@herjarsa/omo-meta-governor 0.50.1 → 0.50.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/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import{createRequire as XO}from"node:module";var JO=Object.defineProperty;var KO=(e)=>e;function YO(e,t){this[e]=KO.bind(null,t)}var An=(e,t)=>{for(var n in t)JO(e,n,{get:t[n],enumerable:!0,configurable:!0,set:YO.bind(t,n)})};var Cr=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(o){n=[o]}if(n)throw n[0];return t};var Z1=XO(import.meta.url);import{existsSync as Ud,mkdirSync as QO,readFileSync as e0,writeFileSync as t0,unlinkSync as lS,copyFileSync as r0}from"node:fs";import{dirname as n0,join as vt,resolve as o0}from"node:path";import{homedir as i0}from"node:os";function uS(){return o0(i0(),".config","opencode")}function rn(e){let t=e??uS();return{log:vt(t,"meta-governor.log"),health:vt(t,"meta-governor-health.json"),selfVersionCache:vt(t,"omo-meta-governor-self-version-cache.json"),upgradeCheck:vt(t,"omo-meta-governor-upgrade-check.json"),cliAnythingUpgradeCheck:vt(t,"omo-cli-anything-upgrade-check.json")}}function ft(e){let t=e??uS(),n=vt(t,"plugins","omo-meta-governor");return{pluginDir:n,logDir:vt(n,"log"),cacheDir:vt(n,"cache"),log:vt(n,"log","meta-governor.log"),health:vt(n,"health.json"),selfVersionCache:vt(n,"cache","self-version.json"),upgradeCheck:vt(n,"cache","upgrade-check.json"),cliAnythingUpgradeCheck:vt(n,"cache","cli-anything-upgrade-check.json"),instructions:vt(n,"instructions.md"),config:vt(n,"config.json")}}function nn(e){let t=[],n=[],o=[[e.oldPaths.log,e.newPaths.log],[e.oldPaths.health,e.newPaths.health],[e.oldPaths.selfVersionCache,e.newPaths.selfVersionCache],[e.oldPaths.upgradeCheck,e.newPaths.upgradeCheck],[e.oldPaths.cliAnythingUpgradeCheck,e.newPaths.cliAnythingUpgradeCheck]];for(let[r,i]of o){if(!Ud(r)){n.push(r);continue}if(Ud(i)){try{lS(r),t.push(r)}catch{n.push(r)}continue}try{QO(n0(i),{recursive:!0}),r0(r,i),lS(r),t.push(r)}catch{n.push(r)}}return{migrated:t,skipped:n}}function s0(e){if(!Ud(e))return{exists:!1};try{let t=e0(e,"utf8"),n=a0(t),o=JSON.parse(n);return{exists:!0,raw:t,data:o}}catch(t){return{exists:!0,error:t instanceof Error?t.message:String(t)}}}function a0(e){let t="",n=0,o=!1,r="",i=!1;while(n<e.length){let s=e[n],a=e[n+1];if(o){if(t+=s,i)i=!1;else if(s==="\\")i=!0;else if(s===r)o=!1;n++;continue}if(s==='"'||s==="'"){o=!0,r=s,t+=s,n++;continue}if(s==="/"&&a==="/"){while(n<e.length&&e[n]!==`
2
- `)n++;continue}if(s==="/"&&a==="*"){n+=2;while(n<e.length&&!(e[n]==="*"&&e[n+1]==="/"))n++;n+=2;continue}t+=s,n++}return t}function H1(e,t){let n=s0(e);if(!n.exists)return{changed:!1,wrote:!1,error:"file not found"};if(n.error||!n.data)return{changed:!1,wrote:!1,error:n.error??"parse error"};let o=n.data,r=o.instructions,i;if(r===void 0)i=[t],o.instructions=i;else if(Array.isArray(r)){if(r.includes(t))return{changed:!1,wrote:!1};r.push(t),i=r}else return{changed:!1,wrote:!1,error:"instructions is not an array"};try{let s=JSON.stringify(o,null,2)+`
3
- `;return t0(e,s,"utf8"),{changed:!0,wrote:!0}}catch(s){return{changed:!1,wrote:!1,error:s instanceof Error?s.message:String(s)}}}var _o=()=>{};import{spawn as c0,spawnSync as Mn}from"node:child_process";function dS(e){try{let t=Mn("pgrep",["-P",String(e)],{encoding:"utf8"});for(let n of t.stdout.trim().split(/\s+/)){let o=Number(n);if(!o)continue;dS(o);try{process.kill(o,"SIGKILL")}catch{}}}catch{}}function Un(e){if(!e||e<=0)return;try{if(process.platform==="win32")Mn("taskkill",["/pid",String(e),"/T","/F"],{stdio:"ignore"});else{try{process.kill(-e,"SIGKILL")}catch{}dS(e);try{process.kill(e,"SIGKILL")}catch{}}}catch{}}function l0(e){if(!e||e<=0)return!1;try{return process.kill(e,0),!0}catch(t){if(t.code==="ESRCH")return!1;return!0}}function Fd(e){if(e&&e>0)Ta.add(e)}function Ea(e){Ta.delete(e)}function $a(){let e=0;for(let t of Ta)if(l0(t))Un(t),e++;return Ta.clear(),e}function Oa(e,t,n){return new Promise((o)=>{let r;try{r=c0(e,t,{cwd:n.cwd,stdio:["ignore","pipe","pipe"],shell:process.platform==="win32",windowsHide:!0,env:{...process.env,OMO_MG_SPAWN:"1",...n.env}})}catch{o({stdout:"",stderr:"",code:null,timedOut:!1});return}Fd(r.pid);let i="",s="",a=!1,l=!1,c,u=(h)=>{if(l)return;if(l=!0,clearTimeout(f),c)clearTimeout(c);Ea(r.pid),o(h)},f=setTimeout(()=>{a=!0,Un(r.pid),c=setTimeout(()=>{u({stdout:i,stderr:s,code:null,timedOut:!0})},2000)},n.timeoutMs);r.stdout?.on("data",(h)=>{i+=h.toString("utf8")}),r.stderr?.on("data",(h)=>{s+=h.toString("utf8")}),r.on("error",()=>{u({stdout:i,stderr:s,code:null,timedOut:a})}),r.on("close",(h)=>{if(r.exitCode===null)Un(r.pid);u({stdout:i,stderr:s,code:h,timedOut:a})})})}function Ke(e,t,n){let o=Date.now(),r;try{r=Mn(e,t,{cwd:n.cwd,stdio:["ignore","pipe","pipe"],shell:process.platform==="win32",windowsHide:!0,env:{...process.env,OMO_MG_SPAWN:"1",...n.env},timeout:n.timeoutMs})}catch{return{stdout:"",stderr:"",code:null,timedOut:!1}}let i=Date.now()-o,s=r.error!=null&&r.error.code==="ETIMEDOUT"||r.signal==="SIGTERM"||i>=n.timeoutMs-50;if(s&&r.pid)Un(r.pid);return{stdout:(r.stdout??"").toString("utf8"),stderr:(r.stderr??"").toString("utf8"),code:r.status,timedOut:s}}function ko(){let e=0;try{if(process.platform==="win32"){for(let t of["graphify.exe","codegraph.exe"])try{Mn("taskkill",["/IM",t,"/F"],{stdio:"ignore"})}catch{}try{if(Mn("powershell",["-NoProfile","-Command","Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -match 'OMO_MG_WATCH|OMO_MG_SPAWN' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"],{stdio:"ignore"}).status===0)e=1}catch{}}else{for(let t of["graphify","codegraph"])try{Mn("pkill",["-x",t],{stdio:"ignore"})}catch{}try{Mn("pkill",["-f","OMO_MG_WATCH|OMO_MG_SPAWN"],{stdio:"ignore"})}catch{}}}catch{}return e}function zd(){if(Nd)return!1;Nd=!0;let e=()=>{try{$a()}catch{}try{ko()}catch{}};Ti.push({event:"exit",fn:e}),process.on("exit",e);let t=(o)=>{e();let r=o==="SIGINT"?130:o==="SIGTERM"?143:o==="SIGHUP"?129:1;process.exit(r)};Ti.push({event:"SIGINT",fn:t}),Ti.push({event:"SIGTERM",fn:t}),Ti.push({event:"SIGHUP",fn:t}),process.on("SIGINT",t),process.on("SIGTERM",t),process.on("SIGHUP",t);let n=()=>{e()};return Ti.push({event:"beforeExit",fn:n}),process.on("beforeExit",n),!0}function Y1(){return Nd}var Ta,Ti,Nd=!1;var Da=Cr(()=>{Ta=new Set;Ti=[]});import{appendFileSync as u0,mkdirSync as d0,statSync as p0,renameSync as m0,existsSync as pS,unlinkSync as f0}from"node:fs";import{dirname as h0}from"node:path";function fS(e){let t=e;for(let n of g0)t=t.replace(n,"[REDACTED]");return t}function Ld(e,t=new WeakSet){if(typeof e==="string")return fS(e);if(Array.isArray(e)){if(t.has(e))return"[Circular]";return t.add(e),e.map((n)=>Ld(n,t))}if(e&&typeof e==="object"){if(t.has(e))return"[Circular]";t.add(e);let n={};for(let[o,r]of Object.entries(e))if(y0.test(o))n[o]="[REDACTED]";else try{n[o]=Ld(r,t)}catch{n[o]="[unserializable]"}return n}return e}function v0(){try{d0(h0(Vt),{recursive:!0})}catch{}}function S0(){if(!pS(Vt))return;try{if(p0(Vt).size<x0)return}catch{return}for(let e=mS;e>=1;e--){let t=e===1?Vt:`${Vt}.${e-1}`,n=`${Vt}.${e}`;if(pS(t))try{if(e===mS)f0(t);else m0(t,n)}catch{}}}function b0(e,t,n,o,r){v0(),S0();let i=fS(t),s=n!==void 0?Ld(n):void 0,a={timestamp:new Date().toISOString(),level:e,message:i,...o?{event:o}:{},...r?{sessionID:r}:{},...s!==void 0?{data:s}:{}},l;try{l=JSON.stringify(a)+`
2
+ `)n++;continue}if(s==="/"&&a==="*"){n+=2;while(n<e.length&&!(e[n]==="*"&&e[n+1]==="/"))n++;n+=2;continue}t+=s,n++}return t}function W1(e,t){let n=s0(e);if(!n.exists)return{changed:!1,wrote:!1,error:"file not found"};if(n.error||!n.data)return{changed:!1,wrote:!1,error:n.error??"parse error"};let o=n.data,r=o.instructions,i;if(r===void 0)i=[t],o.instructions=i;else if(Array.isArray(r)){if(r.includes(t))return{changed:!1,wrote:!1};r.push(t),i=r}else return{changed:!1,wrote:!1,error:"instructions is not an array"};try{let s=JSON.stringify(o,null,2)+`
3
+ `;return t0(e,s,"utf8"),{changed:!0,wrote:!0}}catch(s){return{changed:!1,wrote:!1,error:s instanceof Error?s.message:String(s)}}}var _o=()=>{};import{spawn as c0,spawnSync as Mn}from"node:child_process";function dS(e){try{let t=Mn("pgrep",["-P",String(e)],{encoding:"utf8",windowsHide:!0});for(let n of t.stdout.trim().split(/\s+/)){let o=Number(n);if(!o)continue;dS(o);try{process.kill(o,"SIGKILL")}catch{}}}catch{}}function Un(e){if(!e||e<=0)return;try{if(process.platform==="win32")Mn("taskkill",["/pid",String(e),"/T","/F"],{stdio:"ignore",windowsHide:!0});else{try{process.kill(-e,"SIGKILL")}catch{}dS(e);try{process.kill(e,"SIGKILL")}catch{}}}catch{}}function l0(e){if(!e||e<=0)return!1;try{return process.kill(e,0),!0}catch(t){if(t.code==="ESRCH")return!1;return!0}}function Fd(e){if(e&&e>0)Ta.add(e)}function Ea(e){Ta.delete(e)}function $a(){let e=0;for(let t of Ta)if(l0(t))Un(t),e++;return Ta.clear(),e}function Oa(e,t,n){return new Promise((o)=>{let r;try{r=c0(e,t,{cwd:n.cwd,stdio:["ignore","pipe","pipe"],shell:process.platform==="win32",windowsHide:!0,env:{...process.env,OMO_MG_SPAWN:"1",...n.env}})}catch{o({stdout:"",stderr:"",code:null,timedOut:!1});return}Fd(r.pid);let i="",s="",a=!1,l=!1,c,u=(h)=>{if(l)return;if(l=!0,clearTimeout(f),c)clearTimeout(c);Ea(r.pid),o(h)},f=setTimeout(()=>{a=!0,Un(r.pid),c=setTimeout(()=>{u({stdout:i,stderr:s,code:null,timedOut:!0})},2000)},n.timeoutMs);r.stdout?.on("data",(h)=>{i+=h.toString("utf8")}),r.stderr?.on("data",(h)=>{s+=h.toString("utf8")}),r.on("error",()=>{u({stdout:i,stderr:s,code:null,timedOut:a})}),r.on("close",(h)=>{if(r.exitCode===null)Un(r.pid);u({stdout:i,stderr:s,code:h,timedOut:a})})})}function Ke(e,t,n){let o=Date.now(),r;try{r=Mn(e,t,{cwd:n.cwd,stdio:["ignore","pipe","pipe"],shell:process.platform==="win32",windowsHide:!0,env:{...process.env,OMO_MG_SPAWN:"1",...n.env},timeout:n.timeoutMs})}catch{return{stdout:"",stderr:"",code:null,timedOut:!1}}let i=Date.now()-o,s=r.error!=null&&r.error.code==="ETIMEDOUT"||r.signal==="SIGTERM"||i>=n.timeoutMs-50;if(s&&r.pid)Un(r.pid);return{stdout:(r.stdout??"").toString("utf8"),stderr:(r.stderr??"").toString("utf8"),code:r.status,timedOut:s}}function ko(){let e=0;try{if(process.platform==="win32"){for(let t of["graphify.exe","codegraph.exe"])try{Mn("taskkill",["/IM",t,"/F"],{stdio:"ignore",windowsHide:!0})}catch{}try{if(Mn("powershell",["-NoProfile","-Command","Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -match 'OMO_MG_WATCH|OMO_MG_SPAWN' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"],{stdio:"ignore",windowsHide:!0}).status===0)e=1}catch{}}else{for(let t of["graphify","codegraph"])try{Mn("pkill",["-x",t],{stdio:"ignore",windowsHide:!0})}catch{}try{Mn("pkill",["-f","OMO_MG_WATCH|OMO_MG_SPAWN"],{stdio:"ignore",windowsHide:!0})}catch{}}}catch{}return e}function zd(){if(Nd)return!1;Nd=!0;let e=()=>{try{$a()}catch{}try{ko()}catch{}};Ti.push({event:"exit",fn:e}),process.on("exit",e);let t=(o)=>{e();let r=o==="SIGINT"?130:o==="SIGTERM"?143:o==="SIGHUP"?129:1;process.exit(r)};Ti.push({event:"SIGINT",fn:t}),Ti.push({event:"SIGTERM",fn:t}),Ti.push({event:"SIGHUP",fn:t}),process.on("SIGINT",t),process.on("SIGTERM",t),process.on("SIGHUP",t);let n=()=>{e()};return Ti.push({event:"beforeExit",fn:n}),process.on("beforeExit",n),!0}function Y1(){return Nd}var Ta,Ti,Nd=!1;var Da=Cr(()=>{Ta=new Set;Ti=[]});import{appendFileSync as u0,mkdirSync as d0,statSync as p0,renameSync as m0,existsSync as pS,unlinkSync as f0}from"node:fs";import{dirname as h0}from"node:path";function fS(e){let t=e;for(let n of g0)t=t.replace(n,"[REDACTED]");return t}function Ld(e,t=new WeakSet){if(typeof e==="string")return fS(e);if(Array.isArray(e)){if(t.has(e))return"[Circular]";return t.add(e),e.map((n)=>Ld(n,t))}if(e&&typeof e==="object"){if(t.has(e))return"[Circular]";t.add(e);let n={};for(let[o,r]of Object.entries(e))if(y0.test(o))n[o]="[REDACTED]";else try{n[o]=Ld(r,t)}catch{n[o]="[unserializable]"}return n}return e}function v0(){try{d0(h0(Ht),{recursive:!0})}catch{}}function S0(){if(!pS(Ht))return;try{if(p0(Ht).size<x0)return}catch{return}for(let e=mS;e>=1;e--){let t=e===1?Ht:`${Ht}.${e-1}`,n=`${Ht}.${e}`;if(pS(t))try{if(e===mS)f0(t);else m0(t,n)}catch{}}}function b0(e,t,n,o,r){v0(),S0();let i=fS(t),s=n!==void 0?Ld(n):void 0,a={timestamp:new Date().toISOString(),level:e,message:i,...o?{event:o}:{},...r?{sessionID:r}:{},...s!==void 0?{data:s}:{}},l;try{l=JSON.stringify(a)+`
4
4
  `}catch{l=JSON.stringify({timestamp:a.timestamp,level:e,message:t,data:"[unserializable]"})+`
5
- `}try{u0(Vt,l)}catch{}if(e==="error")console.error(`[meta-governor] ${t}`)}function w(e,t,n){b0(e,t,n)}var g0,y0,Vt,x0=10485760,mS=5;var tr=Cr(()=>{_o();g0=[/eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/g,/sk-(?:proj-|svc-|)[a-zA-Z0-9]{20,}/g,/pk-[a-zA-Z0-9]{20,}/g,/ghp_[a-zA-Z0-9]{36,}/g,/ghs_[a-zA-Z0-9]{36,}/g,/github_pat_[a-zA-Z0-9]{22,}/g,/Bearer\s+[a-zA-Z0-9_\-]{20,}/gi,/(?:key|secret|token|password|credential|private_key)\s*[:=]\s*['"]?[a-zA-Z0-9_\-]{16,}/gi],y0=/^(?:key|secret|token|password|credential|private_key|api[_-]?key|access[_-]?token|auth[_-]?token)$/i;try{nn({oldPaths:rn(),newPaths:ft()})}catch{}Vt=ft().log});import{execSync as Nn,spawn as hS}from"node:child_process";import{access as i4,stat as wS}from"node:fs/promises";import{resolve as jd,join as _0}from"node:path";async function gS(e,t=60000,n){let o=["i","-D","@colbymchenry/codegraph"];if(n)try{return n(`npm ${o.join(" ")}`,{cwd:e,stdio:"ignore",timeout:t}),"codegraph-installed"}catch{return"codegraph-install-failed"}return Ke("npm",o,{cwd:e,timeoutMs:t}).code===0?"codegraph-installed":"codegraph-install-failed"}async function yS(e=60000,t){if(t)try{return t("pip install --upgrade graphifyy --break-system-packages --quiet",{stdio:"ignore",timeout:e}),"graphify-installed"}catch{try{return t("uv tool install --upgrade graphifyy --quiet",{stdio:"ignore",timeout:e}),"graphify-installed"}catch{return"graphify-install-failed"}}if(Ke("pip",["install","--upgrade","graphifyy","--break-system-packages","--quiet"],{timeoutMs:e}).code===0)return"graphify-installed";return Ke("uv",["tool","install","--upgrade","graphifyy","--quiet"],{timeoutMs:e}).code===0?"graphify-installed":"graphify-install-failed"}function l4(){Gd.clear()}async function vS(e,t=Nn){let n=!1,o=!1,r=await bS(jd(e,".codegraph","codegraph.db")),i=await bS(jd(e,"graphify-out","graph.json")),s=(a,l)=>{if(t!==Nn)return t(a,{stdio:"ignore",...l});let c=a.split(" "),u=c[0],f=c.slice(1),h=Ke(u,f,{cwd:l?.cwd??e,timeoutMs:l?.timeout??1e4});if(h.code!==0)throw Error(`exit ${h.code}`)};try{s("npx --yes codegraph --version",{timeout:1e4}),n=!0}catch{try{s("node node_modules/.bin/codegraph --version",{cwd:e,timeout:5000}),n=!0}catch{}}try{s("graphify --version",{timeout:5000}),o=!0}catch{try{s("graphifyy --version",{timeout:5000}),o=!0}catch{try{s('python -c "import graphifyy"',{timeout:5000}),o=!0}catch{try{s('python3 -c "import graphifyy"',{timeout:5000}),o=!0}catch{}}}}return{codegraph:n,graphify:o,codegraphIndexExists:r,graphifyIndexExists:i}}async function k0(e,t=60000,n=Nn){try{if(n!==Nn)n("npx --yes codegraph init",{cwd:e,stdio:"ignore",timeout:t});else{let o=Ke("npx",["--yes","codegraph","init"],{cwd:e,timeoutMs:t});if(o.code!==0)throw Error(`exit ${o.code}`)}return!0}catch{return!1}}async function w0(e,t=120000,n=Nn){let o=[{bin:"graphify",args:[".","--no-viz"]},{bin:"python",args:["-m","graphify",".","--no-viz"]},{bin:"python3",args:["-m","graphify",".","--no-viz"]}];for(let r of o)try{if(n!==Nn)n(`${r.bin} ${r.args.join(" ")}`,{cwd:e,stdio:"ignore",timeout:t});else{let i=Ke(r.bin,r.args,{cwd:e,timeoutMs:t});if(i.code!==0)throw Error(`exit ${i.code}`)}return!0}catch{}return!1}function SS(e,t){let n=`${e}:${t}`;if(Ei.has(n))return;try{let o;if(t==="codegraph")o=hS("node",["-e",`
5
+ `}try{u0(Ht,l)}catch{}if(e==="error")console.error(`[meta-governor] ${t}`)}function w(e,t,n){b0(e,t,n)}var g0,y0,Ht,x0=10485760,mS=5;var tr=Cr(()=>{_o();g0=[/eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/g,/sk-(?:proj-|svc-|)[a-zA-Z0-9]{20,}/g,/pk-[a-zA-Z0-9]{20,}/g,/ghp_[a-zA-Z0-9]{36,}/g,/ghs_[a-zA-Z0-9]{36,}/g,/github_pat_[a-zA-Z0-9]{22,}/g,/Bearer\s+[a-zA-Z0-9_\-]{20,}/gi,/(?:key|secret|token|password|credential|private_key)\s*[:=]\s*['"]?[a-zA-Z0-9_\-]{16,}/gi],y0=/^(?:key|secret|token|password|credential|private_key|api[_-]?key|access[_-]?token|auth[_-]?token)$/i;try{nn({oldPaths:rn(),newPaths:ft()})}catch{}Ht=ft().log});import{execSync as Nn,spawn as hS}from"node:child_process";import{access as i4,stat as wS}from"node:fs/promises";import{resolve as jd,join as _0}from"node:path";async function gS(e,t=60000,n){let o=["i","-D","@colbymchenry/codegraph"];if(n)try{return n(`npm ${o.join(" ")}`,{cwd:e,stdio:"ignore",timeout:t}),"codegraph-installed"}catch{return"codegraph-install-failed"}return Ke("npm",o,{cwd:e,timeoutMs:t}).code===0?"codegraph-installed":"codegraph-install-failed"}async function yS(e=60000,t){if(t)try{return t("pip install --upgrade graphifyy --break-system-packages --quiet",{stdio:"ignore",timeout:e}),"graphify-installed"}catch{try{return t("uv tool install --upgrade graphifyy --quiet",{stdio:"ignore",timeout:e}),"graphify-installed"}catch{return"graphify-install-failed"}}if(Ke("pip",["install","--upgrade","graphifyy","--break-system-packages","--quiet"],{timeoutMs:e}).code===0)return"graphify-installed";return Ke("uv",["tool","install","--upgrade","graphifyy","--quiet"],{timeoutMs:e}).code===0?"graphify-installed":"graphify-install-failed"}function l4(){Gd.clear()}async function vS(e,t=Nn){let n=!1,o=!1,r=await bS(jd(e,".codegraph","codegraph.db")),i=await bS(jd(e,"graphify-out","graph.json")),s=(a,l)=>{if(t!==Nn)return t(a,{stdio:"ignore",...l});let c=a.split(" "),u=c[0],f=c.slice(1),h=Ke(u,f,{cwd:l?.cwd??e,timeoutMs:l?.timeout??1e4});if(h.code!==0)throw Error(`exit ${h.code}`)};try{s("npx --yes codegraph --version",{timeout:1e4}),n=!0}catch{try{s("node node_modules/.bin/codegraph --version",{cwd:e,timeout:5000}),n=!0}catch{}}try{s("graphify --version",{timeout:5000}),o=!0}catch{try{s("graphifyy --version",{timeout:5000}),o=!0}catch{try{s('python -c "import graphifyy"',{timeout:5000}),o=!0}catch{try{s('python3 -c "import graphifyy"',{timeout:5000}),o=!0}catch{}}}}return{codegraph:n,graphify:o,codegraphIndexExists:r,graphifyIndexExists:i}}async function k0(e,t=60000,n=Nn){try{if(n!==Nn)n("npx --yes codegraph init",{cwd:e,stdio:"ignore",timeout:t});else{let o=Ke("npx",["--yes","codegraph","init"],{cwd:e,timeoutMs:t});if(o.code!==0)throw Error(`exit ${o.code}`)}return!0}catch{return!1}}async function w0(e,t=120000,n=Nn){let o=[{bin:"graphify",args:[".","--no-viz"]},{bin:"python",args:["-m","graphify",".","--no-viz"]},{bin:"python3",args:["-m","graphify",".","--no-viz"]}];for(let r of o)try{if(n!==Nn)n(`${r.bin} ${r.args.join(" ")}`,{cwd:e,stdio:"ignore",timeout:t});else{let i=Ke(r.bin,r.args,{cwd:e,timeoutMs:t});if(i.code!==0)throw Error(`exit ${i.code}`)}return!0}catch{}return!1}function SS(e,t){let n=`${e}:${t}`;if(Ei.has(n))return;try{let o;if(t==="codegraph")o=hS("node",["-e",`
6
6
  const OMO_MG_WATCH = 1;
7
7
  const {spawn} = require("child_process");
8
8
  const run = () => {
@@ -18,8 +18,8 @@ import{createRequire as XO}from"node:module";var JO=Object.defineProperty;var KO
18
18
  };
19
19
  run();
20
20
  setInterval(run, 30_000);
21
- `],{stdio:"ignore",detached:!0,shell:!1,env:{...process.env,OMO_MG_SPAWN:"1"}});else o=hS("python3",["-m","graphify",".","--no-viz","--watch"],{cwd:e,stdio:"ignore",detached:!0,shell:!1,env:{...process.env,OMO_MG_SPAWN:"1"}});o.unref(),Ei.set(n,{process:o,tool:t}),Fd(o.pid),o.on("exit",()=>{Ei.delete(n),Ea(o.pid)})}catch{}}function qd(e){for(let[t,n]of Ei)if(!e||t.startsWith(e)){let o=n.process.pid;if(o)Ea(o);if(process.platform==="win32")Un(o);else{try{n.process.kill("SIGTERM")}catch{}setTimeout(()=>{Un(o)},2000).unref()}Ei.delete(t)}}async function Ca(e={enabled:!0,watch:!1,autoInstall:!0,installTimeoutMs:60000}){let t=[],n=e.projectDir??process.cwd();if(!e.enabled)return{attempted:!1,codes:["disabled"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:!1,graphifyIndexExists:!1},alreadyInitialized:!1};if(e.killOrphanedOnInit!==!1&&!xS){xS=!0;let r=ko();Zd("info","orphan sweep: killed "+r+" leftover tool processes")}if(Gd.has(n)){let r=await vS(n,e.runner);return{attempted:!1,codes:r.codegraphIndexExists?["codegraph-already-exists"]:[],availability:r,alreadyInitialized:!0}}Gd.add(n);let o;try{o=await vS(n,e.runner)}catch{return{attempted:!1,codes:["error"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:!1,graphifyIndexExists:!1},alreadyInitialized:!1}}if(e.autoUpgrade!==!1)try{let r=e.upgradeCachePath??T0(),i=await E0(r),s=e.upgradeCheckTtlMs??86400000,a={codegraph:null,graphify:null},l=async(c)=>{let u=c==="codegraph"?"codegraphLatest":"graphifyLatest";if(IS(i,s)&&i?.[u])return i[u];let h=await(c==="codegraph"?O0:D0)();return a[c]=h,h};if(o.codegraph){let c=await kS(e.runner),u=await l("codegraph");if(_S(c,u,i,s,"codegraphLatest")){if(u&&Bd(c,u)){if(await gS(n,e.installTimeoutMs??60000,e.runner)==="codegraph-installed"){if(t.push("codegraph-upgraded"),await kS(e.runner)==null)t.push("codegraph-upgrade-broken")}}}}if(o.graphify){let c=await P0(e.runner),u=await l("graphify");if(_S(c,u,i,s,"graphifyLatest")){if(u&&Bd(c,u)){if(await yS(e.installTimeoutMs??60000,e.runner)==="graphify-installed")t.push("graphify-upgraded")}}if(e.checkGraphifyNeedsUpdate!==!1)try{if((e.runner?(()=>{try{return e.runner("graphify check-update "+n,{cwd:n,stdio:"ignore",timeout:1e4}),{code:0,stdout:"",stderr:""}}catch{return{code:1,stdout:"",stderr:"runner rejected"}}})():Ke("graphify",["check-update",n],{cwd:n,timeoutMs:1e4})).code!==0){if(e.runner)try{e.runner("graphify update "+n+" --no-cluster",{cwd:n,stdio:"ignore",timeout:e.installTimeoutMs??60000})}catch{}else Ke("graphify",["update",n,"--no-cluster"],{cwd:n,timeoutMs:e.installTimeoutMs??60000});t.push("graphify-reextract-triggered")}}catch{}}try{await $0(r,{checkedAtMs:Date.now(),codegraphLatest:a.codegraph??i?.codegraphLatest,graphifyLatest:a.graphify??i?.graphifyLatest}),t.push("upgrade-cache-written")}catch{}}catch{t.push("upgrade-check-skipped")}if(e.autoInstall!==!1){if(!o.codegraph){let r=await gS(n,e.installTimeoutMs??60000,e.runner);if(t.push(r),r==="codegraph-installed")o.codegraph=!0}if(!o.graphify){let r=await yS(e.installTimeoutMs??60000,e.runner);if(t.push(r),r==="graphify-installed")o.graphify=!0}}else{if(!o.codegraph)t.push("codegraph-install-skipped");if(!o.graphify)t.push("graphify-install-skipped")}if(o.codegraph)if(!o.codegraphIndexExists){let r=await k0(n,e.installTimeoutMs??60000);t.push(r?"codegraph-initialized":"codegraph-init-failed")}else t.push("codegraph-already-exists");else t.push("codegraph-unavailable");if(o.graphify){if(!o.graphifyIndexExists){let r=await w0(n,e.installTimeoutMs??120000);t.push(r?"graphify-initialized":"graphify-init-failed")}else t.push("graphify-already-exists");try{if(!await Hd(n)){if(Ke("graphify",["hook","install"],{cwd:n,timeoutMs:1e4}).code===0)t.push("graphify-hook-installed")}}catch{}}else t.push("graphify-unavailable");if(e.watch){if(o.codegraph)SS(n,"codegraph"),t.push("watch-started-codegraph");if(o.graphify)SS(n,"graphify"),t.push("watch-started-graphify")}if(e.addToGlobalGraph===!0&&o.graphify)try{await Oa("graphify",["global","add",_0(n,"graphify-out")],{cwd:n,timeoutMs:1e4}),t.push("graphify-added-to-global")}catch{t.push("graphify-global-add-failed")}return{attempted:!0,codes:t,availability:o,alreadyInitialized:!1}}async function Pa(e){try{return(await wS(e)).isDirectory()}catch{return!1}}async function bS(e){try{return(await wS(e)).isFile()}catch{return!1}}function Vd(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])git\s+commit(?:\s+-|\s|$)/.test(t)}async function Wd(e,t){if(await Pa(jd(e,".codegraph")))return await I0(e,t);return await Ca({enabled:!0,watch:!1,autoInstall:!1,installTimeoutMs:5000,projectDir:e,runner:t})}async function Hd(e){let{access:t,readFile:n}=await import("node:fs/promises"),{resolve:o}=await import("node:path"),r=o(e,".git","hooks","post-commit");try{await t(r)}catch{return!1}try{return(await n(r,"utf-8")).includes("graphify-hook-start")}catch{return!1}}async function I0(e,t){let{resolve:n}=await import("node:path"),o=[],r=await Pa(n(e,".codegraph"));if(r){try{if(t)t("npx --yes codegraph sync -q",{cwd:e,stdio:"ignore",timeout:30000});else Ke("npx",["--yes","codegraph","sync","-q"],{cwd:e,timeoutMs:30000});o.push("codegraph-already-exists"),Zd("info",`codegraph sync -q completed for ${e}`)}catch(s){Zd("warn",`codegraph sync failed for ${e}: ${s}`),o.push("codegraph-install-failed")}return{attempted:!0,codes:o,availability:{codegraph:!0,graphify:!1,codegraphIndexExists:r,graphifyIndexExists:await Pa(n(e,"graphify-out"))},alreadyInitialized:!1}}let i=!1;try{if(t)t("npx --yes codegraph --version",{stdio:"ignore",timeout:5000});else if(Ke("npx",["--yes","codegraph","--version"],{timeoutMs:5000}).code!==0)throw Error("codegraph probe failed");i=!0}catch{try{if(t)t("node node_modules/.bin/codegraph --version",{cwd:e,stdio:"ignore",timeout:5000});else if(Ke("node",["node_modules/.bin/codegraph","--version"],{cwd:e,timeoutMs:5000}).code!==0)throw Error("local codegraph probe failed");i=!0}catch{}}if(!i)return{attempted:!0,codes:["codegraph-unavailable"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:r,graphifyIndexExists:await Pa(n(e,"graphify-out"))},alreadyInitialized:!1};return await Ca({enabled:!0,watch:!1,autoInstall:!1,installTimeoutMs:5000,projectDir:e,runner:t})}function Bd(e,t){if(e==null&&t)return!0;if(!t)return!1;let n=e,o=t;if(!n||n===o)return!1;let r=/^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/;if(!r.test(n)||!r.test(o))return!1;let i=(y)=>{let[k="",S=""]=y.split("-",2),I=k.split(".").map((me)=>{let Ee=Number.parseInt(me,10);return Number.isFinite(Ee)?Ee:0}),[D=0,R=0,M=0]=I;return[D,R,M,S]},[s,a,l,c]=i(n),[u,f,h,m]=i(o);if(u!==s)return u>s;if(f!==a)return f>a;if(h!==l)return h>l;if(c&&!m)return!0;if(!c&&m)return!1;return m>c}function T0(){return ft().upgradeCheck}async function E0(e){try{let{readFile:t}=await import("node:fs/promises"),n=await t(e,"utf-8"),o=JSON.parse(n);if(typeof o?.checkedAtMs==="number")return o;return null}catch{return null}}async function $0(e,t){let{dirname:n}=await import("node:path"),{mkdir:o,writeFile:r}=await import("node:fs/promises"),i=n(e);try{await o(i,{recursive:!0}),await r(e,JSON.stringify(t,null,2))}catch{}}function IS(e,t){if(!e)return!1;let n=Date.now()-e.checkedAtMs;return n>=0&&n<t}function _S(e,t,n,o,r="codegraphLatest"){let i=t;if(IS(n,o))i=n?.[r]??i;if(!e&&!i)return!1;if(!i)return!1;if(!e)return!0;return Bd(e,i)}async function O0(){try{let t=Ke("npm",["view","@colbymchenry/codegraph","version"],{timeoutMs:1e4}).stdout.trim();return t.length>0?t:null}catch{return null}}async function D0(e=Nn){for(let t of["python","python3"])try{let r=(Ke(t,["-m","pip","index","versions","graphifyy"],{timeoutMs:1e4}).stdout.split(`
22
- `)[0]??"").match(/graphifyy\s*\(?([0-9]+\.[0-9]+\.[0-9]+[^\s)]*)/);if(r)return r[1]}catch{}for(let t of["python","python3"])try{let o=Ke(t,["-c","import urllib.request, json; d=json.load(urllib.request.urlopen('https://pypi.org/pypi/graphifyy/json')); print(d['info']['version'])"],{timeoutMs:1e4}).stdout.trim();if(o.length>0)return o}catch{}return null}async function kS(e){let t=[{bin:"npx",args:["--yes","codegraph","--version"]},{bin:"node",args:["node_modules/.bin/codegraph","--version"]}];for(let{bin:n,args:o}of t)try{let r;if(e){let s=e(`${n} ${o.join(" ")}`,{stdio:"ignore",timeout:1e4});r=typeof s==="string"?s:s.toString()}else r=Ke(n,o,{timeoutMs:1e4}).stdout;let i=r.match(/([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(i)return i[1]}catch{}return null}async function P0(e){let t=(n,o)=>{if(e){let r=e(`${n} ${o.join(" ")}`,{stdio:"ignore",timeout:1e4});return typeof r==="string"?r:r.toString()}return Ke(n,o,{timeoutMs:1e4}).stdout};try{let o=t("graphify",["--version"]).match(/([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(o)return o[1]}catch{}try{let o=t("python",["-m","pip","show","graphifyy"]).match(/Version:\s*([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(o)return o[1]}catch{}try{let o=t("python3",["-m","pip","show","graphifyy"]).match(/Version:\s*([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(o)return o[1]}catch{}return null}function TS(e,t,n){let o=n?(i)=>n(i,{cwd:e}).toString():void 0,r=t;try{if(!r)if(o)r=o("git rev-parse --abbrev-ref HEAD").trim();else r=Ke("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,timeoutMs:5000}).stdout.trim();if(o)o(`git fetch origin ${r}`);else Ke("git",["fetch","origin",r],{cwd:e,timeoutMs:30000});let i;if(o)i=o(`git rev-list --count HEAD..origin/${r}`);else i=Ke("git",["rev-list","--count",`HEAD..origin/${r}`],{cwd:e,timeoutMs:1e4}).stdout;let s=Number.parseInt(i.trim(),10);return Number.isFinite(s)&&s>0?s:0}catch{return 0}}var Gd,xS=!1,Ei,Zd;var Ra=Cr(()=>{_o();Da();tr();try{nn({oldPaths:rn(),newPaths:ft()})}catch{}Gd=new Set;Ei=new Map;Zd=w});import{execSync as C0}from"node:child_process";function St(e,t,n){try{return{ok:!0,stdout:t(e,{timeoutMs:n}),stderr:"",timedOut:!1}}catch(o){let r=o,i=typeof r.stdout==="string"?r.stdout:r.stdout instanceof Buffer?r.stdout.toString("utf8"):"",s=typeof r.stderr==="string"?r.stderr:r.stderr instanceof Buffer?r.stderr.toString("utf8"):r.message??"",a=/timed out|ETIMEDOUT|timeout/i.test(s);return{ok:!1,stdout:i,stderr:s,timedOut:a}}}function Aa(e=rr){let t=St("pip show cli-anything-hub",e,1e4);if(!t.ok)t=St("pip3 show cli-anything-hub",e,1e4);if(!t.ok)t=St("python -m pip show cli-anything-hub",e,1e4);if(!t.ok)return null;let n=t.stdout.match(/^Version:\s*([\d.]+[^\s]*)/m);return n?n[1].trim():null}function ES(e=rr){let t=St("pip index versions cli-anything-hub",e,1e4);if(!t.ok)t=St("pip3 index versions cli-anything-hub",e,1e4);if(!t.ok)t=St("python -m pip index versions cli-anything-hub",e,1e4);if(!t.ok)return null;let n=t.stdout.match(/^\S+\s+\(([\d.]+[^\s,)]*)/m);return n?n[1].trim():null}function $S(e,t){if(e===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.split(/[.+-]/).map((r)=>Number.parseInt(r,10)||0),o=t.split(/[.+-]/).map((r)=>Number.parseInt(r,10)||0);for(let r=0;r<Math.max(n.length,o.length);r++){let i=n[r]??0,s=o[r]??0;if(i<s)return-1;if(i>s)return 1}return 0}function OS(e=rr,t=60000){let n=Date.now(),o=["uv tool install cli-anything-hub","uv pip install --system --break-system-packages cli-anything-hub","pip install --user cli-anything-hub","pip install cli-anything-hub"],r="";for(let i of o){let s=St(i,e,t);if(s.ok)return{ok:!0,data:null,rawOutput:s.stdout,stderr:s.stderr,durationMs:Date.now()-n,code:"cli-anything-install-succeeded"};r=s.stderr}return{ok:!1,data:null,rawOutput:null,stderr:r.slice(0,500),durationMs:Date.now()-n,code:"cli-anything-install-failed"}}function DS(e=rr,t=60000){let n=Date.now(),o=["uv tool upgrade cli-anything-hub","uv tool install --upgrade cli-anything-hub","uv pip install --system --upgrade --break-system-packages cli-anything-hub","pip install --user --upgrade cli-anything-hub","pip install --upgrade cli-anything-hub"],r="";for(let i of o){let s=St(i,e,t);if(s.ok)return{ok:!0,data:null,rawOutput:s.stdout,stderr:s.stderr,durationMs:Date.now()-n,code:"cli-anything-upgrade-succeeded"};r=s.stderr}return{ok:!1,data:null,rawOutput:null,stderr:r.slice(0,500),durationMs:Date.now()-n,code:"cli-anything-upgrade-failed"}}function PS(e={},t=rr,n=30000,o="cli-hub"){let r=Date.now(),i=["list","--json"];if(e.category)i.push("--category",e.category);if(e.source)i.push("--source",e.source);let s=St(`${o} ${i.join(" ")}`,t,n);if(!s.ok)return{ok:!1,data:null,rawOutput:s.stdout,stderr:s.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-list-failed"};try{return{ok:!0,data:JSON.parse(s.stdout),rawOutput:null,stderr:s.stderr,durationMs:Date.now()-r,code:"cli-hub-list-succeeded"}}catch{return{ok:!1,data:null,rawOutput:s.stdout,stderr:"Failed to parse cli-hub list JSON output",durationMs:Date.now()-r,code:"cli-hub-list-failed"}}}function CS(e,t=rr,n=30000,o="cli-hub"){let r=Date.now();if(!e.trim())return{ok:!1,data:null,rawOutput:null,stderr:"empty query",durationMs:0,code:"cli-hub-search-failed"};let i=St(`${o} search "${e}" --json`,t,n);if(!i.ok)return{ok:!1,data:null,rawOutput:i.stdout,stderr:i.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-search-failed"};try{return{ok:!0,data:JSON.parse(i.stdout),rawOutput:null,stderr:i.stderr,durationMs:Date.now()-r,code:"cli-hub-search-succeeded"}}catch{return{ok:!1,data:null,rawOutput:i.stdout,stderr:"Failed to parse cli-hub search JSON output",durationMs:Date.now()-r,code:"cli-hub-search-failed"}}}function RS(e,t=rr,n=1e4,o="cli-hub"){let r=Date.now(),i=St(`${o} info "${e}"`,t,n);if(!i.ok)return{ok:!1,data:null,rawOutput:i.stdout,stderr:i.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-info-failed"};return{ok:!0,data:i.stdout,rawOutput:null,stderr:i.stderr,durationMs:Date.now()-r,code:"cli-hub-info-succeeded"}}function AS(e,t=rr,n=120000,o="cli-hub"){let r=Date.now(),i=St(`${o} install "${e}"`,t,n);if(!i.ok)return{ok:!1,data:null,rawOutput:i.stdout,stderr:i.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-install-failed"};return{ok:!0,data:null,rawOutput:i.stdout,stderr:i.stderr,durationMs:Date.now()-r,code:"cli-hub-install-succeeded"}}function MS(e="global",t=rr,n=60000,o="npx skills"){let r=Date.now(),s=`${o} add HKUDS/CLI-Anything --skill cli-hub-meta-skill ${e==="global"?"-g":"-p"} -y`,a=St(s,t,n);if(!a.ok)return{ok:!1,data:null,rawOutput:a.stdout,stderr:a.stderr.slice(0,500),durationMs:Date.now()-r,code:"skill-install-failed"};return{ok:!0,data:null,rawOutput:a.stdout,stderr:a.stderr,durationMs:Date.now()-r,code:"skill-install-succeeded"}}function US(e="global",t=rr,n=60000,o="npx skills"){let r=Date.now(),s=`${o} update cli-hub-meta-skill ${e==="global"?"-g":"-p"} -y`,a=St(s,t,n);if(!a.ok)return{ok:!1,data:null,rawOutput:a.stdout,stderr:a.stderr.slice(0,500),durationMs:Date.now()-r,code:"skill-upgrade-failed"};return{ok:!0,data:null,rawOutput:a.stdout,stderr:a.stderr,durationMs:Date.now()-r,code:"skill-upgrade-succeeded"}}function NS(e="global",t=rr,n=1e4,o="npx skills"){let i=St(`${o} list ${e==="global"?"-g":"-p"}`,t,n);if(!i.ok)return!1;return/cli-hub-meta-skill/i.test(i.stdout)}var rr=(e,t)=>C0(e,{timeout:t?.timeoutMs??1e4,encoding:"utf8",stdio:["ignore","pipe","pipe"]}).toString();var wo=()=>{};import{AsyncLocalStorage as lA}from"node:async_hooks";function Yc(e){if(e){let t=Date.now();if(t-H_>1000)H_=t,Promise.resolve().then(() => (tr(),{})).then(({})=>{w("info","SessionBridge: OpenCode client hydrated — session.prompt() available")}).catch((n)=>{Promise.resolve().then(() => (tr(),{})).then(({})=>w("warn",`session-bridge setSessionClient log init failed: ${String(n)}`))})}Kc=e}function ys(){return(Hg.getStore()??Kc)!==null}async function Bn(e,t){let n=Date.now(),o=t.timeoutMs??15000,r=Hg.getStore()??Kc;if(!r)return{ok:!1,messageID:null,error:"SessionBridge: no OpenCode client captured (plugin not initialized?)",durationMs:0};if(!e)return{ok:!1,messageID:null,error:"SessionBridge: sessionID is required",durationMs:0};let i=JSON.stringify(t.mcpArgs,null,2),l={type:"text",text:`${t.preamble??"The user wants to record this."}
21
+ `],{stdio:"ignore",detached:!0,shell:!1,windowsHide:!0,env:{...process.env,OMO_MG_SPAWN:"1"}});else o=hS("python3",["-m","graphify",".","--no-viz","--watch"],{cwd:e,stdio:"ignore",detached:!0,shell:!1,windowsHide:!0,env:{...process.env,OMO_MG_SPAWN:"1"}});o.unref(),Ei.set(n,{process:o,tool:t}),Fd(o.pid),o.on("exit",()=>{Ei.delete(n),Ea(o.pid)})}catch{}}function qd(e){for(let[t,n]of Ei)if(!e||t.startsWith(e)){let o=n.process.pid;if(o)Ea(o);if(process.platform==="win32")Un(o);else{try{n.process.kill("SIGTERM")}catch{}setTimeout(()=>{Un(o)},2000).unref()}Ei.delete(t)}}async function Ca(e={enabled:!0,watch:!1,autoInstall:!0,installTimeoutMs:60000}){let t=[],n=e.projectDir??process.cwd();if(!e.enabled)return{attempted:!1,codes:["disabled"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:!1,graphifyIndexExists:!1},alreadyInitialized:!1};if(e.killOrphanedOnInit!==!1&&!xS){xS=!0;let r=ko();Zd("info","orphan sweep: killed "+r+" leftover tool processes")}if(Gd.has(n)){let r=await vS(n,e.runner);return{attempted:!1,codes:r.codegraphIndexExists?["codegraph-already-exists"]:[],availability:r,alreadyInitialized:!0}}Gd.add(n);let o;try{o=await vS(n,e.runner)}catch{return{attempted:!1,codes:["error"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:!1,graphifyIndexExists:!1},alreadyInitialized:!1}}if(e.autoUpgrade!==!1)try{let r=e.upgradeCachePath??T0(),i=await E0(r),s=e.upgradeCheckTtlMs??86400000,a={codegraph:null,graphify:null},l=async(c)=>{let u=c==="codegraph"?"codegraphLatest":"graphifyLatest";if(IS(i,s)&&i?.[u])return i[u];let h=await(c==="codegraph"?O0:D0)();return a[c]=h,h};if(o.codegraph){let c=await kS(e.runner),u=await l("codegraph");if(_S(c,u,i,s,"codegraphLatest")){if(u&&Bd(c,u)){if(await gS(n,e.installTimeoutMs??60000,e.runner)==="codegraph-installed"){if(t.push("codegraph-upgraded"),await kS(e.runner)==null)t.push("codegraph-upgrade-broken")}}}}if(o.graphify){let c=await P0(e.runner),u=await l("graphify");if(_S(c,u,i,s,"graphifyLatest")){if(u&&Bd(c,u)){if(await yS(e.installTimeoutMs??60000,e.runner)==="graphify-installed")t.push("graphify-upgraded")}}if(e.checkGraphifyNeedsUpdate!==!1)try{if((e.runner?(()=>{try{return e.runner("graphify check-update "+n,{cwd:n,stdio:"ignore",timeout:1e4}),{code:0,stdout:"",stderr:""}}catch{return{code:1,stdout:"",stderr:"runner rejected"}}})():Ke("graphify",["check-update",n],{cwd:n,timeoutMs:1e4})).code!==0){if(e.runner)try{e.runner("graphify update "+n+" --no-cluster",{cwd:n,stdio:"ignore",timeout:e.installTimeoutMs??60000})}catch{}else Ke("graphify",["update",n,"--no-cluster"],{cwd:n,timeoutMs:e.installTimeoutMs??60000});t.push("graphify-reextract-triggered")}}catch{}}try{await $0(r,{checkedAtMs:Date.now(),codegraphLatest:a.codegraph??i?.codegraphLatest,graphifyLatest:a.graphify??i?.graphifyLatest}),t.push("upgrade-cache-written")}catch{}}catch{t.push("upgrade-check-skipped")}if(e.autoInstall!==!1){if(!o.codegraph){let r=await gS(n,e.installTimeoutMs??60000,e.runner);if(t.push(r),r==="codegraph-installed")o.codegraph=!0}if(!o.graphify){let r=await yS(e.installTimeoutMs??60000,e.runner);if(t.push(r),r==="graphify-installed")o.graphify=!0}}else{if(!o.codegraph)t.push("codegraph-install-skipped");if(!o.graphify)t.push("graphify-install-skipped")}if(o.codegraph)if(!o.codegraphIndexExists){let r=await k0(n,e.installTimeoutMs??60000);t.push(r?"codegraph-initialized":"codegraph-init-failed")}else t.push("codegraph-already-exists");else t.push("codegraph-unavailable");if(o.graphify){if(!o.graphifyIndexExists){let r=await w0(n,e.installTimeoutMs??120000);t.push(r?"graphify-initialized":"graphify-init-failed")}else t.push("graphify-already-exists");try{if(!await Wd(n)){if(Ke("graphify",["hook","install"],{cwd:n,timeoutMs:1e4}).code===0)t.push("graphify-hook-installed")}}catch{}}else t.push("graphify-unavailable");if(e.watch){if(o.codegraph)SS(n,"codegraph"),t.push("watch-started-codegraph");if(o.graphify)SS(n,"graphify"),t.push("watch-started-graphify")}if(e.addToGlobalGraph===!0&&o.graphify)try{await Oa("graphify",["global","add",_0(n,"graphify-out")],{cwd:n,timeoutMs:1e4}),t.push("graphify-added-to-global")}catch{t.push("graphify-global-add-failed")}return{attempted:!0,codes:t,availability:o,alreadyInitialized:!1}}async function Pa(e){try{return(await wS(e)).isDirectory()}catch{return!1}}async function bS(e){try{return(await wS(e)).isFile()}catch{return!1}}function Hd(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])git\s+commit(?:\s+-|\s|$)/.test(t)}async function Vd(e,t){if(await Pa(jd(e,".codegraph")))return await I0(e,t);return await Ca({enabled:!0,watch:!1,autoInstall:!1,installTimeoutMs:5000,projectDir:e,runner:t})}async function Wd(e){let{access:t,readFile:n}=await import("node:fs/promises"),{resolve:o}=await import("node:path"),r=o(e,".git","hooks","post-commit");try{await t(r)}catch{return!1}try{return(await n(r,"utf-8")).includes("graphify-hook-start")}catch{return!1}}async function I0(e,t){let{resolve:n}=await import("node:path"),o=[],r=await Pa(n(e,".codegraph"));if(r){try{if(t)t("npx --yes codegraph sync -q",{cwd:e,stdio:"ignore",timeout:30000});else Ke("npx",["--yes","codegraph","sync","-q"],{cwd:e,timeoutMs:30000});o.push("codegraph-already-exists"),Zd("info",`codegraph sync -q completed for ${e}`)}catch(s){Zd("warn",`codegraph sync failed for ${e}: ${s}`),o.push("codegraph-install-failed")}return{attempted:!0,codes:o,availability:{codegraph:!0,graphify:!1,codegraphIndexExists:r,graphifyIndexExists:await Pa(n(e,"graphify-out"))},alreadyInitialized:!1}}let i=!1;try{if(t)t("npx --yes codegraph --version",{stdio:"ignore",timeout:5000});else if(Ke("npx",["--yes","codegraph","--version"],{timeoutMs:5000}).code!==0)throw Error("codegraph probe failed");i=!0}catch{try{if(t)t("node node_modules/.bin/codegraph --version",{cwd:e,stdio:"ignore",timeout:5000});else if(Ke("node",["node_modules/.bin/codegraph","--version"],{cwd:e,timeoutMs:5000}).code!==0)throw Error("local codegraph probe failed");i=!0}catch{}}if(!i)return{attempted:!0,codes:["codegraph-unavailable"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:r,graphifyIndexExists:await Pa(n(e,"graphify-out"))},alreadyInitialized:!1};return await Ca({enabled:!0,watch:!1,autoInstall:!1,installTimeoutMs:5000,projectDir:e,runner:t})}function Bd(e,t){if(e==null&&t)return!0;if(!t)return!1;let n=e,o=t;if(!n||n===o)return!1;let r=/^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/;if(!r.test(n)||!r.test(o))return!1;let i=(y)=>{let[k="",S=""]=y.split("-",2),I=k.split(".").map((me)=>{let Ee=Number.parseInt(me,10);return Number.isFinite(Ee)?Ee:0}),[D=0,R=0,M=0]=I;return[D,R,M,S]},[s,a,l,c]=i(n),[u,f,h,m]=i(o);if(u!==s)return u>s;if(f!==a)return f>a;if(h!==l)return h>l;if(c&&!m)return!0;if(!c&&m)return!1;return m>c}function T0(){return ft().upgradeCheck}async function E0(e){try{let{readFile:t}=await import("node:fs/promises"),n=await t(e,"utf-8"),o=JSON.parse(n);if(typeof o?.checkedAtMs==="number")return o;return null}catch{return null}}async function $0(e,t){let{dirname:n}=await import("node:path"),{mkdir:o,writeFile:r}=await import("node:fs/promises"),i=n(e);try{await o(i,{recursive:!0}),await r(e,JSON.stringify(t,null,2))}catch{}}function IS(e,t){if(!e)return!1;let n=Date.now()-e.checkedAtMs;return n>=0&&n<t}function _S(e,t,n,o,r="codegraphLatest"){let i=t;if(IS(n,o))i=n?.[r]??i;if(!e&&!i)return!1;if(!i)return!1;if(!e)return!0;return Bd(e,i)}async function O0(){try{let t=Ke("npm",["view","@colbymchenry/codegraph","version"],{timeoutMs:1e4}).stdout.trim();return t.length>0?t:null}catch{return null}}async function D0(e=Nn){for(let t of["python","python3"])try{let r=(Ke(t,["-m","pip","index","versions","graphifyy"],{timeoutMs:1e4}).stdout.split(`
22
+ `)[0]??"").match(/graphifyy\s*\(?([0-9]+\.[0-9]+\.[0-9]+[^\s)]*)/);if(r)return r[1]}catch{}for(let t of["python","python3"])try{let o=Ke(t,["-c","import urllib.request, json; d=json.load(urllib.request.urlopen('https://pypi.org/pypi/graphifyy/json')); print(d['info']['version'])"],{timeoutMs:1e4}).stdout.trim();if(o.length>0)return o}catch{}return null}async function kS(e){let t=[{bin:"npx",args:["--yes","codegraph","--version"]},{bin:"node",args:["node_modules/.bin/codegraph","--version"]}];for(let{bin:n,args:o}of t)try{let r;if(e){let s=e(`${n} ${o.join(" ")}`,{stdio:"ignore",timeout:1e4});r=typeof s==="string"?s:s.toString()}else r=Ke(n,o,{timeoutMs:1e4}).stdout;let i=r.match(/([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(i)return i[1]}catch{}return null}async function P0(e){let t=(n,o)=>{if(e){let r=e(`${n} ${o.join(" ")}`,{stdio:"ignore",timeout:1e4});return typeof r==="string"?r:r.toString()}return Ke(n,o,{timeoutMs:1e4}).stdout};try{let o=t("graphify",["--version"]).match(/([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(o)return o[1]}catch{}try{let o=t("python",["-m","pip","show","graphifyy"]).match(/Version:\s*([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(o)return o[1]}catch{}try{let o=t("python3",["-m","pip","show","graphifyy"]).match(/Version:\s*([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(o)return o[1]}catch{}return null}function TS(e,t,n){let o=n?(i)=>n(i,{cwd:e}).toString():void 0,r=t;try{if(!r)if(o)r=o("git rev-parse --abbrev-ref HEAD").trim();else r=Ke("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,timeoutMs:5000}).stdout.trim();if(o)o(`git fetch origin ${r}`);else Ke("git",["fetch","origin",r],{cwd:e,timeoutMs:30000});let i;if(o)i=o(`git rev-list --count HEAD..origin/${r}`);else i=Ke("git",["rev-list","--count",`HEAD..origin/${r}`],{cwd:e,timeoutMs:1e4}).stdout;let s=Number.parseInt(i.trim(),10);return Number.isFinite(s)&&s>0?s:0}catch{return 0}}var Gd,xS=!1,Ei,Zd;var Ra=Cr(()=>{_o();Da();tr();try{nn({oldPaths:rn(),newPaths:ft()})}catch{}Gd=new Set;Ei=new Map;Zd=w});import{execSync as C0}from"node:child_process";function St(e,t,n){try{return{ok:!0,stdout:t(e,{timeoutMs:n}),stderr:"",timedOut:!1}}catch(o){let r=o,i=typeof r.stdout==="string"?r.stdout:r.stdout instanceof Buffer?r.stdout.toString("utf8"):"",s=typeof r.stderr==="string"?r.stderr:r.stderr instanceof Buffer?r.stderr.toString("utf8"):r.message??"",a=/timed out|ETIMEDOUT|timeout/i.test(s);return{ok:!1,stdout:i,stderr:s,timedOut:a}}}function Aa(e=rr){let t=St("pip show cli-anything-hub",e,1e4);if(!t.ok)t=St("pip3 show cli-anything-hub",e,1e4);if(!t.ok)t=St("python -m pip show cli-anything-hub",e,1e4);if(!t.ok)return null;let n=t.stdout.match(/^Version:\s*([\d.]+[^\s]*)/m);return n?n[1].trim():null}function ES(e=rr){let t=St("pip index versions cli-anything-hub",e,1e4);if(!t.ok)t=St("pip3 index versions cli-anything-hub",e,1e4);if(!t.ok)t=St("python -m pip index versions cli-anything-hub",e,1e4);if(!t.ok)return null;let n=t.stdout.match(/^\S+\s+\(([\d.]+[^\s,)]*)/m);return n?n[1].trim():null}function $S(e,t){if(e===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.split(/[.+-]/).map((r)=>Number.parseInt(r,10)||0),o=t.split(/[.+-]/).map((r)=>Number.parseInt(r,10)||0);for(let r=0;r<Math.max(n.length,o.length);r++){let i=n[r]??0,s=o[r]??0;if(i<s)return-1;if(i>s)return 1}return 0}function OS(e=rr,t=60000){let n=Date.now(),o=["uv tool install cli-anything-hub","uv pip install --system --break-system-packages cli-anything-hub","pip install --user cli-anything-hub","pip install cli-anything-hub"],r="";for(let i of o){let s=St(i,e,t);if(s.ok)return{ok:!0,data:null,rawOutput:s.stdout,stderr:s.stderr,durationMs:Date.now()-n,code:"cli-anything-install-succeeded"};r=s.stderr}return{ok:!1,data:null,rawOutput:null,stderr:r.slice(0,500),durationMs:Date.now()-n,code:"cli-anything-install-failed"}}function DS(e=rr,t=60000){let n=Date.now(),o=["uv tool upgrade cli-anything-hub","uv tool install --upgrade cli-anything-hub","uv pip install --system --upgrade --break-system-packages cli-anything-hub","pip install --user --upgrade cli-anything-hub","pip install --upgrade cli-anything-hub"],r="";for(let i of o){let s=St(i,e,t);if(s.ok)return{ok:!0,data:null,rawOutput:s.stdout,stderr:s.stderr,durationMs:Date.now()-n,code:"cli-anything-upgrade-succeeded"};r=s.stderr}return{ok:!1,data:null,rawOutput:null,stderr:r.slice(0,500),durationMs:Date.now()-n,code:"cli-anything-upgrade-failed"}}function PS(e={},t=rr,n=30000,o="cli-hub"){let r=Date.now(),i=["list","--json"];if(e.category)i.push("--category",e.category);if(e.source)i.push("--source",e.source);let s=St(`${o} ${i.join(" ")}`,t,n);if(!s.ok)return{ok:!1,data:null,rawOutput:s.stdout,stderr:s.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-list-failed"};try{return{ok:!0,data:JSON.parse(s.stdout),rawOutput:null,stderr:s.stderr,durationMs:Date.now()-r,code:"cli-hub-list-succeeded"}}catch{return{ok:!1,data:null,rawOutput:s.stdout,stderr:"Failed to parse cli-hub list JSON output",durationMs:Date.now()-r,code:"cli-hub-list-failed"}}}function CS(e,t=rr,n=30000,o="cli-hub"){let r=Date.now();if(!e.trim())return{ok:!1,data:null,rawOutput:null,stderr:"empty query",durationMs:0,code:"cli-hub-search-failed"};let i=St(`${o} search "${e}" --json`,t,n);if(!i.ok)return{ok:!1,data:null,rawOutput:i.stdout,stderr:i.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-search-failed"};try{return{ok:!0,data:JSON.parse(i.stdout),rawOutput:null,stderr:i.stderr,durationMs:Date.now()-r,code:"cli-hub-search-succeeded"}}catch{return{ok:!1,data:null,rawOutput:i.stdout,stderr:"Failed to parse cli-hub search JSON output",durationMs:Date.now()-r,code:"cli-hub-search-failed"}}}function RS(e,t=rr,n=1e4,o="cli-hub"){let r=Date.now(),i=St(`${o} info "${e}"`,t,n);if(!i.ok)return{ok:!1,data:null,rawOutput:i.stdout,stderr:i.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-info-failed"};return{ok:!0,data:i.stdout,rawOutput:null,stderr:i.stderr,durationMs:Date.now()-r,code:"cli-hub-info-succeeded"}}function AS(e,t=rr,n=120000,o="cli-hub"){let r=Date.now(),i=St(`${o} install "${e}"`,t,n);if(!i.ok)return{ok:!1,data:null,rawOutput:i.stdout,stderr:i.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-install-failed"};return{ok:!0,data:null,rawOutput:i.stdout,stderr:i.stderr,durationMs:Date.now()-r,code:"cli-hub-install-succeeded"}}function MS(e="global",t=rr,n=60000,o="npx skills"){let r=Date.now(),s=`${o} add HKUDS/CLI-Anything --skill cli-hub-meta-skill ${e==="global"?"-g":"-p"} -y`,a=St(s,t,n);if(!a.ok)return{ok:!1,data:null,rawOutput:a.stdout,stderr:a.stderr.slice(0,500),durationMs:Date.now()-r,code:"skill-install-failed"};return{ok:!0,data:null,rawOutput:a.stdout,stderr:a.stderr,durationMs:Date.now()-r,code:"skill-install-succeeded"}}function US(e="global",t=rr,n=60000,o="npx skills"){let r=Date.now(),s=`${o} update cli-hub-meta-skill ${e==="global"?"-g":"-p"} -y`,a=St(s,t,n);if(!a.ok)return{ok:!1,data:null,rawOutput:a.stdout,stderr:a.stderr.slice(0,500),durationMs:Date.now()-r,code:"skill-upgrade-failed"};return{ok:!0,data:null,rawOutput:a.stdout,stderr:a.stderr,durationMs:Date.now()-r,code:"skill-upgrade-succeeded"}}function NS(e="global",t=rr,n=1e4,o="npx skills"){let i=St(`${o} list ${e==="global"?"-g":"-p"}`,t,n);if(!i.ok)return!1;return/cli-hub-meta-skill/i.test(i.stdout)}var rr=(e,t)=>C0(e,{timeout:t?.timeoutMs??1e4,encoding:"utf8",stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString();var wo=()=>{};import{AsyncLocalStorage as lA}from"node:async_hooks";function Yc(e){if(e){let t=Date.now();if(t-W_>1000)W_=t,Promise.resolve().then(() => (tr(),{})).then(({})=>{w("info","SessionBridge: OpenCode client hydrated — session.prompt() available")}).catch((n)=>{Promise.resolve().then(() => (tr(),{})).then(({})=>w("warn",`session-bridge setSessionClient log init failed: ${String(n)}`))})}Kc=e}function ys(){return(Wg.getStore()??Kc)!==null}async function Bn(e,t){let n=Date.now(),o=t.timeoutMs??15000,r=Wg.getStore()??Kc;if(!r)return{ok:!1,messageID:null,error:"SessionBridge: no OpenCode client captured (plugin not initialized?)",durationMs:0};if(!e)return{ok:!1,messageID:null,error:"SessionBridge: sessionID is required",durationMs:0};let i=JSON.stringify(t.mcpArgs,null,2),l={type:"text",text:`${t.preamble??"The user wants to record this."}
23
23
 
24
24
  Please call the \`${t.mcpTool}\` MCP tool with EXACTLY these args:
25
25
 
@@ -28,15 +28,15 @@ Please call the \`${t.mcpTool}\` MCP tool with EXACTLY these args:
28
28
  \`\`\`
29
29
 
30
30
  Do not paraphrase, modify, or add fields. Pass the args through verbatim.
31
- After the tool call, briefly confirm what you stored and for which tool.`};try{return{ok:!0,messageID:(await K_(r.session.prompt({path:{id:e},body:{parts:[l]}}),o,`session.prompt for ${t.mcpTool}`))?.data?.info?.id??null,error:null,durationMs:Date.now()-n}}catch(c){return{ok:!1,messageID:null,error:c instanceof Error?c.message:String(c),durationMs:Date.now()-n}}}async function Xc(e,t,n=1e4){let o=Date.now(),r=Hg.getStore()??Kc;if(!r)return{ok:!1,messageID:null,error:"SessionBridge: no OpenCode client captured (plugin not initialized?)",durationMs:0};if(!e||!t)return{ok:!1,messageID:null,error:"SessionBridge: sessionID and text are required",durationMs:0};let i={type:"text",text:t};try{return{ok:!0,messageID:(await K_(r.session.prompt({path:{id:e},body:{parts:[i]}}),n,`session.prompt persist for ${e}`))?.data?.info?.id??null,error:null,durationMs:Date.now()-o}}catch(s){return{ok:!1,messageID:null,error:s instanceof Error?s.message:String(s),durationMs:Date.now()-o}}}async function J_(e,t){return Xc(e,t)}function K_(e,t,n){return new Promise((o,r)=>{let i=setTimeout(()=>{r(Error(`${n} timed out after ${t}ms`))},t);e.then((s)=>{clearTimeout(i),o(s)},(s)=>{clearTimeout(i),r(s)})})}function Y_(e){if(e.target==="oracle")return`[MetaGovernor] Escalation triggered. Reason: ${e.reasoning}
31
+ After the tool call, briefly confirm what you stored and for which tool.`};try{return{ok:!0,messageID:(await K_(r.session.prompt({path:{id:e},body:{parts:[l]}}),o,`session.prompt for ${t.mcpTool}`))?.data?.info?.id??null,error:null,durationMs:Date.now()-n}}catch(c){return{ok:!1,messageID:null,error:c instanceof Error?c.message:String(c),durationMs:Date.now()-n}}}async function Xc(e,t,n=1e4){let o=Date.now(),r=Wg.getStore()??Kc;if(!r)return{ok:!1,messageID:null,error:"SessionBridge: no OpenCode client captured (plugin not initialized?)",durationMs:0};if(!e||!t)return{ok:!1,messageID:null,error:"SessionBridge: sessionID and text are required",durationMs:0};let i={type:"text",text:t};try{return{ok:!0,messageID:(await K_(r.session.prompt({path:{id:e},body:{parts:[i]}}),n,`session.prompt persist for ${e}`))?.data?.info?.id??null,error:null,durationMs:Date.now()-o}}catch(s){return{ok:!1,messageID:null,error:s instanceof Error?s.message:String(s),durationMs:Date.now()-o}}}async function J_(e,t){return Xc(e,t)}function K_(e,t,n){return new Promise((o,r)=>{let i=setTimeout(()=>{r(Error(`${n} timed out after ${t}ms`))},t);e.then((s)=>{clearTimeout(i),o(s)},(s)=>{clearTimeout(i),r(s)})})}function Y_(e){if(e.target==="oracle")return`[MetaGovernor] Escalation triggered. Reason: ${e.reasoning}
32
32
 
33
33
  Please invoke the \`task\` tool with \`subagent_type=oracle\` to perform a verification pass on the current session state. Decision context: ${e.evidenceCount} evidence unit(s). After Oracle returns, you should continue with the recommended action.`;return`[MetaGovernor] Escalation to user required. Reason: ${e.reasoning}
34
34
 
35
- Present a clear summary to the user with the deviation(s) detected and your recommended next steps. Wait for explicit user input before proceeding.`}var Hg,H_=0,Kc=null;var xs=Cr(()=>{Hg=new lA});var X_=()=>{};import{readFile as kA,access as wA}from"node:fs/promises";import{resolve as IA,join as TA}from"node:path";import{homedir as EA}from"node:os";function $A(e){let t=[],n=0;while(n<e.length){let r=e[n];if(r==='"'||r==="'"){let i=r;t.push(i),n++;while(n<e.length){let s=e[n];if(t.push(s),s==="\\"){if(n++,n<e.length)t.push(e[n])}else if(s===i){n++;break}n++}continue}if(r==="/"&&n+1<e.length&&e[n+1]==="/"){n+=2;while(n<e.length&&e[n]!==`
36
- `)n++;continue}if(r==="/"&&n+1<e.length&&e[n+1]==="*"){n+=2;while(n<e.length){if(e[n]==="*"&&n+1<e.length&&e[n+1]==="/"){n+=2;break}n++}continue}t.push(r),n++}let o=t.join("");for(let r=0;r<10;r++){let i=o;if(o=o.replace(/,(\s*[\]}])/g,"$1"),o===i)break}return o}function OA(e,t){try{let n=$A(e);return JSON.parse(n)}catch(n){Promise.resolve().then(() => (tr(),{})).then(({})=>w("warn",`JSONC parse failed for ${t??"<inline>"}: ${n instanceof Error?n.message:String(n)}`));return}}function DA(){return IA(EA(),".config","opencode",gk)}function PA(e){let t=e??process.cwd();return TA(t,".opencode",gk)}async function CA(e){try{return await wA(e),!0}catch{return!1}}async function fk(e){if(!await CA(e))return;try{let t=await kA(e,"utf-8");return OA(t,e)}catch(t){let n=t instanceof Error?t.message:String(t);w("warn","jsonc_parse_failed",{path:e,error:n,hint:"Check syntax: comments must use // or /* */, no trailing commas. Run `node -e \"JSON.parse(require('fs').readFileSync('"+e+"','utf-8').replace(/\\/\\*[\\s\\S]*?\\*\\//g,'').replace(/\\/\\/[^\\n]*/g,'').replace(/,(\\s*[}\\]])/g,'$1'))\"` to isolate the issue."});return}}function Fl(e,t){let n={...e};for(let o of Object.keys(t)){let r=t[o],i=n[o];if(r===void 0)continue;if(hk(r)&&hk(i))n[o]=Fl(i,r);else n[o]=r}return n}function hk(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}async function zl(e={}){let t=[],n="defaults",o={},r=e.userConfigPath??DA(),i=await fk(r);if(i)o=Fl(o,i),t.push(`user:${r}`),n="user";let s=PA(e.projectDir),a=await fk(s);if(a)o=Fl(o,a),t.push(`project:${s}`),n="project";if(e.cliOptions&&Object.keys(e.cliOptions).length>0)o=Fl(o,e.cliOptions),t.push("cli:inline"),n="cli";return{config:o,sources:t,effectiveSource:n}}var gk="omo-meta-governor.jsonc";var Xg=Cr(()=>{tr()});import{execFileSync as VM}from"node:child_process";function my(e,t=1e4){try{return VM("gh",e,{encoding:"utf-8",timeout:t,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().replace(/\r\n/g,`
37
- `).trim()}catch{return null}}function WM(e){let t=my(["run","list","--limit","1","--commit",e,"--json","databaseId,status,conclusion,displayTitle,headSha,url"],1e4);if(!t)return null;try{return JSON.parse(t)[0]??null}catch{return null}}function HM(e,t){let n=my(["workflow","run",e,"--ref",t],15000);return null}function JM(e,t=4000){let n=my(["run","view",String(e),"--log-failed"],30000);if(!n)return"";if(n.length<=t)return n;return n.slice(0,t)+`
35
+ Present a clear summary to the user with the deviation(s) detected and your recommended next steps. Wait for explicit user input before proceeding.`}var Wg,W_=0,Kc=null;var xs=Cr(()=>{Wg=new lA});var X_=()=>{};import{readFile as kA,access as wA}from"node:fs/promises";import{resolve as IA,join as TA}from"node:path";import{homedir as EA}from"node:os";function $A(e){let t=[],n=0;while(n<e.length){let r=e[n];if(r==='"'||r==="'"){let i=r;t.push(i),n++;while(n<e.length){let s=e[n];if(t.push(s),s==="\\"){if(n++,n<e.length)t.push(e[n])}else if(s===i){n++;break}n++}continue}if(r==="/"&&n+1<e.length&&e[n+1]==="/"){n+=2;while(n<e.length&&e[n]!==`
36
+ `)n++;continue}if(r==="/"&&n+1<e.length&&e[n+1]==="*"){n+=2;while(n<e.length){if(e[n]==="*"&&n+1<e.length&&e[n+1]==="/"){n+=2;break}n++}continue}t.push(r),n++}let o=t.join("");for(let r=0;r<10;r++){let i=o;if(o=o.replace(/,(\s*[\]}])/g,"$1"),o===i)break}return o}function OA(e,t){try{let n=$A(e);return JSON.parse(n)}catch(n){Promise.resolve().then(() => (tr(),{})).then(({})=>w("warn",`JSONC parse failed for ${t??"<inline>"}: ${n instanceof Error?n.message:String(n)}`));return}}function DA(){return IA(EA(),".config","opencode",gk)}function PA(e){let t=e??process.cwd();return TA(t,".opencode",gk)}async function CA(e){try{return await wA(e),!0}catch{return!1}}async function fk(e){if(!await CA(e))return;try{let t=await kA(e,"utf-8");return OA(t,e)}catch(t){let n=t instanceof Error?t.message:String(t);w("warn","jsonc_parse_failed",{path:e,error:n,hint:"Check syntax: comments must use // or /* */, no trailing commas. Run `node -e \"JSON.parse(require('fs').readFileSync('"+e+"','utf-8').replace(/\\/\\*[\\s\\S]*?\\*\\//g,'').replace(/\\/\\/[^\\n]*/g,'').replace(/,(\\s*[}\\]])/g,'$1'))\"` to isolate the issue."});return}}function Fl(e,t){let n={...e};for(let o of Object.keys(t)){let r=t[o],i=n[o];if(r===void 0)continue;if(hk(r)&&hk(i))n[o]=Fl(i,r);else n[o]=r}return n}function hk(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}async function zl(e={}){let t=[],n="defaults",o={},r=e.userConfigPath??DA(),i=await fk(r);if(i)o=Fl(o,i),t.push(`user:${r}`),n="user";let s=PA(e.projectDir),a=await fk(s);if(a)o=Fl(o,a),t.push(`project:${s}`),n="project";if(e.cliOptions&&Object.keys(e.cliOptions).length>0)o=Fl(o,e.cliOptions),t.push("cli:inline"),n="cli";return{config:o,sources:t,effectiveSource:n}}var gk="omo-meta-governor.jsonc";var Xg=Cr(()=>{tr()});import{execFileSync as HM}from"node:child_process";function my(e,t=1e4){try{return HM("gh",e,{encoding:"utf-8",timeout:t,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().replace(/\r\n/g,`
37
+ `).trim()}catch{return null}}function VM(e){let t=my(["run","list","--limit","1","--commit",e,"--json","databaseId,status,conclusion,displayTitle,headSha,url"],1e4);if(!t)return null;try{return JSON.parse(t)[0]??null}catch{return null}}function WM(e,t){let n=my(["workflow","run",e,"--ref",t],15000);return null}function JM(e,t=4000){let n=my(["run","view",String(e),"--log-failed"],30000);if(!n)return"";if(n.length<=t)return n;return n.slice(0,t)+`
38
38
 
39
- … (${n.length-t} chars truncated) …`}var sw=()=>{};Ra();Da();import{randomUUID as OB,createHash as KM}from"node:crypto";import{fileURLToPath as aw}from"node:url";_o();wo();import{existsSync as R0,readFileSync as A0,writeFileSync as M0,mkdirSync as U0}from"node:fs";import{dirname as N0}from"node:path";import{execSync as F0}from"node:child_process";try{nn({oldPaths:rn(),newPaths:ft()})}catch{}function z0(e){if(!R0(e))return null;try{return JSON.parse(A0(e,"utf8"))}catch{return null}}function L0(e,t){try{U0(N0(e),{recursive:!0}),M0(e,JSON.stringify(t,null,2),"utf8")}catch{}}async function FS(e={}){let t={enabled:e.enabled??!0,autoInstall:e.autoInstall??!0,autoUpgrade:e.autoUpgrade??!0,cachePath:e.cachePath??ft().cliAnythingUpgradeCheck,upgradeCheckTtlMs:e.upgradeCheckTtlMs??86400000,projectDir:e.projectDir,runner:e.runner,installScope:e.installScope??"global",cliHubBin:e.cliHubBin,skillsBin:e.skillsBin,installTimeoutMs:e.installTimeoutMs??60000};if(!t.enabled)return{attempted:!1,codes:["cli-anything-upgrade-skipped"],availability:{cliHub:!1,cliHubVersion:null,metaSkill:!1},alreadyInitialized:!0};let n=[],o=t.runner??((a,l)=>F0(a,{timeout:l?.timeoutMs??1e4,encoding:"utf8",stdio:["ignore","pipe","pipe"]})),r=Aa(o),i=NS(t.installScope,o,1e4,t.skillsBin),s={cliHub:r!==null,cliHubVersion:r,metaSkill:i};if(r===null&&t.autoInstall){let a=OS(o,t.installTimeoutMs);if(n.push(a.code),a.ok){let l=Aa(o);s.cliHub=!0,s.cliHubVersion=l}}else if(r!==null)n.push("cli-anything-already-installed");if(!i&&t.autoInstall){let a=MS(t.installScope,o,t.installTimeoutMs,t.skillsBin);if(n.push(a.code),a.ok)s.metaSkill=!0}else if(i)n.push("skill-already-current");if(t.autoUpgrade){let a=z0(t.cachePath),l=Date.now(),c=!0;if(a?.updatedAtISO){let f=Date.parse(a.updatedAtISO);if(Number.isFinite(f)&&l-f<t.upgradeCheckTtlMs)c=!1}let u=a?.cliHubLatestVersion??null;if(c)u=ES(o),L0(t.cachePath,{cliHubLatestVersion:u,metaSkillLastCheckedISO:new Date(l).toISOString(),updatedAtISO:new Date(l).toISOString()});if(s.cliHub&&u!==null&&s.cliHubVersion!==null&&$S(u,s.cliHubVersion)>0){let f=DS(o,t.installTimeoutMs);if(n.push(f.code),f.ok){let h=Aa(o);s.cliHubVersion=h}}else if(s.cliHub&&s.cliHubVersion);if(s.metaSkill){let f=US(t.installScope,o,t.installTimeoutMs,t.skillsBin);if(f.ok||/no update/i.test(f.stderr)){if(!n.includes("skill-already-current"))n.push(f.ok?"skill-upgrade-succeeded":"skill-already-current")}else n.push(f.code)}}return{attempted:!0,codes:n,availability:s,alreadyInitialized:!1}}import{homedir as iD}from"node:os";import{join as sD}from"node:path";var zS={limits:{maxLessons:10,maxSlots:20,maxTasks:10},timeouts:{agentmemoryMs:2000,boulderStateMs:1000}};async function ZS(e,t){let n=performance.now(),o={...zS.limits,...e.limits},r={...zS.timeouts,...e.timeouts},[i,s]=await Promise.allSettled([j0(e,t.agentmemory,o,r.agentmemoryMs),G0(e,t.boulderState,o,r.boulderStateMs)]),a=[],l={},c=i.status==="fulfilled"?i.value:(jS(a,l,"agentmemory",LS(i.reason)),GS.agentmemory),u=s.status==="fulfilled"?s.value:(jS(a,l,"boulderState",LS(s.reason)),GS.boulderState);return{query:e.query,timestampISO:new Date().toISOString(),agentmemory:c,boulderState:u,degradedSources:a,durationMs:performance.now()-n,errorMessages:l}}async function j0(e,t,n,o){let r=await BS(t.smartSearch({query:e.query,limit:n.maxLessons}),o,"agentmemory");return{available:!0,lessons:Z0(r.lessons).slice(0,n.maxLessons).map((s)=>({id:s.id,title:s.title,advice:s.advice??"info",confidence:s.confidence,concepts:s.concepts}))}}async function G0(e,t,n,o){let r=await BS(t.boulderRead({directory:e.directory,sessionID:e.sessionID,query:e.query}),o,"boulderState");return{available:!0,tasks:r.sort((s,a)=>s.priority-a.priority||a.updatedAtMs-s.updatedAtMs).slice(0,n.maxTasks).map((s)=>({id:s.id,status:s.status,title:s.title})),planProgress:B0(r)}}function Z0(e){return[...e].sort((t,n)=>n.confidence-t.confidence)}function B0(e){if(e.length===0)return 0;return e.filter((n)=>n.status==="done").length/e.length}function LS(e){if(e instanceof Error)return e.message;if(typeof e==="string")return e;return"unknown error"}function jS(e,t,n,o){e.push(n),t[n]=o}var GS={agentmemory:{available:!1,lessons:[]},boulderState:{available:!1,tasks:[],planProgress:0}};async function BS(e,t,n){return new Promise((o,r)=>{let i=setTimeout(()=>r(Error(`${n} timeout after ${t}ms`)),t);e.then((s)=>{clearTimeout(i),o(s)},(s)=>{clearTimeout(i),r(s)})})}function b4(){return{compactBurnRateThreshold:500,compactUsageThreshold:0.85,switchModelUsageThreshold:0.95,delegateConsecutiveHighBurn:5,windowSize:10}}function q0(e){if(e.length===0)return 0;return e.reduce((n,o)=>n+o,0)/e.length}function V0(e,t){let n=0;for(let o=e.length-1;o>=0;o--)if(e[o]>=t)n++;else break;return n}function W0(e,t,n,o){let r=t-e;if(r<=0)return o;if(n<=0)return null;let i=Math.floor(r/n);if(i<=0)return o;let s=i*2;return new Date(new Date(o).getTime()+s*1000).toISOString()}function qS(e){let{currentUsage:t,modelLimit:n,recentTurnTokens:o,timestampISO:r,config:i}=e,s=o.slice(-i.windowSize),a=q0(s),l=n-t,c=n>0?t/n:1,u=Math.min(0.95,0.3+s.length/i.windowSize*0.65),f="no-action",h=[],m="within normal parameters";if(c>=i.switchModelUsageThreshold)m=`context usage ${(c*100).toFixed(1)}% exceeds switch threshold ${(i.switchModelUsageThreshold*100).toFixed(1)}%`,h.push("switch-model");if(c>=i.compactUsageThreshold||a>=i.compactBurnRateThreshold){if(f==="no-action")f="compact-now",m=c>=i.compactUsageThreshold?`context usage ${(c*100).toFixed(1)}% exceeds compact threshold ${(i.compactUsageThreshold*100).toFixed(1)}%`:`burn rate ${a.toFixed(0)} tokens/turn exceeds threshold ${i.compactBurnRateThreshold}`}let y=V0(s,i.compactBurnRateThreshold);if(y>=i.delegateConsecutiveHighBurn&&f==="no-action")m=`${y} consecutive high-burn turns (threshold: ${i.delegateConsecutiveHighBurn})`,h.push("delegate-to-subagent");let k=W0(t,n,a,r);return{currentUsage:t,burnRate:a,budgetLeft:l,willOverflowAt:k,recommendation:f,recommendations:h,confidence:u,modelLimit:n,windowRemaining:Math.max(0,Math.floor(l/Math.max(a,1))),input:{...e},computedAtISO:r,turnsAnalyzed:s.length}}var gr={"oracle-verified":0.25,"no-progress-detector":0.2,"deviation-detector":0.2,"iteration-budget":0.15,"lesson-recall":0.1,"token-predictor":0.1},Jd=()=>({continueThreshold:0.3,warnThreshold:0.3,escalateThreshold:0.45,stopThreshold:0.55,paralysisThreshold:3,defaultEscalationTarget:"oracle",oracleFrequency:"per-stop"});function H0(e,t){let n=[];n.push({source:"oracle-verified",rawScore:e.oracleVerified?0.6:0,weight:gr["oracle-verified"],weightedScore:e.oracleVerified?0.6*gr["oracle-verified"]:0,description:e.oracleVerified?"Oracle verification passed":"No Oracle verification"}),n.push({source:"no-progress-detector",rawScore:e.noProgress?-0.8:0,weight:gr["no-progress-detector"],weightedScore:e.noProgress?-0.8*gr["no-progress-detector"]:0,description:e.noProgress?"No progress detected in last turn":"Progress detected"});let o=J0(e.deviations,t),r=60000,i=e.deviations.filter((l)=>l.ts===void 0||t-l.ts<=r);n.push({source:"deviation-detector",rawScore:o,weight:gr["deviation-detector"],weightedScore:o*gr["deviation-detector"],description:i.length>0?`${i.length} deviation(s) detected (worst: ${i[0].severity})`:"No deviations detected"});let s=K0(e.iterationRatio);n.push({source:"iteration-budget",rawScore:s,weight:gr["iteration-budget"],weightedScore:s*gr["iteration-budget"],description:`Iteration ratio: ${e.iterationRatio.toFixed(2)} (${e.ambient.iteration}/${e.ambient.maxIterations})`});let a=Y0(e.lessonsRelevant);return n.push({source:"lesson-recall",rawScore:a,weight:gr["lesson-recall"],weightedScore:a*gr["lesson-recall"],description:e.lessonsRelevant.length>0?`${e.lessonsRelevant.length} relevant lesson(s) (avg confidence: ${X0(e.lessonsRelevant).toFixed(2)})`:"No relevant lessons"}),n}function J0(e,t=Date.now()){let o=e.filter((a)=>a.ts===void 0||t-a.ts<=60000);if(o.length===0)return 0;let r={grave:-0.9,media:-0.5,leve:-0.2},i=0;for(let a of o){let l=r[a.severity]??-0.3;if(l<i)i=l}let s=Math.min(o.length*0.05,0.2);return Math.max(i-s,-1)}function K0(e){if(e<=0.5)return-e*0.6;return-0.3-(e-0.5)*1}function Y0(e){if(e.length===0)return 0;let t=0;for(let n of e)t+=({continue:0.3,info:0,warn:-0.3,stop:-0.7}[n.advice]??0)*n.confidence;return Math.max(Math.min(t/e.length,1),-1)}function X0(e){if(e.length===0)return 0;return e.reduce((t,n)=>t+n.confidence,0)/e.length}function Q0(e,t){if(e>=t.continueThreshold)return"continue";if(e<=-t.stopThreshold)return"stop";if(e<=-t.escalateThreshold)return"escalate";if(e<=-t.warnThreshold)return"warn";return"continue"}function eD(e,t,n){if(t.oracleFrequency==="off")return null;if(t.oracleFrequency==="final-only")return null;if(n!=="stop")return null;if(!e.oracleVerified)return"oracle";if(e.deviations.some((o)=>o.severity==="grave"))return"user";return t.defaultEscalationTarget}function VS(e,t,n,o){if(o)return`Paralysis detected: forced continue despite score ${e.toFixed(3)} (too many consecutive stops)`;let r=[...n].sort((c,u)=>c.weightedScore-u.weightedScore),i=r[0],s=r[r.length-1],a=[];if(i.weightedScore<0)a.push(`primary concern: ${i.description}`);if(s.weightedScore>0)a.push(`positive signal: ${s.description}`);return`${{continue:"Continue",warn:"Warn",escalate:"Escalate",stop:"Stop"}[t]} (score: ${e.toFixed(3)}): ${a.join("; ")||"balanced signals"}`}function WS(e,t,n=Date.now()){let o={...Jd(),...t},r=e.deviations.map((m)=>({...m}));if(!Number.isFinite(e.iterationRatio)||!Number.isFinite(e.ambient.iteration)||!Number.isFinite(e.ambient.maxIterations))return{decision:{action:"continue",score:0,reasoning:"Score neutral: NaN detected in input(s); defaulting to continue.",evidence:[],shouldEscalateTo:null},contributions:[],rawScore:0,paralysisOverride:!1,computedAtISO:new Date().toISOString()};let i=H0(e,n),s=i.reduce((m,y)=>m+y.weightedScore,0),a=Math.max(Math.min(s,1),-1),l=e.slotMemory.consecutiveStops>=o.paralysisThreshold&&a<=-o.warnThreshold,c=l?"continue":Q0(a,o),u=[];if(c!=="continue"||Math.abs(a)<o.continueThreshold){for(let m of i)if(Math.abs(m.weightedScore)>0.01)u.push({source:m.source,value:m.description,confidence:Math.abs(m.rawScore),weight:m.weight});if(u.length===0&&c!=="continue")u.push({source:"ambient",value:VS(a,c,i,l),confidence:0.5,weight:0.1})}let f=eD(e,o,c);return{decision:{action:c,score:a,reasoning:VS(a,c,i,l),evidence:u,shouldEscalateTo:f},contributions:i,rawScore:a,paralysisOverride:l,computedAtISO:new Date().toISOString()}}var Kd=()=>({enabled:!0,maxHistoryPerSession:50,forceContinueAfterStops:3,warnMessageTemplate:"[MetaGovernor] Score {score}: {reasoning}. Evidence: {evidenceCount} signal(s).",escalateMessageTemplate:"[MetaGovernor] Escalating to {target}: {reasoning}",stopMessageTemplate:"[MetaGovernor] STOP — {reasoning}. Evidence: {evidenceCount} signal(s)."});function Ma(e,t){let n=e;for(let[o,r]of Object.entries(t))n=n.replaceAll(`{${o}}`,r);return n}function tD(e){return e.length}function HS(e,t){let n={...Kd(),...t};if(!n.enabled)return{action:"continue",message:null,historyEntry:{decision:e.scoringResult.decision,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:"Decision handler disabled — pass-through continue"}};let o=e.scoringResult.decision,{score:r,reasoning:i}=o,s=tD(o.evidence),a=o.shouldEscalateTo??n.defaultEscalationTarget??"oracle";if(e.scoringResult.paralysisOverride)return{action:"continue",message:Ma(n.warnMessageTemplate,{score:r.toFixed(3),reasoning:`Paralysis detected — forced continue. ${i}`,evidenceCount:String(s)}),historyEntry:{decision:o,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:`Paralysis override: ${i}`}};switch(o.action){case"continue":return{action:"continue",message:null,historyEntry:{decision:o,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:i}};case"warn":return{action:"warn",message:Ma(n.warnMessageTemplate,{score:r.toFixed(3),reasoning:i,evidenceCount:String(s)}),historyEntry:{decision:o,action:"warn",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:i}};case"escalate":return{action:"escalate",message:Ma(n.escalateMessageTemplate,{target:a,reasoning:i}),historyEntry:{decision:o,action:"escalate",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:`Escalate to ${a}: ${i}`}};case"stop":return{action:"stop",message:Ma(n.stopMessageTemplate,{reasoning:i,evidenceCount:String(s)}),historyEntry:{decision:o,action:"stop",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:i}}}}function w4(e,t){if(e.length<=t)return{trimmed:[...e],dropped:0};let n=e.length-t;return{trimmed:e.slice(-t),dropped:n}}function JS(e){let t=0;for(let n=e.length-1;n>=0;n--)if(e[n].action==="stop")t++;else break;return t}var KS={leve:0,media:1,grave:2};function rD(e,t,n){let o=`${e}-${t}-${n}`.split("").reduce((r,i)=>(r<<5)-r+i.charCodeAt(0)|0,0);return`D-${Math.abs(o).toString(36)}`}function YS(e,t){let n=KS[t]??0;return e.some((o)=>(KS[o.severity]??0)>=n)}function nD(e,t=[]){let n=new Set;for(let o of e)if(n.add(o.category),n.add(o.severity),o.filePath){let r=o.filePath.split("/").pop()??o.filePath;n.add(r)}for(let o of t){let r=o.split("/").pop()??o;if(r)n.add(r)}return[...n]}function oD(e,t){let n=t.map((o)=>`[${o.severity}] ${o.category}: ${o.detail}`).join("; ");return`Action "${e.action}" (score ${e.score.toFixed(2)}) after deviations: ${n}. Reasoning: ${e.reasoning}`}async function XS(e,t){let{decision:n,config:o,sessionID:r,directory:i,filesChanged:s}=e,a=new Date().toISOString();if(!o.enabled)return{lessonSaved:null,decisionSaved:null,reason:"closed-loop learning disabled"};if(n.evidence.length===0&&n.action==="continue")return{lessonSaved:null,decisionSaved:null,reason:"no deviations to learn from"};let l=null,c=null;if(o.saveDecisions){let y={id:rD(r,n.action,a),timestampISO:a,action:n.action,score:n.score,reasoning:n.reasoning,sessionID:r,directory:i,deviations:n.evidence.filter((k)=>k.source==="deviation-detector").map((k)=>({severity:"media",category:k.source,detail:k.value}))};try{await t.saveMemory({content:`Decision: ${n.action} (score ${n.score.toFixed(2)}). ${n.reasoning}`,concepts:["meta-governor","decision",n.action],type:"fact",files:[...s]}),c=y}catch{}}let u=n.evidence.filter((y)=>y.source==="deviation-detector").map((y)=>({severity:"media",category:y.source,detail:y.value})),f=e.currentLessonCount??0;if(f>=o.maxLessonsPerSession)return{lessonSaved:null,decisionSaved:c,reason:`maxLessonsPerSession cap reached (${f} >= ${o.maxLessonsPerSession})`};let h=o.saveLessons!==!1;if(h&&YS(u,o.minSeverityToLearn)){let y=nD(u,s),k=oD(n,u);try{l={id:(await t.saveLesson({content:k,context:`session:${r} dir:${i}`,confidence:Math.max(0.3,Math.min(0.8,Math.abs(n.score))),tags:y})).id,title:`${n.action} after ${u[0]?.category??"deviation"}`,content:k,type:"pattern",concepts:y,confidence:Math.max(0.3,Math.min(0.8,Math.abs(n.score))),files:[...s],sessionID:r}}catch{}}let m=[];if(c)m.push("decision saved");if(l)m.push("lesson saved");if(!c&&!l)if(!h)m.push("saveLessons disabled");else if(!YS(u,o.minSeverityToLearn))m.push("severity below threshold");else m.push("no saveable content");return{lessonSaved:l,decisionSaved:c,reason:m.join("; ")||"no action taken"}}function Ua(){return{enabled:!0,minSeverityToLearn:"media",maxLessonsPerSession:20,saveDecisions:!0,saveLessons:!0,autoRemember:{enabled:!0,cooldownMs:300000,dedupe:!0}}}var aD=()=>({enabled:!0,memory:{enabled:!0,query:"",timeoutMs:3000},tokenPredictor:{},oracle:{frequency:"per-stop"},scoring:{oracleFrequency:"per-stop"},decision:{},closedLoop:{},intervention:{mode:"silent",includeDecisionHistory:!0,maxHistoryMessages:5,minActionForMessage:"stop",maxInterventionsPerSession:3,respectDoneSignal:!0,phaseAwareDoneSignal:!1,persistToSession:!0,compactionLoopGuard:{enabled:!0,maxOverflowRecoveries:1}},protocolEnforcement:{enabled:!1,path:void 0,injectIntoSystem:!1,auditToolCalls:!1},skillPriming:{enabled:!1,trigger:"firstImplement",router:"both",enforceMode:"directive"},skillHub:{enabled:!1,syncIntervalMs:86400000,bootstrapUrl:"https://skills-library.com/api/skills.json",searchFallbackUrl:"https://skills.sh/api/search",downloadBaseUrl:"https://skills.sh/api/download",embedBaseUrl:"http://127.0.0.1:3114/v1",embedModel:"bge-m3",minInstalls:0,filterDuplicates:!0,depsCheck:!0,choreDir:sD(iD(),".agents","skills"),autoMaterialize:!0},graphSync:{killOrphanedOnInit:!0,reindexOnFetch:!0,fetchBranch:"main",autoUpgrade:!0,upgradeCachePath:void 0,checkGraphifyNeedsUpdate:!0,addToGlobalGraph:!1},graphRetrieval:{preferredTool:"auto",preferLocalCodegraph:!1,contextRouting:!1},cliAnything:{enabled:!0,autoInstall:!0,autoUpgrade:!0,cachePath:void 0,upgradeCheckTtlMs:void 0,cliHubBin:"cli-hub",skillsBin:"npx skills",installScope:"global"}}),Yd={query:"",timestampISO:new Date().toISOString(),agentmemory:{available:!1,lessons:[]},boulderState:{available:!1,tasks:[],planProgress:0},degradedSources:["agentmemory","boulderState"]},cD={consecutiveStops:0,consecutiveContinues:0,lastUpdatedISO:new Date().toISOString()},lD={action:"continue",message:null,historyEntry:{decision:{action:"continue",score:0,reasoning:"no decision made",evidence:[],shouldEscalateTo:null},action:"continue",timestampISO:new Date().toISOString(),sessionID:"",reasoning:"no decision made"}};function uD(e,t=Yd){let n=e.maxIterations>0?e.iteration/e.maxIterations:0,o={...cD,consecutiveStops:e.consecutiveStops??0};return{oracleVerified:e.oracleVerified,noProgress:e.noProgress,deviations:e.deviations,iterationRatio:n,lessonsRelevant:t.agentmemory.lessons,slotMemory:o,ambient:{sessionID:e.sessionID,directory:".",mode:"simple",agentName:e.agentName??"unknown",iteration:e.iteration,maxIterations:e.maxIterations}}}async function eb(e,t={}){let n={...aD(),...t};if(!n.enabled)return{memoryRead:Yd,tokenPrediction:QS(e),scoringResult:{decision:{action:"continue",score:0,reasoning:"MetaGovernor disabled",evidence:[],shouldEscalateTo:null},contributions:[],rawScore:0,paralysisOverride:!1,computedAtISO:new Date().toISOString()},decision:lD,lessonSaved:null,decisionHistory:[],skipped:!0,skipReason:"disabled"};let o=Yd;if(n.memory.enabled)try{let c={agentmemory:e.backends.agentmemory,boulderState:e.backends.boulderState};o=await ZS({directory:".",sessionID:e.sessionID,query:n.memory.query||e.toolName},c)}catch{}let r;try{r=qS({currentUsage:e.recentTurnTokens.reduce((c,u)=>c+u,0),modelLimit:e.modelLimit??t.modelOverride?.modelLimit??200000,recentTurnTokens:e.recentTurnTokens,timestampISO:new Date().toISOString(),providerID:e.providerID??"",modelID:e.modelID??"",config:n.tokenPredictor})}catch{r=QS(e)}let i=WS(uD(e,o),n.scoring),s={sessionID:e.sessionID,scoringResult:i},a=HS(s,n.decision),l=null;try{if(n.closedLoop.enabled!==!1)l=await XS({decision:a.historyEntry.decision,memoryRead:o,config:{...Ua(),...n.closedLoop},sessionID:e.sessionID,directory:".",filesChanged:e.filePaths??[],currentLessonCount:e.currentLessonCount},e.writeBackend)}catch{}return{memoryRead:o,tokenPrediction:r,scoringResult:i,decision:a,lessonSaved:l,decisionHistory:[a.historyEntry],skipped:!1}}function QS(e){let t=e.recentTurnTokens.reduce((n,o)=>n+o,0);return{burnRate:0,budgetLeft:200000,currentUsage:t,modelLimit:200000,willOverflowAt:null,recommendation:"no-action",confidence:1,windowRemaining:200000,input:{currentUsage:t,modelLimit:200000,recentTurnTokens:e.recentTurnTokens,timestampISO:new Date().toISOString(),providerID:e.providerID??"",modelID:e.modelID??"",config:{compactBurnRateThreshold:500,compactUsageThreshold:0.85,switchModelUsageThreshold:0.95,delegateConsecutiveHighBurn:5,windowSize:10}},computedAtISO:new Date().toISOString(),turnsAnalyzed:e.recentTurnTokens.length,recommendations:[]}}import{createRequire as dD}from"node:module";var tb=dD(import.meta.url);function pD(e){if(typeof process<"u"&&process.versions?.bun){let n=tb("bun:sqlite");if(!n.Database)throw Error("sqlite-driver: bun:sqlite loaded but Database export missing");return new n.Database(e,{create:!0})}let t;try{t=tb("node:sqlite")}catch{throw Error("sqlite-driver: node:sqlite is unavailable. omo-meta-governor MCP mode requires Bun, or Node >= 23.4 (Node 22.5-23.3 needs --experimental-sqlite).")}if(!t.DatabaseSync)throw Error("sqlite-driver: node:sqlite loaded but DatabaseSync export missing (Node too old?). Use Bun or Node >= 23.4.");return new t.DatabaseSync(e)}class rb{raw;constructor(e){this.raw=e}run(...e){return this.raw.run(...e)}get(...e){return this.raw.get(...e)}all(...e){let t=this.raw.all(...e);return Array.isArray(t)?t:[]}}class nb{raw;constructor(e){this.raw=e}exec(e){this.raw.exec(e)}prepare(e){return new rb(this.raw.prepare(e))}query(e){return this.prepare(e)}close(){this.raw.close()}}function ob(e){return new nb(pD(e))}import{existsSync as mD,mkdirSync as fD}from"node:fs";import{join as ib}from"node:path";import{homedir as hD}from"node:os";function gD(){let e=ib(hD(),".omo-meta-governor");if(!mD(e))fD(e,{recursive:!0});return ib(e,"meta-governor.db")}var Xd="1",yD=`
39
+ … (${n.length-t} chars truncated) …`}var sw=()=>{};Ra();Da();import{randomUUID as OB,createHash as KM}from"node:crypto";import{fileURLToPath as aw}from"node:url";_o();wo();import{existsSync as R0,readFileSync as A0,writeFileSync as M0,mkdirSync as U0}from"node:fs";import{dirname as N0}from"node:path";import{execSync as F0}from"node:child_process";try{nn({oldPaths:rn(),newPaths:ft()})}catch{}function z0(e){if(!R0(e))return null;try{return JSON.parse(A0(e,"utf8"))}catch{return null}}function L0(e,t){try{U0(N0(e),{recursive:!0}),M0(e,JSON.stringify(t,null,2),"utf8")}catch{}}async function FS(e={}){let t={enabled:e.enabled??!0,autoInstall:e.autoInstall??!0,autoUpgrade:e.autoUpgrade??!0,cachePath:e.cachePath??ft().cliAnythingUpgradeCheck,upgradeCheckTtlMs:e.upgradeCheckTtlMs??86400000,projectDir:e.projectDir,runner:e.runner,installScope:e.installScope??"global",cliHubBin:e.cliHubBin,skillsBin:e.skillsBin,installTimeoutMs:e.installTimeoutMs??60000};if(!t.enabled)return{attempted:!1,codes:["cli-anything-upgrade-skipped"],availability:{cliHub:!1,cliHubVersion:null,metaSkill:!1},alreadyInitialized:!0};let n=[],o=t.runner??((a,l)=>F0(a,{timeout:l?.timeoutMs??1e4,encoding:"utf8",stdio:["ignore","pipe","pipe"],windowsHide:!0})),r=Aa(o),i=NS(t.installScope,o,1e4,t.skillsBin),s={cliHub:r!==null,cliHubVersion:r,metaSkill:i};if(r===null&&t.autoInstall){let a=OS(o,t.installTimeoutMs);if(n.push(a.code),a.ok){let l=Aa(o);s.cliHub=!0,s.cliHubVersion=l}}else if(r!==null)n.push("cli-anything-already-installed");if(!i&&t.autoInstall){let a=MS(t.installScope,o,t.installTimeoutMs,t.skillsBin);if(n.push(a.code),a.ok)s.metaSkill=!0}else if(i)n.push("skill-already-current");if(t.autoUpgrade){let a=z0(t.cachePath),l=Date.now(),c=!0;if(a?.updatedAtISO){let f=Date.parse(a.updatedAtISO);if(Number.isFinite(f)&&l-f<t.upgradeCheckTtlMs)c=!1}let u=a?.cliHubLatestVersion??null;if(c)u=ES(o),L0(t.cachePath,{cliHubLatestVersion:u,metaSkillLastCheckedISO:new Date(l).toISOString(),updatedAtISO:new Date(l).toISOString()});if(s.cliHub&&u!==null&&s.cliHubVersion!==null&&$S(u,s.cliHubVersion)>0){let f=DS(o,t.installTimeoutMs);if(n.push(f.code),f.ok){let h=Aa(o);s.cliHubVersion=h}}else if(s.cliHub&&s.cliHubVersion);if(s.metaSkill){let f=US(t.installScope,o,t.installTimeoutMs,t.skillsBin);if(f.ok||/no update/i.test(f.stderr)){if(!n.includes("skill-already-current"))n.push(f.ok?"skill-upgrade-succeeded":"skill-already-current")}else n.push(f.code)}}return{attempted:!0,codes:n,availability:s,alreadyInitialized:!1}}import{homedir as iD}from"node:os";import{join as sD}from"node:path";var zS={limits:{maxLessons:10,maxSlots:20,maxTasks:10},timeouts:{agentmemoryMs:2000,boulderStateMs:1000}};async function ZS(e,t){let n=performance.now(),o={...zS.limits,...e.limits},r={...zS.timeouts,...e.timeouts},[i,s]=await Promise.allSettled([j0(e,t.agentmemory,o,r.agentmemoryMs),G0(e,t.boulderState,o,r.boulderStateMs)]),a=[],l={},c=i.status==="fulfilled"?i.value:(jS(a,l,"agentmemory",LS(i.reason)),GS.agentmemory),u=s.status==="fulfilled"?s.value:(jS(a,l,"boulderState",LS(s.reason)),GS.boulderState);return{query:e.query,timestampISO:new Date().toISOString(),agentmemory:c,boulderState:u,degradedSources:a,durationMs:performance.now()-n,errorMessages:l}}async function j0(e,t,n,o){let r=await BS(t.smartSearch({query:e.query,limit:n.maxLessons}),o,"agentmemory");return{available:!0,lessons:Z0(r.lessons).slice(0,n.maxLessons).map((s)=>({id:s.id,title:s.title,advice:s.advice??"info",confidence:s.confidence,concepts:s.concepts}))}}async function G0(e,t,n,o){let r=await BS(t.boulderRead({directory:e.directory,sessionID:e.sessionID,query:e.query}),o,"boulderState");return{available:!0,tasks:r.sort((s,a)=>s.priority-a.priority||a.updatedAtMs-s.updatedAtMs).slice(0,n.maxTasks).map((s)=>({id:s.id,status:s.status,title:s.title})),planProgress:B0(r)}}function Z0(e){return[...e].sort((t,n)=>n.confidence-t.confidence)}function B0(e){if(e.length===0)return 0;return e.filter((n)=>n.status==="done").length/e.length}function LS(e){if(e instanceof Error)return e.message;if(typeof e==="string")return e;return"unknown error"}function jS(e,t,n,o){e.push(n),t[n]=o}var GS={agentmemory:{available:!1,lessons:[]},boulderState:{available:!1,tasks:[],planProgress:0}};async function BS(e,t,n){return new Promise((o,r)=>{let i=setTimeout(()=>r(Error(`${n} timeout after ${t}ms`)),t);e.then((s)=>{clearTimeout(i),o(s)},(s)=>{clearTimeout(i),r(s)})})}function b4(){return{compactBurnRateThreshold:500,compactUsageThreshold:0.85,switchModelUsageThreshold:0.95,delegateConsecutiveHighBurn:5,windowSize:10}}function q0(e){if(e.length===0)return 0;return e.reduce((n,o)=>n+o,0)/e.length}function H0(e,t){let n=0;for(let o=e.length-1;o>=0;o--)if(e[o]>=t)n++;else break;return n}function V0(e,t,n,o){let r=t-e;if(r<=0)return o;if(n<=0)return null;let i=Math.floor(r/n);if(i<=0)return o;let s=i*2;return new Date(new Date(o).getTime()+s*1000).toISOString()}function qS(e){let{currentUsage:t,modelLimit:n,recentTurnTokens:o,timestampISO:r,config:i}=e,s=o.slice(-i.windowSize),a=q0(s),l=n-t,c=n>0?t/n:1,u=Math.min(0.95,0.3+s.length/i.windowSize*0.65),f="no-action",h=[],m="within normal parameters";if(c>=i.switchModelUsageThreshold)m=`context usage ${(c*100).toFixed(1)}% exceeds switch threshold ${(i.switchModelUsageThreshold*100).toFixed(1)}%`,h.push("switch-model");if(c>=i.compactUsageThreshold||a>=i.compactBurnRateThreshold){if(f==="no-action")f="compact-now",m=c>=i.compactUsageThreshold?`context usage ${(c*100).toFixed(1)}% exceeds compact threshold ${(i.compactUsageThreshold*100).toFixed(1)}%`:`burn rate ${a.toFixed(0)} tokens/turn exceeds threshold ${i.compactBurnRateThreshold}`}let y=H0(s,i.compactBurnRateThreshold);if(y>=i.delegateConsecutiveHighBurn&&f==="no-action")m=`${y} consecutive high-burn turns (threshold: ${i.delegateConsecutiveHighBurn})`,h.push("delegate-to-subagent");let k=V0(t,n,a,r);return{currentUsage:t,burnRate:a,budgetLeft:l,willOverflowAt:k,recommendation:f,recommendations:h,confidence:u,modelLimit:n,windowRemaining:Math.max(0,Math.floor(l/Math.max(a,1))),input:{...e},computedAtISO:r,turnsAnalyzed:s.length}}var gr={"oracle-verified":0.25,"no-progress-detector":0.2,"deviation-detector":0.2,"iteration-budget":0.15,"lesson-recall":0.1,"token-predictor":0.1},Jd=()=>({continueThreshold:0.3,warnThreshold:0.3,escalateThreshold:0.45,stopThreshold:0.55,paralysisThreshold:3,defaultEscalationTarget:"oracle",oracleFrequency:"per-stop"});function W0(e,t){let n=[];n.push({source:"oracle-verified",rawScore:e.oracleVerified?0.6:0,weight:gr["oracle-verified"],weightedScore:e.oracleVerified?0.6*gr["oracle-verified"]:0,description:e.oracleVerified?"Oracle verification passed":"No Oracle verification"}),n.push({source:"no-progress-detector",rawScore:e.noProgress?-0.8:0,weight:gr["no-progress-detector"],weightedScore:e.noProgress?-0.8*gr["no-progress-detector"]:0,description:e.noProgress?"No progress detected in last turn":"Progress detected"});let o=J0(e.deviations,t),r=60000,i=e.deviations.filter((l)=>l.ts===void 0||t-l.ts<=r);n.push({source:"deviation-detector",rawScore:o,weight:gr["deviation-detector"],weightedScore:o*gr["deviation-detector"],description:i.length>0?`${i.length} deviation(s) detected (worst: ${i[0].severity})`:"No deviations detected"});let s=K0(e.iterationRatio);n.push({source:"iteration-budget",rawScore:s,weight:gr["iteration-budget"],weightedScore:s*gr["iteration-budget"],description:`Iteration ratio: ${e.iterationRatio.toFixed(2)} (${e.ambient.iteration}/${e.ambient.maxIterations})`});let a=Y0(e.lessonsRelevant);return n.push({source:"lesson-recall",rawScore:a,weight:gr["lesson-recall"],weightedScore:a*gr["lesson-recall"],description:e.lessonsRelevant.length>0?`${e.lessonsRelevant.length} relevant lesson(s) (avg confidence: ${X0(e.lessonsRelevant).toFixed(2)})`:"No relevant lessons"}),n}function J0(e,t=Date.now()){let o=e.filter((a)=>a.ts===void 0||t-a.ts<=60000);if(o.length===0)return 0;let r={grave:-0.9,media:-0.5,leve:-0.2},i=0;for(let a of o){let l=r[a.severity]??-0.3;if(l<i)i=l}let s=Math.min(o.length*0.05,0.2);return Math.max(i-s,-1)}function K0(e){if(e<=0.5)return-e*0.6;return-0.3-(e-0.5)*1}function Y0(e){if(e.length===0)return 0;let t=0;for(let n of e)t+=({continue:0.3,info:0,warn:-0.3,stop:-0.7}[n.advice]??0)*n.confidence;return Math.max(Math.min(t/e.length,1),-1)}function X0(e){if(e.length===0)return 0;return e.reduce((t,n)=>t+n.confidence,0)/e.length}function Q0(e,t){if(e>=t.continueThreshold)return"continue";if(e<=-t.stopThreshold)return"stop";if(e<=-t.escalateThreshold)return"escalate";if(e<=-t.warnThreshold)return"warn";return"continue"}function eD(e,t,n){if(t.oracleFrequency==="off")return null;if(t.oracleFrequency==="final-only")return null;if(n!=="stop")return null;if(!e.oracleVerified)return"oracle";if(e.deviations.some((o)=>o.severity==="grave"))return"user";return t.defaultEscalationTarget}function HS(e,t,n,o){if(o)return`Paralysis detected: forced continue despite score ${e.toFixed(3)} (too many consecutive stops)`;let r=[...n].sort((c,u)=>c.weightedScore-u.weightedScore),i=r[0],s=r[r.length-1],a=[];if(i.weightedScore<0)a.push(`primary concern: ${i.description}`);if(s.weightedScore>0)a.push(`positive signal: ${s.description}`);return`${{continue:"Continue",warn:"Warn",escalate:"Escalate",stop:"Stop"}[t]} (score: ${e.toFixed(3)}): ${a.join("; ")||"balanced signals"}`}function VS(e,t,n=Date.now()){let o={...Jd(),...t},r=e.deviations.map((m)=>({...m}));if(!Number.isFinite(e.iterationRatio)||!Number.isFinite(e.ambient.iteration)||!Number.isFinite(e.ambient.maxIterations))return{decision:{action:"continue",score:0,reasoning:"Score neutral: NaN detected in input(s); defaulting to continue.",evidence:[],shouldEscalateTo:null},contributions:[],rawScore:0,paralysisOverride:!1,computedAtISO:new Date().toISOString()};let i=W0(e,n),s=i.reduce((m,y)=>m+y.weightedScore,0),a=Math.max(Math.min(s,1),-1),l=e.slotMemory.consecutiveStops>=o.paralysisThreshold&&a<=-o.warnThreshold,c=l?"continue":Q0(a,o),u=[];if(c!=="continue"||Math.abs(a)<o.continueThreshold){for(let m of i)if(Math.abs(m.weightedScore)>0.01)u.push({source:m.source,value:m.description,confidence:Math.abs(m.rawScore),weight:m.weight});if(u.length===0&&c!=="continue")u.push({source:"ambient",value:HS(a,c,i,l),confidence:0.5,weight:0.1})}let f=eD(e,o,c);return{decision:{action:c,score:a,reasoning:HS(a,c,i,l),evidence:u,shouldEscalateTo:f},contributions:i,rawScore:a,paralysisOverride:l,computedAtISO:new Date().toISOString()}}var Kd=()=>({enabled:!0,maxHistoryPerSession:50,forceContinueAfterStops:3,warnMessageTemplate:"[MetaGovernor] Score {score}: {reasoning}. Evidence: {evidenceCount} signal(s).",escalateMessageTemplate:"[MetaGovernor] Escalating to {target}: {reasoning}",stopMessageTemplate:"[MetaGovernor] STOP — {reasoning}. Evidence: {evidenceCount} signal(s)."});function Ma(e,t){let n=e;for(let[o,r]of Object.entries(t))n=n.replaceAll(`{${o}}`,r);return n}function tD(e){return e.length}function WS(e,t){let n={...Kd(),...t};if(!n.enabled)return{action:"continue",message:null,historyEntry:{decision:e.scoringResult.decision,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:"Decision handler disabled — pass-through continue"}};let o=e.scoringResult.decision,{score:r,reasoning:i}=o,s=tD(o.evidence),a=o.shouldEscalateTo??n.defaultEscalationTarget??"oracle";if(e.scoringResult.paralysisOverride)return{action:"continue",message:Ma(n.warnMessageTemplate,{score:r.toFixed(3),reasoning:`Paralysis detected — forced continue. ${i}`,evidenceCount:String(s)}),historyEntry:{decision:o,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:`Paralysis override: ${i}`}};switch(o.action){case"continue":return{action:"continue",message:null,historyEntry:{decision:o,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:i}};case"warn":return{action:"warn",message:Ma(n.warnMessageTemplate,{score:r.toFixed(3),reasoning:i,evidenceCount:String(s)}),historyEntry:{decision:o,action:"warn",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:i}};case"escalate":return{action:"escalate",message:Ma(n.escalateMessageTemplate,{target:a,reasoning:i}),historyEntry:{decision:o,action:"escalate",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:`Escalate to ${a}: ${i}`}};case"stop":return{action:"stop",message:Ma(n.stopMessageTemplate,{reasoning:i,evidenceCount:String(s)}),historyEntry:{decision:o,action:"stop",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:i}}}}function w4(e,t){if(e.length<=t)return{trimmed:[...e],dropped:0};let n=e.length-t;return{trimmed:e.slice(-t),dropped:n}}function JS(e){let t=0;for(let n=e.length-1;n>=0;n--)if(e[n].action==="stop")t++;else break;return t}var KS={leve:0,media:1,grave:2};function rD(e,t,n){let o=`${e}-${t}-${n}`.split("").reduce((r,i)=>(r<<5)-r+i.charCodeAt(0)|0,0);return`D-${Math.abs(o).toString(36)}`}function YS(e,t){let n=KS[t]??0;return e.some((o)=>(KS[o.severity]??0)>=n)}function nD(e,t=[]){let n=new Set;for(let o of e)if(n.add(o.category),n.add(o.severity),o.filePath){let r=o.filePath.split("/").pop()??o.filePath;n.add(r)}for(let o of t){let r=o.split("/").pop()??o;if(r)n.add(r)}return[...n]}function oD(e,t){let n=t.map((o)=>`[${o.severity}] ${o.category}: ${o.detail}`).join("; ");return`Action "${e.action}" (score ${e.score.toFixed(2)}) after deviations: ${n}. Reasoning: ${e.reasoning}`}async function XS(e,t){let{decision:n,config:o,sessionID:r,directory:i,filesChanged:s}=e,a=new Date().toISOString();if(!o.enabled)return{lessonSaved:null,decisionSaved:null,reason:"closed-loop learning disabled"};if(n.evidence.length===0&&n.action==="continue")return{lessonSaved:null,decisionSaved:null,reason:"no deviations to learn from"};let l=null,c=null;if(o.saveDecisions){let y={id:rD(r,n.action,a),timestampISO:a,action:n.action,score:n.score,reasoning:n.reasoning,sessionID:r,directory:i,deviations:n.evidence.filter((k)=>k.source==="deviation-detector").map((k)=>({severity:"media",category:k.source,detail:k.value}))};try{await t.saveMemory({content:`Decision: ${n.action} (score ${n.score.toFixed(2)}). ${n.reasoning}`,concepts:["meta-governor","decision",n.action],type:"fact",files:[...s]}),c=y}catch{}}let u=n.evidence.filter((y)=>y.source==="deviation-detector").map((y)=>({severity:"media",category:y.source,detail:y.value})),f=e.currentLessonCount??0;if(f>=o.maxLessonsPerSession)return{lessonSaved:null,decisionSaved:c,reason:`maxLessonsPerSession cap reached (${f} >= ${o.maxLessonsPerSession})`};let h=o.saveLessons!==!1;if(h&&YS(u,o.minSeverityToLearn)){let y=nD(u,s),k=oD(n,u);try{l={id:(await t.saveLesson({content:k,context:`session:${r} dir:${i}`,confidence:Math.max(0.3,Math.min(0.8,Math.abs(n.score))),tags:y})).id,title:`${n.action} after ${u[0]?.category??"deviation"}`,content:k,type:"pattern",concepts:y,confidence:Math.max(0.3,Math.min(0.8,Math.abs(n.score))),files:[...s],sessionID:r}}catch{}}let m=[];if(c)m.push("decision saved");if(l)m.push("lesson saved");if(!c&&!l)if(!h)m.push("saveLessons disabled");else if(!YS(u,o.minSeverityToLearn))m.push("severity below threshold");else m.push("no saveable content");return{lessonSaved:l,decisionSaved:c,reason:m.join("; ")||"no action taken"}}function Ua(){return{enabled:!0,minSeverityToLearn:"media",maxLessonsPerSession:20,saveDecisions:!0,saveLessons:!0,autoRemember:{enabled:!0,cooldownMs:300000,dedupe:!0}}}var aD=()=>({enabled:!0,memory:{enabled:!0,query:"",timeoutMs:3000},tokenPredictor:{},oracle:{frequency:"per-stop"},scoring:{oracleFrequency:"per-stop"},decision:{},closedLoop:{},intervention:{mode:"silent",includeDecisionHistory:!0,maxHistoryMessages:5,minActionForMessage:"stop",maxInterventionsPerSession:3,respectDoneSignal:!0,phaseAwareDoneSignal:!1,persistToSession:!0,compactionLoopGuard:{enabled:!0,maxOverflowRecoveries:1}},protocolEnforcement:{enabled:!1,path:void 0,injectIntoSystem:!1,auditToolCalls:!1},skillPriming:{enabled:!1,trigger:"firstImplement",router:"both",enforceMode:"directive"},skillHub:{enabled:!1,syncIntervalMs:86400000,bootstrapUrl:"https://skills-library.com/api/skills.json",searchFallbackUrl:"https://skills.sh/api/search",downloadBaseUrl:"https://skills.sh/api/download",embedBaseUrl:"http://127.0.0.1:3114/v1",embedModel:"bge-m3",minInstalls:0,filterDuplicates:!0,depsCheck:!0,choreDir:sD(iD(),".agents","skills"),autoMaterialize:!0},graphSync:{killOrphanedOnInit:!0,reindexOnFetch:!0,fetchBranch:"main",autoUpgrade:!0,upgradeCachePath:void 0,checkGraphifyNeedsUpdate:!0,addToGlobalGraph:!1},graphRetrieval:{preferredTool:"auto",preferLocalCodegraph:!1,contextRouting:!1},cliAnything:{enabled:!0,autoInstall:!0,autoUpgrade:!0,cachePath:void 0,upgradeCheckTtlMs:void 0,cliHubBin:"cli-hub",skillsBin:"npx skills",installScope:"global"}}),Yd={query:"",timestampISO:new Date().toISOString(),agentmemory:{available:!1,lessons:[]},boulderState:{available:!1,tasks:[],planProgress:0},degradedSources:["agentmemory","boulderState"]},cD={consecutiveStops:0,consecutiveContinues:0,lastUpdatedISO:new Date().toISOString()},lD={action:"continue",message:null,historyEntry:{decision:{action:"continue",score:0,reasoning:"no decision made",evidence:[],shouldEscalateTo:null},action:"continue",timestampISO:new Date().toISOString(),sessionID:"",reasoning:"no decision made"}};function uD(e,t=Yd){let n=e.maxIterations>0?e.iteration/e.maxIterations:0,o={...cD,consecutiveStops:e.consecutiveStops??0};return{oracleVerified:e.oracleVerified,noProgress:e.noProgress,deviations:e.deviations,iterationRatio:n,lessonsRelevant:t.agentmemory.lessons,slotMemory:o,ambient:{sessionID:e.sessionID,directory:".",mode:"simple",agentName:e.agentName??"unknown",iteration:e.iteration,maxIterations:e.maxIterations}}}async function eb(e,t={}){let n={...aD(),...t};if(!n.enabled)return{memoryRead:Yd,tokenPrediction:QS(e),scoringResult:{decision:{action:"continue",score:0,reasoning:"MetaGovernor disabled",evidence:[],shouldEscalateTo:null},contributions:[],rawScore:0,paralysisOverride:!1,computedAtISO:new Date().toISOString()},decision:lD,lessonSaved:null,decisionHistory:[],skipped:!0,skipReason:"disabled"};let o=Yd;if(n.memory.enabled)try{let c={agentmemory:e.backends.agentmemory,boulderState:e.backends.boulderState};o=await ZS({directory:".",sessionID:e.sessionID,query:n.memory.query||e.toolName},c)}catch{}let r;try{r=qS({currentUsage:e.recentTurnTokens.reduce((c,u)=>c+u,0),modelLimit:e.modelLimit??t.modelOverride?.modelLimit??200000,recentTurnTokens:e.recentTurnTokens,timestampISO:new Date().toISOString(),providerID:e.providerID??"",modelID:e.modelID??"",config:n.tokenPredictor})}catch{r=QS(e)}let i=VS(uD(e,o),n.scoring),s={sessionID:e.sessionID,scoringResult:i},a=WS(s,n.decision),l=null;try{if(n.closedLoop.enabled!==!1)l=await XS({decision:a.historyEntry.decision,memoryRead:o,config:{...Ua(),...n.closedLoop},sessionID:e.sessionID,directory:".",filesChanged:e.filePaths??[],currentLessonCount:e.currentLessonCount},e.writeBackend)}catch{}return{memoryRead:o,tokenPrediction:r,scoringResult:i,decision:a,lessonSaved:l,decisionHistory:[a.historyEntry],skipped:!1}}function QS(e){let t=e.recentTurnTokens.reduce((n,o)=>n+o,0);return{burnRate:0,budgetLeft:200000,currentUsage:t,modelLimit:200000,willOverflowAt:null,recommendation:"no-action",confidence:1,windowRemaining:200000,input:{currentUsage:t,modelLimit:200000,recentTurnTokens:e.recentTurnTokens,timestampISO:new Date().toISOString(),providerID:e.providerID??"",modelID:e.modelID??"",config:{compactBurnRateThreshold:500,compactUsageThreshold:0.85,switchModelUsageThreshold:0.95,delegateConsecutiveHighBurn:5,windowSize:10}},computedAtISO:new Date().toISOString(),turnsAnalyzed:e.recentTurnTokens.length,recommendations:[]}}import{createRequire as dD}from"node:module";var tb=dD(import.meta.url);function pD(e){if(typeof process<"u"&&process.versions?.bun){let n=tb("bun:sqlite");if(!n.Database)throw Error("sqlite-driver: bun:sqlite loaded but Database export missing");return new n.Database(e,{create:!0})}let t;try{t=tb("node:sqlite")}catch{throw Error("sqlite-driver: node:sqlite is unavailable. omo-meta-governor MCP mode requires Bun, or Node >= 23.4 (Node 22.5-23.3 needs --experimental-sqlite).")}if(!t.DatabaseSync)throw Error("sqlite-driver: node:sqlite loaded but DatabaseSync export missing (Node too old?). Use Bun or Node >= 23.4.");return new t.DatabaseSync(e)}class rb{raw;constructor(e){this.raw=e}run(...e){return this.raw.run(...e)}get(...e){return this.raw.get(...e)}all(...e){let t=this.raw.all(...e);return Array.isArray(t)?t:[]}}class nb{raw;constructor(e){this.raw=e}exec(e){this.raw.exec(e)}prepare(e){return new rb(this.raw.prepare(e))}query(e){return this.prepare(e)}close(){this.raw.close()}}function ob(e){return new nb(pD(e))}import{existsSync as mD,mkdirSync as fD}from"node:fs";import{join as ib}from"node:path";import{homedir as hD}from"node:os";function gD(){let e=ib(hD(),".omo-meta-governor");if(!mD(e))fD(e,{recursive:!0});return ib(e,"meta-governor.db")}var Xd="1",yD=`
40
40
  CREATE TABLE IF NOT EXISTS _meta (
41
41
  key TEXT PRIMARY KEY,
42
42
  value TEXT NOT NULL
@@ -167,8 +167,8 @@ CREATE INDEX IF NOT EXISTS idx_boulder_dir_session ON boulder_tasks(directory, s
167
167
  download_count = excluded.download_count,
168
168
  last_synced = excluded.last_synced,
169
169
  content_hash = excluded.content_hash
170
- `).run(e.id,e.name,e.description,e.repo_url,e.installs??0,e.skill_id,e.download_count??0,e.last_synced??t,e.content_hash),Promise.resolve(e.id)}setSkillMaterializedAt(e,t){this.db.prepare("UPDATE skills SET last_materialized_at = ? WHERE id LIKE ? OR id = ?").run(t,`%/${e}`,e)}getSkillMaterializedAt(e){return this.db.prepare("SELECT last_materialized_at FROM skills WHERE id = ?").get(e)?.last_materialized_at??null}skillReplaceDeps(e,t){this.db.exec("BEGIN");try{this.db.prepare("DELETE FROM skill_deps WHERE skill_id = ?").run(e);let n=this.db.prepare("INSERT OR IGNORE INTO skill_deps (skill_id, dep_type, dep_name) VALUES (?, ?, ?)"),o=0;for(let r of t)if(typeof r.depType==="string"&&r.depType.length>0&&typeof r.depName==="string"&&r.depName.length>0)n.run(e,r.depType,r.depName),o++;return this.db.exec("COMMIT"),Promise.resolve(o)}catch(n){throw this.db.exec("ROLLBACK"),n}}skillGetDeps(e){let t=this.db.prepare("SELECT dep_type AS depType, dep_name AS depName FROM skill_deps WHERE skill_id = ? ORDER BY dep_type ASC, dep_name ASC").all(e);return Promise.resolve(t)}close(){this.db.close()}toFtsQuery(e){let t=e.trim().split(/\s+/).filter(Boolean).map((n)=>n.replace(/["()*:^]/g,"")).filter(Boolean);if(t.length===0)return'""';return t.map((n)=>`"${n}"*`).join(" ")}}function ab(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}var Qd=null;function Io(){if(!Qd)Qd=new cb;return Qd}var Vc={};An(Vc,{$brand:()=>tp,$input:()=>ih,$output:()=>oh,NEVER:()=>ep,TimePrecision:()=>ch,ZodAny:()=>o_,ZodArray:()=>c_,ZodBase64:()=>Ig,ZodBase64URL:()=>Tg,ZodBigInt:()=>hs,ZodBigIntFormat:()=>Og,ZodBoolean:()=>fs,ZodCIDRv4:()=>kg,ZodCIDRv6:()=>wg,ZodCUID:()=>gg,ZodCUID2:()=>yg,ZodCatch:()=>E_,ZodCodec:()=>zg,ZodCustom:()=>qc,ZodCustomStringFormat:()=>ps,ZodDate:()=>Gc,ZodDefault:()=>b_,ZodDiscriminatedUnion:()=>l_,ZodE164:()=>Eg,ZodEmail:()=>mg,ZodEmoji:()=>fg,ZodEnum:()=>us,ZodError:()=>RC,ZodFile:()=>x_,ZodFirstPartyTypeKind:()=>Lg,ZodFunction:()=>U_,ZodGUID:()=>Nc,ZodIPv4:()=>bg,ZodIPv6:()=>_g,ZodISODate:()=>Rc,ZodISODateTime:()=>Cc,ZodISODuration:()=>Mc,ZodISOTime:()=>Ac,ZodIntersection:()=>u_,ZodIssueCode:()=>BR,ZodJWT:()=>$g,ZodKSUID:()=>Sg,ZodLazy:()=>R_,ZodLiteral:()=>y_,ZodMap:()=>h_,ZodNaN:()=>O_,ZodNanoID:()=>hg,ZodNever:()=>s_,ZodNonOptional:()=>Ng,ZodNull:()=>r_,ZodNullable:()=>S_,ZodNumber:()=>ms,ZodNumberFormat:()=>Fo,ZodObject:()=>Bc,ZodOptional:()=>Ug,ZodPipe:()=>Fg,ZodPrefault:()=>k_,ZodPromise:()=>M_,ZodReadonly:()=>D_,ZodRealError:()=>Et,ZodRecord:()=>Rg,ZodSet:()=>g_,ZodString:()=>ds,ZodStringFormat:()=>Ce,ZodSuccess:()=>T_,ZodSymbol:()=>e_,ZodTemplateLiteral:()=>C_,ZodTransform:()=>v_,ZodTuple:()=>p_,ZodType:()=>K,ZodULID:()=>xg,ZodURL:()=>jc,ZodUUID:()=>Fr,ZodUndefined:()=>t_,ZodUnion:()=>Pg,ZodUnknown:()=>i_,ZodVoid:()=>a_,ZodXID:()=>vg,_ZodString:()=>pg,_default:()=>__,_function:()=>NR,any:()=>yR,array:()=>Zc,base64:()=>eR,base64url:()=>tR,bigint:()=>pR,boolean:()=>Qb,catch:()=>$_,check:()=>FR,cidrv4:()=>XC,cidrv6:()=>QC,clone:()=>bt,codec:()=>AR,coerce:()=>jg,config:()=>et,core:()=>Nr,cuid:()=>qC,cuid2:()=>VC,custom:()=>zR,date:()=>vR,decode:()=>ng,decodeAsync:()=>ig,discriminatedUnion:()=>wR,e164:()=>rR,email:()=>MC,emoji:()=>ZC,encode:()=>rg,encodeAsync:()=>og,endsWith:()=>os,enum:()=>Ag,file:()=>DR,flattenError:()=>Ni,float32:()=>cR,float64:()=>lR,formatError:()=>Fi,function:()=>NR,getErrorMap:()=>VR,globalRegistry:()=>vr,gt:()=>Mr,gte:()=>Tt,guid:()=>UC,hash:()=>aR,hex:()=>sR,hostname:()=>iR,httpUrl:()=>GC,includes:()=>rs,instanceof:()=>LR,int:()=>dg,int32:()=>uR,int64:()=>mR,intersection:()=>d_,ipv4:()=>KC,ipv6:()=>YC,iso:()=>Uc,json:()=>GR,jwt:()=>nR,keyof:()=>SR,ksuid:()=>JC,lazy:()=>A_,length:()=>Mo,literal:()=>OR,locales:()=>Hi,looseObject:()=>kR,lowercase:()=>es,lt:()=>Ar,lte:()=>Wt,map:()=>TR,maxLength:()=>Ao,maxSize:()=>Ro,mime:()=>is,minLength:()=>un,minSize:()=>Zn,multipleOf:()=>Gn,nan:()=>RR,nanoid:()=>BC,nativeEnum:()=>$R,negative:()=>Nh,never:()=>Dg,nonnegative:()=>zh,nonoptional:()=>I_,nonpositive:()=>Fh,normalize:()=>ss,null:()=>n_,nullable:()=>zc,nullish:()=>PR,number:()=>Xb,object:()=>bR,optional:()=>Fc,overwrite:()=>Ur,parse:()=>Xh,parseAsync:()=>Qh,partialRecord:()=>IR,pipe:()=>Lc,positive:()=>Uh,prefault:()=>w_,preprocess:()=>ZR,prettifyError:()=>up,promise:()=>UR,property:()=>Lh,readonly:()=>P_,record:()=>f_,refine:()=>N_,regex:()=>Qi,regexes:()=>Rr,registry:()=>uc,safeDecode:()=>ag,safeDecodeAsync:()=>lg,safeEncode:()=>sg,safeEncodeAsync:()=>cg,safeParse:()=>eg,safeParseAsync:()=>tg,set:()=>ER,setErrorMap:()=>qR,size:()=>Xi,startsWith:()=>ns,strictObject:()=>_R,string:()=>ug,stringFormat:()=>oR,stringbool:()=>jR,success:()=>CR,superRefine:()=>F_,symbol:()=>hR,templateLiteral:()=>MR,toJSONSchema:()=>Wh,toLowerCase:()=>cs,toUpperCase:()=>ls,transform:()=>Mg,treeifyError:()=>lp,trim:()=>as,tuple:()=>m_,uint32:()=>dR,uint64:()=>fR,ulid:()=>WC,undefined:()=>gR,union:()=>Cg,unknown:()=>No,uppercase:()=>ts,url:()=>jC,util:()=>U,uuid:()=>NC,uuidv4:()=>FC,uuidv6:()=>zC,uuidv7:()=>LC,void:()=>xR,xid:()=>HC});var Nr={};An(Nr,{$ZodAny:()=>Nm,$ZodArray:()=>Gm,$ZodAsyncError:()=>yr,$ZodBase64:()=>Em,$ZodBase64URL:()=>$m,$ZodBigInt:()=>ac,$ZodBigIntFormat:()=>Rm,$ZodBoolean:()=>ji,$ZodCIDRv4:()=>wm,$ZodCIDRv6:()=>Im,$ZodCUID:()=>mm,$ZodCUID2:()=>fm,$ZodCatch:()=>sf,$ZodCheck:()=>Ae,$ZodCheckBigIntFormat:()=>Zp,$ZodCheckEndsWith:()=>tm,$ZodCheckGreaterThan:()=>Qa,$ZodCheckIncludes:()=>Qp,$ZodCheckLengthEquals:()=>Jp,$ZodCheckLessThan:()=>Xa,$ZodCheckLowerCase:()=>Yp,$ZodCheckMaxLength:()=>Wp,$ZodCheckMaxSize:()=>Bp,$ZodCheckMimeType:()=>nm,$ZodCheckMinLength:()=>Hp,$ZodCheckMinSize:()=>qp,$ZodCheckMultipleOf:()=>jp,$ZodCheckNumberFormat:()=>Gp,$ZodCheckOverwrite:()=>om,$ZodCheckProperty:()=>rm,$ZodCheckRegex:()=>Kp,$ZodCheckSizeEquals:()=>Vp,$ZodCheckStartsWith:()=>em,$ZodCheckStringFormat:()=>Co,$ZodCheckUpperCase:()=>Xp,$ZodCodec:()=>Gi,$ZodCustom:()=>ff,$ZodCustomStringFormat:()=>Pm,$ZodDate:()=>jm,$ZodDefault:()=>tf,$ZodDiscriminatedUnion:()=>Bm,$ZodE164:()=>Om,$ZodEmail:()=>lm,$ZodEmoji:()=>dm,$ZodEncodeError:()=>Fn,$ZodEnum:()=>Jm,$ZodError:()=>Ui,$ZodFile:()=>Ym,$ZodFunction:()=>df,$ZodGUID:()=>am,$ZodIPv4:()=>_m,$ZodIPv6:()=>km,$ZodISODate:()=>vm,$ZodISODateTime:()=>xm,$ZodISODuration:()=>bm,$ZodISOTime:()=>Sm,$ZodIntersection:()=>qm,$ZodJWT:()=>Dm,$ZodKSUID:()=>ym,$ZodLazy:()=>mf,$ZodLiteral:()=>Km,$ZodMap:()=>Wm,$ZodNaN:()=>af,$ZodNanoID:()=>pm,$ZodNever:()=>zm,$ZodNonOptional:()=>nf,$ZodNull:()=>Um,$ZodNullable:()=>ef,$ZodNumber:()=>sc,$ZodNumberFormat:()=>Cm,$ZodObject:()=>Bb,$ZodObjectJIT:()=>Zm,$ZodOptional:()=>Qm,$ZodPipe:()=>cf,$ZodPrefault:()=>rf,$ZodPromise:()=>pf,$ZodReadonly:()=>lf,$ZodRealError:()=>It,$ZodRecord:()=>Vm,$ZodRegistry:()=>Ji,$ZodSet:()=>Hm,$ZodString:()=>jn,$ZodStringFormat:()=>Oe,$ZodSuccess:()=>of,$ZodSymbol:()=>Am,$ZodTemplateLiteral:()=>uf,$ZodTransform:()=>Xm,$ZodTuple:()=>lc,$ZodType:()=>Z,$ZodULID:()=>hm,$ZodURL:()=>um,$ZodUUID:()=>cm,$ZodUndefined:()=>Mm,$ZodUnion:()=>cc,$ZodUnknown:()=>Fm,$ZodVoid:()=>Lm,$ZodXID:()=>gm,$brand:()=>tp,$constructor:()=>x,$input:()=>ih,$output:()=>oh,Doc:()=>ec,JSONSchema:()=>Jb,JSONSchemaGenerator:()=>Pc,NEVER:()=>ep,TimePrecision:()=>ch,_any:()=>Oh,_array:()=>jh,_base64:()=>Ec,_base64url:()=>$c,_bigint:()=>_h,_boolean:()=>Sh,_catch:()=>TC,_check:()=>Hb,_cidrv4:()=>Ic,_cidrv6:()=>Tc,_coercedBigint:()=>kh,_coercedBoolean:()=>bh,_coercedDate:()=>Ah,_coercedNumber:()=>fh,_coercedString:()=>ah,_cuid:()=>xc,_cuid2:()=>vc,_custom:()=>Zh,_date:()=>Rh,_decode:()=>Za,_decodeAsync:()=>qa,_default:()=>kC,_discriminatedUnion:()=>dC,_e164:()=>Oc,_email:()=>dc,_emoji:()=>gc,_encode:()=>Ga,_encodeAsync:()=>Ba,_endsWith:()=>os,_enum:()=>yC,_file:()=>Gh,_float32:()=>gh,_float64:()=>yh,_gt:()=>Mr,_gte:()=>Tt,_guid:()=>Ki,_includes:()=>rs,_int:()=>hh,_int32:()=>xh,_int64:()=>wh,_intersection:()=>pC,_ipv4:()=>kc,_ipv6:()=>wc,_isoDate:()=>uh,_isoDateTime:()=>lh,_isoDuration:()=>ph,_isoTime:()=>dh,_jwt:()=>Dc,_ksuid:()=>_c,_lazy:()=>DC,_length:()=>Mo,_literal:()=>vC,_lowercase:()=>es,_lt:()=>Ar,_lte:()=>Wt,_map:()=>hC,_max:()=>Wt,_maxLength:()=>Ao,_maxSize:()=>Ro,_mime:()=>is,_min:()=>Tt,_minLength:()=>un,_minSize:()=>Zn,_multipleOf:()=>Gn,_nan:()=>Mh,_nanoid:()=>yc,_nativeEnum:()=>xC,_negative:()=>Nh,_never:()=>Ph,_nonnegative:()=>zh,_nonoptional:()=>wC,_nonpositive:()=>Fh,_normalize:()=>ss,_null:()=>$h,_nullable:()=>_C,_number:()=>mh,_optional:()=>bC,_overwrite:()=>Ur,_parse:()=>$o,_parseAsync:()=>Oo,_pipe:()=>EC,_positive:()=>Uh,_promise:()=>PC,_property:()=>Lh,_readonly:()=>$C,_record:()=>fC,_refine:()=>Bh,_regex:()=>Qi,_safeDecode:()=>Wa,_safeDecodeAsync:()=>Ja,_safeEncode:()=>Va,_safeEncodeAsync:()=>Ha,_safeParse:()=>Do,_safeParseAsync:()=>Po,_set:()=>gC,_size:()=>Xi,_startsWith:()=>ns,_string:()=>sh,_stringFormat:()=>Uo,_stringbool:()=>Vh,_success:()=>IC,_superRefine:()=>qh,_symbol:()=>Th,_templateLiteral:()=>OC,_toLowerCase:()=>cs,_toUpperCase:()=>ls,_transform:()=>SC,_trim:()=>as,_tuple:()=>mC,_uint32:()=>vh,_uint64:()=>Ih,_ulid:()=>Sc,_undefined:()=>Eh,_union:()=>uC,_unknown:()=>Dh,_uppercase:()=>ts,_url:()=>Yi,_uuid:()=>pc,_uuidv4:()=>mc,_uuidv6:()=>fc,_uuidv7:()=>hc,_void:()=>Ch,_xid:()=>bc,clone:()=>bt,config:()=>et,decode:()=>ND,decodeAsync:()=>zD,encode:()=>UD,encodeAsync:()=>FD,flattenError:()=>Ni,formatError:()=>Fi,globalConfig:()=>$i,globalRegistry:()=>vr,isValidBase64:()=>Tm,isValidBase64URL:()=>Lb,isValidJWT:()=>jb,locales:()=>Hi,parse:()=>La,parseAsync:()=>ja,prettifyError:()=>up,regexes:()=>Rr,registry:()=>uc,safeDecode:()=>jD,safeDecodeAsync:()=>ZD,safeEncode:()=>LD,safeEncodeAsync:()=>GD,safeParse:()=>dp,safeParseAsync:()=>pp,toDotPath:()=>bb,toJSONSchema:()=>Wh,treeifyError:()=>lp,util:()=>U,version:()=>im});var ep=Object.freeze({status:"aborted"});function x(e,t,n){function o(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,l);for(let u in s.prototype)if(!(u in a))Object.defineProperty(a,u,{value:s.prototype[u].bind(a)});a._zod.constr=s,a._zod.def=l}let r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:e});function s(a){var l;let c=n?.Parent?new i:this;o(c,a),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(n?.Parent&&a instanceof n.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var tp=Symbol("zod_brand");class yr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Fn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}var $i={};function et(e){if(e)Object.assign($i,e);return $i}var U={};An(U,{BIGINT_FORMAT_RANGES:()=>cp,Class:()=>vb,NUMBER_FORMAT_RANGES:()=>ap,aborted:()=>cn,allowsEval:()=>op,assert:()=>_D,assertEqual:()=>xD,assertIs:()=>SD,assertNever:()=>bD,assertNotEqual:()=>vD,assignProp:()=>nr,base64ToUint8Array:()=>yb,base64urlToUint8Array:()=>PD,cached:()=>Eo,captureStackTrace:()=>za,cleanEnum:()=>DD,cleanRegex:()=>Pi,clone:()=>bt,cloneDef:()=>kD,createTransparentProxy:()=>OD,defineLazy:()=>te,esc:()=>Fa,escapeRegex:()=>xr,extend:()=>pb,finalizeIssue:()=>Ut,floatSafeRemainder:()=>np,getElementAtPath:()=>wD,getEnumValues:()=>Di,getLengthableOrigin:()=>Mi,getParsedType:()=>$D,getSizableOrigin:()=>Ai,hexToUint8Array:()=>RD,isObject:()=>zn,isPlainObject:()=>an,issue:()=>ln,joinValues:()=>_,jsonStringifyReplacer:()=>To,merge:()=>fb,mergeDefs:()=>sn,normalizeParams:()=>E,nullish:()=>on,numKeys:()=>ED,objectClone:()=>Na,omit:()=>db,optionalKeys:()=>sp,partial:()=>hb,pick:()=>ub,prefixIssues:()=>Mt,primitiveTypes:()=>ip,promiseAllObject:()=>ID,propertyKeyTypes:()=>Ri,randomString:()=>TD,required:()=>gb,safeExtend:()=>mb,shallowClone:()=>Ci,stringifyPrimitive:()=>O,uint8ArrayToBase64:()=>xb,uint8ArrayToBase64url:()=>CD,uint8ArrayToHex:()=>AD,unwrapMessage:()=>Oi});function xD(e){return e}function vD(e){return e}function SD(e){}function bD(e){throw Error()}function _D(e){}function Di(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function _(e,t="|"){return e.map((n)=>O(n)).join(t)}function To(e,t){if(typeof t==="bigint")return t.toString();return t}function Eo(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function on(e){return e===null||e===void 0}function Pi(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function np(e,t){let n=(e.toString().split(".")[1]||"").length,o=t.toString(),r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){let l=o.match(/\d?e-(\d?)/);if(l?.[1])r=Number.parseInt(l[1])}let i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}var lb=Symbol("evaluating");function te(e,t,n){let o=void 0;Object.defineProperty(e,t,{get(){if(o===lb)return;if(o===void 0)o=lb,o=n();return o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Na(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function nr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function sn(...e){let t={};for(let n of e){let o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function kD(e){return sn(e._zod.def)}function wD(e,t){if(!t)return e;return t.reduce((n,o)=>n?.[o],e)}function ID(e){let t=Object.keys(e),n=t.map((o)=>e[o]);return Promise.all(n).then((o)=>{let r={};for(let i=0;i<t.length;i++)r[t[i]]=o[i];return r})}function TD(e=10){let n="";for(let o=0;o<e;o++)n+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return n}function Fa(e){return JSON.stringify(e)}var za="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function zn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var op=Eo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function an(e){if(zn(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;if(zn(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function Ci(e){if(an(e))return{...e};if(Array.isArray(e))return[...e];return e}function ED(e){let t=0;for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n))t++;return t}var $D=(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":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},Ri=new Set(["string","number","symbol"]),ip=new Set(["string","number","bigint","boolean","symbol","undefined"]);function xr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bt(e,t,n){let o=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)o._zod.parent=e;return o}function E(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function OD(e){let t;return new Proxy({},{get(n,o,r){return t??(t=e()),Reflect.get(t,o,r)},set(n,o,r,i){return t??(t=e()),Reflect.set(t,o,r,i)},has(n,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(n,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(n,o,r){return t??(t=e()),Reflect.defineProperty(t,o,r)}})}function O(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function sp(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ap={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},cp={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ub(e,t){let n=e._zod.def,o=sn(e._zod.def,{get shape(){let r={};for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;r[i]=n.shape[i]}return nr(this,"shape",r),r},checks:[]});return bt(e,o)}function db(e,t){let n=e._zod.def,o=sn(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;delete r[i]}return nr(this,"shape",r),r},checks:[]});return bt(e,o)}function pb(e,t){if(!an(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let r=sn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return nr(this,"shape",i),i},checks:[]});return bt(e,r)}function mb(e,t){if(!an(t))throw Error("Invalid input to safeExtend: expected a plain object");let n={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return nr(this,"shape",o),o},checks:e._zod.def.checks};return bt(e,n)}function fb(e,t){let n=sn(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return nr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return bt(e,n)}function hb(e,t,n){let o=sn(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let s in n){if(!(s in r))throw Error(`Unrecognized key: "${s}"`);if(!n[s])continue;i[s]=e?new e({type:"optional",innerType:r[s]}):r[s]}else for(let s in r)i[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return nr(this,"shape",i),i},checks:[]});return bt(t,o)}function gb(e,t,n){let o=sn(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let s in n){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);if(!n[s])continue;i[s]=new e({type:"nonoptional",innerType:r[s]})}else for(let s in r)i[s]=new e({type:"nonoptional",innerType:r[s]});return nr(this,"shape",i),i},checks:[]});return bt(t,o)}function cn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Mt(e,t){return t.map((n)=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function Oi(e){return typeof e==="string"?e:e?.message}function Ut(e,t,n){let o={...e,path:e.path??[]};if(!e.message){let r=Oi(e.inst?._zod.def?.error?.(e))??Oi(t?.error?.(e))??Oi(n.customError?.(e))??Oi(n.localeError?.(e))??"Invalid input";o.message=r}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function Ai(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Mi(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ln(...e){let[t,n,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:o};return{...t}}function DD(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function yb(e){let t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}function xb(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function PD(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return yb(t+n)}function CD(e){return xb(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function RD(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)n[o/2]=Number.parseInt(t.slice(o,o+2),16);return n}function AD(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}class vb{constructor(...e){}}var Sb=(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,To,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ui=x("$ZodError",Sb),It=x("$ZodError",Sb,{Parent:Error});function Ni(e,t=(n)=>n.message){let n={},o=[];for(let r of e.issues)if(r.path.length>0)n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r));else o.push(t(r));return{formErrors:o,fieldErrors:n}}function Fi(e,t){let n=t||function(i){return i.message},o={_errors:[]},r=(i)=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)o._errors.push(n(s));else{let a=o,l=0;while(l<s.path.length){let c=s.path[l];if(l!==s.path.length-1)a[c]=a[c]||{_errors:[]};else a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s));a=a[c],l++}}};return r(e),o}function lp(e,t){let n=t||function(i){return i.message},o={errors:[]},r=(i,s=[])=>{var a,l;for(let c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map((u)=>r({issues:u},c.path));else if(c.code==="invalid_key")r({issues:c.issues},c.path);else if(c.code==="invalid_element")r({issues:c.issues},c.path);else{let u=[...s,...c.path];if(u.length===0){o.errors.push(n(c));continue}let f=o,h=0;while(h<u.length){let m=u[h],y=h===u.length-1;if(typeof m==="string")f.properties??(f.properties={}),(a=f.properties)[m]??(a[m]={errors:[]}),f=f.properties[m];else f.items??(f.items=[]),(l=f.items)[m]??(l[m]={errors:[]}),f=f.items[m];if(y)f.errors.push(n(c));h++}}};return r(e),o}function bb(e){let t=[],n=e.map((o)=>typeof o==="object"?o.key:o);for(let o of n)if(typeof o==="number")t.push(`[${o}]`);else if(typeof o==="symbol")t.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))t.push(`[${JSON.stringify(o)}]`);else{if(t.length)t.push(".");t.push(o)}return t.join("")}function up(e){let t=[],n=[...e.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)if(t.push(`✖ ${o.message}`),o.path?.length)t.push(` → at ${bb(o.path)}`);return t.join(`
171
- `)}var $o=(e)=>(t,n,o,r)=>{let i=o?Object.assign(o,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new yr;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map((l)=>Ut(l,i,et())));throw za(a,r?.callee),a}return s.value},La=$o(It),Oo=(e)=>async(t,n,o,r)=>{let i=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map((l)=>Ut(l,i,et())));throw za(a,r?.callee),a}return s.value},ja=Oo(It),Do=(e)=>(t,n,o)=>{let r=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new yr;return i.issues.length?{success:!1,error:new(e??Ui)(i.issues.map((s)=>Ut(s,r,et())))}:{success:!0,data:i.value}},dp=Do(It),Po=(e)=>async(t,n,o)=>{let r=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>Ut(s,r,et())))}:{success:!0,data:i.value}},pp=Po(It),Ga=(e)=>(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return $o(e)(t,n,r)},UD=Ga(It),Za=(e)=>(t,n,o)=>$o(e)(t,n,o),ND=Za(It),Ba=(e)=>async(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Oo(e)(t,n,r)},FD=Ba(It),qa=(e)=>async(t,n,o)=>Oo(e)(t,n,o),zD=qa(It),Va=(e)=>(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Do(e)(t,n,r)},LD=Va(It),Wa=(e)=>(t,n,o)=>Do(e)(t,n,o),jD=Wa(It),Ha=(e)=>async(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Po(e)(t,n,r)},GD=Ha(It),Ja=(e)=>async(t,n,o)=>Po(e)(t,n,o),ZD=Ja(It);var Rr={};An(Rr,{base64:()=>Ep,base64url:()=>Ka,bigint:()=>Rp,boolean:()=>Up,browserEmail:()=>YD,cidrv4:()=>Ip,cidrv6:()=>Tp,cuid:()=>mp,cuid2:()=>fp,date:()=>Op,datetime:()=>Pp,domain:()=>kb,duration:()=>vp,e164:()=>$p,email:()=>bp,emoji:()=>_p,extendedDuration:()=>BD,guid:()=>Sp,hex:()=>Tb,hostname:()=>Ya,html5Email:()=>HD,idnEmail:()=>KD,integer:()=>Ap,ipv4:()=>kp,ipv6:()=>wp,ksuid:()=>yp,lowercase:()=>zp,md5_base64:()=>QD,md5_base64url:()=>eP,md5_hex:()=>XD,nanoid:()=>xp,null:()=>Np,number:()=>Mp,rfc5322Email:()=>JD,sha1_base64:()=>rP,sha1_base64url:()=>nP,sha1_hex:()=>tP,sha256_base64:()=>iP,sha256_base64url:()=>sP,sha256_hex:()=>oP,sha384_base64:()=>cP,sha384_base64url:()=>lP,sha384_hex:()=>aP,sha512_base64:()=>dP,sha512_base64url:()=>pP,sha512_hex:()=>uP,string:()=>Cp,time:()=>Dp,ulid:()=>hp,undefined:()=>Fp,unicodeEmail:()=>_b,uppercase:()=>Lp,uuid:()=>Ln,uuid4:()=>qD,uuid6:()=>VD,uuid7:()=>WD,xid:()=>gp});var mp=/^[cC][^\s-]{8,}$/,fp=/^[0-9a-z]+$/,hp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,gp=/^[0-9a-vA-V]{20}$/,yp=/^[A-Za-z0-9]{27}$/,xp=/^[a-zA-Z0-9_-]{21}$/,vp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,BD=/^[-+]?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)?)??$/,Sp=/^([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})$/,Ln=(e)=>{if(!e)return/^([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)$/;return 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})$`)},qD=Ln(4),VD=Ln(6),WD=Ln(7),bp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,HD=/^[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])?)*$/,JD=/^(([^<>()\[\]\\.,;:\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,}))$/,_b=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,KD=_b,YD=/^[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])?)*$/;function _p(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var kp=/^(?:(?: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])$/,wp=/^(([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}|:))$/,Ip=/^((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])$/,Tp=/^(([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])$/,Ep=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ka=/^[A-Za-z0-9_-]*$/,Ya=/^(?=.{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])?)*\.?$/,kb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,$p=/^\+(?:[0-9]){6,14}[0-9]$/,wb="(?:(?:\\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])))",Op=new RegExp(`^${wb}$`);function Ib(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Dp(e){return new RegExp(`^${Ib(e)}$`)}function Pp(e){let t=Ib({precision:e.precision}),n=["Z"];if(e.local)n.push("");if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${n.join("|")})`;return new RegExp(`^${wb}T(?:${o})$`)}var Cp=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Rp=/^-?\d+n?$/,Ap=/^-?\d+$/,Mp=/^-?\d+(?:\.\d+)?/,Up=/^(?:true|false)$/i,Np=/^null$/i;var Fp=/^undefined$/i;var zp=/^[^A-Z]*$/,Lp=/^[^a-z]*$/,Tb=/^[0-9a-fA-F]*$/;function zi(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Li(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var XD=/^[0-9a-fA-F]{32}$/,QD=zi(22,"=="),eP=Li(22),tP=/^[0-9a-fA-F]{40}$/,rP=zi(27,"="),nP=Li(27),oP=/^[0-9a-fA-F]{64}$/,iP=zi(43,"="),sP=Li(43),aP=/^[0-9a-fA-F]{96}$/,cP=zi(64,""),lP=Li(64),uP=/^[0-9a-fA-F]{128}$/,dP=zi(86,"=="),pP=Li(86);var Ae=x("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),$b={number:"number",bigint:"bigint",object:"date"},Xa=x("$ZodCheckLessThan",(e,t)=>{Ae.init(e,t);let n=$b[typeof t.value];e._zod.onattach.push((o)=>{let r=o._zod.bag,i=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)r.maximum=t.value;else r.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:n,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qa=x("$ZodCheckGreaterThan",(e,t)=>{Ae.init(e,t);let n=$b[typeof t.value];e._zod.onattach.push((o)=>{let r=o._zod.bag,i=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)r.minimum=t.value;else r.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:n,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jp=x("$ZodCheckMultipleOf",(e,t)=>{Ae.init(e,t),e._zod.onattach.push((n)=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?n.value%t.value===BigInt(0):np(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Gp=x("$ZodCheckNumberFormat",(e,t)=>{Ae.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),o=n?"int":"number",[r,i]=ap[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=r,a.maximum=i,n)a.pattern=Ap}),e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}if(a<r)s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:e})}}),Zp=x("$ZodCheckBigIntFormat",(e,t)=>{Ae.init(e,t);let[n,o]=cp[t.format];e._zod.onattach.push((r)=>{let i=r._zod.bag;i.format=t.format,i.minimum=n,i.maximum=o}),e._zod.check=(r)=>{let i=r.value;if(i<n)r.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(i>o)r.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inst:e})}}),Bp=x("$ZodCheckMaxSize",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.size!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let r=o.value;if(r.size<=t.maximum)return;o.issues.push({origin:Ai(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qp=x("$ZodCheckMinSize",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.size!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let r=o.value;if(r.size>=t.minimum)return;o.issues.push({origin:Ai(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Vp=x("$ZodCheckSizeEquals",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.size!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=(o)=>{let r=o.value,i=r.size;if(i===t.size)return;let s=i>t.size;o.issues.push({origin:Ai(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Wp=x("$ZodCheckMaxLength",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.length!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let r=o.value;if(r.length<=t.maximum)return;let s=Mi(r);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Hp=x("$ZodCheckMinLength",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.length!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let r=o.value;if(r.length>=t.minimum)return;let s=Mi(r);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Jp=x("$ZodCheckLengthEquals",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.length!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=(o)=>{let r=o.value,i=r.length;if(i===t.length)return;let s=Mi(r),a=i>t.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Co=x("$ZodCheckStringFormat",(e,t)=>{var n,o;if(Ae.init(e,t),e._zod.onattach.push((r)=>{let i=r._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(n=e._zod).check??(n.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),Kp=x("$ZodCheckRegex",(e,t)=>{Co.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Yp=x("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=zp),Co.init(e,t)}),Xp=x("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Lp),Co.init(e,t)}),Qp=x("$ZodCheckIncludes",(e,t)=>{Ae.init(e,t);let n=xr(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push((r)=>{let i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=(r)=>{if(r.value.includes(t.includes,t.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),em=x("$ZodCheckStartsWith",(e,t)=>{Ae.init(e,t);let n=new RegExp(`^${xr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),tm=x("$ZodCheckEndsWith",(e,t)=>{Ae.init(e,t);let n=new RegExp(`.*${xr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function Eb(e,t,n){if(e.issues.length)t.issues.push(...Mt(n,e.issues))}var rm=x("$ZodCheckProperty",(e,t)=>{Ae.init(e,t),e._zod.check=(n)=>{let o=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then((r)=>Eb(r,n,t.property));Eb(o,n,t.property);return}}),nm=x("$ZodCheckMimeType",(e,t)=>{Ae.init(e,t);let n=new Set(t.mime);e._zod.onattach.push((o)=>{o._zod.bag.mime=t.mime}),e._zod.check=(o)=>{if(n.has(o.value.type))return;o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),om=x("$ZodCheckOverwrite",(e,t)=>{Ae.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class ec{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
170
+ `).run(e.id,e.name,e.description,e.repo_url,e.installs??0,e.skill_id,e.download_count??0,e.last_synced??t,e.content_hash),Promise.resolve(e.id)}setSkillMaterializedAt(e,t){this.db.prepare("UPDATE skills SET last_materialized_at = ? WHERE id LIKE ? OR id = ?").run(t,`%/${e}`,e)}getSkillMaterializedAt(e){return this.db.prepare("SELECT last_materialized_at FROM skills WHERE id = ?").get(e)?.last_materialized_at??null}skillReplaceDeps(e,t){this.db.exec("BEGIN");try{this.db.prepare("DELETE FROM skill_deps WHERE skill_id = ?").run(e);let n=this.db.prepare("INSERT OR IGNORE INTO skill_deps (skill_id, dep_type, dep_name) VALUES (?, ?, ?)"),o=0;for(let r of t)if(typeof r.depType==="string"&&r.depType.length>0&&typeof r.depName==="string"&&r.depName.length>0)n.run(e,r.depType,r.depName),o++;return this.db.exec("COMMIT"),Promise.resolve(o)}catch(n){throw this.db.exec("ROLLBACK"),n}}skillGetDeps(e){let t=this.db.prepare("SELECT dep_type AS depType, dep_name AS depName FROM skill_deps WHERE skill_id = ? ORDER BY dep_type ASC, dep_name ASC").all(e);return Promise.resolve(t)}close(){this.db.close()}toFtsQuery(e){let t=e.trim().split(/\s+/).filter(Boolean).map((n)=>n.replace(/["()*:^]/g,"")).filter(Boolean);if(t.length===0)return'""';return t.map((n)=>`"${n}"*`).join(" ")}}function ab(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}var Qd=null;function Io(){if(!Qd)Qd=new cb;return Qd}var Hc={};An(Hc,{$brand:()=>tp,$input:()=>ih,$output:()=>oh,NEVER:()=>ep,TimePrecision:()=>ch,ZodAny:()=>o_,ZodArray:()=>c_,ZodBase64:()=>Ig,ZodBase64URL:()=>Tg,ZodBigInt:()=>hs,ZodBigIntFormat:()=>Og,ZodBoolean:()=>fs,ZodCIDRv4:()=>kg,ZodCIDRv6:()=>wg,ZodCUID:()=>gg,ZodCUID2:()=>yg,ZodCatch:()=>E_,ZodCodec:()=>zg,ZodCustom:()=>qc,ZodCustomStringFormat:()=>ps,ZodDate:()=>Gc,ZodDefault:()=>b_,ZodDiscriminatedUnion:()=>l_,ZodE164:()=>Eg,ZodEmail:()=>mg,ZodEmoji:()=>fg,ZodEnum:()=>us,ZodError:()=>RC,ZodFile:()=>x_,ZodFirstPartyTypeKind:()=>Lg,ZodFunction:()=>U_,ZodGUID:()=>Nc,ZodIPv4:()=>bg,ZodIPv6:()=>_g,ZodISODate:()=>Rc,ZodISODateTime:()=>Cc,ZodISODuration:()=>Mc,ZodISOTime:()=>Ac,ZodIntersection:()=>u_,ZodIssueCode:()=>BR,ZodJWT:()=>$g,ZodKSUID:()=>Sg,ZodLazy:()=>R_,ZodLiteral:()=>y_,ZodMap:()=>h_,ZodNaN:()=>O_,ZodNanoID:()=>hg,ZodNever:()=>s_,ZodNonOptional:()=>Ng,ZodNull:()=>r_,ZodNullable:()=>S_,ZodNumber:()=>ms,ZodNumberFormat:()=>Fo,ZodObject:()=>Bc,ZodOptional:()=>Ug,ZodPipe:()=>Fg,ZodPrefault:()=>k_,ZodPromise:()=>M_,ZodReadonly:()=>D_,ZodRealError:()=>Et,ZodRecord:()=>Rg,ZodSet:()=>g_,ZodString:()=>ds,ZodStringFormat:()=>Ce,ZodSuccess:()=>T_,ZodSymbol:()=>e_,ZodTemplateLiteral:()=>C_,ZodTransform:()=>v_,ZodTuple:()=>p_,ZodType:()=>K,ZodULID:()=>xg,ZodURL:()=>jc,ZodUUID:()=>Fr,ZodUndefined:()=>t_,ZodUnion:()=>Pg,ZodUnknown:()=>i_,ZodVoid:()=>a_,ZodXID:()=>vg,_ZodString:()=>pg,_default:()=>__,_function:()=>NR,any:()=>yR,array:()=>Zc,base64:()=>eR,base64url:()=>tR,bigint:()=>pR,boolean:()=>Qb,catch:()=>$_,check:()=>FR,cidrv4:()=>XC,cidrv6:()=>QC,clone:()=>bt,codec:()=>AR,coerce:()=>jg,config:()=>et,core:()=>Nr,cuid:()=>qC,cuid2:()=>HC,custom:()=>zR,date:()=>vR,decode:()=>ng,decodeAsync:()=>ig,discriminatedUnion:()=>wR,e164:()=>rR,email:()=>MC,emoji:()=>ZC,encode:()=>rg,encodeAsync:()=>og,endsWith:()=>os,enum:()=>Ag,file:()=>DR,flattenError:()=>Ni,float32:()=>cR,float64:()=>lR,formatError:()=>Fi,function:()=>NR,getErrorMap:()=>HR,globalRegistry:()=>vr,gt:()=>Mr,gte:()=>Tt,guid:()=>UC,hash:()=>aR,hex:()=>sR,hostname:()=>iR,httpUrl:()=>GC,includes:()=>rs,instanceof:()=>LR,int:()=>dg,int32:()=>uR,int64:()=>mR,intersection:()=>d_,ipv4:()=>KC,ipv6:()=>YC,iso:()=>Uc,json:()=>GR,jwt:()=>nR,keyof:()=>SR,ksuid:()=>JC,lazy:()=>A_,length:()=>Mo,literal:()=>OR,locales:()=>Wi,looseObject:()=>kR,lowercase:()=>es,lt:()=>Ar,lte:()=>Vt,map:()=>TR,maxLength:()=>Ao,maxSize:()=>Ro,mime:()=>is,minLength:()=>un,minSize:()=>Zn,multipleOf:()=>Gn,nan:()=>RR,nanoid:()=>BC,nativeEnum:()=>$R,negative:()=>Nh,never:()=>Dg,nonnegative:()=>zh,nonoptional:()=>I_,nonpositive:()=>Fh,normalize:()=>ss,null:()=>n_,nullable:()=>zc,nullish:()=>PR,number:()=>Xb,object:()=>bR,optional:()=>Fc,overwrite:()=>Ur,parse:()=>Xh,parseAsync:()=>Qh,partialRecord:()=>IR,pipe:()=>Lc,positive:()=>Uh,prefault:()=>w_,preprocess:()=>ZR,prettifyError:()=>up,promise:()=>UR,property:()=>Lh,readonly:()=>P_,record:()=>f_,refine:()=>N_,regex:()=>Qi,regexes:()=>Rr,registry:()=>uc,safeDecode:()=>ag,safeDecodeAsync:()=>lg,safeEncode:()=>sg,safeEncodeAsync:()=>cg,safeParse:()=>eg,safeParseAsync:()=>tg,set:()=>ER,setErrorMap:()=>qR,size:()=>Xi,startsWith:()=>ns,strictObject:()=>_R,string:()=>ug,stringFormat:()=>oR,stringbool:()=>jR,success:()=>CR,superRefine:()=>F_,symbol:()=>hR,templateLiteral:()=>MR,toJSONSchema:()=>Vh,toLowerCase:()=>cs,toUpperCase:()=>ls,transform:()=>Mg,treeifyError:()=>lp,trim:()=>as,tuple:()=>m_,uint32:()=>dR,uint64:()=>fR,ulid:()=>VC,undefined:()=>gR,union:()=>Cg,unknown:()=>No,uppercase:()=>ts,url:()=>jC,util:()=>U,uuid:()=>NC,uuidv4:()=>FC,uuidv6:()=>zC,uuidv7:()=>LC,void:()=>xR,xid:()=>WC});var Nr={};An(Nr,{$ZodAny:()=>Nm,$ZodArray:()=>Gm,$ZodAsyncError:()=>yr,$ZodBase64:()=>Em,$ZodBase64URL:()=>$m,$ZodBigInt:()=>ac,$ZodBigIntFormat:()=>Rm,$ZodBoolean:()=>ji,$ZodCIDRv4:()=>wm,$ZodCIDRv6:()=>Im,$ZodCUID:()=>mm,$ZodCUID2:()=>fm,$ZodCatch:()=>sf,$ZodCheck:()=>Ae,$ZodCheckBigIntFormat:()=>Zp,$ZodCheckEndsWith:()=>tm,$ZodCheckGreaterThan:()=>Qa,$ZodCheckIncludes:()=>Qp,$ZodCheckLengthEquals:()=>Jp,$ZodCheckLessThan:()=>Xa,$ZodCheckLowerCase:()=>Yp,$ZodCheckMaxLength:()=>Vp,$ZodCheckMaxSize:()=>Bp,$ZodCheckMimeType:()=>nm,$ZodCheckMinLength:()=>Wp,$ZodCheckMinSize:()=>qp,$ZodCheckMultipleOf:()=>jp,$ZodCheckNumberFormat:()=>Gp,$ZodCheckOverwrite:()=>om,$ZodCheckProperty:()=>rm,$ZodCheckRegex:()=>Kp,$ZodCheckSizeEquals:()=>Hp,$ZodCheckStartsWith:()=>em,$ZodCheckStringFormat:()=>Co,$ZodCheckUpperCase:()=>Xp,$ZodCodec:()=>Gi,$ZodCustom:()=>ff,$ZodCustomStringFormat:()=>Pm,$ZodDate:()=>jm,$ZodDefault:()=>tf,$ZodDiscriminatedUnion:()=>Bm,$ZodE164:()=>Om,$ZodEmail:()=>lm,$ZodEmoji:()=>dm,$ZodEncodeError:()=>Fn,$ZodEnum:()=>Jm,$ZodError:()=>Ui,$ZodFile:()=>Ym,$ZodFunction:()=>df,$ZodGUID:()=>am,$ZodIPv4:()=>_m,$ZodIPv6:()=>km,$ZodISODate:()=>vm,$ZodISODateTime:()=>xm,$ZodISODuration:()=>bm,$ZodISOTime:()=>Sm,$ZodIntersection:()=>qm,$ZodJWT:()=>Dm,$ZodKSUID:()=>ym,$ZodLazy:()=>mf,$ZodLiteral:()=>Km,$ZodMap:()=>Vm,$ZodNaN:()=>af,$ZodNanoID:()=>pm,$ZodNever:()=>zm,$ZodNonOptional:()=>nf,$ZodNull:()=>Um,$ZodNullable:()=>ef,$ZodNumber:()=>sc,$ZodNumberFormat:()=>Cm,$ZodObject:()=>Bb,$ZodObjectJIT:()=>Zm,$ZodOptional:()=>Qm,$ZodPipe:()=>cf,$ZodPrefault:()=>rf,$ZodPromise:()=>pf,$ZodReadonly:()=>lf,$ZodRealError:()=>It,$ZodRecord:()=>Hm,$ZodRegistry:()=>Ji,$ZodSet:()=>Wm,$ZodString:()=>jn,$ZodStringFormat:()=>Oe,$ZodSuccess:()=>of,$ZodSymbol:()=>Am,$ZodTemplateLiteral:()=>uf,$ZodTransform:()=>Xm,$ZodTuple:()=>lc,$ZodType:()=>Z,$ZodULID:()=>hm,$ZodURL:()=>um,$ZodUUID:()=>cm,$ZodUndefined:()=>Mm,$ZodUnion:()=>cc,$ZodUnknown:()=>Fm,$ZodVoid:()=>Lm,$ZodXID:()=>gm,$brand:()=>tp,$constructor:()=>x,$input:()=>ih,$output:()=>oh,Doc:()=>ec,JSONSchema:()=>Jb,JSONSchemaGenerator:()=>Pc,NEVER:()=>ep,TimePrecision:()=>ch,_any:()=>Oh,_array:()=>jh,_base64:()=>Ec,_base64url:()=>$c,_bigint:()=>_h,_boolean:()=>Sh,_catch:()=>TC,_check:()=>Wb,_cidrv4:()=>Ic,_cidrv6:()=>Tc,_coercedBigint:()=>kh,_coercedBoolean:()=>bh,_coercedDate:()=>Ah,_coercedNumber:()=>fh,_coercedString:()=>ah,_cuid:()=>xc,_cuid2:()=>vc,_custom:()=>Zh,_date:()=>Rh,_decode:()=>Za,_decodeAsync:()=>qa,_default:()=>kC,_discriminatedUnion:()=>dC,_e164:()=>Oc,_email:()=>dc,_emoji:()=>gc,_encode:()=>Ga,_encodeAsync:()=>Ba,_endsWith:()=>os,_enum:()=>yC,_file:()=>Gh,_float32:()=>gh,_float64:()=>yh,_gt:()=>Mr,_gte:()=>Tt,_guid:()=>Ki,_includes:()=>rs,_int:()=>hh,_int32:()=>xh,_int64:()=>wh,_intersection:()=>pC,_ipv4:()=>kc,_ipv6:()=>wc,_isoDate:()=>uh,_isoDateTime:()=>lh,_isoDuration:()=>ph,_isoTime:()=>dh,_jwt:()=>Dc,_ksuid:()=>_c,_lazy:()=>DC,_length:()=>Mo,_literal:()=>vC,_lowercase:()=>es,_lt:()=>Ar,_lte:()=>Vt,_map:()=>hC,_max:()=>Vt,_maxLength:()=>Ao,_maxSize:()=>Ro,_mime:()=>is,_min:()=>Tt,_minLength:()=>un,_minSize:()=>Zn,_multipleOf:()=>Gn,_nan:()=>Mh,_nanoid:()=>yc,_nativeEnum:()=>xC,_negative:()=>Nh,_never:()=>Ph,_nonnegative:()=>zh,_nonoptional:()=>wC,_nonpositive:()=>Fh,_normalize:()=>ss,_null:()=>$h,_nullable:()=>_C,_number:()=>mh,_optional:()=>bC,_overwrite:()=>Ur,_parse:()=>$o,_parseAsync:()=>Oo,_pipe:()=>EC,_positive:()=>Uh,_promise:()=>PC,_property:()=>Lh,_readonly:()=>$C,_record:()=>fC,_refine:()=>Bh,_regex:()=>Qi,_safeDecode:()=>Va,_safeDecodeAsync:()=>Ja,_safeEncode:()=>Ha,_safeEncodeAsync:()=>Wa,_safeParse:()=>Do,_safeParseAsync:()=>Po,_set:()=>gC,_size:()=>Xi,_startsWith:()=>ns,_string:()=>sh,_stringFormat:()=>Uo,_stringbool:()=>Hh,_success:()=>IC,_superRefine:()=>qh,_symbol:()=>Th,_templateLiteral:()=>OC,_toLowerCase:()=>cs,_toUpperCase:()=>ls,_transform:()=>SC,_trim:()=>as,_tuple:()=>mC,_uint32:()=>vh,_uint64:()=>Ih,_ulid:()=>Sc,_undefined:()=>Eh,_union:()=>uC,_unknown:()=>Dh,_uppercase:()=>ts,_url:()=>Yi,_uuid:()=>pc,_uuidv4:()=>mc,_uuidv6:()=>fc,_uuidv7:()=>hc,_void:()=>Ch,_xid:()=>bc,clone:()=>bt,config:()=>et,decode:()=>ND,decodeAsync:()=>zD,encode:()=>UD,encodeAsync:()=>FD,flattenError:()=>Ni,formatError:()=>Fi,globalConfig:()=>$i,globalRegistry:()=>vr,isValidBase64:()=>Tm,isValidBase64URL:()=>Lb,isValidJWT:()=>jb,locales:()=>Wi,parse:()=>La,parseAsync:()=>ja,prettifyError:()=>up,regexes:()=>Rr,registry:()=>uc,safeDecode:()=>jD,safeDecodeAsync:()=>ZD,safeEncode:()=>LD,safeEncodeAsync:()=>GD,safeParse:()=>dp,safeParseAsync:()=>pp,toDotPath:()=>bb,toJSONSchema:()=>Vh,treeifyError:()=>lp,util:()=>U,version:()=>im});var ep=Object.freeze({status:"aborted"});function x(e,t,n){function o(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,l);for(let u in s.prototype)if(!(u in a))Object.defineProperty(a,u,{value:s.prototype[u].bind(a)});a._zod.constr=s,a._zod.def=l}let r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:e});function s(a){var l;let c=n?.Parent?new i:this;o(c,a),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(n?.Parent&&a instanceof n.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var tp=Symbol("zod_brand");class yr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Fn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}var $i={};function et(e){if(e)Object.assign($i,e);return $i}var U={};An(U,{BIGINT_FORMAT_RANGES:()=>cp,Class:()=>vb,NUMBER_FORMAT_RANGES:()=>ap,aborted:()=>cn,allowsEval:()=>op,assert:()=>_D,assertEqual:()=>xD,assertIs:()=>SD,assertNever:()=>bD,assertNotEqual:()=>vD,assignProp:()=>nr,base64ToUint8Array:()=>yb,base64urlToUint8Array:()=>PD,cached:()=>Eo,captureStackTrace:()=>za,cleanEnum:()=>DD,cleanRegex:()=>Pi,clone:()=>bt,cloneDef:()=>kD,createTransparentProxy:()=>OD,defineLazy:()=>te,esc:()=>Fa,escapeRegex:()=>xr,extend:()=>pb,finalizeIssue:()=>Ut,floatSafeRemainder:()=>np,getElementAtPath:()=>wD,getEnumValues:()=>Di,getLengthableOrigin:()=>Mi,getParsedType:()=>$D,getSizableOrigin:()=>Ai,hexToUint8Array:()=>RD,isObject:()=>zn,isPlainObject:()=>an,issue:()=>ln,joinValues:()=>_,jsonStringifyReplacer:()=>To,merge:()=>fb,mergeDefs:()=>sn,normalizeParams:()=>E,nullish:()=>on,numKeys:()=>ED,objectClone:()=>Na,omit:()=>db,optionalKeys:()=>sp,partial:()=>hb,pick:()=>ub,prefixIssues:()=>Mt,primitiveTypes:()=>ip,promiseAllObject:()=>ID,propertyKeyTypes:()=>Ri,randomString:()=>TD,required:()=>gb,safeExtend:()=>mb,shallowClone:()=>Ci,stringifyPrimitive:()=>O,uint8ArrayToBase64:()=>xb,uint8ArrayToBase64url:()=>CD,uint8ArrayToHex:()=>AD,unwrapMessage:()=>Oi});function xD(e){return e}function vD(e){return e}function SD(e){}function bD(e){throw Error()}function _D(e){}function Di(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function _(e,t="|"){return e.map((n)=>O(n)).join(t)}function To(e,t){if(typeof t==="bigint")return t.toString();return t}function Eo(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function on(e){return e===null||e===void 0}function Pi(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function np(e,t){let n=(e.toString().split(".")[1]||"").length,o=t.toString(),r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){let l=o.match(/\d?e-(\d?)/);if(l?.[1])r=Number.parseInt(l[1])}let i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}var lb=Symbol("evaluating");function te(e,t,n){let o=void 0;Object.defineProperty(e,t,{get(){if(o===lb)return;if(o===void 0)o=lb,o=n();return o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Na(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function nr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function sn(...e){let t={};for(let n of e){let o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function kD(e){return sn(e._zod.def)}function wD(e,t){if(!t)return e;return t.reduce((n,o)=>n?.[o],e)}function ID(e){let t=Object.keys(e),n=t.map((o)=>e[o]);return Promise.all(n).then((o)=>{let r={};for(let i=0;i<t.length;i++)r[t[i]]=o[i];return r})}function TD(e=10){let n="";for(let o=0;o<e;o++)n+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return n}function Fa(e){return JSON.stringify(e)}var za="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function zn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var op=Eo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function an(e){if(zn(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;if(zn(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function Ci(e){if(an(e))return{...e};if(Array.isArray(e))return[...e];return e}function ED(e){let t=0;for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n))t++;return t}var $D=(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":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},Ri=new Set(["string","number","symbol"]),ip=new Set(["string","number","bigint","boolean","symbol","undefined"]);function xr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bt(e,t,n){let o=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)o._zod.parent=e;return o}function E(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function OD(e){let t;return new Proxy({},{get(n,o,r){return t??(t=e()),Reflect.get(t,o,r)},set(n,o,r,i){return t??(t=e()),Reflect.set(t,o,r,i)},has(n,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(n,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(n,o,r){return t??(t=e()),Reflect.defineProperty(t,o,r)}})}function O(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function sp(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ap={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},cp={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ub(e,t){let n=e._zod.def,o=sn(e._zod.def,{get shape(){let r={};for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;r[i]=n.shape[i]}return nr(this,"shape",r),r},checks:[]});return bt(e,o)}function db(e,t){let n=e._zod.def,o=sn(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;delete r[i]}return nr(this,"shape",r),r},checks:[]});return bt(e,o)}function pb(e,t){if(!an(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let r=sn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return nr(this,"shape",i),i},checks:[]});return bt(e,r)}function mb(e,t){if(!an(t))throw Error("Invalid input to safeExtend: expected a plain object");let n={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return nr(this,"shape",o),o},checks:e._zod.def.checks};return bt(e,n)}function fb(e,t){let n=sn(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return nr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return bt(e,n)}function hb(e,t,n){let o=sn(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let s in n){if(!(s in r))throw Error(`Unrecognized key: "${s}"`);if(!n[s])continue;i[s]=e?new e({type:"optional",innerType:r[s]}):r[s]}else for(let s in r)i[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return nr(this,"shape",i),i},checks:[]});return bt(t,o)}function gb(e,t,n){let o=sn(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let s in n){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);if(!n[s])continue;i[s]=new e({type:"nonoptional",innerType:r[s]})}else for(let s in r)i[s]=new e({type:"nonoptional",innerType:r[s]});return nr(this,"shape",i),i},checks:[]});return bt(t,o)}function cn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Mt(e,t){return t.map((n)=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function Oi(e){return typeof e==="string"?e:e?.message}function Ut(e,t,n){let o={...e,path:e.path??[]};if(!e.message){let r=Oi(e.inst?._zod.def?.error?.(e))??Oi(t?.error?.(e))??Oi(n.customError?.(e))??Oi(n.localeError?.(e))??"Invalid input";o.message=r}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function Ai(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Mi(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ln(...e){let[t,n,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:o};return{...t}}function DD(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function yb(e){let t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}function xb(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function PD(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return yb(t+n)}function CD(e){return xb(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function RD(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)n[o/2]=Number.parseInt(t.slice(o,o+2),16);return n}function AD(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}class vb{constructor(...e){}}var Sb=(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,To,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ui=x("$ZodError",Sb),It=x("$ZodError",Sb,{Parent:Error});function Ni(e,t=(n)=>n.message){let n={},o=[];for(let r of e.issues)if(r.path.length>0)n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r));else o.push(t(r));return{formErrors:o,fieldErrors:n}}function Fi(e,t){let n=t||function(i){return i.message},o={_errors:[]},r=(i)=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)o._errors.push(n(s));else{let a=o,l=0;while(l<s.path.length){let c=s.path[l];if(l!==s.path.length-1)a[c]=a[c]||{_errors:[]};else a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s));a=a[c],l++}}};return r(e),o}function lp(e,t){let n=t||function(i){return i.message},o={errors:[]},r=(i,s=[])=>{var a,l;for(let c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map((u)=>r({issues:u},c.path));else if(c.code==="invalid_key")r({issues:c.issues},c.path);else if(c.code==="invalid_element")r({issues:c.issues},c.path);else{let u=[...s,...c.path];if(u.length===0){o.errors.push(n(c));continue}let f=o,h=0;while(h<u.length){let m=u[h],y=h===u.length-1;if(typeof m==="string")f.properties??(f.properties={}),(a=f.properties)[m]??(a[m]={errors:[]}),f=f.properties[m];else f.items??(f.items=[]),(l=f.items)[m]??(l[m]={errors:[]}),f=f.items[m];if(y)f.errors.push(n(c));h++}}};return r(e),o}function bb(e){let t=[],n=e.map((o)=>typeof o==="object"?o.key:o);for(let o of n)if(typeof o==="number")t.push(`[${o}]`);else if(typeof o==="symbol")t.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))t.push(`[${JSON.stringify(o)}]`);else{if(t.length)t.push(".");t.push(o)}return t.join("")}function up(e){let t=[],n=[...e.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)if(t.push(`✖ ${o.message}`),o.path?.length)t.push(` → at ${bb(o.path)}`);return t.join(`
171
+ `)}var $o=(e)=>(t,n,o,r)=>{let i=o?Object.assign(o,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new yr;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map((l)=>Ut(l,i,et())));throw za(a,r?.callee),a}return s.value},La=$o(It),Oo=(e)=>async(t,n,o,r)=>{let i=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map((l)=>Ut(l,i,et())));throw za(a,r?.callee),a}return s.value},ja=Oo(It),Do=(e)=>(t,n,o)=>{let r=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new yr;return i.issues.length?{success:!1,error:new(e??Ui)(i.issues.map((s)=>Ut(s,r,et())))}:{success:!0,data:i.value}},dp=Do(It),Po=(e)=>async(t,n,o)=>{let r=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>Ut(s,r,et())))}:{success:!0,data:i.value}},pp=Po(It),Ga=(e)=>(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return $o(e)(t,n,r)},UD=Ga(It),Za=(e)=>(t,n,o)=>$o(e)(t,n,o),ND=Za(It),Ba=(e)=>async(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Oo(e)(t,n,r)},FD=Ba(It),qa=(e)=>async(t,n,o)=>Oo(e)(t,n,o),zD=qa(It),Ha=(e)=>(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Do(e)(t,n,r)},LD=Ha(It),Va=(e)=>(t,n,o)=>Do(e)(t,n,o),jD=Va(It),Wa=(e)=>async(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Po(e)(t,n,r)},GD=Wa(It),Ja=(e)=>async(t,n,o)=>Po(e)(t,n,o),ZD=Ja(It);var Rr={};An(Rr,{base64:()=>Ep,base64url:()=>Ka,bigint:()=>Rp,boolean:()=>Up,browserEmail:()=>YD,cidrv4:()=>Ip,cidrv6:()=>Tp,cuid:()=>mp,cuid2:()=>fp,date:()=>Op,datetime:()=>Pp,domain:()=>kb,duration:()=>vp,e164:()=>$p,email:()=>bp,emoji:()=>_p,extendedDuration:()=>BD,guid:()=>Sp,hex:()=>Tb,hostname:()=>Ya,html5Email:()=>WD,idnEmail:()=>KD,integer:()=>Ap,ipv4:()=>kp,ipv6:()=>wp,ksuid:()=>yp,lowercase:()=>zp,md5_base64:()=>QD,md5_base64url:()=>eP,md5_hex:()=>XD,nanoid:()=>xp,null:()=>Np,number:()=>Mp,rfc5322Email:()=>JD,sha1_base64:()=>rP,sha1_base64url:()=>nP,sha1_hex:()=>tP,sha256_base64:()=>iP,sha256_base64url:()=>sP,sha256_hex:()=>oP,sha384_base64:()=>cP,sha384_base64url:()=>lP,sha384_hex:()=>aP,sha512_base64:()=>dP,sha512_base64url:()=>pP,sha512_hex:()=>uP,string:()=>Cp,time:()=>Dp,ulid:()=>hp,undefined:()=>Fp,unicodeEmail:()=>_b,uppercase:()=>Lp,uuid:()=>Ln,uuid4:()=>qD,uuid6:()=>HD,uuid7:()=>VD,xid:()=>gp});var mp=/^[cC][^\s-]{8,}$/,fp=/^[0-9a-z]+$/,hp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,gp=/^[0-9a-vA-V]{20}$/,yp=/^[A-Za-z0-9]{27}$/,xp=/^[a-zA-Z0-9_-]{21}$/,vp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,BD=/^[-+]?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)?)??$/,Sp=/^([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})$/,Ln=(e)=>{if(!e)return/^([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)$/;return 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})$`)},qD=Ln(4),HD=Ln(6),VD=Ln(7),bp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,WD=/^[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])?)*$/,JD=/^(([^<>()\[\]\\.,;:\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,}))$/,_b=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,KD=_b,YD=/^[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])?)*$/;function _p(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var kp=/^(?:(?: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])$/,wp=/^(([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}|:))$/,Ip=/^((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])$/,Tp=/^(([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])$/,Ep=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ka=/^[A-Za-z0-9_-]*$/,Ya=/^(?=.{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])?)*\.?$/,kb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,$p=/^\+(?:[0-9]){6,14}[0-9]$/,wb="(?:(?:\\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])))",Op=new RegExp(`^${wb}$`);function Ib(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Dp(e){return new RegExp(`^${Ib(e)}$`)}function Pp(e){let t=Ib({precision:e.precision}),n=["Z"];if(e.local)n.push("");if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${n.join("|")})`;return new RegExp(`^${wb}T(?:${o})$`)}var Cp=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Rp=/^-?\d+n?$/,Ap=/^-?\d+$/,Mp=/^-?\d+(?:\.\d+)?/,Up=/^(?:true|false)$/i,Np=/^null$/i;var Fp=/^undefined$/i;var zp=/^[^A-Z]*$/,Lp=/^[^a-z]*$/,Tb=/^[0-9a-fA-F]*$/;function zi(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Li(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var XD=/^[0-9a-fA-F]{32}$/,QD=zi(22,"=="),eP=Li(22),tP=/^[0-9a-fA-F]{40}$/,rP=zi(27,"="),nP=Li(27),oP=/^[0-9a-fA-F]{64}$/,iP=zi(43,"="),sP=Li(43),aP=/^[0-9a-fA-F]{96}$/,cP=zi(64,""),lP=Li(64),uP=/^[0-9a-fA-F]{128}$/,dP=zi(86,"=="),pP=Li(86);var Ae=x("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),$b={number:"number",bigint:"bigint",object:"date"},Xa=x("$ZodCheckLessThan",(e,t)=>{Ae.init(e,t);let n=$b[typeof t.value];e._zod.onattach.push((o)=>{let r=o._zod.bag,i=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)r.maximum=t.value;else r.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:n,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qa=x("$ZodCheckGreaterThan",(e,t)=>{Ae.init(e,t);let n=$b[typeof t.value];e._zod.onattach.push((o)=>{let r=o._zod.bag,i=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)r.minimum=t.value;else r.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:n,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jp=x("$ZodCheckMultipleOf",(e,t)=>{Ae.init(e,t),e._zod.onattach.push((n)=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?n.value%t.value===BigInt(0):np(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Gp=x("$ZodCheckNumberFormat",(e,t)=>{Ae.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),o=n?"int":"number",[r,i]=ap[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=r,a.maximum=i,n)a.pattern=Ap}),e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}if(a<r)s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:e})}}),Zp=x("$ZodCheckBigIntFormat",(e,t)=>{Ae.init(e,t);let[n,o]=cp[t.format];e._zod.onattach.push((r)=>{let i=r._zod.bag;i.format=t.format,i.minimum=n,i.maximum=o}),e._zod.check=(r)=>{let i=r.value;if(i<n)r.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(i>o)r.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inst:e})}}),Bp=x("$ZodCheckMaxSize",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.size!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let r=o.value;if(r.size<=t.maximum)return;o.issues.push({origin:Ai(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qp=x("$ZodCheckMinSize",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.size!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let r=o.value;if(r.size>=t.minimum)return;o.issues.push({origin:Ai(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Hp=x("$ZodCheckSizeEquals",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.size!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=(o)=>{let r=o.value,i=r.size;if(i===t.size)return;let s=i>t.size;o.issues.push({origin:Ai(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Vp=x("$ZodCheckMaxLength",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.length!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let r=o.value;if(r.length<=t.maximum)return;let s=Mi(r);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wp=x("$ZodCheckMinLength",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.length!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let r=o.value;if(r.length>=t.minimum)return;let s=Mi(r);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Jp=x("$ZodCheckLengthEquals",(e,t)=>{var n;Ae.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!on(r)&&r.length!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=(o)=>{let r=o.value,i=r.length;if(i===t.length)return;let s=Mi(r),a=i>t.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Co=x("$ZodCheckStringFormat",(e,t)=>{var n,o;if(Ae.init(e,t),e._zod.onattach.push((r)=>{let i=r._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(n=e._zod).check??(n.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),Kp=x("$ZodCheckRegex",(e,t)=>{Co.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Yp=x("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=zp),Co.init(e,t)}),Xp=x("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Lp),Co.init(e,t)}),Qp=x("$ZodCheckIncludes",(e,t)=>{Ae.init(e,t);let n=xr(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push((r)=>{let i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=(r)=>{if(r.value.includes(t.includes,t.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),em=x("$ZodCheckStartsWith",(e,t)=>{Ae.init(e,t);let n=new RegExp(`^${xr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),tm=x("$ZodCheckEndsWith",(e,t)=>{Ae.init(e,t);let n=new RegExp(`.*${xr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function Eb(e,t,n){if(e.issues.length)t.issues.push(...Mt(n,e.issues))}var rm=x("$ZodCheckProperty",(e,t)=>{Ae.init(e,t),e._zod.check=(n)=>{let o=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then((r)=>Eb(r,n,t.property));Eb(o,n,t.property);return}}),nm=x("$ZodCheckMimeType",(e,t)=>{Ae.init(e,t);let n=new Set(t.mime);e._zod.onattach.push((o)=>{o._zod.bag.mime=t.mime}),e._zod.check=(o)=>{if(n.has(o.value.type))return;o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),om=x("$ZodCheckOverwrite",(e,t)=>{Ae.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class ec{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
172
172
  `).filter((i)=>i),o=Math.min(...n.map((i)=>i.length-i.trimStart().length)),r=n.map((i)=>i.slice(o)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of r)this.content.push(i)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((r)=>` ${r}`)];return new e(...t,o.join(`
173
173
  `))}}var im={major:4,minor:1,patch:8};var Z=x("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=im;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let r of o)for(let i of r._zod.onattach)i(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(s,a,l)=>{let c=cn(s),u;for(let f of a){if(f._zod.def.when){if(!f._zod.def.when(s))continue}else if(c)continue;let h=s.issues.length,m=f._zod.check(s);if(m instanceof Promise&&l?.async===!1)throw new yr;if(u||m instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await m,s.issues.length===h)return;if(!c)c=cn(s,h)});else{if(s.issues.length===h)continue;if(!c)c=cn(s,h)}}if(u)return u.then(()=>s);return s},i=(s,a,l)=>{if(cn(s))return s.aborted=!0,s;let c=r(a,o,l);if(c instanceof Promise){if(l.async===!1)throw new yr;return c.then((u)=>e._zod.parse(u,l))}return e._zod.parse(c,l)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let c=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});if(c instanceof Promise)return c.then((u)=>i(u,s,a));return i(c,s,a)}let l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new yr;return l.then((c)=>r(c,o,a))}return r(l,o,a)}}e["~standard"]={validate:(r)=>{try{let i=dp(e,r);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return pp(e,r).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),jn=x("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Cp(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Oe=x("$ZodStringFormat",(e,t)=>{Co.init(e,t),jn.init(e,t)}),am=x("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Sp),Oe.init(e,t)}),cm=x("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ln(o))}else t.pattern??(t.pattern=Ln());Oe.init(e,t)}),lm=x("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=bp),Oe.init(e,t)}),um=x("$ZodURL",(e,t)=>{Oe.init(e,t),e._zod.check=(n)=>{try{let o=n.value.trim(),r=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(r.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Ya.source,input:n.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})}if(t.normalize)n.value=r.href;else n.value=o;return}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),dm=x("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=_p()),Oe.init(e,t)}),pm=x("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=xp),Oe.init(e,t)}),mm=x("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mp),Oe.init(e,t)}),fm=x("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=fp),Oe.init(e,t)}),hm=x("$ZodULID",(e,t)=>{t.pattern??(t.pattern=hp),Oe.init(e,t)}),gm=x("$ZodXID",(e,t)=>{t.pattern??(t.pattern=gp),Oe.init(e,t)}),ym=x("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=yp),Oe.init(e,t)}),xm=x("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Pp(t)),Oe.init(e,t)}),vm=x("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Op),Oe.init(e,t)}),Sm=x("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Dp(t)),Oe.init(e,t)}),bm=x("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vp),Oe.init(e,t)}),_m=x("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=kp),Oe.init(e,t),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.format="ipv4"})}),km=x("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=wp),Oe.init(e,t),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.format="ipv6"}),e._zod.check=(n)=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),wm=x("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ip),Oe.init(e,t)}),Im=x("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Tp),Oe.init(e,t),e._zod.check=(n)=>{let o=n.value.split("/");try{if(o.length!==2)throw Error();let[r,i]=o;if(!i)throw Error();let s=Number(i);if(`${s}`!==i)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Tm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Em=x("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ep),Oe.init(e,t),e._zod.onattach.push((n)=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=(n)=>{if(Tm(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Lb(e){if(!Ka.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Tm(n)}var $m=x("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ka),Oe.init(e,t),e._zod.onattach.push((n)=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=(n)=>{if(Lb(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Om=x("$ZodE164",(e,t)=>{t.pattern??(t.pattern=$p),Oe.init(e,t)});function jb(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[o]=n;if(!o)return!1;let r=JSON.parse(atob(o));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(t&&(!("alg"in r)||r.alg!==t))return!1;return!0}catch{return!1}}var Dm=x("$ZodJWT",(e,t)=>{Oe.init(e,t),e._zod.check=(n)=>{if(jb(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Pm=x("$ZodCustomStringFormat",(e,t)=>{Oe.init(e,t),e._zod.check=(n)=>{if(t.fn(n.value))return;n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),sc=x("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??Mp,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}let r=n.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let i=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?"Infinity":void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}}),Cm=x("$ZodNumber",(e,t)=>{Gp.init(e,t),sc.init(e,t)}),ji=x("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=Up,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}let r=n.value;if(typeof r==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),ac=x("$ZodBigInt",(e,t)=>{Z.init(e,t),e._zod.pattern=Rp,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(r){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Rm=x("$ZodBigInt",(e,t)=>{Zp.init(e,t),ac.init(e,t)}),Am=x("$ZodSymbol",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(typeof r==="symbol")return n;return n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),Mm=x("$ZodUndefined",(e,t)=>{Z.init(e,t),e._zod.pattern=Fp,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,o)=>{let r=n.value;if(typeof r>"u")return n;return n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),Um=x("$ZodNull",(e,t)=>{Z.init(e,t),e._zod.pattern=Np,e._zod.values=new Set([null]),e._zod.parse=(n,o)=>{let r=n.value;if(r===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),Nm=x("$ZodAny",(e,t)=>{Z.init(e,t),e._zod.parse=(n)=>n}),Fm=x("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=(n)=>n}),zm=x("$ZodNever",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Lm=x("$ZodVoid",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(typeof r>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),jm=x("$ZodDate",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let r=n.value,i=r instanceof Date;if(i&&!Number.isNaN(r.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:e}),n}});function Db(e,t,n){if(e.issues.length)t.issues.push(...Mt(n,e.issues));t.value[n]=e.value}var Gm=x("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let i=[];for(let s=0;s<r.length;s++){let a=r[s],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)i.push(l.then((c)=>Db(c,n,s)));else Db(l,n,s)}if(i.length)return Promise.all(i).then(()=>n);return n}});function ic(e,t,n,o){if(e.issues.length)t.issues.push(...Mt(n,e.issues));if(e.value===void 0){if(n in o)t.value[n]=void 0}else t.value[n]=e.value}function Gb(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let n=sp(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Zb(e,t,n,o,r,i){let s=[],a=r.keySet,l=r.catchall._zod,c=l.def.type;for(let u of Object.keys(t)){if(a.has(u))continue;if(c==="never"){s.push(u);continue}let f=l.run({value:t[u],issues:[]},o);if(f instanceof Promise)e.push(f.then((h)=>ic(h,n,u,t)));else ic(f,n,u,t)}if(s.length)n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i});if(!e.length)return n;return Promise.all(e).then(()=>n)}var Bb=x("$ZodObject",(e,t)=>{Z.init(e,t);let n=Eo(()=>Gb(t));te(e._zod,"propValues",()=>{let s=t.shape,a={};for(let l in s){let c=s[l]._zod;if(c.values){a[l]??(a[l]=new Set);for(let u of c.values)a[l].add(u)}}return a});let o=zn,r=t.catchall,i;e._zod.parse=(s,a)=>{i??(i=n.value);let l=s.value;if(!o(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),s;s.value={};let c=[],u=i.shape;for(let f of i.keys){let m=u[f]._zod.run({value:l[f],issues:[]},a);if(m instanceof Promise)c.push(m.then((y)=>ic(y,s,f,l)));else ic(m,s,f,l)}if(!r)return c.length?Promise.all(c).then(()=>s):s;return Zb(c,l,s,a,n.value,e)}}),Zm=x("$ZodObjectJIT",(e,t)=>{Bb.init(e,t);let n=e._zod.parse,o=Eo(()=>Gb(t)),r=(h)=>{let m=new ec(["shape","payload","ctx"]),y=o.value,k=(R)=>{let M=Fa(R);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};m.write("const input = payload.value;");let S=Object.create(null),I=0;for(let R of y.keys)S[R]=`key_${I++}`;m.write("const newResult = {};");for(let R of y.keys){let M=S[R],me=Fa(R);m.write(`const ${M} = ${k(R)};`),m.write(`
174
174
  if (${M}.issues.length) {
@@ -187,20 +187,20 @@ CREATE INDEX IF NOT EXISTS idx_boulder_dir_session ON boulder_tasks(directory, s
187
187
  newResult[${me}] = ${M}.value;
188
188
  }
189
189
 
190
- `)}m.write("payload.value = newResult;"),m.write("return payload;");let D=m.compile();return(R,M)=>D(h,R,M)},i,s=zn,a=!$i.jitless,c=a&&op.value,u=t.catchall,f;e._zod.parse=(h,m)=>{f??(f=o.value);let y=h.value;if(!s(y))return h.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),h;if(a&&c&&m?.async===!1&&m.jitless!==!0){if(!i)i=r(t.shape);if(h=i(h,m),!u)return h;return Zb([],y,h,m,f,e)}return n(h,m)}});function Pb(e,t,n,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let r=e.filter((i)=>!cn(i));if(r.length===1)return t.value=r[0].value,r[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>Ut(s,o,et())))}),t}var cc=x("$ZodUnion",(e,t)=>{Z.init(e,t),te(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),te(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),te(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),te(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((i)=>i._zod.pattern);return new RegExp(`^(${r.map((i)=>Pi(i.source)).join("|")})$`)}return});let n=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(r,i)=>{if(n)return o(r,i);let s=!1,a=[];for(let l of t.options){let c=l._zod.run({value:r.value,issues:[]},i);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}if(!s)return Pb(a,r,e,i);return Promise.all(a).then((l)=>Pb(l,r,e,i))}}),Bm=x("$ZodDiscriminatedUnion",(e,t)=>{cc.init(e,t);let n=e._zod.parse;te(e._zod,"propValues",()=>{let r={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,l]of Object.entries(s)){if(!r[a])r[a]=new Set;for(let c of l)r[a].add(c)}}return r});let o=Eo(()=>{let r=t.options,i=new Map;for(let s of r){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let l of a){if(i.has(l))throw Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(r,i)=>{let s=r.value;if(!zn(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;let a=o.value.get(s?.[t.discriminator]);if(a)return a._zod.run(r,i);if(t.unionFallback)return n(r,i);return r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),r}}),qm=x("$ZodIntersection",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value,i=t.left._zod.run({value:r,issues:[]},o),s=t.right._zod.run({value:r,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([l,c])=>Cb(n,l,c));return Cb(n,i,s)}});function sm(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(an(e)&&an(t)){let n=Object.keys(t),o=Object.keys(e).filter((i)=>n.indexOf(i)!==-1),r={...e,...t};for(let i of o){let s=sm(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r[i]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t[o],s=sm(r,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Cb(e,t,n){if(t.issues.length)e.issues.push(...t.issues);if(n.issues.length)e.issues.push(...n.issues);if(cn(e))return e;let o=sm(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var lc=x("$ZodTuple",(e,t)=>{Z.init(e,t);let n=t.items,o=n.length-[...n].reverse().findIndex((r)=>r._zod.optin!=="optional");e._zod.parse=(r,i)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let a=[];if(!t.rest){let c=s.length>n.length,u=s.length<o-1;if(c||u)return r.issues.push({...c?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},input:s,inst:e,origin:"array"}),r}let l=-1;for(let c of n){if(l++,l>=s.length){if(l>=o)continue}let u=c._zod.run({value:s[l],issues:[]},i);if(u instanceof Promise)a.push(u.then((f)=>tc(f,r,l)));else tc(u,r,l)}if(t.rest){let c=s.slice(n.length);for(let u of c){l++;let f=t.rest._zod.run({value:u,issues:[]},i);if(f instanceof Promise)a.push(f.then((h)=>tc(h,r,l)));else tc(f,r,l)}}if(a.length)return Promise.all(a).then(()=>r);return r}});function tc(e,t,n){if(e.issues.length)t.issues.push(...Mt(n,e.issues));t.value[n]=e.value}var Vm=x("$ZodRecord",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!an(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let i=[];if(t.keyType._zod.values){let s=t.keyType._zod.values;n.value={};for(let l of s)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){let c=t.valueType._zod.run({value:r[l],issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>{if(u.issues.length)n.issues.push(...Mt(l,u.issues));n.value[l]=u.value}));else{if(c.issues.length)n.issues.push(...Mt(l,c.issues));n.value[l]=c.value}}let a;for(let l in r)if(!s.has(l))a=a??[],a.push(l);if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:a})}else{n.value={};for(let s of Reflect.ownKeys(r)){if(s==="__proto__")continue;let a=t.keyType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map((c)=>Ut(c,o,et())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}let l=t.valueType._zod.run({value:r[s],issues:[]},o);if(l instanceof Promise)i.push(l.then((c)=>{if(c.issues.length)n.issues.push(...Mt(s,c.issues));n.value[a.value]=c.value}));else{if(l.issues.length)n.issues.push(...Mt(s,l.issues));n.value[a.value]=l.value}}}if(i.length)return Promise.all(i).then(()=>n);return n}}),Wm=x("$ZodMap",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),n;let i=[];n.value=new Map;for(let[s,a]of r){let l=t.keyType._zod.run({value:s,issues:[]},o),c=t.valueType._zod.run({value:a,issues:[]},o);if(l instanceof Promise||c instanceof Promise)i.push(Promise.all([l,c]).then(([u,f])=>{Rb(u,f,n,s,r,e,o)}));else Rb(l,c,n,s,r,e,o)}if(i.length)return Promise.all(i).then(()=>n);return n}});function Rb(e,t,n,o,r,i,s){if(e.issues.length)if(Ri.has(typeof o))n.issues.push(...Mt(o,e.issues));else n.issues.push({code:"invalid_key",origin:"map",input:r,inst:i,issues:e.issues.map((a)=>Ut(a,s,et()))});if(t.issues.length)if(Ri.has(typeof o))n.issues.push(...Mt(o,t.issues));else n.issues.push({origin:"map",code:"invalid_element",input:r,inst:i,key:o,issues:t.issues.map((a)=>Ut(a,s,et()))});n.value.set(e.value,t.value)}var Hm=x("$ZodSet",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),n;let i=[];n.value=new Set;for(let s of r){let a=t.valueType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)i.push(a.then((l)=>Ab(l,n)));else Ab(a,n)}if(i.length)return Promise.all(i).then(()=>n);return n}});function Ab(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var Jm=x("$ZodEnum",(e,t)=>{Z.init(e,t);let n=Di(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter((r)=>Ri.has(typeof r)).map((r)=>typeof r==="string"?xr(r):r.toString()).join("|")})$`),e._zod.parse=(r,i)=>{let s=r.value;if(o.has(s))return r;return r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Km=x("$ZodLiteral",(e,t)=>{if(Z.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?xr(n):n?xr(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let r=n.value;if(e._zod.values.has(r))return n;return n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}}),Ym=x("$ZodFile",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(r instanceof File)return n;return n.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),n}}),Xm=x("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Fn(e.constructor.name);let r=t.transform(n.value,n);if(o.async)return(r instanceof Promise?r:Promise.resolve(r)).then((s)=>(n.value=s,n));if(r instanceof Promise)throw new yr;return n.value=r,n}});function Mb(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var Qm=x("$ZodOptional",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),te(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Pi(n.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(t.innerType._zod.optin==="optional"){let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Mb(i,n.value));return Mb(r,n.value)}if(n.value===void 0)return n;return t.innerType._zod.run(n,o)}}),ef=x("$ZodNullable",(e,t)=>{Z.init(e,t),te(e._zod,"optin",()=>t.innerType._zod.optin),te(e._zod,"optout",()=>t.innerType._zod.optout),te(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Pi(n.source)}|null)$`):void 0}),te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>{if(n.value===null)return n;return t.innerType._zod.run(n,o)}}),tf=x("$ZodDefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Ub(i,t));return Ub(r,t)}});function Ub(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var rf=x("$ZodPrefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,o)}}),nf=x("$ZodNonOptional",(e,t)=>{Z.init(e,t),te(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(n,o)=>{let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Nb(i,e));return Nb(r,e)}});function Nb(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var of=x("$ZodSuccess",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Fn("ZodSuccess");let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>(n.value=i.issues.length===0,n));return n.value=r.issues.length===0,n}}),sf=x("$ZodCatch",(e,t)=>{Z.init(e,t),te(e._zod,"optin",()=>t.innerType._zod.optin),te(e._zod,"optout",()=>t.innerType._zod.optout),te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>{if(n.value=i.value,i.issues.length)n.value=t.catchValue({...n,error:{issues:i.issues.map((s)=>Ut(s,o,et()))},input:n.value}),n.issues=[];return n});if(n.value=r.value,r.issues.length)n.value=t.catchValue({...n,error:{issues:r.issues.map((i)=>Ut(i,o,et()))},input:n.value}),n.issues=[];return n}}),af=x("$ZodNaN",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{if(typeof n.value!=="number"||!Number.isNaN(n.value))return n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n;return n}}),cf=x("$ZodPipe",(e,t)=>{Z.init(e,t),te(e._zod,"values",()=>t.in._zod.values),te(e._zod,"optin",()=>t.in._zod.optin),te(e._zod,"optout",()=>t.out._zod.optout),te(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>rc(s,t.in,o));return rc(i,t.in,o)}let r=t.in._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>rc(i,t.out,o));return rc(r,t.out,o)}});function rc(e,t,n){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var Gi=x("$ZodCodec",(e,t)=>{Z.init(e,t),te(e._zod,"values",()=>t.in._zod.values),te(e._zod,"optin",()=>t.in._zod.optin),te(e._zod,"optout",()=>t.out._zod.optout),te(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>nc(s,t,o));return nc(i,t,o)}else{let i=t.out._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>nc(s,t,o));return nc(i,t,o)}}});function nc(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let r=t.transform(e.value,e);if(r instanceof Promise)return r.then((i)=>oc(e,i,t.out,n));return oc(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);if(r instanceof Promise)return r.then((i)=>oc(e,i,t.in,n));return oc(e,r,t.in,n)}}function oc(e,t,n,o){if(e.issues.length)return e.aborted=!0,e;return n._zod.run({value:t,issues:e.issues},o)}var lf=x("$ZodReadonly",(e,t)=>{Z.init(e,t),te(e._zod,"propValues",()=>t.innerType._zod.propValues),te(e._zod,"values",()=>t.innerType._zod.values),te(e._zod,"optin",()=>t.innerType._zod.optin),te(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then(Fb);return Fb(r)}});function Fb(e){return e.value=Object.freeze(e.value),e}var uf=x("$ZodTemplateLiteral",(e,t)=>{Z.init(e,t);let n=[];for(let o of t.parts)if(typeof o==="object"&&o!==null){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let r=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!r)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=r.startsWith("^")?1:0,s=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(i,s))}else if(o===null||ip.has(typeof o))n.push(xr(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(o,r)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"template_literal",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o;return o}}),df=x("$ZodFunction",(e,t)=>(Z.init(e,t),e._def=t,e._zod.def=t,e.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return function(...o){let r=e._def.input?La(e._def.input,o):o,i=Reflect.apply(n,this,r);if(e._def.output)return La(e._def.output,i);return i}},e.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return async function(...o){let r=e._def.input?await ja(e._def.input,o):o,i=await Reflect.apply(n,this,r);if(e._def.output)return await ja(e._def.output,i);return i}},e._zod.parse=(n,o)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n;if(e._def.output&&e._def.output._zod.def.type==="promise")n.value=e.implementAsync(n.value);else n.value=e.implement(n.value);return n},e.input=(...n)=>{let o=e.constructor;if(Array.isArray(n[0]))return new o({type:"function",input:new lc({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new o({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),pf=x("$ZodPromise",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>Promise.resolve(n.value).then((r)=>t.innerType._zod.run({value:r,issues:[]},o))}),mf=x("$ZodLazy",(e,t)=>{Z.init(e,t),te(e._zod,"innerType",()=>t.getter()),te(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),te(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),te(e._zod,"optin",()=>e._zod.innerType._zod.optin??void 0),te(e._zod,"optout",()=>e._zod.innerType._zod.optout??void 0),e._zod.parse=(n,o)=>e._zod.innerType._zod.run(n,o)}),ff=x("$ZodCustom",(e,t)=>{Ae.init(e,t),Z.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=(n)=>{let o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then((i)=>zb(i,n,o,e));zb(r,n,o,e);return}});function zb(e,t,n,o){if(!e){let r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)r.params=o._zod.def.params;t.issues.push(ln(r))}}var Hi={};An(Hi,{ar:()=>hf,az:()=>gf,be:()=>yf,ca:()=>xf,cs:()=>vf,da:()=>Sf,de:()=>bf,en:()=>Zi,eo:()=>_f,es:()=>kf,fa:()=>wf,fi:()=>If,fr:()=>Tf,frCA:()=>Ef,he:()=>$f,hu:()=>Of,id:()=>Df,is:()=>Pf,it:()=>Cf,ja:()=>Rf,ka:()=>Af,kh:()=>Mf,km:()=>Bi,ko:()=>Uf,lt:()=>Nf,mk:()=>Ff,ms:()=>zf,nl:()=>Lf,no:()=>jf,ota:()=>Gf,pl:()=>Bf,ps:()=>Zf,pt:()=>qf,ru:()=>Vf,sl:()=>Wf,sv:()=>Hf,ta:()=>Jf,th:()=>Kf,tr:()=>Yf,ua:()=>Xf,uk:()=>Wi,ur:()=>Qf,vi:()=>eh,yo:()=>nh,zhCN:()=>th,zhTW:()=>rh});var fP=()=>{let e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(r)=>{switch(r.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${r.expected}، ولكن تم إدخال ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${O(r.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return` أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${i} ${r.maximum.toString()} ${s.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${i} ${r.minimum.toString()} ${s.unit}`;return`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${r.prefix}"`;if(i.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`;if(i.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`;if(i.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`;return`${o[i.format]??r.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${r.divisor}`;case"unrecognized_keys":return`معرف${r.keys.length>1?"ات":""} غريب${r.keys.length>1?"ة":""}: ${_(r.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${r.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${r.origin}`;default:return"مدخل غير مقبول"}}};function hf(){return{localeError:fP()}}var hP=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={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",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"};return(r)=>{switch(r.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${r.expected}, daxil olan ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Yanlış dəyər: gözlənilən ${O(r.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${i}${r.maximum.toString()} ${s.unit??"element"}`;return`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Çox kiçik: gözlənilən ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`;return`Çox kiçik: gözlənilən ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`;if(i.format==="ends_with")return`Yanlış mətn: "${i.suffix}" ilə bitməlidir`;if(i.format==="includes")return`Yanlış mətn: "${i.includes}" daxil olmalıdır`;if(i.format==="regex")return`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${o[i.format]??r.format}`}case"not_multiple_of":return`Yanlış ədəd: ${r.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${r.keys.length>1?"lar":""}: ${_(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${r.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function gf(){return{localeError:hP()}}function qb(e,t,n,o){let r=Math.abs(e),i=r%10,s=r%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return n;return o}var gP=()=>{let e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"лік";case"object":{if(Array.isArray(r))return"масіў";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(r)=>{switch(r.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${r.expected}, атрымана ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Няправільны ўвод: чакалася ${O(r.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=qb(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна ${s.verb} ${i}${r.maximum.toString()} ${l}`}return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна быць ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=qb(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта малы: чакалася, што ${r.origin} павінна ${s.verb} ${i}${r.minimum.toString()} ${l}`}return`Занадта малы: чакалася, што ${r.origin} павінна быць ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${i.prefix}"`;if(i.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${i.suffix}"`;if(i.format==="includes")return`Няправільны радок: павінен змяшчаць "${i.includes}"`;if(i.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`;return`Няправільны ${o[i.format]??r.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${r.keys.length>1?"ключы":"ключ"}: ${_(r.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${r.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${r.origin}`;default:return"Няправільны ўвод"}}};function yf(){return{localeError:gP()}}var yP=()=>{let e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"entrada",email:"adreça electrònica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(r)=>{switch(r.code){case"invalid_type":return`Tipus invàlid: s'esperava ${r.expected}, s'ha rebut ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Valor invàlid: s'esperava ${O(r.values[0])}`;return`Opció invàlida: s'esperava una de ${_(r.values," o ")}`;case"too_big":{let i=r.inclusive?"com a màxim":"menys de",s=t(r.origin);if(s)return`Massa gran: s'esperava que ${r.origin??"el valor"} contingués ${i} ${r.maximum.toString()} ${s.unit??"elements"}`;return`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"com a mínim":"més de",s=t(r.origin);if(s)return`Massa petit: s'esperava que ${r.origin} contingués ${i} ${r.minimum.toString()} ${s.unit}`;return`Massa petit: s'esperava que ${r.origin} fos ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Format invàlid: ha de començar amb "${i.prefix}"`;if(i.format==="ends_with")return`Format invàlid: ha d'acabar amb "${i.suffix}"`;if(i.format==="includes")return`Format invàlid: ha d'incloure "${i.includes}"`;if(i.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${i.pattern}`;return`Format invàlid per a ${o[i.format]??r.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${r.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${r.origin}`;default:return"Entrada invàlida"}}};function xf(){return{localeError:yP()}}var xP=()=>{let e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(r))return"pole";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"regulární výraz",email:"e-mailová adresa",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:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(r)=>{switch(r.code){case"invalid_type":return`Neplatný vstup: očekáváno ${r.expected}, obdrženo ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Neplatný vstup: očekáváno ${O(r.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Hodnota je příliš velká: ${r.origin??"hodnota"} musí mít ${i}${r.maximum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš velká: ${r.origin??"hodnota"} musí být ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Hodnota je příliš malá: ${r.origin??"hodnota"} musí mít ${i}${r.minimum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš malá: ${r.origin??"hodnota"} musí být ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Neplatný řetězec: musí začínat na "${i.prefix}"`;if(i.format==="ends_with")return`Neplatný řetězec: musí končit na "${i.suffix}"`;if(i.format==="includes")return`Neplatný řetězec: musí obsahovat "${i.includes}"`;if(i.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`;return`Neplatný formát ${o[i.format]??r.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${r.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${_(r.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${r.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${r.origin}`;default:return"Neplatný vstup"}}};function vf(){return{localeError:xP()}}var vP=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function n(s){return e[s]??null}function o(s){return t[s]??s}let r=(s)=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":{if(Array.isArray(s))return"liste";if(s===null)return"null";if(Object.getPrototypeOf(s)!==Object.prototype&&s.constructor)return s.constructor.name;return"objekt"}}return a},i={regex:"input",email:"e-mailadresse",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 dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(s)=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${o(s.expected)}, fik ${o(r(s.input))}`;case"invalid_value":if(s.values.length===1)return`Ugyldig værdi: forventede ${O(s.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${_(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",l=n(s.origin),c=o(s.origin);if(l)return`For stor: forventede ${c??"value"} ${l.verb} ${a} ${s.maximum.toString()} ${l.unit??"elementer"}`;return`For stor: forventede ${c??"value"} havde ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",l=n(s.origin),c=o(s.origin);if(l)return`For lille: forventede ${c} ${l.verb} ${a} ${s.minimum.toString()} ${l.unit}`;return`For lille: forventede ${c} havde ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;if(a.format==="starts_with")return`Ugyldig streng: skal starte med "${a.prefix}"`;if(a.format==="ends_with")return`Ugyldig streng: skal ende med "${a.suffix}"`;if(a.format==="includes")return`Ugyldig streng: skal indeholde "${a.includes}"`;if(a.format==="regex")return`Ugyldig streng: skal matche mønsteret ${a.pattern}`;return`Ugyldig ${i[a.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${_(s.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${s.origin}`;default:return"Ugyldigt input"}}};function Sf(){return{localeError:vP()}}var SP=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"Zahl";case"object":{if(Array.isArray(r))return"Array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(r)=>{switch(r.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${r.expected}, erhalten ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ungültige Eingabe: erwartet ${O(r.values[0])}`;return`Ungültige Option: erwartet eine von ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Zu groß: erwartet, dass ${r.origin??"Wert"} ${i}${r.maximum.toString()} ${s.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${r.origin??"Wert"} ${i}${r.maximum.toString()} ist`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Zu klein: erwartet, dass ${r.origin} ${i}${r.minimum.toString()} ${s.unit} hat`;return`Zu klein: erwartet, dass ${r.origin} ${i}${r.minimum.toString()} ist`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ungültiger String: muss mit "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ungültiger String: muss mit "${i.suffix}" enden`;if(i.format==="includes")return`Ungültiger String: muss "${i.includes}" enthalten`;if(i.format==="regex")return`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`;return`Ungültig: ${o[i.format]??r.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${_(r.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${r.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${r.origin}`;default:return"Ungültige Eingabe"}}};function bf(){return{localeError:SP()}}var bP=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},_P=()=>{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"}};function t(o){return e[o]??null}let n={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",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"};return(o)=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${bP(o.input)}`;case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${O(o.values[0])}`;return`Invalid option: expected one of ${_(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Too big: expected ${o.origin??"value"} to have ${r}${o.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Too small: expected ${o.origin} to have ${r}${o.minimum.toString()} ${i.unit}`;return`Too small: expected ${o.origin} to be ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Invalid string: must start with "${r.prefix}"`;if(r.format==="ends_with")return`Invalid string: must end with "${r.suffix}"`;if(r.format==="includes")return`Invalid string: must include "${r.includes}"`;if(r.format==="regex")return`Invalid string: must match pattern ${r.pattern}`;return`Invalid ${n[r.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":""}: ${_(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"}}};function Zi(){return{localeError:_P()}}var kP=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},wP=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(o){return e[o]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(o)=>{switch(o.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${o.expected}, riceviĝis ${kP(o.input)}`;case"invalid_value":if(o.values.length===1)return`Nevalida enigo: atendiĝis ${O(o.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${_(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${r}${o.maximum.toString()} ${i.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Tro malgranda: atendiĝis ke ${o.origin} havu ${r}${o.minimum.toString()} ${i.unit}`;return`Tro malgranda: atendiĝis ke ${o.origin} estu ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${r.prefix}"`;if(r.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${r.suffix}"`;if(r.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${r.includes}"`;if(r.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`;return`Nevalida ${n[r.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} ŝlosilo${o.keys.length>1?"j":""}: ${_(o.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function _f(){return{localeError:wP()}}var IP=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function n(s){return e[s]??null}function o(s){return t[s]??s}let r=(s)=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"number";case"object":{if(Array.isArray(s))return"array";if(s===null)return"null";if(Object.getPrototypeOf(s)!==Object.prototype)return s.constructor.name;return"object"}}return a},i={regex:"entrada",email:"dirección de correo electrónico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(s)=>{switch(s.code){case"invalid_type":return`Entrada inválida: se esperaba ${o(s.expected)}, recibido ${o(r(s.input))}`;case"invalid_value":if(s.values.length===1)return`Entrada inválida: se esperaba ${O(s.values[0])}`;return`Opción inválida: se esperaba una de ${_(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",l=n(s.origin),c=o(s.origin);if(l)return`Demasiado grande: se esperaba que ${c??"valor"} tuviera ${a}${s.maximum.toString()} ${l.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${c??"valor"} fuera ${a}${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",l=n(s.origin),c=o(s.origin);if(l)return`Demasiado pequeño: se esperaba que ${c} tuviera ${a}${s.minimum.toString()} ${l.unit}`;return`Demasiado pequeño: se esperaba que ${c} fuera ${a}${s.minimum.toString()}`}case"invalid_format":{let a=s;if(a.format==="starts_with")return`Cadena inválida: debe comenzar con "${a.prefix}"`;if(a.format==="ends_with")return`Cadena inválida: debe terminar en "${a.suffix}"`;if(a.format==="includes")return`Cadena inválida: debe incluir "${a.includes}"`;if(a.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${a.pattern}`;return`Inválido ${i[a.format]??s.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${_(s.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o(s.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o(s.origin)}`;default:return"Entrada inválida"}}};function kf(){return{localeError:IP()}}var TP=()=>{let e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"آرایه";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(r)=>{switch(r.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${r.expected} می‌بود، ${n(r.input)} دریافت شد`;case"invalid_value":if(r.values.length===1)return`ورودی نامعتبر: می‌بایست ${O(r.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${_(r.values,"|")} می‌بود`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`خیلی بزرگ: ${r.origin??"مقدار"} باید ${i}${r.maximum.toString()} ${s.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${r.origin??"مقدار"} باید ${i}${r.maximum.toString()} باشد`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`خیلی کوچک: ${r.origin} باید ${i}${r.minimum.toString()} ${s.unit} باشد`;return`خیلی کوچک: ${r.origin} باید ${i}${r.minimum.toString()} باشد`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`رشته نامعتبر: باید با "${i.prefix}" شروع شود`;if(i.format==="ends_with")return`رشته نامعتبر: باید با "${i.suffix}" تمام شود`;if(i.format==="includes")return`رشته نامعتبر: باید شامل "${i.includes}" باشد`;if(i.format==="regex")return`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`;return`${o[i.format]??r.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${r.divisor} باشد`;case"unrecognized_keys":return`کلید${r.keys.length>1?"های":""} ناشناس: ${_(r.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${r.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${r.origin}`;default:return"ورودی نامعتبر"}}};function wf(){return{localeError:TP()}}var EP=()=>{let e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(r)=>{switch(r.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${r.expected}, oli ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Virheellinen syöte: täytyy olla ${O(r.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Liian suuri: ${s.subject} täytyy olla ${i}${r.maximum.toString()} ${s.unit}`.trim();return`Liian suuri: arvon täytyy olla ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Liian pieni: ${s.subject} täytyy olla ${i}${r.minimum.toString()} ${s.unit}`.trim();return`Liian pieni: arvon täytyy olla ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${i.prefix}"`;if(i.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${i.suffix}"`;if(i.format==="includes")return`Virheellinen syöte: täytyy sisältää "${i.includes}"`;if(i.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`;return`Virheellinen ${o[i.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${_(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function If(){return{localeError:EP()}}var $P=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nombre";case"object":{if(Array.isArray(r))return"tableau";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"entrée",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(r)=>{switch(r.code){case"invalid_type":return`Entrée invalide : ${r.expected} attendu, ${n(r.input)} reçu`;case"invalid_value":if(r.values.length===1)return`Entrée invalide : ${O(r.values[0])} attendu`;return`Option invalide : une valeur parmi ${_(r.values,"|")} attendue`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Trop grand : ${r.origin??"valeur"} doit ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"élément(s)"}`;return`Trop grand : ${r.origin??"valeur"} doit être ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Trop petit : ${r.origin} doit ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Trop petit : ${r.origin} doit être ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${i.pattern}`;return`${o[i.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${_(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function Tf(){return{localeError:$P()}}var OP=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"entrée",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(r)=>{switch(r.code){case"invalid_type":return`Entrée invalide : attendu ${r.expected}, reçu ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Entrée invalide : attendu ${O(r.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"≤":"<",s=t(r.origin);if(s)return`Trop grand : attendu que ${r.origin??"la valeur"} ait ${i}${r.maximum.toString()} ${s.unit}`;return`Trop grand : attendu que ${r.origin??"la valeur"} soit ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"≥":">",s=t(r.origin);if(s)return`Trop petit : attendu que ${r.origin} ait ${i}${r.minimum.toString()} ${s.unit}`;return`Trop petit : attendu que ${r.origin} soit ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au motif ${i.pattern}`;return`${o[i.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${_(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function Ef(){return{localeError:OP()}}var DP=()=>{let e={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return(r)=>{switch(r.code){case"invalid_type":return`קלט לא תקין: צריך ${r.expected}, התקבל ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`קלט לא תקין: צריך ${O(r.values[0])}`;return`קלט לא תקין: צריך אחת מהאפשרויות ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`גדול מדי: ${r.origin??"value"} צריך להיות ${i}${r.maximum.toString()} ${s.unit??"elements"}`;return`גדול מדי: ${r.origin??"value"} צריך להיות ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`קטן מדי: ${r.origin} צריך להיות ${i}${r.minimum.toString()} ${s.unit}`;return`קטן מדי: ${r.origin} צריך להיות ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`מחרוזת לא תקינה: חייבת להתחיל ב"${i.prefix}"`;if(i.format==="ends_with")return`מחרוזת לא תקינה: חייבת להסתיים ב "${i.suffix}"`;if(i.format==="includes")return`מחרוזת לא תקינה: חייבת לכלול "${i.includes}"`;if(i.format==="regex")return`מחרוזת לא תקינה: חייבת להתאים לתבנית ${i.pattern}`;return`${o[i.format]??r.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${r.divisor}`;case"unrecognized_keys":return`מפתח${r.keys.length>1?"ות":""} לא מזוה${r.keys.length>1?"ים":"ה"}: ${_(r.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${r.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${r.origin}`;default:return"קלט לא תקין"}}};function $f(){return{localeError:DP()}}var PP=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"szám";case"object":{if(Array.isArray(r))return"tömb";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"bemenet",email:"email cím",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 időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(r)=>{switch(r.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${r.expected}, a kapott érték ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Érvénytelen bemenet: a várt érték ${O(r.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Túl nagy: ${r.origin??"érték"} mérete túl nagy ${i}${r.maximum.toString()} ${s.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${r.origin??"érték"} túl nagy: ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Túl kicsi: a bemeneti érték ${r.origin} mérete túl kicsi ${i}${r.minimum.toString()} ${s.unit}`;return`Túl kicsi: a bemeneti érték ${r.origin} túl kicsi ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`;if(i.format==="ends_with")return`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`;if(i.format==="includes")return`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`;if(i.format==="regex")return`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`;return`Érvénytelen ${o[i.format]??r.format}`}case"not_multiple_of":return`Érvénytelen szám: ${r.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${r.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${r.origin}`;default:return"Érvénytelen bemenet"}}};function Of(){return{localeError:PP()}}var CP=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input tidak valid: diharapkan ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input tidak valid: diharapkan ${O(r.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${i}${r.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Terlalu kecil: diharapkan ${r.origin} memiliki ${i}${r.minimum.toString()} ${s.unit}`;return`Terlalu kecil: diharapkan ${r.origin} menjadi ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`String tidak valid: harus dimulai dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak valid: harus berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak valid: harus menyertakan "${i.includes}"`;if(i.format==="regex")return`String tidak valid: harus sesuai pola ${i.pattern}`;return`${o[i.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};function Df(){return{localeError:CP()}}var RP=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"númer";case"object":{if(Array.isArray(e))return"fylki";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},AP=()=>{let e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function t(o){return e[o]??null}let n={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return(o)=>{switch(o.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${RP(o.input)} þar sem á að vera ${o.expected}`;case"invalid_value":if(o.values.length===1)return`Rangt gildi: gert ráð fyrir ${O(o.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${_(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} hafi ${r}${o.maximum.toString()} ${i.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} sé ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Of lítið: gert er ráð fyrir að ${o.origin} hafi ${r}${o.minimum.toString()} ${i.unit}`;return`Of lítið: gert er ráð fyrir að ${o.origin} sé ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Ógildur strengur: verður að byrja á "${r.prefix}"`;if(r.format==="ends_with")return`Ógildur strengur: verður að enda á "${r.suffix}"`;if(r.format==="includes")return`Ógildur strengur: verður að innihalda "${r.includes}"`;if(r.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${r.pattern}`;return`Rangt ${n[r.format]??o.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${o.divisor}`;case"unrecognized_keys":return`Óþekkt ${o.keys.length>1?"ir lyklar":"ur lykill"}: ${_(o.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${o.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${o.origin}`;default:return"Rangt gildi"}}};function Pf(){return{localeError:AP()}}var MP=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"numero";case"object":{if(Array.isArray(r))return"vettore";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input non valido: atteso ${r.expected}, ricevuto ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input non valido: atteso ${O(r.values[0])}`;return`Opzione non valida: atteso uno tra ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Troppo grande: ${r.origin??"valore"} deve avere ${i}${r.maximum.toString()} ${s.unit??"elementi"}`;return`Troppo grande: ${r.origin??"valore"} deve essere ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Troppo piccolo: ${r.origin} deve avere ${i}${r.minimum.toString()} ${s.unit}`;return`Troppo piccolo: ${r.origin} deve essere ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Stringa non valida: deve iniziare con "${i.prefix}"`;if(i.format==="ends_with")return`Stringa non valida: deve terminare con "${i.suffix}"`;if(i.format==="includes")return`Stringa non valida: deve includere "${i.includes}"`;if(i.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${i.pattern}`;return`Invalid ${o[i.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${_(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};function Cf(){return{localeError:MP()}}var UP=()=>{let e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"数値";case"object":{if(Array.isArray(r))return"配列";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(r)=>{switch(r.code){case"invalid_type":return`無効な入力: ${r.expected}が期待されましたが、${n(r.input)}が入力されました`;case"invalid_value":if(r.values.length===1)return`無効な入力: ${O(r.values[0])}が期待されました`;return`無効な選択: ${_(r.values,"、")}のいずれかである必要があります`;case"too_big":{let i=r.inclusive?"以下である":"より小さい",s=t(r.origin);if(s)return`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${s.unit??"要素"}${i}必要があります`;return`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${i}必要があります`}case"too_small":{let i=r.inclusive?"以上である":"より大きい",s=t(r.origin);if(s)return`小さすぎる値: ${r.origin}は${r.minimum.toString()}${s.unit}${i}必要があります`;return`小さすぎる値: ${r.origin}は${r.minimum.toString()}${i}必要があります`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`無効な文字列: "${i.prefix}"で始まる必要があります`;if(i.format==="ends_with")return`無効な文字列: "${i.suffix}"で終わる必要があります`;if(i.format==="includes")return`無効な文字列: "${i.includes}"を含む必要があります`;if(i.format==="regex")return`無効な文字列: パターン${i.pattern}に一致する必要があります`;return`無効な${o[i.format]??r.format}`}case"not_multiple_of":return`無効な数値: ${r.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${r.keys.length>1?"群":""}: ${_(r.keys,"、")}`;case"invalid_key":return`${r.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${r.origin}内の無効な値`;default:return"無効な入力"}}};function Rf(){return{localeError:UP()}}var NP=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"რიცხვი";case"object":{if(Array.isArray(e))return"მასივი";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return{string:"სტრინგი",boolean:"ბულეანი",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"ფუნქცია"}[t]??t},FP=()=>{let e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function t(o){return e[o]??null}let n={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"};return(o)=>{switch(o.code){case"invalid_type":return`არასწორი შეყვანა: მოსალოდნელი ${o.expected}, მიღებული ${NP(o.input)}`;case"invalid_value":if(o.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${O(o.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${_(o.values,"|")}-დან`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} ${i.verb} ${r}${o.maximum.toString()} ${i.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} იყოს ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`ზედმეტად პატარა: მოსალოდნელი ${o.origin} ${i.verb} ${r}${o.minimum.toString()} ${i.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${o.origin} იყოს ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${r.prefix}"-ით`;if(r.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${r.suffix}"-ით`;if(r.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${r.includes}"-ს`;if(r.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${r.pattern}`;return`არასწორი ${n[r.format]??o.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${o.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${o.keys.length>1?"ები":"ი"}: ${_(o.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${o.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${o.origin}-ში`;default:return"არასწორი შეყვანა"}}};function Af(){return{localeError:FP()}}var zP=()=>{let e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(r))return"អារេ (Array)";if(r===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(r)=>{switch(r.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${r.expected} ប៉ុន្តែទទួលបាន ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${O(r.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${i} ${r.maximum.toString()} ${s.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`តូចពេក៖ ត្រូវការ ${r.origin} ${i} ${r.minimum.toString()} ${s.unit}`;return`តូចពេក៖ ត្រូវការ ${r.origin} ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`;if(i.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`;if(i.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`;if(i.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`;return`មិនត្រឹមត្រូវ៖ ${o[i.format]??r.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${r.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${_(r.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function Bi(){return{localeError:zP()}}function Mf(){return Bi()}var LP=()=>{let e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(r)=>{switch(r.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${r.expected}, 받은 타입은 ${n(r.input)}입니다`;case"invalid_value":if(r.values.length===1)return`잘못된 입력: 값은 ${O(r.values[0])} 이어야 합니다`;return`잘못된 옵션: ${_(r.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let i=r.inclusive?"이하":"미만",s=i==="미만"?"이어야 합니다":"여야 합니다",a=t(r.origin),l=a?.unit??"요소";if(a)return`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()}${l} ${i}${s}`;return`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()} ${i}${s}`}case"too_small":{let i=r.inclusive?"이상":"초과",s=i==="이상"?"이어야 합니다":"여야 합니다",a=t(r.origin),l=a?.unit??"요소";if(a)return`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()}${l} ${i}${s}`;return`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`;if(i.format==="ends_with")return`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`;if(i.format==="includes")return`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`;if(i.format==="regex")return`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${o[i.format]??r.format}`}case"not_multiple_of":return`잘못된 숫자: ${r.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${_(r.keys,", ")}`;case"invalid_key":return`잘못된 키: ${r.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${r.origin}`;default:return"잘못된 입력"}}};function Uf(){return{localeError:LP()}}var jP=(e)=>Vi(typeof e,e),Vi=(e,t=void 0)=>{switch(e){case"number":return Number.isNaN(t)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":{if(t===void 0)return"nežinomas objektas";if(t===null)return"nulinė reikšmė";if(Array.isArray(t))return"masyvas";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name;return"objektas"}case"null":return"nulinė reikšmė"}return e},qi=(e)=>e.charAt(0).toUpperCase()+e.slice(1);function Vb(e){let t=Math.abs(e),n=t%10,o=t%100;if(o>=11&&o<=19||n===0)return"many";if(n===1)return"one";return"few"}var GP=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(o,r,i,s){let a=e[o]??null;if(a===null)return a;return{unit:a.unit[r],verb:a.verb[s][i?"inclusive":"notInclusive"]}}let n={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"};return(o)=>{switch(o.code){case"invalid_type":return`Gautas tipas ${jP(o.input)}, o tikėtasi - ${Vi(o.expected)}`;case"invalid_value":if(o.values.length===1)return`Privalo būti ${O(o.values[0])}`;return`Privalo būti vienas iš ${_(o.values,"|")} pasirinkimų`;case"too_big":{let r=Vi(o.origin),i=t(o.origin,Vb(Number(o.maximum)),o.inclusive??!1,"smaller");if(i?.verb)return`${qi(r??o.origin??"reikšmė")} ${i.verb} ${o.maximum.toString()} ${i.unit??"elementų"}`;let s=o.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${qi(r??o.origin??"reikšmė")} turi būti ${s} ${o.maximum.toString()} ${i?.unit}`}case"too_small":{let r=Vi(o.origin),i=t(o.origin,Vb(Number(o.minimum)),o.inclusive??!1,"bigger");if(i?.verb)return`${qi(r??o.origin??"reikšmė")} ${i.verb} ${o.minimum.toString()} ${i.unit??"elementų"}`;let s=o.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${qi(r??o.origin??"reikšmė")} turi būti ${s} ${o.minimum.toString()} ${i?.unit}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Eilutė privalo prasidėti "${r.prefix}"`;if(r.format==="ends_with")return`Eilutė privalo pasibaigti "${r.suffix}"`;if(r.format==="includes")return`Eilutė privalo įtraukti "${r.includes}"`;if(r.format==="regex")return`Eilutė privalo atitikti ${r.pattern}`;return`Neteisingas ${n[r.format]??o.format}`}case"not_multiple_of":return`Skaičius privalo būti ${o.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${o.keys.length>1?"i":"as"} rakt${o.keys.length>1?"ai":"as"}: ${_(o.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let r=Vi(o.origin);return`${qi(r??o.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function Nf(){return{localeError:GP()}}var ZP=()=>{let e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"број";case"object":{if(Array.isArray(r))return"низа";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(r)=>{switch(r.code){case"invalid_type":return`Грешен внес: се очекува ${r.expected}, примено ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Invalid input: expected ${O(r.values[0])}`;return`Грешана опција: се очекува една ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Премногу голем: се очекува ${r.origin??"вредноста"} да има ${i}${r.maximum.toString()} ${s.unit??"елементи"}`;return`Премногу голем: се очекува ${r.origin??"вредноста"} да биде ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Премногу мал: се очекува ${r.origin} да има ${i}${r.minimum.toString()} ${s.unit}`;return`Премногу мал: се очекува ${r.origin} да биде ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Неважечка низа: мора да започнува со "${i.prefix}"`;if(i.format==="ends_with")return`Неважечка низа: мора да завршува со "${i.suffix}"`;if(i.format==="includes")return`Неважечка низа: мора да вклучува "${i.includes}"`;if(i.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${i.pattern}`;return`Invalid ${o[i.format]??r.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${_(r.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${r.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${r.origin}`;default:return"Грешен внес"}}};function Ff(){return{localeError:ZP()}}var BP=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nombor";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input tidak sah: dijangka ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input tidak sah: dijangka ${O(r.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Terlalu besar: dijangka ${r.origin??"nilai"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Terlalu kecil: dijangka ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Terlalu kecil: dijangka ${r.origin} adalah ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`String tidak sah: mesti bermula dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak sah: mesti mengandungi "${i.includes}"`;if(i.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${i.pattern}`;return`${o[i.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${_(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};function zf(){return{localeError:BP()}}var qP=()=>{let e={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"getal";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(r)=>{switch(r.code){case"invalid_type":return`Ongeldige invoer: verwacht ${r.expected}, ontving ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ongeldige invoer: verwacht ${O(r.values[0])}`;return`Ongeldige optie: verwacht één van ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Te lang: verwacht dat ${r.origin??"waarde"} ${i}${r.maximum.toString()} ${s.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${r.origin??"waarde"} ${i}${r.maximum.toString()} is`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Te kort: verwacht dat ${r.origin} ${i}${r.minimum.toString()} ${s.unit} bevat`;return`Te kort: verwacht dat ${r.origin} ${i}${r.minimum.toString()} is`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ongeldige tekst: moet met "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ongeldige tekst: moet op "${i.suffix}" eindigen`;if(i.format==="includes")return`Ongeldige tekst: moet "${i.includes}" bevatten`;if(i.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`;return`Ongeldig: ${o[i.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};function Lf(){return{localeError:qP()}}var VP=()=>{let e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"tall";case"object":{if(Array.isArray(r))return"liste";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Ugyldig input: forventet ${r.expected}, fikk ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ugyldig verdi: forventet ${O(r.values[0])}`;return`Ugyldig valg: forventet en av ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`For stor(t): forventet ${r.origin??"value"} til å ha ${i}${r.maximum.toString()} ${s.unit??"elementer"}`;return`For stor(t): forventet ${r.origin??"value"} til å ha ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`For lite(n): forventet ${r.origin} til å ha ${i}${r.minimum.toString()} ${s.unit}`;return`For lite(n): forventet ${r.origin} til å ha ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ugyldig streng: må starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: må ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: må inneholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: må matche mønsteret ${i.pattern}`;return`Ugyldig ${o[i.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${_(r.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};function jf(){return{localeError:VP()}}var WP=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"numara";case"object":{if(Array.isArray(r))return"saf";if(r===null)return"gayb";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"giren",email:"epostagâh",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 hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(r)=>{switch(r.code){case"invalid_type":return`Fâsit giren: umulan ${r.expected}, alınan ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Fâsit giren: umulan ${O(r.values[0])}`;return`Fâsit tercih: mûteberler ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Fazla büyük: ${r.origin??"value"}, ${i}${r.maximum.toString()} ${s.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${r.origin??"value"}, ${i}${r.maximum.toString()} olmalıydı.`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Fazla küçük: ${r.origin}, ${i}${r.minimum.toString()} ${s.unit} sahip olmalıydı.`;return`Fazla küçük: ${r.origin}, ${i}${r.minimum.toString()} olmalıydı.`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Fâsit metin: "${i.prefix}" ile başlamalı.`;if(i.format==="ends_with")return`Fâsit metin: "${i.suffix}" ile bitmeli.`;if(i.format==="includes")return`Fâsit metin: "${i.includes}" ihtivâ etmeli.`;if(i.format==="regex")return`Fâsit metin: ${i.pattern} nakşına uymalı.`;return`Fâsit ${o[i.format]??r.format}`}case"not_multiple_of":return`Fâsit sayı: ${r.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`${r.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${r.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Gf(){return{localeError:WP()}}var HP=()=>{let e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"ارې";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return(r)=>{switch(r.code){case"invalid_type":return`ناسم ورودي: باید ${r.expected} وای, مګر ${n(r.input)} ترلاسه شو`;case"invalid_value":if(r.values.length===1)return`ناسم ورودي: باید ${O(r.values[0])} وای`;return`ناسم انتخاب: باید یو له ${_(r.values,"|")} څخه وای`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`ډیر لوی: ${r.origin??"ارزښت"} باید ${i}${r.maximum.toString()} ${s.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${r.origin??"ارزښت"} باید ${i}${r.maximum.toString()} وي`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`ډیر کوچنی: ${r.origin} باید ${i}${r.minimum.toString()} ${s.unit} ولري`;return`ډیر کوچنی: ${r.origin} باید ${i}${r.minimum.toString()} وي`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`ناسم متن: باید د "${i.prefix}" سره پیل شي`;if(i.format==="ends_with")return`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`;if(i.format==="includes")return`ناسم متن: باید "${i.includes}" ولري`;if(i.format==="regex")return`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`;return`${o[i.format]??r.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${r.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${r.keys.length>1?"کلیډونه":"کلیډ"}: ${_(r.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${r.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${r.origin} کې`;default:return"ناسمه ورودي"}}};function Zf(){return{localeError:HP()}}var JP=()=>{let e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"liczba";case"object":{if(Array.isArray(r))return"tablica";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"wyrażenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(r)=>{switch(r.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${r.expected}, otrzymano ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${O(r.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Za duża wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${i}${r.maximum.toString()} ${s.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Za mała wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${i}${r.minimum.toString()} ${s.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`;if(i.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`;if(i.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`;if(i.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`;return`Nieprawidłow(y/a/e) ${o[i.format]??r.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${r.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${r.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Bf(){return{localeError:JP()}}var KP=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"número";case"object":{if(Array.isArray(r))return"array";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"padrão",email:"endereço de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(r)=>{switch(r.code){case"invalid_type":return`Tipo inválido: esperado ${r.expected}, recebido ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Entrada inválida: esperado ${O(r.values[0])}`;return`Opção inválida: esperada uma das ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Muito grande: esperado que ${r.origin??"valor"} tivesse ${i}${r.maximum.toString()} ${s.unit??"elementos"}`;return`Muito grande: esperado que ${r.origin??"valor"} fosse ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Muito pequeno: esperado que ${r.origin} tivesse ${i}${r.minimum.toString()} ${s.unit}`;return`Muito pequeno: esperado que ${r.origin} fosse ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Texto inválido: deve começar com "${i.prefix}"`;if(i.format==="ends_with")return`Texto inválido: deve terminar com "${i.suffix}"`;if(i.format==="includes")return`Texto inválido: deve incluir "${i.includes}"`;if(i.format==="regex")return`Texto inválido: deve corresponder ao padrão ${i.pattern}`;return`${o[i.format]??r.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Chave inválida em ${r.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${r.origin}`;default:return"Campo inválido"}}};function qf(){return{localeError:KP()}}function Wb(e,t,n,o){let r=Math.abs(e),i=r%10,s=r%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return n;return o}var YP=()=>{let e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"массив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(r)=>{switch(r.code){case"invalid_type":return`Неверный ввод: ожидалось ${r.expected}, получено ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Неверный ввод: ожидалось ${O(r.values[0])}`;return`Неверный вариант: ожидалось одно из ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=Wb(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет иметь ${i}${r.maximum.toString()} ${l}`}return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=Wb(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком маленькое значение: ожидалось, что ${r.origin} будет иметь ${i}${r.minimum.toString()} ${l}`}return`Слишком маленькое значение: ожидалось, что ${r.origin} будет ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Неверная строка: должна начинаться с "${i.prefix}"`;if(i.format==="ends_with")return`Неверная строка: должна заканчиваться на "${i.suffix}"`;if(i.format==="includes")return`Неверная строка: должна содержать "${i.includes}"`;if(i.format==="regex")return`Неверная строка: должна соответствовать шаблону ${i.pattern}`;return`Неверный ${o[i.format]??r.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспознанн${r.keys.length>1?"ые":"ый"} ключ${r.keys.length>1?"и":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${r.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${r.origin}`;default:return"Неверные входные данные"}}};function Vf(){return{localeError:YP()}}var XP=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"število";case"object":{if(Array.isArray(r))return"tabela";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"vnos",email:"e-poštni naslov",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 datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(r)=>{switch(r.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${r.expected}, prejeto ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Neveljaven vnos: pričakovano ${O(r.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} imelo ${i}${r.maximum.toString()} ${s.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Premajhno: pričakovano, da bo ${r.origin} imelo ${i}${r.minimum.toString()} ${s.unit}`;return`Premajhno: pričakovano, da bo ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Neveljaven niz: mora se začeti z "${i.prefix}"`;if(i.format==="ends_with")return`Neveljaven niz: mora se končati z "${i.suffix}"`;if(i.format==="includes")return`Neveljaven niz: mora vsebovati "${i.includes}"`;if(i.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`;return`Neveljaven ${o[i.format]??r.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i ključi":" ključ"}: ${_(r.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};function Wf(){return{localeError:XP()}}var QP=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"antal";case"object":{if(Array.isArray(r))return"lista";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"reguljärt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(r)=>{switch(r.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${r.expected}, fick ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ogiltig inmatning: förväntat ${O(r.values[0])}`;return`Ogiltigt val: förväntade en av ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`För stor(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.maximum.toString()} ${s.unit??"element"}`;return`För stor(t): förväntat ${r.origin??"värdet"} att ha ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`För lite(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.minimum.toString()} ${s.unit}`;return`För lite(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ogiltig sträng: måste börja med "${i.prefix}"`;if(i.format==="ends_with")return`Ogiltig sträng: måste sluta med "${i.suffix}"`;if(i.format==="includes")return`Ogiltig sträng: måste innehålla "${i.includes}"`;if(i.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`;return`Ogiltig(t) ${o[i.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${_(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${r.origin??"värdet"}`;default:return"Ogiltig input"}}};function Hf(){return{localeError:QP()}}var eC=()=>{let e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(r))return"அணி";if(r===null)return"வெறுமை";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",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 தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${r.expected}, பெறப்பட்டது ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${O(r.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${_(r.values,"|")} இல் ஒன்று`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${i}${r.maximum.toString()} ${s.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${i}${r.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${i}${r.minimum.toString()} ${s.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${i}${r.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`;if(i.format==="ends_with")return`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`;if(i.format==="includes")return`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`;if(i.format==="regex")return`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${o[i.format]??r.format}`}case"not_multiple_of":return`தவறான எண்: ${r.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${r.keys.length>1?"கள்":""}: ${_(r.keys,", ")}`;case"invalid_key":return`${r.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${r.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Jf(){return{localeError:eC()}}var tC=()=>{let e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(r))return"อาร์เรย์ (Array)";if(r===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(r)=>{switch(r.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${r.expected} แต่ได้รับ ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${O(r.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"ไม่เกิน":"น้อยกว่า",s=t(r.origin);if(s)return`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${i} ${r.maximum.toString()} ${s.unit??"รายการ"}`;return`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"อย่างน้อย":"มากกว่า",s=t(r.origin);if(s)return`น้อยกว่ากำหนด: ${r.origin} ควรมี${i} ${r.minimum.toString()} ${s.unit}`;return`น้อยกว่ากำหนด: ${r.origin} ควรมี${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`;if(i.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`;if(i.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`;if(i.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`;return`รูปแบบไม่ถูกต้อง: ${o[i.format]??r.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${r.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${_(r.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${r.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${r.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function Kf(){return{localeError:tC()}}var rC=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},nC=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(o){return e[o]??null}let n={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(o)=>{switch(o.code){case"invalid_type":return`Geçersiz değer: beklenen ${o.expected}, alınan ${rC(o.input)}`;case"invalid_value":if(o.values.length===1)return`Geçersiz değer: beklenen ${O(o.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${_(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Çok büyük: beklenen ${o.origin??"değer"} ${r}${o.maximum.toString()} ${i.unit??"öğe"}`;return`Çok büyük: beklenen ${o.origin??"değer"} ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Çok küçük: beklenen ${o.origin} ${r}${o.minimum.toString()} ${i.unit}`;return`Çok küçük: beklenen ${o.origin} ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Geçersiz metin: "${r.prefix}" ile başlamalı`;if(r.format==="ends_with")return`Geçersiz metin: "${r.suffix}" ile bitmeli`;if(r.format==="includes")return`Geçersiz metin: "${r.includes}" içermeli`;if(r.format==="regex")return`Geçersiz metin: ${r.pattern} desenine uymalı`;return`Geçersiz ${n[r.format]??o.format}`}case"not_multiple_of":return`Geçersiz sayı: ${o.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${o.keys.length>1?"lar":""}: ${_(o.keys,", ")}`;case"invalid_key":return`${o.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${o.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function Yf(){return{localeError:nC()}}var oC=()=>{let e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"масив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(r)=>{switch(r.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${r.expected}, отримано ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Неправильні вхідні дані: очікується ${O(r.values[0])}`;return`Неправильна опція: очікується одне з ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Занадто велике: очікується, що ${r.origin??"значення"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"елементів"}`;return`Занадто велике: очікується, що ${r.origin??"значення"} буде ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Занадто мале: очікується, що ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Занадто мале: очікується, що ${r.origin} буде ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Неправильний рядок: повинен починатися з "${i.prefix}"`;if(i.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`;if(i.format==="includes")return`Неправильний рядок: повинен містити "${i.includes}"`;if(i.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`;return`Неправильний ${o[i.format]??r.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${r.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${r.keys.length>1?"і":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${r.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${r.origin}`;default:return"Неправильні вхідні дані"}}};function Wi(){return{localeError:oC()}}function Xf(){return Wi()}var iC=()=>{let e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"نمبر";case"object":{if(Array.isArray(r))return"آرے";if(r===null)return"نل";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(r)=>{switch(r.code){case"invalid_type":return`غلط ان پٹ: ${r.expected} متوقع تھا، ${n(r.input)} موصول ہوا`;case"invalid_value":if(r.values.length===1)return`غلط ان پٹ: ${O(r.values[0])} متوقع تھا`;return`غلط آپشن: ${_(r.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`بہت بڑا: ${r.origin??"ویلیو"} کے ${i}${r.maximum.toString()} ${s.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${r.origin??"ویلیو"} کا ${i}${r.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`بہت چھوٹا: ${r.origin} کے ${i}${r.minimum.toString()} ${s.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${r.origin} کا ${i}${r.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`;if(i.format==="ends_with")return`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`;if(i.format==="includes")return`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`;if(i.format==="regex")return`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`;return`غلط ${o[i.format]??r.format}`}case"not_multiple_of":return`غلط نمبر: ${r.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${r.keys.length>1?"ز":""}: ${_(r.keys,"، ")}`;case"invalid_key":return`${r.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${r.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function Qf(){return{localeError:iC()}}var sC=()=>{let e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"số";case"object":{if(Array.isArray(r))return"mảng";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"đầu vào",email:"địa chỉ email",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:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(r)=>{switch(r.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${r.expected}, nhận được ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${O(r.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Quá lớn: mong đợi ${r.origin??"giá trị"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"phần tử"}`;return`Quá lớn: mong đợi ${r.origin??"giá trị"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Quá nhỏ: mong đợi ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Quá nhỏ: mong đợi ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`;if(i.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`;if(i.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`;if(i.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`;return`${o[i.format]??r.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${r.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${_(r.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${r.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${r.origin}`;default:return"Đầu vào không hợp lệ"}}};function eh(){return{localeError:sC()}}var aC=()=>{let e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(r))return"数组";if(r===null)return"空值(null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(r)=>{switch(r.code){case"invalid_type":return`无效输入:期望 ${r.expected},实际接收 ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`无效输入:期望 ${O(r.values[0])}`;return`无效选项:期望以下之一 ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`数值过大:期望 ${r.origin??"值"} ${i}${r.maximum.toString()} ${s.unit??"个元素"}`;return`数值过大:期望 ${r.origin??"值"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`数值过小:期望 ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`;return`数值过小:期望 ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`无效字符串:必须以 "${i.prefix}" 开头`;if(i.format==="ends_with")return`无效字符串:必须以 "${i.suffix}" 结尾`;if(i.format==="includes")return`无效字符串:必须包含 "${i.includes}"`;if(i.format==="regex")return`无效字符串:必须满足正则表达式 ${i.pattern}`;return`无效${o[i.format]??r.format}`}case"not_multiple_of":return`无效数字:必须是 ${r.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${_(r.keys,", ")}`;case"invalid_key":return`${r.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${r.origin} 中包含无效值(value)`;default:return"无效输入"}}};function th(){return{localeError:aC()}}var cC=()=>{let e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"輸入",email:"郵件地址",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 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(r)=>{switch(r.code){case"invalid_type":return`無效的輸入值:預期為 ${r.expected},但收到 ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`無效的輸入值:預期為 ${O(r.values[0])}`;return`無效的選項:預期為以下其中之一 ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`數值過大:預期 ${r.origin??"值"} 應為 ${i}${r.maximum.toString()} ${s.unit??"個元素"}`;return`數值過大:預期 ${r.origin??"值"} 應為 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`數值過小:預期 ${r.origin} 應為 ${i}${r.minimum.toString()} ${s.unit}`;return`數值過小:預期 ${r.origin} 應為 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`無效的字串:必須以 "${i.prefix}" 開頭`;if(i.format==="ends_with")return`無效的字串:必須以 "${i.suffix}" 結尾`;if(i.format==="includes")return`無效的字串:必須包含 "${i.includes}"`;if(i.format==="regex")return`無效的字串:必須符合格式 ${i.pattern}`;return`無效的 ${o[i.format]??r.format}`}case"not_multiple_of":return`無效的數字:必須為 ${r.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${r.keys.length>1?"們":""}:${_(r.keys,"、")}`;case"invalid_key":return`${r.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${r.origin} 中有無效的值`;default:return"無效的輸入值"}}};function rh(){return{localeError:cC()}}var lC=()=>{let e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(r))return"akopọ";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",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:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return(r)=>{switch(r.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${r.expected}, àmọ̀ a rí ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${O(r.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${r.origin??"iye"} ${s.verb} ${i}${r.maximum} ${s.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${i}${r.maximum}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Kéré ju: a ní láti jẹ́ pé ${r.origin} ${s.verb} ${i}${r.minimum} ${s.unit}`;return`Kéré ju: a ní láti jẹ́ ${i}${r.minimum}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${i.prefix}"`;if(i.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${i.suffix}"`;if(i.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${i.includes}"`;if(i.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${i.pattern}`;return`Aṣìṣe: ${o[i.format]??r.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${r.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${_(r.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${r.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${r.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function nh(){return{localeError:lC()}}var oh=Symbol("ZodOutput"),ih=Symbol("ZodInput");class Ji{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function uc(){return new Ji}var vr=uc();function sh(e,t){return new e({type:"string",...E(t)})}function ah(e,t){return new e({type:"string",coerce:!0,...E(t)})}function dc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}function Ki(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}function pc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}function fc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}function hc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}function Yi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}function gc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}function yc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}function xc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}function vc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}function Sc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}function bc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}function _c(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}function kc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}function wc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}function Ic(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}function Tc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}function Ec(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}function $c(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}function Oc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}function Dc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}var ch={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function lh(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}function uh(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}function dh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}function ph(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}function mh(e,t){return new e({type:"number",checks:[],...E(t)})}function fh(e,t){return new e({type:"number",coerce:!0,checks:[],...E(t)})}function hh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}function gh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...E(t)})}function yh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...E(t)})}function xh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...E(t)})}function vh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...E(t)})}function Sh(e,t){return new e({type:"boolean",...E(t)})}function bh(e,t){return new e({type:"boolean",coerce:!0,...E(t)})}function _h(e,t){return new e({type:"bigint",...E(t)})}function kh(e,t){return new e({type:"bigint",coerce:!0,...E(t)})}function wh(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...E(t)})}function Ih(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...E(t)})}function Th(e,t){return new e({type:"symbol",...E(t)})}function Eh(e,t){return new e({type:"undefined",...E(t)})}function $h(e,t){return new e({type:"null",...E(t)})}function Oh(e){return new e({type:"any"})}function Dh(e){return new e({type:"unknown"})}function Ph(e,t){return new e({type:"never",...E(t)})}function Ch(e,t){return new e({type:"void",...E(t)})}function Rh(e,t){return new e({type:"date",...E(t)})}function Ah(e,t){return new e({type:"date",coerce:!0,...E(t)})}function Mh(e,t){return new e({type:"nan",...E(t)})}function Ar(e,t){return new Xa({check:"less_than",...E(t),value:e,inclusive:!1})}function Wt(e,t){return new Xa({check:"less_than",...E(t),value:e,inclusive:!0})}function Mr(e,t){return new Qa({check:"greater_than",...E(t),value:e,inclusive:!1})}function Tt(e,t){return new Qa({check:"greater_than",...E(t),value:e,inclusive:!0})}function Uh(e){return Mr(0,e)}function Nh(e){return Ar(0,e)}function Fh(e){return Wt(0,e)}function zh(e){return Tt(0,e)}function Gn(e,t){return new jp({check:"multiple_of",...E(t),value:e})}function Ro(e,t){return new Bp({check:"max_size",...E(t),maximum:e})}function Zn(e,t){return new qp({check:"min_size",...E(t),minimum:e})}function Xi(e,t){return new Vp({check:"size_equals",...E(t),size:e})}function Ao(e,t){return new Wp({check:"max_length",...E(t),maximum:e})}function un(e,t){return new Hp({check:"min_length",...E(t),minimum:e})}function Mo(e,t){return new Jp({check:"length_equals",...E(t),length:e})}function Qi(e,t){return new Kp({check:"string_format",format:"regex",...E(t),pattern:e})}function es(e){return new Yp({check:"string_format",format:"lowercase",...E(e)})}function ts(e){return new Xp({check:"string_format",format:"uppercase",...E(e)})}function rs(e,t){return new Qp({check:"string_format",format:"includes",...E(t),includes:e})}function ns(e,t){return new em({check:"string_format",format:"starts_with",...E(t),prefix:e})}function os(e,t){return new tm({check:"string_format",format:"ends_with",...E(t),suffix:e})}function Lh(e,t,n){return new rm({check:"property",property:e,schema:t,...E(n)})}function is(e,t){return new nm({check:"mime_type",mime:e,...E(t)})}function Ur(e){return new om({check:"overwrite",tx:e})}function ss(e){return Ur((t)=>t.normalize(e))}function as(){return Ur((e)=>e.trim())}function cs(){return Ur((e)=>e.toLowerCase())}function ls(){return Ur((e)=>e.toUpperCase())}function jh(e,t,n){return new e({type:"array",element:t,...E(n)})}function uC(e,t,n){return new e({type:"union",options:t,...E(n)})}function dC(e,t,n,o){return new e({type:"union",options:n,discriminator:t,...E(o)})}function pC(e,t,n){return new e({type:"intersection",left:t,right:n})}function mC(e,t,n,o){let r=n instanceof Z;return new e({type:"tuple",items:t,rest:r?n:null,...E(r?o:n)})}function fC(e,t,n,o){return new e({type:"record",keyType:t,valueType:n,...E(o)})}function hC(e,t,n,o){return new e({type:"map",keyType:t,valueType:n,...E(o)})}function gC(e,t,n){return new e({type:"set",valueType:t,...E(n)})}function yC(e,t,n){let o=Array.isArray(t)?Object.fromEntries(t.map((r)=>[r,r])):t;return new e({type:"enum",entries:o,...E(n)})}function xC(e,t,n){return new e({type:"enum",entries:t,...E(n)})}function vC(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...E(n)})}function Gh(e,t){return new e({type:"file",...E(t)})}function SC(e,t){return new e({type:"transform",transform:t})}function bC(e,t){return new e({type:"optional",innerType:t})}function _C(e,t){return new e({type:"nullable",innerType:t})}function kC(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n==="function"?n():Ci(n)}})}function wC(e,t,n){return new e({type:"nonoptional",innerType:t,...E(n)})}function IC(e,t){return new e({type:"success",innerType:t})}function TC(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n==="function"?n:()=>n})}function EC(e,t,n){return new e({type:"pipe",in:t,out:n})}function $C(e,t){return new e({type:"readonly",innerType:t})}function OC(e,t,n){return new e({type:"template_literal",parts:t,...E(n)})}function DC(e,t){return new e({type:"lazy",getter:t})}function PC(e,t){return new e({type:"promise",innerType:t})}function Zh(e,t,n){let o=E(n);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Bh(e,t,n){return new e({type:"custom",check:"custom",fn:t,...E(n)})}function qh(e){let t=Hb((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ln(o,n.value,t._zod.def));else{let r=o;if(r.fatal)r.continue=!1;r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(ln(r))}},e(n.value,n)));return t}function Hb(e,t){let n=new Ae({check:"custom",...E(t)});return n._zod.check=e,n}function Vh(e,t){let n=E(t),o=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];if(n.case!=="sensitive")o=o.map((m)=>typeof m==="string"?m.toLowerCase():m),r=r.map((m)=>typeof m==="string"?m.toLowerCase():m);let i=new Set(o),s=new Set(r),a=e.Codec??Gi,l=e.Boolean??ji,u=new(e.String??jn)({type:"string",error:n.error}),f=new l({type:"boolean",error:n.error}),h=new a({type:"pipe",in:u,out:f,transform:(m,y)=>{let k=m;if(n.case!=="sensitive")k=k.toLowerCase();if(i.has(k))return!0;else if(s.has(k))return!1;else return y.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:y.value,inst:h,continue:!1}),{}},reverseTransform:(m,y)=>{if(m===!0)return o[0]||"true";else return r[0]||"false"},error:n.error});return h}function Uo(e,t,n,o={}){let r=E(o),i={...E(o),check:"string_format",type:"string",format:t,fn:typeof n==="function"?n:(a)=>n.test(a),...r};if(n instanceof RegExp)i.pattern=n;return new e(i)}class Pc{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??vr,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var n;let o=e._zod.def,r={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i){if(i.count++,t.schemaPath.includes(e))i.cycle=t.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,e],path:t.path},f=e._zod.parent;if(f)s.ref=f,this.process(f,u),this.seen.get(f).isParent=!0;else{let h=s.schema;switch(o.type){case"string":{let m=h;m.type="string";let{minimum:y,maximum:k,format:S,patterns:I,contentEncoding:D}=e._zod.bag;if(typeof y==="number")m.minLength=y;if(typeof k==="number")m.maxLength=k;if(S){if(m.format=r[S]??S,m.format==="")delete m.format}if(D)m.contentEncoding=D;if(I&&I.size>0){let R=[...I];if(R.length===1)m.pattern=R[0].source;else if(R.length>1)s.schema.allOf=[...R.map((M)=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:M.source}))]}break}case"number":{let m=h,{minimum:y,maximum:k,format:S,multipleOf:I,exclusiveMaximum:D,exclusiveMinimum:R}=e._zod.bag;if(typeof S==="string"&&S.includes("int"))m.type="integer";else m.type="number";if(typeof R==="number")if(this.target==="draft-4"||this.target==="openapi-3.0")m.minimum=R,m.exclusiveMinimum=!0;else m.exclusiveMinimum=R;if(typeof y==="number"){if(m.minimum=y,typeof R==="number"&&this.target!=="draft-4")if(R>=y)delete m.minimum;else delete m.exclusiveMinimum}if(typeof D==="number")if(this.target==="draft-4"||this.target==="openapi-3.0")m.maximum=D,m.exclusiveMaximum=!0;else m.exclusiveMaximum=D;if(typeof k==="number"){if(m.maximum=k,typeof D==="number"&&this.target!=="draft-4")if(D<=k)delete m.maximum;else delete m.exclusiveMaximum}if(typeof I==="number")m.multipleOf=I;break}case"boolean":{let m=h;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{if(this.target==="openapi-3.0")h.type="string",h.nullable=!0,h.enum=[null];else h.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"never":{h.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let m=h,{minimum:y,maximum:k}=e._zod.bag;if(typeof y==="number")m.minItems=y;if(typeof k==="number")m.maxItems=k;m.type="array",m.items=this.process(o.element,{...u,path:[...u.path,"items"]});break}case"object":{let m=h;m.type="object",m.properties={};let y=o.shape;for(let I in y)m.properties[I]=this.process(y[I],{...u,path:[...u.path,"properties",I]});let k=new Set(Object.keys(y)),S=new Set([...k].filter((I)=>{let D=o.shape[I]._zod;if(this.io==="input")return D.optin===void 0;else return D.optout===void 0}));if(S.size>0)m.required=Array.from(S);if(o.catchall?._zod.def.type==="never")m.additionalProperties=!1;else if(!o.catchall){if(this.io==="output")m.additionalProperties=!1}else if(o.catchall)m.additionalProperties=this.process(o.catchall,{...u,path:[...u.path,"additionalProperties"]});break}case"union":{let m=h,y=o.options.map((k,S)=>this.process(k,{...u,path:[...u.path,"anyOf",S]}));m.anyOf=y;break}case"intersection":{let m=h,y=this.process(o.left,{...u,path:[...u.path,"allOf",0]}),k=this.process(o.right,{...u,path:[...u.path,"allOf",1]}),S=(D)=>("allOf"in D)&&Object.keys(D).length===1,I=[...S(y)?y.allOf:[y],...S(k)?k.allOf:[k]];m.allOf=I;break}case"tuple":{let m=h;m.type="array";let y=this.target==="draft-2020-12"?"prefixItems":"items",k=this.target==="draft-2020-12"?"items":this.target==="openapi-3.0"?"items":"additionalItems",S=o.items.map((M,me)=>this.process(M,{...u,path:[...u.path,y,me]})),I=o.rest?this.process(o.rest,{...u,path:[...u.path,k,...this.target==="openapi-3.0"?[o.items.length]:[]]}):null;if(this.target==="draft-2020-12"){if(m.prefixItems=S,I)m.items=I}else if(this.target==="openapi-3.0"){if(m.items={anyOf:S},I)m.items.anyOf.push(I);if(m.minItems=S.length,!I)m.maxItems=S.length}else if(m.items=S,I)m.additionalItems=I;let{minimum:D,maximum:R}=e._zod.bag;if(typeof D==="number")m.minItems=D;if(typeof R==="number")m.maxItems=R;break}case"record":{let m=h;if(m.type="object",this.target==="draft-7"||this.target==="draft-2020-12")m.propertyNames=this.process(o.keyType,{...u,path:[...u.path,"propertyNames"]});m.additionalProperties=this.process(o.valueType,{...u,path:[...u.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=h,y=Di(o.entries);if(y.every((k)=>typeof k==="number"))m.type="number";if(y.every((k)=>typeof k==="string"))m.type="string";m.enum=y;break}case"literal":{let m=h,y=[];for(let k of o.values)if(k===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof k==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else y.push(Number(k));else y.push(k);if(y.length===0);else if(y.length===1){let k=y[0];if(m.type=k===null?"null":typeof k,this.target==="draft-4"||this.target==="openapi-3.0")m.enum=[k];else m.const=k}else{if(y.every((k)=>typeof k==="number"))m.type="number";if(y.every((k)=>typeof k==="string"))m.type="string";if(y.every((k)=>typeof k==="boolean"))m.type="string";if(y.every((k)=>k===null))m.type="null";m.enum=y}break}case"file":{let m=h,y={type:"string",format:"binary",contentEncoding:"binary"},{minimum:k,maximum:S,mime:I}=e._zod.bag;if(k!==void 0)y.minLength=k;if(S!==void 0)y.maxLength=S;if(I)if(I.length===1)y.contentMediaType=I[0],Object.assign(m,y);else m.anyOf=I.map((D)=>({...y,contentMediaType:D}));else Object.assign(m,y);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,u);if(this.target==="openapi-3.0")s.ref=o.innerType,h.nullable=!0;else h.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,u),s.ref=o.innerType;break}case"success":{let m=h;m.type="boolean";break}case"default":{this.process(o.innerType,u),s.ref=o.innerType,h.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{if(this.process(o.innerType,u),s.ref=o.innerType,this.io==="input")h._prefault=JSON.parse(JSON.stringify(o.defaultValue));break}case"catch":{this.process(o.innerType,u),s.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}h.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=h,y=e._zod.pattern;if(!y)throw Error("Pattern not found in template literal");m.type="string",m.pattern=y.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,u),s.ref=m;break}case"readonly":{this.process(o.innerType,u),s.ref=o.innerType,h.readOnly=!0;break}case"promise":{this.process(o.innerType,u),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,u),s.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,u),s.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(e);if(l)Object.assign(s.schema,l);if(this.io==="input"&&nt(e))delete s.schema.examples,delete s.schema.default;if(this.io==="input"&&s.schema._prefault)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,this.seen.get(e).schema}emit(e,t){let n={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},o=this.seen.get(e);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(c)=>{let u=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let y=n.external.registry.get(c[0])?.id,k=n.external.uri??((I)=>I);if(y)return{ref:k(y)};let S=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=S,{defId:S,ref:`${k("__shared")}#/${u}/${S}`}}if(c[1]===o)return{ref:"#"};let h=`${"#"}/${u}/`,m=c[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:h+m}},i=(c)=>{if(c[1].schema.$ref)return;let u=c[1],{ref:f,defId:h}=r(c);if(u.def={...u.schema},h)u.defId=h;let m=u.schema;for(let y in m)delete m[y];m.$ref=f};if(n.cycles==="throw")for(let c of this.seen.entries()){let u=c[1];if(u.cycle)throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
190
+ `)}m.write("payload.value = newResult;"),m.write("return payload;");let D=m.compile();return(R,M)=>D(h,R,M)},i,s=zn,a=!$i.jitless,c=a&&op.value,u=t.catchall,f;e._zod.parse=(h,m)=>{f??(f=o.value);let y=h.value;if(!s(y))return h.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),h;if(a&&c&&m?.async===!1&&m.jitless!==!0){if(!i)i=r(t.shape);if(h=i(h,m),!u)return h;return Zb([],y,h,m,f,e)}return n(h,m)}});function Pb(e,t,n,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let r=e.filter((i)=>!cn(i));if(r.length===1)return t.value=r[0].value,r[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>Ut(s,o,et())))}),t}var cc=x("$ZodUnion",(e,t)=>{Z.init(e,t),te(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),te(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),te(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),te(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((i)=>i._zod.pattern);return new RegExp(`^(${r.map((i)=>Pi(i.source)).join("|")})$`)}return});let n=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(r,i)=>{if(n)return o(r,i);let s=!1,a=[];for(let l of t.options){let c=l._zod.run({value:r.value,issues:[]},i);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}if(!s)return Pb(a,r,e,i);return Promise.all(a).then((l)=>Pb(l,r,e,i))}}),Bm=x("$ZodDiscriminatedUnion",(e,t)=>{cc.init(e,t);let n=e._zod.parse;te(e._zod,"propValues",()=>{let r={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,l]of Object.entries(s)){if(!r[a])r[a]=new Set;for(let c of l)r[a].add(c)}}return r});let o=Eo(()=>{let r=t.options,i=new Map;for(let s of r){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let l of a){if(i.has(l))throw Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(r,i)=>{let s=r.value;if(!zn(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;let a=o.value.get(s?.[t.discriminator]);if(a)return a._zod.run(r,i);if(t.unionFallback)return n(r,i);return r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),r}}),qm=x("$ZodIntersection",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value,i=t.left._zod.run({value:r,issues:[]},o),s=t.right._zod.run({value:r,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([l,c])=>Cb(n,l,c));return Cb(n,i,s)}});function sm(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(an(e)&&an(t)){let n=Object.keys(t),o=Object.keys(e).filter((i)=>n.indexOf(i)!==-1),r={...e,...t};for(let i of o){let s=sm(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r[i]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t[o],s=sm(r,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Cb(e,t,n){if(t.issues.length)e.issues.push(...t.issues);if(n.issues.length)e.issues.push(...n.issues);if(cn(e))return e;let o=sm(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var lc=x("$ZodTuple",(e,t)=>{Z.init(e,t);let n=t.items,o=n.length-[...n].reverse().findIndex((r)=>r._zod.optin!=="optional");e._zod.parse=(r,i)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let a=[];if(!t.rest){let c=s.length>n.length,u=s.length<o-1;if(c||u)return r.issues.push({...c?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},input:s,inst:e,origin:"array"}),r}let l=-1;for(let c of n){if(l++,l>=s.length){if(l>=o)continue}let u=c._zod.run({value:s[l],issues:[]},i);if(u instanceof Promise)a.push(u.then((f)=>tc(f,r,l)));else tc(u,r,l)}if(t.rest){let c=s.slice(n.length);for(let u of c){l++;let f=t.rest._zod.run({value:u,issues:[]},i);if(f instanceof Promise)a.push(f.then((h)=>tc(h,r,l)));else tc(f,r,l)}}if(a.length)return Promise.all(a).then(()=>r);return r}});function tc(e,t,n){if(e.issues.length)t.issues.push(...Mt(n,e.issues));t.value[n]=e.value}var Hm=x("$ZodRecord",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!an(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let i=[];if(t.keyType._zod.values){let s=t.keyType._zod.values;n.value={};for(let l of s)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){let c=t.valueType._zod.run({value:r[l],issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>{if(u.issues.length)n.issues.push(...Mt(l,u.issues));n.value[l]=u.value}));else{if(c.issues.length)n.issues.push(...Mt(l,c.issues));n.value[l]=c.value}}let a;for(let l in r)if(!s.has(l))a=a??[],a.push(l);if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:a})}else{n.value={};for(let s of Reflect.ownKeys(r)){if(s==="__proto__")continue;let a=t.keyType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map((c)=>Ut(c,o,et())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}let l=t.valueType._zod.run({value:r[s],issues:[]},o);if(l instanceof Promise)i.push(l.then((c)=>{if(c.issues.length)n.issues.push(...Mt(s,c.issues));n.value[a.value]=c.value}));else{if(l.issues.length)n.issues.push(...Mt(s,l.issues));n.value[a.value]=l.value}}}if(i.length)return Promise.all(i).then(()=>n);return n}}),Vm=x("$ZodMap",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),n;let i=[];n.value=new Map;for(let[s,a]of r){let l=t.keyType._zod.run({value:s,issues:[]},o),c=t.valueType._zod.run({value:a,issues:[]},o);if(l instanceof Promise||c instanceof Promise)i.push(Promise.all([l,c]).then(([u,f])=>{Rb(u,f,n,s,r,e,o)}));else Rb(l,c,n,s,r,e,o)}if(i.length)return Promise.all(i).then(()=>n);return n}});function Rb(e,t,n,o,r,i,s){if(e.issues.length)if(Ri.has(typeof o))n.issues.push(...Mt(o,e.issues));else n.issues.push({code:"invalid_key",origin:"map",input:r,inst:i,issues:e.issues.map((a)=>Ut(a,s,et()))});if(t.issues.length)if(Ri.has(typeof o))n.issues.push(...Mt(o,t.issues));else n.issues.push({origin:"map",code:"invalid_element",input:r,inst:i,key:o,issues:t.issues.map((a)=>Ut(a,s,et()))});n.value.set(e.value,t.value)}var Wm=x("$ZodSet",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),n;let i=[];n.value=new Set;for(let s of r){let a=t.valueType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)i.push(a.then((l)=>Ab(l,n)));else Ab(a,n)}if(i.length)return Promise.all(i).then(()=>n);return n}});function Ab(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var Jm=x("$ZodEnum",(e,t)=>{Z.init(e,t);let n=Di(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter((r)=>Ri.has(typeof r)).map((r)=>typeof r==="string"?xr(r):r.toString()).join("|")})$`),e._zod.parse=(r,i)=>{let s=r.value;if(o.has(s))return r;return r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Km=x("$ZodLiteral",(e,t)=>{if(Z.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?xr(n):n?xr(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let r=n.value;if(e._zod.values.has(r))return n;return n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}}),Ym=x("$ZodFile",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(r instanceof File)return n;return n.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),n}}),Xm=x("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Fn(e.constructor.name);let r=t.transform(n.value,n);if(o.async)return(r instanceof Promise?r:Promise.resolve(r)).then((s)=>(n.value=s,n));if(r instanceof Promise)throw new yr;return n.value=r,n}});function Mb(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var Qm=x("$ZodOptional",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),te(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Pi(n.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(t.innerType._zod.optin==="optional"){let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Mb(i,n.value));return Mb(r,n.value)}if(n.value===void 0)return n;return t.innerType._zod.run(n,o)}}),ef=x("$ZodNullable",(e,t)=>{Z.init(e,t),te(e._zod,"optin",()=>t.innerType._zod.optin),te(e._zod,"optout",()=>t.innerType._zod.optout),te(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Pi(n.source)}|null)$`):void 0}),te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>{if(n.value===null)return n;return t.innerType._zod.run(n,o)}}),tf=x("$ZodDefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Ub(i,t));return Ub(r,t)}});function Ub(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var rf=x("$ZodPrefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,o)}}),nf=x("$ZodNonOptional",(e,t)=>{Z.init(e,t),te(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(n,o)=>{let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Nb(i,e));return Nb(r,e)}});function Nb(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var of=x("$ZodSuccess",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Fn("ZodSuccess");let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>(n.value=i.issues.length===0,n));return n.value=r.issues.length===0,n}}),sf=x("$ZodCatch",(e,t)=>{Z.init(e,t),te(e._zod,"optin",()=>t.innerType._zod.optin),te(e._zod,"optout",()=>t.innerType._zod.optout),te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>{if(n.value=i.value,i.issues.length)n.value=t.catchValue({...n,error:{issues:i.issues.map((s)=>Ut(s,o,et()))},input:n.value}),n.issues=[];return n});if(n.value=r.value,r.issues.length)n.value=t.catchValue({...n,error:{issues:r.issues.map((i)=>Ut(i,o,et()))},input:n.value}),n.issues=[];return n}}),af=x("$ZodNaN",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>{if(typeof n.value!=="number"||!Number.isNaN(n.value))return n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n;return n}}),cf=x("$ZodPipe",(e,t)=>{Z.init(e,t),te(e._zod,"values",()=>t.in._zod.values),te(e._zod,"optin",()=>t.in._zod.optin),te(e._zod,"optout",()=>t.out._zod.optout),te(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>rc(s,t.in,o));return rc(i,t.in,o)}let r=t.in._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>rc(i,t.out,o));return rc(r,t.out,o)}});function rc(e,t,n){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var Gi=x("$ZodCodec",(e,t)=>{Z.init(e,t),te(e._zod,"values",()=>t.in._zod.values),te(e._zod,"optin",()=>t.in._zod.optin),te(e._zod,"optout",()=>t.out._zod.optout),te(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>nc(s,t,o));return nc(i,t,o)}else{let i=t.out._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>nc(s,t,o));return nc(i,t,o)}}});function nc(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let r=t.transform(e.value,e);if(r instanceof Promise)return r.then((i)=>oc(e,i,t.out,n));return oc(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);if(r instanceof Promise)return r.then((i)=>oc(e,i,t.in,n));return oc(e,r,t.in,n)}}function oc(e,t,n,o){if(e.issues.length)return e.aborted=!0,e;return n._zod.run({value:t,issues:e.issues},o)}var lf=x("$ZodReadonly",(e,t)=>{Z.init(e,t),te(e._zod,"propValues",()=>t.innerType._zod.propValues),te(e._zod,"values",()=>t.innerType._zod.values),te(e._zod,"optin",()=>t.innerType._zod.optin),te(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then(Fb);return Fb(r)}});function Fb(e){return e.value=Object.freeze(e.value),e}var uf=x("$ZodTemplateLiteral",(e,t)=>{Z.init(e,t);let n=[];for(let o of t.parts)if(typeof o==="object"&&o!==null){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let r=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!r)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=r.startsWith("^")?1:0,s=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(i,s))}else if(o===null||ip.has(typeof o))n.push(xr(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(o,r)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"template_literal",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o;return o}}),df=x("$ZodFunction",(e,t)=>(Z.init(e,t),e._def=t,e._zod.def=t,e.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return function(...o){let r=e._def.input?La(e._def.input,o):o,i=Reflect.apply(n,this,r);if(e._def.output)return La(e._def.output,i);return i}},e.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return async function(...o){let r=e._def.input?await ja(e._def.input,o):o,i=await Reflect.apply(n,this,r);if(e._def.output)return await ja(e._def.output,i);return i}},e._zod.parse=(n,o)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n;if(e._def.output&&e._def.output._zod.def.type==="promise")n.value=e.implementAsync(n.value);else n.value=e.implement(n.value);return n},e.input=(...n)=>{let o=e.constructor;if(Array.isArray(n[0]))return new o({type:"function",input:new lc({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new o({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),pf=x("$ZodPromise",(e,t)=>{Z.init(e,t),e._zod.parse=(n,o)=>Promise.resolve(n.value).then((r)=>t.innerType._zod.run({value:r,issues:[]},o))}),mf=x("$ZodLazy",(e,t)=>{Z.init(e,t),te(e._zod,"innerType",()=>t.getter()),te(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),te(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),te(e._zod,"optin",()=>e._zod.innerType._zod.optin??void 0),te(e._zod,"optout",()=>e._zod.innerType._zod.optout??void 0),e._zod.parse=(n,o)=>e._zod.innerType._zod.run(n,o)}),ff=x("$ZodCustom",(e,t)=>{Ae.init(e,t),Z.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=(n)=>{let o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then((i)=>zb(i,n,o,e));zb(r,n,o,e);return}});function zb(e,t,n,o){if(!e){let r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)r.params=o._zod.def.params;t.issues.push(ln(r))}}var Wi={};An(Wi,{ar:()=>hf,az:()=>gf,be:()=>yf,ca:()=>xf,cs:()=>vf,da:()=>Sf,de:()=>bf,en:()=>Zi,eo:()=>_f,es:()=>kf,fa:()=>wf,fi:()=>If,fr:()=>Tf,frCA:()=>Ef,he:()=>$f,hu:()=>Of,id:()=>Df,is:()=>Pf,it:()=>Cf,ja:()=>Rf,ka:()=>Af,kh:()=>Mf,km:()=>Bi,ko:()=>Uf,lt:()=>Nf,mk:()=>Ff,ms:()=>zf,nl:()=>Lf,no:()=>jf,ota:()=>Gf,pl:()=>Bf,ps:()=>Zf,pt:()=>qf,ru:()=>Hf,sl:()=>Vf,sv:()=>Wf,ta:()=>Jf,th:()=>Kf,tr:()=>Yf,ua:()=>Xf,uk:()=>Vi,ur:()=>Qf,vi:()=>eh,yo:()=>nh,zhCN:()=>th,zhTW:()=>rh});var fP=()=>{let e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(r)=>{switch(r.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${r.expected}، ولكن تم إدخال ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${O(r.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return` أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${i} ${r.maximum.toString()} ${s.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${i} ${r.minimum.toString()} ${s.unit}`;return`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${r.prefix}"`;if(i.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`;if(i.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`;if(i.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`;return`${o[i.format]??r.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${r.divisor}`;case"unrecognized_keys":return`معرف${r.keys.length>1?"ات":""} غريب${r.keys.length>1?"ة":""}: ${_(r.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${r.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${r.origin}`;default:return"مدخل غير مقبول"}}};function hf(){return{localeError:fP()}}var hP=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={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",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"};return(r)=>{switch(r.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${r.expected}, daxil olan ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Yanlış dəyər: gözlənilən ${O(r.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${i}${r.maximum.toString()} ${s.unit??"element"}`;return`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Çox kiçik: gözlənilən ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`;return`Çox kiçik: gözlənilən ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`;if(i.format==="ends_with")return`Yanlış mətn: "${i.suffix}" ilə bitməlidir`;if(i.format==="includes")return`Yanlış mətn: "${i.includes}" daxil olmalıdır`;if(i.format==="regex")return`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${o[i.format]??r.format}`}case"not_multiple_of":return`Yanlış ədəd: ${r.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${r.keys.length>1?"lar":""}: ${_(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${r.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function gf(){return{localeError:hP()}}function qb(e,t,n,o){let r=Math.abs(e),i=r%10,s=r%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return n;return o}var gP=()=>{let e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"лік";case"object":{if(Array.isArray(r))return"масіў";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(r)=>{switch(r.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${r.expected}, атрымана ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Няправільны ўвод: чакалася ${O(r.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=qb(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна ${s.verb} ${i}${r.maximum.toString()} ${l}`}return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна быць ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=qb(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта малы: чакалася, што ${r.origin} павінна ${s.verb} ${i}${r.minimum.toString()} ${l}`}return`Занадта малы: чакалася, што ${r.origin} павінна быць ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${i.prefix}"`;if(i.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${i.suffix}"`;if(i.format==="includes")return`Няправільны радок: павінен змяшчаць "${i.includes}"`;if(i.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`;return`Няправільны ${o[i.format]??r.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${r.keys.length>1?"ключы":"ключ"}: ${_(r.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${r.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${r.origin}`;default:return"Няправільны ўвод"}}};function yf(){return{localeError:gP()}}var yP=()=>{let e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"entrada",email:"adreça electrònica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(r)=>{switch(r.code){case"invalid_type":return`Tipus invàlid: s'esperava ${r.expected}, s'ha rebut ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Valor invàlid: s'esperava ${O(r.values[0])}`;return`Opció invàlida: s'esperava una de ${_(r.values," o ")}`;case"too_big":{let i=r.inclusive?"com a màxim":"menys de",s=t(r.origin);if(s)return`Massa gran: s'esperava que ${r.origin??"el valor"} contingués ${i} ${r.maximum.toString()} ${s.unit??"elements"}`;return`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"com a mínim":"més de",s=t(r.origin);if(s)return`Massa petit: s'esperava que ${r.origin} contingués ${i} ${r.minimum.toString()} ${s.unit}`;return`Massa petit: s'esperava que ${r.origin} fos ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Format invàlid: ha de començar amb "${i.prefix}"`;if(i.format==="ends_with")return`Format invàlid: ha d'acabar amb "${i.suffix}"`;if(i.format==="includes")return`Format invàlid: ha d'incloure "${i.includes}"`;if(i.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${i.pattern}`;return`Format invàlid per a ${o[i.format]??r.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${r.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${r.origin}`;default:return"Entrada invàlida"}}};function xf(){return{localeError:yP()}}var xP=()=>{let e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(r))return"pole";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"regulární výraz",email:"e-mailová adresa",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:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(r)=>{switch(r.code){case"invalid_type":return`Neplatný vstup: očekáváno ${r.expected}, obdrženo ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Neplatný vstup: očekáváno ${O(r.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Hodnota je příliš velká: ${r.origin??"hodnota"} musí mít ${i}${r.maximum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš velká: ${r.origin??"hodnota"} musí být ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Hodnota je příliš malá: ${r.origin??"hodnota"} musí mít ${i}${r.minimum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš malá: ${r.origin??"hodnota"} musí být ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Neplatný řetězec: musí začínat na "${i.prefix}"`;if(i.format==="ends_with")return`Neplatný řetězec: musí končit na "${i.suffix}"`;if(i.format==="includes")return`Neplatný řetězec: musí obsahovat "${i.includes}"`;if(i.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`;return`Neplatný formát ${o[i.format]??r.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${r.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${_(r.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${r.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${r.origin}`;default:return"Neplatný vstup"}}};function vf(){return{localeError:xP()}}var vP=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function n(s){return e[s]??null}function o(s){return t[s]??s}let r=(s)=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":{if(Array.isArray(s))return"liste";if(s===null)return"null";if(Object.getPrototypeOf(s)!==Object.prototype&&s.constructor)return s.constructor.name;return"objekt"}}return a},i={regex:"input",email:"e-mailadresse",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 dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(s)=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${o(s.expected)}, fik ${o(r(s.input))}`;case"invalid_value":if(s.values.length===1)return`Ugyldig værdi: forventede ${O(s.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${_(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",l=n(s.origin),c=o(s.origin);if(l)return`For stor: forventede ${c??"value"} ${l.verb} ${a} ${s.maximum.toString()} ${l.unit??"elementer"}`;return`For stor: forventede ${c??"value"} havde ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",l=n(s.origin),c=o(s.origin);if(l)return`For lille: forventede ${c} ${l.verb} ${a} ${s.minimum.toString()} ${l.unit}`;return`For lille: forventede ${c} havde ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;if(a.format==="starts_with")return`Ugyldig streng: skal starte med "${a.prefix}"`;if(a.format==="ends_with")return`Ugyldig streng: skal ende med "${a.suffix}"`;if(a.format==="includes")return`Ugyldig streng: skal indeholde "${a.includes}"`;if(a.format==="regex")return`Ugyldig streng: skal matche mønsteret ${a.pattern}`;return`Ugyldig ${i[a.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${_(s.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${s.origin}`;default:return"Ugyldigt input"}}};function Sf(){return{localeError:vP()}}var SP=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"Zahl";case"object":{if(Array.isArray(r))return"Array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(r)=>{switch(r.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${r.expected}, erhalten ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ungültige Eingabe: erwartet ${O(r.values[0])}`;return`Ungültige Option: erwartet eine von ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Zu groß: erwartet, dass ${r.origin??"Wert"} ${i}${r.maximum.toString()} ${s.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${r.origin??"Wert"} ${i}${r.maximum.toString()} ist`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Zu klein: erwartet, dass ${r.origin} ${i}${r.minimum.toString()} ${s.unit} hat`;return`Zu klein: erwartet, dass ${r.origin} ${i}${r.minimum.toString()} ist`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ungültiger String: muss mit "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ungültiger String: muss mit "${i.suffix}" enden`;if(i.format==="includes")return`Ungültiger String: muss "${i.includes}" enthalten`;if(i.format==="regex")return`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`;return`Ungültig: ${o[i.format]??r.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${_(r.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${r.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${r.origin}`;default:return"Ungültige Eingabe"}}};function bf(){return{localeError:SP()}}var bP=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},_P=()=>{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"}};function t(o){return e[o]??null}let n={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",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"};return(o)=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${bP(o.input)}`;case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${O(o.values[0])}`;return`Invalid option: expected one of ${_(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Too big: expected ${o.origin??"value"} to have ${r}${o.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Too small: expected ${o.origin} to have ${r}${o.minimum.toString()} ${i.unit}`;return`Too small: expected ${o.origin} to be ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Invalid string: must start with "${r.prefix}"`;if(r.format==="ends_with")return`Invalid string: must end with "${r.suffix}"`;if(r.format==="includes")return`Invalid string: must include "${r.includes}"`;if(r.format==="regex")return`Invalid string: must match pattern ${r.pattern}`;return`Invalid ${n[r.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":""}: ${_(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"}}};function Zi(){return{localeError:_P()}}var kP=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},wP=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(o){return e[o]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(o)=>{switch(o.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${o.expected}, riceviĝis ${kP(o.input)}`;case"invalid_value":if(o.values.length===1)return`Nevalida enigo: atendiĝis ${O(o.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${_(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${r}${o.maximum.toString()} ${i.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Tro malgranda: atendiĝis ke ${o.origin} havu ${r}${o.minimum.toString()} ${i.unit}`;return`Tro malgranda: atendiĝis ke ${o.origin} estu ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${r.prefix}"`;if(r.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${r.suffix}"`;if(r.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${r.includes}"`;if(r.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`;return`Nevalida ${n[r.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} ŝlosilo${o.keys.length>1?"j":""}: ${_(o.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function _f(){return{localeError:wP()}}var IP=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function n(s){return e[s]??null}function o(s){return t[s]??s}let r=(s)=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"number";case"object":{if(Array.isArray(s))return"array";if(s===null)return"null";if(Object.getPrototypeOf(s)!==Object.prototype)return s.constructor.name;return"object"}}return a},i={regex:"entrada",email:"dirección de correo electrónico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(s)=>{switch(s.code){case"invalid_type":return`Entrada inválida: se esperaba ${o(s.expected)}, recibido ${o(r(s.input))}`;case"invalid_value":if(s.values.length===1)return`Entrada inválida: se esperaba ${O(s.values[0])}`;return`Opción inválida: se esperaba una de ${_(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",l=n(s.origin),c=o(s.origin);if(l)return`Demasiado grande: se esperaba que ${c??"valor"} tuviera ${a}${s.maximum.toString()} ${l.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${c??"valor"} fuera ${a}${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",l=n(s.origin),c=o(s.origin);if(l)return`Demasiado pequeño: se esperaba que ${c} tuviera ${a}${s.minimum.toString()} ${l.unit}`;return`Demasiado pequeño: se esperaba que ${c} fuera ${a}${s.minimum.toString()}`}case"invalid_format":{let a=s;if(a.format==="starts_with")return`Cadena inválida: debe comenzar con "${a.prefix}"`;if(a.format==="ends_with")return`Cadena inválida: debe terminar en "${a.suffix}"`;if(a.format==="includes")return`Cadena inválida: debe incluir "${a.includes}"`;if(a.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${a.pattern}`;return`Inválido ${i[a.format]??s.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${_(s.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o(s.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o(s.origin)}`;default:return"Entrada inválida"}}};function kf(){return{localeError:IP()}}var TP=()=>{let e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"آرایه";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(r)=>{switch(r.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${r.expected} می‌بود، ${n(r.input)} دریافت شد`;case"invalid_value":if(r.values.length===1)return`ورودی نامعتبر: می‌بایست ${O(r.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${_(r.values,"|")} می‌بود`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`خیلی بزرگ: ${r.origin??"مقدار"} باید ${i}${r.maximum.toString()} ${s.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${r.origin??"مقدار"} باید ${i}${r.maximum.toString()} باشد`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`خیلی کوچک: ${r.origin} باید ${i}${r.minimum.toString()} ${s.unit} باشد`;return`خیلی کوچک: ${r.origin} باید ${i}${r.minimum.toString()} باشد`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`رشته نامعتبر: باید با "${i.prefix}" شروع شود`;if(i.format==="ends_with")return`رشته نامعتبر: باید با "${i.suffix}" تمام شود`;if(i.format==="includes")return`رشته نامعتبر: باید شامل "${i.includes}" باشد`;if(i.format==="regex")return`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`;return`${o[i.format]??r.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${r.divisor} باشد`;case"unrecognized_keys":return`کلید${r.keys.length>1?"های":""} ناشناس: ${_(r.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${r.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${r.origin}`;default:return"ورودی نامعتبر"}}};function wf(){return{localeError:TP()}}var EP=()=>{let e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(r)=>{switch(r.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${r.expected}, oli ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Virheellinen syöte: täytyy olla ${O(r.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Liian suuri: ${s.subject} täytyy olla ${i}${r.maximum.toString()} ${s.unit}`.trim();return`Liian suuri: arvon täytyy olla ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Liian pieni: ${s.subject} täytyy olla ${i}${r.minimum.toString()} ${s.unit}`.trim();return`Liian pieni: arvon täytyy olla ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${i.prefix}"`;if(i.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${i.suffix}"`;if(i.format==="includes")return`Virheellinen syöte: täytyy sisältää "${i.includes}"`;if(i.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`;return`Virheellinen ${o[i.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${_(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function If(){return{localeError:EP()}}var $P=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nombre";case"object":{if(Array.isArray(r))return"tableau";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"entrée",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(r)=>{switch(r.code){case"invalid_type":return`Entrée invalide : ${r.expected} attendu, ${n(r.input)} reçu`;case"invalid_value":if(r.values.length===1)return`Entrée invalide : ${O(r.values[0])} attendu`;return`Option invalide : une valeur parmi ${_(r.values,"|")} attendue`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Trop grand : ${r.origin??"valeur"} doit ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"élément(s)"}`;return`Trop grand : ${r.origin??"valeur"} doit être ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Trop petit : ${r.origin} doit ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Trop petit : ${r.origin} doit être ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${i.pattern}`;return`${o[i.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${_(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function Tf(){return{localeError:$P()}}var OP=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"entrée",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(r)=>{switch(r.code){case"invalid_type":return`Entrée invalide : attendu ${r.expected}, reçu ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Entrée invalide : attendu ${O(r.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"≤":"<",s=t(r.origin);if(s)return`Trop grand : attendu que ${r.origin??"la valeur"} ait ${i}${r.maximum.toString()} ${s.unit}`;return`Trop grand : attendu que ${r.origin??"la valeur"} soit ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"≥":">",s=t(r.origin);if(s)return`Trop petit : attendu que ${r.origin} ait ${i}${r.minimum.toString()} ${s.unit}`;return`Trop petit : attendu que ${r.origin} soit ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au motif ${i.pattern}`;return`${o[i.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${_(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function Ef(){return{localeError:OP()}}var DP=()=>{let e={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return(r)=>{switch(r.code){case"invalid_type":return`קלט לא תקין: צריך ${r.expected}, התקבל ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`קלט לא תקין: צריך ${O(r.values[0])}`;return`קלט לא תקין: צריך אחת מהאפשרויות ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`גדול מדי: ${r.origin??"value"} צריך להיות ${i}${r.maximum.toString()} ${s.unit??"elements"}`;return`גדול מדי: ${r.origin??"value"} צריך להיות ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`קטן מדי: ${r.origin} צריך להיות ${i}${r.minimum.toString()} ${s.unit}`;return`קטן מדי: ${r.origin} צריך להיות ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`מחרוזת לא תקינה: חייבת להתחיל ב"${i.prefix}"`;if(i.format==="ends_with")return`מחרוזת לא תקינה: חייבת להסתיים ב "${i.suffix}"`;if(i.format==="includes")return`מחרוזת לא תקינה: חייבת לכלול "${i.includes}"`;if(i.format==="regex")return`מחרוזת לא תקינה: חייבת להתאים לתבנית ${i.pattern}`;return`${o[i.format]??r.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${r.divisor}`;case"unrecognized_keys":return`מפתח${r.keys.length>1?"ות":""} לא מזוה${r.keys.length>1?"ים":"ה"}: ${_(r.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${r.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${r.origin}`;default:return"קלט לא תקין"}}};function $f(){return{localeError:DP()}}var PP=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"szám";case"object":{if(Array.isArray(r))return"tömb";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"bemenet",email:"email cím",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 időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(r)=>{switch(r.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${r.expected}, a kapott érték ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Érvénytelen bemenet: a várt érték ${O(r.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Túl nagy: ${r.origin??"érték"} mérete túl nagy ${i}${r.maximum.toString()} ${s.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${r.origin??"érték"} túl nagy: ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Túl kicsi: a bemeneti érték ${r.origin} mérete túl kicsi ${i}${r.minimum.toString()} ${s.unit}`;return`Túl kicsi: a bemeneti érték ${r.origin} túl kicsi ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`;if(i.format==="ends_with")return`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`;if(i.format==="includes")return`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`;if(i.format==="regex")return`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`;return`Érvénytelen ${o[i.format]??r.format}`}case"not_multiple_of":return`Érvénytelen szám: ${r.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${r.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${r.origin}`;default:return"Érvénytelen bemenet"}}};function Of(){return{localeError:PP()}}var CP=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input tidak valid: diharapkan ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input tidak valid: diharapkan ${O(r.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${i}${r.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Terlalu kecil: diharapkan ${r.origin} memiliki ${i}${r.minimum.toString()} ${s.unit}`;return`Terlalu kecil: diharapkan ${r.origin} menjadi ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`String tidak valid: harus dimulai dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak valid: harus berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak valid: harus menyertakan "${i.includes}"`;if(i.format==="regex")return`String tidak valid: harus sesuai pola ${i.pattern}`;return`${o[i.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};function Df(){return{localeError:CP()}}var RP=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"númer";case"object":{if(Array.isArray(e))return"fylki";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},AP=()=>{let e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function t(o){return e[o]??null}let n={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return(o)=>{switch(o.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${RP(o.input)} þar sem á að vera ${o.expected}`;case"invalid_value":if(o.values.length===1)return`Rangt gildi: gert ráð fyrir ${O(o.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${_(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} hafi ${r}${o.maximum.toString()} ${i.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} sé ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Of lítið: gert er ráð fyrir að ${o.origin} hafi ${r}${o.minimum.toString()} ${i.unit}`;return`Of lítið: gert er ráð fyrir að ${o.origin} sé ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Ógildur strengur: verður að byrja á "${r.prefix}"`;if(r.format==="ends_with")return`Ógildur strengur: verður að enda á "${r.suffix}"`;if(r.format==="includes")return`Ógildur strengur: verður að innihalda "${r.includes}"`;if(r.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${r.pattern}`;return`Rangt ${n[r.format]??o.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${o.divisor}`;case"unrecognized_keys":return`Óþekkt ${o.keys.length>1?"ir lyklar":"ur lykill"}: ${_(o.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${o.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${o.origin}`;default:return"Rangt gildi"}}};function Pf(){return{localeError:AP()}}var MP=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"numero";case"object":{if(Array.isArray(r))return"vettore";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input non valido: atteso ${r.expected}, ricevuto ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input non valido: atteso ${O(r.values[0])}`;return`Opzione non valida: atteso uno tra ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Troppo grande: ${r.origin??"valore"} deve avere ${i}${r.maximum.toString()} ${s.unit??"elementi"}`;return`Troppo grande: ${r.origin??"valore"} deve essere ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Troppo piccolo: ${r.origin} deve avere ${i}${r.minimum.toString()} ${s.unit}`;return`Troppo piccolo: ${r.origin} deve essere ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Stringa non valida: deve iniziare con "${i.prefix}"`;if(i.format==="ends_with")return`Stringa non valida: deve terminare con "${i.suffix}"`;if(i.format==="includes")return`Stringa non valida: deve includere "${i.includes}"`;if(i.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${i.pattern}`;return`Invalid ${o[i.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${_(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};function Cf(){return{localeError:MP()}}var UP=()=>{let e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"数値";case"object":{if(Array.isArray(r))return"配列";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(r)=>{switch(r.code){case"invalid_type":return`無効な入力: ${r.expected}が期待されましたが、${n(r.input)}が入力されました`;case"invalid_value":if(r.values.length===1)return`無効な入力: ${O(r.values[0])}が期待されました`;return`無効な選択: ${_(r.values,"、")}のいずれかである必要があります`;case"too_big":{let i=r.inclusive?"以下である":"より小さい",s=t(r.origin);if(s)return`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${s.unit??"要素"}${i}必要があります`;return`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${i}必要があります`}case"too_small":{let i=r.inclusive?"以上である":"より大きい",s=t(r.origin);if(s)return`小さすぎる値: ${r.origin}は${r.minimum.toString()}${s.unit}${i}必要があります`;return`小さすぎる値: ${r.origin}は${r.minimum.toString()}${i}必要があります`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`無効な文字列: "${i.prefix}"で始まる必要があります`;if(i.format==="ends_with")return`無効な文字列: "${i.suffix}"で終わる必要があります`;if(i.format==="includes")return`無効な文字列: "${i.includes}"を含む必要があります`;if(i.format==="regex")return`無効な文字列: パターン${i.pattern}に一致する必要があります`;return`無効な${o[i.format]??r.format}`}case"not_multiple_of":return`無効な数値: ${r.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${r.keys.length>1?"群":""}: ${_(r.keys,"、")}`;case"invalid_key":return`${r.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${r.origin}内の無効な値`;default:return"無効な入力"}}};function Rf(){return{localeError:UP()}}var NP=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"რიცხვი";case"object":{if(Array.isArray(e))return"მასივი";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return{string:"სტრინგი",boolean:"ბულეანი",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"ფუნქცია"}[t]??t},FP=()=>{let e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function t(o){return e[o]??null}let n={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"};return(o)=>{switch(o.code){case"invalid_type":return`არასწორი შეყვანა: მოსალოდნელი ${o.expected}, მიღებული ${NP(o.input)}`;case"invalid_value":if(o.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${O(o.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${_(o.values,"|")}-დან`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} ${i.verb} ${r}${o.maximum.toString()} ${i.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} იყოს ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`ზედმეტად პატარა: მოსალოდნელი ${o.origin} ${i.verb} ${r}${o.minimum.toString()} ${i.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${o.origin} იყოს ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${r.prefix}"-ით`;if(r.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${r.suffix}"-ით`;if(r.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${r.includes}"-ს`;if(r.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${r.pattern}`;return`არასწორი ${n[r.format]??o.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${o.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${o.keys.length>1?"ები":"ი"}: ${_(o.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${o.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${o.origin}-ში`;default:return"არასწორი შეყვანა"}}};function Af(){return{localeError:FP()}}var zP=()=>{let e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(r))return"អារេ (Array)";if(r===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(r)=>{switch(r.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${r.expected} ប៉ុន្តែទទួលបាន ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${O(r.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${i} ${r.maximum.toString()} ${s.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`តូចពេក៖ ត្រូវការ ${r.origin} ${i} ${r.minimum.toString()} ${s.unit}`;return`តូចពេក៖ ត្រូវការ ${r.origin} ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`;if(i.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`;if(i.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`;if(i.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`;return`មិនត្រឹមត្រូវ៖ ${o[i.format]??r.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${r.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${_(r.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function Bi(){return{localeError:zP()}}function Mf(){return Bi()}var LP=()=>{let e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(r)=>{switch(r.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${r.expected}, 받은 타입은 ${n(r.input)}입니다`;case"invalid_value":if(r.values.length===1)return`잘못된 입력: 값은 ${O(r.values[0])} 이어야 합니다`;return`잘못된 옵션: ${_(r.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let i=r.inclusive?"이하":"미만",s=i==="미만"?"이어야 합니다":"여야 합니다",a=t(r.origin),l=a?.unit??"요소";if(a)return`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()}${l} ${i}${s}`;return`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()} ${i}${s}`}case"too_small":{let i=r.inclusive?"이상":"초과",s=i==="이상"?"이어야 합니다":"여야 합니다",a=t(r.origin),l=a?.unit??"요소";if(a)return`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()}${l} ${i}${s}`;return`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`;if(i.format==="ends_with")return`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`;if(i.format==="includes")return`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`;if(i.format==="regex")return`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${o[i.format]??r.format}`}case"not_multiple_of":return`잘못된 숫자: ${r.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${_(r.keys,", ")}`;case"invalid_key":return`잘못된 키: ${r.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${r.origin}`;default:return"잘못된 입력"}}};function Uf(){return{localeError:LP()}}var jP=(e)=>Hi(typeof e,e),Hi=(e,t=void 0)=>{switch(e){case"number":return Number.isNaN(t)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":{if(t===void 0)return"nežinomas objektas";if(t===null)return"nulinė reikšmė";if(Array.isArray(t))return"masyvas";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name;return"objektas"}case"null":return"nulinė reikšmė"}return e},qi=(e)=>e.charAt(0).toUpperCase()+e.slice(1);function Hb(e){let t=Math.abs(e),n=t%10,o=t%100;if(o>=11&&o<=19||n===0)return"many";if(n===1)return"one";return"few"}var GP=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(o,r,i,s){let a=e[o]??null;if(a===null)return a;return{unit:a.unit[r],verb:a.verb[s][i?"inclusive":"notInclusive"]}}let n={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"};return(o)=>{switch(o.code){case"invalid_type":return`Gautas tipas ${jP(o.input)}, o tikėtasi - ${Hi(o.expected)}`;case"invalid_value":if(o.values.length===1)return`Privalo būti ${O(o.values[0])}`;return`Privalo būti vienas iš ${_(o.values,"|")} pasirinkimų`;case"too_big":{let r=Hi(o.origin),i=t(o.origin,Hb(Number(o.maximum)),o.inclusive??!1,"smaller");if(i?.verb)return`${qi(r??o.origin??"reikšmė")} ${i.verb} ${o.maximum.toString()} ${i.unit??"elementų"}`;let s=o.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${qi(r??o.origin??"reikšmė")} turi būti ${s} ${o.maximum.toString()} ${i?.unit}`}case"too_small":{let r=Hi(o.origin),i=t(o.origin,Hb(Number(o.minimum)),o.inclusive??!1,"bigger");if(i?.verb)return`${qi(r??o.origin??"reikšmė")} ${i.verb} ${o.minimum.toString()} ${i.unit??"elementų"}`;let s=o.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${qi(r??o.origin??"reikšmė")} turi būti ${s} ${o.minimum.toString()} ${i?.unit}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Eilutė privalo prasidėti "${r.prefix}"`;if(r.format==="ends_with")return`Eilutė privalo pasibaigti "${r.suffix}"`;if(r.format==="includes")return`Eilutė privalo įtraukti "${r.includes}"`;if(r.format==="regex")return`Eilutė privalo atitikti ${r.pattern}`;return`Neteisingas ${n[r.format]??o.format}`}case"not_multiple_of":return`Skaičius privalo būti ${o.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${o.keys.length>1?"i":"as"} rakt${o.keys.length>1?"ai":"as"}: ${_(o.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let r=Hi(o.origin);return`${qi(r??o.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function Nf(){return{localeError:GP()}}var ZP=()=>{let e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"број";case"object":{if(Array.isArray(r))return"низа";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(r)=>{switch(r.code){case"invalid_type":return`Грешен внес: се очекува ${r.expected}, примено ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Invalid input: expected ${O(r.values[0])}`;return`Грешана опција: се очекува една ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Премногу голем: се очекува ${r.origin??"вредноста"} да има ${i}${r.maximum.toString()} ${s.unit??"елементи"}`;return`Премногу голем: се очекува ${r.origin??"вредноста"} да биде ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Премногу мал: се очекува ${r.origin} да има ${i}${r.minimum.toString()} ${s.unit}`;return`Премногу мал: се очекува ${r.origin} да биде ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Неважечка низа: мора да започнува со "${i.prefix}"`;if(i.format==="ends_with")return`Неважечка низа: мора да завршува со "${i.suffix}"`;if(i.format==="includes")return`Неважечка низа: мора да вклучува "${i.includes}"`;if(i.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${i.pattern}`;return`Invalid ${o[i.format]??r.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${_(r.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${r.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${r.origin}`;default:return"Грешен внес"}}};function Ff(){return{localeError:ZP()}}var BP=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nombor";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input tidak sah: dijangka ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input tidak sah: dijangka ${O(r.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Terlalu besar: dijangka ${r.origin??"nilai"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Terlalu kecil: dijangka ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Terlalu kecil: dijangka ${r.origin} adalah ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`String tidak sah: mesti bermula dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak sah: mesti mengandungi "${i.includes}"`;if(i.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${i.pattern}`;return`${o[i.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${_(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};function zf(){return{localeError:BP()}}var qP=()=>{let e={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"getal";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(r)=>{switch(r.code){case"invalid_type":return`Ongeldige invoer: verwacht ${r.expected}, ontving ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ongeldige invoer: verwacht ${O(r.values[0])}`;return`Ongeldige optie: verwacht één van ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Te lang: verwacht dat ${r.origin??"waarde"} ${i}${r.maximum.toString()} ${s.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${r.origin??"waarde"} ${i}${r.maximum.toString()} is`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Te kort: verwacht dat ${r.origin} ${i}${r.minimum.toString()} ${s.unit} bevat`;return`Te kort: verwacht dat ${r.origin} ${i}${r.minimum.toString()} is`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ongeldige tekst: moet met "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ongeldige tekst: moet op "${i.suffix}" eindigen`;if(i.format==="includes")return`Ongeldige tekst: moet "${i.includes}" bevatten`;if(i.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`;return`Ongeldig: ${o[i.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};function Lf(){return{localeError:qP()}}var HP=()=>{let e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"tall";case"object":{if(Array.isArray(r))return"liste";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Ugyldig input: forventet ${r.expected}, fikk ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ugyldig verdi: forventet ${O(r.values[0])}`;return`Ugyldig valg: forventet en av ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`For stor(t): forventet ${r.origin??"value"} til å ha ${i}${r.maximum.toString()} ${s.unit??"elementer"}`;return`For stor(t): forventet ${r.origin??"value"} til å ha ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`For lite(n): forventet ${r.origin} til å ha ${i}${r.minimum.toString()} ${s.unit}`;return`For lite(n): forventet ${r.origin} til å ha ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ugyldig streng: må starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: må ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: må inneholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: må matche mønsteret ${i.pattern}`;return`Ugyldig ${o[i.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${_(r.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};function jf(){return{localeError:HP()}}var VP=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"numara";case"object":{if(Array.isArray(r))return"saf";if(r===null)return"gayb";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"giren",email:"epostagâh",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 hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(r)=>{switch(r.code){case"invalid_type":return`Fâsit giren: umulan ${r.expected}, alınan ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Fâsit giren: umulan ${O(r.values[0])}`;return`Fâsit tercih: mûteberler ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Fazla büyük: ${r.origin??"value"}, ${i}${r.maximum.toString()} ${s.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${r.origin??"value"}, ${i}${r.maximum.toString()} olmalıydı.`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Fazla küçük: ${r.origin}, ${i}${r.minimum.toString()} ${s.unit} sahip olmalıydı.`;return`Fazla küçük: ${r.origin}, ${i}${r.minimum.toString()} olmalıydı.`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Fâsit metin: "${i.prefix}" ile başlamalı.`;if(i.format==="ends_with")return`Fâsit metin: "${i.suffix}" ile bitmeli.`;if(i.format==="includes")return`Fâsit metin: "${i.includes}" ihtivâ etmeli.`;if(i.format==="regex")return`Fâsit metin: ${i.pattern} nakşına uymalı.`;return`Fâsit ${o[i.format]??r.format}`}case"not_multiple_of":return`Fâsit sayı: ${r.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`${r.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${r.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Gf(){return{localeError:VP()}}var WP=()=>{let e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"ارې";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return(r)=>{switch(r.code){case"invalid_type":return`ناسم ورودي: باید ${r.expected} وای, مګر ${n(r.input)} ترلاسه شو`;case"invalid_value":if(r.values.length===1)return`ناسم ورودي: باید ${O(r.values[0])} وای`;return`ناسم انتخاب: باید یو له ${_(r.values,"|")} څخه وای`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`ډیر لوی: ${r.origin??"ارزښت"} باید ${i}${r.maximum.toString()} ${s.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${r.origin??"ارزښت"} باید ${i}${r.maximum.toString()} وي`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`ډیر کوچنی: ${r.origin} باید ${i}${r.minimum.toString()} ${s.unit} ولري`;return`ډیر کوچنی: ${r.origin} باید ${i}${r.minimum.toString()} وي`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`ناسم متن: باید د "${i.prefix}" سره پیل شي`;if(i.format==="ends_with")return`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`;if(i.format==="includes")return`ناسم متن: باید "${i.includes}" ولري`;if(i.format==="regex")return`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`;return`${o[i.format]??r.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${r.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${r.keys.length>1?"کلیډونه":"کلیډ"}: ${_(r.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${r.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${r.origin} کې`;default:return"ناسمه ورودي"}}};function Zf(){return{localeError:WP()}}var JP=()=>{let e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"liczba";case"object":{if(Array.isArray(r))return"tablica";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"wyrażenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(r)=>{switch(r.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${r.expected}, otrzymano ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${O(r.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Za duża wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${i}${r.maximum.toString()} ${s.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Za mała wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${i}${r.minimum.toString()} ${s.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`;if(i.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`;if(i.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`;if(i.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`;return`Nieprawidłow(y/a/e) ${o[i.format]??r.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${r.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${r.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Bf(){return{localeError:JP()}}var KP=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"número";case"object":{if(Array.isArray(r))return"array";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"padrão",email:"endereço de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(r)=>{switch(r.code){case"invalid_type":return`Tipo inválido: esperado ${r.expected}, recebido ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Entrada inválida: esperado ${O(r.values[0])}`;return`Opção inválida: esperada uma das ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Muito grande: esperado que ${r.origin??"valor"} tivesse ${i}${r.maximum.toString()} ${s.unit??"elementos"}`;return`Muito grande: esperado que ${r.origin??"valor"} fosse ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Muito pequeno: esperado que ${r.origin} tivesse ${i}${r.minimum.toString()} ${s.unit}`;return`Muito pequeno: esperado que ${r.origin} fosse ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Texto inválido: deve começar com "${i.prefix}"`;if(i.format==="ends_with")return`Texto inválido: deve terminar com "${i.suffix}"`;if(i.format==="includes")return`Texto inválido: deve incluir "${i.includes}"`;if(i.format==="regex")return`Texto inválido: deve corresponder ao padrão ${i.pattern}`;return`${o[i.format]??r.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Chave inválida em ${r.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${r.origin}`;default:return"Campo inválido"}}};function qf(){return{localeError:KP()}}function Vb(e,t,n,o){let r=Math.abs(e),i=r%10,s=r%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return n;return o}var YP=()=>{let e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"массив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(r)=>{switch(r.code){case"invalid_type":return`Неверный ввод: ожидалось ${r.expected}, получено ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Неверный ввод: ожидалось ${O(r.values[0])}`;return`Неверный вариант: ожидалось одно из ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=Vb(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет иметь ${i}${r.maximum.toString()} ${l}`}return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=Vb(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком маленькое значение: ожидалось, что ${r.origin} будет иметь ${i}${r.minimum.toString()} ${l}`}return`Слишком маленькое значение: ожидалось, что ${r.origin} будет ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Неверная строка: должна начинаться с "${i.prefix}"`;if(i.format==="ends_with")return`Неверная строка: должна заканчиваться на "${i.suffix}"`;if(i.format==="includes")return`Неверная строка: должна содержать "${i.includes}"`;if(i.format==="regex")return`Неверная строка: должна соответствовать шаблону ${i.pattern}`;return`Неверный ${o[i.format]??r.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспознанн${r.keys.length>1?"ые":"ый"} ключ${r.keys.length>1?"и":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${r.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${r.origin}`;default:return"Неверные входные данные"}}};function Hf(){return{localeError:YP()}}var XP=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"število";case"object":{if(Array.isArray(r))return"tabela";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"vnos",email:"e-poštni naslov",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 datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(r)=>{switch(r.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${r.expected}, prejeto ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Neveljaven vnos: pričakovano ${O(r.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} imelo ${i}${r.maximum.toString()} ${s.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Premajhno: pričakovano, da bo ${r.origin} imelo ${i}${r.minimum.toString()} ${s.unit}`;return`Premajhno: pričakovano, da bo ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Neveljaven niz: mora se začeti z "${i.prefix}"`;if(i.format==="ends_with")return`Neveljaven niz: mora se končati z "${i.suffix}"`;if(i.format==="includes")return`Neveljaven niz: mora vsebovati "${i.includes}"`;if(i.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`;return`Neveljaven ${o[i.format]??r.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i ključi":" ključ"}: ${_(r.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};function Vf(){return{localeError:XP()}}var QP=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"antal";case"object":{if(Array.isArray(r))return"lista";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"reguljärt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(r)=>{switch(r.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${r.expected}, fick ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ogiltig inmatning: förväntat ${O(r.values[0])}`;return`Ogiltigt val: förväntade en av ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`För stor(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.maximum.toString()} ${s.unit??"element"}`;return`För stor(t): förväntat ${r.origin??"värdet"} att ha ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`För lite(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.minimum.toString()} ${s.unit}`;return`För lite(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ogiltig sträng: måste börja med "${i.prefix}"`;if(i.format==="ends_with")return`Ogiltig sträng: måste sluta med "${i.suffix}"`;if(i.format==="includes")return`Ogiltig sträng: måste innehålla "${i.includes}"`;if(i.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`;return`Ogiltig(t) ${o[i.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${_(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${r.origin??"värdet"}`;default:return"Ogiltig input"}}};function Wf(){return{localeError:QP()}}var eC=()=>{let e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(r))return"அணி";if(r===null)return"வெறுமை";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",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 தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${r.expected}, பெறப்பட்டது ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${O(r.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${_(r.values,"|")} இல் ஒன்று`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${i}${r.maximum.toString()} ${s.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${i}${r.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${i}${r.minimum.toString()} ${s.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${i}${r.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`;if(i.format==="ends_with")return`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`;if(i.format==="includes")return`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`;if(i.format==="regex")return`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${o[i.format]??r.format}`}case"not_multiple_of":return`தவறான எண்: ${r.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${r.keys.length>1?"கள்":""}: ${_(r.keys,", ")}`;case"invalid_key":return`${r.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${r.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Jf(){return{localeError:eC()}}var tC=()=>{let e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(r))return"อาร์เรย์ (Array)";if(r===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(r)=>{switch(r.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${r.expected} แต่ได้รับ ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${O(r.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"ไม่เกิน":"น้อยกว่า",s=t(r.origin);if(s)return`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${i} ${r.maximum.toString()} ${s.unit??"รายการ"}`;return`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"อย่างน้อย":"มากกว่า",s=t(r.origin);if(s)return`น้อยกว่ากำหนด: ${r.origin} ควรมี${i} ${r.minimum.toString()} ${s.unit}`;return`น้อยกว่ากำหนด: ${r.origin} ควรมี${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`;if(i.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`;if(i.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`;if(i.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`;return`รูปแบบไม่ถูกต้อง: ${o[i.format]??r.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${r.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${_(r.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${r.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${r.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function Kf(){return{localeError:tC()}}var rC=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},nC=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(o){return e[o]??null}let n={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(o)=>{switch(o.code){case"invalid_type":return`Geçersiz değer: beklenen ${o.expected}, alınan ${rC(o.input)}`;case"invalid_value":if(o.values.length===1)return`Geçersiz değer: beklenen ${O(o.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${_(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Çok büyük: beklenen ${o.origin??"değer"} ${r}${o.maximum.toString()} ${i.unit??"öğe"}`;return`Çok büyük: beklenen ${o.origin??"değer"} ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Çok küçük: beklenen ${o.origin} ${r}${o.minimum.toString()} ${i.unit}`;return`Çok küçük: beklenen ${o.origin} ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Geçersiz metin: "${r.prefix}" ile başlamalı`;if(r.format==="ends_with")return`Geçersiz metin: "${r.suffix}" ile bitmeli`;if(r.format==="includes")return`Geçersiz metin: "${r.includes}" içermeli`;if(r.format==="regex")return`Geçersiz metin: ${r.pattern} desenine uymalı`;return`Geçersiz ${n[r.format]??o.format}`}case"not_multiple_of":return`Geçersiz sayı: ${o.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${o.keys.length>1?"lar":""}: ${_(o.keys,", ")}`;case"invalid_key":return`${o.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${o.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function Yf(){return{localeError:nC()}}var oC=()=>{let e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"масив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(r)=>{switch(r.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${r.expected}, отримано ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Неправильні вхідні дані: очікується ${O(r.values[0])}`;return`Неправильна опція: очікується одне з ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Занадто велике: очікується, що ${r.origin??"значення"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"елементів"}`;return`Занадто велике: очікується, що ${r.origin??"значення"} буде ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Занадто мале: очікується, що ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Занадто мале: очікується, що ${r.origin} буде ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Неправильний рядок: повинен починатися з "${i.prefix}"`;if(i.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`;if(i.format==="includes")return`Неправильний рядок: повинен містити "${i.includes}"`;if(i.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`;return`Неправильний ${o[i.format]??r.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${r.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${r.keys.length>1?"і":""}: ${_(r.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${r.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${r.origin}`;default:return"Неправильні вхідні дані"}}};function Vi(){return{localeError:oC()}}function Xf(){return Vi()}var iC=()=>{let e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"نمبر";case"object":{if(Array.isArray(r))return"آرے";if(r===null)return"نل";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(r)=>{switch(r.code){case"invalid_type":return`غلط ان پٹ: ${r.expected} متوقع تھا، ${n(r.input)} موصول ہوا`;case"invalid_value":if(r.values.length===1)return`غلط ان پٹ: ${O(r.values[0])} متوقع تھا`;return`غلط آپشن: ${_(r.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`بہت بڑا: ${r.origin??"ویلیو"} کے ${i}${r.maximum.toString()} ${s.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${r.origin??"ویلیو"} کا ${i}${r.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`بہت چھوٹا: ${r.origin} کے ${i}${r.minimum.toString()} ${s.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${r.origin} کا ${i}${r.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`;if(i.format==="ends_with")return`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`;if(i.format==="includes")return`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`;if(i.format==="regex")return`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`;return`غلط ${o[i.format]??r.format}`}case"not_multiple_of":return`غلط نمبر: ${r.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${r.keys.length>1?"ز":""}: ${_(r.keys,"، ")}`;case"invalid_key":return`${r.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${r.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function Qf(){return{localeError:iC()}}var sC=()=>{let e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"số";case"object":{if(Array.isArray(r))return"mảng";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"đầu vào",email:"địa chỉ email",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:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(r)=>{switch(r.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${r.expected}, nhận được ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${O(r.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Quá lớn: mong đợi ${r.origin??"giá trị"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"phần tử"}`;return`Quá lớn: mong đợi ${r.origin??"giá trị"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Quá nhỏ: mong đợi ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Quá nhỏ: mong đợi ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`;if(i.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`;if(i.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`;if(i.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`;return`${o[i.format]??r.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${r.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${_(r.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${r.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${r.origin}`;default:return"Đầu vào không hợp lệ"}}};function eh(){return{localeError:sC()}}var aC=()=>{let e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(r))return"数组";if(r===null)return"空值(null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(r)=>{switch(r.code){case"invalid_type":return`无效输入:期望 ${r.expected},实际接收 ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`无效输入:期望 ${O(r.values[0])}`;return`无效选项:期望以下之一 ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`数值过大:期望 ${r.origin??"值"} ${i}${r.maximum.toString()} ${s.unit??"个元素"}`;return`数值过大:期望 ${r.origin??"值"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`数值过小:期望 ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`;return`数值过小:期望 ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`无效字符串:必须以 "${i.prefix}" 开头`;if(i.format==="ends_with")return`无效字符串:必须以 "${i.suffix}" 结尾`;if(i.format==="includes")return`无效字符串:必须包含 "${i.includes}"`;if(i.format==="regex")return`无效字符串:必须满足正则表达式 ${i.pattern}`;return`无效${o[i.format]??r.format}`}case"not_multiple_of":return`无效数字:必须是 ${r.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${_(r.keys,", ")}`;case"invalid_key":return`${r.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${r.origin} 中包含无效值(value)`;default:return"无效输入"}}};function th(){return{localeError:aC()}}var cC=()=>{let e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"輸入",email:"郵件地址",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 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(r)=>{switch(r.code){case"invalid_type":return`無效的輸入值:預期為 ${r.expected},但收到 ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`無效的輸入值:預期為 ${O(r.values[0])}`;return`無效的選項:預期為以下其中之一 ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`數值過大:預期 ${r.origin??"值"} 應為 ${i}${r.maximum.toString()} ${s.unit??"個元素"}`;return`數值過大:預期 ${r.origin??"值"} 應為 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`數值過小:預期 ${r.origin} 應為 ${i}${r.minimum.toString()} ${s.unit}`;return`數值過小:預期 ${r.origin} 應為 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`無效的字串:必須以 "${i.prefix}" 開頭`;if(i.format==="ends_with")return`無效的字串:必須以 "${i.suffix}" 結尾`;if(i.format==="includes")return`無效的字串:必須包含 "${i.includes}"`;if(i.format==="regex")return`無效的字串:必須符合格式 ${i.pattern}`;return`無效的 ${o[i.format]??r.format}`}case"not_multiple_of":return`無效的數字:必須為 ${r.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${r.keys.length>1?"們":""}:${_(r.keys,"、")}`;case"invalid_key":return`${r.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${r.origin} 中有無效的值`;default:return"無效的輸入值"}}};function rh(){return{localeError:cC()}}var lC=()=>{let e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(r))return"akopọ";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",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:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return(r)=>{switch(r.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${r.expected}, àmọ̀ a rí ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${O(r.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${_(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${r.origin??"iye"} ${s.verb} ${i}${r.maximum} ${s.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${i}${r.maximum}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Kéré ju: a ní láti jẹ́ pé ${r.origin} ${s.verb} ${i}${r.minimum} ${s.unit}`;return`Kéré ju: a ní láti jẹ́ ${i}${r.minimum}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${i.prefix}"`;if(i.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${i.suffix}"`;if(i.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${i.includes}"`;if(i.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${i.pattern}`;return`Aṣìṣe: ${o[i.format]??r.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${r.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${_(r.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${r.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${r.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function nh(){return{localeError:lC()}}var oh=Symbol("ZodOutput"),ih=Symbol("ZodInput");class Ji{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function uc(){return new Ji}var vr=uc();function sh(e,t){return new e({type:"string",...E(t)})}function ah(e,t){return new e({type:"string",coerce:!0,...E(t)})}function dc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}function Ki(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}function pc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}function fc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}function hc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}function Yi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}function gc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}function yc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}function xc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}function vc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}function Sc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}function bc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}function _c(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}function kc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}function wc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}function Ic(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}function Tc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}function Ec(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}function $c(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}function Oc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}function Dc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}var ch={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function lh(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}function uh(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}function dh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}function ph(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}function mh(e,t){return new e({type:"number",checks:[],...E(t)})}function fh(e,t){return new e({type:"number",coerce:!0,checks:[],...E(t)})}function hh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}function gh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...E(t)})}function yh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...E(t)})}function xh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...E(t)})}function vh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...E(t)})}function Sh(e,t){return new e({type:"boolean",...E(t)})}function bh(e,t){return new e({type:"boolean",coerce:!0,...E(t)})}function _h(e,t){return new e({type:"bigint",...E(t)})}function kh(e,t){return new e({type:"bigint",coerce:!0,...E(t)})}function wh(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...E(t)})}function Ih(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...E(t)})}function Th(e,t){return new e({type:"symbol",...E(t)})}function Eh(e,t){return new e({type:"undefined",...E(t)})}function $h(e,t){return new e({type:"null",...E(t)})}function Oh(e){return new e({type:"any"})}function Dh(e){return new e({type:"unknown"})}function Ph(e,t){return new e({type:"never",...E(t)})}function Ch(e,t){return new e({type:"void",...E(t)})}function Rh(e,t){return new e({type:"date",...E(t)})}function Ah(e,t){return new e({type:"date",coerce:!0,...E(t)})}function Mh(e,t){return new e({type:"nan",...E(t)})}function Ar(e,t){return new Xa({check:"less_than",...E(t),value:e,inclusive:!1})}function Vt(e,t){return new Xa({check:"less_than",...E(t),value:e,inclusive:!0})}function Mr(e,t){return new Qa({check:"greater_than",...E(t),value:e,inclusive:!1})}function Tt(e,t){return new Qa({check:"greater_than",...E(t),value:e,inclusive:!0})}function Uh(e){return Mr(0,e)}function Nh(e){return Ar(0,e)}function Fh(e){return Vt(0,e)}function zh(e){return Tt(0,e)}function Gn(e,t){return new jp({check:"multiple_of",...E(t),value:e})}function Ro(e,t){return new Bp({check:"max_size",...E(t),maximum:e})}function Zn(e,t){return new qp({check:"min_size",...E(t),minimum:e})}function Xi(e,t){return new Hp({check:"size_equals",...E(t),size:e})}function Ao(e,t){return new Vp({check:"max_length",...E(t),maximum:e})}function un(e,t){return new Wp({check:"min_length",...E(t),minimum:e})}function Mo(e,t){return new Jp({check:"length_equals",...E(t),length:e})}function Qi(e,t){return new Kp({check:"string_format",format:"regex",...E(t),pattern:e})}function es(e){return new Yp({check:"string_format",format:"lowercase",...E(e)})}function ts(e){return new Xp({check:"string_format",format:"uppercase",...E(e)})}function rs(e,t){return new Qp({check:"string_format",format:"includes",...E(t),includes:e})}function ns(e,t){return new em({check:"string_format",format:"starts_with",...E(t),prefix:e})}function os(e,t){return new tm({check:"string_format",format:"ends_with",...E(t),suffix:e})}function Lh(e,t,n){return new rm({check:"property",property:e,schema:t,...E(n)})}function is(e,t){return new nm({check:"mime_type",mime:e,...E(t)})}function Ur(e){return new om({check:"overwrite",tx:e})}function ss(e){return Ur((t)=>t.normalize(e))}function as(){return Ur((e)=>e.trim())}function cs(){return Ur((e)=>e.toLowerCase())}function ls(){return Ur((e)=>e.toUpperCase())}function jh(e,t,n){return new e({type:"array",element:t,...E(n)})}function uC(e,t,n){return new e({type:"union",options:t,...E(n)})}function dC(e,t,n,o){return new e({type:"union",options:n,discriminator:t,...E(o)})}function pC(e,t,n){return new e({type:"intersection",left:t,right:n})}function mC(e,t,n,o){let r=n instanceof Z;return new e({type:"tuple",items:t,rest:r?n:null,...E(r?o:n)})}function fC(e,t,n,o){return new e({type:"record",keyType:t,valueType:n,...E(o)})}function hC(e,t,n,o){return new e({type:"map",keyType:t,valueType:n,...E(o)})}function gC(e,t,n){return new e({type:"set",valueType:t,...E(n)})}function yC(e,t,n){let o=Array.isArray(t)?Object.fromEntries(t.map((r)=>[r,r])):t;return new e({type:"enum",entries:o,...E(n)})}function xC(e,t,n){return new e({type:"enum",entries:t,...E(n)})}function vC(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...E(n)})}function Gh(e,t){return new e({type:"file",...E(t)})}function SC(e,t){return new e({type:"transform",transform:t})}function bC(e,t){return new e({type:"optional",innerType:t})}function _C(e,t){return new e({type:"nullable",innerType:t})}function kC(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n==="function"?n():Ci(n)}})}function wC(e,t,n){return new e({type:"nonoptional",innerType:t,...E(n)})}function IC(e,t){return new e({type:"success",innerType:t})}function TC(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n==="function"?n:()=>n})}function EC(e,t,n){return new e({type:"pipe",in:t,out:n})}function $C(e,t){return new e({type:"readonly",innerType:t})}function OC(e,t,n){return new e({type:"template_literal",parts:t,...E(n)})}function DC(e,t){return new e({type:"lazy",getter:t})}function PC(e,t){return new e({type:"promise",innerType:t})}function Zh(e,t,n){let o=E(n);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Bh(e,t,n){return new e({type:"custom",check:"custom",fn:t,...E(n)})}function qh(e){let t=Wb((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ln(o,n.value,t._zod.def));else{let r=o;if(r.fatal)r.continue=!1;r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(ln(r))}},e(n.value,n)));return t}function Wb(e,t){let n=new Ae({check:"custom",...E(t)});return n._zod.check=e,n}function Hh(e,t){let n=E(t),o=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];if(n.case!=="sensitive")o=o.map((m)=>typeof m==="string"?m.toLowerCase():m),r=r.map((m)=>typeof m==="string"?m.toLowerCase():m);let i=new Set(o),s=new Set(r),a=e.Codec??Gi,l=e.Boolean??ji,u=new(e.String??jn)({type:"string",error:n.error}),f=new l({type:"boolean",error:n.error}),h=new a({type:"pipe",in:u,out:f,transform:(m,y)=>{let k=m;if(n.case!=="sensitive")k=k.toLowerCase();if(i.has(k))return!0;else if(s.has(k))return!1;else return y.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:y.value,inst:h,continue:!1}),{}},reverseTransform:(m,y)=>{if(m===!0)return o[0]||"true";else return r[0]||"false"},error:n.error});return h}function Uo(e,t,n,o={}){let r=E(o),i={...E(o),check:"string_format",type:"string",format:t,fn:typeof n==="function"?n:(a)=>n.test(a),...r};if(n instanceof RegExp)i.pattern=n;return new e(i)}class Pc{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??vr,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var n;let o=e._zod.def,r={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i){if(i.count++,t.schemaPath.includes(e))i.cycle=t.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,e],path:t.path},f=e._zod.parent;if(f)s.ref=f,this.process(f,u),this.seen.get(f).isParent=!0;else{let h=s.schema;switch(o.type){case"string":{let m=h;m.type="string";let{minimum:y,maximum:k,format:S,patterns:I,contentEncoding:D}=e._zod.bag;if(typeof y==="number")m.minLength=y;if(typeof k==="number")m.maxLength=k;if(S){if(m.format=r[S]??S,m.format==="")delete m.format}if(D)m.contentEncoding=D;if(I&&I.size>0){let R=[...I];if(R.length===1)m.pattern=R[0].source;else if(R.length>1)s.schema.allOf=[...R.map((M)=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:M.source}))]}break}case"number":{let m=h,{minimum:y,maximum:k,format:S,multipleOf:I,exclusiveMaximum:D,exclusiveMinimum:R}=e._zod.bag;if(typeof S==="string"&&S.includes("int"))m.type="integer";else m.type="number";if(typeof R==="number")if(this.target==="draft-4"||this.target==="openapi-3.0")m.minimum=R,m.exclusiveMinimum=!0;else m.exclusiveMinimum=R;if(typeof y==="number"){if(m.minimum=y,typeof R==="number"&&this.target!=="draft-4")if(R>=y)delete m.minimum;else delete m.exclusiveMinimum}if(typeof D==="number")if(this.target==="draft-4"||this.target==="openapi-3.0")m.maximum=D,m.exclusiveMaximum=!0;else m.exclusiveMaximum=D;if(typeof k==="number"){if(m.maximum=k,typeof D==="number"&&this.target!=="draft-4")if(D<=k)delete m.maximum;else delete m.exclusiveMaximum}if(typeof I==="number")m.multipleOf=I;break}case"boolean":{let m=h;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{if(this.target==="openapi-3.0")h.type="string",h.nullable=!0,h.enum=[null];else h.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"never":{h.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let m=h,{minimum:y,maximum:k}=e._zod.bag;if(typeof y==="number")m.minItems=y;if(typeof k==="number")m.maxItems=k;m.type="array",m.items=this.process(o.element,{...u,path:[...u.path,"items"]});break}case"object":{let m=h;m.type="object",m.properties={};let y=o.shape;for(let I in y)m.properties[I]=this.process(y[I],{...u,path:[...u.path,"properties",I]});let k=new Set(Object.keys(y)),S=new Set([...k].filter((I)=>{let D=o.shape[I]._zod;if(this.io==="input")return D.optin===void 0;else return D.optout===void 0}));if(S.size>0)m.required=Array.from(S);if(o.catchall?._zod.def.type==="never")m.additionalProperties=!1;else if(!o.catchall){if(this.io==="output")m.additionalProperties=!1}else if(o.catchall)m.additionalProperties=this.process(o.catchall,{...u,path:[...u.path,"additionalProperties"]});break}case"union":{let m=h,y=o.options.map((k,S)=>this.process(k,{...u,path:[...u.path,"anyOf",S]}));m.anyOf=y;break}case"intersection":{let m=h,y=this.process(o.left,{...u,path:[...u.path,"allOf",0]}),k=this.process(o.right,{...u,path:[...u.path,"allOf",1]}),S=(D)=>("allOf"in D)&&Object.keys(D).length===1,I=[...S(y)?y.allOf:[y],...S(k)?k.allOf:[k]];m.allOf=I;break}case"tuple":{let m=h;m.type="array";let y=this.target==="draft-2020-12"?"prefixItems":"items",k=this.target==="draft-2020-12"?"items":this.target==="openapi-3.0"?"items":"additionalItems",S=o.items.map((M,me)=>this.process(M,{...u,path:[...u.path,y,me]})),I=o.rest?this.process(o.rest,{...u,path:[...u.path,k,...this.target==="openapi-3.0"?[o.items.length]:[]]}):null;if(this.target==="draft-2020-12"){if(m.prefixItems=S,I)m.items=I}else if(this.target==="openapi-3.0"){if(m.items={anyOf:S},I)m.items.anyOf.push(I);if(m.minItems=S.length,!I)m.maxItems=S.length}else if(m.items=S,I)m.additionalItems=I;let{minimum:D,maximum:R}=e._zod.bag;if(typeof D==="number")m.minItems=D;if(typeof R==="number")m.maxItems=R;break}case"record":{let m=h;if(m.type="object",this.target==="draft-7"||this.target==="draft-2020-12")m.propertyNames=this.process(o.keyType,{...u,path:[...u.path,"propertyNames"]});m.additionalProperties=this.process(o.valueType,{...u,path:[...u.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=h,y=Di(o.entries);if(y.every((k)=>typeof k==="number"))m.type="number";if(y.every((k)=>typeof k==="string"))m.type="string";m.enum=y;break}case"literal":{let m=h,y=[];for(let k of o.values)if(k===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof k==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else y.push(Number(k));else y.push(k);if(y.length===0);else if(y.length===1){let k=y[0];if(m.type=k===null?"null":typeof k,this.target==="draft-4"||this.target==="openapi-3.0")m.enum=[k];else m.const=k}else{if(y.every((k)=>typeof k==="number"))m.type="number";if(y.every((k)=>typeof k==="string"))m.type="string";if(y.every((k)=>typeof k==="boolean"))m.type="string";if(y.every((k)=>k===null))m.type="null";m.enum=y}break}case"file":{let m=h,y={type:"string",format:"binary",contentEncoding:"binary"},{minimum:k,maximum:S,mime:I}=e._zod.bag;if(k!==void 0)y.minLength=k;if(S!==void 0)y.maxLength=S;if(I)if(I.length===1)y.contentMediaType=I[0],Object.assign(m,y);else m.anyOf=I.map((D)=>({...y,contentMediaType:D}));else Object.assign(m,y);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,u);if(this.target==="openapi-3.0")s.ref=o.innerType,h.nullable=!0;else h.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,u),s.ref=o.innerType;break}case"success":{let m=h;m.type="boolean";break}case"default":{this.process(o.innerType,u),s.ref=o.innerType,h.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{if(this.process(o.innerType,u),s.ref=o.innerType,this.io==="input")h._prefault=JSON.parse(JSON.stringify(o.defaultValue));break}case"catch":{this.process(o.innerType,u),s.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}h.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=h,y=e._zod.pattern;if(!y)throw Error("Pattern not found in template literal");m.type="string",m.pattern=y.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,u),s.ref=m;break}case"readonly":{this.process(o.innerType,u),s.ref=o.innerType,h.readOnly=!0;break}case"promise":{this.process(o.innerType,u),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,u),s.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,u),s.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(e);if(l)Object.assign(s.schema,l);if(this.io==="input"&&nt(e))delete s.schema.examples,delete s.schema.default;if(this.io==="input"&&s.schema._prefault)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,this.seen.get(e).schema}emit(e,t){let n={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},o=this.seen.get(e);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(c)=>{let u=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let y=n.external.registry.get(c[0])?.id,k=n.external.uri??((I)=>I);if(y)return{ref:k(y)};let S=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=S,{defId:S,ref:`${k("__shared")}#/${u}/${S}`}}if(c[1]===o)return{ref:"#"};let h=`${"#"}/${u}/`,m=c[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:h+m}},i=(c)=>{if(c[1].schema.$ref)return;let u=c[1],{ref:f,defId:h}=r(c);if(u.def={...u.schema},h)u.defId=h;let m=u.schema;for(let y in m)delete m[y];m.$ref=f};if(n.cycles==="throw")for(let c of this.seen.entries()){let u=c[1];if(u.cycle)throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
191
191
 
192
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of this.seen.entries()){let u=c[1];if(e===c[0]){i(c);continue}if(n.external){let h=n.external.registry.get(c[0])?.id;if(e!==c[0]&&h){i(c);continue}}if(this.metadataRegistry.get(c[0])?.id){i(c);continue}if(u.cycle){i(c);continue}if(u.count>1){if(n.reused==="ref"){i(c);continue}}}let s=(c,u)=>{let f=this.seen.get(c),h=f.def??f.schema,m={...h};if(f.ref===null)return;let y=f.ref;if(f.ref=null,y){s(y,u);let k=this.seen.get(y).schema;if(k.$ref&&(u.target==="draft-7"||u.target==="draft-4"||u.target==="openapi-3.0"))h.allOf=h.allOf??[],h.allOf.push(k);else Object.assign(h,k),Object.assign(h,m)}if(!f.isParent)this.override({zodSchema:c,jsonSchema:h,path:f.path??[]})};for(let c of[...this.seen.entries()].reverse())s(c[0],{target:this.target});let a={};if(this.target==="draft-2020-12")a.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")a.$schema="http://json-schema.org/draft-07/schema#";else if(this.target==="draft-4")a.$schema="http://json-schema.org/draft-04/schema#";else if(this.target==="openapi-3.0");else console.warn(`Invalid target: ${this.target}`);if(n.external?.uri){let c=n.external.registry.get(e)?.id;if(!c)throw Error("Schema is missing an `id` property");a.$id=n.external.uri(c)}Object.assign(a,o.def);let l=n.external?.defs??{};for(let c of this.seen.entries()){let u=c[1];if(u.def&&u.defId)l[u.defId]=u.def}if(n.external);else if(Object.keys(l).length>0)if(this.target==="draft-2020-12")a.$defs=l;else a.definitions=l;try{return JSON.parse(JSON.stringify(a))}catch(c){throw Error("Error converting schema to JSON.")}}}function Wh(e,t){if(e instanceof Ji){let o=new Pc(t),r={};for(let a of e._idmap.entries()){let[l,c]=a;o.process(c)}let i={},s={registry:e,uri:t?.uri,defs:r};for(let a of e._idmap.entries()){let[l,c]=a;i[l]=o.emit(c,{...t,external:s})}if(Object.keys(r).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:r}}return{schemas:i}}let n=new Pc(t);return n.process(e),n.emit(e,t)}function nt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;switch(r.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return nt(r.element,n);case"object":{for(let i in r.shape)if(nt(r.shape[i],n))return!0;return!1}case"union":{for(let i of r.options)if(nt(i,n))return!0;return!1}case"intersection":return nt(r.left,n)||nt(r.right,n);case"tuple":{for(let i of r.items)if(nt(i,n))return!0;if(r.rest&&nt(r.rest,n))return!0;return!1}case"record":return nt(r.keyType,n)||nt(r.valueType,n);case"map":return nt(r.keyType,n)||nt(r.valueType,n);case"set":return nt(r.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return nt(r.innerType,n);case"lazy":return nt(r.getter(),n);case"default":return nt(r.innerType,n);case"prefault":return nt(r.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return nt(r.in,n)||nt(r.out,n);case"success":return!1;case"catch":return!1;case"function":return!1;default:}throw Error(`Unknown schema type: ${r.type}`)}var Jb={};var Uc={};An(Uc,{ZodISODate:()=>Rc,ZodISODateTime:()=>Cc,ZodISODuration:()=>Mc,ZodISOTime:()=>Ac,date:()=>Jh,datetime:()=>Hh,duration:()=>Yh,time:()=>Kh});var Cc=x("ZodISODateTime",(e,t)=>{xm.init(e,t),Ce.init(e,t)});function Hh(e){return lh(Cc,e)}var Rc=x("ZodISODate",(e,t)=>{vm.init(e,t),Ce.init(e,t)});function Jh(e){return uh(Rc,e)}var Ac=x("ZodISOTime",(e,t)=>{Sm.init(e,t),Ce.init(e,t)});function Kh(e){return dh(Ac,e)}var Mc=x("ZodISODuration",(e,t)=>{bm.init(e,t),Ce.init(e,t)});function Yh(e){return ph(Mc,e)}var Yb=(e,t)=>{Ui.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(n)=>Fi(e,n)},flatten:{value:(n)=>Ni(e,n)},addIssue:{value:(n)=>{e.issues.push(n),e.message=JSON.stringify(e.issues,To,2)}},addIssues:{value:(n)=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,To,2)}},isEmpty:{get(){return e.issues.length===0}}})},RC=x("ZodError",Yb),Et=x("ZodError",Yb,{Parent:Error});var Xh=$o(Et),Qh=Oo(Et),eg=Do(Et),tg=Po(Et),rg=Ga(Et),ng=Za(Et),og=Ba(Et),ig=qa(Et),sg=Va(Et),ag=Wa(Et),cg=Ha(Et),lg=Ja(Et);var K=x("ZodType",(e,t)=>(Z.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),e.clone=(n,o)=>bt(e,n,o),e.brand=()=>e,e.register=(n,o)=>(n.add(e,o),e),e.parse=(n,o)=>Xh(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>eg(e,n,o),e.parseAsync=async(n,o)=>Qh(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>tg(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>rg(e,n,o),e.decode=(n,o)=>ng(e,n,o),e.encodeAsync=async(n,o)=>og(e,n,o),e.decodeAsync=async(n,o)=>ig(e,n,o),e.safeEncode=(n,o)=>sg(e,n,o),e.safeDecode=(n,o)=>ag(e,n,o),e.safeEncodeAsync=async(n,o)=>cg(e,n,o),e.safeDecodeAsync=async(n,o)=>lg(e,n,o),e.refine=(n,o)=>e.check(N_(n,o)),e.superRefine=(n)=>e.check(F_(n)),e.overwrite=(n)=>e.check(Ur(n)),e.optional=()=>Fc(e),e.nullable=()=>zc(e),e.nullish=()=>Fc(zc(e)),e.nonoptional=(n)=>I_(e,n),e.array=()=>Zc(e),e.or=(n)=>Cg([e,n]),e.and=(n)=>d_(e,n),e.transform=(n)=>Lc(e,Mg(n)),e.default=(n)=>__(e,n),e.prefault=(n)=>w_(e,n),e.catch=(n)=>$_(e,n),e.pipe=(n)=>Lc(e,n),e.readonly=()=>P_(e),e.describe=(n)=>{let o=e.clone();return vr.add(o,{description:n}),o},Object.defineProperty(e,"description",{get(){return vr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return vr.get(e);let o=e.clone();return vr.add(o,n[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),pg=x("_ZodString",(e,t)=>{jn.init(e,t),K.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...o)=>e.check(Qi(...o)),e.includes=(...o)=>e.check(rs(...o)),e.startsWith=(...o)=>e.check(ns(...o)),e.endsWith=(...o)=>e.check(os(...o)),e.min=(...o)=>e.check(un(...o)),e.max=(...o)=>e.check(Ao(...o)),e.length=(...o)=>e.check(Mo(...o)),e.nonempty=(...o)=>e.check(un(1,...o)),e.lowercase=(o)=>e.check(es(o)),e.uppercase=(o)=>e.check(ts(o)),e.trim=()=>e.check(as()),e.normalize=(...o)=>e.check(ss(...o)),e.toLowerCase=()=>e.check(cs()),e.toUpperCase=()=>e.check(ls())}),ds=x("ZodString",(e,t)=>{jn.init(e,t),pg.init(e,t),e.email=(n)=>e.check(dc(mg,n)),e.url=(n)=>e.check(Yi(jc,n)),e.jwt=(n)=>e.check(Dc($g,n)),e.emoji=(n)=>e.check(gc(fg,n)),e.guid=(n)=>e.check(Ki(Nc,n)),e.uuid=(n)=>e.check(pc(Fr,n)),e.uuidv4=(n)=>e.check(mc(Fr,n)),e.uuidv6=(n)=>e.check(fc(Fr,n)),e.uuidv7=(n)=>e.check(hc(Fr,n)),e.nanoid=(n)=>e.check(yc(hg,n)),e.guid=(n)=>e.check(Ki(Nc,n)),e.cuid=(n)=>e.check(xc(gg,n)),e.cuid2=(n)=>e.check(vc(yg,n)),e.ulid=(n)=>e.check(Sc(xg,n)),e.base64=(n)=>e.check(Ec(Ig,n)),e.base64url=(n)=>e.check($c(Tg,n)),e.xid=(n)=>e.check(bc(vg,n)),e.ksuid=(n)=>e.check(_c(Sg,n)),e.ipv4=(n)=>e.check(kc(bg,n)),e.ipv6=(n)=>e.check(wc(_g,n)),e.cidrv4=(n)=>e.check(Ic(kg,n)),e.cidrv6=(n)=>e.check(Tc(wg,n)),e.e164=(n)=>e.check(Oc(Eg,n)),e.datetime=(n)=>e.check(Hh(n)),e.date=(n)=>e.check(Jh(n)),e.time=(n)=>e.check(Kh(n)),e.duration=(n)=>e.check(Yh(n))});function ug(e){return sh(ds,e)}var Ce=x("ZodStringFormat",(e,t)=>{Oe.init(e,t),pg.init(e,t)}),mg=x("ZodEmail",(e,t)=>{lm.init(e,t),Ce.init(e,t)});function MC(e){return dc(mg,e)}var Nc=x("ZodGUID",(e,t)=>{am.init(e,t),Ce.init(e,t)});function UC(e){return Ki(Nc,e)}var Fr=x("ZodUUID",(e,t)=>{cm.init(e,t),Ce.init(e,t)});function NC(e){return pc(Fr,e)}function FC(e){return mc(Fr,e)}function zC(e){return fc(Fr,e)}function LC(e){return hc(Fr,e)}var jc=x("ZodURL",(e,t)=>{um.init(e,t),Ce.init(e,t)});function jC(e){return Yi(jc,e)}function GC(e){return Yi(jc,{protocol:/^https?$/,hostname:kb,...E(e)})}var fg=x("ZodEmoji",(e,t)=>{dm.init(e,t),Ce.init(e,t)});function ZC(e){return gc(fg,e)}var hg=x("ZodNanoID",(e,t)=>{pm.init(e,t),Ce.init(e,t)});function BC(e){return yc(hg,e)}var gg=x("ZodCUID",(e,t)=>{mm.init(e,t),Ce.init(e,t)});function qC(e){return xc(gg,e)}var yg=x("ZodCUID2",(e,t)=>{fm.init(e,t),Ce.init(e,t)});function VC(e){return vc(yg,e)}var xg=x("ZodULID",(e,t)=>{hm.init(e,t),Ce.init(e,t)});function WC(e){return Sc(xg,e)}var vg=x("ZodXID",(e,t)=>{gm.init(e,t),Ce.init(e,t)});function HC(e){return bc(vg,e)}var Sg=x("ZodKSUID",(e,t)=>{ym.init(e,t),Ce.init(e,t)});function JC(e){return _c(Sg,e)}var bg=x("ZodIPv4",(e,t)=>{_m.init(e,t),Ce.init(e,t)});function KC(e){return kc(bg,e)}var _g=x("ZodIPv6",(e,t)=>{km.init(e,t),Ce.init(e,t)});function YC(e){return wc(_g,e)}var kg=x("ZodCIDRv4",(e,t)=>{wm.init(e,t),Ce.init(e,t)});function XC(e){return Ic(kg,e)}var wg=x("ZodCIDRv6",(e,t)=>{Im.init(e,t),Ce.init(e,t)});function QC(e){return Tc(wg,e)}var Ig=x("ZodBase64",(e,t)=>{Em.init(e,t),Ce.init(e,t)});function eR(e){return Ec(Ig,e)}var Tg=x("ZodBase64URL",(e,t)=>{$m.init(e,t),Ce.init(e,t)});function tR(e){return $c(Tg,e)}var Eg=x("ZodE164",(e,t)=>{Om.init(e,t),Ce.init(e,t)});function rR(e){return Oc(Eg,e)}var $g=x("ZodJWT",(e,t)=>{Dm.init(e,t),Ce.init(e,t)});function nR(e){return Dc($g,e)}var ps=x("ZodCustomStringFormat",(e,t)=>{Pm.init(e,t),Ce.init(e,t)});function oR(e,t,n={}){return Uo(ps,e,t,n)}function iR(e){return Uo(ps,"hostname",Ya,e)}function sR(e){return Uo(ps,"hex",Tb,e)}function aR(e,t){let n=t?.enc??"hex",o=`${e}_${n}`,r=Rr[o];if(!r)throw Error(`Unrecognized hash format: ${o}`);return Uo(ps,o,r,t)}var ms=x("ZodNumber",(e,t)=>{sc.init(e,t),K.init(e,t),e.gt=(o,r)=>e.check(Mr(o,r)),e.gte=(o,r)=>e.check(Tt(o,r)),e.min=(o,r)=>e.check(Tt(o,r)),e.lt=(o,r)=>e.check(Ar(o,r)),e.lte=(o,r)=>e.check(Wt(o,r)),e.max=(o,r)=>e.check(Wt(o,r)),e.int=(o)=>e.check(dg(o)),e.safe=(o)=>e.check(dg(o)),e.positive=(o)=>e.check(Mr(0,o)),e.nonnegative=(o)=>e.check(Tt(0,o)),e.negative=(o)=>e.check(Ar(0,o)),e.nonpositive=(o)=>e.check(Wt(0,o)),e.multipleOf=(o,r)=>e.check(Gn(o,r)),e.step=(o,r)=>e.check(Gn(o,r)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),e.isFinite=!0,e.format=n.format??null});function Xb(e){return mh(ms,e)}var Fo=x("ZodNumberFormat",(e,t)=>{Cm.init(e,t),ms.init(e,t)});function dg(e){return hh(Fo,e)}function cR(e){return gh(Fo,e)}function lR(e){return yh(Fo,e)}function uR(e){return xh(Fo,e)}function dR(e){return vh(Fo,e)}var fs=x("ZodBoolean",(e,t)=>{ji.init(e,t),K.init(e,t)});function Qb(e){return Sh(fs,e)}var hs=x("ZodBigInt",(e,t)=>{ac.init(e,t),K.init(e,t),e.gte=(o,r)=>e.check(Tt(o,r)),e.min=(o,r)=>e.check(Tt(o,r)),e.gt=(o,r)=>e.check(Mr(o,r)),e.gte=(o,r)=>e.check(Tt(o,r)),e.min=(o,r)=>e.check(Tt(o,r)),e.lt=(o,r)=>e.check(Ar(o,r)),e.lte=(o,r)=>e.check(Wt(o,r)),e.max=(o,r)=>e.check(Wt(o,r)),e.positive=(o)=>e.check(Mr(BigInt(0),o)),e.negative=(o)=>e.check(Ar(BigInt(0),o)),e.nonpositive=(o)=>e.check(Wt(BigInt(0),o)),e.nonnegative=(o)=>e.check(Tt(BigInt(0),o)),e.multipleOf=(o,r)=>e.check(Gn(o,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function pR(e){return _h(hs,e)}var Og=x("ZodBigIntFormat",(e,t)=>{Rm.init(e,t),hs.init(e,t)});function mR(e){return wh(Og,e)}function fR(e){return Ih(Og,e)}var e_=x("ZodSymbol",(e,t)=>{Am.init(e,t),K.init(e,t)});function hR(e){return Th(e_,e)}var t_=x("ZodUndefined",(e,t)=>{Mm.init(e,t),K.init(e,t)});function gR(e){return Eh(t_,e)}var r_=x("ZodNull",(e,t)=>{Um.init(e,t),K.init(e,t)});function n_(e){return $h(r_,e)}var o_=x("ZodAny",(e,t)=>{Nm.init(e,t),K.init(e,t)});function yR(){return Oh(o_)}var i_=x("ZodUnknown",(e,t)=>{Fm.init(e,t),K.init(e,t)});function No(){return Dh(i_)}var s_=x("ZodNever",(e,t)=>{zm.init(e,t),K.init(e,t)});function Dg(e){return Ph(s_,e)}var a_=x("ZodVoid",(e,t)=>{Lm.init(e,t),K.init(e,t)});function xR(e){return Ch(a_,e)}var Gc=x("ZodDate",(e,t)=>{jm.init(e,t),K.init(e,t),e.min=(o,r)=>e.check(Tt(o,r)),e.max=(o,r)=>e.check(Wt(o,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function vR(e){return Rh(Gc,e)}var c_=x("ZodArray",(e,t)=>{Gm.init(e,t),K.init(e,t),e.element=t.element,e.min=(n,o)=>e.check(un(n,o)),e.nonempty=(n)=>e.check(un(1,n)),e.max=(n,o)=>e.check(Ao(n,o)),e.length=(n,o)=>e.check(Mo(n,o)),e.unwrap=()=>e.element});function Zc(e,t){return jh(c_,e,t)}function SR(e){let t=e._zod.def.shape;return Ag(Object.keys(t))}var Bc=x("ZodObject",(e,t)=>{Zm.init(e,t),K.init(e,t),te(e,"shape",()=>t.shape),e.keyof=()=>Ag(Object.keys(e._zod.def.shape)),e.catchall=(n)=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:No()}),e.loose=()=>e.clone({...e._zod.def,catchall:No()}),e.strict=()=>e.clone({...e._zod.def,catchall:Dg()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(n)=>pb(e,n),e.safeExtend=(n)=>mb(e,n),e.merge=(n)=>fb(e,n),e.pick=(n)=>ub(e,n),e.omit=(n)=>db(e,n),e.partial=(...n)=>hb(Ug,e,n[0]),e.required=(...n)=>gb(Ng,e,n[0])});function bR(e,t){let n={type:"object",get shape(){return nr(this,"shape",e?Na(e):{}),this.shape},...E(t)};return new Bc(n)}function _R(e,t){return new Bc({type:"object",get shape(){return nr(this,"shape",Na(e)),this.shape},catchall:Dg(),...E(t)})}function kR(e,t){return new Bc({type:"object",get shape(){return nr(this,"shape",Na(e)),this.shape},catchall:No(),...E(t)})}var Pg=x("ZodUnion",(e,t)=>{cc.init(e,t),K.init(e,t),e.options=t.options});function Cg(e,t){return new Pg({type:"union",options:e,...E(t)})}var l_=x("ZodDiscriminatedUnion",(e,t)=>{Pg.init(e,t),Bm.init(e,t)});function wR(e,t,n){return new l_({type:"union",options:t,discriminator:e,...E(n)})}var u_=x("ZodIntersection",(e,t)=>{qm.init(e,t),K.init(e,t)});function d_(e,t){return new u_({type:"intersection",left:e,right:t})}var p_=x("ZodTuple",(e,t)=>{lc.init(e,t),K.init(e,t),e.rest=(n)=>e.clone({...e._zod.def,rest:n})});function m_(e,t,n){let o=t instanceof Z,r=o?n:t;return new p_({type:"tuple",items:e,rest:o?t:null,...E(r)})}var Rg=x("ZodRecord",(e,t)=>{Vm.init(e,t),K.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function f_(e,t,n){return new Rg({type:"record",keyType:e,valueType:t,...E(n)})}function IR(e,t,n){let o=bt(e);return o._zod.values=void 0,new Rg({type:"record",keyType:o,valueType:t,...E(n)})}var h_=x("ZodMap",(e,t)=>{Wm.init(e,t),K.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function TR(e,t,n){return new h_({type:"map",keyType:e,valueType:t,...E(n)})}var g_=x("ZodSet",(e,t)=>{Hm.init(e,t),K.init(e,t),e.min=(...n)=>e.check(Zn(...n)),e.nonempty=(n)=>e.check(Zn(1,n)),e.max=(...n)=>e.check(Ro(...n)),e.size=(...n)=>e.check(Xi(...n))});function ER(e,t){return new g_({type:"set",valueType:e,...E(t)})}var us=x("ZodEnum",(e,t)=>{Jm.init(e,t),K.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{let i={};for(let s of o)if(n.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new us({...t,checks:[],...E(r),entries:i})},e.exclude=(o,r)=>{let i={...t.entries};for(let s of o)if(n.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new us({...t,checks:[],...E(r),entries:i})}});function Ag(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new us({type:"enum",entries:n,...E(t)})}function $R(e,t){return new us({type:"enum",entries:e,...E(t)})}var y_=x("ZodLiteral",(e,t)=>{Km.init(e,t),K.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function OR(e,t){return new y_({type:"literal",values:Array.isArray(e)?e:[e],...E(t)})}var x_=x("ZodFile",(e,t)=>{Ym.init(e,t),K.init(e,t),e.min=(n,o)=>e.check(Zn(n,o)),e.max=(n,o)=>e.check(Ro(n,o)),e.mime=(n,o)=>e.check(is(Array.isArray(n)?n:[n],o))});function DR(e){return Gh(x_,e)}var v_=x("ZodTransform",(e,t)=>{Xm.init(e,t),K.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Fn(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(ln(i,n.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(ln(s))}};let r=t.transform(n.value,n);if(r instanceof Promise)return r.then((i)=>(n.value=i,n));return n.value=r,n}});function Mg(e){return new v_({type:"transform",transform:e})}var Ug=x("ZodOptional",(e,t)=>{Qm.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Fc(e){return new Ug({type:"optional",innerType:e})}var S_=x("ZodNullable",(e,t)=>{ef.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function zc(e){return new S_({type:"nullable",innerType:e})}function PR(e){return Fc(zc(e))}var b_=x("ZodDefault",(e,t)=>{tf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function __(e,t){return new b_({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ci(t)}})}var k_=x("ZodPrefault",(e,t)=>{rf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function w_(e,t){return new k_({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ci(t)}})}var Ng=x("ZodNonOptional",(e,t)=>{nf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function I_(e,t){return new Ng({type:"nonoptional",innerType:e,...E(t)})}var T_=x("ZodSuccess",(e,t)=>{of.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function CR(e){return new T_({type:"success",innerType:e})}var E_=x("ZodCatch",(e,t)=>{sf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function $_(e,t){return new E_({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var O_=x("ZodNaN",(e,t)=>{af.init(e,t),K.init(e,t)});function RR(e){return Mh(O_,e)}var Fg=x("ZodPipe",(e,t)=>{cf.init(e,t),K.init(e,t),e.in=t.in,e.out=t.out});function Lc(e,t){return new Fg({type:"pipe",in:e,out:t})}var zg=x("ZodCodec",(e,t)=>{Fg.init(e,t),Gi.init(e,t)});function AR(e,t,n){return new zg({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}var D_=x("ZodReadonly",(e,t)=>{lf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function P_(e){return new D_({type:"readonly",innerType:e})}var C_=x("ZodTemplateLiteral",(e,t)=>{uf.init(e,t),K.init(e,t)});function MR(e,t){return new C_({type:"template_literal",parts:e,...E(t)})}var R_=x("ZodLazy",(e,t)=>{mf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.getter()});function A_(e){return new R_({type:"lazy",getter:e})}var M_=x("ZodPromise",(e,t)=>{pf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function UR(e){return new M_({type:"promise",innerType:e})}var U_=x("ZodFunction",(e,t)=>{df.init(e,t),K.init(e,t)});function NR(e){return new U_({type:"function",input:Array.isArray(e?.input)?m_(e?.input):e?.input??Zc(No()),output:e?.output??No()})}var qc=x("ZodCustom",(e,t)=>{ff.init(e,t),K.init(e,t)});function FR(e){let t=new Ae({check:"custom"});return t._zod.check=e,t}function zR(e,t){return Zh(qc,e??(()=>!0),t)}function N_(e,t={}){return Bh(qc,e,t)}function F_(e){return qh(e)}function LR(e,t={error:`Input not instance of ${e.name}`}){let n=new qc({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...E(t)});return n._zod.bag.Class=e,n}var jR=(...e)=>Vh({Codec:zg,Boolean:fs,String:ds},...e);function GR(e){let t=A_(()=>Cg([ug(e),Xb(),Qb(),n_(),Zc(t),f_(ug(),t)]));return t}function ZR(e,t){return Lc(Mg(e),t)}var BR={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function qR(e){et({customError:e})}function VR(){return et().customError}var Lg;(function(e){})(Lg||(Lg={}));var jg={};An(jg,{bigint:()=>KR,boolean:()=>JR,date:()=>YR,number:()=>HR,string:()=>WR});function WR(e){return ah(ds,e)}function HR(e){return fh(ms,e)}function JR(e){return bh(fs,e)}function KR(e){return kh(hs,e)}function YR(e){return Ah(Gc,e)}et(Zi());function V(e){return e}V.schema=Vc;import{readFileSync as uA}from"node:fs";import{dirname as dA,join as pA}from"node:path";import{fileURLToPath as mA}from"node:url";import{renameSync as XR,writeFileSync as QR,readFileSync as vG,existsSync as Gg,statSync as eA}from"node:fs";import{dirname as tA}from"node:path";import{mkdirSync as rA}from"node:fs";function Wc(e,t){let n=tA(t);if(!Gg(n))rA(n,{recursive:!0});let o=`${t}.tmp`;QR(o,JSON.stringify(e,null,2),"utf8"),XR(o,t)}function nA(e){let t=0;if(Gg(e))try{t=eA(e).size}catch{}let n=0;for(let o=1;o<=10;o++)if(Gg(`${e}.${o}`))n=o;else break;return{path:e,sizeBytes:t,rotatedFiles:n}}function Hc(e){let t=e.snapshot.counters,n=t.orchestrator_errors?.count??0,o=(t.decisions_skipped_continue?.count??0)+(t.decisions_skipped_no_decision?.count??0)+(t.decisions_skipped_no_message?.count??0)+(t.decisions_skipped_below_threshold?.count??0);return{version:e.version,status:n?"degraded":"healthy",enabled:e.enabled,startedAtISO:e.snapshot.startedAtISO,uptimeMs:e.snapshot.uptimeMs,metrics:{decisionsTaken:t.decisions_taken?.count??0,decisionsStored:t.decisions_stored?.count??0,interventionsDelivered:t.interventions_delivered?.count??0,orchestratorRuns:t.orchestrator_runs?.count??0,orchestratorErrors:n,materializationFailures:t.materialization_failures?.count??0,tier3RemindersSent:t.tier3_reminders_sent?.count??0,tier3SkillsCreated:t.tier3_skills_created?.count??0,lastDecisionISO:t.decisions_taken?.lastOccurrenceISO??null,lastInterventionISO:t.interventions_delivered?.lastOccurrenceISO??null},logFile:nA(e.logFilePath),session:{id:e.sessionID,toolCallsObserved:t.tool_calls_observed?.count??0,violationsDetected:t.protocol_violations_detected?.count??0,interventionsSkipped:o,firstSeenISO:e.snapshot.startedAtISO,lastSeenISO:new Date().toISOString()},graphSync:{lastUpgradeAtISO:null,lastUpgradeResult:"unknown",lastUpgradeTarget:null,lastUpgradeMs:null},graphToolsUsed:{omo_search:0,omo_recall:0,omo_health:0,omo_find:0,omo_impact:0,omo_remember:0,omo_recall_mcp:0,omo_path:0,omo_explain:0,omo_files:0,omo_callers:0,omo_node:0,omo_context:0,omo_affected_cg:0,omo_status:0,omo_unlock:0,omo_mark_dirty:0,omo_sync_if_dirty:0,omo_index:0,omo_visualize:0,omo_serve:0,omo_uninit:0,omo_diagnose:0,omo_merge_graphs:0,omo_save_result:0,omo_extract:0,omo_cluster_only:0,omo_label:0,omo_tree:0,omo_clone:0,omo_add:0,omo_check_update:0,omo_hook_status:0,omo_cli_anything_install:0,omo_cli_anything_list:0,omo_cli_anything_search:0,omo_cli_anything_info:0}}}function z_(e,t,n=Date.now){let o=-1/0;return{write(r){let i=n();if(i-o<t)return;o=i,e(r)}}}Da();import{statSync as j_,existsSync as TG}from"node:fs";import{join as Bg}from"node:path";class L_{client=null;defaultTimeoutMs;toolCache=null;constructor(e={}){this.defaultTimeoutMs=e.defaultTimeoutMs??5000}setClient(e){this.client=e,this.toolCache=null}isReady(){return this.client!==null}async callTool(e,t={},n){let o=Date.now(),r=n??this.defaultTimeoutMs;if(!this.client)return{data:null,timedOut:!1,durationMs:Date.now()-o,error:"MCP client not initialized"};try{let s=(await this.raceWithTimeout(this.client.tool.invoke({toolID:e,input:t}),r,e)).data;return{data:s&&typeof s==="object"&&!Array.isArray(s)?s:null,timedOut:!1,durationMs:Date.now()-o,error:null}}catch(i){return{data:null,timedOut:i instanceof Error&&/timed out/i.test(i.message),durationMs:Date.now()-o,error:i instanceof Error?i.message:String(i)}}}async isAvailable(e){if(!this.client)return!1;if(this.toolCache===null)try{let t=await this.client.tool.list();this.toolCache=new Set((t.data??[]).map((n)=>n.id))}catch{this.toolCache=new Set}return this.toolCache.has(e)}async availableTools(){if(!this.client)return[];if(this.toolCache===null)await this.isAvailable("__bootstrap__");return Array.from(this.toolCache??new Set)}invalidateCache(){this.toolCache=null}raceWithTimeout(e,t,n){return new Promise((o,r)=>{let i=setTimeout(()=>{r(Error(`${n} timed out after ${t}ms`))},t);e.then((s)=>{clearTimeout(i),o(s)},(s)=>{clearTimeout(i),r(s)})})}}var Zg=null;function gs(){if(!Zg)Zg=new L_;return Zg}function oA(e,t,n,o){let r=t&&n;if(e==="codegraph")return t?{kind:"codegraph",cmd:"codegraph",args:[]}:null;if(e==="graphify")return n?{kind:"graphify",cmd:"graphify",args:[]}:null;if(e==="alternate"&&r)return(o??"").trim().toLowerCase().split("").reduce((a,l)=>a+l.charCodeAt(0),0)%2===0?{kind:"codegraph",cmd:"codegraph",args:[]}:{kind:"graphify",cmd:"graphify",args:[]};if(t)return{kind:"codegraph",cmd:"codegraph",args:[]};if(n)return{kind:"graphify",cmd:"graphify",args:[]};return null}function G_(e){let t=e.trim().toLowerCase(),n=2166136261;for(let o=0;o<t.length;o++)n^=t.charCodeAt(o),n=n*16777619>>>0;return n.toString(16)}class Z_{timeoutMs;cacheTtlMs;maxEntriesPerSession;cache=new Map;preferredTool;mcpTimeoutMs;preferredMcpServer;constructor(e={}){this.timeoutMs=e.timeoutMs??5000,this.cacheTtlMs=e.cacheTtlMs??300000,this.maxEntriesPerSession=e.maxEntriesPerSession??10,this.preferredTool=e.preferredTool??"auto",this.mcpTimeoutMs=e.mcpTimeoutMs??5000,this.preferredMcpServer=e.preferredMcpServer??"auto"}setPreferredTool(e){this.preferredTool=e}hasCodegraphDir(e){try{return j_(Bg(e,".codegraph")).isDirectory()}catch{return!1}}hasGraphifyDir(e){try{return j_(Bg(e,"graphify-out")).isDirectory()}catch{return!1}}cacheContext(e,t,n){let o=this.cache.get(e);if(!o)o={entries:new Map},this.cache.set(e,o);let r=G_(t);o.entries.set(r,{query:t,content:n,insertedAtMs:Date.now()});while(o.entries.size>this.maxEntriesPerSession){let i=o.entries.keys().next().value;if(!i)break;o.entries.delete(i)}}getCachedContext(e,t){let n=this.cache.get(e);if(!n)return null;if(t){let r=G_(t),i=n.entries.get(r);if(!i)return null;if(Date.now()-i.insertedAtMs>this.cacheTtlMs)return n.entries.delete(r),null;return i.content}let o=null;for(let r of n.entries.values())if(Date.now()-r.insertedAtMs<=this.cacheTtlMs)o=r.content;return o}clear(){this.cache.clear()}clearSession(e){this.cache.delete(e)}kindForServer(e){if(e==="codegraph")return"codegraph";if(e==="graphify")return"graphify";return null}async isMcpServerAvailable(e,t){try{let n=gs();if(!n.isReady())return!1;return t?await n.isAvailable(t):!0}catch{return!1}}async detectMcpServers(){let[e,t]=await Promise.all([this.isMcpServerAvailable("codegraph","codegraph_search"),this.isMcpServerAvailable("graphify","query_graph")]);return{codegraph:e,graphify:t}}async invokeMCP(e,t,n,o){let r=Date.now();try{let s=await gs().callTool(t,n,o.timeoutMs);if(s.error||s.data===null)return{kind:this.kindForServer(e),query:o.queryLabel,result:null,timedOut:s.timedOut,durationMs:Date.now()-r};let l=s.data.content,c=null;if(Array.isArray(l)&&l.length>0){let u=l[0];if(typeof u.text==="string")c=u.text}return{kind:this.kindForServer(e),query:o.queryLabel,result:c||null,timedOut:!1,durationMs:Date.now()-r}}catch{return{kind:this.kindForServer(e),query:o?.queryLabel??t,result:null,timedOut:!1,durationMs:Date.now()-r}}}async invoke(e,t,n={}){let o=Date.now(),r=n.timeoutMs??this.timeoutMs,i=this.hasCodegraphDir(e),s=this.hasGraphifyDir(e),a=n.preferredTool??this.preferredTool,l=oA(a,i,s,t);if(n.forceSubprocess!==!0&&l){let h=(n.preferredMcpServer??"auto")==="auto"?l.kind==="codegraph"?"codegraph":"graphify":n.preferredMcpServer;if(h!==null&&await this.isMcpServerAvailable(h)){let m=l.kind==="codegraph"?"codegraph_search":"query_graph",y=l.kind==="codegraph"?{query:t,projectPath:e}:{question:t,project_path:e};return{...await this.invokeMCP(h,m,y,{timeoutMs:r,queryLabel:t}),kind:l.kind}}}let c=null,u=null,f=[];if(l)if(c=l.kind,c==="codegraph")u=n.codegraphBin??"codegraph",f=["explore",t,"--project-path",e];else u=n.graphifyBin??"graphify",f=["query",t,"--graph",Bg(e,"graphify-out")];if(!u||!c)return{kind:null,query:t,result:null,timedOut:!1,durationMs:Date.now()-o};try{let h=await this.spawnWithTimeout(u,f,r,e);return{kind:c,query:t,result:h.trim()||null,timedOut:!1,durationMs:Date.now()-o}}catch(h){let m=h instanceof Error&&h.message.includes("timed out");return{kind:c,query:t,result:null,timedOut:m,durationMs:Date.now()-o}}}spawnWithTimeout(e,t,n,o){return Oa(e,t,{cwd:o,timeoutMs:n}).then((r)=>{if(r.timedOut)throw Error(`graph retrieval subprocess timed out after ${n}ms`);if(r.code===null)throw Error(`graph retrieval subprocess failed to spawn: ${e}`);if(r.code!==0)throw Error(`graph retrieval subprocess exited ${r.code}: ${r.stderr.slice(0,200)}`);return r.stdout})}async invokeNode(e,t,n={}){return this.invokeCodegraphSubcommand("node",e,t,n)}async invokeCallers(e,t,n={}){return this.invokeCodegraphSubcommand("callers",e,t,n)}async invokeImpact(e,t,n={}){return this.invokeCodegraphSubcommand("impact",e,t,n)}async invokeFiles(e,t={}){return this.invokeCodegraphSubcommand("files",void 0,e,t)}async invokeContext(e,t,n={}){return this.invokeCodegraphSubcommand("context",e,t,n)}async invokeAffected(e,t,n={}){return this.invokeCodegraphSubcommand("affected",e,t,n)}async invokeStatus(e,t={}){return this.invokeCodegraphSubcommand("status",void 0,e,t)}async invokeUnlock(e,t={}){return this.invokeCodegraphSubcommand("unlock",void 0,e,t)}async invokeMarkDirty(e,t={}){return this.invokeCodegraphSubcommand("mark-dirty",void 0,e,t)}async invokeSyncIfDirty(e,t={}){return this.invokeCodegraphSubcommand("sync-if-dirty",void 0,e,t)}async invokeIndex(e,t={}){return this.invokeCodegraphSubcommand("index",void 0,e,t)}async invokeVisualize(e,t={}){return this.invokeCodegraphSubcommand("visualize",void 0,e,t)}async invokeServe(e,t,n={}){return this.invokeCodegraphSubcommand("serve",String(e),t,n)}async invokeUninit(e,t={}){return this.invokeCodegraphSubcommand("uninit",void 0,e,t)}async invokeCodegraphSubcommand(e,t,n,o){let r=Date.now(),i=o.timeoutMs??this.timeoutMs;if(!this.hasCodegraphDir(n))return{kind:null,query:t===void 0?e:Array.isArray(t)?t.join(","):t,result:null,timedOut:!1,durationMs:Date.now()-r};let s=o.codegraphBin??"codegraph",a=t===void 0?[]:Array.isArray(t)?t:[t],l=[e,...a,"--project-path",n],c=t===void 0?e:Array.isArray(t)?t.join(","):t;try{let u=await this.spawnWithTimeout(s,l,i,n);return{kind:"codegraph",query:c,result:u.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(u){let f=u instanceof Error&&/timed out/i.test(u.message);return{kind:"codegraph",query:c,result:null,timedOut:f,durationMs:Date.now()-r}}}async invokePath(e,t,n,o={}){let r=Date.now(),i=o.timeoutMs??this.timeoutMs;if(!this.hasGraphifyDir(n))return{kind:null,query:`${e} ${t}`,result:null,timedOut:!1,durationMs:Date.now()-r};let s=o.graphifyBin??"graphify",a=["path",e,t];try{let l=await this.spawnWithTimeout(s,a,i,n);return{kind:"graphify",query:`${e} ${t}`,result:l.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(l){return{kind:"graphify",query:`${e} ${t}`,result:null,timedOut:l instanceof Error&&/timed out/i.test(l.message),durationMs:Date.now()-r}}}async invokeExplain(e,t,n={}){return this.invokeGraphifySubcommand("explain",e,t,n)}async invokeGraphifySubcommand(e,t,n,o){let r=Date.now(),i=o.timeoutMs??this.timeoutMs;if(!this.hasGraphifyDir(n))return{kind:null,query:t??e,result:null,timedOut:!1,durationMs:Date.now()-r};let s=o.graphifyBin??"graphify",a=t===void 0?[e]:[e,t];try{let l=await this.spawnWithTimeout(s,a,i,n);return{kind:"graphify",query:t??e,result:l.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(l){return{kind:"graphify",query:t??e,result:null,timedOut:l instanceof Error&&/timed out/i.test(l.message),durationMs:Date.now()-r}}}async invokeDiagnose(e,t={}){return this.invokeGraphifySubcommand("diagnose",void 0,e,t)}async invokeMergeDriver(e,t={}){return this.invokeGraphifySubcommand("merge-driver",void 0,e,t)}async invokeSaveResult(e,t={}){return this.invokeGraphifySubcommand("save-result",void 0,e,t)}async invokeExtract(e,t={}){return this.invokeGraphifySubcommand("extract",void 0,e,t)}async invokeClusterOnly(e,t={}){return this.invokeGraphifySubcommand("cluster-only",void 0,e,t)}async invokeLabel(e,t,n={}){return this.invokeGraphifySubcommand("label",e,t,n)}async invokeTree(e,t={}){return this.invokeGraphifySubcommand("tree",void 0,e,t)}async invokeClone(e,t={}){return this.invokeGraphifySubcommand("clone",void 0,e,t)}async invokeAdd(e,t,n={}){return this.invokeGraphifySubcommand("add",e,t,n)}async invokeCheckUpdate(e,t={}){return this.invokeGraphifySubcommand("check-update",void 0,e,t)}}var qg=null;function pe(){if(!qg)qg=new Z_;return qg}function B_(e){let t=pe();if(e.preferredTool)t.setPreferredTool(e.preferredTool)}var iA=pe();class W_{retrieval;constructor(e=iA){this.retrieval=e}async find(e,t,n=5000){let o=Date.now(),r=await this.retrieval.invokeNode(e,t,{timeoutMs:n});if(r.kind==="codegraph"&&r.result)return sA(e,r.result,o,"codegraph");let i=await this.retrieval.invoke(t,e,{timeoutMs:n});if(i.kind==="graphify"&&i.result)return aA(e,i.result,o,"graphify");return{symbol:e,source:null,callers:[],found:!1,kind:r.kind??i.kind,durationMs:Date.now()-o}}async impact(e,t,n=5000){let o=Date.now(),r=await this.retrieval.invokeImpact(e,t,{timeoutMs:n});if(r.kind==="codegraph"&&r.result)return cA(e,r.result,o,"codegraph",r.timedOut);let i=await this.retrieval.invokeCallers(e,t,{timeoutMs:n});if(i.kind==="codegraph"&&i.result)return{symbol:e,directCallers:Jc(i.result),transitiveCallers:[],testFiles:[],docFiles:[],totalAffectedFiles:new Set(Jc(i.result).map((s)=>s.file)).size,kind:"codegraph",durationMs:Date.now()-o,timedOut:i.timedOut};return{symbol:e,directCallers:[],transitiveCallers:[],testFiles:[],docFiles:[],totalAffectedFiles:0,kind:r.kind??i.kind,durationMs:Date.now()-o,timedOut:r.timedOut||i.timedOut}}async listFiles(e,t=5000){let n=Date.now(),o=await this.retrieval.invokeFiles(e,{timeoutMs:t});if(o.kind==="codegraph"&&o.result){let r=o.result.split(`
193
- `).map((i)=>i.trim()).filter(Boolean);return{files:r,count:r.length,kind:"codegraph",durationMs:Date.now()-n}}return{files:[],count:0,kind:o.kind,durationMs:Date.now()-n}}}function sA(e,t,n,o){let r=Jc(t),i=t.search(/callers?:|## callers?/i),s=i>0?t.slice(0,i).trim():t.trim();return{symbol:e,source:s||null,callers:r,found:r.length>0||s.length>0,kind:o,durationMs:Date.now()-n}}function aA(e,t,n,o){return{symbol:e,source:t.trim()||null,callers:[],found:t.trim().length>0,kind:o,durationMs:Date.now()-n}}function cA(e,t,n,o,r){let i=q_(t,/direct\s*callers?:|## direct/i),s=q_(t,/transitive\s*callers?:|## transitive/i),a=V_(t,/tests?:|## tests?/i),l=V_(t,/docs?:|## docs?/i),c=new Set;for(let u of i)c.add(u.file);for(let u of s)c.add(u.file);for(let u of a)c.add(u);for(let u of l)c.add(u);return{symbol:e,directCallers:i,transitiveCallers:s,testFiles:a,docFiles:l,totalAffectedFiles:c.size,kind:o,durationMs:Date.now()-n,timedOut:r}}function Jc(e){let t=[],n=e.split(`
192
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of this.seen.entries()){let u=c[1];if(e===c[0]){i(c);continue}if(n.external){let h=n.external.registry.get(c[0])?.id;if(e!==c[0]&&h){i(c);continue}}if(this.metadataRegistry.get(c[0])?.id){i(c);continue}if(u.cycle){i(c);continue}if(u.count>1){if(n.reused==="ref"){i(c);continue}}}let s=(c,u)=>{let f=this.seen.get(c),h=f.def??f.schema,m={...h};if(f.ref===null)return;let y=f.ref;if(f.ref=null,y){s(y,u);let k=this.seen.get(y).schema;if(k.$ref&&(u.target==="draft-7"||u.target==="draft-4"||u.target==="openapi-3.0"))h.allOf=h.allOf??[],h.allOf.push(k);else Object.assign(h,k),Object.assign(h,m)}if(!f.isParent)this.override({zodSchema:c,jsonSchema:h,path:f.path??[]})};for(let c of[...this.seen.entries()].reverse())s(c[0],{target:this.target});let a={};if(this.target==="draft-2020-12")a.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")a.$schema="http://json-schema.org/draft-07/schema#";else if(this.target==="draft-4")a.$schema="http://json-schema.org/draft-04/schema#";else if(this.target==="openapi-3.0");else console.warn(`Invalid target: ${this.target}`);if(n.external?.uri){let c=n.external.registry.get(e)?.id;if(!c)throw Error("Schema is missing an `id` property");a.$id=n.external.uri(c)}Object.assign(a,o.def);let l=n.external?.defs??{};for(let c of this.seen.entries()){let u=c[1];if(u.def&&u.defId)l[u.defId]=u.def}if(n.external);else if(Object.keys(l).length>0)if(this.target==="draft-2020-12")a.$defs=l;else a.definitions=l;try{return JSON.parse(JSON.stringify(a))}catch(c){throw Error("Error converting schema to JSON.")}}}function Vh(e,t){if(e instanceof Ji){let o=new Pc(t),r={};for(let a of e._idmap.entries()){let[l,c]=a;o.process(c)}let i={},s={registry:e,uri:t?.uri,defs:r};for(let a of e._idmap.entries()){let[l,c]=a;i[l]=o.emit(c,{...t,external:s})}if(Object.keys(r).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:r}}return{schemas:i}}let n=new Pc(t);return n.process(e),n.emit(e,t)}function nt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;switch(r.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return nt(r.element,n);case"object":{for(let i in r.shape)if(nt(r.shape[i],n))return!0;return!1}case"union":{for(let i of r.options)if(nt(i,n))return!0;return!1}case"intersection":return nt(r.left,n)||nt(r.right,n);case"tuple":{for(let i of r.items)if(nt(i,n))return!0;if(r.rest&&nt(r.rest,n))return!0;return!1}case"record":return nt(r.keyType,n)||nt(r.valueType,n);case"map":return nt(r.keyType,n)||nt(r.valueType,n);case"set":return nt(r.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return nt(r.innerType,n);case"lazy":return nt(r.getter(),n);case"default":return nt(r.innerType,n);case"prefault":return nt(r.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return nt(r.in,n)||nt(r.out,n);case"success":return!1;case"catch":return!1;case"function":return!1;default:}throw Error(`Unknown schema type: ${r.type}`)}var Jb={};var Uc={};An(Uc,{ZodISODate:()=>Rc,ZodISODateTime:()=>Cc,ZodISODuration:()=>Mc,ZodISOTime:()=>Ac,date:()=>Jh,datetime:()=>Wh,duration:()=>Yh,time:()=>Kh});var Cc=x("ZodISODateTime",(e,t)=>{xm.init(e,t),Ce.init(e,t)});function Wh(e){return lh(Cc,e)}var Rc=x("ZodISODate",(e,t)=>{vm.init(e,t),Ce.init(e,t)});function Jh(e){return uh(Rc,e)}var Ac=x("ZodISOTime",(e,t)=>{Sm.init(e,t),Ce.init(e,t)});function Kh(e){return dh(Ac,e)}var Mc=x("ZodISODuration",(e,t)=>{bm.init(e,t),Ce.init(e,t)});function Yh(e){return ph(Mc,e)}var Yb=(e,t)=>{Ui.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(n)=>Fi(e,n)},flatten:{value:(n)=>Ni(e,n)},addIssue:{value:(n)=>{e.issues.push(n),e.message=JSON.stringify(e.issues,To,2)}},addIssues:{value:(n)=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,To,2)}},isEmpty:{get(){return e.issues.length===0}}})},RC=x("ZodError",Yb),Et=x("ZodError",Yb,{Parent:Error});var Xh=$o(Et),Qh=Oo(Et),eg=Do(Et),tg=Po(Et),rg=Ga(Et),ng=Za(Et),og=Ba(Et),ig=qa(Et),sg=Ha(Et),ag=Va(Et),cg=Wa(Et),lg=Ja(Et);var K=x("ZodType",(e,t)=>(Z.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),e.clone=(n,o)=>bt(e,n,o),e.brand=()=>e,e.register=(n,o)=>(n.add(e,o),e),e.parse=(n,o)=>Xh(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>eg(e,n,o),e.parseAsync=async(n,o)=>Qh(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>tg(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>rg(e,n,o),e.decode=(n,o)=>ng(e,n,o),e.encodeAsync=async(n,o)=>og(e,n,o),e.decodeAsync=async(n,o)=>ig(e,n,o),e.safeEncode=(n,o)=>sg(e,n,o),e.safeDecode=(n,o)=>ag(e,n,o),e.safeEncodeAsync=async(n,o)=>cg(e,n,o),e.safeDecodeAsync=async(n,o)=>lg(e,n,o),e.refine=(n,o)=>e.check(N_(n,o)),e.superRefine=(n)=>e.check(F_(n)),e.overwrite=(n)=>e.check(Ur(n)),e.optional=()=>Fc(e),e.nullable=()=>zc(e),e.nullish=()=>Fc(zc(e)),e.nonoptional=(n)=>I_(e,n),e.array=()=>Zc(e),e.or=(n)=>Cg([e,n]),e.and=(n)=>d_(e,n),e.transform=(n)=>Lc(e,Mg(n)),e.default=(n)=>__(e,n),e.prefault=(n)=>w_(e,n),e.catch=(n)=>$_(e,n),e.pipe=(n)=>Lc(e,n),e.readonly=()=>P_(e),e.describe=(n)=>{let o=e.clone();return vr.add(o,{description:n}),o},Object.defineProperty(e,"description",{get(){return vr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return vr.get(e);let o=e.clone();return vr.add(o,n[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),pg=x("_ZodString",(e,t)=>{jn.init(e,t),K.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...o)=>e.check(Qi(...o)),e.includes=(...o)=>e.check(rs(...o)),e.startsWith=(...o)=>e.check(ns(...o)),e.endsWith=(...o)=>e.check(os(...o)),e.min=(...o)=>e.check(un(...o)),e.max=(...o)=>e.check(Ao(...o)),e.length=(...o)=>e.check(Mo(...o)),e.nonempty=(...o)=>e.check(un(1,...o)),e.lowercase=(o)=>e.check(es(o)),e.uppercase=(o)=>e.check(ts(o)),e.trim=()=>e.check(as()),e.normalize=(...o)=>e.check(ss(...o)),e.toLowerCase=()=>e.check(cs()),e.toUpperCase=()=>e.check(ls())}),ds=x("ZodString",(e,t)=>{jn.init(e,t),pg.init(e,t),e.email=(n)=>e.check(dc(mg,n)),e.url=(n)=>e.check(Yi(jc,n)),e.jwt=(n)=>e.check(Dc($g,n)),e.emoji=(n)=>e.check(gc(fg,n)),e.guid=(n)=>e.check(Ki(Nc,n)),e.uuid=(n)=>e.check(pc(Fr,n)),e.uuidv4=(n)=>e.check(mc(Fr,n)),e.uuidv6=(n)=>e.check(fc(Fr,n)),e.uuidv7=(n)=>e.check(hc(Fr,n)),e.nanoid=(n)=>e.check(yc(hg,n)),e.guid=(n)=>e.check(Ki(Nc,n)),e.cuid=(n)=>e.check(xc(gg,n)),e.cuid2=(n)=>e.check(vc(yg,n)),e.ulid=(n)=>e.check(Sc(xg,n)),e.base64=(n)=>e.check(Ec(Ig,n)),e.base64url=(n)=>e.check($c(Tg,n)),e.xid=(n)=>e.check(bc(vg,n)),e.ksuid=(n)=>e.check(_c(Sg,n)),e.ipv4=(n)=>e.check(kc(bg,n)),e.ipv6=(n)=>e.check(wc(_g,n)),e.cidrv4=(n)=>e.check(Ic(kg,n)),e.cidrv6=(n)=>e.check(Tc(wg,n)),e.e164=(n)=>e.check(Oc(Eg,n)),e.datetime=(n)=>e.check(Wh(n)),e.date=(n)=>e.check(Jh(n)),e.time=(n)=>e.check(Kh(n)),e.duration=(n)=>e.check(Yh(n))});function ug(e){return sh(ds,e)}var Ce=x("ZodStringFormat",(e,t)=>{Oe.init(e,t),pg.init(e,t)}),mg=x("ZodEmail",(e,t)=>{lm.init(e,t),Ce.init(e,t)});function MC(e){return dc(mg,e)}var Nc=x("ZodGUID",(e,t)=>{am.init(e,t),Ce.init(e,t)});function UC(e){return Ki(Nc,e)}var Fr=x("ZodUUID",(e,t)=>{cm.init(e,t),Ce.init(e,t)});function NC(e){return pc(Fr,e)}function FC(e){return mc(Fr,e)}function zC(e){return fc(Fr,e)}function LC(e){return hc(Fr,e)}var jc=x("ZodURL",(e,t)=>{um.init(e,t),Ce.init(e,t)});function jC(e){return Yi(jc,e)}function GC(e){return Yi(jc,{protocol:/^https?$/,hostname:kb,...E(e)})}var fg=x("ZodEmoji",(e,t)=>{dm.init(e,t),Ce.init(e,t)});function ZC(e){return gc(fg,e)}var hg=x("ZodNanoID",(e,t)=>{pm.init(e,t),Ce.init(e,t)});function BC(e){return yc(hg,e)}var gg=x("ZodCUID",(e,t)=>{mm.init(e,t),Ce.init(e,t)});function qC(e){return xc(gg,e)}var yg=x("ZodCUID2",(e,t)=>{fm.init(e,t),Ce.init(e,t)});function HC(e){return vc(yg,e)}var xg=x("ZodULID",(e,t)=>{hm.init(e,t),Ce.init(e,t)});function VC(e){return Sc(xg,e)}var vg=x("ZodXID",(e,t)=>{gm.init(e,t),Ce.init(e,t)});function WC(e){return bc(vg,e)}var Sg=x("ZodKSUID",(e,t)=>{ym.init(e,t),Ce.init(e,t)});function JC(e){return _c(Sg,e)}var bg=x("ZodIPv4",(e,t)=>{_m.init(e,t),Ce.init(e,t)});function KC(e){return kc(bg,e)}var _g=x("ZodIPv6",(e,t)=>{km.init(e,t),Ce.init(e,t)});function YC(e){return wc(_g,e)}var kg=x("ZodCIDRv4",(e,t)=>{wm.init(e,t),Ce.init(e,t)});function XC(e){return Ic(kg,e)}var wg=x("ZodCIDRv6",(e,t)=>{Im.init(e,t),Ce.init(e,t)});function QC(e){return Tc(wg,e)}var Ig=x("ZodBase64",(e,t)=>{Em.init(e,t),Ce.init(e,t)});function eR(e){return Ec(Ig,e)}var Tg=x("ZodBase64URL",(e,t)=>{$m.init(e,t),Ce.init(e,t)});function tR(e){return $c(Tg,e)}var Eg=x("ZodE164",(e,t)=>{Om.init(e,t),Ce.init(e,t)});function rR(e){return Oc(Eg,e)}var $g=x("ZodJWT",(e,t)=>{Dm.init(e,t),Ce.init(e,t)});function nR(e){return Dc($g,e)}var ps=x("ZodCustomStringFormat",(e,t)=>{Pm.init(e,t),Ce.init(e,t)});function oR(e,t,n={}){return Uo(ps,e,t,n)}function iR(e){return Uo(ps,"hostname",Ya,e)}function sR(e){return Uo(ps,"hex",Tb,e)}function aR(e,t){let n=t?.enc??"hex",o=`${e}_${n}`,r=Rr[o];if(!r)throw Error(`Unrecognized hash format: ${o}`);return Uo(ps,o,r,t)}var ms=x("ZodNumber",(e,t)=>{sc.init(e,t),K.init(e,t),e.gt=(o,r)=>e.check(Mr(o,r)),e.gte=(o,r)=>e.check(Tt(o,r)),e.min=(o,r)=>e.check(Tt(o,r)),e.lt=(o,r)=>e.check(Ar(o,r)),e.lte=(o,r)=>e.check(Vt(o,r)),e.max=(o,r)=>e.check(Vt(o,r)),e.int=(o)=>e.check(dg(o)),e.safe=(o)=>e.check(dg(o)),e.positive=(o)=>e.check(Mr(0,o)),e.nonnegative=(o)=>e.check(Tt(0,o)),e.negative=(o)=>e.check(Ar(0,o)),e.nonpositive=(o)=>e.check(Vt(0,o)),e.multipleOf=(o,r)=>e.check(Gn(o,r)),e.step=(o,r)=>e.check(Gn(o,r)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),e.isFinite=!0,e.format=n.format??null});function Xb(e){return mh(ms,e)}var Fo=x("ZodNumberFormat",(e,t)=>{Cm.init(e,t),ms.init(e,t)});function dg(e){return hh(Fo,e)}function cR(e){return gh(Fo,e)}function lR(e){return yh(Fo,e)}function uR(e){return xh(Fo,e)}function dR(e){return vh(Fo,e)}var fs=x("ZodBoolean",(e,t)=>{ji.init(e,t),K.init(e,t)});function Qb(e){return Sh(fs,e)}var hs=x("ZodBigInt",(e,t)=>{ac.init(e,t),K.init(e,t),e.gte=(o,r)=>e.check(Tt(o,r)),e.min=(o,r)=>e.check(Tt(o,r)),e.gt=(o,r)=>e.check(Mr(o,r)),e.gte=(o,r)=>e.check(Tt(o,r)),e.min=(o,r)=>e.check(Tt(o,r)),e.lt=(o,r)=>e.check(Ar(o,r)),e.lte=(o,r)=>e.check(Vt(o,r)),e.max=(o,r)=>e.check(Vt(o,r)),e.positive=(o)=>e.check(Mr(BigInt(0),o)),e.negative=(o)=>e.check(Ar(BigInt(0),o)),e.nonpositive=(o)=>e.check(Vt(BigInt(0),o)),e.nonnegative=(o)=>e.check(Tt(BigInt(0),o)),e.multipleOf=(o,r)=>e.check(Gn(o,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function pR(e){return _h(hs,e)}var Og=x("ZodBigIntFormat",(e,t)=>{Rm.init(e,t),hs.init(e,t)});function mR(e){return wh(Og,e)}function fR(e){return Ih(Og,e)}var e_=x("ZodSymbol",(e,t)=>{Am.init(e,t),K.init(e,t)});function hR(e){return Th(e_,e)}var t_=x("ZodUndefined",(e,t)=>{Mm.init(e,t),K.init(e,t)});function gR(e){return Eh(t_,e)}var r_=x("ZodNull",(e,t)=>{Um.init(e,t),K.init(e,t)});function n_(e){return $h(r_,e)}var o_=x("ZodAny",(e,t)=>{Nm.init(e,t),K.init(e,t)});function yR(){return Oh(o_)}var i_=x("ZodUnknown",(e,t)=>{Fm.init(e,t),K.init(e,t)});function No(){return Dh(i_)}var s_=x("ZodNever",(e,t)=>{zm.init(e,t),K.init(e,t)});function Dg(e){return Ph(s_,e)}var a_=x("ZodVoid",(e,t)=>{Lm.init(e,t),K.init(e,t)});function xR(e){return Ch(a_,e)}var Gc=x("ZodDate",(e,t)=>{jm.init(e,t),K.init(e,t),e.min=(o,r)=>e.check(Tt(o,r)),e.max=(o,r)=>e.check(Vt(o,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function vR(e){return Rh(Gc,e)}var c_=x("ZodArray",(e,t)=>{Gm.init(e,t),K.init(e,t),e.element=t.element,e.min=(n,o)=>e.check(un(n,o)),e.nonempty=(n)=>e.check(un(1,n)),e.max=(n,o)=>e.check(Ao(n,o)),e.length=(n,o)=>e.check(Mo(n,o)),e.unwrap=()=>e.element});function Zc(e,t){return jh(c_,e,t)}function SR(e){let t=e._zod.def.shape;return Ag(Object.keys(t))}var Bc=x("ZodObject",(e,t)=>{Zm.init(e,t),K.init(e,t),te(e,"shape",()=>t.shape),e.keyof=()=>Ag(Object.keys(e._zod.def.shape)),e.catchall=(n)=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:No()}),e.loose=()=>e.clone({...e._zod.def,catchall:No()}),e.strict=()=>e.clone({...e._zod.def,catchall:Dg()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(n)=>pb(e,n),e.safeExtend=(n)=>mb(e,n),e.merge=(n)=>fb(e,n),e.pick=(n)=>ub(e,n),e.omit=(n)=>db(e,n),e.partial=(...n)=>hb(Ug,e,n[0]),e.required=(...n)=>gb(Ng,e,n[0])});function bR(e,t){let n={type:"object",get shape(){return nr(this,"shape",e?Na(e):{}),this.shape},...E(t)};return new Bc(n)}function _R(e,t){return new Bc({type:"object",get shape(){return nr(this,"shape",Na(e)),this.shape},catchall:Dg(),...E(t)})}function kR(e,t){return new Bc({type:"object",get shape(){return nr(this,"shape",Na(e)),this.shape},catchall:No(),...E(t)})}var Pg=x("ZodUnion",(e,t)=>{cc.init(e,t),K.init(e,t),e.options=t.options});function Cg(e,t){return new Pg({type:"union",options:e,...E(t)})}var l_=x("ZodDiscriminatedUnion",(e,t)=>{Pg.init(e,t),Bm.init(e,t)});function wR(e,t,n){return new l_({type:"union",options:t,discriminator:e,...E(n)})}var u_=x("ZodIntersection",(e,t)=>{qm.init(e,t),K.init(e,t)});function d_(e,t){return new u_({type:"intersection",left:e,right:t})}var p_=x("ZodTuple",(e,t)=>{lc.init(e,t),K.init(e,t),e.rest=(n)=>e.clone({...e._zod.def,rest:n})});function m_(e,t,n){let o=t instanceof Z,r=o?n:t;return new p_({type:"tuple",items:e,rest:o?t:null,...E(r)})}var Rg=x("ZodRecord",(e,t)=>{Hm.init(e,t),K.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function f_(e,t,n){return new Rg({type:"record",keyType:e,valueType:t,...E(n)})}function IR(e,t,n){let o=bt(e);return o._zod.values=void 0,new Rg({type:"record",keyType:o,valueType:t,...E(n)})}var h_=x("ZodMap",(e,t)=>{Vm.init(e,t),K.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function TR(e,t,n){return new h_({type:"map",keyType:e,valueType:t,...E(n)})}var g_=x("ZodSet",(e,t)=>{Wm.init(e,t),K.init(e,t),e.min=(...n)=>e.check(Zn(...n)),e.nonempty=(n)=>e.check(Zn(1,n)),e.max=(...n)=>e.check(Ro(...n)),e.size=(...n)=>e.check(Xi(...n))});function ER(e,t){return new g_({type:"set",valueType:e,...E(t)})}var us=x("ZodEnum",(e,t)=>{Jm.init(e,t),K.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{let i={};for(let s of o)if(n.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new us({...t,checks:[],...E(r),entries:i})},e.exclude=(o,r)=>{let i={...t.entries};for(let s of o)if(n.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new us({...t,checks:[],...E(r),entries:i})}});function Ag(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new us({type:"enum",entries:n,...E(t)})}function $R(e,t){return new us({type:"enum",entries:e,...E(t)})}var y_=x("ZodLiteral",(e,t)=>{Km.init(e,t),K.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function OR(e,t){return new y_({type:"literal",values:Array.isArray(e)?e:[e],...E(t)})}var x_=x("ZodFile",(e,t)=>{Ym.init(e,t),K.init(e,t),e.min=(n,o)=>e.check(Zn(n,o)),e.max=(n,o)=>e.check(Ro(n,o)),e.mime=(n,o)=>e.check(is(Array.isArray(n)?n:[n],o))});function DR(e){return Gh(x_,e)}var v_=x("ZodTransform",(e,t)=>{Xm.init(e,t),K.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Fn(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(ln(i,n.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(ln(s))}};let r=t.transform(n.value,n);if(r instanceof Promise)return r.then((i)=>(n.value=i,n));return n.value=r,n}});function Mg(e){return new v_({type:"transform",transform:e})}var Ug=x("ZodOptional",(e,t)=>{Qm.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Fc(e){return new Ug({type:"optional",innerType:e})}var S_=x("ZodNullable",(e,t)=>{ef.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function zc(e){return new S_({type:"nullable",innerType:e})}function PR(e){return Fc(zc(e))}var b_=x("ZodDefault",(e,t)=>{tf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function __(e,t){return new b_({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ci(t)}})}var k_=x("ZodPrefault",(e,t)=>{rf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function w_(e,t){return new k_({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ci(t)}})}var Ng=x("ZodNonOptional",(e,t)=>{nf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function I_(e,t){return new Ng({type:"nonoptional",innerType:e,...E(t)})}var T_=x("ZodSuccess",(e,t)=>{of.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function CR(e){return new T_({type:"success",innerType:e})}var E_=x("ZodCatch",(e,t)=>{sf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function $_(e,t){return new E_({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var O_=x("ZodNaN",(e,t)=>{af.init(e,t),K.init(e,t)});function RR(e){return Mh(O_,e)}var Fg=x("ZodPipe",(e,t)=>{cf.init(e,t),K.init(e,t),e.in=t.in,e.out=t.out});function Lc(e,t){return new Fg({type:"pipe",in:e,out:t})}var zg=x("ZodCodec",(e,t)=>{Fg.init(e,t),Gi.init(e,t)});function AR(e,t,n){return new zg({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}var D_=x("ZodReadonly",(e,t)=>{lf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function P_(e){return new D_({type:"readonly",innerType:e})}var C_=x("ZodTemplateLiteral",(e,t)=>{uf.init(e,t),K.init(e,t)});function MR(e,t){return new C_({type:"template_literal",parts:e,...E(t)})}var R_=x("ZodLazy",(e,t)=>{mf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.getter()});function A_(e){return new R_({type:"lazy",getter:e})}var M_=x("ZodPromise",(e,t)=>{pf.init(e,t),K.init(e,t),e.unwrap=()=>e._zod.def.innerType});function UR(e){return new M_({type:"promise",innerType:e})}var U_=x("ZodFunction",(e,t)=>{df.init(e,t),K.init(e,t)});function NR(e){return new U_({type:"function",input:Array.isArray(e?.input)?m_(e?.input):e?.input??Zc(No()),output:e?.output??No()})}var qc=x("ZodCustom",(e,t)=>{ff.init(e,t),K.init(e,t)});function FR(e){let t=new Ae({check:"custom"});return t._zod.check=e,t}function zR(e,t){return Zh(qc,e??(()=>!0),t)}function N_(e,t={}){return Bh(qc,e,t)}function F_(e){return qh(e)}function LR(e,t={error:`Input not instance of ${e.name}`}){let n=new qc({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...E(t)});return n._zod.bag.Class=e,n}var jR=(...e)=>Hh({Codec:zg,Boolean:fs,String:ds},...e);function GR(e){let t=A_(()=>Cg([ug(e),Xb(),Qb(),n_(),Zc(t),f_(ug(),t)]));return t}function ZR(e,t){return Lc(Mg(e),t)}var BR={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function qR(e){et({customError:e})}function HR(){return et().customError}var Lg;(function(e){})(Lg||(Lg={}));var jg={};An(jg,{bigint:()=>KR,boolean:()=>JR,date:()=>YR,number:()=>WR,string:()=>VR});function VR(e){return ah(ds,e)}function WR(e){return fh(ms,e)}function JR(e){return bh(fs,e)}function KR(e){return kh(hs,e)}function YR(e){return Ah(Gc,e)}et(Zi());function H(e){return e}H.schema=Hc;import{readFileSync as uA}from"node:fs";import{dirname as dA,join as pA}from"node:path";import{fileURLToPath as mA}from"node:url";import{renameSync as XR,writeFileSync as QR,readFileSync as vG,existsSync as Gg,statSync as eA}from"node:fs";import{dirname as tA}from"node:path";import{mkdirSync as rA}from"node:fs";function Vc(e,t){let n=tA(t);if(!Gg(n))rA(n,{recursive:!0});let o=`${t}.tmp`;QR(o,JSON.stringify(e,null,2),"utf8"),XR(o,t)}function nA(e){let t=0;if(Gg(e))try{t=eA(e).size}catch{}let n=0;for(let o=1;o<=10;o++)if(Gg(`${e}.${o}`))n=o;else break;return{path:e,sizeBytes:t,rotatedFiles:n}}function Wc(e){let t=e.snapshot.counters,n=t.orchestrator_errors?.count??0,o=(t.decisions_skipped_continue?.count??0)+(t.decisions_skipped_no_decision?.count??0)+(t.decisions_skipped_no_message?.count??0)+(t.decisions_skipped_below_threshold?.count??0);return{version:e.version,status:n?"degraded":"healthy",enabled:e.enabled,startedAtISO:e.snapshot.startedAtISO,uptimeMs:e.snapshot.uptimeMs,metrics:{decisionsTaken:t.decisions_taken?.count??0,decisionsStored:t.decisions_stored?.count??0,interventionsDelivered:t.interventions_delivered?.count??0,orchestratorRuns:t.orchestrator_runs?.count??0,orchestratorErrors:n,materializationFailures:t.materialization_failures?.count??0,tier3RemindersSent:t.tier3_reminders_sent?.count??0,tier3SkillsCreated:t.tier3_skills_created?.count??0,lastDecisionISO:t.decisions_taken?.lastOccurrenceISO??null,lastInterventionISO:t.interventions_delivered?.lastOccurrenceISO??null},logFile:nA(e.logFilePath),session:{id:e.sessionID,toolCallsObserved:t.tool_calls_observed?.count??0,violationsDetected:t.protocol_violations_detected?.count??0,interventionsSkipped:o,firstSeenISO:e.snapshot.startedAtISO,lastSeenISO:new Date().toISOString()},graphSync:{lastUpgradeAtISO:null,lastUpgradeResult:"unknown",lastUpgradeTarget:null,lastUpgradeMs:null},graphToolsUsed:{omo_search:0,omo_recall:0,omo_health:0,omo_find:0,omo_impact:0,omo_remember:0,omo_recall_mcp:0,omo_path:0,omo_explain:0,omo_files:0,omo_callers:0,omo_node:0,omo_context:0,omo_affected_cg:0,omo_status:0,omo_unlock:0,omo_mark_dirty:0,omo_sync_if_dirty:0,omo_index:0,omo_visualize:0,omo_serve:0,omo_uninit:0,omo_diagnose:0,omo_merge_graphs:0,omo_save_result:0,omo_extract:0,omo_cluster_only:0,omo_label:0,omo_tree:0,omo_clone:0,omo_add:0,omo_check_update:0,omo_hook_status:0,omo_cli_anything_install:0,omo_cli_anything_list:0,omo_cli_anything_search:0,omo_cli_anything_info:0}}}function z_(e,t,n=Date.now){let o=-1/0;return{write(r){let i=n();if(i-o<t)return;o=i,e(r)}}}Da();import{statSync as j_,existsSync as TG}from"node:fs";import{join as Bg}from"node:path";class L_{client=null;defaultTimeoutMs;toolCache=null;constructor(e={}){this.defaultTimeoutMs=e.defaultTimeoutMs??5000}setClient(e){this.client=e,this.toolCache=null}isReady(){return this.client!==null}async callTool(e,t={},n){let o=Date.now(),r=n??this.defaultTimeoutMs;if(!this.client)return{data:null,timedOut:!1,durationMs:Date.now()-o,error:"MCP client not initialized"};try{let s=(await this.raceWithTimeout(this.client.tool.invoke({toolID:e,input:t}),r,e)).data;return{data:s&&typeof s==="object"&&!Array.isArray(s)?s:null,timedOut:!1,durationMs:Date.now()-o,error:null}}catch(i){return{data:null,timedOut:i instanceof Error&&/timed out/i.test(i.message),durationMs:Date.now()-o,error:i instanceof Error?i.message:String(i)}}}async isAvailable(e){if(!this.client)return!1;if(this.toolCache===null)try{let t=await this.client.tool.list();this.toolCache=new Set((t.data??[]).map((n)=>n.id))}catch{this.toolCache=new Set}return this.toolCache.has(e)}async availableTools(){if(!this.client)return[];if(this.toolCache===null)await this.isAvailable("__bootstrap__");return Array.from(this.toolCache??new Set)}invalidateCache(){this.toolCache=null}raceWithTimeout(e,t,n){return new Promise((o,r)=>{let i=setTimeout(()=>{r(Error(`${n} timed out after ${t}ms`))},t);e.then((s)=>{clearTimeout(i),o(s)},(s)=>{clearTimeout(i),r(s)})})}}var Zg=null;function gs(){if(!Zg)Zg=new L_;return Zg}function oA(e,t,n,o){let r=t&&n;if(e==="codegraph")return t?{kind:"codegraph",cmd:"codegraph",args:[]}:null;if(e==="graphify")return n?{kind:"graphify",cmd:"graphify",args:[]}:null;if(e==="alternate"&&r)return(o??"").trim().toLowerCase().split("").reduce((a,l)=>a+l.charCodeAt(0),0)%2===0?{kind:"codegraph",cmd:"codegraph",args:[]}:{kind:"graphify",cmd:"graphify",args:[]};if(t)return{kind:"codegraph",cmd:"codegraph",args:[]};if(n)return{kind:"graphify",cmd:"graphify",args:[]};return null}function G_(e){let t=e.trim().toLowerCase(),n=2166136261;for(let o=0;o<t.length;o++)n^=t.charCodeAt(o),n=n*16777619>>>0;return n.toString(16)}class Z_{timeoutMs;cacheTtlMs;maxEntriesPerSession;cache=new Map;preferredTool;mcpTimeoutMs;preferredMcpServer;constructor(e={}){this.timeoutMs=e.timeoutMs??5000,this.cacheTtlMs=e.cacheTtlMs??300000,this.maxEntriesPerSession=e.maxEntriesPerSession??10,this.preferredTool=e.preferredTool??"auto",this.mcpTimeoutMs=e.mcpTimeoutMs??5000,this.preferredMcpServer=e.preferredMcpServer??"auto"}setPreferredTool(e){this.preferredTool=e}hasCodegraphDir(e){try{return j_(Bg(e,".codegraph")).isDirectory()}catch{return!1}}hasGraphifyDir(e){try{return j_(Bg(e,"graphify-out")).isDirectory()}catch{return!1}}cacheContext(e,t,n){let o=this.cache.get(e);if(!o)o={entries:new Map},this.cache.set(e,o);let r=G_(t);o.entries.set(r,{query:t,content:n,insertedAtMs:Date.now()});while(o.entries.size>this.maxEntriesPerSession){let i=o.entries.keys().next().value;if(!i)break;o.entries.delete(i)}}getCachedContext(e,t){let n=this.cache.get(e);if(!n)return null;if(t){let r=G_(t),i=n.entries.get(r);if(!i)return null;if(Date.now()-i.insertedAtMs>this.cacheTtlMs)return n.entries.delete(r),null;return i.content}let o=null;for(let r of n.entries.values())if(Date.now()-r.insertedAtMs<=this.cacheTtlMs)o=r.content;return o}clear(){this.cache.clear()}clearSession(e){this.cache.delete(e)}kindForServer(e){if(e==="codegraph")return"codegraph";if(e==="graphify")return"graphify";return null}async isMcpServerAvailable(e,t){try{let n=gs();if(!n.isReady())return!1;return t?await n.isAvailable(t):!0}catch{return!1}}async detectMcpServers(){let[e,t]=await Promise.all([this.isMcpServerAvailable("codegraph","codegraph_search"),this.isMcpServerAvailable("graphify","query_graph")]);return{codegraph:e,graphify:t}}async invokeMCP(e,t,n,o){let r=Date.now();try{let s=await gs().callTool(t,n,o.timeoutMs);if(s.error||s.data===null)return{kind:this.kindForServer(e),query:o.queryLabel,result:null,timedOut:s.timedOut,durationMs:Date.now()-r};let l=s.data.content,c=null;if(Array.isArray(l)&&l.length>0){let u=l[0];if(typeof u.text==="string")c=u.text}return{kind:this.kindForServer(e),query:o.queryLabel,result:c||null,timedOut:!1,durationMs:Date.now()-r}}catch{return{kind:this.kindForServer(e),query:o?.queryLabel??t,result:null,timedOut:!1,durationMs:Date.now()-r}}}async invoke(e,t,n={}){let o=Date.now(),r=n.timeoutMs??this.timeoutMs,i=this.hasCodegraphDir(e),s=this.hasGraphifyDir(e),a=n.preferredTool??this.preferredTool,l=oA(a,i,s,t);if(n.forceSubprocess!==!0&&l){let h=(n.preferredMcpServer??"auto")==="auto"?l.kind==="codegraph"?"codegraph":"graphify":n.preferredMcpServer;if(h!==null&&await this.isMcpServerAvailable(h)){let m=l.kind==="codegraph"?"codegraph_search":"query_graph",y=l.kind==="codegraph"?{query:t,projectPath:e}:{question:t,project_path:e};return{...await this.invokeMCP(h,m,y,{timeoutMs:r,queryLabel:t}),kind:l.kind}}}let c=null,u=null,f=[];if(l)if(c=l.kind,c==="codegraph")u=n.codegraphBin??"codegraph",f=["explore",t,"--project-path",e];else u=n.graphifyBin??"graphify",f=["query",t,"--graph",Bg(e,"graphify-out")];if(!u||!c)return{kind:null,query:t,result:null,timedOut:!1,durationMs:Date.now()-o};try{let h=await this.spawnWithTimeout(u,f,r,e);return{kind:c,query:t,result:h.trim()||null,timedOut:!1,durationMs:Date.now()-o}}catch(h){let m=h instanceof Error&&h.message.includes("timed out");return{kind:c,query:t,result:null,timedOut:m,durationMs:Date.now()-o}}}spawnWithTimeout(e,t,n,o){return Oa(e,t,{cwd:o,timeoutMs:n}).then((r)=>{if(r.timedOut)throw Error(`graph retrieval subprocess timed out after ${n}ms`);if(r.code===null)throw Error(`graph retrieval subprocess failed to spawn: ${e}`);if(r.code!==0)throw Error(`graph retrieval subprocess exited ${r.code}: ${r.stderr.slice(0,200)}`);return r.stdout})}async invokeNode(e,t,n={}){return this.invokeCodegraphSubcommand("node",e,t,n)}async invokeCallers(e,t,n={}){return this.invokeCodegraphSubcommand("callers",e,t,n)}async invokeImpact(e,t,n={}){return this.invokeCodegraphSubcommand("impact",e,t,n)}async invokeFiles(e,t={}){return this.invokeCodegraphSubcommand("files",void 0,e,t)}async invokeContext(e,t,n={}){return this.invokeCodegraphSubcommand("context",e,t,n)}async invokeAffected(e,t,n={}){return this.invokeCodegraphSubcommand("affected",e,t,n)}async invokeStatus(e,t={}){return this.invokeCodegraphSubcommand("status",void 0,e,t)}async invokeUnlock(e,t={}){return this.invokeCodegraphSubcommand("unlock",void 0,e,t)}async invokeMarkDirty(e,t={}){return this.invokeCodegraphSubcommand("mark-dirty",void 0,e,t)}async invokeSyncIfDirty(e,t={}){return this.invokeCodegraphSubcommand("sync-if-dirty",void 0,e,t)}async invokeIndex(e,t={}){return this.invokeCodegraphSubcommand("index",void 0,e,t)}async invokeVisualize(e,t={}){return this.invokeCodegraphSubcommand("visualize",void 0,e,t)}async invokeServe(e,t,n={}){return this.invokeCodegraphSubcommand("serve",String(e),t,n)}async invokeUninit(e,t={}){return this.invokeCodegraphSubcommand("uninit",void 0,e,t)}async invokeCodegraphSubcommand(e,t,n,o){let r=Date.now(),i=o.timeoutMs??this.timeoutMs;if(!this.hasCodegraphDir(n))return{kind:null,query:t===void 0?e:Array.isArray(t)?t.join(","):t,result:null,timedOut:!1,durationMs:Date.now()-r};let s=o.codegraphBin??"codegraph",a=t===void 0?[]:Array.isArray(t)?t:[t],l=[e,...a,"--project-path",n],c=t===void 0?e:Array.isArray(t)?t.join(","):t;try{let u=await this.spawnWithTimeout(s,l,i,n);return{kind:"codegraph",query:c,result:u.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(u){let f=u instanceof Error&&/timed out/i.test(u.message);return{kind:"codegraph",query:c,result:null,timedOut:f,durationMs:Date.now()-r}}}async invokePath(e,t,n,o={}){let r=Date.now(),i=o.timeoutMs??this.timeoutMs;if(!this.hasGraphifyDir(n))return{kind:null,query:`${e} ${t}`,result:null,timedOut:!1,durationMs:Date.now()-r};let s=o.graphifyBin??"graphify",a=["path",e,t];try{let l=await this.spawnWithTimeout(s,a,i,n);return{kind:"graphify",query:`${e} ${t}`,result:l.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(l){return{kind:"graphify",query:`${e} ${t}`,result:null,timedOut:l instanceof Error&&/timed out/i.test(l.message),durationMs:Date.now()-r}}}async invokeExplain(e,t,n={}){return this.invokeGraphifySubcommand("explain",e,t,n)}async invokeGraphifySubcommand(e,t,n,o){let r=Date.now(),i=o.timeoutMs??this.timeoutMs;if(!this.hasGraphifyDir(n))return{kind:null,query:t??e,result:null,timedOut:!1,durationMs:Date.now()-r};let s=o.graphifyBin??"graphify",a=t===void 0?[e]:[e,t];try{let l=await this.spawnWithTimeout(s,a,i,n);return{kind:"graphify",query:t??e,result:l.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(l){return{kind:"graphify",query:t??e,result:null,timedOut:l instanceof Error&&/timed out/i.test(l.message),durationMs:Date.now()-r}}}async invokeDiagnose(e,t={}){return this.invokeGraphifySubcommand("diagnose",void 0,e,t)}async invokeMergeDriver(e,t={}){return this.invokeGraphifySubcommand("merge-driver",void 0,e,t)}async invokeSaveResult(e,t={}){return this.invokeGraphifySubcommand("save-result",void 0,e,t)}async invokeExtract(e,t={}){return this.invokeGraphifySubcommand("extract",void 0,e,t)}async invokeClusterOnly(e,t={}){return this.invokeGraphifySubcommand("cluster-only",void 0,e,t)}async invokeLabel(e,t,n={}){return this.invokeGraphifySubcommand("label",e,t,n)}async invokeTree(e,t={}){return this.invokeGraphifySubcommand("tree",void 0,e,t)}async invokeClone(e,t={}){return this.invokeGraphifySubcommand("clone",void 0,e,t)}async invokeAdd(e,t,n={}){return this.invokeGraphifySubcommand("add",e,t,n)}async invokeCheckUpdate(e,t={}){return this.invokeGraphifySubcommand("check-update",void 0,e,t)}}var qg=null;function pe(){if(!qg)qg=new Z_;return qg}function B_(e){let t=pe();if(e.preferredTool)t.setPreferredTool(e.preferredTool)}var iA=pe();class V_{retrieval;constructor(e=iA){this.retrieval=e}async find(e,t,n=5000){let o=Date.now(),r=await this.retrieval.invokeNode(e,t,{timeoutMs:n});if(r.kind==="codegraph"&&r.result)return sA(e,r.result,o,"codegraph");let i=await this.retrieval.invoke(t,e,{timeoutMs:n});if(i.kind==="graphify"&&i.result)return aA(e,i.result,o,"graphify");return{symbol:e,source:null,callers:[],found:!1,kind:r.kind??i.kind,durationMs:Date.now()-o}}async impact(e,t,n=5000){let o=Date.now(),r=await this.retrieval.invokeImpact(e,t,{timeoutMs:n});if(r.kind==="codegraph"&&r.result)return cA(e,r.result,o,"codegraph",r.timedOut);let i=await this.retrieval.invokeCallers(e,t,{timeoutMs:n});if(i.kind==="codegraph"&&i.result)return{symbol:e,directCallers:Jc(i.result),transitiveCallers:[],testFiles:[],docFiles:[],totalAffectedFiles:new Set(Jc(i.result).map((s)=>s.file)).size,kind:"codegraph",durationMs:Date.now()-o,timedOut:i.timedOut};return{symbol:e,directCallers:[],transitiveCallers:[],testFiles:[],docFiles:[],totalAffectedFiles:0,kind:r.kind??i.kind,durationMs:Date.now()-o,timedOut:r.timedOut||i.timedOut}}async listFiles(e,t=5000){let n=Date.now(),o=await this.retrieval.invokeFiles(e,{timeoutMs:t});if(o.kind==="codegraph"&&o.result){let r=o.result.split(`
193
+ `).map((i)=>i.trim()).filter(Boolean);return{files:r,count:r.length,kind:"codegraph",durationMs:Date.now()-n}}return{files:[],count:0,kind:o.kind,durationMs:Date.now()-n}}}function sA(e,t,n,o){let r=Jc(t),i=t.search(/callers?:|## callers?/i),s=i>0?t.slice(0,i).trim():t.trim();return{symbol:e,source:s||null,callers:r,found:r.length>0||s.length>0,kind:o,durationMs:Date.now()-n}}function aA(e,t,n,o){return{symbol:e,source:t.trim()||null,callers:[],found:t.trim().length>0,kind:o,durationMs:Date.now()-n}}function cA(e,t,n,o,r){let i=q_(t,/direct\s*callers?:|## direct/i),s=q_(t,/transitive\s*callers?:|## transitive/i),a=H_(t,/tests?:|## tests?/i),l=H_(t,/docs?:|## docs?/i),c=new Set;for(let u of i)c.add(u.file);for(let u of s)c.add(u.file);for(let u of a)c.add(u);for(let u of l)c.add(u);return{symbol:e,directCallers:i,transitiveCallers:s,testFiles:a,docFiles:l,totalAffectedFiles:c.size,kind:o,durationMs:Date.now()-n,timedOut:r}}function Jc(e){let t=[],n=e.split(`
194
194
  `);for(let o of n){let r=o.match(/^\s*[-*]?\s*([^\s:]+\.[a-z]+):(\d+)(?:[:\s—–-]+(.+))?/i);if(r){let i=r[1]??"",s=r[2]?parseInt(r[2],10):0,a=(r[3]??"").trim();if(i&&s>0)t.push({file:i,line:s,context:a})}}return t}function q_(e,t){let n=e.split(`
195
195
  `),o=!1,r=[];for(let i of n){if(t.test(i)){o=!0;continue}if(o){if(/^#\s/.test(i)&&!t.test(i))break;if(i.trim()===""&&r.length>0)break;r.push(i)}}return Jc(r.join(`
196
- `))}function V_(e,t){let n=e.split(`
197
- `),o=!1,r=[];for(let i of n){if(t.test(i)){o=!0;continue}if(o){if(/^#\s/.test(i)&&!t.test(i))break;if(i.trim()===""&&r.length>0)break;let s=i.trim().replace(/^[-*]\s*/,"");if(s.match(/[^\s:]+\.[a-z]+/i))r.push(s)}}return r}var Vg=null;function Wg(){if(!Vg)Vg=new W_;return Vg}xs();X_();var we=V.schema,Jg="0.0.0";try{Jg=(()=>{try{let e=dA(mA(import.meta.url)),t=uA(pA(e,"..","package.json"),"utf-8"),n=JSON.parse(t);return typeof n.version==="string"?n.version:"0.0.0"}catch{return"0.0.0"}})()}catch{}async function dn(e,t,n,o){try{let r=pe();if(!await r.isMcpServerAvailable(e,t))return null;return(await r.invokeMCP(e,t,n,{timeoutMs:o,queryLabel:t})).result}catch{return null}}async function fA(e,t,n=1500){if(!Kg)return"pending";return await Kg.awaitDelivery({sessionID:e,mcpTool:t,timeoutMs:n})}var Kg=null;function Q_(e){Kg=e}async function ek(e,t){return await fA(e,t)}function Qc(e){return V({description:"Semantic code search over the project graph. ROUTING (v0.25.0): with both indexes present, codegraph handles code-structure queries (symbols, call sites, module layout) and graphify "+"handles concept/architecture queries — the plugin alternates deterministically per query, "+"or you can force one via config graphRetrieval.preferredTool. USE THIS for architecture questions, finding call sites, understanding module structure. "+"Prefer over grep/glob for high-level understanding — grep is still better for literal text matches.",args:{query:we.string().min(3).describe("Natural language query describing what you're looking for"),maxResults:we.number().int().min(1).max(20).optional().describe("Max results to return (default 10)")},async execute(t,n){let o=Date.now(),r=await e.graphRetrieval.invoke(e.cwd,t.query,{timeoutMs:8000}),i={tool:"omo_search",query:t.query,kind:r.kind,timedOut:r.timedOut,durationMs:r.durationMs,resultSize:r.result?.length??0,sessionID:n.sessionID};if(r.timedOut)return{title:"omo_search: timeout",output:`Graph search timed out after ${r.durationMs}ms. No graph tools available at ${e.cwd}, or the query is too expensive. Fall back to grep/glob for direct text matching.`,metadata:i};if(!r.result)return{title:"omo_search: no graph backend",output:`No codegraph or graphify directory found at ${e.cwd}. Run \`npx codegraph init\` or \`graphify . --no-viz\` to build the index, then call omo_search again. Until then, use grep/glob for direct text matching.`,metadata:i};return{title:`omo_search: ${r.kind}`,output:r.result,metadata:i}}})}function el(e){return V({description:"Search lessons learned in past sessions of this project. Returns ranked lessons (highest confidence first) matching the query. "+"Use before making non-trivial decisions — the answer may already be in memory.",args:{query:we.string().min(2).describe("What kind of lesson you're looking for"),limit:we.number().int().min(1).max(20).optional().describe("Max lessons to return (default 5)")},async execute(t,n){let o=Date.now(),i=(await e.sqlite.smartSearch({query:t.query,limit:t.limit??5})).lessons;if(i.length===0)return{title:"omo_recall: no matches",output:`No past lessons found matching "${t.query}". This is the first time the agent is encountering this question.`,metadata:{tool:"omo_recall",query:t.query,durationMs:Date.now()-o,lessonsFound:0}};let s=i.map((a,l)=>`${l+1}. [${a.id}] confidence=${a.confidence.toFixed(2)}
196
+ `))}function H_(e,t){let n=e.split(`
197
+ `),o=!1,r=[];for(let i of n){if(t.test(i)){o=!0;continue}if(o){if(/^#\s/.test(i)&&!t.test(i))break;if(i.trim()===""&&r.length>0)break;let s=i.trim().replace(/^[-*]\s*/,"");if(s.match(/[^\s:]+\.[a-z]+/i))r.push(s)}}return r}var Hg=null;function Vg(){if(!Hg)Hg=new V_;return Hg}xs();X_();var we=H.schema,Jg="0.0.0";try{Jg=(()=>{try{let e=dA(mA(import.meta.url)),t=uA(pA(e,"..","package.json"),"utf-8"),n=JSON.parse(t);return typeof n.version==="string"?n.version:"0.0.0"}catch{return"0.0.0"}})()}catch{}async function dn(e,t,n,o){try{let r=pe();if(!await r.isMcpServerAvailable(e,t))return null;return(await r.invokeMCP(e,t,n,{timeoutMs:o,queryLabel:t})).result}catch{return null}}async function fA(e,t,n=1500){if(!Kg)return"pending";return await Kg.awaitDelivery({sessionID:e,mcpTool:t,timeoutMs:n})}var Kg=null;function Q_(e){Kg=e}async function ek(e,t){return await fA(e,t)}function Qc(e){return H({description:"Semantic code search over the project graph. ROUTING (v0.25.0): with both indexes present, codegraph handles code-structure queries (symbols, call sites, module layout) and graphify "+"handles concept/architecture queries — the plugin alternates deterministically per query, "+"or you can force one via config graphRetrieval.preferredTool. USE THIS for architecture questions, finding call sites, understanding module structure. "+"Prefer over grep/glob for high-level understanding — grep is still better for literal text matches.",args:{query:we.string().min(3).describe("Natural language query describing what you're looking for"),maxResults:we.number().int().min(1).max(20).optional().describe("Max results to return (default 10)")},async execute(t,n){let o=Date.now(),r=await e.graphRetrieval.invoke(e.cwd,t.query,{timeoutMs:8000}),i={tool:"omo_search",query:t.query,kind:r.kind,timedOut:r.timedOut,durationMs:r.durationMs,resultSize:r.result?.length??0,sessionID:n.sessionID};if(r.timedOut)return{title:"omo_search: timeout",output:`Graph search timed out after ${r.durationMs}ms. No graph tools available at ${e.cwd}, or the query is too expensive. Fall back to grep/glob for direct text matching.`,metadata:i};if(!r.result)return{title:"omo_search: no graph backend",output:`No codegraph or graphify directory found at ${e.cwd}. Run \`npx codegraph init\` or \`graphify . --no-viz\` to build the index, then call omo_search again. Until then, use grep/glob for direct text matching.`,metadata:i};return{title:`omo_search: ${r.kind}`,output:r.result,metadata:i}}})}function el(e){return H({description:"Search lessons learned in past sessions of this project. Returns ranked lessons (highest confidence first) matching the query. "+"Use before making non-trivial decisions — the answer may already be in memory.",args:{query:we.string().min(2).describe("What kind of lesson you're looking for"),limit:we.number().int().min(1).max(20).optional().describe("Max lessons to return (default 5)")},async execute(t,n){let o=Date.now(),i=(await e.sqlite.smartSearch({query:t.query,limit:t.limit??5})).lessons;if(i.length===0)return{title:"omo_recall: no matches",output:`No past lessons found matching "${t.query}". This is the first time the agent is encountering this question.`,metadata:{tool:"omo_recall",query:t.query,durationMs:Date.now()-o,lessonsFound:0}};let s=i.map((a,l)=>`${l+1}. [${a.id}] confidence=${a.confidence.toFixed(2)}
198
198
  ${a.title}
199
199
  ${a.content.slice(0,500)}${a.content.length>500?"...":""}`).join(`
200
200
 
201
201
  `);return{title:`omo_recall: ${i.length} lesson${i.length===1?"":"s"}`,output:`Found ${i.length} past lesson${i.length===1?"":"s"} matching "${t.query}":
202
202
 
203
- ${s}`,metadata:{tool:"omo_recall",query:t.query,durationMs:Date.now()-o,lessonsFound:i.length}}}})}function tl(e){return V({description:"Show omo-meta-governor plugin status: enabled, metrics, recent decisions, and current config. Use when the user asks 'is the plugin working?' or to verify that lessons are being persisted.",args:{},async execute(t,n){let o=e.metrics.getMetrics(),r=Hc({version:Jg,enabled:!0,sessionID:n.sessionID??"__unknown__",snapshot:o,logFilePath:e.logFilePath});try{Wc(r,e.healthFilePath)}catch{}return{title:"omo_health",output:`# omo-meta-governor v${Jg} — Health Report
203
+ ${s}`,metadata:{tool:"omo_recall",query:t.query,durationMs:Date.now()-o,lessonsFound:i.length}}}})}function tl(e){return H({description:"Show omo-meta-governor plugin status: enabled, metrics, recent decisions, and current config. Use when the user asks 'is the plugin working?' or to verify that lessons are being persisted.",args:{},async execute(t,n){let o=e.metrics.getMetrics(),r=Wc({version:Jg,enabled:!0,sessionID:n.sessionID??"__unknown__",snapshot:o,logFilePath:e.logFilePath});try{Vc(r,e.healthFilePath)}catch{}return{title:"omo_health",output:`# omo-meta-governor v${Jg} — Health Report
204
204
 
205
205
  `+`**Status**: ${r.status}
206
206
  **Enabled**: ${r.enabled}
@@ -222,7 +222,7 @@ ${s}`,metadata:{tool:"omo_recall",query:t.query,durationMs:Date.now()-o,lessonsF
222
222
  - Health JSON: \`${e.healthFilePath}\`
223
223
  - Log file: \`${e.logFilePath}\`
224
224
 
225
- The health JSON file is updated on every invocation. Run \`cat ${e.healthFilePath}\` to see the full snapshot.`,metadata:{tool:"omo_health",sessionID:n.sessionID,uptimeMs:r.uptimeMs}}}})}function rl(e){return V({description:"Find the exact source location and direct callers of a symbol (function, class, method, variable). "+"CODEGRAPH TOOL (v0.25.0): symbol precision lives in codegraph — use this for exact definitions "+"and call sites. USE THIS when you know the exact symbol name and need its source code. Example: omo_find with symbol='UserService.create' returns the file:line of the definition and every call site.",args:{symbol:we.string().min(1).describe("The exact symbol name to find (e.g. 'UserService.create', 'validateToken')")},async execute(t,n){let o=Date.now(),i=await(e.codeGraph??Wg()).find(t.symbol,e.cwd,5000),s={tool:"omo_find",symbol:t.symbol,kind:i.kind,found:i.found,callerCount:i.callers.length,durationMs:i.durationMs,sessionID:n.sessionID};if(!i.found)return{title:`omo_find: ${t.symbol} not found`,output:`Symbol "${t.symbol}" was not found in the codebase graph. If .codegraph/ doesn't exist, run \`npx codegraph init\` first. Otherwise, try omo_search with a natural-language description.`,metadata:s};let a=i.source?`
225
+ The health JSON file is updated on every invocation. Run \`cat ${e.healthFilePath}\` to see the full snapshot.`,metadata:{tool:"omo_health",sessionID:n.sessionID,uptimeMs:r.uptimeMs}}}})}function rl(e){return H({description:"Find the exact source location and direct callers of a symbol (function, class, method, variable). "+"CODEGRAPH TOOL (v0.25.0): symbol precision lives in codegraph — use this for exact definitions "+"and call sites. USE THIS when you know the exact symbol name and need its source code. Example: omo_find with symbol='UserService.create' returns the file:line of the definition and every call site.",args:{symbol:we.string().min(1).describe("The exact symbol name to find (e.g. 'UserService.create', 'validateToken')")},async execute(t,n){let o=Date.now(),i=await(e.codeGraph??Vg()).find(t.symbol,e.cwd,5000),s={tool:"omo_find",symbol:t.symbol,kind:i.kind,found:i.found,callerCount:i.callers.length,durationMs:i.durationMs,sessionID:n.sessionID};if(!i.found)return{title:`omo_find: ${t.symbol} not found`,output:`Symbol "${t.symbol}" was not found in the codebase graph. If .codegraph/ doesn't exist, run \`npx codegraph init\` first. Otherwise, try omo_search with a natural-language description.`,metadata:s};let a=i.source?`
226
226
  ## Definition
227
227
 
228
228
  \`\`\`
@@ -237,20 +237,20 @@ ${i.source.slice(0,2000)}
237
237
  ## Direct Callers
238
238
 
239
239
  None found in the indexed graph.`;return{title:`omo_find: ${t.symbol}${i.callers.length>0?` (${i.callers.length} callers)`:""}`,output:`Found definition for "${t.symbol}" (via ${i.kind??"fallback"}).
240
- `+a+l,metadata:s}}})}function nl(e){return V({description:"Analyze the impact of changing a symbol. Lists direct callers, transitive callers, and affected test/doc files. CODEGRAPH TOOL (v0.25.0): call-graph analysis is codegraph-only. "+"ALWAYS run this BEFORE modifying a function or class — "+"knows what will break. Example: omo_impact with symbol='validateToken' lists every file that calls validateToken and every test that exercises it.",args:{symbol:we.string().min(1).describe("The symbol to analyze (function, class, method)")},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_impact",{symbol:t.symbol,depth:2,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_impact: ${t.symbol}`,output:r,metadata:{tool:"omo_impact",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.codeGraph??Wg()).impact(t.symbol,e.cwd,5000),a={tool:"omo_impact",symbol:t.symbol,kind:s.kind,directCallers:s.directCallers.length,transitiveCallers:s.transitiveCallers.length,testFiles:s.testFiles.length,docFiles:s.docFiles.length,totalAffectedFiles:s.totalAffectedFiles,timedOut:s.timedOut,durationMs:s.durationMs,sessionID:n.sessionID};if(s.totalAffectedFiles===0&&s.directCallers.length===0)return{title:`omo_impact: no callers found for ${t.symbol}`,output:`No call sites found for "${t.symbol}". Either the symbol is unused, or the codegraph index is stale. Run \`npx codegraph sync\` to refresh the index and try again.`,metadata:a};let l=[];if(l.push(`Impact analysis for "${t.symbol}" (via ${s.kind??"fallback"}).
240
+ `+a+l,metadata:s}}})}function nl(e){return H({description:"Analyze the impact of changing a symbol. Lists direct callers, transitive callers, and affected test/doc files. CODEGRAPH TOOL (v0.25.0): call-graph analysis is codegraph-only. "+"ALWAYS run this BEFORE modifying a function or class — "+"knows what will break. Example: omo_impact with symbol='validateToken' lists every file that calls validateToken and every test that exercises it.",args:{symbol:we.string().min(1).describe("The symbol to analyze (function, class, method)")},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_impact",{symbol:t.symbol,depth:2,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_impact: ${t.symbol}`,output:r,metadata:{tool:"omo_impact",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.codeGraph??Vg()).impact(t.symbol,e.cwd,5000),a={tool:"omo_impact",symbol:t.symbol,kind:s.kind,directCallers:s.directCallers.length,transitiveCallers:s.transitiveCallers.length,testFiles:s.testFiles.length,docFiles:s.docFiles.length,totalAffectedFiles:s.totalAffectedFiles,timedOut:s.timedOut,durationMs:s.durationMs,sessionID:n.sessionID};if(s.totalAffectedFiles===0&&s.directCallers.length===0)return{title:`omo_impact: no callers found for ${t.symbol}`,output:`No call sites found for "${t.symbol}". Either the symbol is unused, or the codegraph index is stale. Run \`npx codegraph sync\` to refresh the index and try again.`,metadata:a};let l=[];if(l.push(`Impact analysis for "${t.symbol}" (via ${s.kind??"fallback"}).
241
241
  `),l.push("## Summary"),l.push(`- Direct callers: **${s.directCallers.length}**`),l.push(`- Transitive callers: **${s.transitiveCallers.length}**`),l.push(`- Test files affected: **${s.testFiles.length}**`),l.push(`- Doc files affected: **${s.docFiles.length}**`),l.push(`- Total affected files: **${s.totalAffectedFiles}**
242
242
  `),s.directCallers.length>0){l.push("## Direct Callers");for(let c of s.directCallers.slice(0,30))l.push(`- ${c.file}:${c.line}${c.context?` — ${c.context}`:""}`);if(s.directCallers.length>30)l.push(`- ... and ${s.directCallers.length-30} more`);l.push("")}if(s.testFiles.length>0){l.push("## Test Files Affected");for(let c of s.testFiles.slice(0,20))l.push(`- ${c}`);l.push("")}if(s.docFiles.length>0){l.push("## Doc Files Affected");for(let c of s.docFiles.slice(0,20))l.push(`- ${c}`);l.push("")}if(s.timedOut)l.push("⚠️ Analysis timed out — results may be incomplete. Try with a more specific symbol.");return{title:`omo_impact: ${t.symbol} (${s.totalAffectedFiles} files)`,output:l.join(`
243
- `),metadata:a}}})}function ol(e){return V({description:"Save a fact, observation, or insight to AgentMemory so it persists across sessions. USE THIS when you learn something worth remembering: a bug pattern, a config quirk, a user preference, a project rule. The system will route the save to AgentMemory's MCP server. Example: omo_remember with content='Always use bun:sqlite, not better-sqlite3' "+"concepts=['storage', 'bun'] — the system will save this to AgentMemory.",args:{content:we.string().min(1).describe("The fact/observation/lesson to remember"),concepts:we.array(we.string()).optional().describe("Tags to categorize this memory (e.g. ['security', 'auth'])"),type:we.enum(["fact","pattern","observation"]).optional().describe("Type of memory: fact, pattern, or observation")},async execute(t,n){let o=n.sessionID;if(!ys())return{title:"omo_remember: session not initialized",output:"Could not save to AgentMemory: the plugin has not captured the OpenCode session client. Try restarting the plugin or check that the OpenCode session is running.",metadata:{tool:"omo_remember",ok:!1}};let r={content:t.content,concepts:t.concepts??[],type:t.type??"observation"},i=await Bn(o,{toolName:"omo_remember",mcpTool:"agentmemory_memory_save",mcpArgs:r,preamble:"Save this to AgentMemory (cross-session persistent memory)."});if(!i.ok)return{title:"omo_remember: failed",output:`Failed to dispatch save to AgentMemory: ${i.error??"unknown error"}`,metadata:{tool:"omo_remember",ok:!1,durationMs:i.durationMs}};e.onDispatch?.({sessionID:o,mcpTool:"agentmemory_memory_save",mcpArgs:r});let s=await ek(o,"agentmemory_memory_save");return{title:`omo_remember: ${s}`,output:`Save to AgentMemory ${s==="delivered"?"verified":s==="expired"?"not delivered within TTL":"dispatched"} (messageID: ${i.messageID??"pending"}). LLM call to agentmemory_memory_save ${s==="delivered"?"was observed":"not yet observed (will happen on next turn)"} with args: ${JSON.stringify(r)}. It will be available in future sessions via agentmemory_memory_recall.`,metadata:{tool:"omo_remember",ok:!0,messageID:i.messageID,durationMs:i.durationMs,contentLength:t.content.length,deliveryStatus:s}}}})}function il(e){return V({description:"Search AgentMemory's cross-session memory (via agentmemory_memory_smart_search). USE THIS for questions that need context from PREVIOUS sessions: 'how did we set up X', 'what was the last approach to Y', 'recall the config for Z'. For current-session recall, prefer omo_recall (local SQLite) instead.",args:{query:we.string().min(2).describe("The search query"),limit:we.number().int().min(1).max(20).optional().describe("Max results (default 5)")},async execute(t,n){let o=n.sessionID;if(!ys())return{title:"omo_recall_mcp: session not initialized",output:"Could not search AgentMemory: session client not captured. Use omo_recall for local session memory instead.",metadata:{tool:"omo_recall_mcp",ok:!1}};let r={query:t.query,limit:t.limit??5},i=await Bn(o,{toolName:"omo_recall_mcp",mcpTool:"agentmemory_memory_smart_search",mcpArgs:r,preamble:"Search AgentMemory for this query and report the results."});if(!i.ok)return{title:"omo_recall_mcp: failed",output:`Failed to dispatch search to AgentMemory: ${i.error??"unknown error"}`,metadata:{tool:"omo_recall_mcp",ok:!1,durationMs:i.durationMs}};e.onDispatch?.({sessionID:o,mcpTool:"agentmemory_memory_smart_search",mcpArgs:r});let s=await ek(o,"agentmemory_memory_smart_search");return{title:`omo_recall_mcp: ${s}`,output:`Search to AgentMemory ${s==="delivered"?"verified":"dispatched"} (messageID: ${i.messageID??"pending"}). LLM call to agentmemory_memory_smart_search ${s==="delivered"?"was observed":"not yet observed (will happen on next turn)"} with args: ${JSON.stringify(r)}. Results will appear in the next assistant message.`,metadata:{tool:"omo_recall_mcp",ok:!0,messageID:i.messageID,durationMs:i.durationMs,query:t.query,deliveryStatus:s}}}})}function sl(e){return V({description:"Find the shortest conceptual path between two concepts in the codebase "+"using the graphify knowledge graph. GRAPHIFY TOOL (v0.25.0): concept-level relations live in graphify — "+"codegraph cannot answer these. USE THIS to understand how two apparently unrelated parts of the codebase connect. Example: omo_path with from='auth' to='database' traces the chain from authentication handlers to DB queries.",args:{from:we.string().min(1).describe("Start concept"),to:we.string().min(1).describe("End concept")},async execute(t,n){let o=Date.now(),r=await dn("graphify","shortest_path",{source:t.from,target:t.to,project_path:e.cwd},8000);if(r!==null)return{title:"omo_path: path found",output:r,metadata:{tool:"omo_path",from:t.from,to:t.to,kind:"graphify",transport:"mcp",durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}};let s=await pe().invokePath(t.from,t.to,e.cwd,{timeoutMs:8000});return{title:s.kind==="graphify"?"omo_path: path found":"omo_path: unavailable",output:s.result??`No path found between "${t.from}" and "${t.to}". Check if graphify-out/ exists and is up to date.`,metadata:{tool:"omo_path",from:t.from,to:t.to,kind:s.kind,durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}}}})}function al(e){return V({description:"Get a plain-language explanation of a concept from the graphify knowledge graph. "+"GRAPHIFY TOOL (v0.25.0): conceptual overviews live in graphify — codegraph cannot produce them. "+"USE THIS when you encounter an unfamiliar term or module and need a quick overview of what it is and how it fits into the codebase. Example: 'omo_explain SwinTransformer'.",args:{concept:we.string().min(1).describe("The concept to explain")},async execute(t,n){let o=Date.now(),r=await dn("graphify","get_node",{label:t.concept,project_path:e.cwd},8000);if(r!==null)return{title:"omo_explain: done",output:r,metadata:{tool:"omo_explain",concept:t.concept,kind:"graphify",transport:"mcp",durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}};let s=await pe().invokeExplain(t.concept,e.cwd,{timeoutMs:8000});return{title:s.kind==="graphify"?"omo_explain: done":"omo_explain: unavailable",output:s.result??`Concept "${t.concept}" not found in the knowledge graph. Run \`graphify . --no-viz\` first.`,metadata:{tool:"omo_explain",concept:t.concept,kind:s.kind,durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}}}})}function cl(e){return V({description:"List files indexed by the codebase graph (codegraph or graphify). USAGE: returns a list of indexed file paths. Use this when you need to discover which files are in the graph before drilling into a specific one.",args:{},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_files",{projectPath:e.cwd},5000);if(r!==null)return{title:"omo_files: codegraph backend",output:r,metadata:{tool:"omo_files",kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??pe()).invokeFiles(e.cwd,{timeoutMs:5000});if(!s.result)return{title:"omo_files: no index",output:"No indexed files found. If `.codegraph/` doesn't exist, run `npx codegraph init` first. If `graphify-out/` doesn't exist, run `graphify . --no-viz` first.",metadata:{tool:"omo_files",kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}};return{title:`omo_files: ${s.kind??"unknown"} backend`,output:s.result,metadata:{tool:"omo_files",kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function ll(e){return V({description:"List all call sites of a symbol in the codebase graph. USAGE: omo_callers with symbol='UserService.create' returns every file:line "+"where that symbol is called. Codegraph-only — returns null if .codegraph/ is missing.",args:{symbol:we.string().min(1).describe("The symbol to find callers for (function, class, method, variable)")},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_callers",{symbol:t.symbol,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_callers: ${t.symbol}`,output:r,metadata:{tool:"omo_callers",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??pe()).invokeCallers(t.symbol,e.cwd,{timeoutMs:5000});if(!s.result)return{title:`omo_callers: ${t.symbol} (no callers or no codegraph)`,output:`No call sites found for "${t.symbol}". Either the symbol is unused, or codegraph is not installed / has no index. Run \`npx codegraph init\` to create the index.`,metadata:{tool:"omo_callers",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}};return{title:`omo_callers: ${t.symbol}`,output:s.result,metadata:{tool:"omo_callers",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function ul(e){return V({description:"Get the source code of a symbol (function/class/method/variable) and its direct callers. USAGE: omo_node with symbol='UserService.create' returns the symbol's definition and "+"every direct call site. Distinct from omo_find (which only returns a definition summary) — "+"this tool returns the full source body. Codegraph-only.",args:{symbol:we.string().min(1).describe("The symbol to resolve (function, class, method, variable)")},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_node",{symbol:t.symbol,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_node: ${t.symbol}`,output:r,metadata:{tool:"omo_node",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??pe()).invokeNode(t.symbol,e.cwd,{timeoutMs:5000});if(!s.result)return{title:`omo_node: ${t.symbol} not found`,output:`Symbol "${t.symbol}" was not found in the codegraph index. Run \`npx codegraph init\` if the index doesn't exist, or \`npx codegraph sync\` to refresh.`,metadata:{tool:"omo_node",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}};return{title:`omo_node: ${t.symbol}`,output:s.result,metadata:{tool:"omo_node",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function tt(e,t,n,o,r,i){let s=Date.now()-o;if(!n.result)return{title:`${e}: no result`,output:i,metadata:{tool:e,kind:n.kind,durationMs:s,sessionID:r.sessionID,...t}};return{title:e,output:n.result,metadata:{tool:e,kind:n.kind,durationMs:s,sessionID:r.sessionID,...t}}}function dl(e){return V({description:"Get a focused code context window for a given task. USAGE: omo_context with task='validate JWT tokens' returns relevant code blocks (file paths + line ranges). "+"Codegraph-only — returns null if .codegraph/ is missing.",args:{task:we.string().min(1).describe("The task to extract context for")},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_context",{task:t.task,maxNodes:20,projectPath:e.cwd},5000);if(r!==null)return{title:"omo_context",output:r,metadata:{tool:"omo_context",task:t.task,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??pe()).invokeContext(t.task,e.cwd,{timeoutMs:5000});return tt("omo_context",{task:t.task},{...s,durationMs:Date.now()-o},o,n,`No context for task "${t.task}". Run \`npx codegraph init\` if the index doesn't exist.`)}})}function pl(e){return V({description:"List files affected by changes in the given source files. USAGE: omo_affected_cg with files=['src/auth.ts'] returns the set of test files, callers, and dependent modules. Codegraph-only.",args:{files:we.array(we.string().min(1)).min(1).describe("Source file paths to analyze (relative to cwd)")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeAffected(t.files,e.cwd,{timeoutMs:5000});return tt("omo_affected_cg",{files:t.files.join(",")},{...i,durationMs:Date.now()-o},o,n,`Could not compute affected files for [${t.files.join(", ")}]. Run \`npx codegraph init\` if needed.`)}})}function ml(e){return V({description:"Show codegraph health: node count, version, last update timestamp. USAGE: omo_status returns a multi-line report. Codegraph-only.",args:{},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_status",{projectPath:e.cwd},5000);if(r!==null)return{title:"omo_status",output:r,metadata:{tool:"omo_status",kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??pe()).invokeStatus(e.cwd,{timeoutMs:5000});return tt("omo_status",{},{...s,durationMs:Date.now()-o},o,n,"codegraph is not installed or has no index. Run `npx codegraph init` to create one.")}})}function fl(e){return V({description:"Remove a stale codegraph lock file (left behind after a crash). USAGE: omo_unlock clears the lock so the next sync can run. Codegraph-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeUnlock(e.cwd,{timeoutMs:5000});return tt("omo_unlock",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function hl(e){return V({description:"Mark the codegraph index as dirty so the next sync re-extracts. USAGE: omo_mark_dirty when you know source files changed without git hooks firing.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeMarkDirty(e.cwd,{timeoutMs:5000});return tt("omo_mark_dirty",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function gl(e){return V({description:"Trigger a codegraph sync ONLY if the graph was previously marked dirty. USAGE: omo_sync_if_dirty is a cheap daily check; omo_status shows the dirty flag.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeSyncIfDirty(e.cwd,{timeoutMs:30000});return tt("omo_sync_if_dirty",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed or no index exists.")}})}function yl(e){return V({description:"Manually trigger a full codegraph reindex. USAGE: omo_index when you want a guaranteed-fresh graph (bypasses the dirty-flag check).",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeIndex(e.cwd,{timeoutMs:60000});return tt("omo_index",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed. Run `npm i -D @colbymchenry/codegraph` first.")}})}function xl(e){return V({description:"Generate an HTML visualization of the codegraph. USAGE: omo_visualize returns the path to the generated HTML file.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeVisualize(e.cwd,{timeoutMs:30000});return tt("omo_visualize",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function vl(e){return V({description:"Start the codegraph HTTP server on the given port. USAGE: omo_serve with port=3030 starts the server in the background. Returns the port + status.",args:{port:we.number().int().min(1).max(65535).describe("TCP port to bind the codegraph server to")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeServe(t.port,e.cwd,{timeoutMs:5000});return tt("omo_serve",{port:t.port},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed. Run `npm i -D @colbymchenry/codegraph` first.")}})}function Sl(e){return V({description:"Remove the codegraph index (.codegraph/) from disk. "+"USAGE: omo_uninit when you want a clean slate — next sync will rebuild from scratch.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeUninit(e.cwd,{timeoutMs:5000});return tt("omo_uninit",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function bl(e){return V({description:"Diagnose the graphify graph for inconsistencies, multigraph warnings, and stale nodes. USAGE: omo_diagnose returns a JSON-like report. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeDiagnose(e.cwd,{timeoutMs:1e4});return tt("omo_diagnose",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed. Run `pip install graphifyy` first.")}})}function _l(e){return V({description:"Run graphify's 3-way merge driver to resolve conflicting graph segments. USAGE: omo_merge_graphs when git reports a conflict in graphify-out/. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeMergeDriver(e.cwd,{timeoutMs:30000});return tt("omo_merge_graphs",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function kl(e){return V({description:"Persist the result of the last graphify query to disk for later inspection. USAGE: omo_save_result after omo_explain or omo_path returns a useful output.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeSaveResult(e.cwd,{timeoutMs:5000});return tt("omo_save_result",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function wl(e){return V({description:"Re-run graphify's semantic extraction over the entire source tree. USAGE: omo_extract when the graph schema changed and you want a fresh semantic layer.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeExtract(e.cwd,{timeoutMs:60000});return tt("omo_extract",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function Il(e){return V({description:"Re-run graphify's clustering step (skip semantic extraction). USAGE: omo_cluster_only after minor node additions to refresh the topic map.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeClusterOnly(e.cwd,{timeoutMs:30000});return tt("omo_cluster_only",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function Tl(e){return V({description:"Apply a label to a graphify node (e.g. for categorization or human notes). USAGE: omo_label with node='validateToken' applies a label.",args:{node:we.string().min(1).describe("The graph node to label")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeLabel(t.node,e.cwd,{timeoutMs:5000});return tt("omo_label",{node:t.node},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function El(e){return V({description:"Emit a tree visualization of the graphify graph (hierarchical topic layout). USAGE: omo_tree for a structural overview of the topic map. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeTree(e.cwd,{timeoutMs:1e4});return tt("omo_tree",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function $l(e){return V({description:"Clone the graphify graph to a new location. USAGE: omo_clone when forking a project or creating a backup.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeClone(e.cwd,{timeoutMs:30000});return tt("omo_clone",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function Ol(e){return V({description:"Add specific files to the graphify graph (instead of re-extracting the whole tree). USAGE: omo_add with files='src/auth.ts src/login.ts' after writing new files.",args:{files:we.string().min(1).describe("Space-separated list of file paths to add (relative to cwd)")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeAdd(t.files,e.cwd,{timeoutMs:30000});return tt("omo_add",{files:t.files},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function Dl(e){return V({description:"Check if the graphify schema or extractors changed since the last extraction. USAGE: omo_check_update to decide if re-extraction is needed. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeCheckUpdate(e.cwd,{timeoutMs:1e4});return tt("omo_check_update",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function Pl(e){return V({description:"Check whether the graphify post-commit git hook is installed in this project. USAGE: omo_hook_status returns 'installed' or 'missing' along with the hook path. Run after `git init` to confirm the hook is wired.",args:{},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => Ra());let i=await Hd(e.cwd),s=`${e.cwd}/.git/hooks/post-commit`,a=i?`graphify post-commit hook is INSTALLED at ${s}.`:"graphify post-commit hook is NOT installed. Run `graphify hook install` or enable graphSync in plugin config to install automatically.";return{title:`omo_hook_status: ${i?"installed":"missing"}`,output:a,metadata:{tool:"omo_hook_status",installed:i,hookPath:s,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function Cl(e,t,n,o,r,i){let s=Date.now()-o;if(!n.ok)return{title:`${e}: ${n.code}`,output:`${i}
243
+ `),metadata:a}}})}function ol(e){return H({description:"Save a fact, observation, or insight to AgentMemory so it persists across sessions. USE THIS when you learn something worth remembering: a bug pattern, a config quirk, a user preference, a project rule. The system will route the save to AgentMemory's MCP server. Example: omo_remember with content='Always use bun:sqlite, not better-sqlite3' "+"concepts=['storage', 'bun'] — the system will save this to AgentMemory.",args:{content:we.string().min(1).describe("The fact/observation/lesson to remember"),concepts:we.array(we.string()).optional().describe("Tags to categorize this memory (e.g. ['security', 'auth'])"),type:we.enum(["fact","pattern","observation"]).optional().describe("Type of memory: fact, pattern, or observation")},async execute(t,n){let o=n.sessionID;if(!ys())return{title:"omo_remember: session not initialized",output:"Could not save to AgentMemory: the plugin has not captured the OpenCode session client. Try restarting the plugin or check that the OpenCode session is running.",metadata:{tool:"omo_remember",ok:!1}};let r={content:t.content,concepts:t.concepts??[],type:t.type??"observation"},i=await Bn(o,{toolName:"omo_remember",mcpTool:"agentmemory_memory_save",mcpArgs:r,preamble:"Save this to AgentMemory (cross-session persistent memory)."});if(!i.ok)return{title:"omo_remember: failed",output:`Failed to dispatch save to AgentMemory: ${i.error??"unknown error"}`,metadata:{tool:"omo_remember",ok:!1,durationMs:i.durationMs}};e.onDispatch?.({sessionID:o,mcpTool:"agentmemory_memory_save",mcpArgs:r});let s=await ek(o,"agentmemory_memory_save");return{title:`omo_remember: ${s}`,output:`Save to AgentMemory ${s==="delivered"?"verified":s==="expired"?"not delivered within TTL":"dispatched"} (messageID: ${i.messageID??"pending"}). LLM call to agentmemory_memory_save ${s==="delivered"?"was observed":"not yet observed (will happen on next turn)"} with args: ${JSON.stringify(r)}. It will be available in future sessions via agentmemory_memory_recall.`,metadata:{tool:"omo_remember",ok:!0,messageID:i.messageID,durationMs:i.durationMs,contentLength:t.content.length,deliveryStatus:s}}}})}function il(e){return H({description:"Search AgentMemory's cross-session memory (via agentmemory_memory_smart_search). USE THIS for questions that need context from PREVIOUS sessions: 'how did we set up X', 'what was the last approach to Y', 'recall the config for Z'. For current-session recall, prefer omo_recall (local SQLite) instead.",args:{query:we.string().min(2).describe("The search query"),limit:we.number().int().min(1).max(20).optional().describe("Max results (default 5)")},async execute(t,n){let o=n.sessionID;if(!ys())return{title:"omo_recall_mcp: session not initialized",output:"Could not search AgentMemory: session client not captured. Use omo_recall for local session memory instead.",metadata:{tool:"omo_recall_mcp",ok:!1}};let r={query:t.query,limit:t.limit??5},i=await Bn(o,{toolName:"omo_recall_mcp",mcpTool:"agentmemory_memory_smart_search",mcpArgs:r,preamble:"Search AgentMemory for this query and report the results."});if(!i.ok)return{title:"omo_recall_mcp: failed",output:`Failed to dispatch search to AgentMemory: ${i.error??"unknown error"}`,metadata:{tool:"omo_recall_mcp",ok:!1,durationMs:i.durationMs}};e.onDispatch?.({sessionID:o,mcpTool:"agentmemory_memory_smart_search",mcpArgs:r});let s=await ek(o,"agentmemory_memory_smart_search");return{title:`omo_recall_mcp: ${s}`,output:`Search to AgentMemory ${s==="delivered"?"verified":"dispatched"} (messageID: ${i.messageID??"pending"}). LLM call to agentmemory_memory_smart_search ${s==="delivered"?"was observed":"not yet observed (will happen on next turn)"} with args: ${JSON.stringify(r)}. Results will appear in the next assistant message.`,metadata:{tool:"omo_recall_mcp",ok:!0,messageID:i.messageID,durationMs:i.durationMs,query:t.query,deliveryStatus:s}}}})}function sl(e){return H({description:"Find the shortest conceptual path between two concepts in the codebase "+"using the graphify knowledge graph. GRAPHIFY TOOL (v0.25.0): concept-level relations live in graphify — "+"codegraph cannot answer these. USE THIS to understand how two apparently unrelated parts of the codebase connect. Example: omo_path with from='auth' to='database' traces the chain from authentication handlers to DB queries.",args:{from:we.string().min(1).describe("Start concept"),to:we.string().min(1).describe("End concept")},async execute(t,n){let o=Date.now(),r=await dn("graphify","shortest_path",{source:t.from,target:t.to,project_path:e.cwd},8000);if(r!==null)return{title:"omo_path: path found",output:r,metadata:{tool:"omo_path",from:t.from,to:t.to,kind:"graphify",transport:"mcp",durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}};let s=await pe().invokePath(t.from,t.to,e.cwd,{timeoutMs:8000});return{title:s.kind==="graphify"?"omo_path: path found":"omo_path: unavailable",output:s.result??`No path found between "${t.from}" and "${t.to}". Check if graphify-out/ exists and is up to date.`,metadata:{tool:"omo_path",from:t.from,to:t.to,kind:s.kind,durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}}}})}function al(e){return H({description:"Get a plain-language explanation of a concept from the graphify knowledge graph. "+"GRAPHIFY TOOL (v0.25.0): conceptual overviews live in graphify — codegraph cannot produce them. "+"USE THIS when you encounter an unfamiliar term or module and need a quick overview of what it is and how it fits into the codebase. Example: 'omo_explain SwinTransformer'.",args:{concept:we.string().min(1).describe("The concept to explain")},async execute(t,n){let o=Date.now(),r=await dn("graphify","get_node",{label:t.concept,project_path:e.cwd},8000);if(r!==null)return{title:"omo_explain: done",output:r,metadata:{tool:"omo_explain",concept:t.concept,kind:"graphify",transport:"mcp",durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}};let s=await pe().invokeExplain(t.concept,e.cwd,{timeoutMs:8000});return{title:s.kind==="graphify"?"omo_explain: done":"omo_explain: unavailable",output:s.result??`Concept "${t.concept}" not found in the knowledge graph. Run \`graphify . --no-viz\` first.`,metadata:{tool:"omo_explain",concept:t.concept,kind:s.kind,durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}}}})}function cl(e){return H({description:"List files indexed by the codebase graph (codegraph or graphify). USAGE: returns a list of indexed file paths. Use this when you need to discover which files are in the graph before drilling into a specific one.",args:{},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_files",{projectPath:e.cwd},5000);if(r!==null)return{title:"omo_files: codegraph backend",output:r,metadata:{tool:"omo_files",kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??pe()).invokeFiles(e.cwd,{timeoutMs:5000});if(!s.result)return{title:"omo_files: no index",output:"No indexed files found. If `.codegraph/` doesn't exist, run `npx codegraph init` first. If `graphify-out/` doesn't exist, run `graphify . --no-viz` first.",metadata:{tool:"omo_files",kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}};return{title:`omo_files: ${s.kind??"unknown"} backend`,output:s.result,metadata:{tool:"omo_files",kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function ll(e){return H({description:"List all call sites of a symbol in the codebase graph. USAGE: omo_callers with symbol='UserService.create' returns every file:line "+"where that symbol is called. Codegraph-only — returns null if .codegraph/ is missing.",args:{symbol:we.string().min(1).describe("The symbol to find callers for (function, class, method, variable)")},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_callers",{symbol:t.symbol,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_callers: ${t.symbol}`,output:r,metadata:{tool:"omo_callers",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??pe()).invokeCallers(t.symbol,e.cwd,{timeoutMs:5000});if(!s.result)return{title:`omo_callers: ${t.symbol} (no callers or no codegraph)`,output:`No call sites found for "${t.symbol}". Either the symbol is unused, or codegraph is not installed / has no index. Run \`npx codegraph init\` to create the index.`,metadata:{tool:"omo_callers",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}};return{title:`omo_callers: ${t.symbol}`,output:s.result,metadata:{tool:"omo_callers",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function ul(e){return H({description:"Get the source code of a symbol (function/class/method/variable) and its direct callers. USAGE: omo_node with symbol='UserService.create' returns the symbol's definition and "+"every direct call site. Distinct from omo_find (which only returns a definition summary) — "+"this tool returns the full source body. Codegraph-only.",args:{symbol:we.string().min(1).describe("The symbol to resolve (function, class, method, variable)")},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_node",{symbol:t.symbol,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_node: ${t.symbol}`,output:r,metadata:{tool:"omo_node",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??pe()).invokeNode(t.symbol,e.cwd,{timeoutMs:5000});if(!s.result)return{title:`omo_node: ${t.symbol} not found`,output:`Symbol "${t.symbol}" was not found in the codegraph index. Run \`npx codegraph init\` if the index doesn't exist, or \`npx codegraph sync\` to refresh.`,metadata:{tool:"omo_node",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}};return{title:`omo_node: ${t.symbol}`,output:s.result,metadata:{tool:"omo_node",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function tt(e,t,n,o,r,i){let s=Date.now()-o;if(!n.result)return{title:`${e}: no result`,output:i,metadata:{tool:e,kind:n.kind,durationMs:s,sessionID:r.sessionID,...t}};return{title:e,output:n.result,metadata:{tool:e,kind:n.kind,durationMs:s,sessionID:r.sessionID,...t}}}function dl(e){return H({description:"Get a focused code context window for a given task. USAGE: omo_context with task='validate JWT tokens' returns relevant code blocks (file paths + line ranges). "+"Codegraph-only — returns null if .codegraph/ is missing.",args:{task:we.string().min(1).describe("The task to extract context for")},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_context",{task:t.task,maxNodes:20,projectPath:e.cwd},5000);if(r!==null)return{title:"omo_context",output:r,metadata:{tool:"omo_context",task:t.task,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??pe()).invokeContext(t.task,e.cwd,{timeoutMs:5000});return tt("omo_context",{task:t.task},{...s,durationMs:Date.now()-o},o,n,`No context for task "${t.task}". Run \`npx codegraph init\` if the index doesn't exist.`)}})}function pl(e){return H({description:"List files affected by changes in the given source files. USAGE: omo_affected_cg with files=['src/auth.ts'] returns the set of test files, callers, and dependent modules. Codegraph-only.",args:{files:we.array(we.string().min(1)).min(1).describe("Source file paths to analyze (relative to cwd)")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeAffected(t.files,e.cwd,{timeoutMs:5000});return tt("omo_affected_cg",{files:t.files.join(",")},{...i,durationMs:Date.now()-o},o,n,`Could not compute affected files for [${t.files.join(", ")}]. Run \`npx codegraph init\` if needed.`)}})}function ml(e){return H({description:"Show codegraph health: node count, version, last update timestamp. USAGE: omo_status returns a multi-line report. Codegraph-only.",args:{},async execute(t,n){let o=Date.now(),r=await dn("codegraph","codegraph_status",{projectPath:e.cwd},5000);if(r!==null)return{title:"omo_status",output:r,metadata:{tool:"omo_status",kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??pe()).invokeStatus(e.cwd,{timeoutMs:5000});return tt("omo_status",{},{...s,durationMs:Date.now()-o},o,n,"codegraph is not installed or has no index. Run `npx codegraph init` to create one.")}})}function fl(e){return H({description:"Remove a stale codegraph lock file (left behind after a crash). USAGE: omo_unlock clears the lock so the next sync can run. Codegraph-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeUnlock(e.cwd,{timeoutMs:5000});return tt("omo_unlock",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function hl(e){return H({description:"Mark the codegraph index as dirty so the next sync re-extracts. USAGE: omo_mark_dirty when you know source files changed without git hooks firing.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeMarkDirty(e.cwd,{timeoutMs:5000});return tt("omo_mark_dirty",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function gl(e){return H({description:"Trigger a codegraph sync ONLY if the graph was previously marked dirty. USAGE: omo_sync_if_dirty is a cheap daily check; omo_status shows the dirty flag.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeSyncIfDirty(e.cwd,{timeoutMs:30000});return tt("omo_sync_if_dirty",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed or no index exists.")}})}function yl(e){return H({description:"Manually trigger a full codegraph reindex. USAGE: omo_index when you want a guaranteed-fresh graph (bypasses the dirty-flag check).",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeIndex(e.cwd,{timeoutMs:60000});return tt("omo_index",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed. Run `npm i -D @colbymchenry/codegraph` first.")}})}function xl(e){return H({description:"Generate an HTML visualization of the codegraph. USAGE: omo_visualize returns the path to the generated HTML file.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeVisualize(e.cwd,{timeoutMs:30000});return tt("omo_visualize",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function vl(e){return H({description:"Start the codegraph HTTP server on the given port. USAGE: omo_serve with port=3030 starts the server in the background. Returns the port + status.",args:{port:we.number().int().min(1).max(65535).describe("TCP port to bind the codegraph server to")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeServe(t.port,e.cwd,{timeoutMs:5000});return tt("omo_serve",{port:t.port},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed. Run `npm i -D @colbymchenry/codegraph` first.")}})}function Sl(e){return H({description:"Remove the codegraph index (.codegraph/) from disk. "+"USAGE: omo_uninit when you want a clean slate — next sync will rebuild from scratch.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeUninit(e.cwd,{timeoutMs:5000});return tt("omo_uninit",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function bl(e){return H({description:"Diagnose the graphify graph for inconsistencies, multigraph warnings, and stale nodes. USAGE: omo_diagnose returns a JSON-like report. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeDiagnose(e.cwd,{timeoutMs:1e4});return tt("omo_diagnose",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed. Run `pip install graphifyy` first.")}})}function _l(e){return H({description:"Run graphify's 3-way merge driver to resolve conflicting graph segments. USAGE: omo_merge_graphs when git reports a conflict in graphify-out/. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeMergeDriver(e.cwd,{timeoutMs:30000});return tt("omo_merge_graphs",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function kl(e){return H({description:"Persist the result of the last graphify query to disk for later inspection. USAGE: omo_save_result after omo_explain or omo_path returns a useful output.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeSaveResult(e.cwd,{timeoutMs:5000});return tt("omo_save_result",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function wl(e){return H({description:"Re-run graphify's semantic extraction over the entire source tree. USAGE: omo_extract when the graph schema changed and you want a fresh semantic layer.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeExtract(e.cwd,{timeoutMs:60000});return tt("omo_extract",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function Il(e){return H({description:"Re-run graphify's clustering step (skip semantic extraction). USAGE: omo_cluster_only after minor node additions to refresh the topic map.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeClusterOnly(e.cwd,{timeoutMs:30000});return tt("omo_cluster_only",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function Tl(e){return H({description:"Apply a label to a graphify node (e.g. for categorization or human notes). USAGE: omo_label with node='validateToken' applies a label.",args:{node:we.string().min(1).describe("The graph node to label")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeLabel(t.node,e.cwd,{timeoutMs:5000});return tt("omo_label",{node:t.node},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function El(e){return H({description:"Emit a tree visualization of the graphify graph (hierarchical topic layout). USAGE: omo_tree for a structural overview of the topic map. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeTree(e.cwd,{timeoutMs:1e4});return tt("omo_tree",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function $l(e){return H({description:"Clone the graphify graph to a new location. USAGE: omo_clone when forking a project or creating a backup.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeClone(e.cwd,{timeoutMs:30000});return tt("omo_clone",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function Ol(e){return H({description:"Add specific files to the graphify graph (instead of re-extracting the whole tree). USAGE: omo_add with files='src/auth.ts src/login.ts' after writing new files.",args:{files:we.string().min(1).describe("Space-separated list of file paths to add (relative to cwd)")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeAdd(t.files,e.cwd,{timeoutMs:30000});return tt("omo_add",{files:t.files},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function Dl(e){return H({description:"Check if the graphify schema or extractors changed since the last extraction. USAGE: omo_check_update to decide if re-extraction is needed. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??pe()).invokeCheckUpdate(e.cwd,{timeoutMs:1e4});return tt("omo_check_update",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function Pl(e){return H({description:"Check whether the graphify post-commit git hook is installed in this project. USAGE: omo_hook_status returns 'installed' or 'missing' along with the hook path. Run after `git init` to confirm the hook is wired.",args:{},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => Ra());let i=await Wd(e.cwd),s=`${e.cwd}/.git/hooks/post-commit`,a=i?`graphify post-commit hook is INSTALLED at ${s}.`:"graphify post-commit hook is NOT installed. Run `graphify hook install` or enable graphSync in plugin config to install automatically.";return{title:`omo_hook_status: ${i?"installed":"missing"}`,output:a,metadata:{tool:"omo_hook_status",installed:i,hookPath:s,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function Cl(e,t,n,o,r,i){let s=Date.now()-o;if(!n.ok)return{title:`${e}: ${n.code}`,output:`${i}
244
244
 
245
245
  Diagnostic: ${n.code}
246
- stderr: ${n.stderr||"(empty)"}`,metadata:{tool:e,code:n.code,durationMs:s,sessionID:r.sessionID,...t}};let a=n.data!==null&&n.data!==void 0?typeof n.data==="string"?n.data:JSON.stringify(n.data,null,2):n.rawOutput??"";return{title:e,output:a,metadata:{tool:e,code:n.code,durationMs:s,sessionID:r.sessionID,...t}}}function Rl(e){return V({description:"Install a CLI from the CLI-Anything hub so the agent can drive that software. USAGE: omo_cli_anything_install with name='gimp' installs `cli-anything-gimp`, which exposes a `cli-anything-gimp` command. Browse the catalog with omo_cli_anything_list. See https://github.com/HKUDS/CLI-Anything for the full registry.",args:{name:we.string().min(1).describe("The CLI name to install (e.g. 'gimp', 'blender', 'drawio')")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => wo());let i=AS(t.name,e.runner,120000,"cli-hub");return Cl("omo_cli_anything_install",{name:t.name},{...i,durationMs:Date.now()-o},o,n,`Could not install '${t.name}'. Check that cli-anything-hub is installed (omo_health) and the name is correct.`)}})}function Al(e){return V({description:"List all CLIs available in the CLI-Anything hub (40+ GUI software harnesses). USAGE: omo_cli_anything_list with category='image' returns only image-related CLIs. Returns JSON with name, version, description, category, install_cmd, entry_point. See https://github.com/HKUDS/CLI-Anything.",args:{category:we.string().optional().describe("Optional category filter (e.g. 'image', 'devops', '3d', 'audio')"),source:we.enum(["harness","public","npm","all"]).optional().describe("Optional source filter. 'all' includes harness + public + npm.")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => wo());let i=PS({category:t.category,source:t.source},e.runner,30000,"cli-hub");return Cl("omo_cli_anything_list",{category:t.category,source:t.source},{...i,durationMs:Date.now()-o},o,n,"Could not list CLIs from the hub. Make sure cli-anything-hub is installed: `pip install cli-anything-hub`.")}})}function Ml(e){return V({description:"Search the CLI-Anything hub for CLIs matching a query (name, description, or category). USAGE: omo_cli_anything_search with query='cad' returns CAD-related CLIs. Returns JSON array. See https://github.com/HKUDS/CLI-Anything.",args:{query:we.string().min(1).describe("Search query (matches name, description, or category)")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => wo());let i=CS(t.query,e.runner,30000,"cli-hub");return Cl("omo_cli_anything_search",{query:t.query},{...i,durationMs:Date.now()-o},o,n,"Search failed. Make sure cli-anything-hub is installed: `pip install cli-anything-hub`.")}})}function Ul(e){return V({description:"Show details for a specific CLI in the CLI-Anything hub. USAGE: omo_cli_anything_info with name='blender' returns display name, version, description, requirements (e.g. 'blender (apt install blender)'), entry point, install command. See https://github.com/HKUDS/CLI-Anything.",args:{name:we.string().min(1).describe("The CLI name to look up")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => wo());let i=RS(t.name,e.runner,1e4,"cli-hub");return Cl("omo_cli_anything_info",{name:t.name},{...i,durationMs:Date.now()-o},o,n,`Could not find '${t.name}' in the hub. Try omo_cli_anything_search to find similar names.`)}})}xs();class Yg{entries=new Map;deliveredCount=0;expiredCount=0;register(e){this.cleanup();let t=`deliv-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,n=tk(e.mcpArgs);return this.entries.set(t,{id:t,sessionID:e.sessionID,mcpTool:e.mcpTool,mcpArgsHash:n,registeredAt:Date.now(),ttlMs:e.ttlMs??1e4}),t}markDelivered(e){this.cleanup();let t=e.mcpArgs?tk(e.mcpArgs):null;for(let[n,o]of this.entries){if(o.sessionID!==e.sessionID)continue;if(o.mcpTool!==e.mcpTool)continue;if(t!==null&&o.mcpArgsHash!==t)continue;return this.entries.delete(n),this.deliveredCount++,n}return null}async awaitDelivery(e){let t=e.timeoutMs??2000,n=Date.now();while(Date.now()-n<t){if(this.cleanup(),![...this.entries.values()].find((r)=>r.sessionID===e.sessionID&&r.mcpTool===e.mcpTool))return"delivered";await hA(50)}return"expired"}getStats(){return{pending:this.entries.size,delivered:this.deliveredCount,expired:this.expiredCount}}clearSession(e){for(let[t,n]of this.entries)if(n.sessionID===e)this.entries.delete(t)}cleanup(){let e=Date.now();for(let[t,n]of this.entries)if(e-n.registeredAt>n.ttlMs)this.entries.delete(t),this.expiredCount++}}function tk(e){return JSON.stringify(e,Object.keys(e).sort())}function hA(e){return new Promise((t)=>setTimeout(t,e))}tr();_o();import{resolve as YM}from"node:path";import{readFileSync as gA}from"node:fs";import{dirname as yA,resolve as xA}from"node:path";import{fileURLToPath as vA}from"node:url";var rk="0.0.0";try{let e=yA(vA(import.meta.url)),t=xA(e,"..","package.json"),n=JSON.parse(gA(t,"utf8"));if(typeof n.version==="string"&&n.version.length>0)rk=n.version}catch{}var at=rk,nk=["decisions_taken","decisions_skipped_continue","decisions_skipped_no_decision","decisions_skipped_no_message","decisions_skipped_below_threshold","interventions_delivered","interventions_disabled_done","interventions_disabled_cap","decisions_stored","plan_reminders_injected","bot_feedback_injected","violations_injected","protocol_audits_passed","protocol_violations_detected","git_commit_reindex","orchestrator_runs","orchestrator_errors","materialization_failures","tier3_reminders_sent","tier3_skills_created","tool_calls_observed","governance_blocks","governance_asks","governance_tools_hidden","governance_tools_rewritten","governance_commands_blocked"];function ok(){let e={};for(let t of nk)e[t]={count:0,lastOccurrenceISO:null};return e}var SA=ok(),SZ=new Date().toISOString();function Nl(e){let t=e??{},n=ok(),o=new Date().toISOString(),r=t.version??at,i=t.global===!0;return{inc(s){let a=n[s];if(!a)return;if(a.count++,a.lastOccurrenceISO=new Date().toISOString(),i){let l=SA[s];if(l)l.count++,l.lastOccurrenceISO=a.lastOccurrenceISO}},getMetrics(){return{version:r,sessionID:t.sessionID??"",startedAtISO:o,uptimeMs:Date.now()-new Date(o).getTime(),counters:{...n}}},reset(){for(let s of nk)n[s]={count:0,lastOccurrenceISO:null}}}}function ik(e,t){for(let n of t)try{if(new RegExp(n).test(e))return n}catch{}return null}function bA(e){let n=e.replace(/^\*\*\//,"").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");return new RegExp(n)}function sk(e,t){for(let n of t)try{if(bA(n).test(e))return n}catch{}return null}function _A(e,t){let n;try{n=new URL(e).host}catch{return null}for(let o of t)if(n===o||n.endsWith("."+o)||n.includes(o))return o;return null}function ak(e,t){let n=ik(e,t.bashDenyPatterns??[]);if(n!==null)return{decision:"deny",reason:'bash command matches deny pattern "'+n+'"'};let o=ik(e,t.bashAskPatterns??[]);if(o!==null)return{decision:"ask",reason:'bash command matches ask pattern "'+o+'"'};return null}function ck(e,t){let n=sk(e,t.editDenyPaths??[]);if(n!==null)return{decision:"deny",reason:'edit path matches deny pattern "'+n+'"'};let o=sk(e,t.editAskPaths??[]);if(o!==null)return{decision:"ask",reason:'edit path matches ask pattern "'+o+'"'};return null}function lk(e,t){let n=_A(e,t.webfetchDenyHosts??[]);if(n!==null)return{decision:"deny",reason:'webfetch host matches deny pattern "'+n+'"'};return null}async function uk(e,t,n,o){if(!n||n.mode===void 0)return;if(!n.mode)return;let r;switch(e.type){case"bash":r=ak(e.command,n);break;case"edit":r=ck(e.pattern,n);break;case"webfetch":r=lk(e.url,n);break;default:return}if(r===null)return;if(t.status=r.decision,r.decision==="deny")o.inc("governance_blocks");else o.inc("governance_asks")}async function dk(e,t,n,o){if(!n.enabled)return;if(n.hideToolIDs?.includes(e.toolID)){t.description="",o.inc("governance_tools_hidden");return}if(n.descriptionSuffix)t.description=(t.description??"")+n.descriptionSuffix,o.inc("governance_tools_rewritten");let r=n.parameterOverrides?.[e.toolID];if(!r||!t.parameters?.properties)return;for(let[i,s]of Object.entries(r))if(t.parameters.properties[i])t.parameters.properties[i].description=s}async function pk(e,t,n,o){if(!n.enabled)return;if(n.denyPatterns?.length)for(let r of n.denyPatterns)try{if(new RegExp(r).test(e.command))throw o.inc("governance_commands_blocked"),Error('[meta-governor] blocked command matching pattern "'+r+'"')}catch(i){if((i instanceof Error?i.message:String(i)).includes("blocked command matching"))throw i}if(n.replacementPrefix)t.parts.push({type:"text",text:n.replacementPrefix+" executing: "+e.command,synthetic:!0})}async function mk(e,t,n){if(!n.enabled)return;if(!n.modelID||!n.providerID)return;let o=e.provider.models??{},r=Object.values(o).find((i)=>typeof i==="object"&&i!==null&&i.id===n.modelID);if(r)t.model=r}import{homedir as RA}from"node:os";import{join as AA}from"node:path";function Qg(e){let t={enabled:!1,...e},n=Jd(),o=Kd(),r=Ua();return{enabled:t.enabled===!0,memory:{enabled:!0,query:t.memory?.query??"meta_governor_context",timeoutMs:t.memory?.timeoutMs??t.memory?.agentmemoryTimeoutMs??2000},tokenPredictor:{compactBurnRateThreshold:t.tokenPredictor?.compactBurnRateThreshold??500,compactUsageThreshold:t.tokenPredictor?.compactUsageThreshold??0.85,switchModelUsageThreshold:t.tokenPredictor?.switchModelUsageThreshold??0.95,delegateConsecutiveHighBurn:t.tokenPredictor?.delegateConsecutiveHighBurn??5},scoring:{...n,...t.scoring?.continueThreshold!==void 0?{continueThreshold:t.scoring.continueThreshold}:{},...t.scoring?.warnThreshold!==void 0?{warnThreshold:t.scoring.warnThreshold}:{},...t.scoring?.escalateThreshold!==void 0?{escalateThreshold:t.scoring.escalateThreshold}:{},...t.scoring?.stopThreshold!==void 0?{stopThreshold:t.scoring.stopThreshold}:{},...t.scoring?.paralysisThreshold!==void 0?{paralysisThreshold:t.scoring.paralysisThreshold}:{},...t.scoring?.defaultEscalationTarget!==void 0?{defaultEscalationTarget:t.scoring.defaultEscalationTarget}:{},oracleFrequency:t.oracle?.frequency??t.scoring?.oracleFrequency??"per-stop"},closedLoop:{...r,...t.closedLoop?.enabled!==void 0?{enabled:t.closedLoop.enabled}:{},...t.closedLoop?.minSeverityToLearn!==void 0?{minSeverityToLearn:t.closedLoop.minSeverityToLearn}:{},...t.closedLoop?.maxLessonsPerSession!==void 0?{maxLessonsPerSession:t.closedLoop.maxLessonsPerSession}:{},...t.closedLoop?.saveDecisions!==void 0?{saveDecisions:t.closedLoop.saveDecisions}:{},...t.closedLoop?.saveLessons!==void 0?{saveLessons:t.closedLoop.saveLessons}:{},...t.closedLoop?.autoRemember!==void 0?{autoRemember:{...r.autoRemember,...t.closedLoop.autoRemember}}:{}},decision:{...o,...t.decision?.maxHistoryPerSession!==void 0?{maxHistoryPerSession:t.decision.maxHistoryPerSession}:{},...t.decision?.forceContinueAfterStops!==void 0?{forceContinueAfterStops:t.decision.forceContinueAfterStops}:{},...t.decision?.warnMessageTemplate!==void 0?{warnMessageTemplate:t.decision.warnMessageTemplate}:{},...t.decision?.escalateMessageTemplate!==void 0?{escalateMessageTemplate:t.decision.escalateMessageTemplate}:{},...t.decision?.stopMessageTemplate!==void 0?{stopMessageTemplate:t.decision.stopMessageTemplate}:{}},modelOverride:t.modelOverride?{providerID:t.modelOverride.providerID,modelID:t.modelOverride.modelID,modelLimit:t.modelOverride.modelLimit,temperature:t.modelOverride.temperature??0.2,topP:t.modelOverride.topP??1,maxTokens:t.modelOverride.maxTokens??2048,reasoning:t.modelOverride.reasoning??!1,verbosity:t.modelOverride.verbosity??"minimal"}:void 0,intervention:{mode:t.intervention?.mode??"silent",includeDecisionHistory:t.intervention?.includeDecisionHistory??!0,maxHistoryMessages:t.intervention?.maxHistoryMessages??5,minActionForMessage:t.intervention?.minActionForMessage??"stop",maxInterventionsPerSession:t.intervention?.maxInterventionsPerSession??3,respectDoneSignal:t.intervention?.respectDoneSignal??!0,phaseAwareDoneSignal:t.intervention?.phaseAwareDoneSignal??!1,persistToSession:t.intervention?.persistToSession??!0,compactionLoopGuard:{enabled:t.intervention?.compactionLoopGuard?.enabled??!0,maxOverflowRecoveries:Math.max(1,t.intervention?.compactionLoopGuard?.maxOverflowRecoveries??1)}},postWave:{enabled:t.postWave?.enabled??t.intervention?.phaseAwareDoneSignal===!0,repoMode:t.postWave?.repoMode??"auto",aasToolPrefix:t.postWave?.aasToolPrefix??"aas",ciTimeoutMs:t.postWave?.ciTimeoutMs??600000,maxRetriesPerWave:t.postWave?.maxRetriesPerWave??1,reinjectCooldownMs:t.postWave?.reinjectCooldownMs??60000,respectSilentMode:t.postWave?.respectSilentMode??!1,...t.postWave?.ownRepoDirective!==void 0?{ownRepoDirective:t.postWave.ownRepoDirective}:{},...t.postWave?.thirdPartyDirective!==void 0?{thirdPartyDirective:t.postWave.thirdPartyDirective}:{}},protocolEnforcement:{enabled:t.protocolEnforcement?.enabled??!1,path:t.protocolEnforcement?.path,injectIntoSystem:t.protocolEnforcement?.injectIntoSystem??!1,auditToolCalls:t.protocolEnforcement?.auditToolCalls??!1},skillPriming:{enabled:t.skillPriming?.enabled??!0,trigger:t.skillPriming?.trigger??"firstImplement",router:t.skillPriming?.router??"registry",enforceMode:t.skillPriming?.enforceMode??"directive"},skillHub:{enabled:t.skillHub?.enabled??!1,syncIntervalMs:t.skillHub?.syncIntervalMs??86400000,bootstrapUrl:t.skillHub?.bootstrapUrl??"https://skills-library.com/api/skills.json",searchFallbackUrl:t.skillHub?.searchFallbackUrl??"https://skills.sh/api/search",downloadBaseUrl:t.skillHub?.downloadBaseUrl??"https://skills.sh/api/download",embedBaseUrl:t.skillHub?.embedBaseUrl??"http://127.0.0.1:3114/v1",embedModel:t.skillHub?.embedModel??"bge-m3",minInstalls:t.skillHub?.minInstalls??0,filterDuplicates:t.skillHub?.filterDuplicates!==!1,depsCheck:t.skillHub?.depsCheck!==!1,choreDir:t.skillHub?.choreDir??AA(RA(),".agents","skills"),autoMaterialize:t.skillHub?.autoMaterialize??!0},graphSync:{killOrphanedOnInit:t.graphSync?.killOrphanedOnInit??!0,reindexOnFetch:t.graphSync?.reindexOnFetch!==!1,fetchBranch:t.graphSync?.fetchBranch??"main",autoUpgrade:t.graphSync?.autoUpgrade!==!1,upgradeCachePath:t.graphSync?.upgradeCachePath,checkGraphifyNeedsUpdate:t.graphSync?.checkGraphifyNeedsUpdate!==!1,addToGlobalGraph:t.graphSync?.addToGlobalGraph===!0},graphRetrieval:{preferredTool:t.graphRetrieval?.preferredTool??"auto",preferLocalCodegraph:t.graphRetrieval?.preferLocalCodegraph===!0,contextRouting:t.graphRetrieval?.contextRouting===!0},cliAnything:{enabled:t.cliAnything?.enabled!==!1,autoInstall:t.cliAnything?.autoInstall!==!1,autoUpgrade:t.cliAnything?.autoUpgrade!==!1,cachePath:t.cliAnything?.cachePath,upgradeCheckTtlMs:t.cliAnything?.upgradeCheckTtlMs,cliHubBin:t.cliAnything?.cliHubBin??"cli-hub",skillsBin:t.cliAnything?.skillsBin??"npx skills",installScope:t.cliAnything?.installScope??"global"},governance:{permissionPolicy:t.governance?.permissionPolicy?{mode:t.governance.permissionPolicy.mode,bashDenyPatterns:t.governance.permissionPolicy.bashDenyPatterns,bashAskPatterns:t.governance.permissionPolicy.bashAskPatterns,editDenyPaths:t.governance.permissionPolicy.editDenyPaths,editAskPaths:t.governance.permissionPolicy.editAskPaths,webfetchDenyHosts:t.governance.permissionPolicy.webfetchDenyHosts}:void 0,toolRewrite:{enabled:t.governance?.toolRewrite?.enabled??!0,descriptionSuffix:t.governance?.toolRewrite?.descriptionSuffix,hideToolIDs:t.governance?.toolRewrite?.hideToolIDs,parameterOverrides:t.governance?.toolRewrite?.parameterOverrides},commandFilter:{enabled:t.governance?.commandFilter?.enabled??!0,denyPatterns:t.governance?.commandFilter?.denyPatterns,replacementPrefix:t.governance?.commandFilter?.replacementPrefix},smallModelOverride:t.governance?.smallModelOverride?{enabled:t.governance.smallModelOverride.enabled,modelID:t.governance.smallModelOverride.modelID,providerID:t.governance.smallModelOverride.providerID}:void 0}}}function FZ(e){if(!e)return!1;if(e.enabled===!0)return!0;return e.meta_governor?.enabled===!0}async function zZ(e={}){await Promise.resolve().then(() => Xg());let n=await zl(e);return Qg(n.config)}Xg();var pn=new Map,Ll=new Map;function ey(e,t){pn.set(e,t);let n=Ll.get(e)??[];if(n.push(t.historyEntry),n.length>20)n.splice(0,n.length-20);Ll.set(e,n)}function vs(e){let t=pn.get(e);if(t!==void 0)pn.delete(e);return t}function ty(e){return pn.get(e)}function jZ(e){return pn.has(e)}function GZ(){for(let[e,t]of pn)return pn.delete(e),t;return}function ZZ(){pn.clear(),Ll.clear()}function yk(e){return Ll.get(e)??[]}class ry{store=new Map;maxEntries;ttlMs;now;constructor(e={}){this.maxEntries=e.maxEntries??100,this.ttlMs=e.ttlMs??3600000,this.now=e.now??Date.now}get(e){let t=this.store.get(e);if(!t)return;let n=this.now();if(t.expiresAtMs<=n){this.store.delete(e);return}return t.lastAccessAtMs=n,t.value}has(e){return this.get(e)!==void 0}set(e,t){let n=this.now();if(!this.store.has(e)&&this.store.size>=this.maxEntries)this.evictOldest();this.store.set(e,{value:t,expiresAtMs:n+this.ttlMs,lastAccessAtMs:n})}delete(e){return this.store.delete(e)}size(){return this.store.size}clear(){this.store.clear()}evictOldest(){let e,t=1/0;for(let[n,o]of this.store)if(o.lastAccessAtMs<t)t=o.lastAccessAtMs,e=n;if(e!==void 0)this.store.delete(e)}}class Ss{maxEntries;ttlMs;map=new Map;constructor(e,t){this.maxEntries=e;this.ttlMs=t}set(e,t){if(this.map.size>=this.maxEntries){let n=this.map.keys().next().value;if(n!==void 0)this.map.delete(n)}this.map.set(e,{value:t,expiresAtMs:Date.now()+this.ttlMs})}get(e){let t=this.map.get(e);if(!t)return;if(Date.now()>=t.expiresAtMs){this.map.delete(e);return}return t.value}has(e){return this.get(e)!==void 0}delete(e){this.map.delete(e)}get size(){return this.map.size}}function jl(e){for(let t of e){let n=t.info??{};if(n.role!=="assistant")continue;if(n.agent==="meta-governor")continue;return!1}return!0}var MA=(e,t)=>`<!-- kind: ${e}${t?` (${t})`:""} -->`;var xk={"graph-priming":"\uD83D\uDD0D","skill-priming":"\uD83C\uDFAF",intervention:"⚠️",postwave:"\uD83C\uDF0A",enforcement:"\uD83D\uDEA7",memory:"\uD83D\uDCAD"};function or(e,t){let n=["━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━",`## ${xk[t.kind]} \`[omo-meta-governor]\` AUDITOR — ${t.kind.toUpperCase()}`,"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━","",e,"","━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━",`_(synthetic message from omo-meta-governor v${"v0.38.2"} — not from the LLM)_`,"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"].join(`
246
+ stderr: ${n.stderr||"(empty)"}`,metadata:{tool:e,code:n.code,durationMs:s,sessionID:r.sessionID,...t}};let a=n.data!==null&&n.data!==void 0?typeof n.data==="string"?n.data:JSON.stringify(n.data,null,2):n.rawOutput??"";return{title:e,output:a,metadata:{tool:e,code:n.code,durationMs:s,sessionID:r.sessionID,...t}}}function Rl(e){return H({description:"Install a CLI from the CLI-Anything hub so the agent can drive that software. USAGE: omo_cli_anything_install with name='gimp' installs `cli-anything-gimp`, which exposes a `cli-anything-gimp` command. Browse the catalog with omo_cli_anything_list. See https://github.com/HKUDS/CLI-Anything for the full registry.",args:{name:we.string().min(1).describe("The CLI name to install (e.g. 'gimp', 'blender', 'drawio')")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => wo());let i=AS(t.name,e.runner,120000,"cli-hub");return Cl("omo_cli_anything_install",{name:t.name},{...i,durationMs:Date.now()-o},o,n,`Could not install '${t.name}'. Check that cli-anything-hub is installed (omo_health) and the name is correct.`)}})}function Al(e){return H({description:"List all CLIs available in the CLI-Anything hub (40+ GUI software harnesses). USAGE: omo_cli_anything_list with category='image' returns only image-related CLIs. Returns JSON with name, version, description, category, install_cmd, entry_point. See https://github.com/HKUDS/CLI-Anything.",args:{category:we.string().optional().describe("Optional category filter (e.g. 'image', 'devops', '3d', 'audio')"),source:we.enum(["harness","public","npm","all"]).optional().describe("Optional source filter. 'all' includes harness + public + npm.")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => wo());let i=PS({category:t.category,source:t.source},e.runner,30000,"cli-hub");return Cl("omo_cli_anything_list",{category:t.category,source:t.source},{...i,durationMs:Date.now()-o},o,n,"Could not list CLIs from the hub. Make sure cli-anything-hub is installed: `pip install cli-anything-hub`.")}})}function Ml(e){return H({description:"Search the CLI-Anything hub for CLIs matching a query (name, description, or category). USAGE: omo_cli_anything_search with query='cad' returns CAD-related CLIs. Returns JSON array. See https://github.com/HKUDS/CLI-Anything.",args:{query:we.string().min(1).describe("Search query (matches name, description, or category)")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => wo());let i=CS(t.query,e.runner,30000,"cli-hub");return Cl("omo_cli_anything_search",{query:t.query},{...i,durationMs:Date.now()-o},o,n,"Search failed. Make sure cli-anything-hub is installed: `pip install cli-anything-hub`.")}})}function Ul(e){return H({description:"Show details for a specific CLI in the CLI-Anything hub. USAGE: omo_cli_anything_info with name='blender' returns display name, version, description, requirements (e.g. 'blender (apt install blender)'), entry point, install command. See https://github.com/HKUDS/CLI-Anything.",args:{name:we.string().min(1).describe("The CLI name to look up")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => wo());let i=RS(t.name,e.runner,1e4,"cli-hub");return Cl("omo_cli_anything_info",{name:t.name},{...i,durationMs:Date.now()-o},o,n,`Could not find '${t.name}' in the hub. Try omo_cli_anything_search to find similar names.`)}})}xs();class Yg{entries=new Map;deliveredCount=0;expiredCount=0;register(e){this.cleanup();let t=`deliv-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,n=tk(e.mcpArgs);return this.entries.set(t,{id:t,sessionID:e.sessionID,mcpTool:e.mcpTool,mcpArgsHash:n,registeredAt:Date.now(),ttlMs:e.ttlMs??1e4}),t}markDelivered(e){this.cleanup();let t=e.mcpArgs?tk(e.mcpArgs):null;for(let[n,o]of this.entries){if(o.sessionID!==e.sessionID)continue;if(o.mcpTool!==e.mcpTool)continue;if(t!==null&&o.mcpArgsHash!==t)continue;return this.entries.delete(n),this.deliveredCount++,n}return null}async awaitDelivery(e){let t=e.timeoutMs??2000,n=Date.now();while(Date.now()-n<t){if(this.cleanup(),![...this.entries.values()].find((r)=>r.sessionID===e.sessionID&&r.mcpTool===e.mcpTool))return"delivered";await hA(50)}return"expired"}getStats(){return{pending:this.entries.size,delivered:this.deliveredCount,expired:this.expiredCount}}clearSession(e){for(let[t,n]of this.entries)if(n.sessionID===e)this.entries.delete(t)}cleanup(){let e=Date.now();for(let[t,n]of this.entries)if(e-n.registeredAt>n.ttlMs)this.entries.delete(t),this.expiredCount++}}function tk(e){return JSON.stringify(e,Object.keys(e).sort())}function hA(e){return new Promise((t)=>setTimeout(t,e))}tr();_o();import{resolve as YM}from"node:path";import{readFileSync as gA}from"node:fs";import{dirname as yA,resolve as xA}from"node:path";import{fileURLToPath as vA}from"node:url";var rk="0.0.0";try{let e=yA(vA(import.meta.url)),t=xA(e,"..","package.json"),n=JSON.parse(gA(t,"utf8"));if(typeof n.version==="string"&&n.version.length>0)rk=n.version}catch{}var at=rk,nk=["decisions_taken","decisions_skipped_continue","decisions_skipped_no_decision","decisions_skipped_no_message","decisions_skipped_below_threshold","interventions_delivered","interventions_disabled_done","interventions_disabled_cap","decisions_stored","plan_reminders_injected","bot_feedback_injected","violations_injected","protocol_audits_passed","protocol_violations_detected","git_commit_reindex","orchestrator_runs","orchestrator_errors","materialization_failures","tier3_reminders_sent","tier3_skills_created","tool_calls_observed","governance_blocks","governance_asks","governance_tools_hidden","governance_tools_rewritten","governance_commands_blocked"];function ok(){let e={};for(let t of nk)e[t]={count:0,lastOccurrenceISO:null};return e}var SA=ok(),SZ=new Date().toISOString();function Nl(e){let t=e??{},n=ok(),o=new Date().toISOString(),r=t.version??at,i=t.global===!0;return{inc(s){let a=n[s];if(!a)return;if(a.count++,a.lastOccurrenceISO=new Date().toISOString(),i){let l=SA[s];if(l)l.count++,l.lastOccurrenceISO=a.lastOccurrenceISO}},getMetrics(){return{version:r,sessionID:t.sessionID??"",startedAtISO:o,uptimeMs:Date.now()-new Date(o).getTime(),counters:{...n}}},reset(){for(let s of nk)n[s]={count:0,lastOccurrenceISO:null}}}}function ik(e,t){for(let n of t)try{if(new RegExp(n).test(e))return n}catch{}return null}function bA(e){let n=e.replace(/^\*\*\//,"").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");return new RegExp(n)}function sk(e,t){for(let n of t)try{if(bA(n).test(e))return n}catch{}return null}function _A(e,t){let n;try{n=new URL(e).host}catch{return null}for(let o of t)if(n===o||n.endsWith("."+o)||n.includes(o))return o;return null}function ak(e,t){let n=ik(e,t.bashDenyPatterns??[]);if(n!==null)return{decision:"deny",reason:'bash command matches deny pattern "'+n+'"'};let o=ik(e,t.bashAskPatterns??[]);if(o!==null)return{decision:"ask",reason:'bash command matches ask pattern "'+o+'"'};return null}function ck(e,t){let n=sk(e,t.editDenyPaths??[]);if(n!==null)return{decision:"deny",reason:'edit path matches deny pattern "'+n+'"'};let o=sk(e,t.editAskPaths??[]);if(o!==null)return{decision:"ask",reason:'edit path matches ask pattern "'+o+'"'};return null}function lk(e,t){let n=_A(e,t.webfetchDenyHosts??[]);if(n!==null)return{decision:"deny",reason:'webfetch host matches deny pattern "'+n+'"'};return null}async function uk(e,t,n,o){if(!n||n.mode===void 0)return;if(!n.mode)return;let r;switch(e.type){case"bash":r=ak(e.command,n);break;case"edit":r=ck(e.pattern,n);break;case"webfetch":r=lk(e.url,n);break;default:return}if(r===null)return;if(t.status=r.decision,r.decision==="deny")o.inc("governance_blocks");else o.inc("governance_asks")}async function dk(e,t,n,o){if(!n.enabled)return;if(n.hideToolIDs?.includes(e.toolID)){t.description="",o.inc("governance_tools_hidden");return}if(n.descriptionSuffix)t.description=(t.description??"")+n.descriptionSuffix,o.inc("governance_tools_rewritten");let r=n.parameterOverrides?.[e.toolID];if(!r||!t.parameters?.properties)return;for(let[i,s]of Object.entries(r))if(t.parameters.properties[i])t.parameters.properties[i].description=s}async function pk(e,t,n,o){if(!n.enabled)return;if(n.denyPatterns?.length)for(let r of n.denyPatterns)try{if(new RegExp(r).test(e.command))throw o.inc("governance_commands_blocked"),Error('[meta-governor] blocked command matching pattern "'+r+'"')}catch(i){if((i instanceof Error?i.message:String(i)).includes("blocked command matching"))throw i}if(n.replacementPrefix)t.parts.push({type:"text",text:n.replacementPrefix+" executing: "+e.command,synthetic:!0})}async function mk(e,t,n){if(!n.enabled)return;if(!n.modelID||!n.providerID)return;let o=e.provider.models??{},r=Object.values(o).find((i)=>typeof i==="object"&&i!==null&&i.id===n.modelID);if(r)t.model=r}import{homedir as RA}from"node:os";import{join as AA}from"node:path";function Qg(e){let t={enabled:!1,...e},n=Jd(),o=Kd(),r=Ua();return{enabled:t.enabled===!0,memory:{enabled:!0,query:t.memory?.query??"meta_governor_context",timeoutMs:t.memory?.timeoutMs??t.memory?.agentmemoryTimeoutMs??2000},tokenPredictor:{compactBurnRateThreshold:t.tokenPredictor?.compactBurnRateThreshold??500,compactUsageThreshold:t.tokenPredictor?.compactUsageThreshold??0.85,switchModelUsageThreshold:t.tokenPredictor?.switchModelUsageThreshold??0.95,delegateConsecutiveHighBurn:t.tokenPredictor?.delegateConsecutiveHighBurn??5},scoring:{...n,...t.scoring?.continueThreshold!==void 0?{continueThreshold:t.scoring.continueThreshold}:{},...t.scoring?.warnThreshold!==void 0?{warnThreshold:t.scoring.warnThreshold}:{},...t.scoring?.escalateThreshold!==void 0?{escalateThreshold:t.scoring.escalateThreshold}:{},...t.scoring?.stopThreshold!==void 0?{stopThreshold:t.scoring.stopThreshold}:{},...t.scoring?.paralysisThreshold!==void 0?{paralysisThreshold:t.scoring.paralysisThreshold}:{},...t.scoring?.defaultEscalationTarget!==void 0?{defaultEscalationTarget:t.scoring.defaultEscalationTarget}:{},oracleFrequency:t.oracle?.frequency??t.scoring?.oracleFrequency??"per-stop"},closedLoop:{...r,...t.closedLoop?.enabled!==void 0?{enabled:t.closedLoop.enabled}:{},...t.closedLoop?.minSeverityToLearn!==void 0?{minSeverityToLearn:t.closedLoop.minSeverityToLearn}:{},...t.closedLoop?.maxLessonsPerSession!==void 0?{maxLessonsPerSession:t.closedLoop.maxLessonsPerSession}:{},...t.closedLoop?.saveDecisions!==void 0?{saveDecisions:t.closedLoop.saveDecisions}:{},...t.closedLoop?.saveLessons!==void 0?{saveLessons:t.closedLoop.saveLessons}:{},...t.closedLoop?.autoRemember!==void 0?{autoRemember:{...r.autoRemember,...t.closedLoop.autoRemember}}:{}},decision:{...o,...t.decision?.maxHistoryPerSession!==void 0?{maxHistoryPerSession:t.decision.maxHistoryPerSession}:{},...t.decision?.forceContinueAfterStops!==void 0?{forceContinueAfterStops:t.decision.forceContinueAfterStops}:{},...t.decision?.warnMessageTemplate!==void 0?{warnMessageTemplate:t.decision.warnMessageTemplate}:{},...t.decision?.escalateMessageTemplate!==void 0?{escalateMessageTemplate:t.decision.escalateMessageTemplate}:{},...t.decision?.stopMessageTemplate!==void 0?{stopMessageTemplate:t.decision.stopMessageTemplate}:{}},modelOverride:t.modelOverride?{providerID:t.modelOverride.providerID,modelID:t.modelOverride.modelID,modelLimit:t.modelOverride.modelLimit,temperature:t.modelOverride.temperature??0.2,topP:t.modelOverride.topP??1,maxTokens:t.modelOverride.maxTokens??2048,reasoning:t.modelOverride.reasoning??!1,verbosity:t.modelOverride.verbosity??"minimal"}:void 0,intervention:{mode:t.intervention?.mode??"silent",includeDecisionHistory:t.intervention?.includeDecisionHistory??!0,maxHistoryMessages:t.intervention?.maxHistoryMessages??5,minActionForMessage:t.intervention?.minActionForMessage??"stop",maxInterventionsPerSession:t.intervention?.maxInterventionsPerSession??3,respectDoneSignal:t.intervention?.respectDoneSignal??!0,phaseAwareDoneSignal:t.intervention?.phaseAwareDoneSignal??!1,persistToSession:t.intervention?.persistToSession??!0,compactionLoopGuard:{enabled:t.intervention?.compactionLoopGuard?.enabled??!0,maxOverflowRecoveries:Math.max(1,t.intervention?.compactionLoopGuard?.maxOverflowRecoveries??1)}},postWave:{enabled:t.postWave?.enabled??t.intervention?.phaseAwareDoneSignal===!0,repoMode:t.postWave?.repoMode??"auto",aasToolPrefix:t.postWave?.aasToolPrefix??"aas",ciTimeoutMs:t.postWave?.ciTimeoutMs??600000,maxRetriesPerWave:t.postWave?.maxRetriesPerWave??1,reinjectCooldownMs:t.postWave?.reinjectCooldownMs??60000,respectSilentMode:t.postWave?.respectSilentMode??!1,...t.postWave?.ownRepoDirective!==void 0?{ownRepoDirective:t.postWave.ownRepoDirective}:{},...t.postWave?.thirdPartyDirective!==void 0?{thirdPartyDirective:t.postWave.thirdPartyDirective}:{}},protocolEnforcement:{enabled:t.protocolEnforcement?.enabled??!1,path:t.protocolEnforcement?.path,injectIntoSystem:t.protocolEnforcement?.injectIntoSystem??!1,auditToolCalls:t.protocolEnforcement?.auditToolCalls??!1},skillPriming:{enabled:t.skillPriming?.enabled??!0,trigger:t.skillPriming?.trigger??"firstImplement",router:t.skillPriming?.router??"registry",enforceMode:t.skillPriming?.enforceMode??"directive"},skillHub:{enabled:t.skillHub?.enabled??!1,syncIntervalMs:t.skillHub?.syncIntervalMs??86400000,bootstrapUrl:t.skillHub?.bootstrapUrl??"https://skills-library.com/api/skills.json",searchFallbackUrl:t.skillHub?.searchFallbackUrl??"https://skills.sh/api/search",downloadBaseUrl:t.skillHub?.downloadBaseUrl??"https://skills.sh/api/download",embedBaseUrl:t.skillHub?.embedBaseUrl??"http://127.0.0.1:3114/v1",embedModel:t.skillHub?.embedModel??"bge-m3",minInstalls:t.skillHub?.minInstalls??0,filterDuplicates:t.skillHub?.filterDuplicates!==!1,depsCheck:t.skillHub?.depsCheck!==!1,choreDir:t.skillHub?.choreDir??AA(RA(),".agents","skills"),autoMaterialize:t.skillHub?.autoMaterialize??!0},graphSync:{killOrphanedOnInit:t.graphSync?.killOrphanedOnInit??!0,reindexOnFetch:t.graphSync?.reindexOnFetch!==!1,fetchBranch:t.graphSync?.fetchBranch??"main",autoUpgrade:t.graphSync?.autoUpgrade!==!1,upgradeCachePath:t.graphSync?.upgradeCachePath,checkGraphifyNeedsUpdate:t.graphSync?.checkGraphifyNeedsUpdate!==!1,addToGlobalGraph:t.graphSync?.addToGlobalGraph===!0},graphRetrieval:{preferredTool:t.graphRetrieval?.preferredTool??"auto",preferLocalCodegraph:t.graphRetrieval?.preferLocalCodegraph===!0,contextRouting:t.graphRetrieval?.contextRouting===!0},cliAnything:{enabled:t.cliAnything?.enabled!==!1,autoInstall:t.cliAnything?.autoInstall!==!1,autoUpgrade:t.cliAnything?.autoUpgrade!==!1,cachePath:t.cliAnything?.cachePath,upgradeCheckTtlMs:t.cliAnything?.upgradeCheckTtlMs,cliHubBin:t.cliAnything?.cliHubBin??"cli-hub",skillsBin:t.cliAnything?.skillsBin??"npx skills",installScope:t.cliAnything?.installScope??"global"},governance:{permissionPolicy:t.governance?.permissionPolicy?{mode:t.governance.permissionPolicy.mode,bashDenyPatterns:t.governance.permissionPolicy.bashDenyPatterns,bashAskPatterns:t.governance.permissionPolicy.bashAskPatterns,editDenyPaths:t.governance.permissionPolicy.editDenyPaths,editAskPaths:t.governance.permissionPolicy.editAskPaths,webfetchDenyHosts:t.governance.permissionPolicy.webfetchDenyHosts}:void 0,toolRewrite:{enabled:t.governance?.toolRewrite?.enabled??!0,descriptionSuffix:t.governance?.toolRewrite?.descriptionSuffix,hideToolIDs:t.governance?.toolRewrite?.hideToolIDs,parameterOverrides:t.governance?.toolRewrite?.parameterOverrides},commandFilter:{enabled:t.governance?.commandFilter?.enabled??!0,denyPatterns:t.governance?.commandFilter?.denyPatterns,replacementPrefix:t.governance?.commandFilter?.replacementPrefix},smallModelOverride:t.governance?.smallModelOverride?{enabled:t.governance.smallModelOverride.enabled,modelID:t.governance.smallModelOverride.modelID,providerID:t.governance.smallModelOverride.providerID}:void 0}}}function FZ(e){if(!e)return!1;if(e.enabled===!0)return!0;return e.meta_governor?.enabled===!0}async function zZ(e={}){await Promise.resolve().then(() => Xg());let n=await zl(e);return Qg(n.config)}Xg();var pn=new Map,Ll=new Map;function ey(e,t){pn.set(e,t);let n=Ll.get(e)??[];if(n.push(t.historyEntry),n.length>20)n.splice(0,n.length-20);Ll.set(e,n)}function vs(e){let t=pn.get(e);if(t!==void 0)pn.delete(e);return t}function ty(e){return pn.get(e)}function jZ(e){return pn.has(e)}function GZ(){for(let[e,t]of pn)return pn.delete(e),t;return}function ZZ(){pn.clear(),Ll.clear()}function yk(e){return Ll.get(e)??[]}class ry{store=new Map;maxEntries;ttlMs;now;constructor(e={}){this.maxEntries=e.maxEntries??100,this.ttlMs=e.ttlMs??3600000,this.now=e.now??Date.now}get(e){let t=this.store.get(e);if(!t)return;let n=this.now();if(t.expiresAtMs<=n){this.store.delete(e);return}return t.lastAccessAtMs=n,t.value}has(e){return this.get(e)!==void 0}set(e,t){let n=this.now();if(!this.store.has(e)&&this.store.size>=this.maxEntries)this.evictOldest();this.store.set(e,{value:t,expiresAtMs:n+this.ttlMs,lastAccessAtMs:n})}delete(e){return this.store.delete(e)}size(){return this.store.size}clear(){this.store.clear()}evictOldest(){let e,t=1/0;for(let[n,o]of this.store)if(o.lastAccessAtMs<t)t=o.lastAccessAtMs,e=n;if(e!==void 0)this.store.delete(e)}}class Ss{maxEntries;ttlMs;map=new Map;constructor(e,t){this.maxEntries=e;this.ttlMs=t}set(e,t){if(this.map.size>=this.maxEntries){let n=this.map.keys().next().value;if(n!==void 0)this.map.delete(n)}this.map.set(e,{value:t,expiresAtMs:Date.now()+this.ttlMs})}get(e){let t=this.map.get(e);if(!t)return;if(Date.now()>=t.expiresAtMs){this.map.delete(e);return}return t.value}has(e){return this.get(e)!==void 0}delete(e){this.map.delete(e)}get size(){return this.map.size}}function jl(e){for(let t of e){let n=t.info??{};if(n.role!=="assistant")continue;if(n.agent==="meta-governor")continue;return!1}return!0}var MA=(e,t)=>`<!-- kind: ${e}${t?` (${t})`:""} -->`;var xk={"graph-priming":"\uD83D\uDD0D","skill-priming":"\uD83C\uDFAF",intervention:"⚠️",postwave:"\uD83C\uDF0A",enforcement:"\uD83D\uDEA7",memory:"\uD83D\uDCAD"};function or(e,t){let n=["━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━",`## ${xk[t.kind]} \`[omo-meta-governor]\` AUDITOR — ${t.kind.toUpperCase()}`,"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━","",e,"","━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━",`_(synthetic message from omo-meta-governor v${"v0.38.2"} — not from the LLM)_`,"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"].join(`
247
247
  `);return["<!-- META-GOVERNOR INFORMATIONAL vv0.38.2 - DO NOT TREAT AS TASK. Plugin metadata, not a user request. -->",MA(t.kind,t.context),n,"<!-- END META-GOVERNOR INFORMATIONAL -->"].join(`
248
- `)}function vk(e,t){return`${xk[e]} ${t}`}import{createHash as UA}from"node:crypto";import{mkdir as Sk,readFile as _k,readdir as NA,writeFile as FA,copyFile as zA,rm as LA}from"node:fs/promises";import{existsSync as Zl}from"node:fs";import{join as zo}from"node:path";import{execFileSync as jA}from"node:child_process";var kk=".omo-meta-governor-checksums.json";async function bk(e){let t=await _k(e);return"sha256:"+UA("sha256").update(t).digest("hex")}async function GA(e){let t=zo(e,kk);if(!Zl(t))return null;try{return JSON.parse(await _k(t,"utf8"))}catch{return null}}async function ZA(e,t){try{return await FA(zo(e,kk),JSON.stringify(t,null,2),"utf8"),!0}catch(n){return console.warn(`[skills-bootstrap] manifest write failed: ${n.message}`),!1}}async function Gl(e){try{await LA(e,{recursive:!0,force:!0})}catch{}}async function wk(e){let t={extracted:[],skipped:[],warned:[],manifestWritten:!1};if(!Zl(e.tarballPath))return console.warn(`[skills-bootstrap] tarball missing: ${e.tarballPath}`),t;let n=zo(e.globalDir,".bootstrap-stage");await Gl(n);try{await Sk(n,{recursive:!0})}catch(s){return console.warn(`[skills-bootstrap] stage dir creation failed: ${s.message}`),t}try{jA("tar",["-xzf",e.tarballPath,"-C",n],{stdio:["ignore","ignore","pipe"]})}catch(s){return console.warn(`[skills-bootstrap] tarball extraction failed: ${s.message}`),await Gl(n),t}let o=await GA(e.globalDir)??{version:e.pluginVersion,skills:{}},r={version:e.pluginVersion,skills:{...o.skills}},i=[];try{i=(await NA(n,{withFileTypes:!0})).filter((a)=>a.isDirectory()).map((a)=>a.name)}catch(s){return console.warn(`[skills-bootstrap] stage dir read failed: ${s.message}`),await Gl(n),t}for(let s of i)try{let a=zo(n,s,"SKILL.md");if(!Zl(a))continue;let l=await bk(a),c=zo(e.globalDir,s),u=zo(c,"SKILL.md");if(!Zl(u))await Sk(c,{recursive:!0}),await zA(a,u),t.extracted.push(s);else{let f=await bk(u);if(f===l)t.skipped.push(s);else console.warn(`[skills-bootstrap] skill '${s}' was modified by user; skipping. bundled: ${l}, local: ${f}`),t.warned.push(s)}r.skills[s]=l}catch(a){console.warn(`[skills-bootstrap] error processing '${s}': ${a.message}`)}return await Gl(n),t.manifestWritten=await ZA(e.globalDir,r),t}import{statSync as XM,readFileSync as gy,existsSync as QM}from"node:fs";import{homedir as eU}from"node:os";import{execSync as tU,execFileSync as mw}from"node:child_process";import{join as ks,dirname as rU}from"node:path";import{readFile as WA}from"node:fs/promises";import{resolve as HA}from"node:path";import{homedir as JA}from"node:os";var zr=["write","edit","edit_block","multi_edit","apply_patch","ast_grep_replace","refactor","desktop-commander_write_file","desktop-commander_edit_block"];var BA=["brainstorming","writing-plans","test-driven-development","systematic-debugging","subagent-driven-development"];function Ik(e){let t=e==="aas"?"registry":e,n=["[SKILL PRIMING] This session involves implementation work. Select precise skills for this task before writing code:"],o=1;if(t==="registry"||t==="both")n.push(`${o}. Query the skill-hub catalog (omo_skill_find) for the 2-3 capabilities most relevant to this task (e.g. testing, architecture, language-specific), and inspect candidates with omo_skill_get.`),o++,n.push(`${o}. Compose a minimal stack of 2-3 skills by loading each via its installer (e.g. \`npx skills add <owner/repo/slug>\` via omo_skill_add).`),o++;if(t==="superpowers"||t==="both")n.push(`${o}. If a matching superpowers skill is available and not yet active (${BA.join(" / ")}), delegate it to a sub-agent via \`task(category='<category>', load_skills=['<slug>'])\` — the skill's content is injected into the sub-agent's system prompt. (Requires the superpowers plugin to be installed separately.)`),o++;if(t==="both")n.push("If a superpowers skill is already active, skip the catalog step.");n.push("Do NOT enumerate the full catalog — keep the stack minimal and task-specific.");let r=n.join(`
249
- `);return or(r,{kind:"skill-priming",context:`router=${t}`})}function Tk(e){return vk("skill-priming",`Skill priming (${e==="aas"?"registry":e}): nudging agent to discover relevant skills before implementation.`)}function Ek(e){if(e.trigger==="sessionStart")return!0;if(e.implementationToolSeen)return!0;return e.recentToolCalls.some((t)=>zr.includes(t))}var qA=[/[\\/](\.tmp|\.scratch|scratch|tmp|trash|throwaway)[\\/]/i,/[\\/]tests?[\\/]|^tests?[\\/]/,/[\\/]__tests__[\\/]/,/[\\/]fixtures?[\\/]/,/[\\/]examples?[\\/]/,/\.test\.[a-z]+$/,/\.spec\.[a-z]+$/],VA=50;function $k(e,t){if(e==="edit"||e==="edit_block"||e==="multi_edit"||e==="apply_patch"||e==="ast_grep_replace"||e==="refactor"||e==="desktop-commander_edit_block")return!0;if(e!=="write"&&e!=="desktop-commander_write_file")return!1;let n=t,o=typeof n?.filePath==="string"?n.filePath:typeof n?.path==="string"?n.path:"";if(o&&qA.some((i)=>i.test(o)))return!0;let r=n?.content;if(typeof r==="string"&&r.split(`
250
- `).length<=VA)return!0;return!1}function Ok(e,t){let n=t,o=typeof n?.filePath==="string"?n.filePath:typeof n?.path==="string"?n.path:"",r=/\.([a-z]+)$/i.exec(o),i=r?r[1].toLowerCase():"";return`omo_skill_find "${{ts:"typescript",tsx:"typescript-react",js:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cs:"csharp",cpp:"cpp",c:"c",sh:"bash",bash:"bash",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",toml:"config",sql:"sql",html:"html",css:"css",scss:"css",vue:"vue",svelte:"svelte"}[i]??"code"} ${e}" --limit 5`}var ny=HA(JA(),".config","opencode","sisyphus-mandatory","sisyphus-mandatory.md");async function Dk(e){return await WA(e??ny,"utf-8")}function Pk(e,t){let n=t?.oracleVerified===!0,o=t?.filesChanged??0,r=["","## Sisyphus Protocol Enforcement","","You MUST follow these Sisyphus protocol rules:","","1. **Pre-response Memory Check**: Before any action, read `<project-memory>` and `<session-history-since>` blocks in context. Cite `<memory id>` for any fact used from memory. Do not ask questions whose answers are in those blocks.","","2. **Codebase Graph First**: Before using grep/glob/read for architecture or symbol queries, check whether `.codegraph/` or `graphify-out/` exists. If so, use codegraph/graphify tools first, then grep/read only as last resort.","","3. **Tool Routing Table**: Match common intents to the correct tool:",' - "we did this before" / "you should know" → `agentmemory_memory_recall`'," - Starting a task that resembles a previous one → `agentmemory_memory_smart_search`"," - Before asking the user a clarifying question → `agentmemory_memory_recall` first"," - Save durable insight/decision/rule → `agentmemory_memory_save`",""];if(/\boracle\b/i.test(e)&&!(n&&o>0))r.push("4. **Post-task Oracle Verification**: If files touched >= 3 OR any INVOKE trigger matches, invoke Oracle with the exact format:",' `task(subagent_type="oracle", run_in_background=false, prompt="Verify: ...")`'," - INVOKE triggers: created 1+ new file, modified abstraction, touched security/auth paths, modified DB/persistence, modified CI/CD, added/removed dependency, modified perf-critical path, todo had 2+ completed items."," - SKIP only when: files touched <= 2, no new file, no dependency change, single-step task, change is typo/comment/rename only."," - Verdict: PASS → done. FAIL/CONDITIONAL → fix and re-invoke. Max 3 invocations."," - Cost: Max 3 oracle invocations per task. Skip rate: Must NOT skip Oracle on 2+ file change.","");return r.push("5. **Parallel Query Rule**: Fire independent tool queries in the same turn. Do NOT serialize independent memory/context queries.","","6. **Empty-Result Escalation**: On empty `agentmemory_memory_recall`, fire `agentmemory_memory_smart_search` + `agentmemory_memory_export` before asking the user.","","7. **Hard Rules (No Exceptions)**:"," - Do NOT ask 'where is X?' if memory or session record already contains it."," - Do NOT claim 'I don't know' before firing at least 2 different recall tools."," - Do NOT re-issue clarifying questions whose answer is in `<project-memory>` or `<session-history-since>`."," - Do NOT suppress type errors with `as any`, `@ts-ignore`, or `@ts-expect-error`."," - Do NOT leave empty catch blocks `catch(e) {}`.",' - Do NOT start a fresh agent via `task()` when `task(task_id="ses_...")` (continuation) exists — use continuation IDs.'," - Do NOT batch-complete todos — mark each one `completed` immediately after finishing."," - Do NOT skip creating todos for multi-step tasks.","","8. **Self-Check Before Responding**:"," - Verify you read `<project-memory>` and `<session-history-since>` blocks."," - Verify you cited `<memory id>` for any fact used from memory."," - Verify you did not ask a question whose answer is in those blocks."," - For multi-file changes, verify Oracle was invoked."," - For codebase exploration, verify codegraph/graphify was tried before grep/read."," - After discovering something non-obvious, save it with `agentmemory_memory_save` so future sessions benefit."," - Do NOT save routine operations (file reads, greps, list commands), trivial decisions, or facts already covered by existing memory. Save only novel insights, non-obvious patterns, or corrections to previous assumptions.","","9. **CI Verification Loop (NON-NEGOTIABLE)**: After EVERY step of an implementation plan that produces a code change you intend to keep, you MUST execute the full CI loop BEFORE moving to the next step:"," a. Commit the changes atomically (one commit per verified increment, never omnibus)."," b. Push to the remote that has CI configured (own repo: `git push origin <branch>`. Fork upstream: `git push fork <branch>` + open/update PR)."," c. Wait for the CI run triggered by the push to reach a terminal state (`gh run watch <run-id> --exit-status`).",' d. Assert `conclusion == "success"` on EVERY job. If any job fails, fix the regression, re-push, and re-verify until all jobs are green.'," e. Capture the green run-id so the final plan-completion message can cite it as evidence."," - Anti-pattern this rule kills: running local tests, seeing 0 failures, declaring done, then shipping the next step on top of an unverified CI. Local green is NOT CI green. Pushed-not-watched is NOT CI green."," - At the END of the plan (when the last step is done), run a final guarantee: `gh run list --branch <branch> --limit 5` and assert EVERY recent run on this branch has `conclusion=success`. If any run shows `failure`, surface it explicitly to the user with the run-id, the failing job, and the log excerpt - do NOT claim plan success."," - For fork -> upstream PR workflow: verify the workflow_run on the upstream repo (the PR's head ref), not just the fork. Both must be green."," - This rule applies whenever the repo has a `.github/workflows/*.yml` file (or equivalent CI config). For repos without CI, document the absence explicitly."," - If the user explicitly says 'skip CI' or 'local only', this rule is suppressed for that turn ONLY - re-engage on next step.",""),r.join(`
251
- `)}function Ck(e,t,n){let o=[],r=n.recentToolCalls??[],i=n.recentWriteContents??[],s=n.memorySaved??!1,a=n.batchCompletions??0;if((e==="grep"||e==="glob")&&(n.hasCodegraphDir||n.hasGraphifyDir)){let f=n.hasCodegraphDir?".codegraph":"graphify-out";o.push({rule:"codebase-graph-first",tool:e,severity:"media",detail:`Used ${e} when ${f} exists — should use codegraph/graphify first for architecture and symbol queries.`})}if(e==="task"&&t&&typeof t==="object"){let f=t;if(!f.task_id&&typeof f.prompt==="string"&&r.length>3)o.push({rule:"continuation-discipline",tool:e,severity:"leve",detail:`Started a new task() without task(task_id="ses_...") continuation ID. Use task_id to preserve the subagent's full context and save tokens.`})}if(zr.includes(e)){let f=typeof t==="object"&&t!==null?JSON.stringify(t):String(t??""),h=/@ts-ignore|@ts-expect-error/.test(f),m=/\bas any\b/.test(f);if(h&&m)o.push({rule:"no-type-suppression",tool:e,severity:"grave",detail:"File write contains both @ts-ignore/@ts-expect-error AND 'as any' — double type suppression. "+"Both are forbidden by the Sisyphus protocol."});else if(h)o.push({rule:"no-type-suppression",tool:e,severity:"media",detail:"File write contains @ts-ignore or @ts-expect-error — both are forbidden. "+"Fix the underlying type error instead."});else if(m)o.push({rule:"no-type-suppression",tool:e,severity:"media",detail:"File write contains 'as any' — type suppression forbidden. "+"Use proper type narrowing instead."})}if(zr.includes(e)){let f=typeof t==="object"&&t!==null?JSON.stringify(t):String(t??"");if(/catch\s*\(\s*\w+\s*\)\s*\{\s*\}/.test(f))o.push({rule:"no-empty-catch",tool:e,severity:"media",detail:"Empty catch block detected — `catch(e) {}` is forbidden. "+"Log the error or handle it gracefully."})}if(["codegraph_explore","graphify query"].includes(e)&&r.length>=2){if(!s)o.push({rule:"save-discovery-to-memory",tool:e,severity:"leve",detail:`Used ${e} to discover code but no memory save was made afterwards. Save non-obvious findings with agentmemory_memory_save so future sessions benefit.`})}if(a>0&&e!=="todowrite")o.push({rule:"no-batch-todo-completion",tool:e,severity:"leve",detail:"Batch todo completion detected. Each todo must be marked `completed` immediately "+"after finishing — do not batch-complete multiple items."});if(n.emptyRecall&&!n.escalationAttempted){if(e.startsWith("question")||e==="ask")o.push({rule:"empty-result-escalation",tool:e,severity:"grave",detail:"Memory recall returned empty but agent did not fire smart_search + export before asking the user. Steps 1-3 of empty-result escalation protocol are mandatory."})}let c=["agentmemory_memory_recall","agentmemory_memory_smart_search","agentmemory_memory_save"];if(!n.memoryToolsUsed.some((f)=>c.some((h)=>f.startsWith(h)))&&(e.startsWith("question")||e==="ask"))o.push({rule:"memory-first",tool:e,severity:"grave",detail:"Asked a question without first querying memory. Must fire agentmemory_memory_recall or agentmemory_memory_smart_search before asking the user."});if(n.filesChanged>=3&&!n.oracleInvoked&&zr.includes(e))o.push({rule:"oracle-verification",tool:e,severity:"media",detail:`Files changed (${n.filesChanged}) >= 3 but Oracle was not invoked. The POST-TASK ORACLE VERIFICATION protocol requires Oracle invocation on multi-file changes.`});return o}import{stat as IM}from"fs";import{stat as TM,readdir as EM}from"fs/promises";import{EventEmitter as $M}from"events";import*as oe from"path";import{stat as KA,lstat as Rk,readdir as YA,realpath as XA}from"node:fs/promises";import{Readable as QA}from"node:stream";import{resolve as Ak,relative as eM,join as tM,sep as rM}from"node:path";var Nt={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},oy={root:".",fileFilter:(e)=>!0,directoryFilter:(e)=>!0,type:Nt.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(oy);var Fk="READDIRP_RECURSIVE_ERROR",nM=new Set(["ENOENT","EPERM","EACCES","ELOOP",Fk]),Mk=[Nt.DIR_TYPE,Nt.EVERYTHING_TYPE,Nt.FILE_DIR_TYPE,Nt.FILE_TYPE],oM=new Set([Nt.DIR_TYPE,Nt.EVERYTHING_TYPE,Nt.FILE_DIR_TYPE]),iM=new Set([Nt.EVERYTHING_TYPE,Nt.FILE_DIR_TYPE,Nt.FILE_TYPE]),sM=(e)=>nM.has(e.code),aM=process.platform==="win32",Uk=(e)=>!0,Nk=(e)=>{if(e===void 0)return Uk;if(typeof e==="function")return e;if(typeof e==="string"){let t=e.trim();return(n)=>n.basename===t}if(Array.isArray(e)){let t=e.map((n)=>n.trim());return(n)=>t.some((o)=>n.basename===o)}return Uk};class zk extends QA{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...oy,...e},{root:n,type:o}=t;this._fileFilter=Nk(t.fileFilter),this._directoryFilter=Nk(t.directoryFilter);let r=t.lstat?Rk:KA;if(aM)this._stat=(i)=>r(i,{bigint:!0});else this._stat=r;this._maxDepth=t.depth??oy.depth,this._wantsDir=o?oM.has(o):!1,this._wantsFile=o?iM.has(o):!1,this._wantsEverything=o===Nt.EVERYTHING_TYPE,this._root=Ak(n),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(this.reading)return;this.reading=!0;try{while(!this.destroyed&&e>0){let t=this.parent,n=t&&t.files;if(n&&n.length>0){let{path:o,depth:r}=t,i=n.splice(0,e).map((a)=>this._formatEntry(a,o)),s=await Promise.all(i);for(let a of s){if(!a)continue;if(this.destroyed)return;let l=await this._getEntryType(a);if(l==="directory"&&this._directoryFilter(a)){if(r<=this._maxDepth)this.parents.push(this._exploreDir(a.fullPath,r+1));if(this._wantsDir)this.push(a),e--}else if((l==="file"||this._includeAsFile(a))&&this._fileFilter(a)){if(this._wantsFile)this.push(a),e--}}}else{let o=this.parents.pop();if(!o){this.push(null);break}if(this.parent=await o,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}async _exploreDir(e,t){let n;try{n=await YA(e,this._rdOptions)}catch(o){this._onError(o)}return{files:n,depth:t,path:e}}async _formatEntry(e,t){let n,o=this._isDirent?e.name:e;try{let r=Ak(tM(t,o));n={path:eM(this._root,r),fullPath:r,basename:o},n[this._statsProp]=this._isDirent?e:await this._stat(r)}catch(r){this._onError(r);return}return n}_onError(e){if(sM(e)&&!this.destroyed)this.emit("warn",e);else this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let t=e[this._statsProp];if(t.isFile())return"file";if(t.isDirectory())return"directory";if(t&&t.isSymbolicLink()){let n=e.fullPath;try{let o=await XA(n),r=await Rk(o);if(r.isFile())return"file";if(r.isDirectory()){let i=o.length;if(n.startsWith(o)&&n.substr(i,1)===rM){let s=Error(`Circular symlink detected: "${n}" points to "${o}"`);return s.code=Fk,this._onError(s)}return"directory"}}catch(o){return this._onError(o),""}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}}function Lk(e,t={}){let n=t.entryType||t.type;if(n==="both")n=Nt.FILE_DIR_TYPE;if(n)t.type=n;if(!e)throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");else if(typeof e!=="string")throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");else if(n&&!Mk.includes(n))throw Error(`readdirp: Invalid type passed. Use one of ${Mk.join(", ")}`);return t.root=e,new zk(t)}import{watchFile as cM,unwatchFile as jk,watch as lM}from"fs";import{open as uM,stat as Zk,lstat as dM,realpath as iy}from"fs/promises";import*as Ne from"path";import{type as pM}from"os";var mM="data",cy="end",Bk="close",Wl=()=>{};var Hl=process.platform,ly=Hl==="win32",fM=Hl==="darwin",hM=Hl==="linux",gM=Hl==="freebsd",qk=pM()==="OS400",je={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},ir=je,yM="watch",xM={lstat:dM,stat:Zk},qn="listeners",Bl="errHandlers",Lo="rawEmitters",vM=[qn,Bl,Lo],SM=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),bM=(e)=>SM.has(Ne.extname(e).slice(1).toLowerCase()),ay=(e,t)=>{if(e instanceof Set)e.forEach(t);else t(e)},bs=(e,t,n)=>{let o=e[t];if(!(o instanceof Set))e[t]=o=new Set([o]);o.add(n)},_M=(e)=>(t)=>{let n=e[t];if(n instanceof Set)n.clear();else delete e[t]},_s=(e,t,n)=>{let o=e[t];if(o instanceof Set)o.delete(n);else if(o===n)delete e[t]},Vk=(e)=>e instanceof Set?e.size===0:!e,ql=new Map;function Gk(e,t,n,o,r){let i=(s,a)=>{if(n(e),r(s,a,{watchedPath:e}),a&&e!==a)Vl(Ne.resolve(e,a),qn,Ne.join(e,a))};try{return lM(e,{persistent:t.persistent},i)}catch(s){o(s);return}}var Vl=(e,t,n,o,r)=>{let i=ql.get(e);if(!i)return;ay(i[t],(s)=>{s(n,o,r)})},kM=(e,t,n,o)=>{let{listener:r,errHandler:i,rawEmitter:s}=o,a=ql.get(t),l;if(!n.persistent){if(l=Gk(e,n,r,i,s),!l)return;return l.close.bind(l)}if(a)bs(a,qn,r),bs(a,Bl,i),bs(a,Lo,s);else{if(l=Gk(e,n,Vl.bind(null,t,qn),i,Vl.bind(null,t,Lo)),!l)return;l.on(ir.ERROR,async(c)=>{let u=Vl.bind(null,t,Bl);if(a)a.watcherUnusable=!0;if(ly&&c.code==="EPERM")try{await(await uM(e,"r")).close(),u(c)}catch(f){}else u(c)}),a={listeners:r,errHandlers:i,rawEmitters:s,watcher:l},ql.set(t,a)}return()=>{if(_s(a,qn,r),_s(a,Bl,i),_s(a,Lo,s),Vk(a.listeners))a.watcher.close(),ql.delete(t),vM.forEach(_M(a)),a.watcher=void 0,Object.freeze(a)}},sy=new Map,wM=(e,t,n,o)=>{let{listener:r,rawEmitter:i}=o,s=sy.get(t),a=s&&s.options;if(a&&(a.persistent<n.persistent||a.interval>n.interval))jk(t),s=void 0;if(s)bs(s,qn,r),bs(s,Lo,i);else s={listeners:r,rawEmitters:i,options:n,watcher:cM(t,n,(l,c)=>{ay(s.rawEmitters,(f)=>{f(ir.CHANGE,t,{curr:l,prev:c})});let u=l.mtimeMs;if(l.size!==c.size||u>c.mtimeMs||u===0)ay(s.listeners,(f)=>f(e,l))})},sy.set(t,s);return()=>{if(_s(s,qn,r),_s(s,Lo,i),Vk(s.listeners))sy.delete(t),jk(t),s.options=s.watcher=void 0,Object.freeze(s)}};class uy{constructor(e){this.fsw=e,this._boundHandleError=(t)=>e._handleError(t)}_watchWithNodeFs(e,t){let n=this.fsw.options,o=Ne.dirname(e),r=Ne.basename(e);this.fsw._getWatchedDir(o).add(r);let s=Ne.resolve(e),a={persistent:n.persistent};if(!t)t=Wl;let l;if(n.usePolling){let c=n.interval!==n.binaryInterval;a.interval=c&&bM(r)?n.binaryInterval:n.interval,l=wM(e,s,a,{listener:t,rawEmitter:this.fsw._emitRaw})}else l=kM(e,s,a,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return l}_handleFile(e,t,n){if(this.fsw.closed)return;let o=Ne.dirname(e),r=Ne.basename(e),i=this.fsw._getWatchedDir(o),s=t;if(i.has(r))return;let a=async(c,u)=>{if(!this.fsw._throttle(yM,e,5))return;if(!u||u.mtimeMs===0)try{let f=await Zk(e);if(this.fsw.closed)return;let{atimeMs:h,mtimeMs:m}=f;if(!h||h<=m||m!==s.mtimeMs)this.fsw._emit(ir.CHANGE,e,f);if((fM||hM||gM)&&s.ino!==f.ino){this.fsw._closeFile(c),s=f;let y=this._watchWithNodeFs(e,a);if(y)this.fsw._addPathCloser(c,y)}else s=f}catch(f){this.fsw._remove(o,r)}else if(i.has(r)){let{atimeMs:f,mtimeMs:h}=u;if(!f||f<=h||h!==s.mtimeMs)this.fsw._emit(ir.CHANGE,e,u);s=u}},l=this._watchWithNodeFs(e,a);if(!(n&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(ir.ADD,e,0))return;this.fsw._emit(ir.ADD,e,t)}return l}async _handleSymlink(e,t,n,o){if(this.fsw.closed)return;let r=e.fullPath,i=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let s;try{s=await iy(n)}catch(a){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;if(i.has(o)){if(this.fsw._symlinkPaths.get(r)!==s)this.fsw._symlinkPaths.set(r,s),this.fsw._emit(ir.CHANGE,n,e.stats)}else i.add(o),this.fsw._symlinkPaths.set(r,s),this.fsw._emit(ir.ADD,n,e.stats);return this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(e,t,n,o,r,i,s){if(e=Ne.join(e,""),s=this.fsw._throttle("readdir",e,1000),!s)return;let a=this.fsw._getWatchedDir(n.path),l=new Set,c=this.fsw._readdirp(e,{fileFilter:(u)=>n.filterPath(u),directoryFilter:(u)=>n.filterDir(u)});if(!c)return;return c.on(mM,async(u)=>{if(this.fsw.closed){c=void 0;return}let f=u.path,h=Ne.join(e,f);if(l.add(f),u.stats.isSymbolicLink()&&await this._handleSymlink(u,e,h,f))return;if(this.fsw.closed){c=void 0;return}if(f===o||!o&&!a.has(f))this.fsw._incrReadyCount(),h=Ne.join(r,Ne.relative(r,h)),this._addToNodeFs(h,t,n,i+1)}).on(ir.ERROR,this._boundHandleError),new Promise((u,f)=>{if(!c)return f();c.once(cy,()=>{if(this.fsw.closed){c=void 0;return}let h=s?s.clear():!1;if(u(void 0),a.getChildren().filter((m)=>m!==e&&!l.has(m)).forEach((m)=>{this.fsw._remove(e,m)}),c=void 0,h)this._handleRead(e,!1,n,o,r,i,s)})})}async _handleDir(e,t,n,o,r,i,s){let a=this.fsw._getWatchedDir(Ne.dirname(e)),l=a.has(Ne.basename(e));if(!(n&&this.fsw.options.ignoreInitial)&&!r&&!l)this.fsw._emit(ir.ADD_DIR,e,t);a.add(Ne.basename(e)),this.fsw._getWatchedDir(e);let c,u,f=this.fsw.options.depth;if((f==null||o<=f)&&!this.fsw._symlinkPaths.has(s)){if(!r){if(await this._handleRead(e,n,i,r,e,o,c),this.fsw.closed)return}u=this._watchWithNodeFs(e,(h,m)=>{if(m&&m.mtimeMs===0)return;this._handleRead(h,!1,i,r,e,o,c)})}return u}async _addToNodeFs(e,t,n,o,r){let i=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return i(),!1;let s=this.fsw._getWatchHelpers(e);if(n)s.filterPath=(a)=>n.filterPath(a),s.filterDir=(a)=>n.filterDir(a);try{let a=await xM[s.statMethod](s.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(s.watchPath,a))return i(),!1;let l=this.fsw.options.followSymlinks,c;if(a.isDirectory()){let u=Ne.resolve(e),f=l?await iy(e):e;if(this.fsw.closed)return;if(c=await this._handleDir(s.watchPath,a,t,o,r,s,f),this.fsw.closed)return;if(u!==f&&f!==void 0)this.fsw._symlinkPaths.set(u,f)}else if(a.isSymbolicLink()){let u=l?await iy(e):e;if(this.fsw.closed)return;let f=Ne.dirname(s.watchPath);if(this.fsw._getWatchedDir(f).add(s.watchPath),this.fsw._emit(ir.ADD,s.watchPath,a),c=await this._handleDir(f,a,t,o,e,s,u),this.fsw.closed)return;if(u!==void 0)this.fsw._symlinkPaths.set(Ne.resolve(e),u)}else c=this._handleFile(s.watchPath,a,t);if(i(),c)this.fsw._addPathCloser(e,c);return!1}catch(a){if(this.fsw._handleError(a))return i(),e}}}/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */var dy="/",OM="//",Xk=".",DM="..",PM="string",CM=/\\/g,Wk=/\/\//,RM=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,AM=/^\.[/\\]/;function Jl(e){return Array.isArray(e)?e:[e]}var py=(e)=>typeof e==="object"&&e!==null&&!(e instanceof RegExp);function MM(e){if(typeof e==="function")return e;if(typeof e==="string")return(t)=>e===t;if(e instanceof RegExp)return(t)=>e.test(t);if(typeof e==="object"&&e!==null)return(t)=>{if(e.path===t)return!0;if(e.recursive){let n=oe.relative(e.path,t);if(!n)return!1;return!n.startsWith("..")&&!oe.isAbsolute(n)}return!1};return()=>!1}function UM(e){if(typeof e!=="string")throw Error("string expected");e=oe.normalize(e),e=e.replace(/\\/g,"/");let t=!1;if(e.startsWith("//"))t=!0;let n=/\/\//;while(e.match(n))e=e.replace(n,"/");if(t)e="/"+e;return e}function Hk(e,t,n){let o=UM(t);for(let r=0;r<e.length;r++){let i=e[r];if(i(o,n))return!0}return!1}function NM(e,t){if(e==null)throw TypeError("anymatch: specify first argument");let o=Jl(e).map((r)=>MM(r));if(t==null)return(r,i)=>Hk(o,r,i);return Hk(o,t)}var Jk=(e)=>{let t=Jl(e).flat();if(!t.every((n)=>typeof n===PM))throw TypeError(`Non-string provided as watch path: ${t}`);return t.map(Qk)},Kk=(e)=>{let t=e.replace(CM,dy),n=!1;if(t.startsWith(OM))n=!0;while(t.match(Wk))t=t.replace(Wk,dy);if(n)t=dy+t;return t},Qk=(e)=>Kk(oe.normalize(Kk(e))),Yk=(e="")=>(t)=>{if(typeof t==="string")return Qk(oe.isAbsolute(t)?t:oe.join(e,t));else return t},FM=(e,t)=>{if(oe.isAbsolute(e))return e;return oe.join(t,e)},zM=Object.freeze(new Set);class ew{constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;if(!t)return;if(e!==Xk&&e!==DM)t.add(e)}async remove(e){let{items:t}=this;if(!t)return;if(t.delete(e),t.size>0)return;let n=this.path;try{await EM(n)}catch(o){if(this._removeWatcher)this._removeWatcher(oe.dirname(n),oe.basename(n))}}has(e){let{items:t}=this;if(!t)return;return t.has(e)}getChildren(){let{items:e}=this;if(!e)return[];return[...e.values()]}dispose(){this.items.clear(),this.path="",this._removeWatcher=Wl,this.items=zM,Object.freeze(this)}}var LM="stat",jM="lstat";class tw{constructor(e,t,n){this.fsw=n;let o=e;this.path=e=e.replace(AM,""),this.watchPath=o,this.fullWatchPath=oe.resolve(o),this.dirParts=[],this.dirParts.forEach((r)=>{if(r.length>1)r.pop()}),this.followSymlinks=t,this.statMethod=t?LM:jM}entryPath(e){return oe.join(this.watchPath,oe.relative(this.watchPath,e.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let n=this.entryPath(e);return this.fsw._isntIgnored(n,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}}class rw extends $M{constructor(e={}){super();this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,n={stabilityThreshold:2000,pollInterval:100},o={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?Jl(e.ignored):Jl([]),awaitWriteFinish:t===!0?n:typeof t==="object"?{...n,...t}:!1};if(qk)o.usePolling=!0;if(o.atomic===void 0)o.atomic=!o.usePolling;let r=process.env.CHOKIDAR_USEPOLLING;if(r!==void 0){let a=r.toLowerCase();if(a==="false"||a==="0")o.usePolling=!1;else if(a==="true"||a==="1")o.usePolling=!0;else o.usePolling=!!a}let i=process.env.CHOKIDAR_INTERVAL;if(i)o.interval=Number.parseInt(i,10);let s=0;this._emitReady=()=>{if(s++,s>=this._readyCount)this._emitReady=Wl,this._readyEmitted=!0,process.nextTick(()=>this.emit(je.READY))},this._emitRaw=(...a)=>this.emit(je.RAW,...a),this._boundRemove=this._remove.bind(this),this.options=o,this._nodeFsHandler=new uy(this),Object.freeze(o)}_addIgnoredPath(e){if(py(e)){for(let t of this._ignoredPaths)if(py(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e==="string"){for(let t of this._ignoredPaths)if(py(t)&&t.path===e)this._ignoredPaths.delete(t)}}add(e,t,n){let{cwd:o}=this.options;this.closed=!1,this._closePromise=void 0;let r=Jk(e);if(o)r=r.map((i)=>FM(i,o));if(r.forEach((i)=>{this._removeIgnoredPath(i)}),this._userIgnored=void 0,!this._readyCount)this._readyCount=0;return this._readyCount+=r.length,Promise.all(r.map(async(i)=>{let s=await this._nodeFsHandler._addToNodeFs(i,!n,void 0,0,t);if(s)this._emitReady();return s})).then((i)=>{if(this.closed)return;i.forEach((s)=>{if(s)this.add(oe.dirname(s),oe.basename(t||s))})}),this}unwatch(e){if(this.closed)return this;let t=Jk(e),{cwd:n}=this.options;return t.forEach((o)=>{if(!oe.isAbsolute(o)&&!this._closers.has(o)){if(n)o=oe.join(n,o);o=oe.resolve(o)}if(this._closePath(o),this._addIgnoredPath(o),this._watched.has(o))this._addIgnoredPath({path:o,recursive:!0});this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach((t)=>t.forEach((n)=>{let o=n();if(o instanceof Promise)e.push(o)})),this._streams.forEach((t)=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach((t)=>t.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>{return}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,n)=>{let r=(this.options.cwd?oe.relative(this.options.cwd,n):n)||Xk;e[r]=t.getChildren().sort()}),e}emitWithAll(e,t){if(this.emit(e,...t),e!==je.ERROR)this.emit(je.ALL,e,...t)}async _emit(e,t,n){if(this.closed)return;let o=this.options;if(ly)t=oe.normalize(t);if(o.cwd)t=oe.relative(o.cwd,t);let r=[t];if(n!=null)r.push(n);let i=o.awaitWriteFinish,s;if(i&&(s=this._pendingWrites.get(t)))return s.lastChange=new Date,this;if(o.atomic){if(e===je.UNLINK)return this._pendingUnlinks.set(t,[e,...r]),setTimeout(()=>{this._pendingUnlinks.forEach((a,l)=>{this.emit(...a),this.emit(je.ALL,...a),this._pendingUnlinks.delete(l)})},typeof o.atomic==="number"?o.atomic:100),this;if(e===je.ADD&&this._pendingUnlinks.has(t))e=je.CHANGE,this._pendingUnlinks.delete(t)}if(i&&(e===je.ADD||e===je.CHANGE)&&this._readyEmitted){let a=(l,c)=>{if(l)e=je.ERROR,r[0]=l,this.emitWithAll(e,r);else if(c){if(r.length>1)r[1]=c;else r.push(c);this.emitWithAll(e,r)}};return this._awaitWriteFinish(t,i.stabilityThreshold,e,a),this}if(e===je.CHANGE){if(!this._throttle(je.CHANGE,t,50))return this}if(o.alwaysStat&&n===void 0&&(e===je.ADD||e===je.ADD_DIR||e===je.CHANGE)){let a=o.cwd?oe.join(o.cwd,t):t,l;try{l=await TM(a)}catch(c){}if(!l||this.closed)return;r.push(l)}return this.emitWithAll(e,r),this}_handleError(e){let t=e&&e.code;if(e&&t!=="ENOENT"&&t!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||t!=="EPERM"&&t!=="EACCES"))this.emit(je.ERROR,e);return e||this.closed}_throttle(e,t,n){if(!this._throttled.has(e))this._throttled.set(e,new Map);let o=this._throttled.get(e);if(!o)throw Error("invalid throttle");let r=o.get(t);if(r)return r.count++,!1;let i,s=()=>{let l=o.get(t),c=l?l.count:0;if(o.delete(t),clearTimeout(i),l)clearTimeout(l.timeoutObject);return c};i=setTimeout(s,n);let a={timeoutObject:i,clear:s,count:0};return o.set(t,a),a}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,n,o){let r=this.options.awaitWriteFinish;if(typeof r!=="object")return;let i=r.pollInterval,s,a=e;if(this.options.cwd&&!oe.isAbsolute(e))a=oe.join(this.options.cwd,e);let l=new Date,c=this._pendingWrites;function u(f){IM(a,(h,m)=>{if(h||!c.has(e)){if(h&&h.code!=="ENOENT")o(h);return}let y=Number(new Date);if(f&&m.size!==f.size)c.get(e).lastChange=y;let k=c.get(e);if(y-k.lastChange>=t)c.delete(e),o(void 0,m);else s=setTimeout(u,i,m)})}if(!c.has(e))c.set(e,{lastChange:l,cancelWait:()=>(c.delete(e),clearTimeout(s),n)}),s=setTimeout(u,i)}_isIgnored(e,t){if(this.options.atomic&&RM.test(e))return!0;if(!this._userIgnored){let{cwd:n}=this.options,r=(this.options.ignored||[]).map(Yk(n)),s=[...[...this._ignoredPaths].map(Yk(n)),...r];this._userIgnored=NM(s,void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new tw(e,this.options.followSymlinks,this)}_getWatchedDir(e){let t=oe.resolve(e);if(!this._watched.has(t))this._watched.set(t,new ew(t,this._boundRemove));return this._watched.get(t)}_hasReadPermissions(e){if(this.options.ignorePermissionErrors)return!0;return Boolean(Number(e.mode)&256)}_remove(e,t,n){let o=oe.join(e,t),r=oe.resolve(o);if(n=n!=null?n:this._watched.has(o)||this._watched.has(r),!this._throttle("remove",o,100))return;if(!n&&this._watched.size===1)this.add(e,t,!0);this._getWatchedDir(o).getChildren().forEach((f)=>this._remove(o,f));let a=this._getWatchedDir(e),l=a.has(t);if(a.remove(t),this._symlinkPaths.has(r))this._symlinkPaths.delete(r);let c=o;if(this.options.cwd)c=oe.relative(this.options.cwd,o);if(this.options.awaitWriteFinish&&this._pendingWrites.has(c)){if(this._pendingWrites.get(c).cancelWait()===je.ADD)return}this._watched.delete(o),this._watched.delete(r);let u=n?je.UNLINK_DIR:je.UNLINK;if(l&&!this._isIgnored(o))this._emit(u,o);this._closePath(o)}_closePath(e){this._closeFile(e);let t=oe.dirname(e);this._getWatchedDir(t).remove(oe.basename(e))}_closeFile(e){let t=this._closers.get(e);if(!t)return;t.forEach((n)=>n()),this._closers.delete(e)}_addPathCloser(e,t){if(!t)return;let n=this._closers.get(e);if(!n)n=[],this._closers.set(e,n);n.push(t)}_readdirp(e,t){if(this.closed)return;let n={type:je.ALL,alwaysStat:!0,lstat:!0,...t,depth:0},o=Lk(e,n);return this._streams.add(o),o.once(Bk,()=>{o=void 0}),o.once(cy,()=>{if(o)this._streams.delete(o),o=void 0}),o}}function nw(e,t={}){let n=new rw(t);return n.add(e),n}import{existsSync as GM}from"node:fs";var ZM=/^[A-Z]:[\\/](pagefile\.sys|DumpStack\.log\.tmp|hiberfil\.sys|swapfile\.sys)/i;async function ow(e){if(!e.projectDir||!GM(e.projectDir))return{stop:async()=>{}};let t=(i)=>i.endsWith("SKILL.md"),n=nw(e.projectDir,{ignoreInitial:!0,usePolling:!0,interval:100,binaryInterval:100,ignored:(i)=>ZM.test(i)}),o=!1,r=new Promise((i)=>{n.once("ready",()=>{if(!o)i()})});return n.on("add",(i)=>{if(!o&&t(i))e.onChange(i,"add")}),n.on("change",(i)=>{if(!o&&t(i))e.onChange(i,"change")}),await r,await new Promise((i)=>setTimeout(i,100)),{async stop(){o=!0,await n.close()}}}var BM=[/^[A-Z]:[\\/](pagefile\.sys|DumpStack\.log\.tmp)/i,/^[A-Z]:[\\/](Users|home)[\\/][^\\/]+[\\/]AppData[\\/]Local[\\/]Temp[\\/]/i,/^\/(var|private\/var)\/folders\//,/^\/snap\//],qM=new Set(["EINVAL","ENOENT","EACCES","EBADF","EPERM"]),Kl=null;function iw(e={}){let t=Object.keys(e).length===0;if(t&&Kl)return Kl;let n=e.paths??BM,o=e.errorCodes??qM,r=e.logger??console,i=(u)=>{let f=u&&typeof u==="object"&&"code"in u&&u.code?o.has(u.code):!1,h=!!(u?.path&&n.some((m)=>m.test(u.path)));if(f&&h){r.warn?.("watcher_scan_blocked",{path:u.path,code:u.code,message:u.message});return}};process.on("uncaughtException",i);let s=()=>process.off("uncaughtException",i),a=(u)=>{if(u&&typeof u==="object"&&"code"in u)i(u)};process.on("unhandledRejection",a);let l=()=>process.off("unhandledRejection",a),c=()=>{if(s(),l(),t)Kl=null};if(t)Kl=c;return c}Ra();iw();var cw=new Set,lw={continue:0,warn:1,escalate:2,stop:3};function uw(e,t){return lw[e]>=lw[t]}function dw(e){if(e.tool!=="bash")return!1;let t=e.args?.command;if(typeof t!=="string")return!1;return/(?:>>?|[<>]\s*&?\s*[''"]?\s*\S+|\btee\s+[^|;&]+)/.test(t)}function nU(e){let t=e.args;if(!t||typeof t!=="object")return null;let n=["pattern","query","path","glob","regex","include_pattern"];for(let o of n){let r=t[o];if(typeof r==="string"&&r.trim().length>0)return r.trim()}return null}var Ht=Nl({sessionID:"__global__",global:!0,version:at});var pw=ft().health;try{nn({oldPaths:rn(),newPaths:ft()})}catch{}function Yl(e={},t={}){let n=pe(),o=new Yg;Q_(o);let r=process.cwd(),i=Io(),s=Qc({graphRetrieval:n,cwd:r}),a=el({sqlite:i}),l=tl({metrics:Ht,logFilePath:Vt,healthFilePath:pw}),c=rl({cwd:r}),u=nl({cwd:r}),f=ol({onDispatch:({sessionID:ut,mcpTool:fr,mcpArgs:Ct})=>{o.register({sessionID:ut,mcpTool:fr,mcpArgs:Ct})}}),h=il({onDispatch:({sessionID:ut,mcpTool:fr,mcpArgs:Ct})=>{o.register({sessionID:ut,mcpTool:fr,mcpArgs:Ct})}}),m=sl({cwd:r}),y=al({cwd:r}),k=cl({graphRetrieval:n,cwd:r}),S=ll({graphRetrieval:n,cwd:r}),I=ul({graphRetrieval:n,cwd:r}),D=dl({graphRetrieval:n,cwd:r}),R=pl({graphRetrieval:n,cwd:r}),M=ml({graphRetrieval:n,cwd:r}),me=fl({graphRetrieval:n,cwd:r}),Ee=hl({graphRetrieval:n,cwd:r}),Ue=gl({graphRetrieval:n,cwd:r}),$e=yl({graphRetrieval:n,cwd:r}),rt=xl({graphRetrieval:n,cwd:r}),ue=vl({graphRetrieval:n,cwd:r}),fe=Sl({graphRetrieval:n,cwd:r}),De=bl({graphRetrieval:n,cwd:r}),Pe=_l({graphRetrieval:n,cwd:r}),$r=kl({graphRetrieval:n,cwd:r}),Qt=wl({graphRetrieval:n,cwd:r}),jv=Il({graphRetrieval:n,cwd:r}),Gv=Tl({graphRetrieval:n,cwd:r}),Zv=El({graphRetrieval:n,cwd:r}),Bv=$l({graphRetrieval:n,cwd:r}),qv=Ol({graphRetrieval:n,cwd:r}),Vv=Dl({graphRetrieval:n,cwd:r}),Wv=Pl({cwd:r}),Hv=Rl({cwd:r}),Jv=Al({cwd:r}),Kv=Ml({cwd:r}),Yv=Ul({cwd:r});w("info",`v${at} MetaGovernor plugin loaded`,{version:at,build:at,cwd:r,projectHasCodegraph:n.hasCodegraphDir(r),projectHasGraphify:n.hasGraphifyDir(r)});let Xv="?";try{let fr=aw(import.meta.url),Ct=gy(fr);Xv=KM("sha256").update(Ct).digest("hex").slice(0,8)}catch{}return console.log(`[meta-governor] v${at} loaded (bundle: ${Xv})`),(async()=>{let ut=ft().selfVersionCache,fr=86400000,Ct=null;try{let Rt=gy(ut,"utf-8"),Or=JSON.parse(Rt);if(typeof Or.latest==="string"&&typeof Or.checkedAtMs==="number"&&Date.now()-Or.checkedAtMs<86400000)Ct={latest:Or.latest,checkedAtMs:Or.checkedAtMs}}catch{}let hr=Ct?.latest??null;if(!hr)try{let{execSync:Rt}=await import("node:child_process");if(hr=Rt("npm view @herjarsa/omo-meta-governor version",{timeout:5000,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null,hr)try{let Or=ut.replace(/[\\/][^\\/]+$/,""),{mkdirSync:A,writeFileSync:bi}=await import("node:fs");A(Or,{recursive:!0}),bi(ut,JSON.stringify({latest:hr,checkedAtMs:Date.now()}))}catch{}}catch{}if(hr&&hr!==at)w("warn",`STALE_CACHE: loaded v${at} but npm has v${hr}. Run: npm cache clean --force && rm -rf ~/.cache/opencode/packages/@herjarsa/omo-meta-governor*`)})(),async(ut,fr)=>{w("info",`v${at} factory_invoked`,{version:at,hasInput:ut!=null,inputDir:ut?.directory??null,inputKeys:ut?Object.keys(ut):[]});let Ct=ut.client,hr=Ct!=null&&typeof Ct==="object"&&"tool"in Ct?Ct:null;gs().setClient(hr),Yc(hr);let Rt;try{Rt=await zl({projectDir:ut.directory??r})}catch(v){throw w("error","factory_config_load_failed",{message:v instanceof Error?v.message:String(v),stack:v instanceof Error?v.stack?.slice(0,800):void 0}),v}let Or={...e,...Rt.config,...fr?.meta_governor??{}},A;try{A=Qg(Or)}catch(v){throw w("error","factory_orchestrator_config_failed",{message:v instanceof Error?v.message:String(v)}),v}if(B_({preferredTool:A.graphRetrieval.preferredTool}),Rt.sources.length>0)w("info",`v${at} config_loaded`,{version:at,sources:Rt.sources,effectiveSource:Rt.effectiveSource,enabled:A.enabled});if(A.postWave?.enabled===!0&&A.intervention.respectDoneSignal===!1)w("info","post_wave_warning",{message:"postWave.enabled=true but intervention.respectDoneSignal=false: post-wave directives still fire on Oracle-verified PHASE-N-COMPLETE, but the done-signal latch is off (intervention is not auto-disabled at plan end)."});let bi=new Set,Od=new Set,LO=new Set,kt=ut.directory?YM(ut.directory):r,_i=fr?.meta_governor?.graphSync??Rt.config?.graphSync??e.graphSync;if(_i?.enabled!==!1){if(t.__test_onGraphSyncInit?.({projectDir:kt}),(t.__test_runGraphSync??Ca)({enabled:!0,watch:_i?.watch??!1,autoInstall:_i?.autoInstall??!0,installTimeoutMs:_i?.installTimeoutMs??60000,killOrphanedOnInit:_i?.killOrphanedOnInit??!0,projectDir:kt}).then((P)=>{if(P?.attempted&&P.availability.codegraph&&P.availability.graphify)bi.add(kt)}).catch((P)=>{w("warn",`graphSync init failed: ${String(P)}`)}),A.cliAnything?.enabled!==!1){let P=fr?.meta_governor?.cliAnything??Rt.config?.cliAnything;(t.__test_runCliAnythingSync??FS)({enabled:!0,autoInstall:P?.autoInstall??!0,autoUpgrade:P?.autoUpgrade??!0,cachePath:P?.cachePath??ft().cliAnythingUpgradeCheck,upgradeCheckTtlMs:P?.upgradeCheckTtlMs??86400000,projectDir:kt,installScope:P?.installScope??"global",cliHubBin:P?.cliHubBin??"cli-hub",skillsBin:P?.skillsBin??"npx skills"}).then((C)=>{if(C?.attempted&&C.availability.cliHub)LO.add(kt)}).catch((C)=>{w("warn",`cli-anything sync failed: ${String(C)}`)})}queueMicrotask(()=>{try{let P=A.graphSync.fetchBranch,b=TS(kt,P);if(b>0)w("info",`reindexOnFetch: ${b} new commits on origin/${P}, reindexing`),Wd(kt).catch((C)=>{w("warn",`reindexOnFetch failed: ${String(C)}`)})}catch{}})}try{let v=rU(aw(import.meta.url)),P=ks(v,"skills","chore.tar.gz");if(QM(P))wk({globalDir:ks(eU(),".agents","skills"),tarballPath:P,pluginVersion:at}).catch((b)=>{w("warn",`chore-skills bootstrap failed: ${String(b)}`)})}catch(v){w("warn",`chore-skills bootstrap failed: ${String(v)}`)}let ki=null;if(!A.enabled){if(Rt.sources.length>0)w("warn","config_loaded_but_disabled",{version:at,sources:Rt.sources,hint:"Set meta_governor.enabled=true (or top-level enabled:true) in your omo-meta-governor.jsonc to activate governance."});return{tool:{omo_search:s,omo_recall:a,omo_health:l,omo_find:c,omo_impact:u,omo_remember:f,omo_recall_mcp:h,omo_path:m,omo_explain:y,omo_files:k,omo_callers:S,omo_node:I,omo_context:D,omo_affected_cg:R,omo_status:M,omo_unlock:me,omo_mark_dirty:Ee,omo_sync_if_dirty:Ue,omo_index:$e,omo_visualize:rt,omo_serve:ue,omo_uninit:fe,omo_diagnose:De,omo_merge_graphs:Pe,omo_save_result:$r,omo_extract:Qt,omo_cluster_only:jv,omo_label:Gv,omo_tree:Zv,omo_clone:Bv,omo_add:qv,omo_check_update:Vv,omo_hook_status:Wv,omo_cli_anything_install:Hv,omo_cli_anything_list:Jv,omo_cli_anything_search:Kv,omo_cli_anything_info:Yv},dispose:async()=>{try{zd()}catch{}try{qd()}catch{}try{$a()}catch{}try{ko()}catch{}try{if(ki)await ki.stop()}catch{}}}}let Dd=()=>A.modelOverride?.providerID??t.providerID?.(),Pd=()=>A.modelOverride?.modelID??t.modelID?.(),jO=()=>A.modelOverride?.modelLimit??200000,F1=Dd()??"unknown",z1=Pd()??"unknown",Qv,eS;if(A.protocolEnforcement.enabled||A.protocolEnforcement.injectIntoSystem){let v=A.protocolEnforcement.path??ny;try{Qv=await Dk(v),eS=Pk(Qv)}catch(P){if(A.modelOverride?.verbosity!=="silent")w("warn",`could not load protocol: ${P instanceof Error?P.message:String(P)}`)}}let xt=new ry({maxEntries:100,ttlMs:3600000}),wi=new Ss(1000,300000),tn=new Ss(1000,300000),Cd=new Set,tS=new Set,rS=new Map,nS=new Set,GO=new Set,ZO=new Set,L1=new Set,oS=new Set,iS=new Map,sS=new Map,BO=()=>({currentWaveN:null,lastInjectedWaveN:null,lastInjectedAtMs:null,postWaveInjectionsThisWave:0,rulesReadForWave:{},oracleAfterPhaseAtMs:{},repoModeResolved:null}),aS=new Ss(1000,86400000),Rd=(v)=>{if(typeof t.__test_isMainSession==="function")try{return t.__test_isMainSession(v)}catch{return!0}return!0},bo=(v,P)=>{if(!v||!P)return;if(!Rd(v)){w("info",`persist skipped (subagent) for ${v}`);return}if(!A.intervention.persistToSession)return;let b=xt.get(v);if(b?.backgroundTaskInFlight||b?.oracleInFlight){w("info",`persist skipped (background task in flight) for ${v}`);return}let C=()=>(t.__test_persistSessionMessage??Xc)(v,P),N=(he)=>{if(!he.ok)w("warn",`persist intervention failed for ${v}`,{error:he.error});else w("info",`persisted intervention for ${v}`)};if(t.__test_persistSessionMessage){C().then((he)=>{if(!he.ok&&he.error&&/timed out/i.test(he.error)){let ke=xt.get(v);if(ke?.backgroundTaskInFlight||ke?.oracleInFlight){w("info",`persist retry skipped (background task in flight) for ${v}`);return}setTimeout(()=>{C().then(N)},t.__test_persistRetryDelayMs??1500);return}N(he)});return}w("info",`persist intervention (superficial, not queued) for ${v}: ${P.slice(0,200)}`),Ht.inc("interventions_delivered")},qO=z_((v)=>{try{Wc(v,pw)}catch(P){w("warn","health snapshot write failed",{error:String(P)})}},5000);try{let v=ks(kt,".agents","skills");ki=await(t.__test_startSkillsFsWatcher??ow)({projectDir:v,onChange:async(b,C)=>{if(C!=="add")return;try{Ht.inc("tier3_skills_created"),w("info",`tier3_skills_created: ${b}`)}catch(N){w("warn",`tier3 watcher onChange failed: ${String(N)}`)}}})}catch(v){w("warn",`tier3 fs watcher failed to start: ${String(v)}`)}return{dispose:async()=>{try{zd()}catch{}try{qd()}catch{}try{$a()}catch{}try{ko()}catch{}try{if(ki)await ki.stop()}catch{}},"tool.execute.before":async(v,P)=>{if(!A.enabled)return;if(!v.sessionID)return;if(A.skillPriming.enabled&&A.skillPriming.enforceMode==="block"&&v.tool!=="omo_skill_find"&&!nS.has(v.sessionID)&&(zr.includes(v.tool)||dw(v))&&!$k(v.tool,P?.args)){let N=Ok(v.tool,P?.args);throw Error(`[meta-governor] skill-priming required: run \`${N}\` to discover relevant skills before using "${v.tool}". Pass the candidates to a sub-agent via \`task(category='<category>', load_skills=[...])\` to load 2-3 capabilities. Set skillPriming.enforceMode='directive' in your config to bypass this gate, or write to a tmp/test/scratch path for trivial edits.`)}if(!A.protocolEnforcement.auditToolCalls)return;let b=xt.get(v.sessionID);if(!b)b={memoryToolsUsed:[],hasCodegraphDir:n.hasCodegraphDir(r),hasGraphifyDir:n.hasGraphifyDir(r),oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,lastViolationInjectionAtMs:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},xt.set(v.sessionID,b);if(b?.oracleInFlight)return;if(eS)w("info","protocol loaded, system injection ready");let C=Ck(v.tool,P.args,{memoryToolsUsed:b.memoryToolsUsed,hasCodegraphDir:b.hasCodegraphDir,hasGraphifyDir:b.hasGraphifyDir,oracleInvoked:b.oracleInvoked,filesChanged:b.filesChanged,emptyRecall:b.emptyRecall,escalationAttempted:b.escalationAttempted,recentToolCalls:b.recentToolCalls,recentWriteContents:b.recentWriteContents,memorySaved:b.memorySaved,batchCompletions:b.batchCompletions});if(C.length>0){let he=b.lastViolationInjectionAtMs??0;if(he>0&&Date.now()-he<30000){w("info",`violation during cooldown (${Math.round((30000-(Date.now()-he))/1000)}s remaining), skipping queue`);let ke=C.map((Qe)=>({severity:Qe.severity,category:Qe.rule,detail:Qe.detail,ts:Date.now()}));b.accumulatedDeviations=[...b.accumulatedDeviations,...ke].slice(-5)}else{w("warn",`protocol violations on tool ${v.tool}`,C);let ke=wi.get(v.sessionID)?.items??[],Qe=new Set;for(let se of C){let He=`${se.severity}::${se.rule}::${se.detail}`;if(Qe.has(He))continue;Qe.add(He);let G=`[${se.severity.toUpperCase()}] ${se.rule}: ${se.detail}`;if(!ke.includes(G))ke.push(G)}wi.set(v.sessionID,{items:ke});let de=C.map((se)=>({severity:se.severity,category:se.rule,detail:se.detail,ts:Date.now()}));b.accumulatedDeviations=[...b.accumulatedDeviations,...de].slice(-5)}}else w("info",`audit OK on tool ${v.tool}`);if((v.tool==="grep"||v.tool==="glob")&&(n.hasCodegraphDir(r)||n.hasGraphifyDir(r))){let N=nU(v);if(N)n.invoke(r,N,{timeoutMs:5000}).then((he)=>{if(he.result)n.cacheContext(v.sessionID,N,he.result)}).catch((he)=>{w("warn",`graphRetrieval.invoke failed for session ${v.sessionID}: ${String(he)}`)})}},"tool.execute.after":async(v,P)=>{if(!A.enabled)return;if(Ht.inc("tool_calls_observed"),v.sessionID&&(v.tool==="omo_skill_find"||v.tool==="omo_skill_add"||v.tool==="omo_skill_get"||v.tool==="omo_skill_local_link"||v.tool==="omo_skill_semantic_find"||v.tool==="omo_skill_create"))nS.add(v.sessionID);if(v.sessionID){let G=v.sessionID;if(v.tool==="omo_search"||v.tool==="omo_find"||v.tool==="omo_impact"||v.tool==="omo_path"||v.tool==="omo_explain")GO.add(G);if(v.tool==="omo_recall"||v.tool==="omo_recall_mcp")ZO.add(G)}qO.write(Hc({version:at,enabled:!0,sessionID:v.sessionID||"__unknown__",snapshot:Ht.getMetrics(),logFilePath:Vt}));try{o.markDelivered({sessionID:v.sessionID,mcpTool:v.tool,mcpArgs:v.args})}catch{}if(zr.includes(v.tool))oS.add(v.sessionID);let b=xt.get(v.sessionID);if(b){if(b.iteration++,b.recentToolCalls=[v.tool].concat(b.recentToolCalls).slice(0,20),zr.includes(v.tool)||dw(v)){b.filesChanged++;let Se=(P.output??"").slice(0,500);b.recentWriteContents=[Se].concat(b.recentWriteContents).slice(0,3);let ne=v.args,Je=ne?.filePath??ne?.path;if(v.tool==="bash"&&(typeof Je!=="string"||Je.length===0)){let Ii=(v.args?.command??"").match(/(?:>>?)\s*[''"]?([^''"&\s;]+)/);if(Ii)Je=Ii[1]}if(typeof Je==="string"&&Je.length>0)b.recentWriteFilePaths=[Je].concat(b.recentWriteFilePaths).slice(0,10)}if(["agentmemory_memory_recall","agentmemory_memory_smart_search","agentmemory_memory_save"].some((Se)=>v.tool.startsWith(Se))&&!b.memoryToolsUsed.includes(v.tool))b.memoryToolsUsed.push(v.tool);if(v.tool.startsWith("agentmemory_memory_save")){let Se=P.output??"";if(Se.includes("saved")||Se.includes("written"))b.memorySaved=!0}if(v.tool==="task"){let Se=P.output??"",ne=v.args,Je=ne?.subagent_type;if(Je==="oracle"||/"subagent_type"\s*:\s*"oracle"/.test(Se)){if(b.oracleInvoked=!0,ne?.run_in_background===!0)b.oracleInFlight=!0,b.oracleInFlightSinceMs=Date.now()}if(ne?.run_in_background===!0&&typeof Je==="string")b.backgroundTaskInFlight=!0,b.backgroundTaskInFlightSinceMs=Date.now(),b.backgroundTaskType=Je,w("info",`background_task_in_flight: subagent_type=${Je} for session ${v.sessionID}`)}let ee=(P.output??"").toLowerCase();if(v.tool.includes("recall")&&(ee.includes("returned empty")||ee.includes("no results")))b.emptyRecall=!0;if(v.tool==="todowrite"&&(P.output??"").includes("completed")){if(((P.output??"").match(/"status":"completed"/g)??[]).length>=3)b.batchCompletions++}let ve=[typeof P.output==="string"?P.output:"",typeof v.args==="string"?v.args:""].join(`
248
+ `)}function vk(e,t){return`${xk[e]} ${t}`}import{createHash as UA}from"node:crypto";import{mkdir as Sk,readFile as _k,readdir as NA,writeFile as FA,copyFile as zA,rm as LA}from"node:fs/promises";import{existsSync as Zl}from"node:fs";import{join as zo}from"node:path";import{execFileSync as jA}from"node:child_process";var kk=".omo-meta-governor-checksums.json";async function bk(e){let t=await _k(e);return"sha256:"+UA("sha256").update(t).digest("hex")}async function GA(e){let t=zo(e,kk);if(!Zl(t))return null;try{return JSON.parse(await _k(t,"utf8"))}catch{return null}}async function ZA(e,t){try{return await FA(zo(e,kk),JSON.stringify(t,null,2),"utf8"),!0}catch(n){return console.warn(`[skills-bootstrap] manifest write failed: ${n.message}`),!1}}async function Gl(e){try{await LA(e,{recursive:!0,force:!0})}catch{}}async function wk(e){let t={extracted:[],skipped:[],warned:[],manifestWritten:!1};if(!Zl(e.tarballPath))return console.warn(`[skills-bootstrap] tarball missing: ${e.tarballPath}`),t;let n=zo(e.globalDir,".bootstrap-stage");await Gl(n);try{await Sk(n,{recursive:!0})}catch(s){return console.warn(`[skills-bootstrap] stage dir creation failed: ${s.message}`),t}try{jA("tar",["-xzf",e.tarballPath,"-C",n],{stdio:["ignore","ignore","pipe"],windowsHide:!0})}catch(s){return console.warn(`[skills-bootstrap] tarball extraction failed: ${s.message}`),await Gl(n),t}let o=await GA(e.globalDir)??{version:e.pluginVersion,skills:{}},r={version:e.pluginVersion,skills:{...o.skills}},i=[];try{i=(await NA(n,{withFileTypes:!0})).filter((a)=>a.isDirectory()).map((a)=>a.name)}catch(s){return console.warn(`[skills-bootstrap] stage dir read failed: ${s.message}`),await Gl(n),t}for(let s of i)try{let a=zo(n,s,"SKILL.md");if(!Zl(a))continue;let l=await bk(a),c=zo(e.globalDir,s),u=zo(c,"SKILL.md");if(!Zl(u))await Sk(c,{recursive:!0}),await zA(a,u),t.extracted.push(s);else{let f=await bk(u);if(f===l)t.skipped.push(s);else console.warn(`[skills-bootstrap] skill '${s}' was modified by user; skipping. bundled: ${l}, local: ${f}`),t.warned.push(s)}r.skills[s]=l}catch(a){console.warn(`[skills-bootstrap] error processing '${s}': ${a.message}`)}return await Gl(n),t.manifestWritten=await ZA(e.globalDir,r),t}import{statSync as XM,readFileSync as gy,existsSync as QM}from"node:fs";import{homedir as eU}from"node:os";import{execSync as tU,execFileSync as mw}from"node:child_process";import{join as ks,dirname as rU}from"node:path";import{readFile as VA}from"node:fs/promises";import{resolve as WA}from"node:path";import{homedir as JA}from"node:os";var zr=["write","edit","edit_block","multi_edit","apply_patch","ast_grep_replace","refactor","desktop-commander_write_file","desktop-commander_edit_block"];var BA=["brainstorming","writing-plans","test-driven-development","systematic-debugging","subagent-driven-development"];function Ik(e){let t=e==="aas"?"registry":e,n=["[SKILL PRIMING] This session involves implementation work. Select precise skills for this task before writing code:"],o=1;if(t==="registry"||t==="both")n.push(`${o}. Query the skill-hub catalog (omo_skill_find) for the 2-3 capabilities most relevant to this task (e.g. testing, architecture, language-specific), and inspect candidates with omo_skill_get.`),o++,n.push(`${o}. Compose a minimal stack of 2-3 skills by loading each via its installer (e.g. \`npx skills add <owner/repo/slug>\` via omo_skill_add).`),o++;if(t==="superpowers"||t==="both")n.push(`${o}. If a matching superpowers skill is available and not yet active (${BA.join(" / ")}), delegate it to a sub-agent via \`task(category='<category>', load_skills=['<slug>'])\` — the skill's content is injected into the sub-agent's system prompt. (Requires the superpowers plugin to be installed separately.)`),o++;if(t==="both")n.push("If a superpowers skill is already active, skip the catalog step.");n.push("Do NOT enumerate the full catalog — keep the stack minimal and task-specific.");let r=n.join(`
249
+ `);return or(r,{kind:"skill-priming",context:`router=${t}`})}function Tk(e){return vk("skill-priming",`Skill priming (${e==="aas"?"registry":e}): nudging agent to discover relevant skills before implementation.`)}function Ek(e){if(e.trigger==="sessionStart")return!0;if(e.implementationToolSeen)return!0;return e.recentToolCalls.some((t)=>zr.includes(t))}var qA=[/[\\/](\.tmp|\.scratch|scratch|tmp|trash|throwaway)[\\/]/i,/[\\/]tests?[\\/]|^tests?[\\/]/,/[\\/]__tests__[\\/]/,/[\\/]fixtures?[\\/]/,/[\\/]examples?[\\/]/,/\.test\.[a-z]+$/,/\.spec\.[a-z]+$/],HA=50;function $k(e,t){if(e==="edit"||e==="edit_block"||e==="multi_edit"||e==="apply_patch"||e==="ast_grep_replace"||e==="refactor"||e==="desktop-commander_edit_block")return!0;if(e!=="write"&&e!=="desktop-commander_write_file")return!1;let n=t,o=typeof n?.filePath==="string"?n.filePath:typeof n?.path==="string"?n.path:"";if(o&&qA.some((i)=>i.test(o)))return!0;let r=n?.content;if(typeof r==="string"&&r.split(`
250
+ `).length<=HA)return!0;return!1}function Ok(e,t){let n=t,o=typeof n?.filePath==="string"?n.filePath:typeof n?.path==="string"?n.path:"",r=/\.([a-z]+)$/i.exec(o),i=r?r[1].toLowerCase():"";return`omo_skill_find "${{ts:"typescript",tsx:"typescript-react",js:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cs:"csharp",cpp:"cpp",c:"c",sh:"bash",bash:"bash",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",toml:"config",sql:"sql",html:"html",css:"css",scss:"css",vue:"vue",svelte:"svelte"}[i]??"code"} ${e}" --limit 5`}var ny=WA(JA(),".config","opencode","sisyphus-mandatory","sisyphus-mandatory.md");async function Dk(e){return await VA(e??ny,"utf-8")}function Pk(e,t){let n=t?.oracleVerified===!0,o=t?.filesChanged??0,r=["","## Sisyphus Protocol Enforcement","","You MUST follow these Sisyphus protocol rules:","","1. **Pre-response Memory Check**: Before any action, read `<project-memory>` and `<session-history-since>` blocks in context. Cite `<memory id>` for any fact used from memory. Do not ask questions whose answers are in those blocks.","","2. **Codebase Graph First**: Before using grep/glob/read for architecture or symbol queries, check whether `.codegraph/` or `graphify-out/` exists. If so, use codegraph/graphify tools first, then grep/read only as last resort.","","3. **Tool Routing Table**: Match common intents to the correct tool:",' - "we did this before" / "you should know" → `agentmemory_memory_recall`'," - Starting a task that resembles a previous one → `agentmemory_memory_smart_search`"," - Before asking the user a clarifying question → `agentmemory_memory_recall` first"," - Save durable insight/decision/rule → `agentmemory_memory_save`",""];if(/\boracle\b/i.test(e)&&!(n&&o>0))r.push("4. **Post-task Oracle Verification**: If files touched >= 3 OR any INVOKE trigger matches, invoke Oracle with the exact format:",' `task(subagent_type="oracle", run_in_background=false, prompt="Verify: ...")`'," - INVOKE triggers: created 1+ new file, modified abstraction, touched security/auth paths, modified DB/persistence, modified CI/CD, added/removed dependency, modified perf-critical path, todo had 2+ completed items."," - SKIP only when: files touched <= 2, no new file, no dependency change, single-step task, change is typo/comment/rename only."," - Verdict: PASS → done. FAIL/CONDITIONAL → fix and re-invoke. Max 3 invocations."," - Cost: Max 3 oracle invocations per task. Skip rate: Must NOT skip Oracle on 2+ file change.","");return r.push("5. **Parallel Query Rule**: Fire independent tool queries in the same turn. Do NOT serialize independent memory/context queries.","","6. **Empty-Result Escalation**: On empty `agentmemory_memory_recall`, fire `agentmemory_memory_smart_search` + `agentmemory_memory_export` before asking the user.","","7. **Hard Rules (No Exceptions)**:"," - Do NOT ask 'where is X?' if memory or session record already contains it."," - Do NOT claim 'I don't know' before firing at least 2 different recall tools."," - Do NOT re-issue clarifying questions whose answer is in `<project-memory>` or `<session-history-since>`."," - Do NOT suppress type errors with `as any`, `@ts-ignore`, or `@ts-expect-error`."," - Do NOT leave empty catch blocks `catch(e) {}`.",' - Do NOT start a fresh agent via `task()` when `task(task_id="ses_...")` (continuation) exists — use continuation IDs.'," - Do NOT batch-complete todos — mark each one `completed` immediately after finishing."," - Do NOT skip creating todos for multi-step tasks.","","8. **Self-Check Before Responding**:"," - Verify you read `<project-memory>` and `<session-history-since>` blocks."," - Verify you cited `<memory id>` for any fact used from memory."," - Verify you did not ask a question whose answer is in those blocks."," - For multi-file changes, verify Oracle was invoked."," - For codebase exploration, verify codegraph/graphify was tried before grep/read."," - After discovering something non-obvious, save it with `agentmemory_memory_save` so future sessions benefit."," - Do NOT save routine operations (file reads, greps, list commands), trivial decisions, or facts already covered by existing memory. Save only novel insights, non-obvious patterns, or corrections to previous assumptions.","","9. **CI Verification Loop (NON-NEGOTIABLE)**: After EVERY step of an implementation plan that produces a code change you intend to keep, you MUST execute the full CI loop BEFORE moving to the next step:"," a. Commit the changes atomically (one commit per verified increment, never omnibus)."," b. Push to the remote that has CI configured (own repo: `git push origin <branch>`. Fork upstream: `git push fork <branch>` + open/update PR)."," c. Wait for the CI run triggered by the push to reach a terminal state (`gh run watch <run-id> --exit-status`).",' d. Assert `conclusion == "success"` on EVERY job. If any job fails, fix the regression, re-push, and re-verify until all jobs are green.'," e. Capture the green run-id so the final plan-completion message can cite it as evidence."," - Anti-pattern this rule kills: running local tests, seeing 0 failures, declaring done, then shipping the next step on top of an unverified CI. Local green is NOT CI green. Pushed-not-watched is NOT CI green."," - At the END of the plan (when the last step is done), run a final guarantee: `gh run list --branch <branch> --limit 5` and assert EVERY recent run on this branch has `conclusion=success`. If any run shows `failure`, surface it explicitly to the user with the run-id, the failing job, and the log excerpt - do NOT claim plan success."," - For fork -> upstream PR workflow: verify the workflow_run on the upstream repo (the PR's head ref), not just the fork. Both must be green."," - This rule applies whenever the repo has a `.github/workflows/*.yml` file (or equivalent CI config). For repos without CI, document the absence explicitly."," - If the user explicitly says 'skip CI' or 'local only', this rule is suppressed for that turn ONLY - re-engage on next step.",""),r.join(`
251
+ `)}function Ck(e,t,n){let o=[],r=n.recentToolCalls??[],i=n.recentWriteContents??[],s=n.memorySaved??!1,a=n.batchCompletions??0;if((e==="grep"||e==="glob")&&(n.hasCodegraphDir||n.hasGraphifyDir)){let f=n.hasCodegraphDir?".codegraph":"graphify-out";o.push({rule:"codebase-graph-first",tool:e,severity:"media",detail:`Used ${e} when ${f} exists — should use codegraph/graphify first for architecture and symbol queries.`})}if(e==="task"&&t&&typeof t==="object"){let f=t;if(!f.task_id&&typeof f.prompt==="string"&&r.length>3)o.push({rule:"continuation-discipline",tool:e,severity:"leve",detail:`Started a new task() without task(task_id="ses_...") continuation ID. Use task_id to preserve the subagent's full context and save tokens.`})}if(zr.includes(e)){let f=typeof t==="object"&&t!==null?JSON.stringify(t):String(t??""),h=/@ts-ignore|@ts-expect-error/.test(f),m=/\bas any\b/.test(f);if(h&&m)o.push({rule:"no-type-suppression",tool:e,severity:"grave",detail:"File write contains both @ts-ignore/@ts-expect-error AND 'as any' — double type suppression. "+"Both are forbidden by the Sisyphus protocol."});else if(h)o.push({rule:"no-type-suppression",tool:e,severity:"media",detail:"File write contains @ts-ignore or @ts-expect-error — both are forbidden. "+"Fix the underlying type error instead."});else if(m)o.push({rule:"no-type-suppression",tool:e,severity:"media",detail:"File write contains 'as any' — type suppression forbidden. "+"Use proper type narrowing instead."})}if(zr.includes(e)){let f=typeof t==="object"&&t!==null?JSON.stringify(t):String(t??"");if(/catch\s*\(\s*\w+\s*\)\s*\{\s*\}/.test(f))o.push({rule:"no-empty-catch",tool:e,severity:"media",detail:"Empty catch block detected — `catch(e) {}` is forbidden. "+"Log the error or handle it gracefully."})}if(["codegraph_explore","graphify query"].includes(e)&&r.length>=2){if(!s)o.push({rule:"save-discovery-to-memory",tool:e,severity:"leve",detail:`Used ${e} to discover code but no memory save was made afterwards. Save non-obvious findings with agentmemory_memory_save so future sessions benefit.`})}if(a>0&&e!=="todowrite")o.push({rule:"no-batch-todo-completion",tool:e,severity:"leve",detail:"Batch todo completion detected. Each todo must be marked `completed` immediately "+"after finishing — do not batch-complete multiple items."});if(n.emptyRecall&&!n.escalationAttempted){if(e.startsWith("question")||e==="ask")o.push({rule:"empty-result-escalation",tool:e,severity:"grave",detail:"Memory recall returned empty but agent did not fire smart_search + export before asking the user. Steps 1-3 of empty-result escalation protocol are mandatory."})}let c=["agentmemory_memory_recall","agentmemory_memory_smart_search","agentmemory_memory_save"];if(!n.memoryToolsUsed.some((f)=>c.some((h)=>f.startsWith(h)))&&(e.startsWith("question")||e==="ask"))o.push({rule:"memory-first",tool:e,severity:"grave",detail:"Asked a question without first querying memory. Must fire agentmemory_memory_recall or agentmemory_memory_smart_search before asking the user."});if(n.filesChanged>=3&&!n.oracleInvoked&&zr.includes(e))o.push({rule:"oracle-verification",tool:e,severity:"media",detail:`Files changed (${n.filesChanged}) >= 3 but Oracle was not invoked. The POST-TASK ORACLE VERIFICATION protocol requires Oracle invocation on multi-file changes.`});return o}import{stat as IM}from"fs";import{stat as TM,readdir as EM}from"fs/promises";import{EventEmitter as $M}from"events";import*as oe from"path";import{stat as KA,lstat as Rk,readdir as YA,realpath as XA}from"node:fs/promises";import{Readable as QA}from"node:stream";import{resolve as Ak,relative as eM,join as tM,sep as rM}from"node:path";var Nt={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},oy={root:".",fileFilter:(e)=>!0,directoryFilter:(e)=>!0,type:Nt.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(oy);var Fk="READDIRP_RECURSIVE_ERROR",nM=new Set(["ENOENT","EPERM","EACCES","ELOOP",Fk]),Mk=[Nt.DIR_TYPE,Nt.EVERYTHING_TYPE,Nt.FILE_DIR_TYPE,Nt.FILE_TYPE],oM=new Set([Nt.DIR_TYPE,Nt.EVERYTHING_TYPE,Nt.FILE_DIR_TYPE]),iM=new Set([Nt.EVERYTHING_TYPE,Nt.FILE_DIR_TYPE,Nt.FILE_TYPE]),sM=(e)=>nM.has(e.code),aM=process.platform==="win32",Uk=(e)=>!0,Nk=(e)=>{if(e===void 0)return Uk;if(typeof e==="function")return e;if(typeof e==="string"){let t=e.trim();return(n)=>n.basename===t}if(Array.isArray(e)){let t=e.map((n)=>n.trim());return(n)=>t.some((o)=>n.basename===o)}return Uk};class zk extends QA{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...oy,...e},{root:n,type:o}=t;this._fileFilter=Nk(t.fileFilter),this._directoryFilter=Nk(t.directoryFilter);let r=t.lstat?Rk:KA;if(aM)this._stat=(i)=>r(i,{bigint:!0});else this._stat=r;this._maxDepth=t.depth??oy.depth,this._wantsDir=o?oM.has(o):!1,this._wantsFile=o?iM.has(o):!1,this._wantsEverything=o===Nt.EVERYTHING_TYPE,this._root=Ak(n),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(this.reading)return;this.reading=!0;try{while(!this.destroyed&&e>0){let t=this.parent,n=t&&t.files;if(n&&n.length>0){let{path:o,depth:r}=t,i=n.splice(0,e).map((a)=>this._formatEntry(a,o)),s=await Promise.all(i);for(let a of s){if(!a)continue;if(this.destroyed)return;let l=await this._getEntryType(a);if(l==="directory"&&this._directoryFilter(a)){if(r<=this._maxDepth)this.parents.push(this._exploreDir(a.fullPath,r+1));if(this._wantsDir)this.push(a),e--}else if((l==="file"||this._includeAsFile(a))&&this._fileFilter(a)){if(this._wantsFile)this.push(a),e--}}}else{let o=this.parents.pop();if(!o){this.push(null);break}if(this.parent=await o,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}async _exploreDir(e,t){let n;try{n=await YA(e,this._rdOptions)}catch(o){this._onError(o)}return{files:n,depth:t,path:e}}async _formatEntry(e,t){let n,o=this._isDirent?e.name:e;try{let r=Ak(tM(t,o));n={path:eM(this._root,r),fullPath:r,basename:o},n[this._statsProp]=this._isDirent?e:await this._stat(r)}catch(r){this._onError(r);return}return n}_onError(e){if(sM(e)&&!this.destroyed)this.emit("warn",e);else this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let t=e[this._statsProp];if(t.isFile())return"file";if(t.isDirectory())return"directory";if(t&&t.isSymbolicLink()){let n=e.fullPath;try{let o=await XA(n),r=await Rk(o);if(r.isFile())return"file";if(r.isDirectory()){let i=o.length;if(n.startsWith(o)&&n.substr(i,1)===rM){let s=Error(`Circular symlink detected: "${n}" points to "${o}"`);return s.code=Fk,this._onError(s)}return"directory"}}catch(o){return this._onError(o),""}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}}function Lk(e,t={}){let n=t.entryType||t.type;if(n==="both")n=Nt.FILE_DIR_TYPE;if(n)t.type=n;if(!e)throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");else if(typeof e!=="string")throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");else if(n&&!Mk.includes(n))throw Error(`readdirp: Invalid type passed. Use one of ${Mk.join(", ")}`);return t.root=e,new zk(t)}import{watchFile as cM,unwatchFile as jk,watch as lM}from"fs";import{open as uM,stat as Zk,lstat as dM,realpath as iy}from"fs/promises";import*as Ne from"path";import{type as pM}from"os";var mM="data",cy="end",Bk="close",Vl=()=>{};var Wl=process.platform,ly=Wl==="win32",fM=Wl==="darwin",hM=Wl==="linux",gM=Wl==="freebsd",qk=pM()==="OS400",je={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},ir=je,yM="watch",xM={lstat:dM,stat:Zk},qn="listeners",Bl="errHandlers",Lo="rawEmitters",vM=[qn,Bl,Lo],SM=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),bM=(e)=>SM.has(Ne.extname(e).slice(1).toLowerCase()),ay=(e,t)=>{if(e instanceof Set)e.forEach(t);else t(e)},bs=(e,t,n)=>{let o=e[t];if(!(o instanceof Set))e[t]=o=new Set([o]);o.add(n)},_M=(e)=>(t)=>{let n=e[t];if(n instanceof Set)n.clear();else delete e[t]},_s=(e,t,n)=>{let o=e[t];if(o instanceof Set)o.delete(n);else if(o===n)delete e[t]},Hk=(e)=>e instanceof Set?e.size===0:!e,ql=new Map;function Gk(e,t,n,o,r){let i=(s,a)=>{if(n(e),r(s,a,{watchedPath:e}),a&&e!==a)Hl(Ne.resolve(e,a),qn,Ne.join(e,a))};try{return lM(e,{persistent:t.persistent},i)}catch(s){o(s);return}}var Hl=(e,t,n,o,r)=>{let i=ql.get(e);if(!i)return;ay(i[t],(s)=>{s(n,o,r)})},kM=(e,t,n,o)=>{let{listener:r,errHandler:i,rawEmitter:s}=o,a=ql.get(t),l;if(!n.persistent){if(l=Gk(e,n,r,i,s),!l)return;return l.close.bind(l)}if(a)bs(a,qn,r),bs(a,Bl,i),bs(a,Lo,s);else{if(l=Gk(e,n,Hl.bind(null,t,qn),i,Hl.bind(null,t,Lo)),!l)return;l.on(ir.ERROR,async(c)=>{let u=Hl.bind(null,t,Bl);if(a)a.watcherUnusable=!0;if(ly&&c.code==="EPERM")try{await(await uM(e,"r")).close(),u(c)}catch(f){}else u(c)}),a={listeners:r,errHandlers:i,rawEmitters:s,watcher:l},ql.set(t,a)}return()=>{if(_s(a,qn,r),_s(a,Bl,i),_s(a,Lo,s),Hk(a.listeners))a.watcher.close(),ql.delete(t),vM.forEach(_M(a)),a.watcher=void 0,Object.freeze(a)}},sy=new Map,wM=(e,t,n,o)=>{let{listener:r,rawEmitter:i}=o,s=sy.get(t),a=s&&s.options;if(a&&(a.persistent<n.persistent||a.interval>n.interval))jk(t),s=void 0;if(s)bs(s,qn,r),bs(s,Lo,i);else s={listeners:r,rawEmitters:i,options:n,watcher:cM(t,n,(l,c)=>{ay(s.rawEmitters,(f)=>{f(ir.CHANGE,t,{curr:l,prev:c})});let u=l.mtimeMs;if(l.size!==c.size||u>c.mtimeMs||u===0)ay(s.listeners,(f)=>f(e,l))})},sy.set(t,s);return()=>{if(_s(s,qn,r),_s(s,Lo,i),Hk(s.listeners))sy.delete(t),jk(t),s.options=s.watcher=void 0,Object.freeze(s)}};class uy{constructor(e){this.fsw=e,this._boundHandleError=(t)=>e._handleError(t)}_watchWithNodeFs(e,t){let n=this.fsw.options,o=Ne.dirname(e),r=Ne.basename(e);this.fsw._getWatchedDir(o).add(r);let s=Ne.resolve(e),a={persistent:n.persistent};if(!t)t=Vl;let l;if(n.usePolling){let c=n.interval!==n.binaryInterval;a.interval=c&&bM(r)?n.binaryInterval:n.interval,l=wM(e,s,a,{listener:t,rawEmitter:this.fsw._emitRaw})}else l=kM(e,s,a,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return l}_handleFile(e,t,n){if(this.fsw.closed)return;let o=Ne.dirname(e),r=Ne.basename(e),i=this.fsw._getWatchedDir(o),s=t;if(i.has(r))return;let a=async(c,u)=>{if(!this.fsw._throttle(yM,e,5))return;if(!u||u.mtimeMs===0)try{let f=await Zk(e);if(this.fsw.closed)return;let{atimeMs:h,mtimeMs:m}=f;if(!h||h<=m||m!==s.mtimeMs)this.fsw._emit(ir.CHANGE,e,f);if((fM||hM||gM)&&s.ino!==f.ino){this.fsw._closeFile(c),s=f;let y=this._watchWithNodeFs(e,a);if(y)this.fsw._addPathCloser(c,y)}else s=f}catch(f){this.fsw._remove(o,r)}else if(i.has(r)){let{atimeMs:f,mtimeMs:h}=u;if(!f||f<=h||h!==s.mtimeMs)this.fsw._emit(ir.CHANGE,e,u);s=u}},l=this._watchWithNodeFs(e,a);if(!(n&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(ir.ADD,e,0))return;this.fsw._emit(ir.ADD,e,t)}return l}async _handleSymlink(e,t,n,o){if(this.fsw.closed)return;let r=e.fullPath,i=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let s;try{s=await iy(n)}catch(a){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;if(i.has(o)){if(this.fsw._symlinkPaths.get(r)!==s)this.fsw._symlinkPaths.set(r,s),this.fsw._emit(ir.CHANGE,n,e.stats)}else i.add(o),this.fsw._symlinkPaths.set(r,s),this.fsw._emit(ir.ADD,n,e.stats);return this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(e,t,n,o,r,i,s){if(e=Ne.join(e,""),s=this.fsw._throttle("readdir",e,1000),!s)return;let a=this.fsw._getWatchedDir(n.path),l=new Set,c=this.fsw._readdirp(e,{fileFilter:(u)=>n.filterPath(u),directoryFilter:(u)=>n.filterDir(u)});if(!c)return;return c.on(mM,async(u)=>{if(this.fsw.closed){c=void 0;return}let f=u.path,h=Ne.join(e,f);if(l.add(f),u.stats.isSymbolicLink()&&await this._handleSymlink(u,e,h,f))return;if(this.fsw.closed){c=void 0;return}if(f===o||!o&&!a.has(f))this.fsw._incrReadyCount(),h=Ne.join(r,Ne.relative(r,h)),this._addToNodeFs(h,t,n,i+1)}).on(ir.ERROR,this._boundHandleError),new Promise((u,f)=>{if(!c)return f();c.once(cy,()=>{if(this.fsw.closed){c=void 0;return}let h=s?s.clear():!1;if(u(void 0),a.getChildren().filter((m)=>m!==e&&!l.has(m)).forEach((m)=>{this.fsw._remove(e,m)}),c=void 0,h)this._handleRead(e,!1,n,o,r,i,s)})})}async _handleDir(e,t,n,o,r,i,s){let a=this.fsw._getWatchedDir(Ne.dirname(e)),l=a.has(Ne.basename(e));if(!(n&&this.fsw.options.ignoreInitial)&&!r&&!l)this.fsw._emit(ir.ADD_DIR,e,t);a.add(Ne.basename(e)),this.fsw._getWatchedDir(e);let c,u,f=this.fsw.options.depth;if((f==null||o<=f)&&!this.fsw._symlinkPaths.has(s)){if(!r){if(await this._handleRead(e,n,i,r,e,o,c),this.fsw.closed)return}u=this._watchWithNodeFs(e,(h,m)=>{if(m&&m.mtimeMs===0)return;this._handleRead(h,!1,i,r,e,o,c)})}return u}async _addToNodeFs(e,t,n,o,r){let i=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return i(),!1;let s=this.fsw._getWatchHelpers(e);if(n)s.filterPath=(a)=>n.filterPath(a),s.filterDir=(a)=>n.filterDir(a);try{let a=await xM[s.statMethod](s.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(s.watchPath,a))return i(),!1;let l=this.fsw.options.followSymlinks,c;if(a.isDirectory()){let u=Ne.resolve(e),f=l?await iy(e):e;if(this.fsw.closed)return;if(c=await this._handleDir(s.watchPath,a,t,o,r,s,f),this.fsw.closed)return;if(u!==f&&f!==void 0)this.fsw._symlinkPaths.set(u,f)}else if(a.isSymbolicLink()){let u=l?await iy(e):e;if(this.fsw.closed)return;let f=Ne.dirname(s.watchPath);if(this.fsw._getWatchedDir(f).add(s.watchPath),this.fsw._emit(ir.ADD,s.watchPath,a),c=await this._handleDir(f,a,t,o,e,s,u),this.fsw.closed)return;if(u!==void 0)this.fsw._symlinkPaths.set(Ne.resolve(e),u)}else c=this._handleFile(s.watchPath,a,t);if(i(),c)this.fsw._addPathCloser(e,c);return!1}catch(a){if(this.fsw._handleError(a))return i(),e}}}/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */var dy="/",OM="//",Xk=".",DM="..",PM="string",CM=/\\/g,Vk=/\/\//,RM=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,AM=/^\.[/\\]/;function Jl(e){return Array.isArray(e)?e:[e]}var py=(e)=>typeof e==="object"&&e!==null&&!(e instanceof RegExp);function MM(e){if(typeof e==="function")return e;if(typeof e==="string")return(t)=>e===t;if(e instanceof RegExp)return(t)=>e.test(t);if(typeof e==="object"&&e!==null)return(t)=>{if(e.path===t)return!0;if(e.recursive){let n=oe.relative(e.path,t);if(!n)return!1;return!n.startsWith("..")&&!oe.isAbsolute(n)}return!1};return()=>!1}function UM(e){if(typeof e!=="string")throw Error("string expected");e=oe.normalize(e),e=e.replace(/\\/g,"/");let t=!1;if(e.startsWith("//"))t=!0;let n=/\/\//;while(e.match(n))e=e.replace(n,"/");if(t)e="/"+e;return e}function Wk(e,t,n){let o=UM(t);for(let r=0;r<e.length;r++){let i=e[r];if(i(o,n))return!0}return!1}function NM(e,t){if(e==null)throw TypeError("anymatch: specify first argument");let o=Jl(e).map((r)=>MM(r));if(t==null)return(r,i)=>Wk(o,r,i);return Wk(o,t)}var Jk=(e)=>{let t=Jl(e).flat();if(!t.every((n)=>typeof n===PM))throw TypeError(`Non-string provided as watch path: ${t}`);return t.map(Qk)},Kk=(e)=>{let t=e.replace(CM,dy),n=!1;if(t.startsWith(OM))n=!0;while(t.match(Vk))t=t.replace(Vk,dy);if(n)t=dy+t;return t},Qk=(e)=>Kk(oe.normalize(Kk(e))),Yk=(e="")=>(t)=>{if(typeof t==="string")return Qk(oe.isAbsolute(t)?t:oe.join(e,t));else return t},FM=(e,t)=>{if(oe.isAbsolute(e))return e;return oe.join(t,e)},zM=Object.freeze(new Set);class ew{constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;if(!t)return;if(e!==Xk&&e!==DM)t.add(e)}async remove(e){let{items:t}=this;if(!t)return;if(t.delete(e),t.size>0)return;let n=this.path;try{await EM(n)}catch(o){if(this._removeWatcher)this._removeWatcher(oe.dirname(n),oe.basename(n))}}has(e){let{items:t}=this;if(!t)return;return t.has(e)}getChildren(){let{items:e}=this;if(!e)return[];return[...e.values()]}dispose(){this.items.clear(),this.path="",this._removeWatcher=Vl,this.items=zM,Object.freeze(this)}}var LM="stat",jM="lstat";class tw{constructor(e,t,n){this.fsw=n;let o=e;this.path=e=e.replace(AM,""),this.watchPath=o,this.fullWatchPath=oe.resolve(o),this.dirParts=[],this.dirParts.forEach((r)=>{if(r.length>1)r.pop()}),this.followSymlinks=t,this.statMethod=t?LM:jM}entryPath(e){return oe.join(this.watchPath,oe.relative(this.watchPath,e.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let n=this.entryPath(e);return this.fsw._isntIgnored(n,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}}class rw extends $M{constructor(e={}){super();this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,n={stabilityThreshold:2000,pollInterval:100},o={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?Jl(e.ignored):Jl([]),awaitWriteFinish:t===!0?n:typeof t==="object"?{...n,...t}:!1};if(qk)o.usePolling=!0;if(o.atomic===void 0)o.atomic=!o.usePolling;let r=process.env.CHOKIDAR_USEPOLLING;if(r!==void 0){let a=r.toLowerCase();if(a==="false"||a==="0")o.usePolling=!1;else if(a==="true"||a==="1")o.usePolling=!0;else o.usePolling=!!a}let i=process.env.CHOKIDAR_INTERVAL;if(i)o.interval=Number.parseInt(i,10);let s=0;this._emitReady=()=>{if(s++,s>=this._readyCount)this._emitReady=Vl,this._readyEmitted=!0,process.nextTick(()=>this.emit(je.READY))},this._emitRaw=(...a)=>this.emit(je.RAW,...a),this._boundRemove=this._remove.bind(this),this.options=o,this._nodeFsHandler=new uy(this),Object.freeze(o)}_addIgnoredPath(e){if(py(e)){for(let t of this._ignoredPaths)if(py(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e==="string"){for(let t of this._ignoredPaths)if(py(t)&&t.path===e)this._ignoredPaths.delete(t)}}add(e,t,n){let{cwd:o}=this.options;this.closed=!1,this._closePromise=void 0;let r=Jk(e);if(o)r=r.map((i)=>FM(i,o));if(r.forEach((i)=>{this._removeIgnoredPath(i)}),this._userIgnored=void 0,!this._readyCount)this._readyCount=0;return this._readyCount+=r.length,Promise.all(r.map(async(i)=>{let s=await this._nodeFsHandler._addToNodeFs(i,!n,void 0,0,t);if(s)this._emitReady();return s})).then((i)=>{if(this.closed)return;i.forEach((s)=>{if(s)this.add(oe.dirname(s),oe.basename(t||s))})}),this}unwatch(e){if(this.closed)return this;let t=Jk(e),{cwd:n}=this.options;return t.forEach((o)=>{if(!oe.isAbsolute(o)&&!this._closers.has(o)){if(n)o=oe.join(n,o);o=oe.resolve(o)}if(this._closePath(o),this._addIgnoredPath(o),this._watched.has(o))this._addIgnoredPath({path:o,recursive:!0});this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach((t)=>t.forEach((n)=>{let o=n();if(o instanceof Promise)e.push(o)})),this._streams.forEach((t)=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach((t)=>t.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>{return}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,n)=>{let r=(this.options.cwd?oe.relative(this.options.cwd,n):n)||Xk;e[r]=t.getChildren().sort()}),e}emitWithAll(e,t){if(this.emit(e,...t),e!==je.ERROR)this.emit(je.ALL,e,...t)}async _emit(e,t,n){if(this.closed)return;let o=this.options;if(ly)t=oe.normalize(t);if(o.cwd)t=oe.relative(o.cwd,t);let r=[t];if(n!=null)r.push(n);let i=o.awaitWriteFinish,s;if(i&&(s=this._pendingWrites.get(t)))return s.lastChange=new Date,this;if(o.atomic){if(e===je.UNLINK)return this._pendingUnlinks.set(t,[e,...r]),setTimeout(()=>{this._pendingUnlinks.forEach((a,l)=>{this.emit(...a),this.emit(je.ALL,...a),this._pendingUnlinks.delete(l)})},typeof o.atomic==="number"?o.atomic:100),this;if(e===je.ADD&&this._pendingUnlinks.has(t))e=je.CHANGE,this._pendingUnlinks.delete(t)}if(i&&(e===je.ADD||e===je.CHANGE)&&this._readyEmitted){let a=(l,c)=>{if(l)e=je.ERROR,r[0]=l,this.emitWithAll(e,r);else if(c){if(r.length>1)r[1]=c;else r.push(c);this.emitWithAll(e,r)}};return this._awaitWriteFinish(t,i.stabilityThreshold,e,a),this}if(e===je.CHANGE){if(!this._throttle(je.CHANGE,t,50))return this}if(o.alwaysStat&&n===void 0&&(e===je.ADD||e===je.ADD_DIR||e===je.CHANGE)){let a=o.cwd?oe.join(o.cwd,t):t,l;try{l=await TM(a)}catch(c){}if(!l||this.closed)return;r.push(l)}return this.emitWithAll(e,r),this}_handleError(e){let t=e&&e.code;if(e&&t!=="ENOENT"&&t!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||t!=="EPERM"&&t!=="EACCES"))this.emit(je.ERROR,e);return e||this.closed}_throttle(e,t,n){if(!this._throttled.has(e))this._throttled.set(e,new Map);let o=this._throttled.get(e);if(!o)throw Error("invalid throttle");let r=o.get(t);if(r)return r.count++,!1;let i,s=()=>{let l=o.get(t),c=l?l.count:0;if(o.delete(t),clearTimeout(i),l)clearTimeout(l.timeoutObject);return c};i=setTimeout(s,n);let a={timeoutObject:i,clear:s,count:0};return o.set(t,a),a}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,n,o){let r=this.options.awaitWriteFinish;if(typeof r!=="object")return;let i=r.pollInterval,s,a=e;if(this.options.cwd&&!oe.isAbsolute(e))a=oe.join(this.options.cwd,e);let l=new Date,c=this._pendingWrites;function u(f){IM(a,(h,m)=>{if(h||!c.has(e)){if(h&&h.code!=="ENOENT")o(h);return}let y=Number(new Date);if(f&&m.size!==f.size)c.get(e).lastChange=y;let k=c.get(e);if(y-k.lastChange>=t)c.delete(e),o(void 0,m);else s=setTimeout(u,i,m)})}if(!c.has(e))c.set(e,{lastChange:l,cancelWait:()=>(c.delete(e),clearTimeout(s),n)}),s=setTimeout(u,i)}_isIgnored(e,t){if(this.options.atomic&&RM.test(e))return!0;if(!this._userIgnored){let{cwd:n}=this.options,r=(this.options.ignored||[]).map(Yk(n)),s=[...[...this._ignoredPaths].map(Yk(n)),...r];this._userIgnored=NM(s,void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new tw(e,this.options.followSymlinks,this)}_getWatchedDir(e){let t=oe.resolve(e);if(!this._watched.has(t))this._watched.set(t,new ew(t,this._boundRemove));return this._watched.get(t)}_hasReadPermissions(e){if(this.options.ignorePermissionErrors)return!0;return Boolean(Number(e.mode)&256)}_remove(e,t,n){let o=oe.join(e,t),r=oe.resolve(o);if(n=n!=null?n:this._watched.has(o)||this._watched.has(r),!this._throttle("remove",o,100))return;if(!n&&this._watched.size===1)this.add(e,t,!0);this._getWatchedDir(o).getChildren().forEach((f)=>this._remove(o,f));let a=this._getWatchedDir(e),l=a.has(t);if(a.remove(t),this._symlinkPaths.has(r))this._symlinkPaths.delete(r);let c=o;if(this.options.cwd)c=oe.relative(this.options.cwd,o);if(this.options.awaitWriteFinish&&this._pendingWrites.has(c)){if(this._pendingWrites.get(c).cancelWait()===je.ADD)return}this._watched.delete(o),this._watched.delete(r);let u=n?je.UNLINK_DIR:je.UNLINK;if(l&&!this._isIgnored(o))this._emit(u,o);this._closePath(o)}_closePath(e){this._closeFile(e);let t=oe.dirname(e);this._getWatchedDir(t).remove(oe.basename(e))}_closeFile(e){let t=this._closers.get(e);if(!t)return;t.forEach((n)=>n()),this._closers.delete(e)}_addPathCloser(e,t){if(!t)return;let n=this._closers.get(e);if(!n)n=[],this._closers.set(e,n);n.push(t)}_readdirp(e,t){if(this.closed)return;let n={type:je.ALL,alwaysStat:!0,lstat:!0,...t,depth:0},o=Lk(e,n);return this._streams.add(o),o.once(Bk,()=>{o=void 0}),o.once(cy,()=>{if(o)this._streams.delete(o),o=void 0}),o}}function nw(e,t={}){let n=new rw(t);return n.add(e),n}import{existsSync as GM}from"node:fs";var ZM=/^[A-Z]:[\\/](pagefile\.sys|DumpStack\.log\.tmp|hiberfil\.sys|swapfile\.sys)/i;async function ow(e){if(!e.projectDir||!GM(e.projectDir))return{stop:async()=>{}};let t=(i)=>i.endsWith("SKILL.md"),n=nw(e.projectDir,{ignoreInitial:!0,usePolling:!0,interval:100,binaryInterval:100,ignored:(i)=>ZM.test(i)}),o=!1,r=new Promise((i)=>{n.once("ready",()=>{if(!o)i()})});return n.on("add",(i)=>{if(!o&&t(i))e.onChange(i,"add")}),n.on("change",(i)=>{if(!o&&t(i))e.onChange(i,"change")}),await r,await new Promise((i)=>setTimeout(i,100)),{async stop(){o=!0,await n.close()}}}var BM=[/^[A-Z]:[\\/](pagefile\.sys|DumpStack\.log\.tmp)/i,/^[A-Z]:[\\/](Users|home)[\\/][^\\/]+[\\/]AppData[\\/]Local[\\/]Temp[\\/]/i,/^\/(var|private\/var)\/folders\//,/^\/snap\//],qM=new Set(["EINVAL","ENOENT","EACCES","EBADF","EPERM"]),Kl=null;function iw(e={}){let t=Object.keys(e).length===0;if(t&&Kl)return Kl;let n=e.paths??BM,o=e.errorCodes??qM,r=e.logger??console,i=(u)=>{let f=u&&typeof u==="object"&&"code"in u&&u.code?o.has(u.code):!1,h=!!(u?.path&&n.some((m)=>m.test(u.path)));if(f&&h){r.warn?.("watcher_scan_blocked",{path:u.path,code:u.code,message:u.message});return}};process.on("uncaughtException",i);let s=()=>process.off("uncaughtException",i),a=(u)=>{if(u&&typeof u==="object"&&"code"in u)i(u)};process.on("unhandledRejection",a);let l=()=>process.off("unhandledRejection",a),c=()=>{if(s(),l(),t)Kl=null};if(t)Kl=c;return c}Ra();iw();var cw=new Set,lw={continue:0,warn:1,escalate:2,stop:3};function uw(e,t){return lw[e]>=lw[t]}function dw(e){if(e.tool!=="bash")return!1;let t=e.args?.command;if(typeof t!=="string")return!1;return/(?:>>?|[<>]\s*&?\s*[''"]?\s*\S+|\btee\s+[^|;&]+)/.test(t)}function nU(e){let t=e.args;if(!t||typeof t!=="object")return null;let n=["pattern","query","path","glob","regex","include_pattern"];for(let o of n){let r=t[o];if(typeof r==="string"&&r.trim().length>0)return r.trim()}return null}var Wt=Nl({sessionID:"__global__",global:!0,version:at});var pw=ft().health;try{nn({oldPaths:rn(),newPaths:ft()})}catch{}function Yl(e={},t={}){let n=pe(),o=new Yg;Q_(o);let r=process.cwd(),i=Io(),s=Qc({graphRetrieval:n,cwd:r}),a=el({sqlite:i}),l=tl({metrics:Wt,logFilePath:Ht,healthFilePath:pw}),c=rl({cwd:r}),u=nl({cwd:r}),f=ol({onDispatch:({sessionID:ut,mcpTool:fr,mcpArgs:Ct})=>{o.register({sessionID:ut,mcpTool:fr,mcpArgs:Ct})}}),h=il({onDispatch:({sessionID:ut,mcpTool:fr,mcpArgs:Ct})=>{o.register({sessionID:ut,mcpTool:fr,mcpArgs:Ct})}}),m=sl({cwd:r}),y=al({cwd:r}),k=cl({graphRetrieval:n,cwd:r}),S=ll({graphRetrieval:n,cwd:r}),I=ul({graphRetrieval:n,cwd:r}),D=dl({graphRetrieval:n,cwd:r}),R=pl({graphRetrieval:n,cwd:r}),M=ml({graphRetrieval:n,cwd:r}),me=fl({graphRetrieval:n,cwd:r}),Ee=hl({graphRetrieval:n,cwd:r}),Ue=gl({graphRetrieval:n,cwd:r}),$e=yl({graphRetrieval:n,cwd:r}),rt=xl({graphRetrieval:n,cwd:r}),ue=vl({graphRetrieval:n,cwd:r}),fe=Sl({graphRetrieval:n,cwd:r}),De=bl({graphRetrieval:n,cwd:r}),Pe=_l({graphRetrieval:n,cwd:r}),$r=kl({graphRetrieval:n,cwd:r}),Qt=wl({graphRetrieval:n,cwd:r}),jv=Il({graphRetrieval:n,cwd:r}),Gv=Tl({graphRetrieval:n,cwd:r}),Zv=El({graphRetrieval:n,cwd:r}),Bv=$l({graphRetrieval:n,cwd:r}),qv=Ol({graphRetrieval:n,cwd:r}),Hv=Dl({graphRetrieval:n,cwd:r}),Vv=Pl({cwd:r}),Wv=Rl({cwd:r}),Jv=Al({cwd:r}),Kv=Ml({cwd:r}),Yv=Ul({cwd:r});w("info",`v${at} MetaGovernor plugin loaded`,{version:at,build:at,cwd:r,projectHasCodegraph:n.hasCodegraphDir(r),projectHasGraphify:n.hasGraphifyDir(r)});let Xv="?";try{let fr=aw(import.meta.url),Ct=gy(fr);Xv=KM("sha256").update(Ct).digest("hex").slice(0,8)}catch{}return console.log(`[meta-governor] v${at} loaded (bundle: ${Xv})`),(async()=>{let ut=ft().selfVersionCache,fr=86400000,Ct=null;try{let Rt=gy(ut,"utf-8"),Or=JSON.parse(Rt);if(typeof Or.latest==="string"&&typeof Or.checkedAtMs==="number"&&Date.now()-Or.checkedAtMs<86400000)Ct={latest:Or.latest,checkedAtMs:Or.checkedAtMs}}catch{}let hr=Ct?.latest??null;if(!hr)try{let{execSync:Rt}=await import("node:child_process");if(hr=Rt("npm view @herjarsa/omo-meta-governor version",{timeout:5000,encoding:"utf-8",stdio:["pipe","pipe","pipe"],windowsHide:!0}).trim()||null,hr)try{let Or=ut.replace(/[\\/][^\\/]+$/,""),{mkdirSync:A,writeFileSync:bi}=await import("node:fs");A(Or,{recursive:!0}),bi(ut,JSON.stringify({latest:hr,checkedAtMs:Date.now()}))}catch{}}catch{}if(hr&&hr!==at)w("warn",`STALE_CACHE: loaded v${at} but npm has v${hr}. Run: npm cache clean --force && rm -rf ~/.cache/opencode/packages/@herjarsa/omo-meta-governor*`)})(),async(ut,fr)=>{w("info",`v${at} factory_invoked`,{version:at,hasInput:ut!=null,inputDir:ut?.directory??null,inputKeys:ut?Object.keys(ut):[]});let Ct=ut.client,hr=Ct!=null&&typeof Ct==="object"&&"tool"in Ct?Ct:null;gs().setClient(hr),Yc(hr);let Rt;try{Rt=await zl({projectDir:ut.directory??r})}catch(v){throw w("error","factory_config_load_failed",{message:v instanceof Error?v.message:String(v),stack:v instanceof Error?v.stack?.slice(0,800):void 0}),v}let Or={...e,...Rt.config,...fr?.meta_governor??{}},A;try{A=Qg(Or)}catch(v){throw w("error","factory_orchestrator_config_failed",{message:v instanceof Error?v.message:String(v)}),v}if(B_({preferredTool:A.graphRetrieval.preferredTool}),Rt.sources.length>0)w("info",`v${at} config_loaded`,{version:at,sources:Rt.sources,effectiveSource:Rt.effectiveSource,enabled:A.enabled});if(A.postWave?.enabled===!0&&A.intervention.respectDoneSignal===!1)w("info","post_wave_warning",{message:"postWave.enabled=true but intervention.respectDoneSignal=false: post-wave directives still fire on Oracle-verified PHASE-N-COMPLETE, but the done-signal latch is off (intervention is not auto-disabled at plan end)."});let bi=new Set,Od=new Set,LO=new Set,kt=ut.directory?YM(ut.directory):r,_i=fr?.meta_governor?.graphSync??Rt.config?.graphSync??e.graphSync;if(_i?.enabled!==!1){if(t.__test_onGraphSyncInit?.({projectDir:kt}),(t.__test_runGraphSync??Ca)({enabled:!0,watch:_i?.watch??!1,autoInstall:_i?.autoInstall??!0,installTimeoutMs:_i?.installTimeoutMs??60000,killOrphanedOnInit:_i?.killOrphanedOnInit??!0,projectDir:kt}).then((P)=>{if(P?.attempted&&P.availability.codegraph&&P.availability.graphify)bi.add(kt)}).catch((P)=>{w("warn",`graphSync init failed: ${String(P)}`)}),A.cliAnything?.enabled!==!1){let P=fr?.meta_governor?.cliAnything??Rt.config?.cliAnything;(t.__test_runCliAnythingSync??FS)({enabled:!0,autoInstall:P?.autoInstall??!0,autoUpgrade:P?.autoUpgrade??!0,cachePath:P?.cachePath??ft().cliAnythingUpgradeCheck,upgradeCheckTtlMs:P?.upgradeCheckTtlMs??86400000,projectDir:kt,installScope:P?.installScope??"global",cliHubBin:P?.cliHubBin??"cli-hub",skillsBin:P?.skillsBin??"npx skills"}).then((C)=>{if(C?.attempted&&C.availability.cliHub)LO.add(kt)}).catch((C)=>{w("warn",`cli-anything sync failed: ${String(C)}`)})}queueMicrotask(()=>{try{let P=A.graphSync.fetchBranch,b=TS(kt,P);if(b>0)w("info",`reindexOnFetch: ${b} new commits on origin/${P}, reindexing`),Vd(kt).catch((C)=>{w("warn",`reindexOnFetch failed: ${String(C)}`)})}catch{}})}try{let v=rU(aw(import.meta.url)),P=ks(v,"skills","chore.tar.gz");if(QM(P))wk({globalDir:ks(eU(),".agents","skills"),tarballPath:P,pluginVersion:at}).catch((b)=>{w("warn",`chore-skills bootstrap failed: ${String(b)}`)})}catch(v){w("warn",`chore-skills bootstrap failed: ${String(v)}`)}let ki=null;if(!A.enabled){if(Rt.sources.length>0)w("warn","config_loaded_but_disabled",{version:at,sources:Rt.sources,hint:"Set meta_governor.enabled=true (or top-level enabled:true) in your omo-meta-governor.jsonc to activate governance."});return{tool:{omo_search:s,omo_recall:a,omo_health:l,omo_find:c,omo_impact:u,omo_remember:f,omo_recall_mcp:h,omo_path:m,omo_explain:y,omo_files:k,omo_callers:S,omo_node:I,omo_context:D,omo_affected_cg:R,omo_status:M,omo_unlock:me,omo_mark_dirty:Ee,omo_sync_if_dirty:Ue,omo_index:$e,omo_visualize:rt,omo_serve:ue,omo_uninit:fe,omo_diagnose:De,omo_merge_graphs:Pe,omo_save_result:$r,omo_extract:Qt,omo_cluster_only:jv,omo_label:Gv,omo_tree:Zv,omo_clone:Bv,omo_add:qv,omo_check_update:Hv,omo_hook_status:Vv,omo_cli_anything_install:Wv,omo_cli_anything_list:Jv,omo_cli_anything_search:Kv,omo_cli_anything_info:Yv},dispose:async()=>{try{zd()}catch{}try{qd()}catch{}try{$a()}catch{}try{ko()}catch{}try{if(ki)await ki.stop()}catch{}}}}let Dd=()=>A.modelOverride?.providerID??t.providerID?.(),Pd=()=>A.modelOverride?.modelID??t.modelID?.(),jO=()=>A.modelOverride?.modelLimit??200000,F1=Dd()??"unknown",z1=Pd()??"unknown",Qv,eS;if(A.protocolEnforcement.enabled||A.protocolEnforcement.injectIntoSystem){let v=A.protocolEnforcement.path??ny;try{Qv=await Dk(v),eS=Pk(Qv)}catch(P){if(A.modelOverride?.verbosity!=="silent")w("warn",`could not load protocol: ${P instanceof Error?P.message:String(P)}`)}}let xt=new ry({maxEntries:100,ttlMs:3600000}),wi=new Ss(1000,300000),tn=new Ss(1000,300000),Cd=new Set,tS=new Set,rS=new Map,nS=new Set,GO=new Set,ZO=new Set,L1=new Set,oS=new Set,iS=new Map,sS=new Map,BO=()=>({currentWaveN:null,lastInjectedWaveN:null,lastInjectedAtMs:null,postWaveInjectionsThisWave:0,rulesReadForWave:{},oracleAfterPhaseAtMs:{},repoModeResolved:null}),aS=new Ss(1000,86400000),Rd=(v)=>{if(typeof t.__test_isMainSession==="function")try{return t.__test_isMainSession(v)}catch{return!0}return!0},bo=(v,P)=>{if(!v||!P)return;if(!Rd(v)){w("info",`persist skipped (subagent) for ${v}`);return}if(!A.intervention.persistToSession)return;let b=xt.get(v);if(b?.backgroundTaskInFlight||b?.oracleInFlight){w("info",`persist skipped (background task in flight) for ${v}`);return}let C=()=>(t.__test_persistSessionMessage??Xc)(v,P),N=(he)=>{if(!he.ok)w("warn",`persist intervention failed for ${v}`,{error:he.error});else w("info",`persisted intervention for ${v}`)};if(t.__test_persistSessionMessage){C().then((he)=>{if(!he.ok&&he.error&&/timed out/i.test(he.error)){let ke=xt.get(v);if(ke?.backgroundTaskInFlight||ke?.oracleInFlight){w("info",`persist retry skipped (background task in flight) for ${v}`);return}setTimeout(()=>{C().then(N)},t.__test_persistRetryDelayMs??1500);return}N(he)});return}w("info",`persist intervention (superficial, not queued) for ${v}: ${P.slice(0,200)}`),Wt.inc("interventions_delivered")},qO=z_((v)=>{try{Vc(v,pw)}catch(P){w("warn","health snapshot write failed",{error:String(P)})}},5000);try{let v=ks(kt,".agents","skills");ki=await(t.__test_startSkillsFsWatcher??ow)({projectDir:v,onChange:async(b,C)=>{if(C!=="add")return;try{Wt.inc("tier3_skills_created"),w("info",`tier3_skills_created: ${b}`)}catch(N){w("warn",`tier3 watcher onChange failed: ${String(N)}`)}}})}catch(v){w("warn",`tier3 fs watcher failed to start: ${String(v)}`)}return{dispose:async()=>{try{zd()}catch{}try{qd()}catch{}try{$a()}catch{}try{ko()}catch{}try{if(ki)await ki.stop()}catch{}},"tool.execute.before":async(v,P)=>{if(!A.enabled)return;if(!v.sessionID)return;if(A.skillPriming.enabled&&A.skillPriming.enforceMode==="block"&&v.tool!=="omo_skill_find"&&!nS.has(v.sessionID)&&(zr.includes(v.tool)||dw(v))&&!$k(v.tool,P?.args)){let N=Ok(v.tool,P?.args);throw Error(`[meta-governor] skill-priming required: run \`${N}\` to discover relevant skills before using "${v.tool}". Pass the candidates to a sub-agent via \`task(category='<category>', load_skills=[...])\` to load 2-3 capabilities. Set skillPriming.enforceMode='directive' in your config to bypass this gate, or write to a tmp/test/scratch path for trivial edits.`)}if(!A.protocolEnforcement.auditToolCalls)return;let b=xt.get(v.sessionID);if(!b)b={memoryToolsUsed:[],hasCodegraphDir:n.hasCodegraphDir(r),hasGraphifyDir:n.hasGraphifyDir(r),oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,lastViolationInjectionAtMs:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},xt.set(v.sessionID,b);if(b?.oracleInFlight)return;if(eS)w("info","protocol loaded, system injection ready");let C=Ck(v.tool,P.args,{memoryToolsUsed:b.memoryToolsUsed,hasCodegraphDir:b.hasCodegraphDir,hasGraphifyDir:b.hasGraphifyDir,oracleInvoked:b.oracleInvoked,filesChanged:b.filesChanged,emptyRecall:b.emptyRecall,escalationAttempted:b.escalationAttempted,recentToolCalls:b.recentToolCalls,recentWriteContents:b.recentWriteContents,memorySaved:b.memorySaved,batchCompletions:b.batchCompletions});if(C.length>0){let he=b.lastViolationInjectionAtMs??0;if(he>0&&Date.now()-he<30000){w("info",`violation during cooldown (${Math.round((30000-(Date.now()-he))/1000)}s remaining), skipping queue`);let ke=C.map((Qe)=>({severity:Qe.severity,category:Qe.rule,detail:Qe.detail,ts:Date.now()}));b.accumulatedDeviations=[...b.accumulatedDeviations,...ke].slice(-5)}else{w("warn",`protocol violations on tool ${v.tool}`,C);let ke=wi.get(v.sessionID)?.items??[],Qe=new Set;for(let se of C){let We=`${se.severity}::${se.rule}::${se.detail}`;if(Qe.has(We))continue;Qe.add(We);let G=`[${se.severity.toUpperCase()}] ${se.rule}: ${se.detail}`;if(!ke.includes(G))ke.push(G)}wi.set(v.sessionID,{items:ke});let de=C.map((se)=>({severity:se.severity,category:se.rule,detail:se.detail,ts:Date.now()}));b.accumulatedDeviations=[...b.accumulatedDeviations,...de].slice(-5)}}else w("info",`audit OK on tool ${v.tool}`);if((v.tool==="grep"||v.tool==="glob")&&(n.hasCodegraphDir(r)||n.hasGraphifyDir(r))){let N=nU(v);if(N)n.invoke(r,N,{timeoutMs:5000}).then((he)=>{if(he.result)n.cacheContext(v.sessionID,N,he.result)}).catch((he)=>{w("warn",`graphRetrieval.invoke failed for session ${v.sessionID}: ${String(he)}`)})}},"tool.execute.after":async(v,P)=>{if(!A.enabled)return;if(Wt.inc("tool_calls_observed"),v.sessionID&&(v.tool==="omo_skill_find"||v.tool==="omo_skill_add"||v.tool==="omo_skill_get"||v.tool==="omo_skill_local_link"||v.tool==="omo_skill_semantic_find"||v.tool==="omo_skill_create"))nS.add(v.sessionID);if(v.sessionID){let G=v.sessionID;if(v.tool==="omo_search"||v.tool==="omo_find"||v.tool==="omo_impact"||v.tool==="omo_path"||v.tool==="omo_explain")GO.add(G);if(v.tool==="omo_recall"||v.tool==="omo_recall_mcp")ZO.add(G)}qO.write(Wc({version:at,enabled:!0,sessionID:v.sessionID||"__unknown__",snapshot:Wt.getMetrics(),logFilePath:Ht}));try{o.markDelivered({sessionID:v.sessionID,mcpTool:v.tool,mcpArgs:v.args})}catch{}if(zr.includes(v.tool))oS.add(v.sessionID);let b=xt.get(v.sessionID);if(b){if(b.iteration++,b.recentToolCalls=[v.tool].concat(b.recentToolCalls).slice(0,20),zr.includes(v.tool)||dw(v)){b.filesChanged++;let Se=(P.output??"").slice(0,500);b.recentWriteContents=[Se].concat(b.recentWriteContents).slice(0,3);let ne=v.args,Je=ne?.filePath??ne?.path;if(v.tool==="bash"&&(typeof Je!=="string"||Je.length===0)){let Ii=(v.args?.command??"").match(/(?:>>?)\s*[''"]?([^''"&\s;]+)/);if(Ii)Je=Ii[1]}if(typeof Je==="string"&&Je.length>0)b.recentWriteFilePaths=[Je].concat(b.recentWriteFilePaths).slice(0,10)}if(["agentmemory_memory_recall","agentmemory_memory_smart_search","agentmemory_memory_save"].some((Se)=>v.tool.startsWith(Se))&&!b.memoryToolsUsed.includes(v.tool))b.memoryToolsUsed.push(v.tool);if(v.tool.startsWith("agentmemory_memory_save")){let Se=P.output??"";if(Se.includes("saved")||Se.includes("written"))b.memorySaved=!0}if(v.tool==="task"){let Se=P.output??"",ne=v.args,Je=ne?.subagent_type;if(Je==="oracle"||/"subagent_type"\s*:\s*"oracle"/.test(Se)){if(b.oracleInvoked=!0,ne?.run_in_background===!0)b.oracleInFlight=!0,b.oracleInFlightSinceMs=Date.now()}if(ne?.run_in_background===!0&&typeof Je==="string")b.backgroundTaskInFlight=!0,b.backgroundTaskInFlightSinceMs=Date.now(),b.backgroundTaskType=Je,w("info",`background_task_in_flight: subagent_type=${Je} for session ${v.sessionID}`)}let ee=(P.output??"").toLowerCase();if(v.tool.includes("recall")&&(ee.includes("returned empty")||ee.includes("no results")))b.emptyRecall=!0;if(v.tool==="todowrite"&&(P.output??"").includes("completed")){if(((P.output??"").match(/"status":"completed"/g)??[]).length>=3)b.batchCompletions++}let ve=[typeof P.output==="string"?P.output:"",typeof v.args==="string"?v.args:""].join(`
252
252
  `);if(!b.taskDoneSignal&&dU(ve))b.taskDoneSignal=!0,b.signalAtMs=Date.now(),w("info",`task_done_signal detected (legacy) for session ${v.sessionID}`);if(!b.phaseCompleteSignal&&pU(ve))b.phaseCompleteSignal=!0,b.signalAtMs=Date.now(),w("info",`phase_complete_signal detected for session ${v.sessionID}`);if(!b.planCompleteSignal&&mU(ve))b.planCompleteSignal=!0,b.signalAtMs=Date.now(),w("info",`plan_complete_signal detected for session ${v.sessionID}`);if(b.oracleInFlight){let ne=b.oracleInFlightSinceMs!==null&&Date.now()-b.oracleInFlightSinceMs>300000;if(b.oracleInFlightSinceMs!==null&&b.signalAtMs>b.oracleInFlightSinceMs||ne)b.oracleInFlight=!1,b.oracleInFlightSinceMs=null,w("info",`oracle_completed: re-enabling intervention for session ${v.sessionID}${ne?" (timeout)":""}`);if(v.tool==="task"&&v.args?.subagent_type==="oracle"&&v.args?.run_in_background===!1)b.oracleInFlight=!1,b.oracleInFlightSinceMs=null,w("info",`oracle_completed (foreground call): re-enabling intervention for session ${v.sessionID}`)}if(b.backgroundTaskInFlight){if(b.backgroundTaskInFlightSinceMs!==null&&Date.now()-b.backgroundTaskInFlightSinceMs>300000)b.backgroundTaskInFlight=!1,b.backgroundTaskInFlightSinceMs=null,b.backgroundTaskType=null,w("info",`background_task_timed_out: re-enabling intervention for session ${v.sessionID}`)}}if(A.postWave?.enabled){let G=A.postWave,T=[typeof P.output==="string"?P.output:"",typeof v.args==="string"?v.args:""].join(`
253
- `),ee=fU(T),ve=v.tool==="task"&&/"subagent_type"\s*:\s*"oracle"/.test(T);if(ee!==null||ve){let Se=xt.get(v.sessionID);if(Se){let Dr=hy(T);if(Se.recentPwArgsHashes.includes(Dr)){if(ee===null&&ve)w("info",`post_wave_dedupe: skipping re-detection of identical Oracle-call text for session ${v.sessionID}`)}else Se.recentPwArgsHashes=[Dr,...Se.recentPwArgsHashes].slice(0,8)}let ne=aS.get(v.sessionID);if(!ne)ne=BO(),aS.set(v.sessionID,ne);if(ee!==null&&ee!==ne.currentWaveN)ne.currentWaveN=ee,ne.postWaveInjectionsThisWave=0;if(ve&&ne.currentWaveN!==null){if(!(Se!==void 0&&Se.recentPwArgsHashes.slice(1).includes(hy(T))))ne.oracleAfterPhaseAtMs[ne.currentWaveN]=Date.now()}let Je=Date.now();if(hU({postWave:ne},G,Je)){let Dr=ne.repoModeResolved??xU(G.repoMode??"auto",kt);ne.repoModeResolved=Dr;let Ii=Dr==="third-party"?yU(G.thirdPartyDirective,ne.currentWaveN,G.aasToolPrefix):gU(G.ownRepoDirective,ne.currentWaveN);ne.lastInjectedWaveN=ne.currentWaveN,ne.lastInjectedAtMs=Je,ne.postWaveInjectionsThisWave++,J_(v.sessionID,Ii).then((Ad)=>{if(!Ad.ok)w("info",`post-wave directive delivery failed for ${v.sessionID}: ${Ad.error??"unknown"}`)})}}}if(b?.interventionDisabled)return;let N=(b?.recentToolCalls??[]).slice(0,5).filter((G)=>["write","edit","edit_block","desktop-commander_write_file","desktop-commander_edit_block","task"].includes(G)),he=b?!(b.oracleInFlight||b.backgroundTaskInFlight)&&N.length===0:!1,ke=b?.accumulatedDeviations??[],Qe=yk(v.sessionID),de=JS(Qe),se={sessionID:v.sessionID,toolName:v.tool,toolOutput:P.output,consecutiveStops:de,iteration:b?.iteration??0,maxIterations:A.closedLoop.maxLessonsPerSession??10,oracleVerified:b?.oracleInvoked??!1,noProgress:he,filesChanged:b?.filesChanged??0,recentTurnTokens:[],deviations:ke,filePaths:b?.recentWriteFilePaths??[],...(()=>{let{backends:G,writeBackend:T}=t;if(G&&T)return{backends:G,writeBackend:T};try{let ee=Io();return{backends:G??{agentmemory:ee,boulderState:ee},writeBackend:T??ee}}catch{return{backends:G??{agentmemory:{smartSearch:async()=>({lessons:[],crystals:[]})},boulderState:{boulderRead:async()=>[]}},writeBackend:T??{saveMemory:async()=>({id:""}),saveLesson:async()=>({id:""})}}}})(),config:A,...Dd()?{providerID:Dd()}:{},...Pd()?{modelID:Pd()}:{},modelLimit:jO(),currentLessonCount:b?.lessonCount??0},He;try{if(He=await eb(se),He.lessonSaved?.lessonSaved&&b)b.lessonCount++;if(He.decision.action!=="continue")Ht.inc("decisions_taken");if(He.decision.action==="escalate"&&v.sessionID&&ys()){let G=xt.get(v.sessionID)??b;if(G?.backgroundTaskInFlight||G?.oracleInFlight)w("info",`escalation prompt skipped (background task in flight) for ${v.sessionID}`);else{let T=He.decision.historyEntry.decision,ee=T.evidence.length,ve=T.shouldEscalateTo;if(!ve){w("info",`escalation suppressed by oracle.frequency for ${v.sessionID} (action=${T.action})`);return}let Se=Y_({reasoning:T.reasoning,target:ve,evidenceCount:ee,sessionID:v.sessionID});setTimeout(()=>{Bn(v.sessionID,{toolName:"meta_governor_escalate",mcpTool:"task",mcpArgs:{subagent_type:ve},preamble:Se}).catch((ne)=>{w("warn",`escalation prompt failed: ${String(ne)}`)})},250)}}if(A.intervention.mode!=="silent"&&b){let G=He.decision;if(b.oracleInFlight||b.backgroundTaskInFlight){let ee=b.oracleInFlight?"oracle_in_flight":"background_task_in_flight";w("info",`${ee}: skipping intervention for session ${v.sessionID} (score ${He.scoringResult.rawScore.toFixed(2)})`);return}let T=A.intervention.phaseAwareDoneSignal===!0;if(A.intervention.respectDoneSignal&&b.oracleInvoked&&(b.planCompleteSignal||!T&&(b.taskDoneSignal||b.phaseCompleteSignal))){b.interventionDisabled=!0;let ee=b.planCompleteSignal?"PLAN-COMPLETE":b.taskDoneSignal?"DONE":"PHASE-N-COMPLETE";w("info",`task verified (${ee} + Oracle): disabling intervention for session ${v.sessionID}`),vs(v.sessionID);return}if(G.action!=="continue"&&uw(G.action,A.intervention.minActionForMessage)){let ee=Math.max(0,A.intervention.maxInterventionsPerSession??0);if(ee>0&&b.interventionCount>=ee){b.interventionDisabled=!0,w("warn",`intervention cap (${ee}) reached for session ${v.sessionID}; disabling further intervention`),vs(v.sessionID);return}let ve=60000,Se=Date.now(),ne=G.historyEntry?.reasoning??G.message??"",Je=`${G.action}::${ne.slice(0,80)}`;if((G.action==="warn"||G.action==="escalate")&&b.lastWarnHash===Je&&b.lastWarnAtMs>0&&Se-b.lastWarnAtMs<ve){w("info",`warn_cooldown: suppressing duplicate ${G.action} (${Math.round((ve-(Se-b.lastWarnAtMs))/1000)}s remaining) for session ${v.sessionID}`),vs(v.sessionID);return}if(b.interventionCount++,G.action==="warn"||G.action==="escalate")b.lastWarnAtMs=Se,b.lastWarnHash=Je}}}catch{}if(He&&He.decision&&He.decision.action!=="continue")ey(v.sessionID,He.decision);try{if(v.tool==="bash"){let T=v.args?.command;if(Vd(T))w("info","git_commit_reindex_triggered",{sessionID:v.sessionID,command:T}),t.__test_onCommitTrigger?.({projectDir:kt,command:T??"",sessionID:v.sessionID}),Wd(kt).catch((ee)=>{w("warn",`codegraph sync failed: ${String(ee)}`)})}}catch{}try{if(v.tool==="bash"){let T=v.args?.command;if(iU(T)){let ee=oU(P.output,v.sessionID);if(ee.length>0){let ve=tn.get(v.sessionID)?.items??[];tn.set(v.sessionID,{items:ve.concat(ee)}),w("info",`captured ${ee.length} bot feedback line(s) for session ${v.sessionID}`)}}}}catch{}try{let G=v.args?.command;if(v.tool==="bash"&&sU(G)){let T=A.ciMonitor;if(T?.enabled){let ee=aU(r),ve=cU(r);if(ee&&ve)w("info",`ci_monitor: git push detected on ${ve}@${ee.slice(0,7)} — starting background poll`),lU(ee,ve,T,v.sessionID).catch((Se)=>{w("warn",`ci_monitor: background poll failed: ${Se instanceof Error?Se.message:String(Se)}`)})}}}catch{}},"experimental.chat.messages.transform":async(v,P)=>{if(!A.enabled)return;let C=P.messages[P.messages.length-1]?.info?.sessionID;if(!C)return;let N=xt.get(C);if(A.skillPriming.enabled&&!tS.has(C)&&Ek({trigger:A.skillPriming.trigger,recentToolCalls:N?.recentToolCalls??[],implementationToolSeen:oS.has(C)})){tS.add(C);let st=Ik(A.skillPriming.router);rS.set(C,st),w("info",`skill_priming_injected for session ${C}`),bo(C,Tk(A.skillPriming.router))}if(bi.has(kt)&&!Od.has(C)){let st=["[META-GOVERNOR] codegraph y graphify ya están inicializados en este repo. ","ROUTING EXPLÍCITO (v0.25.0): ","• Símbolos/definiciones/callers/impacto (código) → CODEGRAPH: omo_find, omo_impact, omo_search. ","• Conceptos/arquitectura/conexiones/explicaciones → GRAPHIFY: omo_path, omo_explain (y omo_search en modo alternate). ","• Vista general del repo → lee graphify-out/GRAPH_REPORT.md. ","Actualizan tras cada commit."].join(" ");w("info",`graph_tools_ready_injected for session ${C}`),bo(C,st)}let he=tn.get(C);if(he){let st=he.items;if(st.length>0){let At=`[MetaGovernor PR Reviewer Feedback]
253
+ `),ee=fU(T),ve=v.tool==="task"&&/"subagent_type"\s*:\s*"oracle"/.test(T);if(ee!==null||ve){let Se=xt.get(v.sessionID);if(Se){let Dr=hy(T);if(Se.recentPwArgsHashes.includes(Dr)){if(ee===null&&ve)w("info",`post_wave_dedupe: skipping re-detection of identical Oracle-call text for session ${v.sessionID}`)}else Se.recentPwArgsHashes=[Dr,...Se.recentPwArgsHashes].slice(0,8)}let ne=aS.get(v.sessionID);if(!ne)ne=BO(),aS.set(v.sessionID,ne);if(ee!==null&&ee!==ne.currentWaveN)ne.currentWaveN=ee,ne.postWaveInjectionsThisWave=0;if(ve&&ne.currentWaveN!==null){if(!(Se!==void 0&&Se.recentPwArgsHashes.slice(1).includes(hy(T))))ne.oracleAfterPhaseAtMs[ne.currentWaveN]=Date.now()}let Je=Date.now();if(hU({postWave:ne},G,Je)){let Dr=ne.repoModeResolved??xU(G.repoMode??"auto",kt);ne.repoModeResolved=Dr;let Ii=Dr==="third-party"?yU(G.thirdPartyDirective,ne.currentWaveN,G.aasToolPrefix):gU(G.ownRepoDirective,ne.currentWaveN);ne.lastInjectedWaveN=ne.currentWaveN,ne.lastInjectedAtMs=Je,ne.postWaveInjectionsThisWave++,J_(v.sessionID,Ii).then((Ad)=>{if(!Ad.ok)w("info",`post-wave directive delivery failed for ${v.sessionID}: ${Ad.error??"unknown"}`)})}}}if(b?.interventionDisabled)return;let N=(b?.recentToolCalls??[]).slice(0,5).filter((G)=>["write","edit","edit_block","desktop-commander_write_file","desktop-commander_edit_block","task"].includes(G)),he=b?!(b.oracleInFlight||b.backgroundTaskInFlight)&&N.length===0:!1,ke=b?.accumulatedDeviations??[],Qe=yk(v.sessionID),de=JS(Qe),se={sessionID:v.sessionID,toolName:v.tool,toolOutput:P.output,consecutiveStops:de,iteration:b?.iteration??0,maxIterations:A.closedLoop.maxLessonsPerSession??10,oracleVerified:b?.oracleInvoked??!1,noProgress:he,filesChanged:b?.filesChanged??0,recentTurnTokens:[],deviations:ke,filePaths:b?.recentWriteFilePaths??[],...(()=>{let{backends:G,writeBackend:T}=t;if(G&&T)return{backends:G,writeBackend:T};try{let ee=Io();return{backends:G??{agentmemory:ee,boulderState:ee},writeBackend:T??ee}}catch{return{backends:G??{agentmemory:{smartSearch:async()=>({lessons:[],crystals:[]})},boulderState:{boulderRead:async()=>[]}},writeBackend:T??{saveMemory:async()=>({id:""}),saveLesson:async()=>({id:""})}}}})(),config:A,...Dd()?{providerID:Dd()}:{},...Pd()?{modelID:Pd()}:{},modelLimit:jO(),currentLessonCount:b?.lessonCount??0},We;try{if(We=await eb(se),We.lessonSaved?.lessonSaved&&b)b.lessonCount++;if(We.decision.action!=="continue")Wt.inc("decisions_taken");if(We.decision.action==="escalate"&&v.sessionID&&ys()){let G=xt.get(v.sessionID)??b;if(G?.backgroundTaskInFlight||G?.oracleInFlight)w("info",`escalation prompt skipped (background task in flight) for ${v.sessionID}`);else{let T=We.decision.historyEntry.decision,ee=T.evidence.length,ve=T.shouldEscalateTo;if(!ve){w("info",`escalation suppressed by oracle.frequency for ${v.sessionID} (action=${T.action})`);return}let Se=Y_({reasoning:T.reasoning,target:ve,evidenceCount:ee,sessionID:v.sessionID});setTimeout(()=>{Bn(v.sessionID,{toolName:"meta_governor_escalate",mcpTool:"task",mcpArgs:{subagent_type:ve},preamble:Se}).catch((ne)=>{w("warn",`escalation prompt failed: ${String(ne)}`)})},250)}}if(A.intervention.mode!=="silent"&&b){let G=We.decision;if(b.oracleInFlight||b.backgroundTaskInFlight){let ee=b.oracleInFlight?"oracle_in_flight":"background_task_in_flight";w("info",`${ee}: skipping intervention for session ${v.sessionID} (score ${We.scoringResult.rawScore.toFixed(2)})`);return}let T=A.intervention.phaseAwareDoneSignal===!0;if(A.intervention.respectDoneSignal&&b.oracleInvoked&&(b.planCompleteSignal||!T&&(b.taskDoneSignal||b.phaseCompleteSignal))){b.interventionDisabled=!0;let ee=b.planCompleteSignal?"PLAN-COMPLETE":b.taskDoneSignal?"DONE":"PHASE-N-COMPLETE";w("info",`task verified (${ee} + Oracle): disabling intervention for session ${v.sessionID}`),vs(v.sessionID);return}if(G.action!=="continue"&&uw(G.action,A.intervention.minActionForMessage)){let ee=Math.max(0,A.intervention.maxInterventionsPerSession??0);if(ee>0&&b.interventionCount>=ee){b.interventionDisabled=!0,w("warn",`intervention cap (${ee}) reached for session ${v.sessionID}; disabling further intervention`),vs(v.sessionID);return}let ve=60000,Se=Date.now(),ne=G.historyEntry?.reasoning??G.message??"",Je=`${G.action}::${ne.slice(0,80)}`;if((G.action==="warn"||G.action==="escalate")&&b.lastWarnHash===Je&&b.lastWarnAtMs>0&&Se-b.lastWarnAtMs<ve){w("info",`warn_cooldown: suppressing duplicate ${G.action} (${Math.round((ve-(Se-b.lastWarnAtMs))/1000)}s remaining) for session ${v.sessionID}`),vs(v.sessionID);return}if(b.interventionCount++,G.action==="warn"||G.action==="escalate")b.lastWarnAtMs=Se,b.lastWarnHash=Je}}}catch{}if(We&&We.decision&&We.decision.action!=="continue")ey(v.sessionID,We.decision);try{if(v.tool==="bash"){let T=v.args?.command;if(Hd(T))w("info","git_commit_reindex_triggered",{sessionID:v.sessionID,command:T}),t.__test_onCommitTrigger?.({projectDir:kt,command:T??"",sessionID:v.sessionID}),Vd(kt).catch((ee)=>{w("warn",`codegraph sync failed: ${String(ee)}`)})}}catch{}try{if(v.tool==="bash"){let T=v.args?.command;if(iU(T)){let ee=oU(P.output,v.sessionID);if(ee.length>0){let ve=tn.get(v.sessionID)?.items??[];tn.set(v.sessionID,{items:ve.concat(ee)}),w("info",`captured ${ee.length} bot feedback line(s) for session ${v.sessionID}`)}}}}catch{}try{let G=v.args?.command;if(v.tool==="bash"&&sU(G)){let T=A.ciMonitor;if(T?.enabled){let ee=aU(r),ve=cU(r);if(ee&&ve)w("info",`ci_monitor: git push detected on ${ve}@${ee.slice(0,7)} — starting background poll`),lU(ee,ve,T,v.sessionID).catch((Se)=>{w("warn",`ci_monitor: background poll failed: ${Se instanceof Error?Se.message:String(Se)}`)})}}}catch{}},"experimental.chat.messages.transform":async(v,P)=>{if(!A.enabled)return;let C=P.messages[P.messages.length-1]?.info?.sessionID;if(!C)return;let N=xt.get(C);if(A.skillPriming.enabled&&!tS.has(C)&&Ek({trigger:A.skillPriming.trigger,recentToolCalls:N?.recentToolCalls??[],implementationToolSeen:oS.has(C)})){tS.add(C);let st=Ik(A.skillPriming.router);rS.set(C,st),w("info",`skill_priming_injected for session ${C}`),bo(C,Tk(A.skillPriming.router))}if(bi.has(kt)&&!Od.has(C)){let st=["[META-GOVERNOR] codegraph y graphify ya están inicializados en este repo. ","ROUTING EXPLÍCITO (v0.25.0): ","• Símbolos/definiciones/callers/impacto (código) → CODEGRAPH: omo_find, omo_impact, omo_search. ","• Conceptos/arquitectura/conexiones/explicaciones → GRAPHIFY: omo_path, omo_explain (y omo_search en modo alternate). ","• Vista general del repo → lee graphify-out/GRAPH_REPORT.md. ","Actualizan tras cada commit."].join(" ");w("info",`graph_tools_ready_injected for session ${C}`),bo(C,st)}let he=tn.get(C);if(he){let st=he.items;if(st.length>0){let At=`[MetaGovernor PR Reviewer Feedback]
254
254
 
255
255
  ${st.map((wt,Pr)=>`${Pr+1}. ${wt}`).join(`
256
256
  `)}
@@ -260,15 +260,15 @@ Apply these fixes to keep the PR mergeable.`;if(!jl(P.messages)){let wt=or(At,{k
260
260
  ${st.map((Pr,er)=>`${er+1}. ${Pr}`).join(`
261
261
  `)}
262
262
 
263
- Remember: use codegraph/graphify for architecture queries, do not grep without trying codegraph/graphify first, no @ts-ignore/as-any, no empty catch, check memory before asking.`;bo(C,At);let wt=xt.get(C);if(wt)wt.lastViolationInjectionAtMs=Date.now()}}let de=ty(C);if(!de)return;if(de.action==="continue")return;if(!de.message)return;if(!uw(de.action,A.intervention.minActionForMessage))return;let se=N??xt.get(C);if(!se)se={memoryToolsUsed:[],hasCodegraphDir:n.hasCodegraphDir(r),hasGraphifyDir:n.hasGraphifyDir(r),oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,lastViolationInjectionAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},xt.set(C,se);let He=Math.max(0,A.intervention.maxInterventionsPerSession??0);if(He>0&&se.interventionCount>=He){se.interventionDisabled=!0;return}if(se.backgroundTaskInFlight||se.oracleInFlight){w("info",`decision injection suppressed (background task in flight) for ${C}`);try{ey(C,de)}catch{}return}let G=A.intervention.includeDecisionHistory!==!1,T=A.intervention.maxHistoryMessages??5,ee=(se.recentInterventionTexts??[]).slice(-T),ve=[];for(let st of ee)if(ve.length===0||ve[ve.length-1]!==st)ve.push(st);let Se=Math.max(T,ve.length),ne=`[MetaGovernor] ${de.message}`;if(G&&ve.length>0)ne=`[MetaGovernor] Recent decisions in this session:
263
+ Remember: use codegraph/graphify for architecture queries, do not grep without trying codegraph/graphify first, no @ts-ignore/as-any, no empty catch, check memory before asking.`;bo(C,At);let wt=xt.get(C);if(wt)wt.lastViolationInjectionAtMs=Date.now()}}let de=ty(C);if(!de)return;if(de.action==="continue")return;if(!de.message)return;if(!uw(de.action,A.intervention.minActionForMessage))return;let se=N??xt.get(C);if(!se)se={memoryToolsUsed:[],hasCodegraphDir:n.hasCodegraphDir(r),hasGraphifyDir:n.hasGraphifyDir(r),oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,lastViolationInjectionAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},xt.set(C,se);let We=Math.max(0,A.intervention.maxInterventionsPerSession??0);if(We>0&&se.interventionCount>=We){se.interventionDisabled=!0;return}if(se.backgroundTaskInFlight||se.oracleInFlight){w("info",`decision injection suppressed (background task in flight) for ${C}`);try{ey(C,de)}catch{}return}let G=A.intervention.includeDecisionHistory!==!1,T=A.intervention.maxHistoryMessages??5,ee=(se.recentInterventionTexts??[]).slice(-T),ve=[];for(let st of ee)if(ve.length===0||ve[ve.length-1]!==st)ve.push(st);let Se=Math.max(T,ve.length),ne=`[MetaGovernor] ${de.message}`;if(G&&ve.length>0)ne=`[MetaGovernor] Recent decisions in this session:
264
264
  ${ve.map((At,wt)=>`${wt+1}. ${At}`).join(`
265
265
  `)}
266
266
 
267
267
  ---
268
268
 
269
- Current decision: ${de.message}`;let Je=`[${de.action}] ${de.message}`;if(se.recentInterventionTexts?.slice(-1)[0]!==Je)se.recentInterventionTexts=[...se.recentInterventionTexts??[],Je].slice(-Se);let Ad={type:"text",text:or(ne,{kind:"intervention"}),synthetic:!0};bo(C,ne);try{if((de.action==="warn"||de.action==="escalate"||de.action==="stop")&&Rd(C)&&!jl(P.messages)){let At=A.closedLoop?.autoRemember??{};if(At.enabled===!1)w("info",`auto-remember skipped (disabled) for ${C}`);else{let wt=`MetaGovernor ${de.action}: ${de.message} (reasoning: ${de.historyEntry?.reasoning??de.message})`,Pr=hy(wt),er=Date.now(),VO=iS.get(C),cS=sS.get(C)??0,Md=At.cooldownMs??300000;if(At.dedupe!==!1&&VO===Pr)w("info",`auto-remember deduped for ${C}: identical content`);else if(Md>0&&er-cS<Md)w("info",`auto-remember cooldown for ${C}: ${er-cS}ms < ${Md}ms`);else{iS.set(C,Pr),sS.set(C,er);let WO="Please call the `agentmemory_memory_save` MCP tool with EXACTLY these args:\n\n```json\n"+JSON.stringify({content:wt,concepts:["metagovernor",de.action]},null,2)+"\n```\n\nDo not paraphrase, modify, or add fields. Pass the args through verbatim.";if(typeof t.__test_autoRemember==="function")try{t.__test_autoRemember({sessionID:C,decision:de,promptText:WO})}catch{}else setTimeout(()=>{Bn(C,{toolName:"omo_remember",mcpTool:"agentmemory_memory_save",mcpArgs:{content:wt,concepts:["metagovernor",de.action]},preamble:"MetaGovernor auto-remember: notable decision — remember WHY this intervention fired."}).catch((HO)=>{w("warn","auto-remember promptAgent failed: "+String(HO))})},0);w("info",`auto-remember queued for ${C}: ${de.action}`)}}}}catch{}if(A.enabled&&se&&Rd(C)&&!jl(P.messages)&&(de.action==="escalate"||de.action==="stop")&&!se.backgroundTaskInFlight&&!se.oracleInFlight&&(se.lastReflectionAtMs===void 0||Date.now()-se.lastReflectionAtMs>300000)){se.lastReflectionAtMs=Date.now(),Ht.inc("reflections_triggered");let st=de.historyEntry?.reasoning??de.message,At=se.accumulatedDeviations.slice(-3),wt=At.length>0?At.map((er)=>` - [${er.severity}] ${er.category}: ${er.detail.slice(0,200)}`).join(`
269
+ Current decision: ${de.message}`;let Je=`[${de.action}] ${de.message}`;if(se.recentInterventionTexts?.slice(-1)[0]!==Je)se.recentInterventionTexts=[...se.recentInterventionTexts??[],Je].slice(-Se);let Ad={type:"text",text:or(ne,{kind:"intervention"}),synthetic:!0};bo(C,ne);try{if((de.action==="warn"||de.action==="escalate"||de.action==="stop")&&Rd(C)&&!jl(P.messages)){let At=A.closedLoop?.autoRemember??{};if(At.enabled===!1)w("info",`auto-remember skipped (disabled) for ${C}`);else{let wt=`MetaGovernor ${de.action}: ${de.message} (reasoning: ${de.historyEntry?.reasoning??de.message})`,Pr=hy(wt),er=Date.now(),HO=iS.get(C),cS=sS.get(C)??0,Md=At.cooldownMs??300000;if(At.dedupe!==!1&&HO===Pr)w("info",`auto-remember deduped for ${C}: identical content`);else if(Md>0&&er-cS<Md)w("info",`auto-remember cooldown for ${C}: ${er-cS}ms < ${Md}ms`);else{iS.set(C,Pr),sS.set(C,er);let VO="Please call the `agentmemory_memory_save` MCP tool with EXACTLY these args:\n\n```json\n"+JSON.stringify({content:wt,concepts:["metagovernor",de.action]},null,2)+"\n```\n\nDo not paraphrase, modify, or add fields. Pass the args through verbatim.";if(typeof t.__test_autoRemember==="function")try{t.__test_autoRemember({sessionID:C,decision:de,promptText:VO})}catch{}else setTimeout(()=>{Bn(C,{toolName:"omo_remember",mcpTool:"agentmemory_memory_save",mcpArgs:{content:wt,concepts:["metagovernor",de.action]},preamble:"MetaGovernor auto-remember: notable decision — remember WHY this intervention fired."}).catch((WO)=>{w("warn","auto-remember promptAgent failed: "+String(WO))})},0);w("info",`auto-remember queued for ${C}: ${de.action}`)}}}}catch{}if(A.enabled&&se&&Rd(C)&&!jl(P.messages)&&(de.action==="escalate"||de.action==="stop")&&!se.backgroundTaskInFlight&&!se.oracleInFlight&&(se.lastReflectionAtMs===void 0||Date.now()-se.lastReflectionAtMs>300000)){se.lastReflectionAtMs=Date.now(),Wt.inc("reflections_triggered");let st=de.historyEntry?.reasoning??de.message,At=se.accumulatedDeviations.slice(-3),wt=At.length>0?At.map((er)=>` - [${er.severity}] ${er.category}: ${er.detail.slice(0,200)}`).join(`
270
270
  `):" (none recorded)",Pr=["[omo-meta-governor audit - self-reflection required]","",`Recent decision: ${de.action} (score ${(de.historyEntry?.decision?.score??0).toFixed(2)})`,`Reasoning: ${st.slice(0,400)}`,`Message: ${de.message.slice(0,400)}`,`Tool calls so far: ${se.iteration}`,"","Recent protocol violations (if any):",wt,"","You are being audited by omo-meta-governor v"+at+". As a senior engineer,","review what you have just done and answer these questions honestly:"," 1. What is going wrong or inefficiently?"," 2. Are you stuck in a loop? Cite specific evidence."," 3. What is the correct path forward to complete the user's task?","","Be specific and actionable. If you should stop or pivot, say so clearly."].join(`
271
- `);if(typeof t.__test_reflectionPrompt==="function")try{t.__test_reflectionPrompt({sessionID:C,text:Pr})}catch{}else setTimeout(()=>{Bn(C,{toolName:"omo_reflection",mcpTool:"session.prompt",mcpArgs:{parts:[{type:"text",text:Pr}]},preamble:"omo-meta-governor audit: senior-engineer self-reflection required."}).catch((er)=>{w("warn","reflection promptAgent failed: "+String(er))})},0)}},event:async(v)=>{if(!A.enabled)return;let P=v.event,b=P?.type??"";if(b==="tool.execute.before"||b==="tool.execute.after"){Ht.inc("tool_calls_observed");let C=P?.properties??{},N=String(C.tool??""),he=String(C.sessionID??C.sessionId??"");if(he&&N){let ke=xt.get(he)??null;if(ke){let Qe=ke.recentToolCalls.indexOf(N);if(Qe>=0)ke.recentToolCalls.splice(Qe,1);if(ke.recentToolCalls.push(N),ke.recentToolCalls.length>20)ke.recentToolCalls.splice(0,ke.recentToolCalls.length-20)}if(b==="tool.execute.after")Ht.inc("orchestrator_runs")}}},"permission.ask":async(v,P)=>{if(!A.enabled)return;await uk(v,P,A.governance?.permissionPolicy??{},Ht)},"tool.definition":async(v,P)=>{if(!A.enabled)return;await dk(v,P,A.governance?.toolRewrite??{},Ht)},"command.execute.before":async(v,P)=>{if(!A.enabled)return;await pk(v,P,A.governance?.commandFilter??{},Ht)},"experimental.provider.small_model":async(v,P)=>{if(!A.enabled)return;await mk(v,P,A.governance?.smallModelOverride??{})},tool:{omo_search:s,omo_recall:a,omo_health:l,omo_find:c,omo_impact:u,omo_remember:f,omo_recall_mcp:h,omo_path:m,omo_explain:y,omo_files:k,omo_callers:S,omo_node:I,omo_context:D,omo_affected_cg:R,omo_status:M,omo_unlock:me,omo_mark_dirty:Ee,omo_sync_if_dirty:Ue,omo_index:$e,omo_visualize:rt,omo_serve:ue,omo_uninit:fe,omo_diagnose:De,omo_merge_graphs:Pe,omo_save_result:$r,omo_extract:Qt,omo_cluster_only:jv,omo_label:Gv,omo_tree:Zv,omo_clone:Bv,omo_add:qv,omo_check_update:Vv,omo_hook_status:Wv,omo_cli_anything_install:Hv,omo_cli_anything_list:Jv,omo_cli_anything_search:Kv,omo_cli_anything_info:Yv},"experimental.session.compacting":async(v,P)=>{if(!A.enabled||!A.closedLoop.enabled)return;let b=Io(),C=`session:${v.sessionID}`,N=await b.smartSearch({query:C,limit:3});if(N.lessons.length>0){let he=N.lessons.map((ke,Qe)=>`${Qe+1}. [${ke.id}] confidence=${ke.confidence.toFixed(2)}
271
+ `);if(typeof t.__test_reflectionPrompt==="function")try{t.__test_reflectionPrompt({sessionID:C,text:Pr})}catch{}else setTimeout(()=>{Bn(C,{toolName:"omo_reflection",mcpTool:"session.prompt",mcpArgs:{parts:[{type:"text",text:Pr}]},preamble:"omo-meta-governor audit: senior-engineer self-reflection required."}).catch((er)=>{w("warn","reflection promptAgent failed: "+String(er))})},0)}},event:async(v)=>{if(!A.enabled)return;let P=v.event,b=P?.type??"";if(b==="tool.execute.before"||b==="tool.execute.after"){Wt.inc("tool_calls_observed");let C=P?.properties??{},N=String(C.tool??""),he=String(C.sessionID??C.sessionId??"");if(he&&N){let ke=xt.get(he)??null;if(ke){let Qe=ke.recentToolCalls.indexOf(N);if(Qe>=0)ke.recentToolCalls.splice(Qe,1);if(ke.recentToolCalls.push(N),ke.recentToolCalls.length>20)ke.recentToolCalls.splice(0,ke.recentToolCalls.length-20)}if(b==="tool.execute.after")Wt.inc("orchestrator_runs")}}},"permission.ask":async(v,P)=>{if(!A.enabled)return;await uk(v,P,A.governance?.permissionPolicy??{},Wt)},"tool.definition":async(v,P)=>{if(!A.enabled)return;await dk(v,P,A.governance?.toolRewrite??{},Wt)},"command.execute.before":async(v,P)=>{if(!A.enabled)return;await pk(v,P,A.governance?.commandFilter??{},Wt)},"experimental.provider.small_model":async(v,P)=>{if(!A.enabled)return;await mk(v,P,A.governance?.smallModelOverride??{})},tool:{omo_search:s,omo_recall:a,omo_health:l,omo_find:c,omo_impact:u,omo_remember:f,omo_recall_mcp:h,omo_path:m,omo_explain:y,omo_files:k,omo_callers:S,omo_node:I,omo_context:D,omo_affected_cg:R,omo_status:M,omo_unlock:me,omo_mark_dirty:Ee,omo_sync_if_dirty:Ue,omo_index:$e,omo_visualize:rt,omo_serve:ue,omo_uninit:fe,omo_diagnose:De,omo_merge_graphs:Pe,omo_save_result:$r,omo_extract:Qt,omo_cluster_only:jv,omo_label:Gv,omo_tree:Zv,omo_clone:Bv,omo_add:qv,omo_check_update:Hv,omo_hook_status:Vv,omo_cli_anything_install:Wv,omo_cli_anything_list:Jv,omo_cli_anything_search:Kv,omo_cli_anything_info:Yv},"experimental.session.compacting":async(v,P)=>{if(!A.enabled||!A.closedLoop.enabled)return;let b=Io(),C=`session:${v.sessionID}`,N=await b.smartSearch({query:C,limit:3});if(N.lessons.length>0){let he=N.lessons.map((ke,Qe)=>`${Qe+1}. [${ke.id}] confidence=${ke.confidence.toFixed(2)}
272
272
  ${ke.content.slice(0,300)}`).join(`
273
273
 
274
274
  `);P.context.push(`
@@ -278,8 +278,8 @@ Current decision: ${de.message}`;let Je=`[${de.action}] ${de.message}`;if(se.rec
278
278
  `+se.items.map((ee,ve)=>ve+1+". "+ee).join(`
279
279
  `)+`
280
280
 
281
- Apply these fixes to keep the PR mergeable.`;P.system.push(or(T,{kind:"postwave"}))}let He=wi.get(b);if(He&&He.items.length>0){wi.delete(b);let T=`[META-GOVERNOR] protocol violations detected this session:
282
- `+He.items.slice(-3).map((ee,ve)=>" "+(ve+1)+". "+ee).join(`
281
+ Apply these fixes to keep the PR mergeable.`;P.system.push(or(T,{kind:"postwave"}))}let We=wi.get(b);if(We&&We.items.length>0){wi.delete(b);let T=`[META-GOVERNOR] protocol violations detected this session:
282
+ `+We.items.slice(-3).map((ee,ve)=>" "+(ve+1)+". "+ee).join(`
283
283
  `)+`
284
284
 
285
285
  Avoid these in subsequent responses.`;P.system.push(or(T,{kind:"enforcement"}))}let G=ty(b);if(G&&G.action!=="continue"&&!C.interventionDisabled){let T="[MetaGovernor] "+G.action.toUpperCase()+": "+G.message+`
@@ -287,23 +287,23 @@ Avoid these in subsequent responses.`;P.system.push(or(T,{kind:"enforcement"}))}
287
287
  Score: `+(G.historyEntry?.decision?.score??0).toFixed(2)+`
288
288
  Reasoning: `+(G.historyEntry?.reasoning??"n/a");P.system.push(or(T,{kind:"intervention"}))}P.system.push(N.join(`
289
289
  `))},"experimental.compaction.autocontinue":async(v,P)=>{if(!A.enabled)return;let{sessionID:b,overflow:C}=v,N=xt.get(b);if(!N)N={memoryToolsUsed:[],hasCodegraphDir:!1,hasGraphifyDir:!1,oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,lastViolationInjectionAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},xt.set(b,N);if(N.interventionDisabled){P.enabled=!1;return}let he=A.intervention.compactionLoopGuard;if(he.enabled)if(C){if(N.overflowCompactionCount++,!N.overflowLoopGuardTripped&&N.overflowCompactionCount>he.maxOverflowRecoveries){N.overflowLoopGuardTripped=!0,N.interventionDisabled=!0,P.enabled=!1,w("warn",`compaction_loop_guard_tripped for session ${b}: ${N.overflowCompactionCount} consecutive overflow compactions; autocontinue disabled and guidance queued`);let ke=tn.get(b),Qe=`[META-GOVERNOR] Overflow compaction loop detected (${N.overflowCompactionCount} consecutive overflow compactions). opencode issue #27924 is in play. Auto-continue is now disabled for this session. Resume your pending tasks using the existing context — do NOT regenerate context you have already produced.`;tn.set(b,{items:(ke?.items??[]).concat(Qe)})}}else N.overflowCompactionCount=0}}}}function oU(e,t){if(typeof e!=="string"||e.length===0)return[];let n=e.split(`
290
- `),o=[];for(let r of n){let i=r.match(/^\s*(\S+)\s+(fail)\s+(.*)$/);if(i){let s=i[1].trim(),a=i[3].trim();o.push(`${t} · ${s}: ${a}`)}}return o}function iU(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])gh\s+pr(?:\s|$)/.test(t)}function sU(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])git\s+push(?:\s|$)/.test(t)}function aU(e){try{return mw("git",["rev-parse","HEAD"],{cwd:e,encoding:"utf-8",timeout:5000,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().trim()||null}catch{return null}}function cU(e){try{let n=mw("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,encoding:"utf-8",timeout:5000,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().trim();return n&&n!=="HEAD"?n:null}catch{return null}}var fy=new Map;async function lU(e,t,n,o){let r=await Promise.resolve().then(() => (sw(),{})),i=fy.get(o)??{lastPolledSha:null,lastFailureInjectionAtMs:0,pending:new Set};i.pending.add(e),fy.set(o,i);try{HM(n.workflow,t);let s=Date.now(),a=null;while(Date.now()-s<n.maxWaitMs){if(a=WM(e),!a){await new Promise((l)=>setTimeout(l,n.pollIntervalMs));continue}if(a.status==="completed")break;await new Promise((l)=>setTimeout(l,n.pollIntervalMs))}if(!a||a.status!=="completed"){w("warn",`ci_monitor: timeout waiting for run on ${e.slice(0,7)} (${n.maxWaitMs}ms)`);return}if(i.lastPolledSha=e,a.conclusion==="failure"){let l=Date.now();if(l-i.lastFailureInjectionAtMs<60000)return;i.lastFailureInjectionAtMs=l;let c=JM(a.databaseId,4000),u=[`[CI Monitor] GitHub Actions run #${a.databaseId} FAILED on ${t}@${e.slice(0,7)}.`,"",`Title: ${a.displayTitle}`,`URL: ${a.url}`,`Conclusion: ${a.conclusion}`,"","── FAILED-STEP LOGS (truncated) ──",c||"(no failed-log output available — run `gh run view "+a.databaseId+" --log-failed` for full output)","","── ACTION ──",n.failOnly?"Read the failed logs above, identify which tests broke, run them locally to reproduce, fix, and re-push. Use `bun run typecheck` first (fastest signal), then run only the failing test files.":"Review the run and take action."].join(`
290
+ `),o=[];for(let r of n){let i=r.match(/^\s*(\S+)\s+(fail)\s+(.*)$/);if(i){let s=i[1].trim(),a=i[3].trim();o.push(`${t} · ${s}: ${a}`)}}return o}function iU(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])gh\s+pr(?:\s|$)/.test(t)}function sU(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])git\s+push(?:\s|$)/.test(t)}function aU(e){try{return mw("git",["rev-parse","HEAD"],{cwd:e,encoding:"utf-8",timeout:5000,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().trim()||null}catch{return null}}function cU(e){try{let n=mw("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,encoding:"utf-8",timeout:5000,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().trim();return n&&n!=="HEAD"?n:null}catch{return null}}var fy=new Map;async function lU(e,t,n,o){let r=await Promise.resolve().then(() => (sw(),{})),i=fy.get(o)??{lastPolledSha:null,lastFailureInjectionAtMs:0,pending:new Set};i.pending.add(e),fy.set(o,i);try{WM(n.workflow,t);let s=Date.now(),a=null;while(Date.now()-s<n.maxWaitMs){if(a=VM(e),!a){await new Promise((l)=>setTimeout(l,n.pollIntervalMs));continue}if(a.status==="completed")break;await new Promise((l)=>setTimeout(l,n.pollIntervalMs))}if(!a||a.status!=="completed"){w("warn",`ci_monitor: timeout waiting for run on ${e.slice(0,7)} (${n.maxWaitMs}ms)`);return}if(i.lastPolledSha=e,a.conclusion==="failure"){let l=Date.now();if(l-i.lastFailureInjectionAtMs<60000)return;i.lastFailureInjectionAtMs=l;let c=JM(a.databaseId,4000),u=[`[CI Monitor] GitHub Actions run #${a.databaseId} FAILED on ${t}@${e.slice(0,7)}.`,"",`Title: ${a.displayTitle}`,`URL: ${a.url}`,`Conclusion: ${a.conclusion}`,"","── FAILED-STEP LOGS (truncated) ──",c||"(no failed-log output available — run `gh run view "+a.databaseId+" --log-failed` for full output)","","── ACTION ──",n.failOnly?"Read the failed logs above, identify which tests broke, run them locally to reproduce, fix, and re-push. Use `bun run typecheck` first (fastest signal), then run only the failing test files.":"Review the run and take action."].join(`
291
291
  `);w("warn",`ci_monitor: CI failed for ${e.slice(0,7)} — ${a.url}`);let f=await Promise.resolve().then(() => (xs(),{})),h=await Xc(o,u,1e4);if(!h.ok)w("warn",`ci_monitor: failed to inject failure message: ${h.error??"unknown"}`)}else if(a.conclusion==="success")w("info",`ci_monitor: run #${a.databaseId} passed for ${e.slice(0,7)}`);else w("info",`ci_monitor: run #${a.databaseId} conclusion=${a.conclusion} for ${e.slice(0,7)}`)}finally{i.pending.delete(e),fy.set(o,i)}}function uU(e,t){if(t>=1)return!1;try{return XM(ks(e,"PLAN.md")),!1}catch{}try{let n=gy(ks(e,"AGENTS.md"),"utf-8");if(/^##\s+Plan\b/im.test(n))return!1}catch{}return!0}function dU(e){if(typeof e!=="string"||e.length===0)return!1;return/<promise>\s*DONE!?\s*<\/promise>/i.test(e)}function pU(e){if(typeof e!=="string"||e.length===0)return!1;return/<promise>\s*DONE!?\s*<\/promise>/i.test(e)||/<promise>\s*PHASE-\d+-COMPLETE\s*<\/promise>/i.test(e)}function mU(e){if(typeof e!=="string"||e.length===0)return!1;return/<promise>\s*PLAN-COMPLETE\s*<\/promise>/i.test(e)}function fU(e){let t=/(?:<promise>\s*)?PHASE-(\d+)-COMPLETE\s*(?:<\/promise>)?/i.exec(e);return t?Number.parseInt(t[1],10):null}function hy(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function hU(e,t,n){if(t.enabled===!1)return!1;let o=e.postWave.currentWaveN;if(o===null)return!1;if(!(o in e.postWave.oracleAfterPhaseAtMs))return!1;let r=t.maxRetriesPerWave??1,i=t.reinjectCooldownMs??60000,s=e.postWave.lastInjectedWaveN===o;if(s&&e.postWave.postWaveInjectionsThisWave>=r)return!1;if(s&&e.postWave.lastInjectedAtMs!==null&&n-e.postWave.lastInjectedAtMs<i)return!1;return!0}function gU(e,t){if(e)return e;return[`Wave ${t===null||t===void 0?"?":String(t)} is Oracle-verified. Land it now:`,"1. Use a CLEAN dedicated branch for this PR: `git checkout -b <branch>` (each PR gets its own independent branch; never mix PRs on one branch unless they fix the same problem).","2. `git push -u origin HEAD` (sets upstream on first push).","3. If no PR exists yet: `gh pr create --fill`.","4. Monitor CI: `timeout 600 gh pr checks --watch` (auto-stops after 10 min).","5. Only start the next wave after checks are green."].join(`
292
292
  `)}function yU(e,t,n=""){if(e)return e;let o=t===null||t===void 0?"?":String(t),r=n?`3. Invoke the \`${n}\` MCP GitHub skills to create the PR/issue, then `:"3. ";return[`Wave ${o} is Oracle-verified. This is a THIRD-PARTY repo — land it as a contribution:`,"1. READ FIRST the repo's contribution rules (read CONTRIBUTING.md, PR/issue templates and guides) and follow them exactly.","2. Create a CLEAN dedicated branch for THIS PR: `git checkout -b <branch>` — each PR gets its own independent branch; never mix PRs on one branch unless they fix the same problem (then commit onto that same branch).",`${r}push the branch to your FORK (\`git push -u origin HEAD\`) and open the PR against the UPSTREAM repo following the repo's template. Use \`gh pr create\` for GitHub.`,"4. Request review on the PR (add reviewers) and wait for CI to pass before starting the next wave."].join(`
293
- `)}function xU(e,t,n=tU){if(e==="own"||e==="third-party")return e;try{let o=n("gh repo view --json isFork,parent",{cwd:t,stdio:"pipe",timeout:1e4}),r=JSON.parse(String(o));if(r.isFork===!0&&r.parent!==null&&r.parent!==void 0)return"third-party";return"own"}catch{try{let o=n("git remote -v",{cwd:t,stdio:"pipe",timeout:1e4});if(String(o).split(`
294
- `).some((i)=>/^\s*upstream\s+/.test(i)))return"third-party"}catch{}return"own"}}function vU(e){return e}var ht=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let o=0,r=t.length;o<r;o++)n=t[o](n);return n}}},SU={pipe(){return ht(this,arguments)}},Vn=function(){function e(){}return e.prototype=SU,e}();var H=function(e,t){if(typeof e==="function")return function(){return e(arguments)?t.apply(this,arguments):(n)=>t(n,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(n,o){if(arguments.length>=2)return t(n,o);return function(r){return t(r,n)}};case 3:return function(n,o,r){if(arguments.length>=3)return t(n,o,r);return function(i){return t(i,n,o)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(o){return t(o,...n)}}}};var _t=(e)=>e;var hw=(e)=>()=>e;var jo=hw(void 0),gw=jo;function Lr(e){let t=new WeakMap;return(n)=>{let o=t.get(n);if(o!==void 0)return o;let r=e(n);return t.set(n,r),r}}function Go(e){let t=new WeakMap;return(n)=>{let o=t.get(n);if(o!==void 0)return o;let r=e(n);return t.set(n,r),t.set(r,r),r}}var Is=(e)=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;if(e instanceof Error)t.delete("stack");let n=Object.getPrototypeOf(e),o=n;while(o!==null&&o!==Object.prototype){let r=Reflect.ownKeys(o);for(let i=0;i<r.length;i++)t.add(r[i]);o=Object.getPrototypeOf(o)}if(t.has("constructor")&&typeof e.constructor==="function"&&n===e.constructor.prototype)t.delete("constructor");return t},Ts=new WeakSet;function Es(e){return typeof e==="string"}function yy(e){return typeof e==="number"}function yw(e){return typeof e==="boolean"}function xw(e){return typeof e==="symbol"}function Xl(e){return Es(e)||yy(e)||xw(e)}function Zo(e){return typeof e==="function"}function xy(e){return e!==void 0}function vy(e){return e!=null}function Sy(e){return!0}function Bo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ql(e){return typeof e==="object"&&e!==null||Zo(e)}var ge=H(2,(e,t)=>Ql(e)&&(t in e));function vw(e){return e instanceof Error}var Ge="~effect/interfaces/Hash",Ie=(e)=>{switch(typeof e){case"number":return Wn(e);case"bigint":return Fe(e.toString(10));case"boolean":return Fe(String(e));case"symbol":return Fe(String(e));case"string":return Fe(e);case"undefined":return Fe("undefined");case"function":case"object":if(e===null)return Fe("null");else if(e instanceof Date){if(Number.isNaN(e.getTime()))return Fe("Invalid Date");return Fe(e.toISOString())}else if(e instanceof RegExp)return Fe(e.toString());else{if(Ts.has(e))return eu(e);if(_y.has(e))return _y.get(e);let t=IU(e,()=>{if(bU(e))return e[Ge]();else if(typeof e==="function")return eu(e);else if(e instanceof DataView)return tu(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e)||ArrayBuffer.isView(e))return tu(e);else if(e instanceof Map)return kU(e);else if(e instanceof Set)return wU(e);return _U(e)});return _y.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},eu=(e)=>{if(!by.has(e))by.set(e,Wn(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return by.get(e)},dt=H(2,(e,t)=>e*53^t),ru=(e)=>e&3221225471|e>>>1&1073741824,bU=(e)=>ge(e,Ge),Wn=(e)=>{if(e!==e)return Fe("NaN");if(e===1/0)return Fe("Infinity");if(e===-1/0)return Fe("-Infinity");let t=e|0;if(t!==e)t^=e*4294967295;while(e>4294967295)t^=e/=4294967295;return ru(t)},Fe=(e)=>{let t=5381,n=e.length;while(n)t=t*33^e.charCodeAt(--n);return ru(t)},wy=(e,t)=>{let n=12289;for(let o of t)n^=dt(Ie(o),Ie(e[o]));return ru(n)},_U=(e)=>wy(e,Is(e)),Iy=(e,t)=>(n)=>{let o=e;for(let r of n)o^=t(r);return ru(o)},tu=Iy(6151,Ie),kU=Iy(Fe("Map"),([e,t])=>dt(Ie(e),Ie(t))),wU=Iy(Fe("Set"),Ie),by=new WeakMap,_y=new WeakMap,ky=new WeakSet;function IU(e,t){if(ky.has(e))return Fe("[Circular]");ky.add(e);let n=t();return ky.delete(e),n}var Ze="~effect/interfaces/Equal";function ze(){if(arguments.length===1)return(e)=>Hn(e,arguments[0]);return Hn(arguments[0],arguments[1])}function Hn(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;if(n!==typeof t)return!1;if(n==="number"&&e!==e&&t!==t)return!0;if(n!=="object"&&n!=="function")return!1;if(Ts.has(e)||Ts.has(t))return!1;return $U(e,t,EU)}function TU(e,t,n){let o=Ty.has(e),r=Ey.has(t);if(o&&r)return!0;if(o||r)return!1;Ty.add(e),Ey.add(t);let i=n();return Ty.delete(e),Ey.delete(t),i}var Ty=new WeakSet,Ey=new WeakSet;function EU(e,t){if(Ie(e)!==Ie(t))return!1;else if(e instanceof Date){if(!(t instanceof Date))return!1;let i=e.getTime(),s=t.getTime();return i===s||Number.isNaN(i)&&Number.isNaN(s)}else if(e instanceof RegExp){if(!(t instanceof RegExp))return!1;return e.toString()===t.toString()}let n=bw(e),o=bw(t);if(n!==o)return!1;let r=n&&o;if(typeof e==="function"&&!r)return!1;return TU(e,t,()=>{if(r)return e[Ze](t);else if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;return OU(e,t)}else if(ArrayBuffer.isView(e)){let i=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||i!==t instanceof DataView)return!1;if(i){let s=t;return Sw(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(s.buffer,s.byteOffset,s.byteLength))}return Sw(e,t)}else if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;return CU(e,t)}else if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;return AU(e,t)}return DU(e,t)})}function $U(e,t,n){let o=nu.get(e);if(!o)o=new WeakMap,nu.set(e,o);else if(o.has(t))return o.get(t);let r=n(e,t);o.set(t,r);let i=nu.get(t);if(!i)i=new WeakMap,nu.set(t,i);return i.set(e,r),r}var nu=new WeakMap;function OU(e,t){for(let n=0;n<e.length;n++)if(!Hn(e[n],t[n]))return!1;return!0}function Sw(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function DU(e,t){let n=Is(e),o=Is(t);if(n.size!==o.size)return!1;for(let r of n)if(!o.has(r)||!Hn(e[r],t[r]))return!1;return!0}function PU(e,t){return function(o,r){let i=Array.from(r);for(let[s,a]of o){let l=!1;for(let c=0;c<i.length;c++){let[u,f]=i[c];if(e(s,u)&&t(a,f)){i[c]=i[i.length-1],i.pop(),l=!0;break}}if(!l)return!1}return!0}}var CU=PU(Hn,Hn);function RU(e){return function(n,o){let r=Array.from(o);for(let i of n){let s=!1;for(let a=0;a<r.length;a++){let l=r[a];if(e(i,l)){r[a]=r[r.length-1],r.pop(),s=!0;break}}if(!s)return!1}return!0}}var AU=RU(Hn),bw=(e)=>ge(e,Ze);var $s=Symbol.for("~effect/Redactable"),MU=(e)=>ge(e,$s);function qo(e){if(MU(e))return $y(e);return e}function $y(e){return e[$s](globalThis[Vo]?.context??UU)}var Vo="~effect/Fiber/currentFiber",_w=new Map,UU={"~effect/Context":{},base:_w,depth:0,mapUnsafe:_w,pipe(){return ht(this,arguments)}};function re(e,t){let n=t?.space??0,o=new WeakSet,r=!n?"":typeof n==="number"?" ".repeat(n):n,i=(c)=>r.repeat(c),s=(c,u)=>{let f=c?.constructor;return f&&f!==Object.prototype.constructor&&f.name?`${f.name}(${u})`:u},a=(c)=>{try{return Reflect.ownKeys(c)}catch{return["[ownKeys threw]"]}};function l(c,u=0){if(typeof c==="string")return JSON.stringify(c);if(typeof c==="number"||c==null||typeof c==="boolean"||typeof c==="symbol")return String(c);if(typeof c==="bigint")return String(c)+"n";if(typeof c==="object"||typeof c==="function"){if(o.has(c))return NU;o.add(c);let f;if($s in c)f=l($y(c),u);else if(Array.isArray(c))f=!r||c.length<=1?`[${c.map((h)=>l(h,u)).join(",")}]`:`[
293
+ `)}function xU(e,t,n=tU){if(e==="own"||e==="third-party")return e;try{let o=n("gh repo view --json isFork,parent",{cwd:t,stdio:"pipe",timeout:1e4,windowsHide:!0}),r=JSON.parse(String(o));if(r.isFork===!0&&r.parent!==null&&r.parent!==void 0)return"third-party";return"own"}catch{try{let o=n("git remote -v",{cwd:t,stdio:"pipe",timeout:1e4});if(String(o).split(`
294
+ `).some((i)=>/^\s*upstream\s+/.test(i)))return"third-party"}catch{}return"own"}}function vU(e){return e}var ht=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let o=0,r=t.length;o<r;o++)n=t[o](n);return n}}},SU={pipe(){return ht(this,arguments)}},Hn=function(){function e(){}return e.prototype=SU,e}();var W=function(e,t){if(typeof e==="function")return function(){return e(arguments)?t.apply(this,arguments):(n)=>t(n,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(n,o){if(arguments.length>=2)return t(n,o);return function(r){return t(r,n)}};case 3:return function(n,o,r){if(arguments.length>=3)return t(n,o,r);return function(i){return t(i,n,o)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(o){return t(o,...n)}}}};var _t=(e)=>e;var hw=(e)=>()=>e;var jo=hw(void 0),gw=jo;function Lr(e){let t=new WeakMap;return(n)=>{let o=t.get(n);if(o!==void 0)return o;let r=e(n);return t.set(n,r),r}}function Go(e){let t=new WeakMap;return(n)=>{let o=t.get(n);if(o!==void 0)return o;let r=e(n);return t.set(n,r),t.set(r,r),r}}var Is=(e)=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;if(e instanceof Error)t.delete("stack");let n=Object.getPrototypeOf(e),o=n;while(o!==null&&o!==Object.prototype){let r=Reflect.ownKeys(o);for(let i=0;i<r.length;i++)t.add(r[i]);o=Object.getPrototypeOf(o)}if(t.has("constructor")&&typeof e.constructor==="function"&&n===e.constructor.prototype)t.delete("constructor");return t},Ts=new WeakSet;function Es(e){return typeof e==="string"}function yy(e){return typeof e==="number"}function yw(e){return typeof e==="boolean"}function xw(e){return typeof e==="symbol"}function Xl(e){return Es(e)||yy(e)||xw(e)}function Zo(e){return typeof e==="function"}function xy(e){return e!==void 0}function vy(e){return e!=null}function Sy(e){return!0}function Bo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ql(e){return typeof e==="object"&&e!==null||Zo(e)}var ge=W(2,(e,t)=>Ql(e)&&(t in e));function vw(e){return e instanceof Error}var Ge="~effect/interfaces/Hash",Ie=(e)=>{switch(typeof e){case"number":return Vn(e);case"bigint":return Fe(e.toString(10));case"boolean":return Fe(String(e));case"symbol":return Fe(String(e));case"string":return Fe(e);case"undefined":return Fe("undefined");case"function":case"object":if(e===null)return Fe("null");else if(e instanceof Date){if(Number.isNaN(e.getTime()))return Fe("Invalid Date");return Fe(e.toISOString())}else if(e instanceof RegExp)return Fe(e.toString());else{if(Ts.has(e))return eu(e);if(_y.has(e))return _y.get(e);let t=IU(e,()=>{if(bU(e))return e[Ge]();else if(typeof e==="function")return eu(e);else if(e instanceof DataView)return tu(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e)||ArrayBuffer.isView(e))return tu(e);else if(e instanceof Map)return kU(e);else if(e instanceof Set)return wU(e);return _U(e)});return _y.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},eu=(e)=>{if(!by.has(e))by.set(e,Vn(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return by.get(e)},dt=W(2,(e,t)=>e*53^t),ru=(e)=>e&3221225471|e>>>1&1073741824,bU=(e)=>ge(e,Ge),Vn=(e)=>{if(e!==e)return Fe("NaN");if(e===1/0)return Fe("Infinity");if(e===-1/0)return Fe("-Infinity");let t=e|0;if(t!==e)t^=e*4294967295;while(e>4294967295)t^=e/=4294967295;return ru(t)},Fe=(e)=>{let t=5381,n=e.length;while(n)t=t*33^e.charCodeAt(--n);return ru(t)},wy=(e,t)=>{let n=12289;for(let o of t)n^=dt(Ie(o),Ie(e[o]));return ru(n)},_U=(e)=>wy(e,Is(e)),Iy=(e,t)=>(n)=>{let o=e;for(let r of n)o^=t(r);return ru(o)},tu=Iy(6151,Ie),kU=Iy(Fe("Map"),([e,t])=>dt(Ie(e),Ie(t))),wU=Iy(Fe("Set"),Ie),by=new WeakMap,_y=new WeakMap,ky=new WeakSet;function IU(e,t){if(ky.has(e))return Fe("[Circular]");ky.add(e);let n=t();return ky.delete(e),n}var Ze="~effect/interfaces/Equal";function ze(){if(arguments.length===1)return(e)=>Wn(e,arguments[0]);return Wn(arguments[0],arguments[1])}function Wn(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;if(n!==typeof t)return!1;if(n==="number"&&e!==e&&t!==t)return!0;if(n!=="object"&&n!=="function")return!1;if(Ts.has(e)||Ts.has(t))return!1;return $U(e,t,EU)}function TU(e,t,n){let o=Ty.has(e),r=Ey.has(t);if(o&&r)return!0;if(o||r)return!1;Ty.add(e),Ey.add(t);let i=n();return Ty.delete(e),Ey.delete(t),i}var Ty=new WeakSet,Ey=new WeakSet;function EU(e,t){if(Ie(e)!==Ie(t))return!1;else if(e instanceof Date){if(!(t instanceof Date))return!1;let i=e.getTime(),s=t.getTime();return i===s||Number.isNaN(i)&&Number.isNaN(s)}else if(e instanceof RegExp){if(!(t instanceof RegExp))return!1;return e.toString()===t.toString()}let n=bw(e),o=bw(t);if(n!==o)return!1;let r=n&&o;if(typeof e==="function"&&!r)return!1;return TU(e,t,()=>{if(r)return e[Ze](t);else if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;return OU(e,t)}else if(ArrayBuffer.isView(e)){let i=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||i!==t instanceof DataView)return!1;if(i){let s=t;return Sw(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(s.buffer,s.byteOffset,s.byteLength))}return Sw(e,t)}else if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;return CU(e,t)}else if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;return AU(e,t)}return DU(e,t)})}function $U(e,t,n){let o=nu.get(e);if(!o)o=new WeakMap,nu.set(e,o);else if(o.has(t))return o.get(t);let r=n(e,t);o.set(t,r);let i=nu.get(t);if(!i)i=new WeakMap,nu.set(t,i);return i.set(e,r),r}var nu=new WeakMap;function OU(e,t){for(let n=0;n<e.length;n++)if(!Wn(e[n],t[n]))return!1;return!0}function Sw(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function DU(e,t){let n=Is(e),o=Is(t);if(n.size!==o.size)return!1;for(let r of n)if(!o.has(r)||!Wn(e[r],t[r]))return!1;return!0}function PU(e,t){return function(o,r){let i=Array.from(r);for(let[s,a]of o){let l=!1;for(let c=0;c<i.length;c++){let[u,f]=i[c];if(e(s,u)&&t(a,f)){i[c]=i[i.length-1],i.pop(),l=!0;break}}if(!l)return!1}return!0}}var CU=PU(Wn,Wn);function RU(e){return function(n,o){let r=Array.from(o);for(let i of n){let s=!1;for(let a=0;a<r.length;a++){let l=r[a];if(e(i,l)){r[a]=r[r.length-1],r.pop(),s=!0;break}}if(!s)return!1}return!0}}var AU=RU(Wn),bw=(e)=>ge(e,Ze);var $s=Symbol.for("~effect/Redactable"),MU=(e)=>ge(e,$s);function qo(e){if(MU(e))return $y(e);return e}function $y(e){return e[$s](globalThis[Ho]?.context??UU)}var Ho="~effect/Fiber/currentFiber",_w=new Map,UU={"~effect/Context":{},base:_w,depth:0,mapUnsafe:_w,pipe(){return ht(this,arguments)}};function re(e,t){let n=t?.space??0,o=new WeakSet,r=!n?"":typeof n==="number"?" ".repeat(n):n,i=(c)=>r.repeat(c),s=(c,u)=>{let f=c?.constructor;return f&&f!==Object.prototype.constructor&&f.name?`${f.name}(${u})`:u},a=(c)=>{try{return Reflect.ownKeys(c)}catch{return["[ownKeys threw]"]}};function l(c,u=0){if(typeof c==="string")return JSON.stringify(c);if(typeof c==="number"||c==null||typeof c==="boolean"||typeof c==="symbol")return String(c);if(typeof c==="bigint")return String(c)+"n";if(typeof c==="object"||typeof c==="function"){if(o.has(c))return NU;o.add(c);let f;if($s in c)f=l($y(c),u);else if(Array.isArray(c))f=!r||c.length<=1?`[${c.map((h)=>l(h,u)).join(",")}]`:`[
295
295
  ${i(u+1)}${c.map((h)=>l(h,u+1)).join(`,
296
296
  `+i(u+1))}
297
297
  ${i(u)}]`;else if(c instanceof Date)f=kw(c);else if(!t?.ignoreToString&&ge(c,"toString")&&typeof c.toString==="function"&&c.toString!==Object.prototype.toString&&c.toString!==Array.prototype.toString){let h=FU(c);f=c instanceof Error&&c.cause?`${h} (cause: ${l(c.cause,u)})`:h}else if(Symbol.iterator in c)f=`${c.constructor.name}(${l(Array.from(c),u)})`;else{let h=a(c);if(!r||h.length<=1){let m=`{${h.map((y)=>`${Os(y)}:${l(c[y],u)}`).join(",")}}`;f=s(c,m)}else{let m=`{
298
298
  ${h.map((y)=>`${i(u+1)}${Os(y)}: ${l(c[y],u+1)}`).join(`,
299
299
  `)}
300
- ${i(u)}}`;f=s(c,m)}}return o.delete(c),f}return String(c)}return l(e,0)}var NU="[Circular]";function Os(e){return typeof e==="string"?JSON.stringify(e):String(e)}function kw(e){try{return e.toISOString()}catch{return"Invalid Date"}}function FU(e){try{let t=e.toString();return typeof t==="string"?t:String(t)}catch{return"[toString threw]"}}function Oy(e,t){let n=[];return JSON.stringify(e,function(o,r){let i=Object.getOwnPropertyDescriptor(this,o)?.value,s=ge(i,$s)?qo(i):qo(r);if(typeof s==="bigint")return re(s);if(typeof s!=="object"||s===null)return s;while(n.length>0&&n[n.length-1]!==this)n.pop();if(n.includes(s))return;return n.push(s),s},t?.space)??"null"}var gn=Symbol.for("nodejs.util.inspect.custom"),Jn=(e)=>{try{if(e=qo(e),ge(e,"toJSON")&&Zo(e.toJSON)&&e.toJSON.length===0)return e.toJSON();else if(Array.isArray(e))return e.map(Jn);return e}catch{return"[toJSON threw]"}};var Fq={toJSON(){return Jn(this)},[gn](){return this.toJSON()},toString(){return re(this.toJSON())}};class yn{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new yn(this.self)}}var LU=()=>{let t={["~effect/Utils/internal"]:(r)=>r()},n={["~effect/Utils/internal"]:(r)=>{try{return r()}finally{}}};return t["~effect/Utils/internal"](()=>Error().stack)?.includes("~effect/Utils/internal")===!0?t["~effect/Utils/internal"]:n["~effect/Utils/internal"]},Sr=LU();function Ft(e,t,n){if(t==="__proto__")Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0});else e[t]=n}function ou(e,t){for(let n of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,n))Ft(e,n,t[n])}var Yn="~effect/Effect",Kn="~effect/Exit",jU={_A:_t,_E:_t,_R:_t},Iw=`${Yn}/identifier`,z=`${Yn}/args`,We=`${Yn}/evaluate`,$t=`${Yn}/successCont`,sr=`${Yn}/failureCont`,xn=`${Yn}/ensureCont`,Xn=Symbol.for("effect/Effect/Yield"),Qn={pipe(){return ht(this,arguments)},toJSON(){return{...this}},toString(){return re(this.toJSON(),{ignoreToString:!0,space:2})},[gn](){return this.toJSON()}},Vq={[Ge](){return wy(this,Object.keys(this))},[Ze](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==n[o]||!ze(this[t[o]],e[t[o]]))return!1;return!0}},GU={[Yn]:jU,...Qn,[Symbol.iterator](){return new yn(this)},toJSON(){return{_id:"Effect",op:this[Iw],...z in this?{args:this[z]}:void 0}}};var Tw=(e)=>ge(e,Kn),Ps="~effect/Cause",iu="~effect/Cause/Reason",su=(e)=>ge(e,Ps);class vn{[Ps];reasons;constructor(e){this[Ps]=Ps,this.reasons=e}pipe(){return ht(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map((e)=>e.toJSON())}}toString(){return`Cause(${re(this.reasons)})`}[gn](){return this.toJSON()}[Ze](e){return su(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>ze(t,e.reasons[n]))}[Ge](){return tu(this.reasons)}}var ww=new WeakMap;class Cs{[iu];annotations;_tag;constructor(e,t,n){if(this[iu]=iu,this._tag=e,t!==Rs&&typeof n==="object"&&n!==null&&t.size>0){let o=ww.get(n);if(o)t=new Map([...o,...t]);ww.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((r,i)=>{if(t?.overwrite!==!0&&n.has(i))return;n.set(i,r)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=n,o}pipe(){return ht(this,arguments)}toString(){return re(this)}[gn](){return this.toString()}}var Rs=new Map;class As extends Cs{error;constructor(e,t=Rs){super("Fail",t,e);this.error=e}toString(){return`Fail(${re(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[Ze](e){return Ns(e)&&ze(this.error,e.error)&&ze(this.annotations,e.annotations)}[Ge](){return dt(Fe(this._tag))(dt(Ie(this.error))(Ie(this.annotations)))}}var Ms=(e)=>new vn(e);var Ew=(e)=>new vn([new As(e)]);class Py extends Cs{defect;constructor(e,t=Rs){super("Die",t,e);this.defect=e}toString(){return`Die(${re(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[Ze](e){return Cy(e)&&ze(this.defect,e.defect)&&ze(this.annotations,e.annotations)}[Ge](){return dt(Fe(this._tag))(dt(Ie(this.defect))(Ie(this.annotations)))}}var $w=(e)=>new vn([new Py(e)]),Us=H((e)=>su(e[0]),(e,t,n)=>{if(t.mapUnsafe.size===0)return e;return new vn(e.reasons.map((o)=>o.annotate(t,n)))}),Ns=(e)=>e._tag==="Fail",Cy=(e)=>e._tag==="Die",au=(e)=>e._tag==="Interrupt";function ZU(e){return Sn("Effect.evaluate: Not implemented")}var jr=(e)=>({...GU,[Iw]:e.op,[We]:e[We]??ZU,[$t]:e[$t],[sr]:e[sr],[xn]:e[xn]}),Jt=(e)=>{let t=jr(e);return function(){let n=Object.create(t);return n[z]=e.single===!1?arguments:arguments[0],n}},Ow=(e)=>{let t={[Kn]:Kn,_tag:e.op,get[e.prop](){return this[z]},...jr(e),toString(){return`${e.op}(${re(this[z])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[z]}},[Ze](n){return Tw(n)&&n._tag===this._tag&&ze(this[z],n[z])},[Ge](){return dt(Fe(e.op),Ie(this[z]))}};return function(n){let o=Object.create(t);return o[z]=n,o}},zt=Ow({op:"Success",prop:"value",[We](e){let t=e.getCont($t);return t?t[$t](this[z],e,this):e.yieldWith(this)}}),Ry={key:"effect/Cause/StackTrace"},Dw={key:"effect/Cause/InterruptorStackTrace"},ar=Ow({op:"Failure",prop:"cause",[We](e){let t=this[z],n=!1;if(e.currentStackFrame)t=Us(t,{mapUnsafe:new Map([[Ry.key,e.currentStackFrame]])}),n=!0;let o=e.getCont(sr);while(e.interruptible&&e._interruptedCause&&o)o=e.getCont(sr);return o?o[sr](t,e,n?void 0:this):e.yieldWith(n?ar(t):this)}}),Wo=(e)=>ar(Ew(e)),Sn=(e)=>ar($w(e)),Ho=Jt({op:"WithFiber",[We](e){return this[z](e)}}),BU=function(){class e extends globalThis.Error{}let t=jr({op:"YieldableError",[We](){return Wo(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),cu=function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends BU{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0);if(n)ou(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1})}toJSON(){return{...this[e],...this}}}}(),Jo=(e)=>{class t extends cu{_tag=e}return t.prototype.name=e,t};var Dy="~effect/Cause/Done";var Wq={[Dy]:Dy,_tag:"Done",value:void 0};var Pw=(e)=>jr({op:e.label,[We]:e.evaluate});var eo=(e)=>(t,n)=>t===n||e(t,n),VU=(e,t)=>e===t,Cw=()=>VU;var Aw="~effect/data/Option",Mw={[Aw]:{_A:(e)=>e},...Qn,[Symbol.iterator](){return new yn(this)}},WU=Object.defineProperty(Object.assign(Object.create(Mw),{_tag:"Some",_op:"Some",[Ze](e){return Ay(e)&&Uy(e)&&ze(this.value,e.value)},[Ge](){return dt(Ie(this._tag))(Ie(this.value))},toString(){return`some(${re(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:Jn(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),HU=Ie("None"),JU=Object.assign(Object.create(Mw),{_tag:"None",_op:"None",valueOrUndefined:void 0,[Ze](e){return Ay(e)&&My(e)},[Ge](){return HU},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),Ay=(e)=>ge(e,Aw),My=(e)=>e._tag==="None",Uy=(e)=>e._tag==="Some",Uw=Object.create(JU),Nw=(e)=>{let t=Object.create(WU);return t.value=e,t};var Fw="~effect/data/Result",zw={[Fw]:{_A:(e)=>e,_E:(e)=>e},...Qn,[Symbol.iterator](){return new yn(this)}},YU=Object.assign(Object.create(zw),{_tag:"Success",_op:"Success",[Ze](e){return Ny(e)&&Lw(e)&&ze(this.success,e.success)},[Ge](){return dt(Ie(this._tag))(Ie(this.success))},toString(){return`success(${re(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:Jn(this.success)}}}),XU=Object.assign(Object.create(zw),{_tag:"Failure",_op:"Failure",[Ze](e){return Ny(e)&&Fy(e)&&ze(this.failure,e.failure)},[Ge](){return dt(Ie(this._tag))(Ie(this.failure))},toString(){return`failure(${re(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:Jn(this.failure)}}}),Ny=(e)=>ge(e,Fw),Fy=(e)=>e._tag==="Failure",Lw=(e)=>e._tag==="Success",jw=(e)=>{let t=Object.create(XU);return t.failure=e,t},Gw=(e)=>{let t=Object.create(YU);return t.success=e,t};function zy(e){return(t,n)=>t===n?0:e(t,n)}var Fs=zy((e,t)=>{if(globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t))return 0;if(globalThis.Number.isNaN(e))return-1;if(globalThis.Number.isNaN(t))return 1;return e<t?-1:1});var Ly=(e)=>H(2,(t,n)=>e(t,n)===-1),uu=(e)=>H(2,(t,n)=>e(t,n)===1),du=(e)=>H(2,(t,n)=>e(t,n)!==1),pu=(e)=>H(2,(t,n)=>e(t,n)!==-1);var cr=()=>Uw,Lt=Nw;var bn=My,jy=Uy,Gy=H(2,(e,{onNone:t,onSome:n})=>bn(e)?t():n(e.value));var Bw=(e)=>(...t)=>{try{return Lt(e(...t))}catch{return cr()}};var mu=H(2,(e,t)=>bn(e)?cr():Lt(t(e.value)));var fu=H(2,(e,t)=>bn(e)?cr():t(e.value)?Lt(e.value):cr());var qw="~effect/Context/Service",Vw=function(){function e(){}let t=e;Object.setPrototypeOf(t,tN);let n=(o,r)=>{if(t.key=o,r?.defaultValue)t[By]=By,t.defaultValue=r.defaultValue;if(r?.make)t.make=r.make;if(r?.fiberCached)Ww.add(o);return t};return arguments.length>0?n(arguments[0],arguments[1]):n},tN={[qw]:qw,...Pw({label:"Service",evaluate(e){return zt(zs(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return Hy(this,e)},use(e){return Ho((t)=>e(zs(t.context,this)))},useSync(e){return Ho((t)=>zt(e(zs(t.context,this))))}},Ww=new Set,By="~effect/Context/Reference",Hw="~effect/Context",rN=8,nN=8,qy=(e,t,n,o)=>{let r=Object.create(oN);return r.cacheRoot=e??r,r.base=t,r.overlay=n,r.depth=o,r._flat=void 0,r.baseHits=0,r},Jw=(e,t)=>{if(!t)return;Jw(e,t.parent),e.set(t.key,t.value)},Kw=(e)=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Jw(t,e.overlay),e._flat=t};var Vy=Symbol(),Yw=(e,t)=>{let n=e;for(let r=n.overlay;r;r=r.parent)if(r.key===t)return r.value;let o=n.base.get(t);if(o===void 0&&!n.base.has(t))return Vy;if(n.overlay&&++n.baseHits>=nN)n.base=Kw(n),n.overlay=void 0,n.depth=0;return o},hu=(e)=>qy(void 0,e,void 0,0),oN={get mapUnsafe(){return Kw(this)},...Qn,[Hw]:{_Services:(e)=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Ze](e){if(!iN(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[o,r]of t)if(!n.has(o)||!ze(r,n.get(o)))return!1;return!0},[Ge](){return Wn(this.mapUnsafe.size)}},Xw=(e,t)=>e.cacheRoot===t.cacheRoot,iN=(e)=>ge(e,Hw);var sN=(e)=>!!e[By],Wy=()=>aN,aN=hu(new Map),Hy=(e,t)=>hu(new Map([[e.key,t]])),Qw=H(3,(e,t,n)=>cN(e,t.key,n)),cN=(e,t,n)=>{let o=e,r=Ww.has(t)?void 0:o.cacheRoot;if(o.depth>=rN){let i=new Map(o.mapUnsafe);return i.set(t,n),qy(r,i,void 0,0)}return qy(r,o.base,{key:t,value:n,parent:o.overlay},o.depth+1)};var gu=(e,t)=>{let n=Yw(e,t);return n===Vy?void 0:n},eI=H(2,(e,t)=>{let n=Yw(e,t.key);if(n===Vy){if(sN(t))return lN(t);throw uN(t)}return n}),zs=eI,Zy="~effect/Context/defaultValue",lN=(e)=>{if(Zy in e)return e[Zy];return e[Zy]=e.defaultValue()},uN=(e)=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let n=t.stack.split(`
300
+ ${i(u)}}`;f=s(c,m)}}return o.delete(c),f}return String(c)}return l(e,0)}var NU="[Circular]";function Os(e){return typeof e==="string"?JSON.stringify(e):String(e)}function kw(e){try{return e.toISOString()}catch{return"Invalid Date"}}function FU(e){try{let t=e.toString();return typeof t==="string"?t:String(t)}catch{return"[toString threw]"}}function Oy(e,t){let n=[];return JSON.stringify(e,function(o,r){let i=Object.getOwnPropertyDescriptor(this,o)?.value,s=ge(i,$s)?qo(i):qo(r);if(typeof s==="bigint")return re(s);if(typeof s!=="object"||s===null)return s;while(n.length>0&&n[n.length-1]!==this)n.pop();if(n.includes(s))return;return n.push(s),s},t?.space)??"null"}var gn=Symbol.for("nodejs.util.inspect.custom"),Jn=(e)=>{try{if(e=qo(e),ge(e,"toJSON")&&Zo(e.toJSON)&&e.toJSON.length===0)return e.toJSON();else if(Array.isArray(e))return e.map(Jn);return e}catch{return"[toJSON threw]"}};var Fq={toJSON(){return Jn(this)},[gn](){return this.toJSON()},toString(){return re(this.toJSON())}};class yn{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new yn(this.self)}}var LU=()=>{let t={["~effect/Utils/internal"]:(r)=>r()},n={["~effect/Utils/internal"]:(r)=>{try{return r()}finally{}}};return t["~effect/Utils/internal"](()=>Error().stack)?.includes("~effect/Utils/internal")===!0?t["~effect/Utils/internal"]:n["~effect/Utils/internal"]},Sr=LU();function Ft(e,t,n){if(t==="__proto__")Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0});else e[t]=n}function ou(e,t){for(let n of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,n))Ft(e,n,t[n])}var Yn="~effect/Effect",Kn="~effect/Exit",jU={_A:_t,_E:_t,_R:_t},Iw=`${Yn}/identifier`,z=`${Yn}/args`,Ve=`${Yn}/evaluate`,$t=`${Yn}/successCont`,sr=`${Yn}/failureCont`,xn=`${Yn}/ensureCont`,Xn=Symbol.for("effect/Effect/Yield"),Qn={pipe(){return ht(this,arguments)},toJSON(){return{...this}},toString(){return re(this.toJSON(),{ignoreToString:!0,space:2})},[gn](){return this.toJSON()}},Hq={[Ge](){return wy(this,Object.keys(this))},[Ze](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==n[o]||!ze(this[t[o]],e[t[o]]))return!1;return!0}},GU={[Yn]:jU,...Qn,[Symbol.iterator](){return new yn(this)},toJSON(){return{_id:"Effect",op:this[Iw],...z in this?{args:this[z]}:void 0}}};var Tw=(e)=>ge(e,Kn),Ps="~effect/Cause",iu="~effect/Cause/Reason",su=(e)=>ge(e,Ps);class vn{[Ps];reasons;constructor(e){this[Ps]=Ps,this.reasons=e}pipe(){return ht(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map((e)=>e.toJSON())}}toString(){return`Cause(${re(this.reasons)})`}[gn](){return this.toJSON()}[Ze](e){return su(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>ze(t,e.reasons[n]))}[Ge](){return tu(this.reasons)}}var ww=new WeakMap;class Cs{[iu];annotations;_tag;constructor(e,t,n){if(this[iu]=iu,this._tag=e,t!==Rs&&typeof n==="object"&&n!==null&&t.size>0){let o=ww.get(n);if(o)t=new Map([...o,...t]);ww.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((r,i)=>{if(t?.overwrite!==!0&&n.has(i))return;n.set(i,r)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=n,o}pipe(){return ht(this,arguments)}toString(){return re(this)}[gn](){return this.toString()}}var Rs=new Map;class As extends Cs{error;constructor(e,t=Rs){super("Fail",t,e);this.error=e}toString(){return`Fail(${re(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[Ze](e){return Ns(e)&&ze(this.error,e.error)&&ze(this.annotations,e.annotations)}[Ge](){return dt(Fe(this._tag))(dt(Ie(this.error))(Ie(this.annotations)))}}var Ms=(e)=>new vn(e);var Ew=(e)=>new vn([new As(e)]);class Py extends Cs{defect;constructor(e,t=Rs){super("Die",t,e);this.defect=e}toString(){return`Die(${re(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[Ze](e){return Cy(e)&&ze(this.defect,e.defect)&&ze(this.annotations,e.annotations)}[Ge](){return dt(Fe(this._tag))(dt(Ie(this.defect))(Ie(this.annotations)))}}var $w=(e)=>new vn([new Py(e)]),Us=W((e)=>su(e[0]),(e,t,n)=>{if(t.mapUnsafe.size===0)return e;return new vn(e.reasons.map((o)=>o.annotate(t,n)))}),Ns=(e)=>e._tag==="Fail",Cy=(e)=>e._tag==="Die",au=(e)=>e._tag==="Interrupt";function ZU(e){return Sn("Effect.evaluate: Not implemented")}var jr=(e)=>({...GU,[Iw]:e.op,[Ve]:e[Ve]??ZU,[$t]:e[$t],[sr]:e[sr],[xn]:e[xn]}),Jt=(e)=>{let t=jr(e);return function(){let n=Object.create(t);return n[z]=e.single===!1?arguments:arguments[0],n}},Ow=(e)=>{let t={[Kn]:Kn,_tag:e.op,get[e.prop](){return this[z]},...jr(e),toString(){return`${e.op}(${re(this[z])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[z]}},[Ze](n){return Tw(n)&&n._tag===this._tag&&ze(this[z],n[z])},[Ge](){return dt(Fe(e.op),Ie(this[z]))}};return function(n){let o=Object.create(t);return o[z]=n,o}},zt=Ow({op:"Success",prop:"value",[Ve](e){let t=e.getCont($t);return t?t[$t](this[z],e,this):e.yieldWith(this)}}),Ry={key:"effect/Cause/StackTrace"},Dw={key:"effect/Cause/InterruptorStackTrace"},ar=Ow({op:"Failure",prop:"cause",[Ve](e){let t=this[z],n=!1;if(e.currentStackFrame)t=Us(t,{mapUnsafe:new Map([[Ry.key,e.currentStackFrame]])}),n=!0;let o=e.getCont(sr);while(e.interruptible&&e._interruptedCause&&o)o=e.getCont(sr);return o?o[sr](t,e,n?void 0:this):e.yieldWith(n?ar(t):this)}}),Vo=(e)=>ar(Ew(e)),Sn=(e)=>ar($w(e)),Wo=Jt({op:"WithFiber",[Ve](e){return this[z](e)}}),BU=function(){class e extends globalThis.Error{}let t=jr({op:"YieldableError",[Ve](){return Vo(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),cu=function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends BU{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0);if(n)ou(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1})}toJSON(){return{...this[e],...this}}}}(),Jo=(e)=>{class t extends cu{_tag=e}return t.prototype.name=e,t};var Dy="~effect/Cause/Done";var Vq={[Dy]:Dy,_tag:"Done",value:void 0};var Pw=(e)=>jr({op:e.label,[Ve]:e.evaluate});var eo=(e)=>(t,n)=>t===n||e(t,n),HU=(e,t)=>e===t,Cw=()=>HU;var Aw="~effect/data/Option",Mw={[Aw]:{_A:(e)=>e},...Qn,[Symbol.iterator](){return new yn(this)}},VU=Object.defineProperty(Object.assign(Object.create(Mw),{_tag:"Some",_op:"Some",[Ze](e){return Ay(e)&&Uy(e)&&ze(this.value,e.value)},[Ge](){return dt(Ie(this._tag))(Ie(this.value))},toString(){return`some(${re(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:Jn(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),WU=Ie("None"),JU=Object.assign(Object.create(Mw),{_tag:"None",_op:"None",valueOrUndefined:void 0,[Ze](e){return Ay(e)&&My(e)},[Ge](){return WU},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),Ay=(e)=>ge(e,Aw),My=(e)=>e._tag==="None",Uy=(e)=>e._tag==="Some",Uw=Object.create(JU),Nw=(e)=>{let t=Object.create(VU);return t.value=e,t};var Fw="~effect/data/Result",zw={[Fw]:{_A:(e)=>e,_E:(e)=>e},...Qn,[Symbol.iterator](){return new yn(this)}},YU=Object.assign(Object.create(zw),{_tag:"Success",_op:"Success",[Ze](e){return Ny(e)&&Lw(e)&&ze(this.success,e.success)},[Ge](){return dt(Ie(this._tag))(Ie(this.success))},toString(){return`success(${re(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:Jn(this.success)}}}),XU=Object.assign(Object.create(zw),{_tag:"Failure",_op:"Failure",[Ze](e){return Ny(e)&&Fy(e)&&ze(this.failure,e.failure)},[Ge](){return dt(Ie(this._tag))(Ie(this.failure))},toString(){return`failure(${re(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:Jn(this.failure)}}}),Ny=(e)=>ge(e,Fw),Fy=(e)=>e._tag==="Failure",Lw=(e)=>e._tag==="Success",jw=(e)=>{let t=Object.create(XU);return t.failure=e,t},Gw=(e)=>{let t=Object.create(YU);return t.success=e,t};function zy(e){return(t,n)=>t===n?0:e(t,n)}var Fs=zy((e,t)=>{if(globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t))return 0;if(globalThis.Number.isNaN(e))return-1;if(globalThis.Number.isNaN(t))return 1;return e<t?-1:1});var Ly=(e)=>W(2,(t,n)=>e(t,n)===-1),uu=(e)=>W(2,(t,n)=>e(t,n)===1),du=(e)=>W(2,(t,n)=>e(t,n)!==1),pu=(e)=>W(2,(t,n)=>e(t,n)!==-1);var cr=()=>Uw,Lt=Nw;var bn=My,jy=Uy,Gy=W(2,(e,{onNone:t,onSome:n})=>bn(e)?t():n(e.value));var Bw=(e)=>(...t)=>{try{return Lt(e(...t))}catch{return cr()}};var mu=W(2,(e,t)=>bn(e)?cr():Lt(t(e.value)));var fu=W(2,(e,t)=>bn(e)?cr():t(e.value)?Lt(e.value):cr());var qw="~effect/Context/Service",Hw=function(){function e(){}let t=e;Object.setPrototypeOf(t,tN);let n=(o,r)=>{if(t.key=o,r?.defaultValue)t[By]=By,t.defaultValue=r.defaultValue;if(r?.make)t.make=r.make;if(r?.fiberCached)Vw.add(o);return t};return arguments.length>0?n(arguments[0],arguments[1]):n},tN={[qw]:qw,...Pw({label:"Service",evaluate(e){return zt(zs(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return Wy(this,e)},use(e){return Wo((t)=>e(zs(t.context,this)))},useSync(e){return Wo((t)=>zt(e(zs(t.context,this))))}},Vw=new Set,By="~effect/Context/Reference",Ww="~effect/Context",rN=8,nN=8,qy=(e,t,n,o)=>{let r=Object.create(oN);return r.cacheRoot=e??r,r.base=t,r.overlay=n,r.depth=o,r._flat=void 0,r.baseHits=0,r},Jw=(e,t)=>{if(!t)return;Jw(e,t.parent),e.set(t.key,t.value)},Kw=(e)=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Jw(t,e.overlay),e._flat=t};var Hy=Symbol(),Yw=(e,t)=>{let n=e;for(let r=n.overlay;r;r=r.parent)if(r.key===t)return r.value;let o=n.base.get(t);if(o===void 0&&!n.base.has(t))return Hy;if(n.overlay&&++n.baseHits>=nN)n.base=Kw(n),n.overlay=void 0,n.depth=0;return o},hu=(e)=>qy(void 0,e,void 0,0),oN={get mapUnsafe(){return Kw(this)},...Qn,[Ww]:{_Services:(e)=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Ze](e){if(!iN(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[o,r]of t)if(!n.has(o)||!ze(r,n.get(o)))return!1;return!0},[Ge](){return Vn(this.mapUnsafe.size)}},Xw=(e,t)=>e.cacheRoot===t.cacheRoot,iN=(e)=>ge(e,Ww);var sN=(e)=>!!e[By],Vy=()=>aN,aN=hu(new Map),Wy=(e,t)=>hu(new Map([[e.key,t]])),Qw=W(3,(e,t,n)=>cN(e,t.key,n)),cN=(e,t,n)=>{let o=e,r=Vw.has(t)?void 0:o.cacheRoot;if(o.depth>=rN){let i=new Map(o.mapUnsafe);return i.set(t,n),qy(r,i,void 0,0)}return qy(r,o.base,{key:t,value:n,parent:o.overlay},o.depth+1)};var gu=(e,t)=>{let n=Yw(e,t);return n===Hy?void 0:n},eI=W(2,(e,t)=>{let n=Yw(e,t.key);if(n===Hy){if(sN(t))return lN(t);throw uN(t)}return n}),zs=eI,Zy="~effect/Context/defaultValue",lN=(e)=>{if(Zy in e)return e[Zy];return e[Zy]=e.defaultValue()},uN=(e)=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let n=t.stack.split(`
301
301
  `);n.splice(1,3),t.stack=n.join(`
302
- `)}return t};var Gr=Vw;var Ky=(e)=>e.length>0;var Ls=Gw,to=jw;var yu=Fy;var xu=H(2,(e,{onFailure:t,onSuccess:n})=>yu(e)?t(e.failure):n(e.success));var Xy=globalThis.Array;var Ko=(e)=>Xy.isArray(e)?e:Xy.from(e);var Qy=H(2,(e,t)=>[...e,t]),pN=H(2,(e,t)=>Ko(e).concat(Ko(t)));var gV=Xy.isArray;var ex=Ky,vu=Ky;var mN=(e,t)=>{let n=Ie(t),o=e.get(n);if(o===void 0)return e.set(n,[t]),!0;for(let r of o)if(ze(r,t))return!1;return o.push(t),!0};var tI=H(2,(e,t)=>{let n=Ko(e),o=Ko(t);if(vu(n))return vu(o)?fN(pN(n,o)):n;return o});var Su=()=>[];var rI=H(2,(e,t)=>e.map(t));var fN=(e)=>{let t=Ko(e);if(t.length<2)return[...t];let n=new Map,o=[];for(let r of t)if(mN(n,r))o.push(r);return o};var rx=Gr("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new bu}),nI="setImmediate"in globalThis?(e)=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:(e)=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},hN=(e)=>{let t=!1;return Promise.resolve().then(()=>{if(!t)e()}),()=>{t=!0}};class oI{buckets=[];scheduleTask(e,t){let n=this.buckets,o=n.length,r,i=0;for(;i<o;i++){if(n[i][0]>t)break;r=n[i]}if(r&&r[0]===t)r[1].push(e);else if(i===o)n.push([t,[e]]);else n.splice(i,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}}class bu{executionMode;setImmediate;constructor(e="async",t){this.executionMode=e,this.setImmediate=t??(e==="sync"?hN:nI)}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new iI(this.setImmediate)}}class iI{tasks=new oI;running=void 0;setImmediate;constructor(e=nI){this.setImmediate=e}scheduleTask(e,t){if(this.tasks.scheduleTask(e,t),this.running===void 0)this.running=this.setImmediate(this.afterScheduled)}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let o=0;o<n.length;o++)n[o]()}}flush(){while(this.tasks.buckets.length>0){if(this.running!==void 0)this.running(),this.running=void 0;this.runTasks()}}}var sI=Gr("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),aI=Gr("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var cI=class extends Vn{constructor(e){super();if(e)ou(this,e)}};var nx=Jo;var uI="~effect/encoding/EncodingError";class ku extends nx("EncodingError"){[uI]=uI}var wu=(e)=>typeof e==="string"?dI(yN.encode(e)):dI(e),Iu=(e)=>{let t=xN(e),n=t.length;if(n%4!==0)return to(new ku({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${n}`}));let o=t.indexOf("=");if(o!==-1&&(o<n-2||o===n-2&&t[n-1]!=="="))return to(new ku({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let r=t.endsWith("==")?2:t.endsWith("=")?1:0,i=new Uint8Array(3*(n/4)-r);for(let s=0,a=0;s<n;s+=4,a+=3){let l=_u(t.charCodeAt(s))<<18|_u(t.charCodeAt(s+1))<<12|_u(t.charCodeAt(s+2))<<6|_u(t.charCodeAt(s+3));i[a]=l>>16,i[a+1]=l>>8&255,i[a+2]=l&255}return Ls(i)}catch(r){return to(new ku({kind:"Decode",module:"Base64",input:t,message:r instanceof Error?r.message:"Invalid input"}))}};var yN=new TextEncoder;var xN=(e)=>e.replace(/[\n\r]/g,""),dI=(e)=>{let t=e.length,n="",o;for(o=2;o<t;o+=3)n+=Zr[e[o-2]>>2],n+=Zr[(e[o-2]&3)<<4|e[o-1]>>4],n+=Zr[(e[o-1]&15)<<2|e[o]>>6],n+=Zr[e[o]&63];if(o===t+1)n+=Zr[e[o-2]>>2],n+=Zr[(e[o-2]&3)<<4],n+="==";if(o===t)n+=Zr[e[o-2]>>2],n+=Zr[(e[o-2]&3)<<4|e[o-1]>>4],n+=Zr[(e[o-1]&15)<<2],n+="=";return n};function _u(e){if(e>=pI.length)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=pI[e];if(t===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var Zr=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],pI=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];var vN=[];for(let e=0;e<256;e++)vN.push(e.toString(16).padStart(2,"0"));var fI="effect/Tracer/ParentSpan";var hI="effect/Tracer";var gI="effect/observability/Metric/FiberRuntimeMetricsKey";var yI=Gr("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:jo});var xI=Gr("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),vI=Gr("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});class II extends Cs{fiberId;constructor(e,t=Rs){super("Interrupt",t,"Interrupted");this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[Ze](e){return au(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[Ge](){return dt(Fe(`${this._tag}:${this.fiberId}`))(eu(this.annotations))}}var TI=(e)=>new vn([new II(e)]);var ax=(e)=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag==="Fail")return Ls(n.error)}return to(e)};var EI=(e)=>e.reasons.some(au);var cx=H(2,(e,t)=>{if(e.reasons.length===0)return t;else if(t.reasons.length===0)return e;let n=new vn(tI(e.reasons,t.reasons));return ze(e,n)?e:n}),$I=H(2,(e,t)=>{let n=!1,o=e.reasons.map((r)=>{if(Ns(r))return n=!0,new As(t(r.error),r.annotations);return r});return n?Ms(o):e});var SI="~effect/Fiber",$N={_A:_t,_E:_t},ON={id:0},DN=()=>globalThis[Vo];class lx{constructor(e,t=!0){this[SI]=$N,this.setContext(e),this.id=++ON.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[SI];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return zs(this.context,e)}addObserver(e){if(this._exit)return e(this._exit),gw;return this._observers.push(e),()=>{if(this._exit)return;let t=this._observers.indexOf(e);if(t>=0)this._observers.splice(t,1)}}interruptUnsafe(e,t){if(this._exit)return;let n=TI(e);if(this.currentStackFrame)n=Us(n,Hy(Ry,this.currentStackFrame));if(t)n=Us(n,t);if(this._interruptedCause=this._interruptedCause?cx(this._interruptedCause,n):n,this.interruptible)if(this._running)this._deferredInterrupt=!0;else this.evaluate(lr(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;else if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let t=this.runLoop(e);if(t===Xn)return;let n=bI.interruptChildren&&bI.interruptChildren(this);if(n!==void 0)return this.evaluate(Gt(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let o=0;o<this._observers.length;o++)this._observers[o](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=Wy()}runLoop(e){let t=globalThis[Vo];globalThis[Vo]=this;let n=this._running;this._running=!0;let o=!1,r=e;this.currentOpCount=0;try{while(!0){if(this._deferredInterrupt)this._deferredInterrupt=!1,r=lr(this._interruptedCause);if(this.currentOpCount++,!o&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){o=!0;let i=r;r=Gt(RI,()=>i)}if(r=this.currentTracerContext?this.currentTracerContext(r,this):r[We](this),r===Xn){let i=this._yielded;if(Kn in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;else if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Xn}}}catch(i){if(!ge(r,We))return Sn(`Fiber.runLoop: Not a valid effect: ${String(r)}`);return this.runLoop(Sn(i))}finally{this._running=n,globalThis[Vo]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,PN;while(!0){let t=this._stack.pop();if(!t)return;let n=t[xn]&&t[xn](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,Xn}children(){return this._children??=new Set}pipe(){return ht(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&Xw(t,e))return;let n=this.getRef(rx);if(n!==this.currentScheduler)this.currentScheduler=n,this._dispatcher=void 0;this.currentSpan=gu(e,fI),this.currentLogLevel=this.getRef(xI),this.minimumLogLevel=this.getRef(vI),this.currentStackFrame=this.getRef(yI),this.maxOpsBeforeYield=this.getRef(sI),this.currentPreventYield=this.getRef(aI),this.runtimeMetrics=gu(e,gI);let o=gu(e,hI);this.currentTracerContext=o?o.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}}var PN={[$t](e,t){return lr(t._interruptedCause)},[sr](e,t){return lr(t._interruptedCause)}},bI={interruptChildren:void 0},OI=(e)=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Dw.key,e.currentStackFrame),hu(t)};var CN=(e)=>ux((t)=>{let n=e[Symbol.iterator](),o=[],r=void 0;function i(){let s=n.next();while(!s.done){if(s.value._exit){o.push(s.value._exit),s=n.next();continue}r=s.value.addObserver((a)=>{o.push(a),i()});return}t(jt(o))}return i(),DI(()=>r?.())});var _I=(e)=>Ho((t)=>{let n=OI(t),o=Su();for(let r of e)r.interruptUnsafe(t.id,n),o.push(r);return jI(CN(o))});var jt=zt,lr=ar,Yo=Wo,DI=Jt({op:"Sync",[We](e){let t=this[z](),n=e.getCont($t);return n?n[$t](t,e):e.yieldWith(zt(t))}}),no=Jt({op:"Suspend",[We](e){return this[z]()}});var PI=xu({onFailure:Yo,onSuccess:jt});var CI=Jt({op:"Yield",[We](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{if(t)return;e.evaluate(Br)},this[z]??0),e.yieldWith(()=>{t=!0})}}),RI=CI(0);var AI=jt(cr());var MI=(e)=>no(()=>lr(Sr(e))),Tu=(e)=>Sn(e),UI=(e)=>no(()=>Yo(Sr(e))),js=jt(void 0);var NI=(e)=>{let t=typeof e==="function"?e:e.try,n=typeof e==="function"?(o)=>new $u(o,"An error occurred in Effect.try"):e.catch;return no(()=>{try{return jt(Sr(t))}catch(o){return Yo(Sr(()=>n(o)))}})};var FI=(e)=>{let t=typeof e==="function"?e:e.try,n=typeof e==="function"?(o)=>new $u(o,"An error occurred in Effect.tryPromise"):e.catch;return zI(function(o,r){let i=(s)=>{try{o(Yo(Sr(()=>n(s))))}catch(a){o(Tu(a))}};try{Sr(()=>t(r)).then((s)=>o(jt(s)),i)}catch(s){i(s)}},t.length!==0)};var zI=Jt({op:"Async",single:!1,[We](e){let t=Sr(()=>this[z][0].bind(e.currentScheduler)),n=!1,o=!1,r=this[z][1]?new AbortController:void 0,i=t((s)=>{if(n)return;if(n=!0,o)e.evaluate(s);else o=s},r?.signal);if(o!==!1)return o;if(o=!0,e._yielded=()=>{n=!0},r===void 0&&i===void 0)return Xn;return e._stack.push(RN(()=>(n=!0,r?.abort(),i??Br))),Xn}}),RN=Jt({op:"AsyncFinalizer",[xn](e){if(e.interruptible)e.interruptible=!1,e._stack.push(mx)},[sr](e,t){return EI(e)?Gt(this[z](),()=>lr(e)):lr(e)}}),ux=(e)=>zI(e,e.length>=2);var AN=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0});var LI=(e,...t)=>AN(e.length,t.length===0?function(){return kI(()=>e.apply(this,arguments))}:function(){let n=kI(()=>e.apply(this,arguments));for(let o of t)n=o(n);return n}),kI=(e)=>{try{let t=e(),n=void 0;while(!0){let o=t.next(n);if(o.done)return jt(o.value);let r=o.value;if(r&&r._tag==="Success"){n=r.value;continue}else if(r&&r._tag==="Failure")return o.value;else{let i=!0;return no(()=>{if(i)return i=!1,Gt(o.value,(s)=>wI(t,s));else return no(()=>wI(e()))})}}}catch(t){return Tu(t)}},wI=Jt({op:"Iterator",single:!1,[$t](e,t){let n=this[z][0];while(!0){let o=n.next(e);if(o.done)return jt(o.value);if(!Ye(o.value))return t._stack.push(this),o.value;else if(o.value._tag==="Failure")return o.value;e=o.value.value}},[We](e){return this[$t](this[z][1],e)}});var jI=(e)=>Gt(e,(t)=>Br);var Gt=H(2,(e,t)=>{let n=Object.create(MN);return n[z]=e,n[$t]=t.length!==1?(o)=>t(o):t,n}),MN=jr({op:"OnSuccess",[We](e){return e._stack.push(this),this[z]}});var Ye=(e)=>(Kn in e),GI=H(2,(e,t)=>{if(Ye(e))return e._tag==="Success"?t(e.value):e;return Gt(e,t)});var ZI=H(2,(e,t)=>Gt(e,(n)=>jt(Sr(()=>t(n))))),BI=H(2,(e,t)=>Ye(e)?VI(e,t):ZI(e,t)),qI=H(2,(e,t)=>Ye(e)?WI(e,t):KI(e,t));var dx=(e)=>e._tag==="Success";var Br=zt(void 0),VI=H(2,(e,t)=>e._tag==="Success"?zt(t(e.value)):e),WI=H(2,(e,t)=>{if(e._tag==="Success")return e;let n=ax(e.cause);if(yu(n))return e;return Wo(t(n.success))});var Eu=H(2,(e,t)=>{let n=Object.create(UN);return n[z]=e,n[sr]=t.length!==1?(o)=>t(o):t,n}),UN=jr({op:"OnFailure",[We](e){return e._stack.push(this),this[z]}});var HI=H(3,(e,t,n)=>Eu(e,(o)=>{let r=t(o);return yu(r)?lr(r.failure):Sr(()=>n(r.success,o))})),JI=H(2,(e,t)=>HI(e,ax,(n)=>t(n)));var KI=H(2,(e,t)=>JI(e,(n)=>UI(()=>t(n))));var HV=jr({op:"OnSuccessAndFailure",[We](e){return e._stack.push(this),this[z]}});var px=(e)=>Ye(e)?zt(e):NN(e),NN=Jt({op:"Exit",[We](e){return e._stack.push(this),this[z]},[$t](e,t,n){return jt(n??zt(e))},[sr](e,t,n){return jt(n??ar(e))}});var FN=(e,t)=>dx(e)?t:Eu(t,(n)=>lr(cx(e.cause,n)));var zN=Jt({op:"OnExit",single:!1,[We](e){return e._stack.push(this),this[z][0]},[xn](e){if(e.interruptible&&this[z][2]!==!0)e._stack.push(mx),e.interruptible=!1},[$t](e,t,n){n??=zt(e);let o=this[z][1](n);return o?Gt(o,(r)=>n):n},[sr](e,t,n){n??=ar(e);let o=this[z][1](n);return o?Gt(FN(n,o),(r)=>n):n}});var YI=(e)=>Ho((t)=>{if(!t.interruptible)return e;return t.interruptible=!1,t._stack.push(mx),e}),LN=Jt({op:"SetInterruptible",[xn](e){if(e.interruptible=this[z],e._interruptedCause&&e.interruptible)return()=>lr(e._interruptedCause)}}),mx=LN(!0);var jN=Jt({op:"While",[$t](e,t){if(this[z].step(e),this[z].while())return t._stack.push(this),this[z].body();return Br},[We](e){if(this[z].while())return e._stack.push(this),this[z].body();return Br}});var GN=(e)=>{let{onItem:t,step:n}=e,o=(r,i,s,a)=>{for(;s<a;s++){let l=i[s],c=t(r,l,s);if(!Ye(c))return Gt(px(c),(f)=>n(r,l,f,s)??o(r,i,s+1,a)??js);let u=n(r,l,c,s);if(u)return u._tag==="Failure"?u:void 0}};return(r,i,s)=>{let a=0,l=s?.end??i.length,c=s?.concurrency??1;if(c===1)return o(r,i,0,l);let u=s?.orderedStep===!0,f=!1,h,m,y,k=!1,S,I,D=a,R=u?Array(l):void 0,M=(Ue)=>{let $e=Sn(Ue);return S=$e,f=!0,k=!0,m&&m.size>0?Gt(YI(_I(Array.from(m))),()=>$e):$e},me=(Ue,$e,rt)=>{if(!u)return n(r,Ue,$e,rt);if(S)return S;R[rt]=$e;while(D<l){let ue=R[D];if(ue===void 0)return;R[D]=void 0;let fe=D++,De=n(r,i[fe],ue,fe);if(De)return De}},Ee=()=>{let Ue=!1;for(;!S&&a<l;a++){let $e=i[a],rt=I??t(r,$e,a);if(Ye(rt)){if(S=me($e,rt,a),S)break}else if(!h)return ux((ue)=>{h=DN(),m=new Set,I=rt,y=ue;let fe;try{fe=Ee()}catch(De){return ue(M(De))}if(fe)return ue(fe);return no(()=>(S=Br,k=!0,m?_I(m):js))});else{I=void 0;let ue=ZN(h,rt,!0,!0,"inherit");if(ue._exit){if(S=me($e,ue._exit,a),S)break;continue}m.add(ue);let fe=a;if(ue.addObserver((De)=>{m.delete(ue);try{if(S){if(!k&&De._tag==="Failure")for(let Pe of De.cause.reasons)if(Pe._tag==="Interrupt")continue;else if(S._tag==="Failure")S.cause.reasons.push(Pe);else S=ar(Ms([Pe]))}else{let Pe=me($e,De,fe);if(Pe)S=Pe._tag==="Failure"?ar(Ms(Pe.cause.reasons.slice())):Pe,Ee()}if(Ue){let Pe=Ee();if(Pe)y(Pe)}else if(f&&m.size===0)y(S??js)}catch(Pe){y(M(Pe))}}),m.size<c)continue;Ue=!0,a++;return}}if(f=!0,S){if(m&&m.size>0){let $e=OI(h);m.forEach((rt)=>rt.interruptUnsafe(h.id,$e));return}if(y||S._tag==="Failure")return S}else if(y){if(!m)return Br;else if(m.size===0)y(js)}};return Ee()}},Gs=()=>GN;var ZN=(e,t,n=!1,o=!1,r=!1)=>{let i=e,s=r==="inherit"?i.interruptible:!r,a=new lx(i.context,s);if(n)a.evaluate(t);else i.currentDispatcher.scheduleTask(()=>a.evaluate(t),0);if(!o&&!a._exit)i.children().add(a),a.addObserver(()=>i._children.delete(a));return a};var XI=(e)=>(t,n)=>{let o=new lx(n?.scheduler?Qw(e,rx,n.scheduler):e,n?.uninterruptible!==!0);if(o.evaluate(t),o._exit)return o;if(n?.signal)if(n.signal.aborted)o.interruptUnsafe();else{let r=()=>o.interruptUnsafe();n.signal.addEventListener("abort",r,{once:!0}),o.addObserver(()=>n.signal.removeEventListener("abort",r))}if(n?.onFiberStart)n.onFiberStart(o);return o};var QI=(e)=>{let t=XI(e);return(n)=>{if(Ye(n))return n;let o=new bu("sync"),r=t(n,{scheduler:o});return r._dispatcher?.flush(),r._exit??Sn(new hx(r))}},eT=QI(Wy());var ox="~effect/Cause/IllegalArgumentError";class fx extends Jo("IllegalArgumentError"){[ox]=ox;constructor(e){super({message:e})}}var ix="~effect/Cause/AsyncFiberError";class hx extends Jo("AsyncFiberError"){[ix]=ix;constructor(e){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:e})}}var sx="~effect/Cause/UnknownError";class $u extends Jo("UnknownError"){[sx]=sx;constructor(e,t){super({message:t,cause:e})}}var BN="~effect/Logger",JV={[BN]:{_Message:_t,_Output:_t},pipe(){return ht(this,arguments)}};var ro={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},KV={None:[],All:[],Trace:[ro.gray],Debug:[ro.blue],Info:[ro.green],Warn:[ro.yellow],Error:[ro.red],Fatal:[ro.bgBrightRed,ro.black]};var tT=zt,yx=ar,Xo=Wo;var Qo=Br;var Ou=dx;var rT=Ns;var Du=$I;var nT=fx;var Pu="~effect/time/DateTime",Cu="~effect/time/DateTime/TimeZone",oT={[Pu]:Pu,pipe(){return ht(this,arguments)},[gn](){return this.toString()},toJSON(){return Bs(this).toJSON()}},qN={...oT,_tag:"Utc",[Ge](){return Wn(this.epochMilliseconds)},[Ze](e){return Zs(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Bs(this).toJSON()})`}},YW={...oT,_tag:"Zoned",[Ge](){return dt(Wn(this.epochMilliseconds))(Ie(this.zone))},[Ze](e){return Zs(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&ze(this.zone,e.zone)},toString(){return`DateTime.Zoned(${gT(this)})`}},iT={[Cu]:Cu,[gn](){return this.toString()}},XW={...iT,_tag:"Named",[Ge](){return Fe(`Named:${this.id}`)},[Ze](e){return bx(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},QW={...iT,_tag:"Offset",[Ge](){return Fe(`Offset:${this.offset}`)},[Ze](e){return bx(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${mT(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}};var Zs=(e)=>ge(e,Pu);var bx=(e)=>ge(e,Cu);var sT=(e)=>e._tag==="Utc";var aT=eo((e,t)=>e.epochMilliseconds===t.epochMilliseconds),cT=zy((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:e.epochMilliseconds>t.epochMilliseconds?1:0);var lT=(e)=>{let t=Object.create(qN);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},oo=(e)=>{let t=e.getTime();if(Number.isNaN(t))throw new nT("Invalid date");return lT(t)},_x=(e)=>{if(Zs(e))return e;else if(e instanceof Date)return oo(e);else if(typeof e==="object"){if("epochMilliseconds"in e)return oo(new Date(e.epochMilliseconds));let t=new Date(0);return WN(t,e),oo(t)}else if(typeof e==="string"&&!VN(e))return oo(new Date(e+"Z"));return oo(new Date(e))},VN=(e)=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e);var uT=Bw(_x);var dT=(e)=>lT(e.epochMilliseconds);var Bs=(e)=>new Date(e.epochMilliseconds),kx=(e)=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);else if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);else if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter((o)=>o.type!=="literal"),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMilliseconds=n.getTime(),n},pT=(e)=>kx(e).getTime()-wx(e),mT=(e)=>{let t=Math.abs(e),n=Math.floor(t/3600000),o=Math.round(t%3600000/60000);if(o===60)n+=1,o=0;return`${e<0?"-":"+"}${String(n).padStart(2,"0")}:${String(o).padStart(2,"0")}`},fT=(e)=>mT(pT(e)),wx=(e)=>e.epochMilliseconds;var WN=(e,t)=>{if(t.year!==void 0)e.setUTCFullYear(t.year);if(t.month!==void 0)e.setUTCMonth(t.month-1);if(t.day!==void 0)e.setUTCDate(t.day);if(t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}if(t.hour!==void 0)e.setUTCHours(t.hour);if(t.minute!==void 0)e.setUTCMinutes(t.minute);if(t.second!==void 0)e.setUTCSeconds(t.second);if(t.millisecond!==void 0)e.setUTCMilliseconds(t.millisecond)};var hT=(e)=>Bs(e).toISOString();var Sx=(e)=>{let t=kx(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${fT(e)}`},gT=(e)=>e.zone._tag==="Offset"?Sx(e):`${Sx(e)}[${e.zone.id}]`;var eH=globalThis.String;var yT=(e)=>e.trim();var xT=FI,Me=jt,Ix=AI;var Te=Yo;var Tx=MI,vT=Tu,Ex=NI;var ST=PI;var qr=Gt;var qs=px;var Vs=Eu;var Ws=eT;var ei=BI,$x=qI;var Kt=GI;var Ox=LI;var bT=Zs;var _T=sT;var kT=aT,wT=cT;var IT=oo,KN=_x;var TT=uT;var ET=dT;var $T=Bs;var OT=wx;var DT=hT;function Hs(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function PT(e){return(t)=>Hs(t)?.[e]}var Au="~structural";var Mu="~sentinels",Uu="~constructor";var CT=PT("brands");var ye=Symbol();var ur=tT,Vr=ur(ye),ot=ur(ye),Nu=(e)=>e===ye?cr():Lt(e),Px=(e)=>e._tag==="None"?Vr:ur(e.value);var Js="~effect/SchemaIssue/Issue";function Ax(e){return ge(e,Js)&&e[Js]===Js}class dr{[Js]=Js;constructor(e,t){if(t?.reportInput===!0&&e!==ye)this.input=e}}class Mx extends dr{_tag="Filter";filter;issue;constructor(e,t,n,o){super(n,o);this.filter=e,this.issue=t}}class Ux extends dr{_tag="Encoding";ast;issue;constructor(e,t,n,o){super(n,o);this.ast=e,this.issue=t}}class br extends dr{_tag="Pointer";path;issue;constructor(e,t){super();this.path=e,this.issue=t}}class Ks extends dr{_tag="MissingKey";annotations;constructor(e){super();this.annotations=e}}class Fu extends dr{_tag="UnexpectedKey";ast;constructor(e,t,n){super(t,n);this.ast=e}}class pt extends dr{_tag="Composite";ast;issues;constructor(e,t,n,o){super(n,o);this.ast=e,this.issues=t}}class Yt extends dr{_tag="InvalidType";ast;constructor(e,t,n){super(t,n);this.ast=e}}class gt extends dr{_tag="InvalidValue";annotations;constructor(e,t,n){super(t,n);this.annotations=e}}class Ys extends dr{_tag="AnyOf";ast;issues;constructor(e,t,n,o){super(n,o);this.ast=e,this.issues=t}}class Nx extends dr{_tag="OneOf";ast;successes;constructor(e,t,n,o){super(n,o);this.ast=e,this.successes=t}}function Rx(e,t,n){if(Ax(e))return e;if(typeof e==="string")return new gt({message:e},t,n);let o=typeof e.issue==="string"?new gt({message:e.issue},t,n):e.issue;return new br(e.path,o)}function RT(e,t,n){if(e===void 0)return;if(typeof e==="boolean")return e?void 0:new gt(void 0,t,n);return Rx(e,t,n)}function AT(e,t,n,o){if(Array.isArray(t)){if(!vu(t))return;return t.length===1?Rx(t[0],n,o):new pt(e,rI(t,(r)=>Rx(r,n,o)),n,o)}return RT(t,n,o)}function Xs(e){let t;for(let n of e.reasons){if(!rT(n)||!Ax(n.error))return;t??=n.error}return t}function zu(e,t){let n=Xs(e);if(n===void 0)throw Error(t,{cause:e});return n}class io extends Vn{run;constructor(e){super();this.run=e}map(e){return new io((t,n)=>this.run(t,n).pipe(ei(mu(e))))}compose(e){if(UT(this))return e;if(UT(e))return this;return new io((t,n)=>this.run(t,n).pipe(Kt((o)=>e.run(o,n))))}}var NT=new io(Me);function UT(e){return e.run===NT.run}function Wr(){return NT}function XN(e){return new io((t,n)=>bn(t)?Ix:e(t.value,n))}function it(e){return Fx(mu(e))}function Qs(e){return XN((t,n)=>e(t,n).pipe(ei(Lt)))}function Fx(e){return new io((t)=>Me(e(t)))}function zx(e){return new io((t)=>{let n=fu(t,xy);return jy(n)?Me(n):ei(e,Lt)})}function Lu(){return it(globalThis.String)}function ju(){return it(globalThis.Number)}function FT(){return it(yT)}function zT(){return it(wu)}function LT(){return Qs((e,t)=>$x(ST(Iu(e)),()=>new gt({expected:"a valid Base64 string"},e,t)))}var ta="~effect/SchemaTransformation/Transformation";class mt{[ta]=ta;_tag="Transformation";decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new mt(this.encode,this.decode)}compose(e){return new mt(this.decode.compose(e.decode),e.encode.compose(this.encode))}}function oF(e){return ge(e,ta)&&e[ta]===ta}var Lx=(e)=>{if(oF(e))return e;return new mt(e.decode,e.encode)};function ri(e){return new mt(Qs(e.decode),Qs(e.encode))}function so(e){return new mt(it(e.decode),it(e.encode))}function jT(){return new mt(FT(),Wr())}var iF=new mt(Wr(),Wr());function Gu(){return iF}var Zu=new mt(ju(),Lu());var sF=(e)=>Bo(e)&&typeof e.message==="string",aF=(e)=>{let n=Object.hasOwn(e,"cause")?Error(e.message,{cause:GT(e.cause)}):Error(e.message);if(typeof e.name==="string"&&e.name!=="Error")n.name=e.name;if(typeof e.stack==="string")n.stack=e.stack;return n},cF=(e)=>{try{let t=Oy(e);return t===void 0?re(e):JSON.parse(t)}catch{return re(e)}},lF=(e,t,n)=>{let o={name:e.name,message:typeof e.message==="string"?e.message:""};if(t?.includeStack&&typeof e.stack==="string")o.stack=e.stack;if(!t?.excludeCause&&e.cause!==void 0)o.cause=n(e.cause);return o},uF=(e)=>{let t=new WeakSet,n=(o)=>{if(vw(o)){if(t.has(o))return"[Circular]";t.add(o);let r=lF(o,e,n);return t.delete(o),r}return cF(o)};return n},GT=(e)=>sF(e)?aF(e):e;var ZT=(e)=>so({decode:GT,encode:uF(e)});var BT=ri({decode:(e,t)=>URL.canParse(e)?Me(new URL(e)):Te(new gt({expected:"a valid URL string"},e,t)),encode:(e)=>Me(e.href)});var qT=new mt(LT(),zT());var VT=ri({decode:(e,t)=>Gy(TT(e),{onNone:()=>Te(new gt({expected:"a valid UTC DateTime string"},e,t)),onSome:(n)=>Me(ET(n))}),encode:(e)=>Me(DT(e))});function Tn(e){return(t)=>t._tag===e}var aa=Tn("Declaration");var hF=Tn("Never");var ni=Tn("Literal"),jx=Tn("UniqueSymbol");var eE=Tn("Arrays"),gF=Tn("Objects"),tE=Tn("Union"),yF=Tn("Suspend");class yt{to;transformation;constructor(e,t){this.to=e,this.transformation=t}}var Vu={};class In{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,o=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=o}}var WT="~effect/Schema";class Ot{[WT]=WT;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,o=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=o}toString(){return`<${this._tag}>`}}class co extends Ot{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,o,r,i,s,a){super(n,o,r,i);this.typeParameters=e,this.run=t,this.encodingChecks=s,this.encodingRun=a}getParser(){let e;return(t,n)=>{if(t===ye)return Vr;return(e??=this.run(this.typeParameters))(t,this,n)}}_rebuild(e,t,n,o,r){let i=si(this.typeParameters,e);return i===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&o===this.run&&r===this.encodingRun?this:new co(i,o,this.annotations,t,void 0,this.context,n,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;if(typeof e==="string")return e;return"<Declaration>"}}class rE extends Ot{_tag="Null";getParser(){return rv(this,null)}getExpected(){return"null"}}var Vx=new rE;class nE extends Ot{_tag="Undefined";getParser(){return rv(this,void 0)}toCodecJson(){return Zt(this,[xF])}getExpected(){return"undefined"}}var xF=new yt(Vx,new mt(it(()=>{return}),it(()=>null))),Wx=new nE;class oE extends Ot{_tag="Any";getParser(){return li(this,Sy)}getExpected(){return"any"}}var iE=new oE;class sE extends Ot{_tag="Unknown";getParser(){return li(this,Sy)}getExpected(){return"unknown"}}var oa=new sE;class ao extends Ot{_tag="Literal";literal;constructor(e,t,n,o,r){super(t,n,o,r);if(typeof e==="number"&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${re(e)}`);this.literal=e}getParser(){return rv(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==="bigint"?HT(this):this}toCodecStringTree(){return typeof this.literal==="string"?this:HT(this)}getExpected(){return typeof this.literal==="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}}function HT(e){let t=globalThis.String(e.literal);return Zt(e,[new yt(new ao(t),new mt(it(()=>e.literal),it(()=>t)))])}class aE extends Ot{_tag="String";getParser(){return li(this,Es)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&$n(n,e,void 0,this,t)?void 0:e}getExpected(){return"string"}}var ia=new aE;class cE extends Ot{_tag="Number";getParser(){return li(this,yy)}matchKey(e,t){return this._match(CF,e,t)}matchPart(e,t){return this._match(qx,e,t)}_match(e,t,n){if(!e.test(t))return;let o=globalThis.Number(t);if(n.disableChecks||!this.checks)return o;return $n(this.checks,o,void 0,this,n)?void 0:o}toCodecJson(){if(this.checks&&(Gx(this.checks,"effect/schema/isFinite")||Gx(this.checks,"effect/schema/isInt")))return this;return Zt(this,[wF])}toCodecStringTree(){if(this.toCodecJson()===this)return Zt(this,[RF]);return Zt(this,[AF])}getExpected(){return"number"}}function Gx(e,t){return e.some((n)=>n.annotations?.representation?.id===t||n._tag==="FilterGroup"&&Gx(n.checks,t))}var Hx=new cE;class lE extends Ot{_tag="Boolean";getParser(){return li(this,yw)}getExpected(){return"boolean"}}var uE=new lE;class ai extends Ot{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,n,o,r,i,s,a){super(o,r,i,s);this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=a;let l=!1;for(let c=0;c<t.length;c++)if(_r(t[c]))l=!0;else if(l)throw Error("A required element cannot follow an optional element. ts(1257)");if(l&&n.length>1)throw Error("A required element cannot follow an optional element. ts(1257)");for(let c=1;c<n.length;c++)if(_r(n[c]))throw Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let n=this,o,r,i=n.elements.length,s=Math.max(0,n.rest.length-1);function a(l,c){if(c<i)return o[c];else if(c>=l)return r[c-l+1];return r[0]}return Ox(function*(l,c){if(l===ye)return ye;if(!Array.isArray(l))return yield*Te(new Yt(n,l,c));if(!o)o=n.elements.map((y)=>({ast:y,parser:t(y)})),r=n.rest.map((y)=>({ast:y,parser:t(y)}));let u=l.length,f={ast:n,getParser:a,input:l,len:u,tailThreshold:Math.max(i,u-s),output:new globalThis.Array(u),issues:void 0,options:c},h=Jx(c?.concurrency),m=vF(f,l,{concurrency:h?.concurrency,end:n.rest.length===0?i:Math.max(u,i+s)});if(m)yield*m;if(n.rest.length===0&&u>i)for(let y=i;y<=u-1;y++){let k=new Fu(n,l[y],c),S=new br([y],k);if(c.errors==="all")if(f.issues)f.issues.push(S);else f.issues=[S];else return yield*Te(new pt(n,[S],l,c))}if(f.issues)return yield*Te(new pt(n,f.issues,l,c));return f.output})}_rebuild(e,t,n){let o=si(this.elements,e),r=si(this.rest,e);return o===this.elements&&r===this.rest&&t===this.checks&&n===this.encodingChecks?this:new ai(this.isMutable,o,r,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}}var vF=Gs()({onItem(e,t,n){let o=n<e.len?t:ye;return e.getParser(e.tailThreshold,n).parser(o,e.options)},step(e,t,n,o){if(n._tag==="Failure")return Bu(e,e.ast,o,n);let r=n===ot?t:n[z];if(r!==ye)e.output[o]=r;else{let i=e.getParser(e.tailThreshold,o);if(_r(i.ast))return;let s=new br([o],new Ks(i.ast.context?.annotations));if(e.options.errors==="all")if(e.issues)e.issues.push(s);else e.issues=[s];else return Xo(new pt(e.ast,[s],e.input,e.options))}}}),Jx=(e)=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),Bu=(e,t,n,o)=>{if(o.cause.reasons.length===0)return o;let r=Xs(o.cause);if(r===void 0)return yx(Du(o.cause,(s)=>new pt(t,[new br([n],s)],e.input,e.options)));let i=new br([n],r);if(e.options.errors==="all")if(e.issues)e.issues.push(i);else e.issues=[i];else return Xo(new pt(t,[i],e.input,e.options))},dE="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function oi(e,t,n=Vu){let o,r;function i(s){switch(s._tag){case"String":case"TemplateLiteral":return(o??=Object.keys(e)).filter((a)=>s.matchPart(a,n)!==void 0);case"Number":return(o??=Object.keys(e)).filter((a)=>s.matchKey(a,n)!==void 0);case"Symbol":return(r??=Object.getOwnPropertySymbols(e)).filter((a)=>s.matchKey(a,n)!==void 0);case"Union":return[...new Set(s.types.flatMap(i))];default:return[]}}return i(nv(ua(t)))}class Wu{name;type;constructor(e,t){this.name=e,this.type=t}}function Zx(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(Zx);default:return!1}}function SF(e){return Zx(e)&&Zx(ua(e))}class Kx{parameter;type;constructor(e,t){if(!SF(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,_r(t)&&!EE(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}class ca extends Ot{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,o,r,i,s){super(n,o,r,i);this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=s;let a=e.map((l)=>l.name).filter((l,c,u)=>u.indexOf(l)!==c);if(a.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(a)}. ts(2300)`)}getParser(e,t=e){let n=this,o=[];for(let S of n.propertySignatures)o.push(S.name);let r=o.length,i=n.indexSignatures.length,s=r&&i?new Set(o):void 0;if(!r&&!i)return li(n,vy);let a,l,c=(S,I,D,R,M)=>{if(M._tag==="Failure")return Bu(S,n,I,M)??Qo;let me=M===ot?R:M[z];if(D!==ye&&me!==ye){if(r&&(s.has(I)||s.has(D)))return Qo;Ft(S.out,D,me)}return Qo},u=(S,I,D,R)=>{if(!R){let Ue=D.parserKey(I,S.options);if(!Ye(Ue))return qr(qs(Ue),($e)=>u(S,I,D,$e));R=Ue}if(R._tag==="Failure")return Bu(S,n,I,R)??Qo;let M=R===ot?I:R[z],me=S.input[I],Ee=D.parserValue(me,S.options);return Ye(Ee)?c(S,I,M,me,Ee):qr(qs(Ee),(Ue)=>c(S,I,M,me,Ue))},f=(S,I,D)=>{let R=S.input[I],M=D.parserValue(R,S.options);return Ye(M)?c(S,I,I,R,M):qr(qs(M),(me)=>c(S,I,I,R,me))},h=i?Gs()({onItem:(S,[I,D])=>u(S,I,D),step:(S,I,D)=>D._tag==="Failure"?D:void 0}):void 0,m=()=>{if(!a)a=n.propertySignatures.map((S)=>({parser:t(S.type),name:S.name,type:S.type})),l=i?n.indexSignatures.map((S)=>({is:S,parserKey:e(nv(S.parameter)),parserValue:t(S.type)})):void 0;return a},y=Ox(function*(S,I){if(S===ye)return ye;if(!(typeof S==="object"&&S!==null&&!Array.isArray(S)))return yield*Te(new Yt(n,S,I));m();let D=S,R={},M={ast:n,input:D,out:R,issues:void 0,options:I},me=I.errors==="all",Ee=I.onExcessProperty==="error",Ue=I.onExcessProperty==="preserve",$e;if(!i&&(Ee||Ue)){s??=new Set(o),$e=Reflect.ownKeys(D);for(let ue=0;ue<$e.length;ue++){let fe=$e[ue];if(!s.has(fe))if(Ee){let De=new Fu(n,D[fe],I),Pe=new br([fe],De);if(me){if(M.issues)M.issues.push(Pe);else M.issues=[Pe];continue}else return yield*Te(new pt(n,[Pe],S,I))}else Ft(R,fe,D[fe])}}let rt=Jx(I?.concurrency);if(r){let ue=JT(M,a,rt);if(ue)yield*ue}if(i&&!rt)for(let ue=0;ue<i;ue++){let fe=l[ue],De=fe.is.parameter===ia?f:u,Pe=fe.is.parameter===ia?Object.keys(D):oi(D,fe.is.parameter,I);for(let $r=0;$r<Pe.length;$r++){let Qt=De(M,Pe[$r],fe);if(!Ye(Qt))yield*Qt;else if(Qt._tag==="Failure")return yield*Qt}}else if(h){let ue=Su();for(let De=0;De<i;De++){let Pe=l[De],$r=oi(D,Pe.is.parameter,I);for(let Qt=0;Qt<$r.length;Qt++)ue.push([$r[Qt],Pe])}let fe=h(M,ue,rt);if(fe)yield*fe}if(M.issues)return yield*Te(new pt(n,M.issues,S,I));if(I.propertyOrder==="original"){let ue=($e??Reflect.ownKeys(D)).concat(o),fe={};for(let De of ue)if(Object.hasOwn(R,De))Ft(fe,De,R[De]);return fe}return R});if(i)return y;let k=(S,I,D)=>{let R=a[I];return qr(qs(D),(M)=>{let me=Bx(S,R,M);if(me)return me;let Ee=()=>ur(S.out),Ue=JT(S,a.slice(I+1));return Ue?Kt(Ue,Ee):Ee()})};return(S,I)=>{if(S===ye)return Vr;if(I.errors==="all"||I.onExcessProperty!==void 0||I.propertyOrder==="original"||I.concurrency!==void 0)return y(S,I);if(!(typeof S==="object"&&S!==null&&!Array.isArray(S)))return Te(new Yt(n,S,I));let D=m(),R=S,M={},me={ast:n,input:R,out:M,issues:void 0,options:I};try{for(let Ee=0;Ee<D.length;Ee++){let Ue=D[Ee],$e=Ue.name,rt=Object.hasOwn(R,$e),ue=rt?R[$e]:ye,fe=Ue.parser(ue,I);if(!Ye(fe))return k(me,Ee,fe);if(fe===ot){if(rt)Ft(M,$e,ue);continue}let De=Bx(me,Ue,fe);if(De)return De}}catch(Ee){return vT(Ee)}return ur(M)}}_rebuild(e,t,n,o){let r=si(this.propertySignatures,(s)=>{let a=e(s.type);return a===s.type?s:new Wu(s.name,a)}),i=si(this.indexSignatures,(s)=>{let a=t(s.parameter),l=e(s.type);return a===s.parameter&&l===s.type?s:new Kx(a,l)});return r===this.propertySignatures&&i===this.indexSignatures&&n===this.checks&&o===this.encodingChecks?this:new ca(r,i,this.annotations,n,void 0,this.context,o)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){if(this.propertySignatures.length===0&&this.indexSignatures.length===0)return"object | array";return"object"}}function Bx(e,t,n){if(n._tag==="Failure")return Bu(e,e.ast,t.name,n);if(n===ot)return;let o=n[z];if(o!==ye){Ft(e.out,t.name,o);return}if(delete e.out[t.name],!_r(t.type)){let r=new br([t.name],new Ks(t.type.context?.annotations));if(e.options.errors==="all"){if(e.issues)e.issues.push(r);else e.issues=[r];return}else return Xo(new pt(e.ast,[r],e.input,e.options))}}var JT=Gs()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(ye,e.options);let n=e.input[t.name];return Ft(e.out,t.name,n),t.parser(n,e.options)},step:Bx});function Yx(e,t){if(!e)return t;if(!t)return e;return[...e,...t]}function Hu(e,t,n){return new ca(Reflect.ownKeys(e).map((o)=>new Wu(o,e[o].ast)),[],n,t)}function Ju(e){return e.ast}function Xx(e,t=void 0){return new ai(!1,e.map((n)=>n.ast),[],void 0,t)}function Ku(e,t,n){return new En(e.map(Ju),t,void 0,n)}function pE(e,t){if(e.encoding||t.some((i)=>i.encoding))throw Error("StructWithRest does not support encodings");let{propertySignatures:n,indexSignatures:o,checks:r}=e;for(let i of t)n=n.concat(i.propertySignatures),o=o.concat(i.indexSignatures),r=Yx(r,i.checks);return new ca(n,o,void 0,r)}var Yu=Go((e)=>{while(!0){if(yF(e))return oa;let t=e.encoding;if(!t)return e.recur?.(Yu,_t)??e;if(t.some((n)=>n.transformation._tag==="Middleware"&&n.transformation.decode!==_t))return oa;e=t[t.length-1].to}});function mE(e){switch(e._tag){case"Null":return["null"];case"Undefined":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(mE)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function ii(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[Mu];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap((t)=>{let n=t.type;if(!_r(n)){if(ni(n))return[{key:t.name,literal:n.literal}];if(jx(n))return[{key:t.name,literal:n.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,n)=>{if(!_r(t)){if(ni(t))return[{key:n,literal:t.literal}];if(jx(t))return[{key:n,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map((n)=>ii(Yu(n)));return t[0].filter((n)=>t.every((o)=>o.some((r)=>r.key===n.key&&r.literal===n.literal)))}case"Suspend":return ii(e.thunk())}}var KT=new WeakMap,na=Object.freeze([]);function bF(e){let t=KT.get(e);if(t)return t;let n,o=0,r,i,s=!0;for(let a=0;a<e.length;a++){let l=e[a],c=Yu(l);if(hF(c))continue;if(s)if(ni(c)||jx(c)){i??=new Map;let f=ni(c)?c.literal:c.symbol,h=i.get(f);if(!h)i.set(f,h=[]);h.push(l)}else s=!1;let u=ii(c);if(u.length){n??=new Map,o++;for(let{key:f,literal:h}of u){let m=n.get(f);if(!m)n.set(f,m=[new Map,new Set]);m[1].add(a);let y=m[0].get(h);if(!y)m[0].set(h,y=new Set);y.add(a)}}else{r??={};let f=mE(c);for(let h of f)(r[h]??=[]).push(a)}}if(s&&i)i.forEach(Object.freeze),t=(a)=>i.get(a)??na;else if(n?.size===1&&!r){let[a,[l]]=n.entries().next().value,c=l;for(let[u,f]of l)c.set(u,Object.freeze(Array.from(f,(h)=>e[h])));t=(u,f)=>{if(Ql(u)){let h=Object.hasOwn(u,a)?u[a]:void 0;if(h!==void 0)return c.get(h)??na;if(f)return e}return na}}else if(n){let a;for(let l of n)if((!a||l[1][0].size>a[1][0].size)&&l[1][1].size===o)a=l;t=(l,c)=>{let u=l===null?"null":Array.isArray(l)?"array":typeof l,f=r?.[u]??na;if(!Ql(l))return f.map((y)=>e[y]);let h=new Set(f),m;if(a){let[y,[k]]=a,S=Object.hasOwn(l,y),I=S?l[y]:void 0;if(S&&(!c||I!==void 0)){let D=k.get(I);if(!D)return f.map((R)=>e[R]);for(let R of D)h.add(R);m=y}}if(m===void 0)for(let[y,[k,S]]of n){let I=Object.hasOwn(l,y),D=I?l[y]:void 0;if(I&&(!c||D!==void 0)){let R=k.get(D);if(R)for(let M of R)h.add(M)}else if(c)for(let R of S)h.add(R)}for(let[y,[k,S]]of n){if(y===m)continue;let I=Object.hasOwn(l,y),D=I?l[y]:void 0;if(I&&(!c||D!==void 0)){let R=k.get(D);for(let M of h)if(S.has(M)&&!R?.has(M))h.delete(M)}}return Array.from(h).sort((y,k)=>y-k).map((y)=>e[y])}}else t=(a)=>{let l=a===null?"null":Array.isArray(a)?"array":typeof a;return(r?.[l]??na).map((c)=>e[c]).filter(_F(a))};return KT.set(e,t),t}function _F(e){return(t)=>{let n=Yu(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function Xu(e,t,n=!1){return bF(t)(e,n)}class En extends Ot{_tag="Union";types;mode;encodingChecks;constructor(e,t,n,o,r,i,s){super(n,o,r,i);this.types=e,this.mode=t,this.encodingChecks=s}getParser(e,t){let n=this;return(o,r)=>{if(o===ye)return Vr;let i=Xu(o,n.types,t!==void 0);if(i.length===1){let c=e(i[0])(o,r);if(c._tag==="Success")return c;return Ye(c)?YT(n,c.cause,o,r):Vs(c,(u)=>YT(n,u,o,r))}let s={ast:n,compile:e,input:o,out:void 0,successes:n.mode==="oneOf"?[]:void 0,issues:void 0,options:r},a=Jx(r?.concurrency),l=kF(s,i,a?{...a,orderedStep:!0}:void 0);if(!l){if(s.out)return s.out;return Te(new Ys(n,s.issues??[],o,r))}return Kt(l,(c)=>{if(s.out===ot)return Me(o);if(s.out)return s.out;return Te(new Ys(n,s.issues??[],o,r))})}}_rebuild(e,t,n){let o=si(this.types,e);return o===this.types&&t===this.checks&&n===this.encodingChecks?this:new En(o,this.mode,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let o=n.matchPart(e,t);if(o!==void 0)return o}return}getExpected(e){let t=this.annotations?.expected;if(typeof t==="string")return t;if(this.types.length===0)return"never";let n=this.types.map((o)=>{let r=ua(o);switch(r._tag){case"Arrays":{let i=r.elements.filter(ni);if(i.length>0)return`${XT(r.isMutable)}[ ${i.map((s)=>e(s)+QT(s.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let i=r.propertySignatures.filter((s)=>ni(s.type));if(i.length>0)return`{ ${i.map((s)=>`${XT(s.type.context?.isMutable)}${Os(s.name)}${QT(s.type.context?.isOptional)}: ${e(s.type)}`).join(", ")}, ... }`;break}}return e(r)});return Array.from(new Set(n)).join(" | ")}}function YT(e,t,n,o){let r=Xs(t);if(!r)return yx(t);return Xo(new Ys(e,[r],n,o))}var kF=Gs()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag==="Failure"){let o=Xs(n.cause);if(o===void 0)return n;if(e.issues)e.issues.push(o);else e.issues=[o]}else{if(e.out&&e.successes)return e.successes.push(t),Xo(new Nx(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return Qo}}}),fE=new En([new ao("Infinity"),new ao("-Infinity"),new ao("NaN")],"anyOf");function XT(e){return e?"":"readonly "}function QT(e){return e?"?":""}function Qu(e){let t=!1,n;return()=>{if(t)return n;return n=e(),t=!0,n}}class ed extends Ot{_tag="Suspend";thunk;constructor(e,t,n,o,r){if(n)throw Error("Cannot add checks to Suspend");super(t,void 0,o,r);this.thunk=Qu(e)}getParser(e){let t;return(n,o)=>(t??=e(this.thunk()))(n,o)}recur(e){return new ed(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}}class qu extends Vn{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,n=!1){super();this.run=e,this.annotations=t,this.aborted=n}annotate(e){return new qu(this.run,{...this.annotations,...e},this.aborted)}abort(){return new qu(this.run,this.annotations,!0)}and(e,t){return new sa([this,e],t)}}class sa extends Vn{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super();this.checks=e,this.annotations=t}annotate(e){return new sa(this.checks,{...this.annotations,...e})}and(e,t){return new sa([this,e],t)}}function td(e,t,n=!1){return new qu((o,r,i)=>AT(r,e(o,r,i),o,i),t,n)}function hE(e){return td((t)=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var Qx=lo(Hx,[hE()]),wF=new yt(new En([Qx,fE],"anyOf"),new mt(ju(),it((e)=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function ev(e,t){let n=e.source,o=new globalThis.RegExp(n,e.flags);return td((r)=>(o.lastIndex=0,o.test(r)),{expected:`a string matching the RegExp ${n}`,representation:{id:"effect/schema/isPattern",payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function la(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}var gE=new WeakMap;function IF(e){return gE.get(e)??e}function Zt(e,t){if(e.encoding===t)return e;return la(e,(n)=>{n.encoding.value=t})}function tv(e,t){if(e.context===t)return e;let n=IF(e);if(n.context===t)return n;let o=la(e,(r)=>{r.context.value=t});return gE.set(o,n),o}function ci(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return yE(e,Qy(e.checks.slice(0,-1),n.annotate(t)))}return la(e,(n)=>{n.annotations.value={...n.annotations.value,...t}})}function yE(e,t){if(e._tag==="Suspend"&&t)throw Error("Cannot add checks to Suspend");if(e.checks===t)return e;return la(e,(n)=>{n.checks.value=t})}function lo(e,t){return yE(e,Yx(e.checks,t))}function xE(e,t){let n=t(e.to);return n===e.to?e:new yt(n,e.transformation)}function vE(e,t){let n=e,o=n[n.length-1],r=xE(o,t);return r===o?e:Qy(e.slice(0,e.length-1),r)}function TF(e){return(t)=>t.encoding?Zt(t,vE(t.encoding,e)):t}function SE(e,t){function n(o){if(o.encoding){let r=o.encoding[o.encoding.length-1];return t?.stopAt?.(r)?o:Zt(o,vE(o.encoding,n))}return e(o)}return Go(n)}function EF(e,t,n){let o=new yt(e,t);return Zt(n,n.encoding?[...n.encoding,o]:[o])}function bE(e,t){let n=CT(e),o=n?[...n,t]:[t];return ci(e,{brands:o})}function si(e,t){let n=!1,o=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r],s=t(i);if(s!==i)n=!0;o[r]=s}return n?o:e}function rd(e,t){let n=e.context?new In(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new In(!1,!1,void 0,t);return tv(e,n)}var nd=Go((e)=>{let t=e.context?e.context.isOptional===!1?new In(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new In(!0,!1);return $F(tv(e,t))}),$F=TF(nd),_E=Lr((e)=>nd(new En([e,Wx],"anyOf")));function kE(e,t){let n=new mt(zx(t),Wr()),o=new yt(oa,n),r=e.context?new In(e.context.isOptional,e.context.isMutable,o,e.context.annotations):new In(!1,!1,o);return tv(e,r)}function wE(e,t,n){return EF(e,n,t)}function OF(e){let t=[],n=[];function o(r){switch(r._tag){case"Literal":if(Xl(r.literal))t.push(r.literal);return;case"UniqueSymbol":t.push(r.symbol);return;case"Never":return;case"Union":for(let i=0;i<r.types.length;i++)o(r.types[i]);return;default:n.push(r)}}return o(e),{literals:t,parameters:n}}function IE(e,t){let{literals:n,parameters:o}=OF(e);return new ca(n.map((r)=>new Wu(r,t)),o.map((r)=>new Kx(r,t)))}function _r(e){return e.context?.isOptional??!1}function TE(e){return e.annotations?.[Au]===!0||e._tag==="FilterGroup"&&e.checks.every(TE)}function DF(e){function t(o){if(TE(o))return[o];return o._tag==="FilterGroup"?o.checks.flatMap(t):[]}let n=e.flatMap(t);return ex(n)?n:void 0}var kr=Go((e)=>{if(e.encoding)return kr(Zt(e,void 0));let t=e,n=t.recur?.(kr)??t,o=n.encodingChecks;if(o){let r=n===e?o:eE(n)||gF(n)||aa(n)&&n.typeParameters.length>0?DF(o):void 0;return la(n,(i)=>{i.encodingChecks.value=void 0,i.checks.value=Yx(n.checks,r)})}return n}),ua=Go((e)=>kr(wn(e)));function PF(e,t){let n=t,o=n.length,r=n[o-1],i=[new yt(wn(Zt(e,void 0)),n[0].transformation.flip())];for(let a=1;a<o;a++)i.unshift(new yt(wn(n[a-1].to),n[a].transformation.flip()));let s=wn(r.to);if(s.encoding)return Zt(s,[...s.encoding,...i]);else return Zt(s,i)}var wn=Lr((e)=>{if(e.encoding)return PF(e,e.encoding);let t=e;return t.flip?.(wn)??t.recur?.(wn)??t});function EE(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(EE);default:return!1}}function rv(e,t){let n=ur(t);return(o,r)=>{if(o===ye)return Vr;if(o===t)return n;return Te(new Yt(e,o,r))}}function li(e,t){return(n,o)=>{if(n===ye)return Vr;if(t(n))return ot;return Te(new Yt(e,n,o))}}var nv=SE((e)=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(nv)}});var qx=new globalThis.RegExp(`^${dE}$`),CF=new globalThis.RegExp(`^(?:${dE}|Infinity|-Infinity|NaN)$`);function $E(e){return ev(qx,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:qx.source}),...e})}var OE=lo(ia,[$E()]),RF=new yt(OE,Zu),AF=new yt(new En([OE,fE],"anyOf"),Zu),MF="-?\\d+",i9=new globalThis.RegExp(`^${MF}$`);var UF="Symbol\\((.*)\\)",s9=new globalThis.RegExp(`^${UF}$`);function $n(e,t,n,o,r){for(let i=0;i<e.length;i++){let s=e[i];if(s._tag==="FilterGroup"){if(n=$n(s.checks,t,n,o,r),n&&(r.errors!=="all"||n[n.length-1].filter.aborted))return n}else{let a=s.run(t,o,r);if(a){let l=new Mx(s,a,t,r);if(n)n.push(l);else n=[l];if(r.errors!=="all"||s.aborted)return n}}}return n}function DE(e){if(!aa(e))return;let t=e.annotations?.[Uu];return Zo(t)?t(e.typeParameters):void 0}function NF(e){return e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&globalThis.Number.isFinite(e)}function FF(e){return e===void 0||typeof e==="string"}function PE(e,t){let n=new WeakMap,o=[];e:while(!0){if(typeof e!=="object"||e===null){if(!t(e))return!1}else{let r=e,i=n.get(r);if(i===!1)return!1;if(i===void 0){let s=Array.isArray(r);if(!s){let a=Object.getPrototypeOf(r);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}n.set(r,!1),o.push({value:r,keys:s?r.length:Object.keys(r),index:0})}}while(o.length>0){let r=o[o.length-1],i=r.keys;if(typeof i==="number"){if(r.index<i){e=r.value[r.index++];continue e}}else if(r.index<i.length){e=r.value[i[r.index++]];continue e}n.set(r.value,!0),o.pop()}return!0}}function zF(e){return PE(e,NF)}var CE=new co([],()=>(e,t,n)=>zF(e)?ot:Te(new Yt(t,e,n)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{return},toCodecStringTree:()=>RE,toArbitrary:()=>(e)=>e.jsonValue()});function LF(e){return PE(e,FF)}var jF=new co([],()=>(e,t,n)=>LF(e)?ot:Te(new Yt(t,e,n)),{expected:"StringTree",toCodecStringTree:()=>{return}}),RE=new yt(jF,Gu());function id(e){let t=NE(cd,kr(e.ast));return(n,o)=>t(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function sd(e){let t=id(e);return(n,o)=>{let r=Ws(t(n,o));if(Ou(r))return Lt(r.value);return zu(r.cause,"Option adapter can only return none for schema issues"),cr()}}function ME(e){let t=id(e);return(n,o)=>{let r=Ws(t(n,o));if(Ou(r))return r.value;let i=zu(r.cause,"Constructor adapter can only throw schema issues");throw Error("Schema validation failed",{cause:i})}}function UE(e){return ad(e.ast)}function ad(e){let t=BF(ZF(kr(e)));return(n)=>{let o=t(n,Vu);if(Ou(o))return!0;return zu(o.cause,"Type guard adapter can only return false for schema issues"),!1}}var ov=(e,t)=>t?{...e,...t}:e,AE=(e)=>{if(e===ye)return Te(new gt);return Me(e)};function ZF(e){return NE(FE,e)}function NE(e,t){let n;return(o,r)=>{let i=(n??=e(t))(o,r??Vu);if(i===ot)return Me(o);if(!Ye(i))return Kt(i,AE);return i[z]===ye?AE(ye):i}}function BF(e){return(t,n)=>Ws(e(t,n))}var FE=Lr((e)=>iv(e,FE)),cd=Lr((e)=>iv(e,cd,zE)),qF=Lr((e)=>iv(e,cd,zE,e.context?.constructorDefault));function zE(e){return e.context?.constructorDefault?qF(e):cd(e)}function LE(e,t,n,o){let r;if(Ye(e)&&e._tag==="Success"){let i=Nu(e===ot?t:e[z]);r=n._tag==="Transformation"?n.decode.run(i,o):n.decode(ur(i),o)}else if(n._tag==="Transformation")r=Kt(e,(i)=>n.decode.run(Nu(i),o));else r=n.decode(ei(e,Nu),o);return Ye(r)&&r._tag==="Success"?Px(r[z]):Kt(r,Px)}function VF(e,t){let n;return(o,r)=>{if(o===ye)return Vr;if(e.isConstructed(o))return ot;let i=(n??=t(e.link.to))(o,r);return LE(i,o,e.link.transformation,r)}}function iv(e,t,n,o){let r=n?DE(e):void 0,i=r?VF(r,t):e.getParser(t,n),s=e.checks,a=o?e.encoding?[...e.encoding,o]:[o]:e.encoding,l=e.encodingChecks,c=(s?s[s.length-1].annotations:e.annotations)?.parseOptions;if(!a&&!s&&!l){if(!c)return i;return(h,m)=>i(h,ov(m,c))}let u,f=(h,m)=>{let y=i(h,m);if(l&&!m.disableChecks)if(Ye(y)){if(y._tag==="Success"){let k=y===ot?h:y[z];if(h!==ye&&k!==ye){let S=$n(l,h,void 0,e,m);if(S)y=Te(new pt(e,S,h,m))}}}else y=qr(y,(k)=>{if(h!==ye&&k!==ye){let S=$n(l,h,void 0,e,m);if(S)return Te(new pt(e,S,h,m))}return Me(k)});if(s&&!m.disableChecks)if(Ye(y)){if(y._tag==="Success"){let k=y===ot?h:y[z];if(k===ye)return y;let S=$n(s,k,void 0,e,m);if(S)y=Te(new pt(e,S,k,m))}}else y=qr(y,(k)=>{if(k!==ye){let S=$n(s,k,void 0,e,m);if(S)return Te(new pt(e,S,k,m))}return Me(k)});return y};if(!a)return c?(h,m)=>f(h,ov(m,c)):f;return(h,m)=>{if(c)m=ov(m,c);let y=u??=a.map((I)=>t(I.to)),k=h,S=y[y.length-1](h,m);for(let I=a.length-1;I>=0;I--)if(S=LE(S,k,a[I].transformation,m),I!==0){let D=y[I-1];if(S._tag==="Success")k=S[z],S=D(k,m);else S=Kt(S,(R)=>{let M=D(R,m);return M===ot?ur(R):M})}if(S._tag==="Success"){let I=S[z],D=f(I,m);return D===ot?S:D}return S=Vs(S,(I)=>Tx(()=>Du(I,(D)=>new Ux(e,D,h,m)))),Kt(S,(I)=>{let D=f(I,m);return D===ot?ur(I):D})}}var ld="~effect/Schema/Schema";var WF={[ld]:ld,pipe(){return ht(this,arguments)},annotate(e){return this.rebuild(ci(this.ast,e))},annotateKey(e){return this.rebuild(rd(this.ast,e))},check(...e){return this.rebuild(lo(this.ast,e))}};function av(e,t){function n(){}let o=Object.defineProperties(Object.setPrototypeOf(n,WF),Object.getOwnPropertyDescriptors({...t}));return o.ast=e,o.rebuild=(r)=>av(r,t),o.makeEffect=id(o),o.make=ME(o),o.makeOption=sd(o),o}var jE=H(2,(e,t)=>JF(e,(n,o)=>!t.includes(n)?[n,o]:void 0));var Hr=(e)=>e;function JF(e,t){let n={};for(let o of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,o))continue;let r=t(o,e[o]);if(r){let[i,s]=r;Ft(n,i,s)}}return n}var GE=Lr((e)=>On(e,[]));function On(e,t){let n=Hs(e)?.toEquivalence;if(n)return n(aa(e)?e.typeParameters.map((o)=>On(o,t)):[]);switch(e._tag){case"Never":return Cw();case"Declaration":case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return ze;case"Arrays":{let o=e.elements.map((s,a)=>On(s,[...t,a])),r=e.elements.length,i=e.rest.map((s,a)=>On(s,[...t,r+a]));return eo((s,a)=>{if(!Array.isArray(s)||!Array.isArray(a))return!1;let l=s.length;if(l!==a.length)return!1;let c=0;for(;c<Math.min(l,e.elements.length);c++)if(!o[c](s[c],a[c]))return!1;if(i.length>0){let[u,...f]=i;for(;c<l-f.length;c++)if(!u(s[c],a[c]))return!1;for(let h=0;h<f.length;h++)if(!f[h](s[c+h],a[c+h]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return ze;let o=e.propertySignatures.map((i)=>On(i.type,[...t,i.name])),r=e.indexSignatures.map((i)=>On(i.type,t));return eo((i,s)=>{if(!Bo(i)||!Bo(s))return!1;for(let a=0;a<o.length;a++){let l=e.propertySignatures[a],c=l.name,u=Object.hasOwn(i,c),f=Object.hasOwn(s,c);if(_r(l.type)){if(u!==f)return!1}if(u&&f&&!o[a](i[c],s[c]))return!1}for(let a=0;a<r.length;a++){let l=e.indexSignatures[a],c=oi(i,l.parameter),u=oi(s,l.parameter);if(c.length!==u.length)return!1;for(let f=0;f<c.length;f++){let h=c[f];if(!Object.hasOwn(s,h)||!r[a](i[h],s[h]))return!1}}return!0})}case"Union":{let o=kr(e).types,r=new Map(o.map((i,s)=>[i,[ad(i),On(e.types[s],t)]]));return eo((i,s)=>{let a=Xu(i,o);for(let l=0;l<a.length;l++){let[c,u]=r.get(a[l]);if(c(i)&&c(s))return u(i,s)}return!1})}case"Suspend":{let o=Qu(()=>On(e.thunk(),t));return eo((r,i)=>o()(r,i))}}}var p9=globalThis.RegExp;var ZE=(e)=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var da=ld;function XF(){return(e,t,n)=>_e(new co(e.map(Ju),(o)=>t(o.map((r)=>_e(r))),n))}function VE(e,t){return XF()([],()=>(n,o,r)=>e(n)?Me(n):Te(new Yt(o,n,r)),t)}function Jr(e){return(t)=>t.annotate(e)}var QF=UE;var _e=av;function WE(e){return ge(e,da)&&e[da]===da}var ez=Hr((e)=>_e(nd(e.ast),{schema:e}));var ud=Hr((e)=>{let t=iz(e);return _e(_E(e.ast),{schema:t})});var ui=Hr((e)=>_e(kr(e.ast),{schema:e})),tz=Hr((e)=>_e(ua(e.ast),{schema:e}));function F(e){let t=_e(new ao(e),{literal:e,transform(n){return t.pipe(wr(F(n),{decode:it(()=>n),encode:it(()=>e)}))}});return t}var uo=_e(iE),ct=_e(oa),rz=_e(Vx),nz=_e(Wx),d=_e(ia),Bt=_e(Hx),be=_e(uE);function uv(e,t){return _e(e,{fields:t,mapFields(n,o){let r=n(this.fields);return uv(Hu(r,o?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function g(e){return uv(Hu(e,void 0),e)}function J(e,t){return _e(IE(e.ast,t.ast),{key:e,value:t})}function HE(e,t){return _e(pE(e.ast,t.map(Ju)),{schema:e,records:t})}function JE(e,t){return _e(e,{elements:t,mapElements(n,o){let r=n(this.elements);return JE(Xx(r,o?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function oz(e){return JE(Xx(e),e)}var Y=Hr((e)=>_e(new ai(!1,[],[e.ast]),{value:e}));var ma=Hr((e)=>_e(new ai(!1,[e.ast],[e.ast]),{value:e}));function KE(e,t){return _e(e,{members:t,mapMembers(n,o){let r=n(this.members);return KE(Ku(r,this.ast.mode,o?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function ie(e,t){return KE(Ku(e,t?.mode??"anyOf",void 0),e)}function ce(e){let t=e.map(F);return _e(Ku(t,"anyOf",void 0),{literals:e,members:t,mapMembers(n){return ie(n(this.members))},pick(n){return ce(n)},transform(n){return ie(t.map((o,r)=>o.transform(n[r])))}})}var dv=Hr((e)=>ie([e,rz])),iz=Hr((e)=>ie([e,nz]));function sz(e){return _e(new ed(()=>e().ast))}function YE(...e){return(t)=>t.check(...e)}function xe(e){return(t)=>_e(bE(t.ast,e),{schema:t,identifier:e})}function wr(e,t){return(n)=>_e(wE(n.ast,e.ast,t?Lx(t):Gu()),{from:n,to:e})}function XE(e){return(t)=>_e(kE(t.ast,e),{schema:t})}function ae(e){return F(e).pipe(XE(Me(e)))}function az(e,t){return g({_tag:ae(e),...t})}function Be(e){return(t)=>{let n={},o=[],r=new Set,i={},s=(u)=>(f)=>u.includes(f[e]);return a(t),Object.assign(t,{cases:n,discriminants:o,isAnyOf:s,guards:i,match:l,matchOrElse:c});function a(u){let f=u.ast;if(tE(f)&&"members"in u&&globalThis.Array.isArray(u.members)&&u.members.every(WE))return u.members.forEach(a);let h=ii(f);if(h.length>0){let m=h.find((y)=>y.key===e)?.literal;if(Xl(m)){let y=typeof m==="number"?globalThis.String(m):m;if(r.has(y))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);r.add(y),o.push(m),Ft(n,m,u),Ft(i,m,QF(ui(u)));return}}throw new globalThis.Error("No literal or unique symbol found")}function l(){if(arguments.length===1){let y=arguments[0];return function(k){let S=k[e];return(Object.hasOwn(y,S)?y[S]:void 0)(k)}}let u=arguments[0],f=arguments[1],h=u[e];return(Object.hasOwn(f,h)?f[h]:void 0)(u)}function c(){if(arguments.length===2){let k=arguments[0],S=arguments[1];return function(I){let D=I[e];return(Object.hasOwn(k,D)?k[D]??S:S)(I)}}let u=arguments[0],f=arguments[1],h=arguments[2],m=u[e];return(Object.hasOwn(f,m)?f[m]??h:h)(u)}}}function di(e,t){return VE((n)=>n instanceof e,t)}function po(){return(e,t)=>new yt(e.ast,Lx(t))}var Dn=td;var BE="^\\S[\\s\\S]*\\S$|^\\S$|^$";function cz(e){let t=new globalThis.RegExp(BE);return Dn((n)=>n.trim()===n,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitrary:{constraint:{patterns:[BE]}},...e})}function pi(e,t){let{source:n,flags:o}=e,r=o===""?`new RegExp(${re(n)})`:`new RegExp(${re(n)}, ${re(o)})`;return ev(e,{toCode:()=>({runtime:`Schema.isPattern(${r})`}),...t})}function lz(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return pi(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function Pn(e,t){let n=JSON.stringify(e),o=new globalThis.RegExp(`^${ZE(e)}`);return Dn((r)=>r.startsWith(e),{expected:`a string starting with ${n}`,representation:{id:"effect/schema/isStartsWith",payload:{startsWith:e}},toJsonSchema:()=>({pattern:o.source}),toCode:()=>({runtime:`Schema.isStartsWith(${re(e)})`}),arbitrary:{constraint:{patterns:[o.source]}},...t})}var Re=_e(Qx);function uz(e){let t=uu(e.order),n=e.formatter??re;return(o,r)=>Dn((i)=>t(i,o),{expected:`a value greater than ${n(o)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:o,exclusiveMinimum:!0}}},...e.annotate?.(o),...r})}function dz(e){let t=pu(e.order),n=e.formatter??re;return(o,r)=>Dn((i)=>t(i,o),{expected:`a value greater than or equal to ${n(o)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:o}}},...e.annotate?.(o),...r})}function pz(e){let t=du(e.order),n=e.formatter??re;return(o,r)=>Dn((i)=>t(i,o),{expected:`a value less than or equal to ${n(o)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:o}}},...e.annotate?.(o),...r})}function mz(e){let t=pu(e.order),n=uu(e.order),o=du(e.order),r=Ly(e.order),i=e.formatter??re;return(s,a)=>{let l=s.exclusiveMinimum?n:t,c=s.exclusiveMaximum?r:o;return Dn((u)=>l(u,s.minimum)&&c(u,s.maximum),{expected:`a value between ${i(s.minimum)}${s.exclusiveMinimum?" (excluded)":""} and ${i(s.maximum)}${s.exclusiveMaximum?" (excluded)":""}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:s.minimum,maximum:s.maximum,...s.exclusiveMinimum&&{exclusiveMinimum:!0},...s.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(s),...a})}}function pa(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${re(e)}`);return e}var fz=uz({order:Fs,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:pa(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${re(e)})`})})});var pv=dz({order:Fs,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:pa(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${re(e)})`})})});var hz=pz({order:Fs,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:pa(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${re(e)})`})})});var QE=mz({order:Fs,annotate:(e)=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:pa(e.minimum),maximum:pa(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${re(e.minimum)}, maximum: ${re(e.maximum)}, exclusiveMinimum: ${re(t)}, exclusiveMaximum: ${re(n)} })`})}}});function gz(e){return Dn((t)=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...e})}var qt=Bt.check(gz());function yz(e,t){return e=Math.max(0,Math.floor(e)),Dn((n)=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="array"?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Au]:!0,arbitrary:{constraint:{minLength:e}},...t})}function e$(e){return yz(1,e)}var xz=(e)=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),vz=(e)=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}};var qE=[];function Sz(e){let t=xz(e),n=qE[t];if(n!==void 0)return n;let o=Ir.pipe(wr(ct,ZT(vz(t))));return qE[t]=o,o}var K8=di(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>po()(g({source:d,flags:d}),ri({decode:(e,t)=>Ex({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new gt({expected:"valid RegExp source and flags"},e,t)}),encode:(e)=>Me({source:e.source,flags:e.flags})})),toArbitrary:()=>(e)=>e.tuple(e.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),e.uniqueArray(e.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map((t)=>t.join(""))).map(([t,n])=>new globalThis.RegExp(t,n)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags});var bz=d.annotate({expected:"a string that will be decoded as a URL"}),Y8=di(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>po()(bz,BT),toArbitrary:()=>(e)=>e.webUrl().map((t)=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()});function _z(e,t,n){let o={...t};if(e?.minimum!==void 0){let r=n===void 0?e.minimum:n(e.minimum),i=e.exclusiveMinimum?new globalThis.Date(r.getTime()+1):r;if(o.min===void 0||i.getTime()>o.min.getTime())o.min=i}if(e?.maximum!==void 0){let r=n===void 0?e.maximum:n(e.maximum),i=e.exclusiveMaximum?new globalThis.Date(r.getTime()-1):r;if(o.max===void 0||i.getTime()<o.max.getTime())o.max=i}return o}var kz=di(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>po()(g({data:d.check(lz()),type:d,name:d,lastModified:qt}),ri({decode:(e,t)=>xu(Iu(e.data),{onFailure:()=>Te(new gt({expected:"a valid Base64 string"},e.data,t)),onSuccess:(n)=>{let o=new globalThis.Uint8Array(n);return Me(new globalThis.File([o],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>xT({try:async()=>{let n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:wu(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new gt({expected:"a readable File"},e,t)})}))});var X8=di(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>po()(Y(oz([d,ie([g({_tag:ae("String"),value:d}),g({_tag:ae("File"),value:kz})])])),ri({decode:(e)=>{let t=new globalThis.FormData;for(let[n,o]of e)t.append(n,o.value);return Me(t)},encode:(e)=>Me(globalThis.Array.from(e.entries()).map(([t,n])=>{if(typeof n==="string")return[t,{_tag:"String",value:n}];else return[t,{_tag:"File",value:n}]}))}))});var Q8=di(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>po()(d.annotate({expected:"a query string that will be decoded as URLSearchParams"}),so({decode:(e)=>new globalThis.URLSearchParams(e),encode:(e)=>e.toString()}))});var wz=d.check(cz()),t$=d.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(wr(wz,jT()));var Iz=d.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),Tz=di(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>po()(Iz,qT),toArbitrary:()=>(e)=>e.uint8Array()});var Ez=VE((e)=>bT(e)&&_T(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecJson:()=>po()(d,VT),toArbitrary:()=>(e,t)=>e.date(_z(t?.constraint?.ordered?.order===wT?t.constraint.ordered:void 0,{noInvalidDate:!0},$T)).map((n)=>IT(n)),toFormatter:()=>(e)=>e.toString(),toEquivalence:()=>kT});var $z=globalThis.Symbol.for("immer-draftable"),lv={};function mv(e,t,n,o,r){let i=Dz(n,t,o),s=r$(t),a=class extends e{constructor(...[l,c]){let f=c?.["~payload"],h=f?.token===lv?f.value:n.make(l??{},c);super(h,{...c,disableChecks:!0,"~payload":{token:lv,value:h}})}static[da]=da;get[s](){return s}static[$z]=!0;static identifier=t;static fields=n.fields;static get ast(){return i(this).ast}static pipe(){return ht(this,arguments)}static rebuild(l){return i(this).rebuild(l)}static make(l,c){return new this(l,c)}static makeOption(l,c){return sd(i(this))(l??{},c)}static makeEffect(l,c){return i(this).makeEffect(l??{},c)}static annotate(l){return this.rebuild(ci(this.ast,l))}static annotateKey(l){return this.rebuild(rd(this.ast,l))}static check(...l){return this.rebuild(lo(this.ast,l))}static extend(l){return(c,u)=>{let f=dd(c)?c:g(c),h={...n.fields,...f.fields},m=Hu(h,n.ast.checks,{identifier:l});return mv(this,l,uv(lo(m,f.ast.checks),h),u,r)}}static mapFields(l,c){return n.mapFields(l,c)}};if(r!==void 0)Object.assign(a.prototype,r(t));return a}function Oz(e){return new mt(it((t)=>new e(t,{"~payload":{token:lv,value:t}})),Wr())}function r$(e){return`~effect/Schema/Class/${e}`}function Dz(e,t,n){let o;return(r)=>{if(o!==void 0)return o;let i=r$(t),s=(c)=>c instanceof r||ge(c,i),a=Oz(r),l=_e(new co([e.ast],()=>(c,u,f)=>s(c)?Me(c):Te(new Yt(u,c,f)),{identifier:t,[Uu]:([c])=>({isConstructed:s,link:new yt(c,a)}),toCodec:([c])=>new yt(c.ast,a),toArbitrary:([c])=>()=>({arbitrary:c.arbitrary.map((u)=>new r(u)),terminal:c.terminal?.map((u)=>new r(u))}),toFormatter:([c])=>(u)=>`${r.identifier}(${c(u)})`,[Mu]:ii(e.ast),...n}));return o=wr(l,a)(e)}}function dd(e){return WE(e)}var mo=(e)=>(t,n)=>{let o=dd(t)?t:g(t);return mv(cI,e,o,n,(r)=>({toString(){return`${r}(${re({...this})})`}}))};var Pz=(e)=>(t,n)=>{let o=dd(t)?t:g(t);return mv(cu,e,o,n,(i)=>({name:i}))},fv=(e)=>(t,n,o)=>{let r=dd(n)?n.mapFields((i)=>({_tag:ae(t),...i}),{unsafePreserveChecks:!0}):az(t,n);return Pz(e??t)(r,o)};function Cz(e){return GE(e.ast)}var Ir=_e(ci(CE,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})}));var qe=qt.check(fz(0)),q=qt.check(pv(0)),Xt=d.pipe(xe("RelativePath")),Le=d.pipe(xe("AbsolutePath")),p=(e)=>ez(e).pipe(wr(ud(ui(e)),{decode:Wr({strict:!1}),encode:Fx(fu((t)=>t!==void 0))})),Q=(e)=>(t)=>Object.assign(t,e(t)),Xe=Re.pipe(wr(Ez,{decode:it((e)=>KN(e)),encode:it((e)=>OT(e))}));var n$=0,hv=0;function lt(){return i$(!1)}function o$(){return i$(!0)}function i$(e,t=Date.now()){if(t!==n$)n$=t,hv=0;hv++;let n=BigInt(t)*0x1000n+BigInt(hv),o=e?~n:n,r=Array.from({length:6},(s,a)=>Number(o>>BigInt(40-8*a)&0xffn).toString(16).padStart(2,"0")).join(""),i=crypto.getRandomValues(new Uint8Array(14));return r+Array.from(i,(s)=>"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[s%62]).join("")}var pd=d.pipe(xe("Project.ID"),Q((e)=>({global:e.make("global")})));var gv=d.check(Pn("wrk")).pipe(xe("Workspace.ID"),Q((e)=>{let t=()=>e.make("wrk_"+lt());return{ascending:(n)=>{if(!n)return t();if(!n.startsWith("wrk"))throw Error(`ID ${n} does not start with wrk`);return e.make(n)},create:t}}));var Cn=g({directory:Le,workspaceID:p(gv)}).annotate({identifier:"Location.Ref"}),B7=g(jE(Cn.fields,["workspaceID"])).annotate({identifier:"Location.PublicRef"});class s$ extends mo("Location.Info")({directory:Le,workspaceID:p(gv),project:g({id:pd,directory:Le,canonical:Le})}){}var q7=g(jE(s$.fields,["workspaceID"])).annotate({identifier:"Location.PublicInfo"});var c$=d.check(Pn("evt_")).pipe(xe("Event.ID"),Q((e)=>({create:()=>e.make("evt_"+lt())}))),Az=qt.check(pv(0)).pipe(xe("Event.Seq")),yv=qt.check(pv(1)).pipe(xe("Event.Version")),a$=g({aggregateID:d,seq:Az,version:yv});function j(e){let t=g(e.schema),n=g({aggregateID:a$.fields.aggregateID,seq:a$.fields.seq,version:F(e.durable.version).pipe(wr(ui(yv),so({decode:()=>yv.make(e.durable.version),encode:()=>e.durable.version})))});return g({id:c$,created:Re,metadata:p(J(d,ct)),type:F(e.type),durable:n,location:p(Cn),data:t}).annotate({identifier:e.identifier??e.type}).pipe(Q(()=>({type:e.type,durability:"durable",durable:e.durable,data:t})))}function L(e){let t=g(e.schema);return g({id:c$,created:Re,metadata:p(J(d,ct)),type:F(e.type),location:p(Cn),data:t}).annotate({identifier:e.identifier??e.type}).pipe(Q(()=>({type:e.type,durability:"ephemeral",durable:void 0,data:t})))}function le(...e){return Object.freeze(e)}var mi=d.pipe(xe("Integration.ID")),md=d.pipe(xe("Integration.MethodID"));var Mz=d.check(Pn("frm_")).pipe(xe("Form.ID")),vv=Mz.pipe(Q((e)=>({create:(t)=>e.make(t??"frm_"+lt())}))),Uz=J(d,ct).annotate({identifier:"Form.Metadata"}),p$=g({value:d,label:d,description:d.pipe(p)}).annotate({identifier:"Form.Option"}),Nz=g({key:d,op:ce(["eq","neq"]),value:ie([d,Bt,be])}).annotate({identifier:"Form.When"}),fa={key:d,title:d.pipe(p),description:d.pipe(p),required:be.pipe(p),hidden:be.pipe(p).annotate({description:"Skip the interactive authentication prompt and use the default unless an answer is supplied"}),when:Y(Nz).pipe(p)},Fz=g({...fa,type:F("string"),format:ce(["email","uri","date","date-time"]).pipe(p),minLength:q.pipe(p),maxLength:q.pipe(p),pattern:d.pipe(p),placeholder:d.pipe(p),default:d.pipe(p),options:Y(p$).pipe(p),custom:be.pipe(p)}).annotate({identifier:"Form.StringField"}),zz=g({...fa,type:F("number"),minimum:Bt.pipe(p),maximum:Bt.pipe(p),default:Bt.pipe(p)}).annotate({identifier:"Form.NumberField"}),Lz=g({...fa,type:F("integer"),minimum:Bt.pipe(p),maximum:Bt.pipe(p),default:Bt.pipe(p)}).annotate({identifier:"Form.IntegerField"}),jz=g({...fa,type:F("boolean"),default:be.pipe(p)}).annotate({identifier:"Form.BooleanField"}),Gz=g({...fa,type:F("multiselect"),options:Y(p$),minItems:q.pipe(p),maxItems:q.pipe(p),custom:be.pipe(p),default:Y(d).pipe(p)}).annotate({identifier:"Form.MultiselectField"}),Zz=g({key:d,type:F("external"),url:d,title:d.pipe(p),description:d.pipe(p)}).annotate({identifier:"Form.ExternalField"}),Bz=ie([Fz,zz,Lz,jz,Gz,Zz]).pipe(Be("type"),Jr({identifier:"Form.Field"})),Sv=ma(Bz).annotate({identifier:"Form.Fields"}),qz={id:vv,sessionID:d,title:d,metadata:Uz.pipe(p)},m$=g({...qz,fields:Sv}).annotate({identifier:"Form.Info"}),Vz=ie([d,Bt,be,Y(d)]).annotate({identifier:"Form.Value"}),fd=J(d,Vz).annotate({identifier:"Form.Answer"}),Wz=ie([g({status:F("pending")}),g({status:F("answered"),answer:fd}),g({status:F("cancelled")})]).pipe(Be("status")).annotate({identifier:"Form.State"}),nQ=g({...m$.fields,state:Wz}).annotate({identifier:"Form.Detail"}),oQ=g({answer:fd}).annotate({identifier:"Form.Reply"}),l$=L({type:"form.created",schema:{form:m$}}),u$=L({type:"form.replied",schema:{id:vv,sessionID:d,answer:fd}}),d$=L({type:"form.cancelled",schema:{id:vv,sessionID:d}}),iQ={Created:l$,Replied:u$,Cancelled:d$,Definitions:le(l$,u$,d$)};var g$=d.pipe(xe("Credential.ID"),Q((e)=>({create:()=>e.make("cred_"+lt())}))),f$=L({type:"credential.updated",schema:{}}),h$=L({type:"credential.switched",schema:{integrationID:mi,credentialID:dv(g$)}}),mQ={Updated:f$,Switched:h$,Definitions:le(f$,h$)},Hz=g({type:F("oauth"),methodID:md,refresh:d,access:d,expires:q,metadata:p(J(d,ct))}).annotate({identifier:"Credential.OAuth"}),Jz=g({type:F("key"),key:d,metadata:p(J(d,ct)),configuration:p(fd)}).annotate({identifier:"Credential.Key"}),fQ=ie([Hz,Jz]).pipe(Be("type")).annotate({identifier:"Credential.Value"});var Kz=g({type:F("credential"),id:g$,label:d,method:ce(["key","oauth"])}).annotate({identifier:"Connection.CredentialInfo"}),Yz=g({type:F("env"),name:d}).annotate({identifier:"Connection.EnvInfo"}),Xz=ie([Kz,Yz]).pipe(Be("type")).annotate({identifier:"Connection.Info"});var wv=mi,x$=md,Qz=g({id:x$,type:F("oauth"),label:d,form:p(Sv)}).annotate({identifier:"Integration.OAuthMethod"}),eL=g({id:x$,type:F("command"),label:d,command:Y(d)}).annotate({identifier:"Integration.CommandMethod"}),tL=g({type:F("key"),label:p(d),form:p(Sv)}).annotate({identifier:"Integration.KeyMethod"}),rL=g({type:F("env"),names:Y(d)}).annotate({identifier:"Integration.EnvMethod"}),nL=ie([Qz,eL,tL,rL]).pipe(Be("type")).annotate({identifier:"Integration.Method"}),y$=L({type:"integration.updated",schema:{}}),IQ={Updated:y$,Definitions:le(y$)},TQ=g({id:wv,name:d,metadata:p(J(d,uo))}).annotate({identifier:"Integration.Ref"}),EQ=g({id:wv,name:d,metadata:p(J(d,uo)),methods:Y(nL),connections:Y(Xz)}).annotate({identifier:"Integration.Info"}),v$=d.pipe(xe("Integration.AttemptID"),Q((e)=>({create:()=>e.make("con_"+lt())}))),Tr=g({created:Bt,expires:Bt});class oL extends mo("Integration.Attempt")({attemptID:v$,url:d,instructions:d,mode:ce(["auto","code"]),time:Tr}){}var $Q=ie([g({status:F("pending"),time:Tr}),g({status:F("complete"),time:Tr}),g({status:F("failed"),message:d,time:Tr}),g({status:F("expired"),time:Tr})]).pipe(Be("status")).annotate({identifier:"Integration.AttemptStatus"}),OQ=g({attemptID:v$,time:Tr}).annotate({identifier:"Integration.CommandAttempt"}),DQ=ie([g({status:F("pending"),message:p(d),time:Tr}),g({status:F("complete"),time:Tr}),g({status:F("failed"),message:d,time:Tr}),g({status:F("expired"),time:Tr})]).pipe(Be("status")).annotate({identifier:"Integration.CommandAttemptStatus"});var ho=d.pipe(xe("Provider.ID"),Q((e)=>({opencode:e.make("opencode"),anthropic:e.make("anthropic"),openai:e.make("openai"),google:e.make("google"),googleVertex:e.make("google-vertex"),githubCopilot:e.make("github-copilot"),amazonBedrock:e.make("amazon-bedrock"),azure:e.make("azure"),openrouter:e.make("openrouter"),mistral:e.make("mistral"),gitlab:e.make("gitlab")}))),S$=L({type:"provider.updated",schema:{}}),MQ={Updated:S$,Definitions:le(S$)},b$=d,iL=ce(["auto","enabled","disabled"]),_$=ie([g({type:F("summary")}),g({type:F("native")})]).pipe(Be("type")).annotate({identifier:"Provider.Compaction"}),sL=ce(["http","websocket"]).annotate({identifier:"Provider.Transport"}),k$=HE(g({timeout:ie([Re,F(!1)]).pipe(p),chunkTimeout:Re.pipe(p),compaction:_$.pipe(p),transport:sL.pipe(p)}),[J(d,uo)]).annotate({identifier:"Provider.Settings"}),aL={settings:k$.pipe(p),headers:J(d,d).pipe(p),body:J(d,uo).pipe(p)},cL=g({settings:k$.pipe(XE(Me({}))),headers:J(d,d),body:J(d,uo)}).annotate({identifier:"Provider.Request"}),UQ=g({id:ho,canonical:ho.pipe(p),integrationID:wv.pipe(p),name:d,activation:iL,package:b$,...aL}).annotate({identifier:"Provider.Info"}).pipe(Q(()=>({empty:(e)=>({id:e,name:e,activation:"auto",package:""})})));var go=Re.pipe(xe("Money.USD"),Jr({identifier:"Money.USD"}),Q((e)=>({zero:e.make(0)}))),hd=Re.pipe(xe("Money.USDPerMillionTokens"),Jr({identifier:"Money.USDPerMillionTokens"}),Q((e)=>({zero:e.make(0)})));var gd=d.pipe(xe("Model.ID")),w$=L({type:"model.updated",schema:{}}),BQ={Updated:w$,Definitions:le(w$)},Tv=d.pipe(xe("Model.VariantID")),Er=g({id:gd,providerID:ho,variant:Tv.pipe(p)}).annotate({identifier:"Model.Ref"}).pipe(Q((e)=>({parse:(t)=>{let n=t.indexOf("/");if(n<=0)throw Error(`Invalid model reference: ${t}`);let o=t.slice(0,n),r=t.indexOf("#",n+1),i=t.slice(n+1,r===-1?void 0:r),s=r===-1?void 0:t.slice(r+1);if(!i||o.includes("#")||s!==void 0&&(!s||s.includes("#")))throw Error(`Invalid model reference: ${t}`);return e.make({providerID:ho.make(o),id:gd.make(i),...s?{variant:Tv.make(s)}:{}})}}))),lL=d.pipe(xe("Model.Family")),uL=ie([ce(["reasoning","reasoning_content","reasoning_text"]),d]).annotate({identifier:"Model.ReasoningField"}),dL=ce(["max_completion_tokens","max_tokens"]).annotate({identifier:"Model.MaxTokensField"}),pL=HE(g({compaction:_$.pipe(p)}),[J(d,uo)]).annotate({identifier:"Model.Settings"}),T$={settings:pL.pipe(p),headers:J(d,d).pipe(p),body:J(d,uo).pipe(p)},mL=g({reasoningField:uL.pipe(p),requireReasoning:be.pipe(p),maxTokensField:dL.pipe(p),requireFinishReason:be.pipe(p),requireAssistantAfterTool:be.pipe(p),supportsPromptCacheKey:be.pipe(p)}).annotate({identifier:"Model.Compatibility"}),I$=g({tools:be,input:Y(d),output:Y(d)}).annotate({identifier:"Model.Capabilities"}).pipe(Q(()=>({default:()=>({tools:!0,input:["text","image"],output:["text"]})}))),fL=g({tier:g({type:ae("context"),size:qt}).pipe(p),input:hd,output:hd,cache:g({read:hd,write:hd})}).annotate({identifier:"Model.Cost"}),hL=g({id:Tv,...T$}).annotate({identifier:"Model.Variant"}),qQ=g({id:gd,modelID:gd,providerID:ho,canonical:ho.pipe(p),family:lL.pipe(p),name:d,compatibility:mL.pipe(p),package:b$.pipe(p),...T$,capabilities:I$,variants:Y(hL),time:g({released:Re}),cost:Y(fL),status:ce(["alpha","beta","deprecated","active"]),enabled:be,limit:g({context:qt,input:qt.pipe(p),output:qt})}).annotate({identifier:"Model.Info"}).pipe(Q(()=>({default:(e,t)=>({id:t,modelID:t,providerID:e,name:t,capabilities:I$.default(),variants:[],time:{released:0},cost:[],status:"active",enabled:!0,limit:{context:200000,output:32000}})})));var pr=d.check(Pn("ses")).pipe(xe("SessionID"),Q((e)=>{let t=()=>e.make("ses_"+o$());return{create:t,descending:(n)=>n===void 0?t():e.make(n)}}));var O$=d.check(Pn("per")).pipe(xe("Permission.ID"),Q((e)=>({create:(t)=>e.make(t??"per_"+lt())}))),gL=ie([g({type:F("tool"),messageID:d,id:d})]).annotate({identifier:"Permission.Source"}),yL={sessionID:pr,action:d,resources:Y(d),save:Y(d).pipe(p),metadata:J(d,ct).pipe(p),source:gL.pipe(p),message:d.pipe(p)},xL=g({id:O$,...yL}).annotate({identifier:"Permission.Request"}),vL=ce(["once","always","reject"]).annotate({identifier:"Permission.Reply"}),E$=L({type:"permission.asked",schema:xL.fields}),$$=L({type:"permission.replied",schema:{sessionID:pr,requestID:O$,reply:vL}}),ree={Asked:E$,Replied:$$,Definitions:le(E$,$$)},SL=ce(["allow","deny","ask"]).annotate({identifier:"Permission.Effect"}),bL=g({action:d,resource:d,effect:SL}).annotate({identifier:"Permission.Rule"}),yd=Y(bL).annotate({identifier:"Permission.Ruleset"});var D$=L({type:"agent.updated",schema:{}}),Kr=d.pipe(xe("Agent.ID")),P$=d.pipe(xe("Agent.Name")),_L=d.annotate({identifier:"Agent.Color"}),uee=g({id:Kr,name:P$,model:Er.pipe(p),request:cL,system:d.pipe(p),description:d.pipe(p),mode:ce(["subagent","primary","all"]),hidden:be,color:_L.pipe(p),steps:qe.pipe(p),permissions:yd}).annotate({identifier:"Agent.Info"}).pipe(Q(()=>({default:(e)=>({id:e,name:P$.make(e),request:{settings:{},headers:{},body:{}},mode:"primary",hidden:!1,permissions:[{action:"*",resource:"*",effect:"allow"},{action:"external_directory",resource:"*",effect:"ask"},{action:"read",resource:"*.env",effect:"ask"},{action:"read",resource:"*.env.*",effect:"ask"},{action:"read",resource:"*.env.example",effect:"allow"}]})}))),dee={Updated:D$,Definitions:le(D$)};var C$=L({type:"command.updated",schema:{}}),hee=g({name:d,description:d.pipe(p)}).annotate({identifier:"Command.Info"}),gee={Updated:C$,Definitions:le(C$)};class Ev extends mo("Mcp.TimeoutConfig")({startup:qe.pipe(p).annotate({description:"Maximum time in milliseconds to establish and initialize the MCP server."}),catalog:qe.pipe(p).annotate({description:"Maximum time in milliseconds to wait for MCP discovery requests such as tools/list and prompts/list."}),execution:qe.pipe(p).annotate({description:"Maximum time in milliseconds to wait for MCP tool and prompt execution."})}){}var A$=ce(["legacy","auto","2026-07-28"]).annotate({identifier:"Mcp.Protocol",description:'MCP protocol negotiation. "legacy" (default) opens with the initialize handshake and speaks protocol revisions up to 2025-11-25. "auto" probes for the 2026-07-28 revision and falls back to legacy when the server does not support it. "2026-07-28" requires that revision and fails otherwise.'});class M$ extends mo("Mcp.LocalConfig")({type:F("local"),command:d.pipe(Y),cwd:d.pipe(p).annotate({description:"Working directory for the MCP server process. Relative paths resolve from the workspace directory."}),environment:J(d,d).pipe(p),disabled:be.pipe(p),codemode:be.pipe(p).annotate({description:"Expose this server's tools through Code Mode. Defaults to true."}),timeout:Ev.pipe(p),protocol:A$.pipe(p)}){}class U$ extends mo("Mcp.OAuthConfig")({client_id:d.pipe(p),client_secret:d.pipe(p),scope:d.pipe(p),callback_port:qt.check(QE({minimum:1,maximum:65535})).pipe(p),redirect_uri:d.pipe(p),auth_server_metadata_url:d.pipe(p).annotate({description:"URL of the OAuth or OpenID Connect authorization server metadata document. Set when the MCP server does not publish protected resource metadata that names its authorization server."})}){}class N$ extends mo("Mcp.RemoteConfig")({type:F("remote"),url:d,headers:J(d,d).pipe(p),oauth:ie([U$,F(!1)]).pipe(p),disabled:be.pipe(p),codemode:be.pipe(p).annotate({description:"Expose this server's tools through Code Mode. Defaults to true."}),timeout:Ev.pipe(p),protocol:A$.pipe(p)}){}var See=ie([M$,N$]).pipe(Be("type")),kL=g({status:F("connected")}).annotate({identifier:"Mcp.Status.Connected"}),wL=g({status:F("pending")}).annotate({identifier:"Mcp.Status.Pending"}),IL=g({status:F("disabled")}).annotate({identifier:"Mcp.Status.Disabled"}),TL=g({status:F("failed"),error:d}).annotate({identifier:"Mcp.Status.Failed"}),EL=g({status:F("needs_auth"),error:d}).annotate({identifier:"Mcp.Status.NeedsAuth"}),$L=ie([kL,wL,IL,TL,EL]).pipe(Be("status")),bee=g({name:d,status:$L,integrationID:p(mi)}).annotate({identifier:"Mcp.Server"}),OL=g({server:d,name:d,uri:d,description:p(d),mimeType:p(d)}).annotate({identifier:"Mcp.Resource"}),DL=g({server:d,name:d,uriTemplate:d,description:p(d),mimeType:p(d)}).annotate({identifier:"Mcp.ResourceTemplate"}),_ee=g({resources:Y(OL),templates:Y(DL)}).annotate({identifier:"Mcp.ResourceCatalog"}),PL=ie([g({type:F("text"),uri:d,text:d,mimeType:p(d)}),g({type:F("blob"),uri:d,blob:d,mimeType:p(d)})]).pipe(Be("type"),Jr({identifier:"Mcp.ResourceContentPart"})),kee=g({server:d,uri:d,contents:Y(PL)}).annotate({identifier:"Mcp.ResourceContent"});var CL=d.check(Pn("pty")).pipe(xe("PtyID")),xa=CL.pipe(Q((e)=>{let t=()=>e.make("pty_"+lt());return{create:t,ascending:(n)=>n===void 0?t():e.make(n)}})),$v=g({id:xa,title:d,command:d,args:Y(d),cwd:d,status:ce(["running","exited"]),pid:q,exitCode:p(q)}).annotate({identifier:"Pty"}),z$=L({type:"pty.created",schema:{info:$v}}),L$=L({type:"pty.updated",schema:{info:$v}}),j$=L({type:"pty.exited",schema:{id:xa,exitCode:q}}),G$=L({type:"pty.deleted",schema:{id:xa}}),Oee={Created:z$,Updated:L$,Exited:j$,Deleted:G$,Definitions:le(z$,L$,j$,G$)},Dee=g({command:p(d),args:p(Y(d)),cwd:p(d),title:p(d),env:p(J(d,d))}),Pee=g({title:p(d),size:p(g({rows:qe,cols:qe}))});var Dt=pd,RL=d.check(pi(/^[a-z][a-z0-9._-]*$/)).annotate({identifier:"Project.Vcs"}),Uee=g({id:Dt,directory:Le,canonical:Le}).annotate({identifier:"Project.Current"}),q$=g({url:p(d),override:p(d),color:p(d)}).annotate({identifier:"Project.Icon"}),V$=g({start:p(d.annotate({description:"Startup script to run when creating a new workspace (worktree)"}))}).annotate({identifier:"Project.Commands"}),AL=g({created:q,updated:q,active:q}).annotate({identifier:"Project.Time"}),ML=g({id:Dt,canonical:Le,vcs:p(RL),name:p(d),icon:p(q$),commands:p(V$),time:AL,sandboxes:Y(d)}).annotate({identifier:"Project"}),Nee=g({projectID:Dt,canonical:p(Le),name:p(d),icon:p(q$),commands:p(V$)}).annotate({identifier:"Project.UpdateInput"}),B$=L({type:"project.updated",schema:ML.fields}),Fee={Updated:B$,Definitions:le(B$)};var vd=ce(["stop","length","tool-calls","content-filter","error","unknown"]);var jee=d.pipe(xe("Tool.CallID"));class NL extends fv()("Tool.Error",{message:d,error:ud(Sz()),metadata:ud(J(d,ct))}){}var FL=g({type:F("text"),text:d}).annotate({identifier:"Tool.TextContent"}),zL=g({type:F("file"),uri:d,mime:d,name:ud(d)}).annotate({identifier:"Tool.FileContent"}),gi=ie([FL,zL]).pipe(Be("type")).annotate({identifier:"Tool.Content"});var Sd=d.pipe(xe("Skill.ID")),bd=d.pipe(xe("Skill.Name")),jL=g({type:ae("directory"),path:Le}).annotate({identifier:"Skill.DirectorySource"}),GL=g({type:ae("url"),url:d}).annotate({identifier:"Skill.UrlSource"}),ZL=g({id:Sd,name:bd,description:d.pipe(p),autoinvoke:be.pipe(p),path:Le,content:d}).annotate({identifier:"Skill.Info"}),W$=L({type:"skill.updated",schema:{}}),Vee={Updated:W$,Definitions:le(W$)},BL=g({type:ae("embedded"),skill:sz(()=>ZL)}).annotate({identifier:"Skill.EmbeddedSource"}),Wee=Object.assign(ie([jL,GL,BL]).pipe(Be("type"),Jr({identifier:"Skill.Source"})),{equals:(e,t)=>{if(e.type!==t.type)return!1;if(e.type==="directory"&&t.type==="directory")return e.path===t.path;if(e.type==="url"&&t.type==="url")return e.url===t.url;if(e.type==="embedded"&&t.type==="embedded")return e.skill.id===t.skill.id;return!1},key:(e)=>e.type==="directory"?`directory:${e.path}`:e.type==="url"?`url:${e.url}`:`embedded:${e.skill.id}`});var Ov=g({start:Re,end:Re,text:d}).annotate({identifier:"Prompt.Mention"}),qL=ie([g({type:F("inline")}),g({type:F("uri"),uri:d})]).pipe(Be("type")).annotate({identifier:"Prompt.FileSource"}),VL=d.check(pi(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/)).annotate({identifier:"Prompt.Base64"}),H$=g({data:VL,mime:d,source:qL,name:d.pipe(p),description:d.pipe(p),mention:Ov.pipe(p)}).annotate({identifier:"Prompt.FileAttachment"}).pipe(Q((e)=>({create:(t)=>e.make({data:t.data,mime:t.mime,source:t.source,name:t.name,description:t.description,mention:t.mention})}))),WL=g({name:d,mention:Ov.pipe(p)}).annotate({identifier:"Prompt.AgentAttachment"}),HL=g({id:Sd,name:bd,text:d.pipe(p),mention:Ov.pipe(p)}).annotate({identifier:"Prompt.SkillAttachment"}),yo=g({text:d,files:Y(H$).pipe(p),agents:Y(WL).pipe(p),skills:Y(HL).pipe(p)}).annotate({identifier:"Prompt"}).pipe(Q((e)=>({equivalence:Cz(e),fromUserMessage:(t)=>e.make({text:t.text,...t.files===void 0?{}:{files:t.files},...t.agents===void 0?{}:{agents:t.agents},...t.skills===void 0?{}:{skills:t.skills}})})));var Sa=J(d,Ir).annotate({identifier:"Session.Metadata"});var JL=g({providerID:ho,provider:d,modelID:d,route:d,protocol:d,endpoint:d}).annotate({identifier:"Session.ProviderContext.Provenance"}),KL=g({version:F(1),provenance:JL,messages:Ir}).annotate({identifier:"Session.ProviderContext"});var YL=d.check(Pn("sh_")).pipe(xe("Shell.ID")),_d=YL.pipe(Q((e)=>{let t=()=>e.make("sh_"+lt());return{create:t,ascending:(n)=>n===void 0?t():e.make(n)}})),Dv=ce(["running","exited","timeout","killed"]),XL=g({started:Re.annotate({description:"Start time in milliseconds since the Unix epoch"}),completed:p(Re).annotate({description:"Completion time in milliseconds since the Unix epoch"})}),Q$=J(d,ct),Pv=g({id:_d,status:Dv,command:d,cwd:d,shell:d,file:d,pid:p(q),exit:p(Re),metadata:Q$,time:XL}).annotate({identifier:"Shell.Info"}),K$=L({type:"shell.created",schema:{info:Pv}}),Y$=L({type:"shell.exited",schema:{id:_d,exit:p(Re),status:Dv}}),X$=L({type:"shell.deleted",schema:{id:_d}}),cte={Created:K$,Exited:Y$,Deleted:X$,Definitions:le(K$,Y$,X$)},lte=g({command:d,cwd:p(d),timeout:p(q),metadata:p(Q$)}),ute=g({cursor:p(q),limit:p(q)}),eO=g({output:d,cursor:q,size:q,truncated:be});var Yr=g({type:d,message:d,status:qt.check(QE({minimum:100,maximum:599})).pipe(p)}).annotate({identifier:"Session.StructuredError"});var xo=d.pipe(xe("Snapshot.ID"));var vo=g({input:Re,output:Re,reasoning:Re,cache:g({read:Re,write:Re})}).annotate({identifier:"TokenUsage.Info"});var Ve=d.check(Pn("msg_")).pipe(xe("Session.Message.ID"),Q((e)=>({create:()=>e.make("msg_"+lt()),fromEvent:(t)=>e.make(t.replace(/^evt_/,"msg_"))}))),mr={id:Ve,metadata:J(d,ct).pipe(p),time:g({created:Xe})},Pt=J(d,ct).annotate({identifier:"Session.Message.ProviderState"}),QL=g({...mr,type:ae("agent-switched"),agent:Kr,previous:Kr.pipe(p)}).annotate({identifier:"Session.Message.AgentSelected"}),ej=g({...mr,type:ae("model-switched"),model:Er,previous:Er.pipe(p)}).annotate({identifier:"Session.Message.ModelSelected"}),tj=g({...mr,type:ae("location-switched"),location:Cn,projectID:Dt.pipe(p),subpath:Xt.pipe(p),previous:g({location:Cn,projectID:Dt.pipe(p),subpath:Xt.pipe(p)}).pipe(p)}).annotate({identifier:"Session.Message.LocationSwitched"}),rj=g({...mr,text:yo.fields.text,files:yo.fields.files,agents:yo.fields.agents,skills:yo.fields.skills,type:ae("user")}).annotate({identifier:"Session.Message.User"}),nj=g({...mr,text:d,description:d.pipe(p),type:ae("synthetic")}).annotate({identifier:"Session.Message.Synthetic"}),oj=g({...mr,type:ae("system"),text:d,description:d.pipe(p)}).annotate({identifier:"Session.Message.System"}),ij=g({...mr,type:ae("skill"),skill:Sd,name:bd,text:d}).annotate({identifier:"Session.Message.Skill"}),sj=g({...mr,type:ae("shell"),shellID:_d,command:d,status:Dv,exit:Bt.pipe(p),output:eO.pipe(p),time:g({created:Xe,completed:Xe.pipe(p)})}).annotate({identifier:"Session.Message.Shell"}),aj=g({status:ae("streaming"),input:d}).annotate({identifier:"Session.Message.ToolState.Streaming"}),cj=g({status:ae("running"),input:J(d,ct),metadata:J(d,Ir)}).annotate({identifier:"Session.Message.ToolState.Running"}),lj=g({status:ae("completed"),input:J(d,ct),content:ma(gi),metadata:J(d,Ir).pipe(p)}).annotate({identifier:"Session.Message.ToolState.Completed"}),uj=g({status:ae("error"),input:J(d,ct),error:Yr,content:ma(gi).pipe(p),metadata:J(d,Ir).pipe(p)}).annotate({identifier:"Session.Message.ToolState.Error"}),dj=ie([aj,cj,lj,uj]).pipe(Be("status")),pj=g({type:ae("tool"),id:d,name:d,executed:be.pipe(p),providerState:Pt.pipe(p),providerResultState:Pt.pipe(p),state:dj,time:g({created:Xe,ran:Xe.pipe(p),completed:Xe.pipe(p)})}).annotate({identifier:"Session.Message.Assistant.Tool"}),mj=g({type:ae("text"),text:d,state:Pt.pipe(p)}).annotate({identifier:"Session.Message.Assistant.Text"}),fj=g({type:ae("reasoning"),text:d,state:Pt.pipe(p),time:g({created:Xe,completed:Xe.pipe(p)}).pipe(p)}).annotate({identifier:"Session.Message.Assistant.Reasoning"}),tO=ie([mj,fj,pj]).pipe(Be("type")),hj=tz(tO).annotate({identifier:"Session.Message.AssistantContent.Encoded"}),gj=g({attempt:qe,at:Xe,error:Yr}).annotate({identifier:"Session.Message.Assistant.Retry"}),yj=g({...mr,type:ae("assistant"),agent:Kr,model:Er,content:tO.pipe(Y),snapshot:g({start:xo.pipe(p),end:xo.pipe(p),files:Y(Xt).pipe(p)}).pipe(p),finish:vd.pipe(p),rawFinish:d.pipe(p),providerState:Pt.pipe(p),cost:go.pipe(p),tokens:vo.pipe(p),error:Yr.pipe(p),retry:gj.pipe(p),time:g({created:Xe,streamed:Xe.pipe(p),completed:Xe.pipe(p)})}).annotate({identifier:"Session.Message.Assistant"}),Av={type:ae("compaction"),...mr},rO={cost:go.pipe(p),tokens:vo.pipe(p)},xj=g({...Av,status:ae("running"),reason:ce(["auto","manual"]),summary:d,recent:d}).annotate({identifier:"Session.Message.Compaction.Running"}),yi=g({...Av,status:ae("completed"),reason:ce(["auto","manual"]),model:Er.pipe(p),providerState:Pt.pipe(p),summary:d,recent:d,providerContext:KL.pipe(p),...rO}).annotate({identifier:"Session.Message.Compaction.Completed"}),Mv=g({...Av,status:ae("failed"),reason:ce(["auto","manual"]),error:Yr,...rO}).annotate({identifier:"Session.Message.Compaction.Failed"}),vj=ie([xj,yi,Mv]).pipe(Be("status"),Jr({identifier:"Session.Message.Compaction"})),Sj=g({...mr,type:ae("idle"),outcome:ce(["succeeded","failed","interrupted"])}).annotate({identifier:"Session.Message.Idle"}),Ate=ie([QL,ej,tj,rj,nj,oj,ij,sj,yj,vj,Sj]).annotate({identifier:"Session.Message.Info"});var bj=g({file:d,patch:d,additions:q,deletions:q,status:ce(["added","deleted","modified"])}).annotate({identifier:"FileDiff.Info"}),Nte=g({file:d.pipe(p),patch:d.pipe(p),additions:Re,deletions:Re,status:ce(["added","deleted","modified"]).pipe(p)}).annotate({identifier:"FileDiff.LegacyInfo"});var Rn=g({messageID:Ve,partID:d.pipe(p),snapshot:xo.pipe(p),files:Y(bj).pipe(p)}).annotate({identifier:"Session.Revert"}),_j=g({path:d,status:ce(["added","modified","deleted"]),additions:Re,deletions:Re,patch:d}),oO=g({messageID:Ve,partID:d.pipe(p),snapshot:d.pipe(p),diff:d.pipe(p),files:Y(_j).pipe(p)}).annotate({identifier:"Session.RevertV1"}),kj=Rn.pipe(wr(g({source:ae("current"),revert:ui(Rn)}),so({decode:(e)=>({source:"current",revert:e}),encode:(e)=>e.revert}))),wj=oO.pipe(wr(g({source:ae("legacy"),revert:ui(oO)}),so({decode:(e)=>({source:"legacy",revert:e}),encode:(e)=>e.revert}))),Zte=ie([kj,wj]).pipe(Be("source"),wr(ui(Rn),so({decode:(e)=>{if(e.source==="current")return e.revert;return Rn.make({messageID:e.revert.messageID,partID:e.revert.partID,snapshot:e.revert.snapshot?xo.make(e.revert.snapshot):void 0,files:e.revert.files?.map((t)=>({file:t.path,status:t.status,additions:t.additions,deletions:t.deletions,patch:t.patch}))})},encode:(e)=>({source:"current",revert:e})})),Jr({identifier:"Session.Revert.Persisted"}));var Ij=d.check(pi(/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._/-]*$/)).pipe(xe("Instruction.Key")),iO=d.check(pi(/^[a-f0-9]{64}$/)).pipe(xe("Instruction.Hash")),Tj=J(Ij,iO),sO=F("removed"),Vte=sO.make("removed"),Ej=J(d,ie([iO,sO]));var $j=d.check(pi(/^[a-z0-9][a-z0-9._-]*$/)).annotate({identifier:"InstructionEntry.Key",description:"Instruction entry key (lowercase alphanumerics plus . _ -)"}),Oj=g({key:$j,value:Ir.annotate({description:"JSON value attached to the session's instructions"})}).annotate({identifier:"InstructionEntry.Info"}),Dj=Y(g({...Oj.fields,removed:be})).annotate({identifier:"InstructionEntry.Snapshot"});class Pj extends fv()("InstructionEntryValueTooLargeError",{actualBytes:qt,maxBytes:qt,message:d},{httpApiStatus:413}){}var _a=ce(["steer","queue"]).annotate({identifier:"Session.Inbox.Delivery"}),Cj=g({...yo.fields,metadata:J(d,ct).pipe(p)}).annotate({identifier:"Session.Inbox.UserPayload"}),Rj=g({text:d,description:d.pipe(p),metadata:J(d,ct).pipe(p)}).annotate({identifier:"Session.Inbox.SyntheticPayload"}),Aj=g({}).annotate({identifier:"Session.Inbox.CompactionPayload"}),lO=g({location:Cn,projectID:Dt,subpath:Xt.pipe(p)}).annotate({identifier:"Session.Inbox.MovePayload"}),uO=g({type:ae("user"),payload:Cj,delivery:_a}),dO=g({type:ae("synthetic"),payload:Rj,delivery:_a}),pO=g({type:ae("compaction"),payload:Aj,delivery:_a}),mO=g({type:ae("move"),payload:lO,delivery:_a}),Mj=ie([uO,dO,pO,mO]).pipe(Be("type"),Jr({identifier:"Session.Inbox.Item"})),Id={id:Ve,sessionID:pr,time:g({created:Xe})},Uj=g({...Id,...uO.fields}).annotate({identifier:"Session.Inbox.User"}),Nj=g({...Id,...dO.fields}).annotate({identifier:"Session.Inbox.Synthetic"}),Fj=g({...Id,...pO.fields}).annotate({identifier:"Session.Inbox.Compaction"}),zj=g({...Id,...mO.fields}).annotate({identifier:"Session.Inbox.Move"}),tre=ie([Uj,Nj,Fj,zj]).pipe(Be("type"),Jr({identifier:"Session.Inbox.Info"}));var hO=ie([g({type:F("before"),messageID:Ve}),g({type:F("through"),messageID:Ve})]).annotate({identifier:"Session.ForkBoundary"});var Dre=g({start:q,end:q,text:d}).annotate({identifier:"Session.Event.Source"}),W={sessionID:pr},X={durable:{aggregate:"sessionID",version:1}},Lj=j({type:"session.created",...X,schema:{...W,projectID:Dt,location:Cn,subpath:Xt.pipe(p),parentID:pr.pipe(p),slug:d,title:d.pipe(p),agent:Kr.pipe(p),model:Er.pipe(p),metadata:Sa.pipe(p),permissions:yd.pipe(p),version:d}}),jj=j({type:"session.agent.selected",...X,schema:{...W,agent:Kr,previous:Kr.pipe(p)}}),Gj=j({type:"session.model.selected",...X,schema:{...W,model:Er,previous:Er.pipe(p)}}),Zj=j({type:"session.moved",...X,schema:{...W,...lO.fields}}),Bj=j({type:"session.renamed",...X,schema:{...W,title:d}}),qj=j({type:"session.metadata.updated",...X,schema:{...W,metadata:Sa}}),Vj=j({type:"session.permissions",...X,schema:{...W,permissions:yd}}),Wj=j({type:"session.viewed",...X,schema:{...W,idle:Re}}),Hj=j({type:"session.message.content.updated",...X,schema:{...W,messageID:Ve,content:Y(hj)}}),Jj=j({type:"session.usage.recorded",...X,schema:{...W,source:ce(["title","compaction"]),cost:go,tokens:vo}}),Kj=L({type:"session.usage.updated",schema:{...W,cost:go,tokens:vo}}),Yj=j({type:"session.deleted",durable:{aggregate:"sessionID",version:2},schema:W}),Xj=j({type:"session.forked",durable:{aggregate:"sessionID",version:2},schema:{...W,parentID:pr,boundary:hO,instructions:Tj.pipe(p),instructionEntries:Dj.pipe(p)}}),Ed={...W,inboxID:Ve},Qj=j({type:"session.inbox.delivered",...X,schema:Ed}),e1=j({type:"session.inbox.enqueued",...X,schema:{...Ed,item:Mj}}),t1=j({type:"session.inbox.cancelled",...X,schema:Ed}),r1=j({type:"session.inbox.delivery.changed",...X,schema:{...Ed,delivery:_a}}),xi;(function(e){e.Started=j({type:"session.execution.started",...X,schema:W}),e.Succeeded=j({type:"session.execution.succeeded",...X,schema:W}),e.Failed=j({type:"session.execution.failed",...X,schema:{...W,error:Yr}}),e.Interrupted=j({type:"session.execution.interrupted",...X,schema:{...W,reason:ce(["user","shutdown","superseded","inactivity"])}})})(xi||(xi={}));var n1=j({type:"session.instructions.updated",durable:{aggregate:"sessionID",version:2},schema:{...W,delta:Ej,text:d.pipe(p)}}),o1=j({type:"session.synthetic",...X,schema:{...W,text:d,description:d.pipe(p),metadata:J(d,ct).pipe(p)}}),Nv;(function(e){e.Activated=j({type:"session.skill.activated",...X,schema:{...W,id:Sd,name:bd,text:d}})})(Nv||(Nv={}));var Td;(function(e){e.Started=j({type:"session.shell.started",...X,schema:{...W,shell:Pv}}),e.Ended=j({type:"session.shell.ended",...X,schema:{...W,shell:Pv,output:eO}})})(Td||(Td={}));var vi;(function(e){e.Started=j({type:"session.step.started",...X,schema:{...W,assistantMessageID:Ve,agent:Kr,model:Er,snapshot:xo.pipe(p),started:q}}),e.Streamed=j({type:"session.step.streamed",...X,schema:{...W,assistantMessageID:Ve}}),e.Ended=j({type:"session.step.ended",...X,schema:{...W,assistantMessageID:Ve,finish:vd,rawFinish:d.pipe(p),providerState:Pt.pipe(p),cost:go,tokens:vo,snapshot:xo.pipe(p),files:Y(Xt).pipe(p)}}),e.Failed=j({type:"session.step.failed",...X,schema:{...W,assistantMessageID:Ve,error:Yr,finish:ce(["content-filter"]).pipe(p),rawFinish:d.pipe(p),providerState:Pt.pipe(p),cost:go.pipe(p),tokens:vo.pipe(p),snapshot:xo.pipe(p),files:Y(Xt).pipe(p)}})})(vi||(vi={}));var ka;(function(e){e.Started=j({type:"session.text.started",...X,schema:{...W,assistantMessageID:Ve,ordinal:q}}),e.Delta=L({type:"session.text.delta",schema:{...W,assistantMessageID:Ve,ordinal:q,delta:d}}),e.Ended=j({type:"session.text.ended",...X,schema:{...W,assistantMessageID:Ve,ordinal:q,text:d,state:Pt.pipe(p)}})})(ka||(ka={}));var wa;(function(e){e.Started=j({type:"session.reasoning.started",...X,schema:{...W,assistantMessageID:Ve,ordinal:q,state:Pt.pipe(p)}}),e.Delta=L({type:"session.reasoning.delta",schema:{...W,assistantMessageID:Ve,ordinal:q,delta:d}}),e.Ended=j({type:"session.reasoning.ended",...X,schema:{...W,assistantMessageID:Ve,ordinal:q,text:d,state:Pt.pipe(p)}})})(wa||(wa={}));var Xr;(function(e){let t={...W,assistantMessageID:Ve,id:d},n;(function(o){o.Started=j({type:"session.tool.input.started",...X,schema:{...t,name:d}}),o.Delta=L({type:"session.tool.input.delta",schema:{...t,delta:d}}),o.Ended=j({type:"session.tool.input.ended",...X,schema:{...t,text:d}})})(n=e.Input||(e.Input={})),e.Called=j({type:"session.tool.called",...X,schema:{...t,input:J(d,ct),executed:be,state:Pt.pipe(p)}}),e.Progress=L({type:"session.tool.progress",schema:{...t,metadata:J(d,Ir)}}),e.Success=j({type:"session.tool.success",durable:{aggregate:"sessionID",version:2},schema:{...t,content:ma(gi),metadata:J(d,Ir).pipe(p),executed:be,resultState:Pt.pipe(p)}}),e.Failed=j({type:"session.tool.failed",durable:{aggregate:"sessionID",version:2},schema:{...t,error:Yr,content:ma(gi).pipe(p),metadata:J(d,Ir).pipe(p),executed:be,resultState:Pt.pipe(p)}})})(Xr||(Xr={}));var i1=j({type:"session.retry.scheduled",...X,schema:{...W,assistantMessageID:Ve,attempt:qe,at:q,error:Yr}}),Si;(function(e){e.Started=j({type:"session.compaction.started",...X,schema:{...W,reason:ce(["auto","manual"]),recent:d,inputID:Ve.pipe(p)}}),e.Delta=L({type:"session.compaction.delta",schema:{...W,text:d}}),e.Ended=j({type:"session.compaction.ended",...X,schema:{...W,reason:e.Started.data.fields.reason,model:yi.fields.model,providerState:yi.fields.providerState,providerContext:yi.fields.providerContext,text:d,recent:d,cost:yi.fields.cost,tokens:yi.fields.tokens}}),e.Failed=j({type:"session.compaction.failed",...X,schema:{...W,reason:e.Started.data.fields.reason,error:Yr,inputID:Ve.pipe(p),cost:Mv.fields.cost,tokens:Mv.fields.tokens}})})(Si||(Si={}));var Ia;(function(e){e.Staged=j({type:"session.revert.staged",...X,schema:{...W,revert:Rn}}),e.Cleared=j({type:"session.revert.cleared",...X,schema:W}),e.Committed=j({type:"session.revert.committed",...X,schema:{...W,to:Ve}})})(Ia||(Ia={}));var gO=le(Lj,jj,Gj,Zj,Bj,qj,Vj,Wj,Kj,Yj,Xj,Qj,e1,t1,r1,xi.Started,xi.Succeeded,xi.Failed,xi.Interrupted,n1,o1,Nv.Activated,Td.Started,Td.Ended,vi.Started,vi.Streamed,vi.Ended,vi.Failed,ka.Started,ka.Delta,ka.Ended,wa.Started,wa.Delta,wa.Ended,Xr.Input.Started,Xr.Input.Delta,Xr.Input.Ended,Xr.Called,Xr.Progress,Xr.Success,Xr.Failed,i1,Si.Started,Si.Delta,Si.Ended,Si.Failed,Ia.Staged,Ia.Cleared,Ia.Committed),s1=le(...gO.filter((e)=>e.durability==="durable"),Jj,Hj),a1=le(...gO.filter((e)=>e.durability==="ephemeral")),c1=ie(s1,{mode:"oneOf"}).pipe(Be("type")).annotate({identifier:"Session.Event.Durable"}),Pre=ie([c1,...a1],{mode:"oneOf"}).pipe(Be("type"));var So=pr,l1=Sa;var u1=hO,Vre=g({id:So,parentID:So.pipe(p),fork:g({sessionID:So,boundary:u1}).pipe(p),projectID:Dt,agent:Kr.pipe(p),model:Er.pipe(p),cost:go,tokens:vo,outcome:ce(["succeeded","failed","interrupted"]).pipe(p),time:g({created:Xe,updated:Xe,idle:Xe.pipe(p),viewed:Xe.pipe(p),archived:Xe.pipe(p)}),title:d.pipe(p),location:Cn,subpath:Xt.pipe(p),metadata:l1.pipe(p),permissions:yd.pipe(p),revert:Rn.pipe(p)}).annotate({identifier:"Session.Info"}),Wre=g({id:So,time:Re,direction:ce(["previous","next"])}).annotate({identifier:"Session.ListAnchor"});var bO=g({...$v.fields,sessionID:So,foregroundProcess:dv(d),size:g({cols:qe,rows:qe}),output:g({head:q,tail:q})}).annotate({identifier:"PersistentPty.Info"}),Qre=g({directory:d,instanceID:d,ticket:d,expiresAt:Bt}).annotate({identifier:"PersistentPty.Handoff"}),ene=g({command:p(d),args:Y(d),cwd:p(d),title:d,env:J(d,d),size:p(g({cols:qe,rows:qe}))}).annotate({identifier:"PersistentPty.CreateInput"}),tne=g({attachmentID:p(d),size:g({cols:qe,rows:qe})}).annotate({identifier:"PersistentPty.UpdateInput"}),d1=g({info:bO,text:d,checkpoint:Tz,cursor:g({x:q,y:q})}).annotate({identifier:"PersistentPty.Snapshot"}),rne=qe.check(hz(65535)).annotate({identifier:"PersistentPty.ReadLines"}),nne=g({ptyID:xa,title:d,cwd:d,foregroundProcess:dv(d),screen:g({text:d,cols:qe,rows:qe,cursor:d1.fields.cursor})}).annotate({identifier:"PersistentPty.ReadResult"}),vO=L({type:"persistent-pty.added",schema:{sessionID:So,terminal:bO}}),SO=L({type:"persistent-pty.removed",schema:{sessionID:So,ptyID:xa}}),one={Added:vO,Removed:SO,Definitions:le(vO,SO)};var kO=L({type:"reference.updated",schema:{}}),lne={Updated:kO,Definitions:le(kO)},p1=g({type:F("local"),path:Le,description:d.pipe(p),hidden:be.pipe(p)}).annotate({identifier:"Reference.LocalSource"}),m1=g({type:F("git"),repository:d,branch:d.pipe(p),description:d.pipe(p),hidden:be.pipe(p)}).annotate({identifier:"Reference.GitSource"}),f1=ie([p1,m1]).pipe(Be("type")).annotate({identifier:"Reference.Source"}),une=g({name:d,path:Le,description:d.pipe(p),hidden:be.pipe(p),source:f1}).annotate({identifier:"Reference.Info"});var h1=g({current:p(d),default:p(d)}).annotate({identifier:"Vcs.Branch"}),mne=g({provider:p(d),branch:h1}).annotate({identifier:"Vcs.Info"}),fne=Y(d).annotate({identifier:"Vcs.BranchList"}),hne=g({name:d,ref:d,source:ce(["reflog","default"])}).annotate({identifier:"Vcs.Base"}),gne=ce(["working","branch","committed"]).annotate({identifier:"Vcs.Mode"}),yne=g({file:d,additions:q,deletions:q,status:ce(["added","deleted","modified"])}).annotate({identifier:"Vcs.FileStatus"});var Fv=d.pipe(xe("WebSearch.ID")),bne=g({id:Fv,name:d}).annotate({identifier:"WebSearch.Provider"}),_ne=g({query:d,providerID:Fv.pipe(p)}).annotate({identifier:"WebSearch.Input"}),g1=g({url:d,title:d.pipe(p),content:d.pipe(p),time:g({published:Re.pipe(p).annotate({description:"Publication time in milliseconds since the Unix epoch"})})}).annotate({identifier:"WebSearch.Result"});class y1 extends mo("WebSearch.Response")({providerID:Fv,results:Y(g1)}){}var EO=L({type:"websearch.updated",schema:{}}),kne={Updated:EO,Definitions:le(EO)};var $ne=t$.pipe(YE(e$()),xe("Worktree.StrategyID")),One=g({projectID:Dt,from:p(Le),branch:p(t$.pipe(YE(e$()))),directory:p(Le).annotate({description:"Parent directory for the new worktree. Uses the project's canonical configuration, then defaults to the server's data directory under worktree/<first six project ID characters>."}),name:p(d)}).annotate({identifier:"Worktree.CreateInput"}),Dne=g({projectID:Dt,directory:Le,force:be}).annotate({identifier:"Worktree.RemoveInput"}),Pne=g({directory:Le}).annotate({identifier:"Worktree.Info"}),x1=g({directory:Le,strategy:p(d)}).annotate({identifier:"Worktree.Directory"}),Cne=g({directory:Le,type:ce(["root","worktree"])}).annotate({identifier:"Worktree.ListEntry"});class v1 extends fv()("Worktree.OperationError",{message:d,forceRequired:p(be)}){}var Rne=Y(x1).annotate({identifier:"Worktree.List"}),OO=L({type:"worktree.updated",schema:{projectID:Dt}}),DO=j({type:"worktree.resolved",durable:{aggregate:"projectID",version:1},schema:{projectID:Dt,directory:Le,previous:Dt,adopted:p(Y(Dt))}}),Ane={Updated:OO,Resolved:DO,Definitions:le(OO,DO)};xs();tr();function S1(e){let t=e.location,n=typeof t?.directory==="string"&&t.directory.length>0?t.directory:process.cwd();return{project:t?.project??null,directory:n}}function CO(e){let{project:t,directory:n}=S1(e);return{client:null,project:t,directory:n,worktree:n,experimental_workspace:{register(){}},serverUrl:new URL("http://localhost"),$:null}}function RO(e){let t=(()=>{let s=e.options;if(s!==null&&typeof s==="object"&&!Array.isArray(s))return s;return{}})(),n=t.meta_governor,o=n!==null&&typeof n==="object"&&!Array.isArray(n)?n:{},{meta_governor:r,...i}=t;return{meta_governor:{...i,...o}}}tr();function b1(e){return e.map((t)=>typeof t?.text==="string"?t.text:JSON.stringify(t??null)).join(`
302
+ `)}return t};var Gr=Hw;var Ky=(e)=>e.length>0;var Ls=Gw,to=jw;var yu=Fy;var xu=W(2,(e,{onFailure:t,onSuccess:n})=>yu(e)?t(e.failure):n(e.success));var Xy=globalThis.Array;var Ko=(e)=>Xy.isArray(e)?e:Xy.from(e);var Qy=W(2,(e,t)=>[...e,t]),pN=W(2,(e,t)=>Ko(e).concat(Ko(t)));var gH=Xy.isArray;var ex=Ky,vu=Ky;var mN=(e,t)=>{let n=Ie(t),o=e.get(n);if(o===void 0)return e.set(n,[t]),!0;for(let r of o)if(ze(r,t))return!1;return o.push(t),!0};var tI=W(2,(e,t)=>{let n=Ko(e),o=Ko(t);if(vu(n))return vu(o)?fN(pN(n,o)):n;return o});var Su=()=>[];var rI=W(2,(e,t)=>e.map(t));var fN=(e)=>{let t=Ko(e);if(t.length<2)return[...t];let n=new Map,o=[];for(let r of t)if(mN(n,r))o.push(r);return o};var rx=Gr("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new bu}),nI="setImmediate"in globalThis?(e)=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:(e)=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},hN=(e)=>{let t=!1;return Promise.resolve().then(()=>{if(!t)e()}),()=>{t=!0}};class oI{buckets=[];scheduleTask(e,t){let n=this.buckets,o=n.length,r,i=0;for(;i<o;i++){if(n[i][0]>t)break;r=n[i]}if(r&&r[0]===t)r[1].push(e);else if(i===o)n.push([t,[e]]);else n.splice(i,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}}class bu{executionMode;setImmediate;constructor(e="async",t){this.executionMode=e,this.setImmediate=t??(e==="sync"?hN:nI)}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new iI(this.setImmediate)}}class iI{tasks=new oI;running=void 0;setImmediate;constructor(e=nI){this.setImmediate=e}scheduleTask(e,t){if(this.tasks.scheduleTask(e,t),this.running===void 0)this.running=this.setImmediate(this.afterScheduled)}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let o=0;o<n.length;o++)n[o]()}}flush(){while(this.tasks.buckets.length>0){if(this.running!==void 0)this.running(),this.running=void 0;this.runTasks()}}}var sI=Gr("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),aI=Gr("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var cI=class extends Hn{constructor(e){super();if(e)ou(this,e)}};var nx=Jo;var uI="~effect/encoding/EncodingError";class ku extends nx("EncodingError"){[uI]=uI}var wu=(e)=>typeof e==="string"?dI(yN.encode(e)):dI(e),Iu=(e)=>{let t=xN(e),n=t.length;if(n%4!==0)return to(new ku({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${n}`}));let o=t.indexOf("=");if(o!==-1&&(o<n-2||o===n-2&&t[n-1]!=="="))return to(new ku({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let r=t.endsWith("==")?2:t.endsWith("=")?1:0,i=new Uint8Array(3*(n/4)-r);for(let s=0,a=0;s<n;s+=4,a+=3){let l=_u(t.charCodeAt(s))<<18|_u(t.charCodeAt(s+1))<<12|_u(t.charCodeAt(s+2))<<6|_u(t.charCodeAt(s+3));i[a]=l>>16,i[a+1]=l>>8&255,i[a+2]=l&255}return Ls(i)}catch(r){return to(new ku({kind:"Decode",module:"Base64",input:t,message:r instanceof Error?r.message:"Invalid input"}))}};var yN=new TextEncoder;var xN=(e)=>e.replace(/[\n\r]/g,""),dI=(e)=>{let t=e.length,n="",o;for(o=2;o<t;o+=3)n+=Zr[e[o-2]>>2],n+=Zr[(e[o-2]&3)<<4|e[o-1]>>4],n+=Zr[(e[o-1]&15)<<2|e[o]>>6],n+=Zr[e[o]&63];if(o===t+1)n+=Zr[e[o-2]>>2],n+=Zr[(e[o-2]&3)<<4],n+="==";if(o===t)n+=Zr[e[o-2]>>2],n+=Zr[(e[o-2]&3)<<4|e[o-1]>>4],n+=Zr[(e[o-1]&15)<<2],n+="=";return n};function _u(e){if(e>=pI.length)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=pI[e];if(t===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var Zr=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],pI=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];var vN=[];for(let e=0;e<256;e++)vN.push(e.toString(16).padStart(2,"0"));var fI="effect/Tracer/ParentSpan";var hI="effect/Tracer";var gI="effect/observability/Metric/FiberRuntimeMetricsKey";var yI=Gr("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:jo});var xI=Gr("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),vI=Gr("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});class II extends Cs{fiberId;constructor(e,t=Rs){super("Interrupt",t,"Interrupted");this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[Ze](e){return au(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[Ge](){return dt(Fe(`${this._tag}:${this.fiberId}`))(eu(this.annotations))}}var TI=(e)=>new vn([new II(e)]);var ax=(e)=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag==="Fail")return Ls(n.error)}return to(e)};var EI=(e)=>e.reasons.some(au);var cx=W(2,(e,t)=>{if(e.reasons.length===0)return t;else if(t.reasons.length===0)return e;let n=new vn(tI(e.reasons,t.reasons));return ze(e,n)?e:n}),$I=W(2,(e,t)=>{let n=!1,o=e.reasons.map((r)=>{if(Ns(r))return n=!0,new As(t(r.error),r.annotations);return r});return n?Ms(o):e});var SI="~effect/Fiber",$N={_A:_t,_E:_t},ON={id:0},DN=()=>globalThis[Ho];class lx{constructor(e,t=!0){this[SI]=$N,this.setContext(e),this.id=++ON.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[SI];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return zs(this.context,e)}addObserver(e){if(this._exit)return e(this._exit),gw;return this._observers.push(e),()=>{if(this._exit)return;let t=this._observers.indexOf(e);if(t>=0)this._observers.splice(t,1)}}interruptUnsafe(e,t){if(this._exit)return;let n=TI(e);if(this.currentStackFrame)n=Us(n,Wy(Ry,this.currentStackFrame));if(t)n=Us(n,t);if(this._interruptedCause=this._interruptedCause?cx(this._interruptedCause,n):n,this.interruptible)if(this._running)this._deferredInterrupt=!0;else this.evaluate(lr(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;else if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let t=this.runLoop(e);if(t===Xn)return;let n=bI.interruptChildren&&bI.interruptChildren(this);if(n!==void 0)return this.evaluate(Gt(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let o=0;o<this._observers.length;o++)this._observers[o](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=Vy()}runLoop(e){let t=globalThis[Ho];globalThis[Ho]=this;let n=this._running;this._running=!0;let o=!1,r=e;this.currentOpCount=0;try{while(!0){if(this._deferredInterrupt)this._deferredInterrupt=!1,r=lr(this._interruptedCause);if(this.currentOpCount++,!o&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){o=!0;let i=r;r=Gt(RI,()=>i)}if(r=this.currentTracerContext?this.currentTracerContext(r,this):r[Ve](this),r===Xn){let i=this._yielded;if(Kn in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;else if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Xn}}}catch(i){if(!ge(r,Ve))return Sn(`Fiber.runLoop: Not a valid effect: ${String(r)}`);return this.runLoop(Sn(i))}finally{this._running=n,globalThis[Ho]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,PN;while(!0){let t=this._stack.pop();if(!t)return;let n=t[xn]&&t[xn](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,Xn}children(){return this._children??=new Set}pipe(){return ht(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&Xw(t,e))return;let n=this.getRef(rx);if(n!==this.currentScheduler)this.currentScheduler=n,this._dispatcher=void 0;this.currentSpan=gu(e,fI),this.currentLogLevel=this.getRef(xI),this.minimumLogLevel=this.getRef(vI),this.currentStackFrame=this.getRef(yI),this.maxOpsBeforeYield=this.getRef(sI),this.currentPreventYield=this.getRef(aI),this.runtimeMetrics=gu(e,gI);let o=gu(e,hI);this.currentTracerContext=o?o.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}}var PN={[$t](e,t){return lr(t._interruptedCause)},[sr](e,t){return lr(t._interruptedCause)}},bI={interruptChildren:void 0},OI=(e)=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Dw.key,e.currentStackFrame),hu(t)};var CN=(e)=>ux((t)=>{let n=e[Symbol.iterator](),o=[],r=void 0;function i(){let s=n.next();while(!s.done){if(s.value._exit){o.push(s.value._exit),s=n.next();continue}r=s.value.addObserver((a)=>{o.push(a),i()});return}t(jt(o))}return i(),DI(()=>r?.())});var _I=(e)=>Wo((t)=>{let n=OI(t),o=Su();for(let r of e)r.interruptUnsafe(t.id,n),o.push(r);return jI(CN(o))});var jt=zt,lr=ar,Yo=Vo,DI=Jt({op:"Sync",[Ve](e){let t=this[z](),n=e.getCont($t);return n?n[$t](t,e):e.yieldWith(zt(t))}}),no=Jt({op:"Suspend",[Ve](e){return this[z]()}});var PI=xu({onFailure:Yo,onSuccess:jt});var CI=Jt({op:"Yield",[Ve](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{if(t)return;e.evaluate(Br)},this[z]??0),e.yieldWith(()=>{t=!0})}}),RI=CI(0);var AI=jt(cr());var MI=(e)=>no(()=>lr(Sr(e))),Tu=(e)=>Sn(e),UI=(e)=>no(()=>Yo(Sr(e))),js=jt(void 0);var NI=(e)=>{let t=typeof e==="function"?e:e.try,n=typeof e==="function"?(o)=>new $u(o,"An error occurred in Effect.try"):e.catch;return no(()=>{try{return jt(Sr(t))}catch(o){return Yo(Sr(()=>n(o)))}})};var FI=(e)=>{let t=typeof e==="function"?e:e.try,n=typeof e==="function"?(o)=>new $u(o,"An error occurred in Effect.tryPromise"):e.catch;return zI(function(o,r){let i=(s)=>{try{o(Yo(Sr(()=>n(s))))}catch(a){o(Tu(a))}};try{Sr(()=>t(r)).then((s)=>o(jt(s)),i)}catch(s){i(s)}},t.length!==0)};var zI=Jt({op:"Async",single:!1,[Ve](e){let t=Sr(()=>this[z][0].bind(e.currentScheduler)),n=!1,o=!1,r=this[z][1]?new AbortController:void 0,i=t((s)=>{if(n)return;if(n=!0,o)e.evaluate(s);else o=s},r?.signal);if(o!==!1)return o;if(o=!0,e._yielded=()=>{n=!0},r===void 0&&i===void 0)return Xn;return e._stack.push(RN(()=>(n=!0,r?.abort(),i??Br))),Xn}}),RN=Jt({op:"AsyncFinalizer",[xn](e){if(e.interruptible)e.interruptible=!1,e._stack.push(mx)},[sr](e,t){return EI(e)?Gt(this[z](),()=>lr(e)):lr(e)}}),ux=(e)=>zI(e,e.length>=2);var AN=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0});var LI=(e,...t)=>AN(e.length,t.length===0?function(){return kI(()=>e.apply(this,arguments))}:function(){let n=kI(()=>e.apply(this,arguments));for(let o of t)n=o(n);return n}),kI=(e)=>{try{let t=e(),n=void 0;while(!0){let o=t.next(n);if(o.done)return jt(o.value);let r=o.value;if(r&&r._tag==="Success"){n=r.value;continue}else if(r&&r._tag==="Failure")return o.value;else{let i=!0;return no(()=>{if(i)return i=!1,Gt(o.value,(s)=>wI(t,s));else return no(()=>wI(e()))})}}}catch(t){return Tu(t)}},wI=Jt({op:"Iterator",single:!1,[$t](e,t){let n=this[z][0];while(!0){let o=n.next(e);if(o.done)return jt(o.value);if(!Ye(o.value))return t._stack.push(this),o.value;else if(o.value._tag==="Failure")return o.value;e=o.value.value}},[Ve](e){return this[$t](this[z][1],e)}});var jI=(e)=>Gt(e,(t)=>Br);var Gt=W(2,(e,t)=>{let n=Object.create(MN);return n[z]=e,n[$t]=t.length!==1?(o)=>t(o):t,n}),MN=jr({op:"OnSuccess",[Ve](e){return e._stack.push(this),this[z]}});var Ye=(e)=>(Kn in e),GI=W(2,(e,t)=>{if(Ye(e))return e._tag==="Success"?t(e.value):e;return Gt(e,t)});var ZI=W(2,(e,t)=>Gt(e,(n)=>jt(Sr(()=>t(n))))),BI=W(2,(e,t)=>Ye(e)?HI(e,t):ZI(e,t)),qI=W(2,(e,t)=>Ye(e)?VI(e,t):KI(e,t));var dx=(e)=>e._tag==="Success";var Br=zt(void 0),HI=W(2,(e,t)=>e._tag==="Success"?zt(t(e.value)):e),VI=W(2,(e,t)=>{if(e._tag==="Success")return e;let n=ax(e.cause);if(yu(n))return e;return Vo(t(n.success))});var Eu=W(2,(e,t)=>{let n=Object.create(UN);return n[z]=e,n[sr]=t.length!==1?(o)=>t(o):t,n}),UN=jr({op:"OnFailure",[Ve](e){return e._stack.push(this),this[z]}});var WI=W(3,(e,t,n)=>Eu(e,(o)=>{let r=t(o);return yu(r)?lr(r.failure):Sr(()=>n(r.success,o))})),JI=W(2,(e,t)=>WI(e,ax,(n)=>t(n)));var KI=W(2,(e,t)=>JI(e,(n)=>UI(()=>t(n))));var WH=jr({op:"OnSuccessAndFailure",[Ve](e){return e._stack.push(this),this[z]}});var px=(e)=>Ye(e)?zt(e):NN(e),NN=Jt({op:"Exit",[Ve](e){return e._stack.push(this),this[z]},[$t](e,t,n){return jt(n??zt(e))},[sr](e,t,n){return jt(n??ar(e))}});var FN=(e,t)=>dx(e)?t:Eu(t,(n)=>lr(cx(e.cause,n)));var zN=Jt({op:"OnExit",single:!1,[Ve](e){return e._stack.push(this),this[z][0]},[xn](e){if(e.interruptible&&this[z][2]!==!0)e._stack.push(mx),e.interruptible=!1},[$t](e,t,n){n??=zt(e);let o=this[z][1](n);return o?Gt(o,(r)=>n):n},[sr](e,t,n){n??=ar(e);let o=this[z][1](n);return o?Gt(FN(n,o),(r)=>n):n}});var YI=(e)=>Wo((t)=>{if(!t.interruptible)return e;return t.interruptible=!1,t._stack.push(mx),e}),LN=Jt({op:"SetInterruptible",[xn](e){if(e.interruptible=this[z],e._interruptedCause&&e.interruptible)return()=>lr(e._interruptedCause)}}),mx=LN(!0);var jN=Jt({op:"While",[$t](e,t){if(this[z].step(e),this[z].while())return t._stack.push(this),this[z].body();return Br},[Ve](e){if(this[z].while())return e._stack.push(this),this[z].body();return Br}});var GN=(e)=>{let{onItem:t,step:n}=e,o=(r,i,s,a)=>{for(;s<a;s++){let l=i[s],c=t(r,l,s);if(!Ye(c))return Gt(px(c),(f)=>n(r,l,f,s)??o(r,i,s+1,a)??js);let u=n(r,l,c,s);if(u)return u._tag==="Failure"?u:void 0}};return(r,i,s)=>{let a=0,l=s?.end??i.length,c=s?.concurrency??1;if(c===1)return o(r,i,0,l);let u=s?.orderedStep===!0,f=!1,h,m,y,k=!1,S,I,D=a,R=u?Array(l):void 0,M=(Ue)=>{let $e=Sn(Ue);return S=$e,f=!0,k=!0,m&&m.size>0?Gt(YI(_I(Array.from(m))),()=>$e):$e},me=(Ue,$e,rt)=>{if(!u)return n(r,Ue,$e,rt);if(S)return S;R[rt]=$e;while(D<l){let ue=R[D];if(ue===void 0)return;R[D]=void 0;let fe=D++,De=n(r,i[fe],ue,fe);if(De)return De}},Ee=()=>{let Ue=!1;for(;!S&&a<l;a++){let $e=i[a],rt=I??t(r,$e,a);if(Ye(rt)){if(S=me($e,rt,a),S)break}else if(!h)return ux((ue)=>{h=DN(),m=new Set,I=rt,y=ue;let fe;try{fe=Ee()}catch(De){return ue(M(De))}if(fe)return ue(fe);return no(()=>(S=Br,k=!0,m?_I(m):js))});else{I=void 0;let ue=ZN(h,rt,!0,!0,"inherit");if(ue._exit){if(S=me($e,ue._exit,a),S)break;continue}m.add(ue);let fe=a;if(ue.addObserver((De)=>{m.delete(ue);try{if(S){if(!k&&De._tag==="Failure")for(let Pe of De.cause.reasons)if(Pe._tag==="Interrupt")continue;else if(S._tag==="Failure")S.cause.reasons.push(Pe);else S=ar(Ms([Pe]))}else{let Pe=me($e,De,fe);if(Pe)S=Pe._tag==="Failure"?ar(Ms(Pe.cause.reasons.slice())):Pe,Ee()}if(Ue){let Pe=Ee();if(Pe)y(Pe)}else if(f&&m.size===0)y(S??js)}catch(Pe){y(M(Pe))}}),m.size<c)continue;Ue=!0,a++;return}}if(f=!0,S){if(m&&m.size>0){let $e=OI(h);m.forEach((rt)=>rt.interruptUnsafe(h.id,$e));return}if(y||S._tag==="Failure")return S}else if(y){if(!m)return Br;else if(m.size===0)y(js)}};return Ee()}},Gs=()=>GN;var ZN=(e,t,n=!1,o=!1,r=!1)=>{let i=e,s=r==="inherit"?i.interruptible:!r,a=new lx(i.context,s);if(n)a.evaluate(t);else i.currentDispatcher.scheduleTask(()=>a.evaluate(t),0);if(!o&&!a._exit)i.children().add(a),a.addObserver(()=>i._children.delete(a));return a};var XI=(e)=>(t,n)=>{let o=new lx(n?.scheduler?Qw(e,rx,n.scheduler):e,n?.uninterruptible!==!0);if(o.evaluate(t),o._exit)return o;if(n?.signal)if(n.signal.aborted)o.interruptUnsafe();else{let r=()=>o.interruptUnsafe();n.signal.addEventListener("abort",r,{once:!0}),o.addObserver(()=>n.signal.removeEventListener("abort",r))}if(n?.onFiberStart)n.onFiberStart(o);return o};var QI=(e)=>{let t=XI(e);return(n)=>{if(Ye(n))return n;let o=new bu("sync"),r=t(n,{scheduler:o});return r._dispatcher?.flush(),r._exit??Sn(new hx(r))}},eT=QI(Vy());var ox="~effect/Cause/IllegalArgumentError";class fx extends Jo("IllegalArgumentError"){[ox]=ox;constructor(e){super({message:e})}}var ix="~effect/Cause/AsyncFiberError";class hx extends Jo("AsyncFiberError"){[ix]=ix;constructor(e){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:e})}}var sx="~effect/Cause/UnknownError";class $u extends Jo("UnknownError"){[sx]=sx;constructor(e,t){super({message:t,cause:e})}}var BN="~effect/Logger",JH={[BN]:{_Message:_t,_Output:_t},pipe(){return ht(this,arguments)}};var ro={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},KH={None:[],All:[],Trace:[ro.gray],Debug:[ro.blue],Info:[ro.green],Warn:[ro.yellow],Error:[ro.red],Fatal:[ro.bgBrightRed,ro.black]};var tT=zt,yx=ar,Xo=Vo;var Qo=Br;var Ou=dx;var rT=Ns;var Du=$I;var nT=fx;var Pu="~effect/time/DateTime",Cu="~effect/time/DateTime/TimeZone",oT={[Pu]:Pu,pipe(){return ht(this,arguments)},[gn](){return this.toString()},toJSON(){return Bs(this).toJSON()}},qN={...oT,_tag:"Utc",[Ge](){return Vn(this.epochMilliseconds)},[Ze](e){return Zs(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Bs(this).toJSON()})`}},YV={...oT,_tag:"Zoned",[Ge](){return dt(Vn(this.epochMilliseconds))(Ie(this.zone))},[Ze](e){return Zs(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&ze(this.zone,e.zone)},toString(){return`DateTime.Zoned(${gT(this)})`}},iT={[Cu]:Cu,[gn](){return this.toString()}},XV={...iT,_tag:"Named",[Ge](){return Fe(`Named:${this.id}`)},[Ze](e){return bx(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},QV={...iT,_tag:"Offset",[Ge](){return Fe(`Offset:${this.offset}`)},[Ze](e){return bx(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${mT(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}};var Zs=(e)=>ge(e,Pu);var bx=(e)=>ge(e,Cu);var sT=(e)=>e._tag==="Utc";var aT=eo((e,t)=>e.epochMilliseconds===t.epochMilliseconds),cT=zy((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:e.epochMilliseconds>t.epochMilliseconds?1:0);var lT=(e)=>{let t=Object.create(qN);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},oo=(e)=>{let t=e.getTime();if(Number.isNaN(t))throw new nT("Invalid date");return lT(t)},_x=(e)=>{if(Zs(e))return e;else if(e instanceof Date)return oo(e);else if(typeof e==="object"){if("epochMilliseconds"in e)return oo(new Date(e.epochMilliseconds));let t=new Date(0);return VN(t,e),oo(t)}else if(typeof e==="string"&&!HN(e))return oo(new Date(e+"Z"));return oo(new Date(e))},HN=(e)=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e);var uT=Bw(_x);var dT=(e)=>lT(e.epochMilliseconds);var Bs=(e)=>new Date(e.epochMilliseconds),kx=(e)=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);else if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);else if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter((o)=>o.type!=="literal"),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMilliseconds=n.getTime(),n},pT=(e)=>kx(e).getTime()-wx(e),mT=(e)=>{let t=Math.abs(e),n=Math.floor(t/3600000),o=Math.round(t%3600000/60000);if(o===60)n+=1,o=0;return`${e<0?"-":"+"}${String(n).padStart(2,"0")}:${String(o).padStart(2,"0")}`},fT=(e)=>mT(pT(e)),wx=(e)=>e.epochMilliseconds;var VN=(e,t)=>{if(t.year!==void 0)e.setUTCFullYear(t.year);if(t.month!==void 0)e.setUTCMonth(t.month-1);if(t.day!==void 0)e.setUTCDate(t.day);if(t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}if(t.hour!==void 0)e.setUTCHours(t.hour);if(t.minute!==void 0)e.setUTCMinutes(t.minute);if(t.second!==void 0)e.setUTCSeconds(t.second);if(t.millisecond!==void 0)e.setUTCMilliseconds(t.millisecond)};var hT=(e)=>Bs(e).toISOString();var Sx=(e)=>{let t=kx(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${fT(e)}`},gT=(e)=>e.zone._tag==="Offset"?Sx(e):`${Sx(e)}[${e.zone.id}]`;var eW=globalThis.String;var yT=(e)=>e.trim();var xT=FI,Me=jt,Ix=AI;var Te=Yo;var Tx=MI,vT=Tu,Ex=NI;var ST=PI;var qr=Gt;var qs=px;var Hs=Eu;var Vs=eT;var ei=BI,$x=qI;var Kt=GI;var Ox=LI;var bT=Zs;var _T=sT;var kT=aT,wT=cT;var IT=oo,KN=_x;var TT=uT;var ET=dT;var $T=Bs;var OT=wx;var DT=hT;function Ws(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function PT(e){return(t)=>Ws(t)?.[e]}var Au="~structural";var Mu="~sentinels",Uu="~constructor";var CT=PT("brands");var ye=Symbol();var ur=tT,Hr=ur(ye),ot=ur(ye),Nu=(e)=>e===ye?cr():Lt(e),Px=(e)=>e._tag==="None"?Hr:ur(e.value);var Js="~effect/SchemaIssue/Issue";function Ax(e){return ge(e,Js)&&e[Js]===Js}class dr{[Js]=Js;constructor(e,t){if(t?.reportInput===!0&&e!==ye)this.input=e}}class Mx extends dr{_tag="Filter";filter;issue;constructor(e,t,n,o){super(n,o);this.filter=e,this.issue=t}}class Ux extends dr{_tag="Encoding";ast;issue;constructor(e,t,n,o){super(n,o);this.ast=e,this.issue=t}}class br extends dr{_tag="Pointer";path;issue;constructor(e,t){super();this.path=e,this.issue=t}}class Ks extends dr{_tag="MissingKey";annotations;constructor(e){super();this.annotations=e}}class Fu extends dr{_tag="UnexpectedKey";ast;constructor(e,t,n){super(t,n);this.ast=e}}class pt extends dr{_tag="Composite";ast;issues;constructor(e,t,n,o){super(n,o);this.ast=e,this.issues=t}}class Yt extends dr{_tag="InvalidType";ast;constructor(e,t,n){super(t,n);this.ast=e}}class gt extends dr{_tag="InvalidValue";annotations;constructor(e,t,n){super(t,n);this.annotations=e}}class Ys extends dr{_tag="AnyOf";ast;issues;constructor(e,t,n,o){super(n,o);this.ast=e,this.issues=t}}class Nx extends dr{_tag="OneOf";ast;successes;constructor(e,t,n,o){super(n,o);this.ast=e,this.successes=t}}function Rx(e,t,n){if(Ax(e))return e;if(typeof e==="string")return new gt({message:e},t,n);let o=typeof e.issue==="string"?new gt({message:e.issue},t,n):e.issue;return new br(e.path,o)}function RT(e,t,n){if(e===void 0)return;if(typeof e==="boolean")return e?void 0:new gt(void 0,t,n);return Rx(e,t,n)}function AT(e,t,n,o){if(Array.isArray(t)){if(!vu(t))return;return t.length===1?Rx(t[0],n,o):new pt(e,rI(t,(r)=>Rx(r,n,o)),n,o)}return RT(t,n,o)}function Xs(e){let t;for(let n of e.reasons){if(!rT(n)||!Ax(n.error))return;t??=n.error}return t}function zu(e,t){let n=Xs(e);if(n===void 0)throw Error(t,{cause:e});return n}class io extends Hn{run;constructor(e){super();this.run=e}map(e){return new io((t,n)=>this.run(t,n).pipe(ei(mu(e))))}compose(e){if(UT(this))return e;if(UT(e))return this;return new io((t,n)=>this.run(t,n).pipe(Kt((o)=>e.run(o,n))))}}var NT=new io(Me);function UT(e){return e.run===NT.run}function Vr(){return NT}function XN(e){return new io((t,n)=>bn(t)?Ix:e(t.value,n))}function it(e){return Fx(mu(e))}function Qs(e){return XN((t,n)=>e(t,n).pipe(ei(Lt)))}function Fx(e){return new io((t)=>Me(e(t)))}function zx(e){return new io((t)=>{let n=fu(t,xy);return jy(n)?Me(n):ei(e,Lt)})}function Lu(){return it(globalThis.String)}function ju(){return it(globalThis.Number)}function FT(){return it(yT)}function zT(){return it(wu)}function LT(){return Qs((e,t)=>$x(ST(Iu(e)),()=>new gt({expected:"a valid Base64 string"},e,t)))}var ta="~effect/SchemaTransformation/Transformation";class mt{[ta]=ta;_tag="Transformation";decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new mt(this.encode,this.decode)}compose(e){return new mt(this.decode.compose(e.decode),e.encode.compose(this.encode))}}function oF(e){return ge(e,ta)&&e[ta]===ta}var Lx=(e)=>{if(oF(e))return e;return new mt(e.decode,e.encode)};function ri(e){return new mt(Qs(e.decode),Qs(e.encode))}function so(e){return new mt(it(e.decode),it(e.encode))}function jT(){return new mt(FT(),Vr())}var iF=new mt(Vr(),Vr());function Gu(){return iF}var Zu=new mt(ju(),Lu());var sF=(e)=>Bo(e)&&typeof e.message==="string",aF=(e)=>{let n=Object.hasOwn(e,"cause")?Error(e.message,{cause:GT(e.cause)}):Error(e.message);if(typeof e.name==="string"&&e.name!=="Error")n.name=e.name;if(typeof e.stack==="string")n.stack=e.stack;return n},cF=(e)=>{try{let t=Oy(e);return t===void 0?re(e):JSON.parse(t)}catch{return re(e)}},lF=(e,t,n)=>{let o={name:e.name,message:typeof e.message==="string"?e.message:""};if(t?.includeStack&&typeof e.stack==="string")o.stack=e.stack;if(!t?.excludeCause&&e.cause!==void 0)o.cause=n(e.cause);return o},uF=(e)=>{let t=new WeakSet,n=(o)=>{if(vw(o)){if(t.has(o))return"[Circular]";t.add(o);let r=lF(o,e,n);return t.delete(o),r}return cF(o)};return n},GT=(e)=>sF(e)?aF(e):e;var ZT=(e)=>so({decode:GT,encode:uF(e)});var BT=ri({decode:(e,t)=>URL.canParse(e)?Me(new URL(e)):Te(new gt({expected:"a valid URL string"},e,t)),encode:(e)=>Me(e.href)});var qT=new mt(LT(),zT());var HT=ri({decode:(e,t)=>Gy(TT(e),{onNone:()=>Te(new gt({expected:"a valid UTC DateTime string"},e,t)),onSome:(n)=>Me(ET(n))}),encode:(e)=>Me(DT(e))});function Tn(e){return(t)=>t._tag===e}var aa=Tn("Declaration");var hF=Tn("Never");var ni=Tn("Literal"),jx=Tn("UniqueSymbol");var eE=Tn("Arrays"),gF=Tn("Objects"),tE=Tn("Union"),yF=Tn("Suspend");class yt{to;transformation;constructor(e,t){this.to=e,this.transformation=t}}var Hu={};class In{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,o=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=o}}var VT="~effect/Schema";class Ot{[VT]=VT;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,o=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=o}toString(){return`<${this._tag}>`}}class co extends Ot{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,o,r,i,s,a){super(n,o,r,i);this.typeParameters=e,this.run=t,this.encodingChecks=s,this.encodingRun=a}getParser(){let e;return(t,n)=>{if(t===ye)return Hr;return(e??=this.run(this.typeParameters))(t,this,n)}}_rebuild(e,t,n,o,r){let i=si(this.typeParameters,e);return i===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&o===this.run&&r===this.encodingRun?this:new co(i,o,this.annotations,t,void 0,this.context,n,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;if(typeof e==="string")return e;return"<Declaration>"}}class rE extends Ot{_tag="Null";getParser(){return rv(this,null)}getExpected(){return"null"}}var Hx=new rE;class nE extends Ot{_tag="Undefined";getParser(){return rv(this,void 0)}toCodecJson(){return Zt(this,[xF])}getExpected(){return"undefined"}}var xF=new yt(Hx,new mt(it(()=>{return}),it(()=>null))),Vx=new nE;class oE extends Ot{_tag="Any";getParser(){return li(this,Sy)}getExpected(){return"any"}}var iE=new oE;class sE extends Ot{_tag="Unknown";getParser(){return li(this,Sy)}getExpected(){return"unknown"}}var oa=new sE;class ao extends Ot{_tag="Literal";literal;constructor(e,t,n,o,r){super(t,n,o,r);if(typeof e==="number"&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${re(e)}`);this.literal=e}getParser(){return rv(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==="bigint"?WT(this):this}toCodecStringTree(){return typeof this.literal==="string"?this:WT(this)}getExpected(){return typeof this.literal==="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}}function WT(e){let t=globalThis.String(e.literal);return Zt(e,[new yt(new ao(t),new mt(it(()=>e.literal),it(()=>t)))])}class aE extends Ot{_tag="String";getParser(){return li(this,Es)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&$n(n,e,void 0,this,t)?void 0:e}getExpected(){return"string"}}var ia=new aE;class cE extends Ot{_tag="Number";getParser(){return li(this,yy)}matchKey(e,t){return this._match(CF,e,t)}matchPart(e,t){return this._match(qx,e,t)}_match(e,t,n){if(!e.test(t))return;let o=globalThis.Number(t);if(n.disableChecks||!this.checks)return o;return $n(this.checks,o,void 0,this,n)?void 0:o}toCodecJson(){if(this.checks&&(Gx(this.checks,"effect/schema/isFinite")||Gx(this.checks,"effect/schema/isInt")))return this;return Zt(this,[wF])}toCodecStringTree(){if(this.toCodecJson()===this)return Zt(this,[RF]);return Zt(this,[AF])}getExpected(){return"number"}}function Gx(e,t){return e.some((n)=>n.annotations?.representation?.id===t||n._tag==="FilterGroup"&&Gx(n.checks,t))}var Wx=new cE;class lE extends Ot{_tag="Boolean";getParser(){return li(this,yw)}getExpected(){return"boolean"}}var uE=new lE;class ai extends Ot{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,n,o,r,i,s,a){super(o,r,i,s);this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=a;let l=!1;for(let c=0;c<t.length;c++)if(_r(t[c]))l=!0;else if(l)throw Error("A required element cannot follow an optional element. ts(1257)");if(l&&n.length>1)throw Error("A required element cannot follow an optional element. ts(1257)");for(let c=1;c<n.length;c++)if(_r(n[c]))throw Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let n=this,o,r,i=n.elements.length,s=Math.max(0,n.rest.length-1);function a(l,c){if(c<i)return o[c];else if(c>=l)return r[c-l+1];return r[0]}return Ox(function*(l,c){if(l===ye)return ye;if(!Array.isArray(l))return yield*Te(new Yt(n,l,c));if(!o)o=n.elements.map((y)=>({ast:y,parser:t(y)})),r=n.rest.map((y)=>({ast:y,parser:t(y)}));let u=l.length,f={ast:n,getParser:a,input:l,len:u,tailThreshold:Math.max(i,u-s),output:new globalThis.Array(u),issues:void 0,options:c},h=Jx(c?.concurrency),m=vF(f,l,{concurrency:h?.concurrency,end:n.rest.length===0?i:Math.max(u,i+s)});if(m)yield*m;if(n.rest.length===0&&u>i)for(let y=i;y<=u-1;y++){let k=new Fu(n,l[y],c),S=new br([y],k);if(c.errors==="all")if(f.issues)f.issues.push(S);else f.issues=[S];else return yield*Te(new pt(n,[S],l,c))}if(f.issues)return yield*Te(new pt(n,f.issues,l,c));return f.output})}_rebuild(e,t,n){let o=si(this.elements,e),r=si(this.rest,e);return o===this.elements&&r===this.rest&&t===this.checks&&n===this.encodingChecks?this:new ai(this.isMutable,o,r,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}}var vF=Gs()({onItem(e,t,n){let o=n<e.len?t:ye;return e.getParser(e.tailThreshold,n).parser(o,e.options)},step(e,t,n,o){if(n._tag==="Failure")return Bu(e,e.ast,o,n);let r=n===ot?t:n[z];if(r!==ye)e.output[o]=r;else{let i=e.getParser(e.tailThreshold,o);if(_r(i.ast))return;let s=new br([o],new Ks(i.ast.context?.annotations));if(e.options.errors==="all")if(e.issues)e.issues.push(s);else e.issues=[s];else return Xo(new pt(e.ast,[s],e.input,e.options))}}}),Jx=(e)=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),Bu=(e,t,n,o)=>{if(o.cause.reasons.length===0)return o;let r=Xs(o.cause);if(r===void 0)return yx(Du(o.cause,(s)=>new pt(t,[new br([n],s)],e.input,e.options)));let i=new br([n],r);if(e.options.errors==="all")if(e.issues)e.issues.push(i);else e.issues=[i];else return Xo(new pt(t,[i],e.input,e.options))},dE="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function oi(e,t,n=Hu){let o,r;function i(s){switch(s._tag){case"String":case"TemplateLiteral":return(o??=Object.keys(e)).filter((a)=>s.matchPart(a,n)!==void 0);case"Number":return(o??=Object.keys(e)).filter((a)=>s.matchKey(a,n)!==void 0);case"Symbol":return(r??=Object.getOwnPropertySymbols(e)).filter((a)=>s.matchKey(a,n)!==void 0);case"Union":return[...new Set(s.types.flatMap(i))];default:return[]}}return i(nv(ua(t)))}class Vu{name;type;constructor(e,t){this.name=e,this.type=t}}function Zx(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(Zx);default:return!1}}function SF(e){return Zx(e)&&Zx(ua(e))}class Kx{parameter;type;constructor(e,t){if(!SF(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,_r(t)&&!EE(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}class ca extends Ot{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,o,r,i,s){super(n,o,r,i);this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=s;let a=e.map((l)=>l.name).filter((l,c,u)=>u.indexOf(l)!==c);if(a.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(a)}. ts(2300)`)}getParser(e,t=e){let n=this,o=[];for(let S of n.propertySignatures)o.push(S.name);let r=o.length,i=n.indexSignatures.length,s=r&&i?new Set(o):void 0;if(!r&&!i)return li(n,vy);let a,l,c=(S,I,D,R,M)=>{if(M._tag==="Failure")return Bu(S,n,I,M)??Qo;let me=M===ot?R:M[z];if(D!==ye&&me!==ye){if(r&&(s.has(I)||s.has(D)))return Qo;Ft(S.out,D,me)}return Qo},u=(S,I,D,R)=>{if(!R){let Ue=D.parserKey(I,S.options);if(!Ye(Ue))return qr(qs(Ue),($e)=>u(S,I,D,$e));R=Ue}if(R._tag==="Failure")return Bu(S,n,I,R)??Qo;let M=R===ot?I:R[z],me=S.input[I],Ee=D.parserValue(me,S.options);return Ye(Ee)?c(S,I,M,me,Ee):qr(qs(Ee),(Ue)=>c(S,I,M,me,Ue))},f=(S,I,D)=>{let R=S.input[I],M=D.parserValue(R,S.options);return Ye(M)?c(S,I,I,R,M):qr(qs(M),(me)=>c(S,I,I,R,me))},h=i?Gs()({onItem:(S,[I,D])=>u(S,I,D),step:(S,I,D)=>D._tag==="Failure"?D:void 0}):void 0,m=()=>{if(!a)a=n.propertySignatures.map((S)=>({parser:t(S.type),name:S.name,type:S.type})),l=i?n.indexSignatures.map((S)=>({is:S,parserKey:e(nv(S.parameter)),parserValue:t(S.type)})):void 0;return a},y=Ox(function*(S,I){if(S===ye)return ye;if(!(typeof S==="object"&&S!==null&&!Array.isArray(S)))return yield*Te(new Yt(n,S,I));m();let D=S,R={},M={ast:n,input:D,out:R,issues:void 0,options:I},me=I.errors==="all",Ee=I.onExcessProperty==="error",Ue=I.onExcessProperty==="preserve",$e;if(!i&&(Ee||Ue)){s??=new Set(o),$e=Reflect.ownKeys(D);for(let ue=0;ue<$e.length;ue++){let fe=$e[ue];if(!s.has(fe))if(Ee){let De=new Fu(n,D[fe],I),Pe=new br([fe],De);if(me){if(M.issues)M.issues.push(Pe);else M.issues=[Pe];continue}else return yield*Te(new pt(n,[Pe],S,I))}else Ft(R,fe,D[fe])}}let rt=Jx(I?.concurrency);if(r){let ue=JT(M,a,rt);if(ue)yield*ue}if(i&&!rt)for(let ue=0;ue<i;ue++){let fe=l[ue],De=fe.is.parameter===ia?f:u,Pe=fe.is.parameter===ia?Object.keys(D):oi(D,fe.is.parameter,I);for(let $r=0;$r<Pe.length;$r++){let Qt=De(M,Pe[$r],fe);if(!Ye(Qt))yield*Qt;else if(Qt._tag==="Failure")return yield*Qt}}else if(h){let ue=Su();for(let De=0;De<i;De++){let Pe=l[De],$r=oi(D,Pe.is.parameter,I);for(let Qt=0;Qt<$r.length;Qt++)ue.push([$r[Qt],Pe])}let fe=h(M,ue,rt);if(fe)yield*fe}if(M.issues)return yield*Te(new pt(n,M.issues,S,I));if(I.propertyOrder==="original"){let ue=($e??Reflect.ownKeys(D)).concat(o),fe={};for(let De of ue)if(Object.hasOwn(R,De))Ft(fe,De,R[De]);return fe}return R});if(i)return y;let k=(S,I,D)=>{let R=a[I];return qr(qs(D),(M)=>{let me=Bx(S,R,M);if(me)return me;let Ee=()=>ur(S.out),Ue=JT(S,a.slice(I+1));return Ue?Kt(Ue,Ee):Ee()})};return(S,I)=>{if(S===ye)return Hr;if(I.errors==="all"||I.onExcessProperty!==void 0||I.propertyOrder==="original"||I.concurrency!==void 0)return y(S,I);if(!(typeof S==="object"&&S!==null&&!Array.isArray(S)))return Te(new Yt(n,S,I));let D=m(),R=S,M={},me={ast:n,input:R,out:M,issues:void 0,options:I};try{for(let Ee=0;Ee<D.length;Ee++){let Ue=D[Ee],$e=Ue.name,rt=Object.hasOwn(R,$e),ue=rt?R[$e]:ye,fe=Ue.parser(ue,I);if(!Ye(fe))return k(me,Ee,fe);if(fe===ot){if(rt)Ft(M,$e,ue);continue}let De=Bx(me,Ue,fe);if(De)return De}}catch(Ee){return vT(Ee)}return ur(M)}}_rebuild(e,t,n,o){let r=si(this.propertySignatures,(s)=>{let a=e(s.type);return a===s.type?s:new Vu(s.name,a)}),i=si(this.indexSignatures,(s)=>{let a=t(s.parameter),l=e(s.type);return a===s.parameter&&l===s.type?s:new Kx(a,l)});return r===this.propertySignatures&&i===this.indexSignatures&&n===this.checks&&o===this.encodingChecks?this:new ca(r,i,this.annotations,n,void 0,this.context,o)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){if(this.propertySignatures.length===0&&this.indexSignatures.length===0)return"object | array";return"object"}}function Bx(e,t,n){if(n._tag==="Failure")return Bu(e,e.ast,t.name,n);if(n===ot)return;let o=n[z];if(o!==ye){Ft(e.out,t.name,o);return}if(delete e.out[t.name],!_r(t.type)){let r=new br([t.name],new Ks(t.type.context?.annotations));if(e.options.errors==="all"){if(e.issues)e.issues.push(r);else e.issues=[r];return}else return Xo(new pt(e.ast,[r],e.input,e.options))}}var JT=Gs()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(ye,e.options);let n=e.input[t.name];return Ft(e.out,t.name,n),t.parser(n,e.options)},step:Bx});function Yx(e,t){if(!e)return t;if(!t)return e;return[...e,...t]}function Wu(e,t,n){return new ca(Reflect.ownKeys(e).map((o)=>new Vu(o,e[o].ast)),[],n,t)}function Ju(e){return e.ast}function Xx(e,t=void 0){return new ai(!1,e.map((n)=>n.ast),[],void 0,t)}function Ku(e,t,n){return new En(e.map(Ju),t,void 0,n)}function pE(e,t){if(e.encoding||t.some((i)=>i.encoding))throw Error("StructWithRest does not support encodings");let{propertySignatures:n,indexSignatures:o,checks:r}=e;for(let i of t)n=n.concat(i.propertySignatures),o=o.concat(i.indexSignatures),r=Yx(r,i.checks);return new ca(n,o,void 0,r)}var Yu=Go((e)=>{while(!0){if(yF(e))return oa;let t=e.encoding;if(!t)return e.recur?.(Yu,_t)??e;if(t.some((n)=>n.transformation._tag==="Middleware"&&n.transformation.decode!==_t))return oa;e=t[t.length-1].to}});function mE(e){switch(e._tag){case"Null":return["null"];case"Undefined":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(mE)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function ii(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[Mu];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap((t)=>{let n=t.type;if(!_r(n)){if(ni(n))return[{key:t.name,literal:n.literal}];if(jx(n))return[{key:t.name,literal:n.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,n)=>{if(!_r(t)){if(ni(t))return[{key:n,literal:t.literal}];if(jx(t))return[{key:n,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map((n)=>ii(Yu(n)));return t[0].filter((n)=>t.every((o)=>o.some((r)=>r.key===n.key&&r.literal===n.literal)))}case"Suspend":return ii(e.thunk())}}var KT=new WeakMap,na=Object.freeze([]);function bF(e){let t=KT.get(e);if(t)return t;let n,o=0,r,i,s=!0;for(let a=0;a<e.length;a++){let l=e[a],c=Yu(l);if(hF(c))continue;if(s)if(ni(c)||jx(c)){i??=new Map;let f=ni(c)?c.literal:c.symbol,h=i.get(f);if(!h)i.set(f,h=[]);h.push(l)}else s=!1;let u=ii(c);if(u.length){n??=new Map,o++;for(let{key:f,literal:h}of u){let m=n.get(f);if(!m)n.set(f,m=[new Map,new Set]);m[1].add(a);let y=m[0].get(h);if(!y)m[0].set(h,y=new Set);y.add(a)}}else{r??={};let f=mE(c);for(let h of f)(r[h]??=[]).push(a)}}if(s&&i)i.forEach(Object.freeze),t=(a)=>i.get(a)??na;else if(n?.size===1&&!r){let[a,[l]]=n.entries().next().value,c=l;for(let[u,f]of l)c.set(u,Object.freeze(Array.from(f,(h)=>e[h])));t=(u,f)=>{if(Ql(u)){let h=Object.hasOwn(u,a)?u[a]:void 0;if(h!==void 0)return c.get(h)??na;if(f)return e}return na}}else if(n){let a;for(let l of n)if((!a||l[1][0].size>a[1][0].size)&&l[1][1].size===o)a=l;t=(l,c)=>{let u=l===null?"null":Array.isArray(l)?"array":typeof l,f=r?.[u]??na;if(!Ql(l))return f.map((y)=>e[y]);let h=new Set(f),m;if(a){let[y,[k]]=a,S=Object.hasOwn(l,y),I=S?l[y]:void 0;if(S&&(!c||I!==void 0)){let D=k.get(I);if(!D)return f.map((R)=>e[R]);for(let R of D)h.add(R);m=y}}if(m===void 0)for(let[y,[k,S]]of n){let I=Object.hasOwn(l,y),D=I?l[y]:void 0;if(I&&(!c||D!==void 0)){let R=k.get(D);if(R)for(let M of R)h.add(M)}else if(c)for(let R of S)h.add(R)}for(let[y,[k,S]]of n){if(y===m)continue;let I=Object.hasOwn(l,y),D=I?l[y]:void 0;if(I&&(!c||D!==void 0)){let R=k.get(D);for(let M of h)if(S.has(M)&&!R?.has(M))h.delete(M)}}return Array.from(h).sort((y,k)=>y-k).map((y)=>e[y])}}else t=(a)=>{let l=a===null?"null":Array.isArray(a)?"array":typeof a;return(r?.[l]??na).map((c)=>e[c]).filter(_F(a))};return KT.set(e,t),t}function _F(e){return(t)=>{let n=Yu(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function Xu(e,t,n=!1){return bF(t)(e,n)}class En extends Ot{_tag="Union";types;mode;encodingChecks;constructor(e,t,n,o,r,i,s){super(n,o,r,i);this.types=e,this.mode=t,this.encodingChecks=s}getParser(e,t){let n=this;return(o,r)=>{if(o===ye)return Hr;let i=Xu(o,n.types,t!==void 0);if(i.length===1){let c=e(i[0])(o,r);if(c._tag==="Success")return c;return Ye(c)?YT(n,c.cause,o,r):Hs(c,(u)=>YT(n,u,o,r))}let s={ast:n,compile:e,input:o,out:void 0,successes:n.mode==="oneOf"?[]:void 0,issues:void 0,options:r},a=Jx(r?.concurrency),l=kF(s,i,a?{...a,orderedStep:!0}:void 0);if(!l){if(s.out)return s.out;return Te(new Ys(n,s.issues??[],o,r))}return Kt(l,(c)=>{if(s.out===ot)return Me(o);if(s.out)return s.out;return Te(new Ys(n,s.issues??[],o,r))})}}_rebuild(e,t,n){let o=si(this.types,e);return o===this.types&&t===this.checks&&n===this.encodingChecks?this:new En(o,this.mode,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let o=n.matchPart(e,t);if(o!==void 0)return o}return}getExpected(e){let t=this.annotations?.expected;if(typeof t==="string")return t;if(this.types.length===0)return"never";let n=this.types.map((o)=>{let r=ua(o);switch(r._tag){case"Arrays":{let i=r.elements.filter(ni);if(i.length>0)return`${XT(r.isMutable)}[ ${i.map((s)=>e(s)+QT(s.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let i=r.propertySignatures.filter((s)=>ni(s.type));if(i.length>0)return`{ ${i.map((s)=>`${XT(s.type.context?.isMutable)}${Os(s.name)}${QT(s.type.context?.isOptional)}: ${e(s.type)}`).join(", ")}, ... }`;break}}return e(r)});return Array.from(new Set(n)).join(" | ")}}function YT(e,t,n,o){let r=Xs(t);if(!r)return yx(t);return Xo(new Ys(e,[r],n,o))}var kF=Gs()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag==="Failure"){let o=Xs(n.cause);if(o===void 0)return n;if(e.issues)e.issues.push(o);else e.issues=[o]}else{if(e.out&&e.successes)return e.successes.push(t),Xo(new Nx(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return Qo}}}),fE=new En([new ao("Infinity"),new ao("-Infinity"),new ao("NaN")],"anyOf");function XT(e){return e?"":"readonly "}function QT(e){return e?"?":""}function Qu(e){let t=!1,n;return()=>{if(t)return n;return n=e(),t=!0,n}}class ed extends Ot{_tag="Suspend";thunk;constructor(e,t,n,o,r){if(n)throw Error("Cannot add checks to Suspend");super(t,void 0,o,r);this.thunk=Qu(e)}getParser(e){let t;return(n,o)=>(t??=e(this.thunk()))(n,o)}recur(e){return new ed(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}}class qu extends Hn{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,n=!1){super();this.run=e,this.annotations=t,this.aborted=n}annotate(e){return new qu(this.run,{...this.annotations,...e},this.aborted)}abort(){return new qu(this.run,this.annotations,!0)}and(e,t){return new sa([this,e],t)}}class sa extends Hn{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super();this.checks=e,this.annotations=t}annotate(e){return new sa(this.checks,{...this.annotations,...e})}and(e,t){return new sa([this,e],t)}}function td(e,t,n=!1){return new qu((o,r,i)=>AT(r,e(o,r,i),o,i),t,n)}function hE(e){return td((t)=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var Qx=lo(Wx,[hE()]),wF=new yt(new En([Qx,fE],"anyOf"),new mt(ju(),it((e)=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function ev(e,t){let n=e.source,o=new globalThis.RegExp(n,e.flags);return td((r)=>(o.lastIndex=0,o.test(r)),{expected:`a string matching the RegExp ${n}`,representation:{id:"effect/schema/isPattern",payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function la(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}var gE=new WeakMap;function IF(e){return gE.get(e)??e}function Zt(e,t){if(e.encoding===t)return e;return la(e,(n)=>{n.encoding.value=t})}function tv(e,t){if(e.context===t)return e;let n=IF(e);if(n.context===t)return n;let o=la(e,(r)=>{r.context.value=t});return gE.set(o,n),o}function ci(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return yE(e,Qy(e.checks.slice(0,-1),n.annotate(t)))}return la(e,(n)=>{n.annotations.value={...n.annotations.value,...t}})}function yE(e,t){if(e._tag==="Suspend"&&t)throw Error("Cannot add checks to Suspend");if(e.checks===t)return e;return la(e,(n)=>{n.checks.value=t})}function lo(e,t){return yE(e,Yx(e.checks,t))}function xE(e,t){let n=t(e.to);return n===e.to?e:new yt(n,e.transformation)}function vE(e,t){let n=e,o=n[n.length-1],r=xE(o,t);return r===o?e:Qy(e.slice(0,e.length-1),r)}function TF(e){return(t)=>t.encoding?Zt(t,vE(t.encoding,e)):t}function SE(e,t){function n(o){if(o.encoding){let r=o.encoding[o.encoding.length-1];return t?.stopAt?.(r)?o:Zt(o,vE(o.encoding,n))}return e(o)}return Go(n)}function EF(e,t,n){let o=new yt(e,t);return Zt(n,n.encoding?[...n.encoding,o]:[o])}function bE(e,t){let n=CT(e),o=n?[...n,t]:[t];return ci(e,{brands:o})}function si(e,t){let n=!1,o=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r],s=t(i);if(s!==i)n=!0;o[r]=s}return n?o:e}function rd(e,t){let n=e.context?new In(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new In(!1,!1,void 0,t);return tv(e,n)}var nd=Go((e)=>{let t=e.context?e.context.isOptional===!1?new In(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new In(!0,!1);return $F(tv(e,t))}),$F=TF(nd),_E=Lr((e)=>nd(new En([e,Vx],"anyOf")));function kE(e,t){let n=new mt(zx(t),Vr()),o=new yt(oa,n),r=e.context?new In(e.context.isOptional,e.context.isMutable,o,e.context.annotations):new In(!1,!1,o);return tv(e,r)}function wE(e,t,n){return EF(e,n,t)}function OF(e){let t=[],n=[];function o(r){switch(r._tag){case"Literal":if(Xl(r.literal))t.push(r.literal);return;case"UniqueSymbol":t.push(r.symbol);return;case"Never":return;case"Union":for(let i=0;i<r.types.length;i++)o(r.types[i]);return;default:n.push(r)}}return o(e),{literals:t,parameters:n}}function IE(e,t){let{literals:n,parameters:o}=OF(e);return new ca(n.map((r)=>new Vu(r,t)),o.map((r)=>new Kx(r,t)))}function _r(e){return e.context?.isOptional??!1}function TE(e){return e.annotations?.[Au]===!0||e._tag==="FilterGroup"&&e.checks.every(TE)}function DF(e){function t(o){if(TE(o))return[o];return o._tag==="FilterGroup"?o.checks.flatMap(t):[]}let n=e.flatMap(t);return ex(n)?n:void 0}var kr=Go((e)=>{if(e.encoding)return kr(Zt(e,void 0));let t=e,n=t.recur?.(kr)??t,o=n.encodingChecks;if(o){let r=n===e?o:eE(n)||gF(n)||aa(n)&&n.typeParameters.length>0?DF(o):void 0;return la(n,(i)=>{i.encodingChecks.value=void 0,i.checks.value=Yx(n.checks,r)})}return n}),ua=Go((e)=>kr(wn(e)));function PF(e,t){let n=t,o=n.length,r=n[o-1],i=[new yt(wn(Zt(e,void 0)),n[0].transformation.flip())];for(let a=1;a<o;a++)i.unshift(new yt(wn(n[a-1].to),n[a].transformation.flip()));let s=wn(r.to);if(s.encoding)return Zt(s,[...s.encoding,...i]);else return Zt(s,i)}var wn=Lr((e)=>{if(e.encoding)return PF(e,e.encoding);let t=e;return t.flip?.(wn)??t.recur?.(wn)??t});function EE(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(EE);default:return!1}}function rv(e,t){let n=ur(t);return(o,r)=>{if(o===ye)return Hr;if(o===t)return n;return Te(new Yt(e,o,r))}}function li(e,t){return(n,o)=>{if(n===ye)return Hr;if(t(n))return ot;return Te(new Yt(e,n,o))}}var nv=SE((e)=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(nv)}});var qx=new globalThis.RegExp(`^${dE}$`),CF=new globalThis.RegExp(`^(?:${dE}|Infinity|-Infinity|NaN)$`);function $E(e){return ev(qx,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:qx.source}),...e})}var OE=lo(ia,[$E()]),RF=new yt(OE,Zu),AF=new yt(new En([OE,fE],"anyOf"),Zu),MF="-?\\d+",i9=new globalThis.RegExp(`^${MF}$`);var UF="Symbol\\((.*)\\)",s9=new globalThis.RegExp(`^${UF}$`);function $n(e,t,n,o,r){for(let i=0;i<e.length;i++){let s=e[i];if(s._tag==="FilterGroup"){if(n=$n(s.checks,t,n,o,r),n&&(r.errors!=="all"||n[n.length-1].filter.aborted))return n}else{let a=s.run(t,o,r);if(a){let l=new Mx(s,a,t,r);if(n)n.push(l);else n=[l];if(r.errors!=="all"||s.aborted)return n}}}return n}function DE(e){if(!aa(e))return;let t=e.annotations?.[Uu];return Zo(t)?t(e.typeParameters):void 0}function NF(e){return e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&globalThis.Number.isFinite(e)}function FF(e){return e===void 0||typeof e==="string"}function PE(e,t){let n=new WeakMap,o=[];e:while(!0){if(typeof e!=="object"||e===null){if(!t(e))return!1}else{let r=e,i=n.get(r);if(i===!1)return!1;if(i===void 0){let s=Array.isArray(r);if(!s){let a=Object.getPrototypeOf(r);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}n.set(r,!1),o.push({value:r,keys:s?r.length:Object.keys(r),index:0})}}while(o.length>0){let r=o[o.length-1],i=r.keys;if(typeof i==="number"){if(r.index<i){e=r.value[r.index++];continue e}}else if(r.index<i.length){e=r.value[i[r.index++]];continue e}n.set(r.value,!0),o.pop()}return!0}}function zF(e){return PE(e,NF)}var CE=new co([],()=>(e,t,n)=>zF(e)?ot:Te(new Yt(t,e,n)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{return},toCodecStringTree:()=>RE,toArbitrary:()=>(e)=>e.jsonValue()});function LF(e){return PE(e,FF)}var jF=new co([],()=>(e,t,n)=>LF(e)?ot:Te(new Yt(t,e,n)),{expected:"StringTree",toCodecStringTree:()=>{return}}),RE=new yt(jF,Gu());function id(e){let t=NE(cd,kr(e.ast));return(n,o)=>t(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function sd(e){let t=id(e);return(n,o)=>{let r=Vs(t(n,o));if(Ou(r))return Lt(r.value);return zu(r.cause,"Option adapter can only return none for schema issues"),cr()}}function ME(e){let t=id(e);return(n,o)=>{let r=Vs(t(n,o));if(Ou(r))return r.value;let i=zu(r.cause,"Constructor adapter can only throw schema issues");throw Error("Schema validation failed",{cause:i})}}function UE(e){return ad(e.ast)}function ad(e){let t=BF(ZF(kr(e)));return(n)=>{let o=t(n,Hu);if(Ou(o))return!0;return zu(o.cause,"Type guard adapter can only return false for schema issues"),!1}}var ov=(e,t)=>t?{...e,...t}:e,AE=(e)=>{if(e===ye)return Te(new gt);return Me(e)};function ZF(e){return NE(FE,e)}function NE(e,t){let n;return(o,r)=>{let i=(n??=e(t))(o,r??Hu);if(i===ot)return Me(o);if(!Ye(i))return Kt(i,AE);return i[z]===ye?AE(ye):i}}function BF(e){return(t,n)=>Vs(e(t,n))}var FE=Lr((e)=>iv(e,FE)),cd=Lr((e)=>iv(e,cd,zE)),qF=Lr((e)=>iv(e,cd,zE,e.context?.constructorDefault));function zE(e){return e.context?.constructorDefault?qF(e):cd(e)}function LE(e,t,n,o){let r;if(Ye(e)&&e._tag==="Success"){let i=Nu(e===ot?t:e[z]);r=n._tag==="Transformation"?n.decode.run(i,o):n.decode(ur(i),o)}else if(n._tag==="Transformation")r=Kt(e,(i)=>n.decode.run(Nu(i),o));else r=n.decode(ei(e,Nu),o);return Ye(r)&&r._tag==="Success"?Px(r[z]):Kt(r,Px)}function HF(e,t){let n;return(o,r)=>{if(o===ye)return Hr;if(e.isConstructed(o))return ot;let i=(n??=t(e.link.to))(o,r);return LE(i,o,e.link.transformation,r)}}function iv(e,t,n,o){let r=n?DE(e):void 0,i=r?HF(r,t):e.getParser(t,n),s=e.checks,a=o?e.encoding?[...e.encoding,o]:[o]:e.encoding,l=e.encodingChecks,c=(s?s[s.length-1].annotations:e.annotations)?.parseOptions;if(!a&&!s&&!l){if(!c)return i;return(h,m)=>i(h,ov(m,c))}let u,f=(h,m)=>{let y=i(h,m);if(l&&!m.disableChecks)if(Ye(y)){if(y._tag==="Success"){let k=y===ot?h:y[z];if(h!==ye&&k!==ye){let S=$n(l,h,void 0,e,m);if(S)y=Te(new pt(e,S,h,m))}}}else y=qr(y,(k)=>{if(h!==ye&&k!==ye){let S=$n(l,h,void 0,e,m);if(S)return Te(new pt(e,S,h,m))}return Me(k)});if(s&&!m.disableChecks)if(Ye(y)){if(y._tag==="Success"){let k=y===ot?h:y[z];if(k===ye)return y;let S=$n(s,k,void 0,e,m);if(S)y=Te(new pt(e,S,k,m))}}else y=qr(y,(k)=>{if(k!==ye){let S=$n(s,k,void 0,e,m);if(S)return Te(new pt(e,S,k,m))}return Me(k)});return y};if(!a)return c?(h,m)=>f(h,ov(m,c)):f;return(h,m)=>{if(c)m=ov(m,c);let y=u??=a.map((I)=>t(I.to)),k=h,S=y[y.length-1](h,m);for(let I=a.length-1;I>=0;I--)if(S=LE(S,k,a[I].transformation,m),I!==0){let D=y[I-1];if(S._tag==="Success")k=S[z],S=D(k,m);else S=Kt(S,(R)=>{let M=D(R,m);return M===ot?ur(R):M})}if(S._tag==="Success"){let I=S[z],D=f(I,m);return D===ot?S:D}return S=Hs(S,(I)=>Tx(()=>Du(I,(D)=>new Ux(e,D,h,m)))),Kt(S,(I)=>{let D=f(I,m);return D===ot?ur(I):D})}}var ld="~effect/Schema/Schema";var VF={[ld]:ld,pipe(){return ht(this,arguments)},annotate(e){return this.rebuild(ci(this.ast,e))},annotateKey(e){return this.rebuild(rd(this.ast,e))},check(...e){return this.rebuild(lo(this.ast,e))}};function av(e,t){function n(){}let o=Object.defineProperties(Object.setPrototypeOf(n,VF),Object.getOwnPropertyDescriptors({...t}));return o.ast=e,o.rebuild=(r)=>av(r,t),o.makeEffect=id(o),o.make=ME(o),o.makeOption=sd(o),o}var jE=W(2,(e,t)=>JF(e,(n,o)=>!t.includes(n)?[n,o]:void 0));var Wr=(e)=>e;function JF(e,t){let n={};for(let o of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,o))continue;let r=t(o,e[o]);if(r){let[i,s]=r;Ft(n,i,s)}}return n}var GE=Lr((e)=>On(e,[]));function On(e,t){let n=Ws(e)?.toEquivalence;if(n)return n(aa(e)?e.typeParameters.map((o)=>On(o,t)):[]);switch(e._tag){case"Never":return Cw();case"Declaration":case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return ze;case"Arrays":{let o=e.elements.map((s,a)=>On(s,[...t,a])),r=e.elements.length,i=e.rest.map((s,a)=>On(s,[...t,r+a]));return eo((s,a)=>{if(!Array.isArray(s)||!Array.isArray(a))return!1;let l=s.length;if(l!==a.length)return!1;let c=0;for(;c<Math.min(l,e.elements.length);c++)if(!o[c](s[c],a[c]))return!1;if(i.length>0){let[u,...f]=i;for(;c<l-f.length;c++)if(!u(s[c],a[c]))return!1;for(let h=0;h<f.length;h++)if(!f[h](s[c+h],a[c+h]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return ze;let o=e.propertySignatures.map((i)=>On(i.type,[...t,i.name])),r=e.indexSignatures.map((i)=>On(i.type,t));return eo((i,s)=>{if(!Bo(i)||!Bo(s))return!1;for(let a=0;a<o.length;a++){let l=e.propertySignatures[a],c=l.name,u=Object.hasOwn(i,c),f=Object.hasOwn(s,c);if(_r(l.type)){if(u!==f)return!1}if(u&&f&&!o[a](i[c],s[c]))return!1}for(let a=0;a<r.length;a++){let l=e.indexSignatures[a],c=oi(i,l.parameter),u=oi(s,l.parameter);if(c.length!==u.length)return!1;for(let f=0;f<c.length;f++){let h=c[f];if(!Object.hasOwn(s,h)||!r[a](i[h],s[h]))return!1}}return!0})}case"Union":{let o=kr(e).types,r=new Map(o.map((i,s)=>[i,[ad(i),On(e.types[s],t)]]));return eo((i,s)=>{let a=Xu(i,o);for(let l=0;l<a.length;l++){let[c,u]=r.get(a[l]);if(c(i)&&c(s))return u(i,s)}return!1})}case"Suspend":{let o=Qu(()=>On(e.thunk(),t));return eo((r,i)=>o()(r,i))}}}var p9=globalThis.RegExp;var ZE=(e)=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var da=ld;function XF(){return(e,t,n)=>_e(new co(e.map(Ju),(o)=>t(o.map((r)=>_e(r))),n))}function HE(e,t){return XF()([],()=>(n,o,r)=>e(n)?Me(n):Te(new Yt(o,n,r)),t)}function Jr(e){return(t)=>t.annotate(e)}var QF=UE;var _e=av;function VE(e){return ge(e,da)&&e[da]===da}var ez=Wr((e)=>_e(nd(e.ast),{schema:e}));var ud=Wr((e)=>{let t=iz(e);return _e(_E(e.ast),{schema:t})});var ui=Wr((e)=>_e(kr(e.ast),{schema:e})),tz=Wr((e)=>_e(ua(e.ast),{schema:e}));function F(e){let t=_e(new ao(e),{literal:e,transform(n){return t.pipe(wr(F(n),{decode:it(()=>n),encode:it(()=>e)}))}});return t}var uo=_e(iE),ct=_e(oa),rz=_e(Hx),nz=_e(Vx),d=_e(ia),Bt=_e(Wx),be=_e(uE);function uv(e,t){return _e(e,{fields:t,mapFields(n,o){let r=n(this.fields);return uv(Wu(r,o?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function g(e){return uv(Wu(e,void 0),e)}function J(e,t){return _e(IE(e.ast,t.ast),{key:e,value:t})}function WE(e,t){return _e(pE(e.ast,t.map(Ju)),{schema:e,records:t})}function JE(e,t){return _e(e,{elements:t,mapElements(n,o){let r=n(this.elements);return JE(Xx(r,o?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function oz(e){return JE(Xx(e),e)}var Y=Wr((e)=>_e(new ai(!1,[],[e.ast]),{value:e}));var ma=Wr((e)=>_e(new ai(!1,[e.ast],[e.ast]),{value:e}));function KE(e,t){return _e(e,{members:t,mapMembers(n,o){let r=n(this.members);return KE(Ku(r,this.ast.mode,o?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function ie(e,t){return KE(Ku(e,t?.mode??"anyOf",void 0),e)}function ce(e){let t=e.map(F);return _e(Ku(t,"anyOf",void 0),{literals:e,members:t,mapMembers(n){return ie(n(this.members))},pick(n){return ce(n)},transform(n){return ie(t.map((o,r)=>o.transform(n[r])))}})}var dv=Wr((e)=>ie([e,rz])),iz=Wr((e)=>ie([e,nz]));function sz(e){return _e(new ed(()=>e().ast))}function YE(...e){return(t)=>t.check(...e)}function xe(e){return(t)=>_e(bE(t.ast,e),{schema:t,identifier:e})}function wr(e,t){return(n)=>_e(wE(n.ast,e.ast,t?Lx(t):Gu()),{from:n,to:e})}function XE(e){return(t)=>_e(kE(t.ast,e),{schema:t})}function ae(e){return F(e).pipe(XE(Me(e)))}function az(e,t){return g({_tag:ae(e),...t})}function Be(e){return(t)=>{let n={},o=[],r=new Set,i={},s=(u)=>(f)=>u.includes(f[e]);return a(t),Object.assign(t,{cases:n,discriminants:o,isAnyOf:s,guards:i,match:l,matchOrElse:c});function a(u){let f=u.ast;if(tE(f)&&"members"in u&&globalThis.Array.isArray(u.members)&&u.members.every(VE))return u.members.forEach(a);let h=ii(f);if(h.length>0){let m=h.find((y)=>y.key===e)?.literal;if(Xl(m)){let y=typeof m==="number"?globalThis.String(m):m;if(r.has(y))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);r.add(y),o.push(m),Ft(n,m,u),Ft(i,m,QF(ui(u)));return}}throw new globalThis.Error("No literal or unique symbol found")}function l(){if(arguments.length===1){let y=arguments[0];return function(k){let S=k[e];return(Object.hasOwn(y,S)?y[S]:void 0)(k)}}let u=arguments[0],f=arguments[1],h=u[e];return(Object.hasOwn(f,h)?f[h]:void 0)(u)}function c(){if(arguments.length===2){let k=arguments[0],S=arguments[1];return function(I){let D=I[e];return(Object.hasOwn(k,D)?k[D]??S:S)(I)}}let u=arguments[0],f=arguments[1],h=arguments[2],m=u[e];return(Object.hasOwn(f,m)?f[m]??h:h)(u)}}}function di(e,t){return HE((n)=>n instanceof e,t)}function po(){return(e,t)=>new yt(e.ast,Lx(t))}var Dn=td;var BE="^\\S[\\s\\S]*\\S$|^\\S$|^$";function cz(e){let t=new globalThis.RegExp(BE);return Dn((n)=>n.trim()===n,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitrary:{constraint:{patterns:[BE]}},...e})}function pi(e,t){let{source:n,flags:o}=e,r=o===""?`new RegExp(${re(n)})`:`new RegExp(${re(n)}, ${re(o)})`;return ev(e,{toCode:()=>({runtime:`Schema.isPattern(${r})`}),...t})}function lz(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return pi(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function Pn(e,t){let n=JSON.stringify(e),o=new globalThis.RegExp(`^${ZE(e)}`);return Dn((r)=>r.startsWith(e),{expected:`a string starting with ${n}`,representation:{id:"effect/schema/isStartsWith",payload:{startsWith:e}},toJsonSchema:()=>({pattern:o.source}),toCode:()=>({runtime:`Schema.isStartsWith(${re(e)})`}),arbitrary:{constraint:{patterns:[o.source]}},...t})}var Re=_e(Qx);function uz(e){let t=uu(e.order),n=e.formatter??re;return(o,r)=>Dn((i)=>t(i,o),{expected:`a value greater than ${n(o)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:o,exclusiveMinimum:!0}}},...e.annotate?.(o),...r})}function dz(e){let t=pu(e.order),n=e.formatter??re;return(o,r)=>Dn((i)=>t(i,o),{expected:`a value greater than or equal to ${n(o)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:o}}},...e.annotate?.(o),...r})}function pz(e){let t=du(e.order),n=e.formatter??re;return(o,r)=>Dn((i)=>t(i,o),{expected:`a value less than or equal to ${n(o)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:o}}},...e.annotate?.(o),...r})}function mz(e){let t=pu(e.order),n=uu(e.order),o=du(e.order),r=Ly(e.order),i=e.formatter??re;return(s,a)=>{let l=s.exclusiveMinimum?n:t,c=s.exclusiveMaximum?r:o;return Dn((u)=>l(u,s.minimum)&&c(u,s.maximum),{expected:`a value between ${i(s.minimum)}${s.exclusiveMinimum?" (excluded)":""} and ${i(s.maximum)}${s.exclusiveMaximum?" (excluded)":""}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:s.minimum,maximum:s.maximum,...s.exclusiveMinimum&&{exclusiveMinimum:!0},...s.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(s),...a})}}function pa(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${re(e)}`);return e}var fz=uz({order:Fs,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:pa(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${re(e)})`})})});var pv=dz({order:Fs,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:pa(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${re(e)})`})})});var hz=pz({order:Fs,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:pa(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${re(e)})`})})});var QE=mz({order:Fs,annotate:(e)=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:pa(e.minimum),maximum:pa(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${re(e.minimum)}, maximum: ${re(e.maximum)}, exclusiveMinimum: ${re(t)}, exclusiveMaximum: ${re(n)} })`})}}});function gz(e){return Dn((t)=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...e})}var qt=Bt.check(gz());function yz(e,t){return e=Math.max(0,Math.floor(e)),Dn((n)=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="array"?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Au]:!0,arbitrary:{constraint:{minLength:e}},...t})}function e$(e){return yz(1,e)}var xz=(e)=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),vz=(e)=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}};var qE=[];function Sz(e){let t=xz(e),n=qE[t];if(n!==void 0)return n;let o=Ir.pipe(wr(ct,ZT(vz(t))));return qE[t]=o,o}var K8=di(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>po()(g({source:d,flags:d}),ri({decode:(e,t)=>Ex({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new gt({expected:"valid RegExp source and flags"},e,t)}),encode:(e)=>Me({source:e.source,flags:e.flags})})),toArbitrary:()=>(e)=>e.tuple(e.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),e.uniqueArray(e.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map((t)=>t.join(""))).map(([t,n])=>new globalThis.RegExp(t,n)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags});var bz=d.annotate({expected:"a string that will be decoded as a URL"}),Y8=di(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>po()(bz,BT),toArbitrary:()=>(e)=>e.webUrl().map((t)=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()});function _z(e,t,n){let o={...t};if(e?.minimum!==void 0){let r=n===void 0?e.minimum:n(e.minimum),i=e.exclusiveMinimum?new globalThis.Date(r.getTime()+1):r;if(o.min===void 0||i.getTime()>o.min.getTime())o.min=i}if(e?.maximum!==void 0){let r=n===void 0?e.maximum:n(e.maximum),i=e.exclusiveMaximum?new globalThis.Date(r.getTime()-1):r;if(o.max===void 0||i.getTime()<o.max.getTime())o.max=i}return o}var kz=di(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>po()(g({data:d.check(lz()),type:d,name:d,lastModified:qt}),ri({decode:(e,t)=>xu(Iu(e.data),{onFailure:()=>Te(new gt({expected:"a valid Base64 string"},e.data,t)),onSuccess:(n)=>{let o=new globalThis.Uint8Array(n);return Me(new globalThis.File([o],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>xT({try:async()=>{let n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:wu(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new gt({expected:"a readable File"},e,t)})}))});var X8=di(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>po()(Y(oz([d,ie([g({_tag:ae("String"),value:d}),g({_tag:ae("File"),value:kz})])])),ri({decode:(e)=>{let t=new globalThis.FormData;for(let[n,o]of e)t.append(n,o.value);return Me(t)},encode:(e)=>Me(globalThis.Array.from(e.entries()).map(([t,n])=>{if(typeof n==="string")return[t,{_tag:"String",value:n}];else return[t,{_tag:"File",value:n}]}))}))});var Q8=di(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>po()(d.annotate({expected:"a query string that will be decoded as URLSearchParams"}),so({decode:(e)=>new globalThis.URLSearchParams(e),encode:(e)=>e.toString()}))});var wz=d.check(cz()),t$=d.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(wr(wz,jT()));var Iz=d.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),Tz=di(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>po()(Iz,qT),toArbitrary:()=>(e)=>e.uint8Array()});var Ez=HE((e)=>bT(e)&&_T(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecJson:()=>po()(d,HT),toArbitrary:()=>(e,t)=>e.date(_z(t?.constraint?.ordered?.order===wT?t.constraint.ordered:void 0,{noInvalidDate:!0},$T)).map((n)=>IT(n)),toFormatter:()=>(e)=>e.toString(),toEquivalence:()=>kT});var $z=globalThis.Symbol.for("immer-draftable"),lv={};function mv(e,t,n,o,r){let i=Dz(n,t,o),s=r$(t),a=class extends e{constructor(...[l,c]){let f=c?.["~payload"],h=f?.token===lv?f.value:n.make(l??{},c);super(h,{...c,disableChecks:!0,"~payload":{token:lv,value:h}})}static[da]=da;get[s](){return s}static[$z]=!0;static identifier=t;static fields=n.fields;static get ast(){return i(this).ast}static pipe(){return ht(this,arguments)}static rebuild(l){return i(this).rebuild(l)}static make(l,c){return new this(l,c)}static makeOption(l,c){return sd(i(this))(l??{},c)}static makeEffect(l,c){return i(this).makeEffect(l??{},c)}static annotate(l){return this.rebuild(ci(this.ast,l))}static annotateKey(l){return this.rebuild(rd(this.ast,l))}static check(...l){return this.rebuild(lo(this.ast,l))}static extend(l){return(c,u)=>{let f=dd(c)?c:g(c),h={...n.fields,...f.fields},m=Wu(h,n.ast.checks,{identifier:l});return mv(this,l,uv(lo(m,f.ast.checks),h),u,r)}}static mapFields(l,c){return n.mapFields(l,c)}};if(r!==void 0)Object.assign(a.prototype,r(t));return a}function Oz(e){return new mt(it((t)=>new e(t,{"~payload":{token:lv,value:t}})),Vr())}function r$(e){return`~effect/Schema/Class/${e}`}function Dz(e,t,n){let o;return(r)=>{if(o!==void 0)return o;let i=r$(t),s=(c)=>c instanceof r||ge(c,i),a=Oz(r),l=_e(new co([e.ast],()=>(c,u,f)=>s(c)?Me(c):Te(new Yt(u,c,f)),{identifier:t,[Uu]:([c])=>({isConstructed:s,link:new yt(c,a)}),toCodec:([c])=>new yt(c.ast,a),toArbitrary:([c])=>()=>({arbitrary:c.arbitrary.map((u)=>new r(u)),terminal:c.terminal?.map((u)=>new r(u))}),toFormatter:([c])=>(u)=>`${r.identifier}(${c(u)})`,[Mu]:ii(e.ast),...n}));return o=wr(l,a)(e)}}function dd(e){return VE(e)}var mo=(e)=>(t,n)=>{let o=dd(t)?t:g(t);return mv(cI,e,o,n,(r)=>({toString(){return`${r}(${re({...this})})`}}))};var Pz=(e)=>(t,n)=>{let o=dd(t)?t:g(t);return mv(cu,e,o,n,(i)=>({name:i}))},fv=(e)=>(t,n,o)=>{let r=dd(n)?n.mapFields((i)=>({_tag:ae(t),...i}),{unsafePreserveChecks:!0}):az(t,n);return Pz(e??t)(r,o)};function Cz(e){return GE(e.ast)}var Ir=_e(ci(CE,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})}));var qe=qt.check(fz(0)),q=qt.check(pv(0)),Xt=d.pipe(xe("RelativePath")),Le=d.pipe(xe("AbsolutePath")),p=(e)=>ez(e).pipe(wr(ud(ui(e)),{decode:Vr({strict:!1}),encode:Fx(fu((t)=>t!==void 0))})),Q=(e)=>(t)=>Object.assign(t,e(t)),Xe=Re.pipe(wr(Ez,{decode:it((e)=>KN(e)),encode:it((e)=>OT(e))}));var n$=0,hv=0;function lt(){return i$(!1)}function o$(){return i$(!0)}function i$(e,t=Date.now()){if(t!==n$)n$=t,hv=0;hv++;let n=BigInt(t)*0x1000n+BigInt(hv),o=e?~n:n,r=Array.from({length:6},(s,a)=>Number(o>>BigInt(40-8*a)&0xffn).toString(16).padStart(2,"0")).join(""),i=crypto.getRandomValues(new Uint8Array(14));return r+Array.from(i,(s)=>"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[s%62]).join("")}var pd=d.pipe(xe("Project.ID"),Q((e)=>({global:e.make("global")})));var gv=d.check(Pn("wrk")).pipe(xe("Workspace.ID"),Q((e)=>{let t=()=>e.make("wrk_"+lt());return{ascending:(n)=>{if(!n)return t();if(!n.startsWith("wrk"))throw Error(`ID ${n} does not start with wrk`);return e.make(n)},create:t}}));var Cn=g({directory:Le,workspaceID:p(gv)}).annotate({identifier:"Location.Ref"}),B7=g(jE(Cn.fields,["workspaceID"])).annotate({identifier:"Location.PublicRef"});class s$ extends mo("Location.Info")({directory:Le,workspaceID:p(gv),project:g({id:pd,directory:Le,canonical:Le})}){}var q7=g(jE(s$.fields,["workspaceID"])).annotate({identifier:"Location.PublicInfo"});var c$=d.check(Pn("evt_")).pipe(xe("Event.ID"),Q((e)=>({create:()=>e.make("evt_"+lt())}))),Az=qt.check(pv(0)).pipe(xe("Event.Seq")),yv=qt.check(pv(1)).pipe(xe("Event.Version")),a$=g({aggregateID:d,seq:Az,version:yv});function j(e){let t=g(e.schema),n=g({aggregateID:a$.fields.aggregateID,seq:a$.fields.seq,version:F(e.durable.version).pipe(wr(ui(yv),so({decode:()=>yv.make(e.durable.version),encode:()=>e.durable.version})))});return g({id:c$,created:Re,metadata:p(J(d,ct)),type:F(e.type),durable:n,location:p(Cn),data:t}).annotate({identifier:e.identifier??e.type}).pipe(Q(()=>({type:e.type,durability:"durable",durable:e.durable,data:t})))}function L(e){let t=g(e.schema);return g({id:c$,created:Re,metadata:p(J(d,ct)),type:F(e.type),location:p(Cn),data:t}).annotate({identifier:e.identifier??e.type}).pipe(Q(()=>({type:e.type,durability:"ephemeral",durable:void 0,data:t})))}function le(...e){return Object.freeze(e)}var mi=d.pipe(xe("Integration.ID")),md=d.pipe(xe("Integration.MethodID"));var Mz=d.check(Pn("frm_")).pipe(xe("Form.ID")),vv=Mz.pipe(Q((e)=>({create:(t)=>e.make(t??"frm_"+lt())}))),Uz=J(d,ct).annotate({identifier:"Form.Metadata"}),p$=g({value:d,label:d,description:d.pipe(p)}).annotate({identifier:"Form.Option"}),Nz=g({key:d,op:ce(["eq","neq"]),value:ie([d,Bt,be])}).annotate({identifier:"Form.When"}),fa={key:d,title:d.pipe(p),description:d.pipe(p),required:be.pipe(p),hidden:be.pipe(p).annotate({description:"Skip the interactive authentication prompt and use the default unless an answer is supplied"}),when:Y(Nz).pipe(p)},Fz=g({...fa,type:F("string"),format:ce(["email","uri","date","date-time"]).pipe(p),minLength:q.pipe(p),maxLength:q.pipe(p),pattern:d.pipe(p),placeholder:d.pipe(p),default:d.pipe(p),options:Y(p$).pipe(p),custom:be.pipe(p)}).annotate({identifier:"Form.StringField"}),zz=g({...fa,type:F("number"),minimum:Bt.pipe(p),maximum:Bt.pipe(p),default:Bt.pipe(p)}).annotate({identifier:"Form.NumberField"}),Lz=g({...fa,type:F("integer"),minimum:Bt.pipe(p),maximum:Bt.pipe(p),default:Bt.pipe(p)}).annotate({identifier:"Form.IntegerField"}),jz=g({...fa,type:F("boolean"),default:be.pipe(p)}).annotate({identifier:"Form.BooleanField"}),Gz=g({...fa,type:F("multiselect"),options:Y(p$),minItems:q.pipe(p),maxItems:q.pipe(p),custom:be.pipe(p),default:Y(d).pipe(p)}).annotate({identifier:"Form.MultiselectField"}),Zz=g({key:d,type:F("external"),url:d,title:d.pipe(p),description:d.pipe(p)}).annotate({identifier:"Form.ExternalField"}),Bz=ie([Fz,zz,Lz,jz,Gz,Zz]).pipe(Be("type"),Jr({identifier:"Form.Field"})),Sv=ma(Bz).annotate({identifier:"Form.Fields"}),qz={id:vv,sessionID:d,title:d,metadata:Uz.pipe(p)},m$=g({...qz,fields:Sv}).annotate({identifier:"Form.Info"}),Hz=ie([d,Bt,be,Y(d)]).annotate({identifier:"Form.Value"}),fd=J(d,Hz).annotate({identifier:"Form.Answer"}),Vz=ie([g({status:F("pending")}),g({status:F("answered"),answer:fd}),g({status:F("cancelled")})]).pipe(Be("status")).annotate({identifier:"Form.State"}),nQ=g({...m$.fields,state:Vz}).annotate({identifier:"Form.Detail"}),oQ=g({answer:fd}).annotate({identifier:"Form.Reply"}),l$=L({type:"form.created",schema:{form:m$}}),u$=L({type:"form.replied",schema:{id:vv,sessionID:d,answer:fd}}),d$=L({type:"form.cancelled",schema:{id:vv,sessionID:d}}),iQ={Created:l$,Replied:u$,Cancelled:d$,Definitions:le(l$,u$,d$)};var g$=d.pipe(xe("Credential.ID"),Q((e)=>({create:()=>e.make("cred_"+lt())}))),f$=L({type:"credential.updated",schema:{}}),h$=L({type:"credential.switched",schema:{integrationID:mi,credentialID:dv(g$)}}),mQ={Updated:f$,Switched:h$,Definitions:le(f$,h$)},Wz=g({type:F("oauth"),methodID:md,refresh:d,access:d,expires:q,metadata:p(J(d,ct))}).annotate({identifier:"Credential.OAuth"}),Jz=g({type:F("key"),key:d,metadata:p(J(d,ct)),configuration:p(fd)}).annotate({identifier:"Credential.Key"}),fQ=ie([Wz,Jz]).pipe(Be("type")).annotate({identifier:"Credential.Value"});var Kz=g({type:F("credential"),id:g$,label:d,method:ce(["key","oauth"])}).annotate({identifier:"Connection.CredentialInfo"}),Yz=g({type:F("env"),name:d}).annotate({identifier:"Connection.EnvInfo"}),Xz=ie([Kz,Yz]).pipe(Be("type")).annotate({identifier:"Connection.Info"});var wv=mi,x$=md,Qz=g({id:x$,type:F("oauth"),label:d,form:p(Sv)}).annotate({identifier:"Integration.OAuthMethod"}),eL=g({id:x$,type:F("command"),label:d,command:Y(d)}).annotate({identifier:"Integration.CommandMethod"}),tL=g({type:F("key"),label:p(d),form:p(Sv)}).annotate({identifier:"Integration.KeyMethod"}),rL=g({type:F("env"),names:Y(d)}).annotate({identifier:"Integration.EnvMethod"}),nL=ie([Qz,eL,tL,rL]).pipe(Be("type")).annotate({identifier:"Integration.Method"}),y$=L({type:"integration.updated",schema:{}}),IQ={Updated:y$,Definitions:le(y$)},TQ=g({id:wv,name:d,metadata:p(J(d,uo))}).annotate({identifier:"Integration.Ref"}),EQ=g({id:wv,name:d,metadata:p(J(d,uo)),methods:Y(nL),connections:Y(Xz)}).annotate({identifier:"Integration.Info"}),v$=d.pipe(xe("Integration.AttemptID"),Q((e)=>({create:()=>e.make("con_"+lt())}))),Tr=g({created:Bt,expires:Bt});class oL extends mo("Integration.Attempt")({attemptID:v$,url:d,instructions:d,mode:ce(["auto","code"]),time:Tr}){}var $Q=ie([g({status:F("pending"),time:Tr}),g({status:F("complete"),time:Tr}),g({status:F("failed"),message:d,time:Tr}),g({status:F("expired"),time:Tr})]).pipe(Be("status")).annotate({identifier:"Integration.AttemptStatus"}),OQ=g({attemptID:v$,time:Tr}).annotate({identifier:"Integration.CommandAttempt"}),DQ=ie([g({status:F("pending"),message:p(d),time:Tr}),g({status:F("complete"),time:Tr}),g({status:F("failed"),message:d,time:Tr}),g({status:F("expired"),time:Tr})]).pipe(Be("status")).annotate({identifier:"Integration.CommandAttemptStatus"});var ho=d.pipe(xe("Provider.ID"),Q((e)=>({opencode:e.make("opencode"),anthropic:e.make("anthropic"),openai:e.make("openai"),google:e.make("google"),googleVertex:e.make("google-vertex"),githubCopilot:e.make("github-copilot"),amazonBedrock:e.make("amazon-bedrock"),azure:e.make("azure"),openrouter:e.make("openrouter"),mistral:e.make("mistral"),gitlab:e.make("gitlab")}))),S$=L({type:"provider.updated",schema:{}}),MQ={Updated:S$,Definitions:le(S$)},b$=d,iL=ce(["auto","enabled","disabled"]),_$=ie([g({type:F("summary")}),g({type:F("native")})]).pipe(Be("type")).annotate({identifier:"Provider.Compaction"}),sL=ce(["http","websocket"]).annotate({identifier:"Provider.Transport"}),k$=WE(g({timeout:ie([Re,F(!1)]).pipe(p),chunkTimeout:Re.pipe(p),compaction:_$.pipe(p),transport:sL.pipe(p)}),[J(d,uo)]).annotate({identifier:"Provider.Settings"}),aL={settings:k$.pipe(p),headers:J(d,d).pipe(p),body:J(d,uo).pipe(p)},cL=g({settings:k$.pipe(XE(Me({}))),headers:J(d,d),body:J(d,uo)}).annotate({identifier:"Provider.Request"}),UQ=g({id:ho,canonical:ho.pipe(p),integrationID:wv.pipe(p),name:d,activation:iL,package:b$,...aL}).annotate({identifier:"Provider.Info"}).pipe(Q(()=>({empty:(e)=>({id:e,name:e,activation:"auto",package:""})})));var go=Re.pipe(xe("Money.USD"),Jr({identifier:"Money.USD"}),Q((e)=>({zero:e.make(0)}))),hd=Re.pipe(xe("Money.USDPerMillionTokens"),Jr({identifier:"Money.USDPerMillionTokens"}),Q((e)=>({zero:e.make(0)})));var gd=d.pipe(xe("Model.ID")),w$=L({type:"model.updated",schema:{}}),BQ={Updated:w$,Definitions:le(w$)},Tv=d.pipe(xe("Model.VariantID")),Er=g({id:gd,providerID:ho,variant:Tv.pipe(p)}).annotate({identifier:"Model.Ref"}).pipe(Q((e)=>({parse:(t)=>{let n=t.indexOf("/");if(n<=0)throw Error(`Invalid model reference: ${t}`);let o=t.slice(0,n),r=t.indexOf("#",n+1),i=t.slice(n+1,r===-1?void 0:r),s=r===-1?void 0:t.slice(r+1);if(!i||o.includes("#")||s!==void 0&&(!s||s.includes("#")))throw Error(`Invalid model reference: ${t}`);return e.make({providerID:ho.make(o),id:gd.make(i),...s?{variant:Tv.make(s)}:{}})}}))),lL=d.pipe(xe("Model.Family")),uL=ie([ce(["reasoning","reasoning_content","reasoning_text"]),d]).annotate({identifier:"Model.ReasoningField"}),dL=ce(["max_completion_tokens","max_tokens"]).annotate({identifier:"Model.MaxTokensField"}),pL=WE(g({compaction:_$.pipe(p)}),[J(d,uo)]).annotate({identifier:"Model.Settings"}),T$={settings:pL.pipe(p),headers:J(d,d).pipe(p),body:J(d,uo).pipe(p)},mL=g({reasoningField:uL.pipe(p),requireReasoning:be.pipe(p),maxTokensField:dL.pipe(p),requireFinishReason:be.pipe(p),requireAssistantAfterTool:be.pipe(p),supportsPromptCacheKey:be.pipe(p)}).annotate({identifier:"Model.Compatibility"}),I$=g({tools:be,input:Y(d),output:Y(d)}).annotate({identifier:"Model.Capabilities"}).pipe(Q(()=>({default:()=>({tools:!0,input:["text","image"],output:["text"]})}))),fL=g({tier:g({type:ae("context"),size:qt}).pipe(p),input:hd,output:hd,cache:g({read:hd,write:hd})}).annotate({identifier:"Model.Cost"}),hL=g({id:Tv,...T$}).annotate({identifier:"Model.Variant"}),qQ=g({id:gd,modelID:gd,providerID:ho,canonical:ho.pipe(p),family:lL.pipe(p),name:d,compatibility:mL.pipe(p),package:b$.pipe(p),...T$,capabilities:I$,variants:Y(hL),time:g({released:Re}),cost:Y(fL),status:ce(["alpha","beta","deprecated","active"]),enabled:be,limit:g({context:qt,input:qt.pipe(p),output:qt})}).annotate({identifier:"Model.Info"}).pipe(Q(()=>({default:(e,t)=>({id:t,modelID:t,providerID:e,name:t,capabilities:I$.default(),variants:[],time:{released:0},cost:[],status:"active",enabled:!0,limit:{context:200000,output:32000}})})));var pr=d.check(Pn("ses")).pipe(xe("SessionID"),Q((e)=>{let t=()=>e.make("ses_"+o$());return{create:t,descending:(n)=>n===void 0?t():e.make(n)}}));var O$=d.check(Pn("per")).pipe(xe("Permission.ID"),Q((e)=>({create:(t)=>e.make(t??"per_"+lt())}))),gL=ie([g({type:F("tool"),messageID:d,id:d})]).annotate({identifier:"Permission.Source"}),yL={sessionID:pr,action:d,resources:Y(d),save:Y(d).pipe(p),metadata:J(d,ct).pipe(p),source:gL.pipe(p),message:d.pipe(p)},xL=g({id:O$,...yL}).annotate({identifier:"Permission.Request"}),vL=ce(["once","always","reject"]).annotate({identifier:"Permission.Reply"}),E$=L({type:"permission.asked",schema:xL.fields}),$$=L({type:"permission.replied",schema:{sessionID:pr,requestID:O$,reply:vL}}),ree={Asked:E$,Replied:$$,Definitions:le(E$,$$)},SL=ce(["allow","deny","ask"]).annotate({identifier:"Permission.Effect"}),bL=g({action:d,resource:d,effect:SL}).annotate({identifier:"Permission.Rule"}),yd=Y(bL).annotate({identifier:"Permission.Ruleset"});var D$=L({type:"agent.updated",schema:{}}),Kr=d.pipe(xe("Agent.ID")),P$=d.pipe(xe("Agent.Name")),_L=d.annotate({identifier:"Agent.Color"}),uee=g({id:Kr,name:P$,model:Er.pipe(p),request:cL,system:d.pipe(p),description:d.pipe(p),mode:ce(["subagent","primary","all"]),hidden:be,color:_L.pipe(p),steps:qe.pipe(p),permissions:yd}).annotate({identifier:"Agent.Info"}).pipe(Q(()=>({default:(e)=>({id:e,name:P$.make(e),request:{settings:{},headers:{},body:{}},mode:"primary",hidden:!1,permissions:[{action:"*",resource:"*",effect:"allow"},{action:"external_directory",resource:"*",effect:"ask"},{action:"read",resource:"*.env",effect:"ask"},{action:"read",resource:"*.env.*",effect:"ask"},{action:"read",resource:"*.env.example",effect:"allow"}]})}))),dee={Updated:D$,Definitions:le(D$)};var C$=L({type:"command.updated",schema:{}}),hee=g({name:d,description:d.pipe(p)}).annotate({identifier:"Command.Info"}),gee={Updated:C$,Definitions:le(C$)};class Ev extends mo("Mcp.TimeoutConfig")({startup:qe.pipe(p).annotate({description:"Maximum time in milliseconds to establish and initialize the MCP server."}),catalog:qe.pipe(p).annotate({description:"Maximum time in milliseconds to wait for MCP discovery requests such as tools/list and prompts/list."}),execution:qe.pipe(p).annotate({description:"Maximum time in milliseconds to wait for MCP tool and prompt execution."})}){}var A$=ce(["legacy","auto","2026-07-28"]).annotate({identifier:"Mcp.Protocol",description:'MCP protocol negotiation. "legacy" (default) opens with the initialize handshake and speaks protocol revisions up to 2025-11-25. "auto" probes for the 2026-07-28 revision and falls back to legacy when the server does not support it. "2026-07-28" requires that revision and fails otherwise.'});class M$ extends mo("Mcp.LocalConfig")({type:F("local"),command:d.pipe(Y),cwd:d.pipe(p).annotate({description:"Working directory for the MCP server process. Relative paths resolve from the workspace directory."}),environment:J(d,d).pipe(p),disabled:be.pipe(p),codemode:be.pipe(p).annotate({description:"Expose this server's tools through Code Mode. Defaults to true."}),timeout:Ev.pipe(p),protocol:A$.pipe(p)}){}class U$ extends mo("Mcp.OAuthConfig")({client_id:d.pipe(p),client_secret:d.pipe(p),scope:d.pipe(p),callback_port:qt.check(QE({minimum:1,maximum:65535})).pipe(p),redirect_uri:d.pipe(p),auth_server_metadata_url:d.pipe(p).annotate({description:"URL of the OAuth or OpenID Connect authorization server metadata document. Set when the MCP server does not publish protected resource metadata that names its authorization server."})}){}class N$ extends mo("Mcp.RemoteConfig")({type:F("remote"),url:d,headers:J(d,d).pipe(p),oauth:ie([U$,F(!1)]).pipe(p),disabled:be.pipe(p),codemode:be.pipe(p).annotate({description:"Expose this server's tools through Code Mode. Defaults to true."}),timeout:Ev.pipe(p),protocol:A$.pipe(p)}){}var See=ie([M$,N$]).pipe(Be("type")),kL=g({status:F("connected")}).annotate({identifier:"Mcp.Status.Connected"}),wL=g({status:F("pending")}).annotate({identifier:"Mcp.Status.Pending"}),IL=g({status:F("disabled")}).annotate({identifier:"Mcp.Status.Disabled"}),TL=g({status:F("failed"),error:d}).annotate({identifier:"Mcp.Status.Failed"}),EL=g({status:F("needs_auth"),error:d}).annotate({identifier:"Mcp.Status.NeedsAuth"}),$L=ie([kL,wL,IL,TL,EL]).pipe(Be("status")),bee=g({name:d,status:$L,integrationID:p(mi)}).annotate({identifier:"Mcp.Server"}),OL=g({server:d,name:d,uri:d,description:p(d),mimeType:p(d)}).annotate({identifier:"Mcp.Resource"}),DL=g({server:d,name:d,uriTemplate:d,description:p(d),mimeType:p(d)}).annotate({identifier:"Mcp.ResourceTemplate"}),_ee=g({resources:Y(OL),templates:Y(DL)}).annotate({identifier:"Mcp.ResourceCatalog"}),PL=ie([g({type:F("text"),uri:d,text:d,mimeType:p(d)}),g({type:F("blob"),uri:d,blob:d,mimeType:p(d)})]).pipe(Be("type"),Jr({identifier:"Mcp.ResourceContentPart"})),kee=g({server:d,uri:d,contents:Y(PL)}).annotate({identifier:"Mcp.ResourceContent"});var CL=d.check(Pn("pty")).pipe(xe("PtyID")),xa=CL.pipe(Q((e)=>{let t=()=>e.make("pty_"+lt());return{create:t,ascending:(n)=>n===void 0?t():e.make(n)}})),$v=g({id:xa,title:d,command:d,args:Y(d),cwd:d,status:ce(["running","exited"]),pid:q,exitCode:p(q)}).annotate({identifier:"Pty"}),z$=L({type:"pty.created",schema:{info:$v}}),L$=L({type:"pty.updated",schema:{info:$v}}),j$=L({type:"pty.exited",schema:{id:xa,exitCode:q}}),G$=L({type:"pty.deleted",schema:{id:xa}}),Oee={Created:z$,Updated:L$,Exited:j$,Deleted:G$,Definitions:le(z$,L$,j$,G$)},Dee=g({command:p(d),args:p(Y(d)),cwd:p(d),title:p(d),env:p(J(d,d))}),Pee=g({title:p(d),size:p(g({rows:qe,cols:qe}))});var Dt=pd,RL=d.check(pi(/^[a-z][a-z0-9._-]*$/)).annotate({identifier:"Project.Vcs"}),Uee=g({id:Dt,directory:Le,canonical:Le}).annotate({identifier:"Project.Current"}),q$=g({url:p(d),override:p(d),color:p(d)}).annotate({identifier:"Project.Icon"}),H$=g({start:p(d.annotate({description:"Startup script to run when creating a new workspace (worktree)"}))}).annotate({identifier:"Project.Commands"}),AL=g({created:q,updated:q,active:q}).annotate({identifier:"Project.Time"}),ML=g({id:Dt,canonical:Le,vcs:p(RL),name:p(d),icon:p(q$),commands:p(H$),time:AL,sandboxes:Y(d)}).annotate({identifier:"Project"}),Nee=g({projectID:Dt,canonical:p(Le),name:p(d),icon:p(q$),commands:p(H$)}).annotate({identifier:"Project.UpdateInput"}),B$=L({type:"project.updated",schema:ML.fields}),Fee={Updated:B$,Definitions:le(B$)};var vd=ce(["stop","length","tool-calls","content-filter","error","unknown"]);var jee=d.pipe(xe("Tool.CallID"));class NL extends fv()("Tool.Error",{message:d,error:ud(Sz()),metadata:ud(J(d,ct))}){}var FL=g({type:F("text"),text:d}).annotate({identifier:"Tool.TextContent"}),zL=g({type:F("file"),uri:d,mime:d,name:ud(d)}).annotate({identifier:"Tool.FileContent"}),gi=ie([FL,zL]).pipe(Be("type")).annotate({identifier:"Tool.Content"});var Sd=d.pipe(xe("Skill.ID")),bd=d.pipe(xe("Skill.Name")),jL=g({type:ae("directory"),path:Le}).annotate({identifier:"Skill.DirectorySource"}),GL=g({type:ae("url"),url:d}).annotate({identifier:"Skill.UrlSource"}),ZL=g({id:Sd,name:bd,description:d.pipe(p),autoinvoke:be.pipe(p),path:Le,content:d}).annotate({identifier:"Skill.Info"}),V$=L({type:"skill.updated",schema:{}}),Hee={Updated:V$,Definitions:le(V$)},BL=g({type:ae("embedded"),skill:sz(()=>ZL)}).annotate({identifier:"Skill.EmbeddedSource"}),Vee=Object.assign(ie([jL,GL,BL]).pipe(Be("type"),Jr({identifier:"Skill.Source"})),{equals:(e,t)=>{if(e.type!==t.type)return!1;if(e.type==="directory"&&t.type==="directory")return e.path===t.path;if(e.type==="url"&&t.type==="url")return e.url===t.url;if(e.type==="embedded"&&t.type==="embedded")return e.skill.id===t.skill.id;return!1},key:(e)=>e.type==="directory"?`directory:${e.path}`:e.type==="url"?`url:${e.url}`:`embedded:${e.skill.id}`});var Ov=g({start:Re,end:Re,text:d}).annotate({identifier:"Prompt.Mention"}),qL=ie([g({type:F("inline")}),g({type:F("uri"),uri:d})]).pipe(Be("type")).annotate({identifier:"Prompt.FileSource"}),HL=d.check(pi(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/)).annotate({identifier:"Prompt.Base64"}),W$=g({data:HL,mime:d,source:qL,name:d.pipe(p),description:d.pipe(p),mention:Ov.pipe(p)}).annotate({identifier:"Prompt.FileAttachment"}).pipe(Q((e)=>({create:(t)=>e.make({data:t.data,mime:t.mime,source:t.source,name:t.name,description:t.description,mention:t.mention})}))),VL=g({name:d,mention:Ov.pipe(p)}).annotate({identifier:"Prompt.AgentAttachment"}),WL=g({id:Sd,name:bd,text:d.pipe(p),mention:Ov.pipe(p)}).annotate({identifier:"Prompt.SkillAttachment"}),yo=g({text:d,files:Y(W$).pipe(p),agents:Y(VL).pipe(p),skills:Y(WL).pipe(p)}).annotate({identifier:"Prompt"}).pipe(Q((e)=>({equivalence:Cz(e),fromUserMessage:(t)=>e.make({text:t.text,...t.files===void 0?{}:{files:t.files},...t.agents===void 0?{}:{agents:t.agents},...t.skills===void 0?{}:{skills:t.skills}})})));var Sa=J(d,Ir).annotate({identifier:"Session.Metadata"});var JL=g({providerID:ho,provider:d,modelID:d,route:d,protocol:d,endpoint:d}).annotate({identifier:"Session.ProviderContext.Provenance"}),KL=g({version:F(1),provenance:JL,messages:Ir}).annotate({identifier:"Session.ProviderContext"});var YL=d.check(Pn("sh_")).pipe(xe("Shell.ID")),_d=YL.pipe(Q((e)=>{let t=()=>e.make("sh_"+lt());return{create:t,ascending:(n)=>n===void 0?t():e.make(n)}})),Dv=ce(["running","exited","timeout","killed"]),XL=g({started:Re.annotate({description:"Start time in milliseconds since the Unix epoch"}),completed:p(Re).annotate({description:"Completion time in milliseconds since the Unix epoch"})}),Q$=J(d,ct),Pv=g({id:_d,status:Dv,command:d,cwd:d,shell:d,file:d,pid:p(q),exit:p(Re),metadata:Q$,time:XL}).annotate({identifier:"Shell.Info"}),K$=L({type:"shell.created",schema:{info:Pv}}),Y$=L({type:"shell.exited",schema:{id:_d,exit:p(Re),status:Dv}}),X$=L({type:"shell.deleted",schema:{id:_d}}),cte={Created:K$,Exited:Y$,Deleted:X$,Definitions:le(K$,Y$,X$)},lte=g({command:d,cwd:p(d),timeout:p(q),metadata:p(Q$)}),ute=g({cursor:p(q),limit:p(q)}),eO=g({output:d,cursor:q,size:q,truncated:be});var Yr=g({type:d,message:d,status:qt.check(QE({minimum:100,maximum:599})).pipe(p)}).annotate({identifier:"Session.StructuredError"});var xo=d.pipe(xe("Snapshot.ID"));var vo=g({input:Re,output:Re,reasoning:Re,cache:g({read:Re,write:Re})}).annotate({identifier:"TokenUsage.Info"});var He=d.check(Pn("msg_")).pipe(xe("Session.Message.ID"),Q((e)=>({create:()=>e.make("msg_"+lt()),fromEvent:(t)=>e.make(t.replace(/^evt_/,"msg_"))}))),mr={id:He,metadata:J(d,ct).pipe(p),time:g({created:Xe})},Pt=J(d,ct).annotate({identifier:"Session.Message.ProviderState"}),QL=g({...mr,type:ae("agent-switched"),agent:Kr,previous:Kr.pipe(p)}).annotate({identifier:"Session.Message.AgentSelected"}),ej=g({...mr,type:ae("model-switched"),model:Er,previous:Er.pipe(p)}).annotate({identifier:"Session.Message.ModelSelected"}),tj=g({...mr,type:ae("location-switched"),location:Cn,projectID:Dt.pipe(p),subpath:Xt.pipe(p),previous:g({location:Cn,projectID:Dt.pipe(p),subpath:Xt.pipe(p)}).pipe(p)}).annotate({identifier:"Session.Message.LocationSwitched"}),rj=g({...mr,text:yo.fields.text,files:yo.fields.files,agents:yo.fields.agents,skills:yo.fields.skills,type:ae("user")}).annotate({identifier:"Session.Message.User"}),nj=g({...mr,text:d,description:d.pipe(p),type:ae("synthetic")}).annotate({identifier:"Session.Message.Synthetic"}),oj=g({...mr,type:ae("system"),text:d,description:d.pipe(p)}).annotate({identifier:"Session.Message.System"}),ij=g({...mr,type:ae("skill"),skill:Sd,name:bd,text:d}).annotate({identifier:"Session.Message.Skill"}),sj=g({...mr,type:ae("shell"),shellID:_d,command:d,status:Dv,exit:Bt.pipe(p),output:eO.pipe(p),time:g({created:Xe,completed:Xe.pipe(p)})}).annotate({identifier:"Session.Message.Shell"}),aj=g({status:ae("streaming"),input:d}).annotate({identifier:"Session.Message.ToolState.Streaming"}),cj=g({status:ae("running"),input:J(d,ct),metadata:J(d,Ir)}).annotate({identifier:"Session.Message.ToolState.Running"}),lj=g({status:ae("completed"),input:J(d,ct),content:ma(gi),metadata:J(d,Ir).pipe(p)}).annotate({identifier:"Session.Message.ToolState.Completed"}),uj=g({status:ae("error"),input:J(d,ct),error:Yr,content:ma(gi).pipe(p),metadata:J(d,Ir).pipe(p)}).annotate({identifier:"Session.Message.ToolState.Error"}),dj=ie([aj,cj,lj,uj]).pipe(Be("status")),pj=g({type:ae("tool"),id:d,name:d,executed:be.pipe(p),providerState:Pt.pipe(p),providerResultState:Pt.pipe(p),state:dj,time:g({created:Xe,ran:Xe.pipe(p),completed:Xe.pipe(p)})}).annotate({identifier:"Session.Message.Assistant.Tool"}),mj=g({type:ae("text"),text:d,state:Pt.pipe(p)}).annotate({identifier:"Session.Message.Assistant.Text"}),fj=g({type:ae("reasoning"),text:d,state:Pt.pipe(p),time:g({created:Xe,completed:Xe.pipe(p)}).pipe(p)}).annotate({identifier:"Session.Message.Assistant.Reasoning"}),tO=ie([mj,fj,pj]).pipe(Be("type")),hj=tz(tO).annotate({identifier:"Session.Message.AssistantContent.Encoded"}),gj=g({attempt:qe,at:Xe,error:Yr}).annotate({identifier:"Session.Message.Assistant.Retry"}),yj=g({...mr,type:ae("assistant"),agent:Kr,model:Er,content:tO.pipe(Y),snapshot:g({start:xo.pipe(p),end:xo.pipe(p),files:Y(Xt).pipe(p)}).pipe(p),finish:vd.pipe(p),rawFinish:d.pipe(p),providerState:Pt.pipe(p),cost:go.pipe(p),tokens:vo.pipe(p),error:Yr.pipe(p),retry:gj.pipe(p),time:g({created:Xe,streamed:Xe.pipe(p),completed:Xe.pipe(p)})}).annotate({identifier:"Session.Message.Assistant"}),Av={type:ae("compaction"),...mr},rO={cost:go.pipe(p),tokens:vo.pipe(p)},xj=g({...Av,status:ae("running"),reason:ce(["auto","manual"]),summary:d,recent:d}).annotate({identifier:"Session.Message.Compaction.Running"}),yi=g({...Av,status:ae("completed"),reason:ce(["auto","manual"]),model:Er.pipe(p),providerState:Pt.pipe(p),summary:d,recent:d,providerContext:KL.pipe(p),...rO}).annotate({identifier:"Session.Message.Compaction.Completed"}),Mv=g({...Av,status:ae("failed"),reason:ce(["auto","manual"]),error:Yr,...rO}).annotate({identifier:"Session.Message.Compaction.Failed"}),vj=ie([xj,yi,Mv]).pipe(Be("status"),Jr({identifier:"Session.Message.Compaction"})),Sj=g({...mr,type:ae("idle"),outcome:ce(["succeeded","failed","interrupted"])}).annotate({identifier:"Session.Message.Idle"}),Ate=ie([QL,ej,tj,rj,nj,oj,ij,sj,yj,vj,Sj]).annotate({identifier:"Session.Message.Info"});var bj=g({file:d,patch:d,additions:q,deletions:q,status:ce(["added","deleted","modified"])}).annotate({identifier:"FileDiff.Info"}),Nte=g({file:d.pipe(p),patch:d.pipe(p),additions:Re,deletions:Re,status:ce(["added","deleted","modified"]).pipe(p)}).annotate({identifier:"FileDiff.LegacyInfo"});var Rn=g({messageID:He,partID:d.pipe(p),snapshot:xo.pipe(p),files:Y(bj).pipe(p)}).annotate({identifier:"Session.Revert"}),_j=g({path:d,status:ce(["added","modified","deleted"]),additions:Re,deletions:Re,patch:d}),oO=g({messageID:He,partID:d.pipe(p),snapshot:d.pipe(p),diff:d.pipe(p),files:Y(_j).pipe(p)}).annotate({identifier:"Session.RevertV1"}),kj=Rn.pipe(wr(g({source:ae("current"),revert:ui(Rn)}),so({decode:(e)=>({source:"current",revert:e}),encode:(e)=>e.revert}))),wj=oO.pipe(wr(g({source:ae("legacy"),revert:ui(oO)}),so({decode:(e)=>({source:"legacy",revert:e}),encode:(e)=>e.revert}))),Zte=ie([kj,wj]).pipe(Be("source"),wr(ui(Rn),so({decode:(e)=>{if(e.source==="current")return e.revert;return Rn.make({messageID:e.revert.messageID,partID:e.revert.partID,snapshot:e.revert.snapshot?xo.make(e.revert.snapshot):void 0,files:e.revert.files?.map((t)=>({file:t.path,status:t.status,additions:t.additions,deletions:t.deletions,patch:t.patch}))})},encode:(e)=>({source:"current",revert:e})})),Jr({identifier:"Session.Revert.Persisted"}));var Ij=d.check(pi(/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._/-]*$/)).pipe(xe("Instruction.Key")),iO=d.check(pi(/^[a-f0-9]{64}$/)).pipe(xe("Instruction.Hash")),Tj=J(Ij,iO),sO=F("removed"),Hte=sO.make("removed"),Ej=J(d,ie([iO,sO]));var $j=d.check(pi(/^[a-z0-9][a-z0-9._-]*$/)).annotate({identifier:"InstructionEntry.Key",description:"Instruction entry key (lowercase alphanumerics plus . _ -)"}),Oj=g({key:$j,value:Ir.annotate({description:"JSON value attached to the session's instructions"})}).annotate({identifier:"InstructionEntry.Info"}),Dj=Y(g({...Oj.fields,removed:be})).annotate({identifier:"InstructionEntry.Snapshot"});class Pj extends fv()("InstructionEntryValueTooLargeError",{actualBytes:qt,maxBytes:qt,message:d},{httpApiStatus:413}){}var _a=ce(["steer","queue"]).annotate({identifier:"Session.Inbox.Delivery"}),Cj=g({...yo.fields,metadata:J(d,ct).pipe(p)}).annotate({identifier:"Session.Inbox.UserPayload"}),Rj=g({text:d,description:d.pipe(p),metadata:J(d,ct).pipe(p)}).annotate({identifier:"Session.Inbox.SyntheticPayload"}),Aj=g({}).annotate({identifier:"Session.Inbox.CompactionPayload"}),lO=g({location:Cn,projectID:Dt,subpath:Xt.pipe(p)}).annotate({identifier:"Session.Inbox.MovePayload"}),uO=g({type:ae("user"),payload:Cj,delivery:_a}),dO=g({type:ae("synthetic"),payload:Rj,delivery:_a}),pO=g({type:ae("compaction"),payload:Aj,delivery:_a}),mO=g({type:ae("move"),payload:lO,delivery:_a}),Mj=ie([uO,dO,pO,mO]).pipe(Be("type"),Jr({identifier:"Session.Inbox.Item"})),Id={id:He,sessionID:pr,time:g({created:Xe})},Uj=g({...Id,...uO.fields}).annotate({identifier:"Session.Inbox.User"}),Nj=g({...Id,...dO.fields}).annotate({identifier:"Session.Inbox.Synthetic"}),Fj=g({...Id,...pO.fields}).annotate({identifier:"Session.Inbox.Compaction"}),zj=g({...Id,...mO.fields}).annotate({identifier:"Session.Inbox.Move"}),tre=ie([Uj,Nj,Fj,zj]).pipe(Be("type"),Jr({identifier:"Session.Inbox.Info"}));var hO=ie([g({type:F("before"),messageID:He}),g({type:F("through"),messageID:He})]).annotate({identifier:"Session.ForkBoundary"});var Dre=g({start:q,end:q,text:d}).annotate({identifier:"Session.Event.Source"}),V={sessionID:pr},X={durable:{aggregate:"sessionID",version:1}},Lj=j({type:"session.created",...X,schema:{...V,projectID:Dt,location:Cn,subpath:Xt.pipe(p),parentID:pr.pipe(p),slug:d,title:d.pipe(p),agent:Kr.pipe(p),model:Er.pipe(p),metadata:Sa.pipe(p),permissions:yd.pipe(p),version:d}}),jj=j({type:"session.agent.selected",...X,schema:{...V,agent:Kr,previous:Kr.pipe(p)}}),Gj=j({type:"session.model.selected",...X,schema:{...V,model:Er,previous:Er.pipe(p)}}),Zj=j({type:"session.moved",...X,schema:{...V,...lO.fields}}),Bj=j({type:"session.renamed",...X,schema:{...V,title:d}}),qj=j({type:"session.metadata.updated",...X,schema:{...V,metadata:Sa}}),Hj=j({type:"session.permissions",...X,schema:{...V,permissions:yd}}),Vj=j({type:"session.viewed",...X,schema:{...V,idle:Re}}),Wj=j({type:"session.message.content.updated",...X,schema:{...V,messageID:He,content:Y(hj)}}),Jj=j({type:"session.usage.recorded",...X,schema:{...V,source:ce(["title","compaction"]),cost:go,tokens:vo}}),Kj=L({type:"session.usage.updated",schema:{...V,cost:go,tokens:vo}}),Yj=j({type:"session.deleted",durable:{aggregate:"sessionID",version:2},schema:V}),Xj=j({type:"session.forked",durable:{aggregate:"sessionID",version:2},schema:{...V,parentID:pr,boundary:hO,instructions:Tj.pipe(p),instructionEntries:Dj.pipe(p)}}),Ed={...V,inboxID:He},Qj=j({type:"session.inbox.delivered",...X,schema:Ed}),e1=j({type:"session.inbox.enqueued",...X,schema:{...Ed,item:Mj}}),t1=j({type:"session.inbox.cancelled",...X,schema:Ed}),r1=j({type:"session.inbox.delivery.changed",...X,schema:{...Ed,delivery:_a}}),xi;(function(e){e.Started=j({type:"session.execution.started",...X,schema:V}),e.Succeeded=j({type:"session.execution.succeeded",...X,schema:V}),e.Failed=j({type:"session.execution.failed",...X,schema:{...V,error:Yr}}),e.Interrupted=j({type:"session.execution.interrupted",...X,schema:{...V,reason:ce(["user","shutdown","superseded","inactivity"])}})})(xi||(xi={}));var n1=j({type:"session.instructions.updated",durable:{aggregate:"sessionID",version:2},schema:{...V,delta:Ej,text:d.pipe(p)}}),o1=j({type:"session.synthetic",...X,schema:{...V,text:d,description:d.pipe(p),metadata:J(d,ct).pipe(p)}}),Nv;(function(e){e.Activated=j({type:"session.skill.activated",...X,schema:{...V,id:Sd,name:bd,text:d}})})(Nv||(Nv={}));var Td;(function(e){e.Started=j({type:"session.shell.started",...X,schema:{...V,shell:Pv}}),e.Ended=j({type:"session.shell.ended",...X,schema:{...V,shell:Pv,output:eO}})})(Td||(Td={}));var vi;(function(e){e.Started=j({type:"session.step.started",...X,schema:{...V,assistantMessageID:He,agent:Kr,model:Er,snapshot:xo.pipe(p),started:q}}),e.Streamed=j({type:"session.step.streamed",...X,schema:{...V,assistantMessageID:He}}),e.Ended=j({type:"session.step.ended",...X,schema:{...V,assistantMessageID:He,finish:vd,rawFinish:d.pipe(p),providerState:Pt.pipe(p),cost:go,tokens:vo,snapshot:xo.pipe(p),files:Y(Xt).pipe(p)}}),e.Failed=j({type:"session.step.failed",...X,schema:{...V,assistantMessageID:He,error:Yr,finish:ce(["content-filter"]).pipe(p),rawFinish:d.pipe(p),providerState:Pt.pipe(p),cost:go.pipe(p),tokens:vo.pipe(p),snapshot:xo.pipe(p),files:Y(Xt).pipe(p)}})})(vi||(vi={}));var ka;(function(e){e.Started=j({type:"session.text.started",...X,schema:{...V,assistantMessageID:He,ordinal:q}}),e.Delta=L({type:"session.text.delta",schema:{...V,assistantMessageID:He,ordinal:q,delta:d}}),e.Ended=j({type:"session.text.ended",...X,schema:{...V,assistantMessageID:He,ordinal:q,text:d,state:Pt.pipe(p)}})})(ka||(ka={}));var wa;(function(e){e.Started=j({type:"session.reasoning.started",...X,schema:{...V,assistantMessageID:He,ordinal:q,state:Pt.pipe(p)}}),e.Delta=L({type:"session.reasoning.delta",schema:{...V,assistantMessageID:He,ordinal:q,delta:d}}),e.Ended=j({type:"session.reasoning.ended",...X,schema:{...V,assistantMessageID:He,ordinal:q,text:d,state:Pt.pipe(p)}})})(wa||(wa={}));var Xr;(function(e){let t={...V,assistantMessageID:He,id:d},n;(function(o){o.Started=j({type:"session.tool.input.started",...X,schema:{...t,name:d}}),o.Delta=L({type:"session.tool.input.delta",schema:{...t,delta:d}}),o.Ended=j({type:"session.tool.input.ended",...X,schema:{...t,text:d}})})(n=e.Input||(e.Input={})),e.Called=j({type:"session.tool.called",...X,schema:{...t,input:J(d,ct),executed:be,state:Pt.pipe(p)}}),e.Progress=L({type:"session.tool.progress",schema:{...t,metadata:J(d,Ir)}}),e.Success=j({type:"session.tool.success",durable:{aggregate:"sessionID",version:2},schema:{...t,content:ma(gi),metadata:J(d,Ir).pipe(p),executed:be,resultState:Pt.pipe(p)}}),e.Failed=j({type:"session.tool.failed",durable:{aggregate:"sessionID",version:2},schema:{...t,error:Yr,content:ma(gi).pipe(p),metadata:J(d,Ir).pipe(p),executed:be,resultState:Pt.pipe(p)}})})(Xr||(Xr={}));var i1=j({type:"session.retry.scheduled",...X,schema:{...V,assistantMessageID:He,attempt:qe,at:q,error:Yr}}),Si;(function(e){e.Started=j({type:"session.compaction.started",...X,schema:{...V,reason:ce(["auto","manual"]),recent:d,inputID:He.pipe(p)}}),e.Delta=L({type:"session.compaction.delta",schema:{...V,text:d}}),e.Ended=j({type:"session.compaction.ended",...X,schema:{...V,reason:e.Started.data.fields.reason,model:yi.fields.model,providerState:yi.fields.providerState,providerContext:yi.fields.providerContext,text:d,recent:d,cost:yi.fields.cost,tokens:yi.fields.tokens}}),e.Failed=j({type:"session.compaction.failed",...X,schema:{...V,reason:e.Started.data.fields.reason,error:Yr,inputID:He.pipe(p),cost:Mv.fields.cost,tokens:Mv.fields.tokens}})})(Si||(Si={}));var Ia;(function(e){e.Staged=j({type:"session.revert.staged",...X,schema:{...V,revert:Rn}}),e.Cleared=j({type:"session.revert.cleared",...X,schema:V}),e.Committed=j({type:"session.revert.committed",...X,schema:{...V,to:He}})})(Ia||(Ia={}));var gO=le(Lj,jj,Gj,Zj,Bj,qj,Hj,Vj,Kj,Yj,Xj,Qj,e1,t1,r1,xi.Started,xi.Succeeded,xi.Failed,xi.Interrupted,n1,o1,Nv.Activated,Td.Started,Td.Ended,vi.Started,vi.Streamed,vi.Ended,vi.Failed,ka.Started,ka.Delta,ka.Ended,wa.Started,wa.Delta,wa.Ended,Xr.Input.Started,Xr.Input.Delta,Xr.Input.Ended,Xr.Called,Xr.Progress,Xr.Success,Xr.Failed,i1,Si.Started,Si.Delta,Si.Ended,Si.Failed,Ia.Staged,Ia.Cleared,Ia.Committed),s1=le(...gO.filter((e)=>e.durability==="durable"),Jj,Wj),a1=le(...gO.filter((e)=>e.durability==="ephemeral")),c1=ie(s1,{mode:"oneOf"}).pipe(Be("type")).annotate({identifier:"Session.Event.Durable"}),Pre=ie([c1,...a1],{mode:"oneOf"}).pipe(Be("type"));var So=pr,l1=Sa;var u1=hO,Hre=g({id:So,parentID:So.pipe(p),fork:g({sessionID:So,boundary:u1}).pipe(p),projectID:Dt,agent:Kr.pipe(p),model:Er.pipe(p),cost:go,tokens:vo,outcome:ce(["succeeded","failed","interrupted"]).pipe(p),time:g({created:Xe,updated:Xe,idle:Xe.pipe(p),viewed:Xe.pipe(p),archived:Xe.pipe(p)}),title:d.pipe(p),location:Cn,subpath:Xt.pipe(p),metadata:l1.pipe(p),permissions:yd.pipe(p),revert:Rn.pipe(p)}).annotate({identifier:"Session.Info"}),Vre=g({id:So,time:Re,direction:ce(["previous","next"])}).annotate({identifier:"Session.ListAnchor"});var bO=g({...$v.fields,sessionID:So,foregroundProcess:dv(d),size:g({cols:qe,rows:qe}),output:g({head:q,tail:q})}).annotate({identifier:"PersistentPty.Info"}),Qre=g({directory:d,instanceID:d,ticket:d,expiresAt:Bt}).annotate({identifier:"PersistentPty.Handoff"}),ene=g({command:p(d),args:Y(d),cwd:p(d),title:d,env:J(d,d),size:p(g({cols:qe,rows:qe}))}).annotate({identifier:"PersistentPty.CreateInput"}),tne=g({attachmentID:p(d),size:g({cols:qe,rows:qe})}).annotate({identifier:"PersistentPty.UpdateInput"}),d1=g({info:bO,text:d,checkpoint:Tz,cursor:g({x:q,y:q})}).annotate({identifier:"PersistentPty.Snapshot"}),rne=qe.check(hz(65535)).annotate({identifier:"PersistentPty.ReadLines"}),nne=g({ptyID:xa,title:d,cwd:d,foregroundProcess:dv(d),screen:g({text:d,cols:qe,rows:qe,cursor:d1.fields.cursor})}).annotate({identifier:"PersistentPty.ReadResult"}),vO=L({type:"persistent-pty.added",schema:{sessionID:So,terminal:bO}}),SO=L({type:"persistent-pty.removed",schema:{sessionID:So,ptyID:xa}}),one={Added:vO,Removed:SO,Definitions:le(vO,SO)};var kO=L({type:"reference.updated",schema:{}}),lne={Updated:kO,Definitions:le(kO)},p1=g({type:F("local"),path:Le,description:d.pipe(p),hidden:be.pipe(p)}).annotate({identifier:"Reference.LocalSource"}),m1=g({type:F("git"),repository:d,branch:d.pipe(p),description:d.pipe(p),hidden:be.pipe(p)}).annotate({identifier:"Reference.GitSource"}),f1=ie([p1,m1]).pipe(Be("type")).annotate({identifier:"Reference.Source"}),une=g({name:d,path:Le,description:d.pipe(p),hidden:be.pipe(p),source:f1}).annotate({identifier:"Reference.Info"});var h1=g({current:p(d),default:p(d)}).annotate({identifier:"Vcs.Branch"}),mne=g({provider:p(d),branch:h1}).annotate({identifier:"Vcs.Info"}),fne=Y(d).annotate({identifier:"Vcs.BranchList"}),hne=g({name:d,ref:d,source:ce(["reflog","default"])}).annotate({identifier:"Vcs.Base"}),gne=ce(["working","branch","committed"]).annotate({identifier:"Vcs.Mode"}),yne=g({file:d,additions:q,deletions:q,status:ce(["added","deleted","modified"])}).annotate({identifier:"Vcs.FileStatus"});var Fv=d.pipe(xe("WebSearch.ID")),bne=g({id:Fv,name:d}).annotate({identifier:"WebSearch.Provider"}),_ne=g({query:d,providerID:Fv.pipe(p)}).annotate({identifier:"WebSearch.Input"}),g1=g({url:d,title:d.pipe(p),content:d.pipe(p),time:g({published:Re.pipe(p).annotate({description:"Publication time in milliseconds since the Unix epoch"})})}).annotate({identifier:"WebSearch.Result"});class y1 extends mo("WebSearch.Response")({providerID:Fv,results:Y(g1)}){}var EO=L({type:"websearch.updated",schema:{}}),kne={Updated:EO,Definitions:le(EO)};var $ne=t$.pipe(YE(e$()),xe("Worktree.StrategyID")),One=g({projectID:Dt,from:p(Le),branch:p(t$.pipe(YE(e$()))),directory:p(Le).annotate({description:"Parent directory for the new worktree. Uses the project's canonical configuration, then defaults to the server's data directory under worktree/<first six project ID characters>."}),name:p(d)}).annotate({identifier:"Worktree.CreateInput"}),Dne=g({projectID:Dt,directory:Le,force:be}).annotate({identifier:"Worktree.RemoveInput"}),Pne=g({directory:Le}).annotate({identifier:"Worktree.Info"}),x1=g({directory:Le,strategy:p(d)}).annotate({identifier:"Worktree.Directory"}),Cne=g({directory:Le,type:ce(["root","worktree"])}).annotate({identifier:"Worktree.ListEntry"});class v1 extends fv()("Worktree.OperationError",{message:d,forceRequired:p(be)}){}var Rne=Y(x1).annotate({identifier:"Worktree.List"}),OO=L({type:"worktree.updated",schema:{projectID:Dt}}),DO=j({type:"worktree.resolved",durable:{aggregate:"projectID",version:1},schema:{projectID:Dt,directory:Le,previous:Dt,adopted:p(Y(Dt))}}),Ane={Updated:OO,Resolved:DO,Definitions:le(OO,DO)};xs();tr();function S1(e){let t=e.location,n=typeof t?.directory==="string"&&t.directory.length>0?t.directory:process.cwd();return{project:t?.project??null,directory:n}}function CO(e){let{project:t,directory:n}=S1(e);return{client:null,project:t,directory:n,worktree:n,experimental_workspace:{register(){}},serverUrl:new URL("http://localhost"),$:null}}function RO(e){let t=(()=>{let s=e.options;if(s!==null&&typeof s==="object"&&!Array.isArray(s))return s;return{}})(),n=t.meta_governor,o=n!==null&&typeof n==="object"&&!Array.isArray(n)?n:{},{meta_governor:r,...i}=t;return{meta_governor:{...i,...o}}}tr();function b1(e){return e.map((t)=>typeof t?.text==="string"?t.text:JSON.stringify(t??null)).join(`
303
303
 
304
304
  `)}function AO(e){if(e===null||typeof e!=="object")return null;let t=e;if(typeof t.id==="string")return t.id;let n=t.data;if(n!==null&&typeof n==="object"){let o=n.info;if(o!==null&&typeof o==="object"){let r=o.id;if(typeof r==="string")return r}}return null}function _1(e){return typeof e==="function"?e:null}class zv{session;constructor(e){let t=e.session;this.session={prompt:async(n)=>{let o=Array.isArray(n?.body?.parts)?n.body.parts:[],r=n?.path?.id??"";if(!r)return w("warn","v2_session_client_missing_session_id"),null;let i=_1(t?.prompt);if(!i)return w("warn","v2_session_client_no_prompt_fn"),null;let s=i.bind(t),a=b1(o);try{let l=await s({sessionID:r,text:a}),c=AO(l);return c?{data:{info:{id:c}}}:null}catch(l){w("warn","v2_session_client_flat_shape_failed",{message:l instanceof Error?l.message:String(l)})}try{let l=await s({path:{id:r},body:{parts:o}}),c=AO(l);return c?{data:{info:{id:c}}}:null}catch(l){return w("warn","v2_session_client_prompt_failed",{message:l instanceof Error?l.message:String(l)}),null}}}}}tr();var k1=new Set(["tool.execute.before","tool.execute.after","experimental.chat.system.transform","experimental.chat.messages.transform","experimental.session.compacting","permission.ask","tool.definition","command.execute.before","experimental.provider.small_model","experimental.compaction.autocontinue","event","dispose","tool"]);function Qr(e){return e instanceof Error?e.message:String(e)}function MO(e){if(e===null||typeof e!=="object")return null;let t=e;if(t.type!=="text"||typeof t.text!=="string")return null;return t.text}function w1(e){if(typeof e==="string")return e;try{let t=JSON.stringify(e);return typeof t==="string"?t:String(e)}catch{return String(e)}}function I1(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(n===null||typeof n!=="object")continue;let o=n;if(o.type==="text"&&typeof o.text==="string")t.push({type:"text",text:o.text})}return t}function T1(e){if(!Array.isArray(e))return"";return e.map((t)=>{if(t===null||typeof t!=="object")return"";let n=t;return n.type==="text"&&typeof n.text==="string"?n.text:""}).filter((t)=>t.length>0).join(`
305
305
 
306
- `)}async function UO(e,t){let n=[],o=t["tool.execute.before"];if(o)n.push(await e.tool.hook("execute.before",async(u)=>{let f={get args(){return u.input},set args(h){u.input=h}};try{await o({tool:u.tool,sessionID:u.sessionID,callID:u.id},f)}catch(h){throw w("warn","v2_bridge_before_hook_block",{tool:u.tool,message:Qr(h)}),h}}));else w("info","v2_bridge_skip_before",{reason:"V1 hook absent (plugin disabled or factory omitted it)"});let r=t["tool.execute.after"];if(r)n.push(await e.tool.hook("execute.after",async(u)=>{let f={title:"",output:u.status==="completed"?w1(u.result):"",metadata:u};try{await r({tool:u.tool,sessionID:u.sessionID,callID:u.id,args:u.input},f)}catch(h){w("warn","v2_bridge_after_hook_failed",{tool:u.tool,message:Qr(h)})}}));else w("info","v2_bridge_skip_after",{reason:"V1 hook absent (plugin disabled or factory omitted it)"});let i=t["experimental.chat.system.transform"],s=t["experimental.chat.messages.transform"];if(i??s)n.push(await e.session.hook("context",async(u)=>{if(i)try{let f=[],h=[];u.system.forEach((m,y)=>{let k=MO(m);if(k!==null)f.push(y),h.push(k)}),await i({sessionID:u.sessionID,model:u.model},{system:h}),h.forEach((m,y)=>{if(y<f.length){let k=f[y];if(MO(u.system[k])!==m)u.system[k]={type:"text",text:m}}else u.system.push({type:"text",text:m})})}catch(f){w("warn","v2_bridge_system_transform_failed",{message:Qr(f)})}if(s)try{let f=u.messages.map((m)=>({info:{sessionID:u.sessionID,role:m.role??"user"},parts:I1(m.content)})),h=f.length;await s({},{messages:f});for(let m=h;m<f.length;m++){let y=T1(f[m].parts);if(y)u.messages.push({role:"assistant",content:[{type:"text",text:y}]})}if(f.length>h)w("info","v2_bridge_messages_injected",{count:f.length-h})}catch(f){w("warn","v2_bridge_messages_transform_failed",{message:Qr(f)})}}));else w("info","v2_bridge_skip_context",{reason:"both V1 chat transforms absent (plugin disabled or omitted)"});let a=t["experimental.session.compacting"];if(a)n.push(await e.session.hook("compaction",async(u)=>{try{let f={context:[]};await a({sessionID:u.sessionID},f);for(let h of f.context)if(typeof h==="string"&&h.length>0)u.system.push({type:"text",text:h});if(typeof f.prompt==="string"&&f.prompt.length>0)u.system.push({type:"text",text:f.prompt}),w("info","v2_bridge_compaction_prompt_folded_to_system")}catch(f){w("warn","v2_bridge_compaction_failed",{message:Qr(f)})}}));else w("info","v2_bridge_skip_compaction",{reason:"V1 hook absent (plugin disabled or factory omitted it)"});let l=t["permission.ask"];if(l)n.push(await e.permission.hook("evaluate",async(u)=>{try{let f=u.resources.length>0&&typeof u.resources[0]==="string"?u.resources[0]:"",h={type:u.action,command:f,pattern:f,url:f,resources:u.resources,sessionID:u.sessionID},m=u.effect==="deny"||u.effect==="ask"||u.effect==="allow"?u.effect:"allow";if(await l(h,{get status(){return m},set status(k){m=k}}),u.effect=m,m!=="allow"&&u.message===void 0)u.message=`[meta-governor] permission ${m} by governance policy`}catch(f){w("warn","v2_bridge_permission_failed_default_allow",{action:u.action,message:Qr(f)})}}));else w("info","v2_bridge_skip_permission",{reason:"V1 hook absent (plugin disabled or factory omitted it)"});let c=t["tool.definition"];if(c)await e.tool.transform((u)=>{for(let f of u.list())try{let h=f.input,m=h!==null&&typeof h==="object"?h:{properties:{}},y={description:f.description,parameters:m};if(Promise.resolve(c({toolID:f.id},y)).catch((k)=>{w("warn","v2_bridge_tool_definition_failed",{toolID:f.id,message:Qr(k)})}),y.description!==f.description){let k=y.description;u.update(f.id,(S)=>{S.description=k})}}catch(h){w("warn","v2_bridge_tool_definition_failed",{toolID:f.id,message:Qr(h)})}});else w("info","v2_bridge_skip_tool_definition",{reason:"V1 hook absent (plugin disabled or factory omitted it)"});if(t["command.execute.before"])w("warn","v2_bridge_skip_command_filter",{reason:"commandFilter governance is V1-only until command transforms are implemented (no direct V2 hook)"});if(t["experimental.provider.small_model"])w("warn","v2_bridge_skip_small_model",{reason:"no V2 equivalent per the official plugin guide; model transforms are a separate feature"});if(t["experimental.compaction.autocontinue"])w("warn","v2_bridge_skip_autocontinue",{reason:"no V2 equivalent; overflow loop guard stays V1-only for now"});if(t.event)w("info","v2_bridge_skip_event",{reason:"already covered by the tool execute.before/after bridges; not re-subscribed"});for(let u of Object.keys(t)){if(k1.has(u))continue;let f;try{f=t[u]}catch(h){w("warn","v2_bridge_sweep_read_failed",{key:u,message:Qr(h)});continue}if(typeof f==="function")w("warn","v2_bridge_skip_unmapped_hook",{key:u,reason:"no V2 equivalent mapped; left unregistered"})}return n}tr();_o();var Lv=V.schema;function NO(e){if(typeof e!=="object"||e===null)return{};let t=e,n=t._zod?.def??t.def;return typeof n==="object"&&n!==null?n:{}}function E1(e){if(typeof e!=="object"||e===null)return;try{let t=e.meta?.call(e);if(typeof t==="object"&&t!==null){let n=t.description;if(typeof n==="string"&&n.length>0)return n}}catch{}return}function en(e,t){let n=E1(t);if(n!==void 0)e.description=n;return e}function $d(e){let t=NO(e);switch(typeof t.type==="string"?t.type:""){case"string":return en({type:"string"},e);case"number":return en({type:"number"},e);case"boolean":return en({type:"boolean"},e);case"enum":{let o=t.entries,r=typeof o==="object"&&o!==null?Object.keys(o):[];return en({type:"string",enum:r},e)}case"literal":{let o=Array.isArray(t.values)?t.values:[];return en({enum:o},e)}case"array":{let o=t.element!==void 0?$d(t.element):{};return en({type:"array",items:o},e)}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"success":if(t.innerType!==void 0)return $d(t.innerType);return en({},e);case"object":{let o=e._zod?.def?.shape,r={},i=[];if(o&&typeof o==="object")for(let[a,l]of Object.entries(o)){r[a]=$d(l);let c=NO(l).type;if(c!=="optional"&&c!=="default")i.push(a)}let s={type:"object",properties:r};if(i.length>0)s.required=i;return en(s,e)}default:return en({},e)}}function $1(e,t){try{let n=Lv.toJSONSchema;if(typeof n==="function"){let o=n(Lv.object(t));if(typeof o==="object"&&o!==null){let{$schema:r,...i}=o;if(typeof i.type==="string")return{schema:i,usedFallback:!1};return{schema:{type:"object",...i},usedFallback:!1}}}}catch(n){w("warn",`v2-tools ${e}: toJSONSchema failed, trying structural fallback`,{message:n instanceof Error?n.message:String(n)})}try{return{schema:$d(Lv.object(t)),usedFallback:!0}}catch(n){return w("warn",`v2-tools ${e}: schema conversion failed, using {type:object}`,{message:n instanceof Error?n.message:String(n)}),{schema:{type:"object"},usedFallback:!0}}}function O1(e){if(typeof e==="object"&&e!==null){let t=e;if(typeof t.sessionID==="string"&&t.sessionID.length>0)return t.sessionID;if(typeof t.sessionId==="string"&&t.sessionId.length>0)return t.sessionId}return""}function D1(e,t){if(typeof t==="string")return{content:t,metadata:{tool:e}};return{content:t.output,metadata:t.metadata??{tool:e}}}function P1(e,t,n){return async(o,r)=>{try{let s={sessionID:O1(r),messageID:"",agent:"",directory:n,worktree:n,abort:new AbortController().signal,metadata:()=>{},ask:async()=>{}},a=await t.execute(o,s);return D1(e,a)}catch(i){let s=i instanceof Error?i.message:String(i);return w("warn",`v2-tools ${e}: execute failed`,{message:s}),{content:`${e} failed: ${s}`,metadata:{tool:e,ok:!1}}}}}function FO(e,t={}){let n=t.cwd??process.cwd(),o=t.graphRetrieval??pe(),r=t.sqlite??Io(),i=t.metrics??Nl({sessionID:"__v2_tools__"}),s=t.logFilePath??Vt,a=t.healthFilePath??ft().health,l=t.onDispatch,c=[{name:"omo_search",build:()=>Qc({graphRetrieval:o,cwd:n})},{name:"omo_recall",build:()=>el({sqlite:r})},{name:"omo_health",build:()=>tl({metrics:i,logFilePath:s,healthFilePath:a})},{name:"omo_find",build:()=>rl({cwd:n})},{name:"omo_impact",build:()=>nl({cwd:n})},{name:"omo_remember",build:()=>ol({onDispatch:l})},{name:"omo_recall_mcp",build:()=>il({onDispatch:l})},{name:"omo_path",build:()=>sl({cwd:n})},{name:"omo_explain",build:()=>al({cwd:n})},{name:"omo_files",build:()=>cl({graphRetrieval:o,cwd:n})},{name:"omo_callers",build:()=>ll({graphRetrieval:o,cwd:n})},{name:"omo_node",build:()=>ul({graphRetrieval:o,cwd:n})},{name:"omo_context",build:()=>dl({graphRetrieval:o,cwd:n})},{name:"omo_affected_cg",build:()=>pl({graphRetrieval:o,cwd:n})},{name:"omo_status",build:()=>ml({graphRetrieval:o,cwd:n})},{name:"omo_unlock",build:()=>fl({graphRetrieval:o,cwd:n})},{name:"omo_mark_dirty",build:()=>hl({graphRetrieval:o,cwd:n})},{name:"omo_sync_if_dirty",build:()=>gl({graphRetrieval:o,cwd:n})},{name:"omo_index",build:()=>yl({graphRetrieval:o,cwd:n})},{name:"omo_visualize",build:()=>xl({graphRetrieval:o,cwd:n})},{name:"omo_serve",build:()=>vl({graphRetrieval:o,cwd:n})},{name:"omo_uninit",build:()=>Sl({graphRetrieval:o,cwd:n})},{name:"omo_diagnose",build:()=>bl({graphRetrieval:o,cwd:n})},{name:"omo_merge_graphs",build:()=>_l({graphRetrieval:o,cwd:n})},{name:"omo_save_result",build:()=>kl({graphRetrieval:o,cwd:n})},{name:"omo_extract",build:()=>wl({graphRetrieval:o,cwd:n})},{name:"omo_cluster_only",build:()=>Il({graphRetrieval:o,cwd:n})},{name:"omo_label",build:()=>Tl({graphRetrieval:o,cwd:n})},{name:"omo_tree",build:()=>El({graphRetrieval:o,cwd:n})},{name:"omo_clone",build:()=>$l({graphRetrieval:o,cwd:n})},{name:"omo_add",build:()=>Ol({graphRetrieval:o,cwd:n})},{name:"omo_check_update",build:()=>Dl({graphRetrieval:o,cwd:n})},{name:"omo_hook_status",build:()=>Pl({cwd:n})},{name:"omo_cli_anything_install",build:()=>Rl({cwd:n})},{name:"omo_cli_anything_list",build:()=>Al({cwd:n})},{name:"omo_cli_anything_search",build:()=>Ml({cwd:n})},{name:"omo_cli_anything_info",build:()=>Ul({cwd:n})}],u=[];for(let f of c)try{let h=f.build(),{schema:m,usedFallback:y}=$1(f.name,h.args);if(y)w("warn",`v2-tools ${f.name}: registered with fallback JSON schema`,{tool:f.name});let k={name:f.name,description:h.description,input:m,execute:P1(f.name,h,n)};e.add(k),u.push(f.name)}catch(h){w("warn",`v2-tools: skipped ${f.name}`,{tool:f.name,message:h instanceof Error?h.message:String(h)})}return u}function zO(e={},t={}){return{id:"omo-meta-governor",setup:async(n)=>{w("info","v2_setup_start",{directory:n?.location?.directory??null});let o=CO(n),r=RO(n),i=Yl(e,t),s;try{s=await i(o,r)}catch(l){throw w("error","v2_setup_factory_failed",{message:l instanceof Error?l.message:String(l),stack:l instanceof Error?l.stack?.slice(0,800):void 0}),l}try{Yc(new zv(n))}catch(l){w("warn","v2_setup_session_client_failed",{message:l instanceof Error?l.message:String(l)})}let a=[];try{a=await UO(n,s)}catch(l){w("warn","v2_setup_bridge_failed",{message:l instanceof Error?l.message:String(l)})}try{await n.tool.transform((l)=>{try{let c=FO(l);w("info",`v2_setup_tools_registered: ${c.length} omo_* tools`)}catch(c){w("warn","v2_setup_tools_failed",{message:c instanceof Error?c.message:String(c)})}})}catch(l){w("warn","v2_setup_tool_transform_failed",{message:l instanceof Error?l.message:String(l)})}return w("info","v2_setup_ready",{hookRegistrations:a.length}),async()=>{for(let l of a)try{await l.dispose()}catch(c){w("warn","v2_setup_registration_dispose_failed",{message:c instanceof Error?c.message:String(c)})}try{await s.dispose?.()}catch(l){w("warn","v2_setup_v1_dispose_failed",{message:l instanceof Error?l.message:String(l)})}}}}}var C1=Yl();function R1(e,t){return C1(e,t)}var A1=vU(zO()),M1={...A1,id:"omo-meta-governor",server:R1},koe=M1;export{koe as default};
306
+ `)}async function UO(e,t){let n=[],o=t["tool.execute.before"];if(o)n.push(await e.tool.hook("execute.before",async(u)=>{let f={get args(){return u.input},set args(h){u.input=h}};try{await o({tool:u.tool,sessionID:u.sessionID,callID:u.id},f)}catch(h){throw w("warn","v2_bridge_before_hook_block",{tool:u.tool,message:Qr(h)}),h}}));else w("info","v2_bridge_skip_before",{reason:"V1 hook absent (plugin disabled or factory omitted it)"});let r=t["tool.execute.after"];if(r)n.push(await e.tool.hook("execute.after",async(u)=>{let f={title:"",output:u.status==="completed"?w1(u.result):"",metadata:u};try{await r({tool:u.tool,sessionID:u.sessionID,callID:u.id,args:u.input},f)}catch(h){w("warn","v2_bridge_after_hook_failed",{tool:u.tool,message:Qr(h)})}}));else w("info","v2_bridge_skip_after",{reason:"V1 hook absent (plugin disabled or factory omitted it)"});let i=t["experimental.chat.system.transform"],s=t["experimental.chat.messages.transform"];if(i??s)n.push(await e.session.hook("context",async(u)=>{if(i)try{let f=[],h=[];u.system.forEach((m,y)=>{let k=MO(m);if(k!==null)f.push(y),h.push(k)}),await i({sessionID:u.sessionID,model:u.model},{system:h}),h.forEach((m,y)=>{if(y<f.length){let k=f[y];if(MO(u.system[k])!==m)u.system[k]={type:"text",text:m}}else u.system.push({type:"text",text:m})})}catch(f){w("warn","v2_bridge_system_transform_failed",{message:Qr(f)})}if(s)try{let f=u.messages.map((m)=>({info:{sessionID:u.sessionID,role:m.role??"user"},parts:I1(m.content)})),h=f.length;await s({},{messages:f});for(let m=h;m<f.length;m++){let y=T1(f[m].parts);if(y)u.messages.push({role:"assistant",content:[{type:"text",text:y}]})}if(f.length>h)w("info","v2_bridge_messages_injected",{count:f.length-h})}catch(f){w("warn","v2_bridge_messages_transform_failed",{message:Qr(f)})}}));else w("info","v2_bridge_skip_context",{reason:"both V1 chat transforms absent (plugin disabled or omitted)"});let a=t["experimental.session.compacting"];if(a)n.push(await e.session.hook("compaction",async(u)=>{try{let f={context:[]};await a({sessionID:u.sessionID},f);for(let h of f.context)if(typeof h==="string"&&h.length>0)u.system.push({type:"text",text:h});if(typeof f.prompt==="string"&&f.prompt.length>0)u.system.push({type:"text",text:f.prompt}),w("info","v2_bridge_compaction_prompt_folded_to_system")}catch(f){w("warn","v2_bridge_compaction_failed",{message:Qr(f)})}}));else w("info","v2_bridge_skip_compaction",{reason:"V1 hook absent (plugin disabled or factory omitted it)"});let l=t["permission.ask"];if(l)n.push(await e.permission.hook("evaluate",async(u)=>{try{let f=u.resources.length>0&&typeof u.resources[0]==="string"?u.resources[0]:"",h={type:u.action,command:f,pattern:f,url:f,resources:u.resources,sessionID:u.sessionID},m=u.effect==="deny"||u.effect==="ask"||u.effect==="allow"?u.effect:"allow";if(await l(h,{get status(){return m},set status(k){m=k}}),u.effect=m,m!=="allow"&&u.message===void 0)u.message=`[meta-governor] permission ${m} by governance policy`}catch(f){w("warn","v2_bridge_permission_failed_default_allow",{action:u.action,message:Qr(f)})}}));else w("info","v2_bridge_skip_permission",{reason:"V1 hook absent (plugin disabled or factory omitted it)"});let c=t["tool.definition"];if(c)await e.tool.transform((u)=>{for(let f of u.list())try{let h=f.input,m=h!==null&&typeof h==="object"?h:{properties:{}},y={description:f.description,parameters:m};if(Promise.resolve(c({toolID:f.id},y)).catch((k)=>{w("warn","v2_bridge_tool_definition_failed",{toolID:f.id,message:Qr(k)})}),y.description!==f.description){let k=y.description;u.update(f.id,(S)=>{S.description=k})}}catch(h){w("warn","v2_bridge_tool_definition_failed",{toolID:f.id,message:Qr(h)})}});else w("info","v2_bridge_skip_tool_definition",{reason:"V1 hook absent (plugin disabled or factory omitted it)"});if(t["command.execute.before"])w("warn","v2_bridge_skip_command_filter",{reason:"commandFilter governance is V1-only until command transforms are implemented (no direct V2 hook)"});if(t["experimental.provider.small_model"])w("warn","v2_bridge_skip_small_model",{reason:"no V2 equivalent per the official plugin guide; model transforms are a separate feature"});if(t["experimental.compaction.autocontinue"])w("warn","v2_bridge_skip_autocontinue",{reason:"no V2 equivalent; overflow loop guard stays V1-only for now"});if(t.event)w("info","v2_bridge_skip_event",{reason:"already covered by the tool execute.before/after bridges; not re-subscribed"});for(let u of Object.keys(t)){if(k1.has(u))continue;let f;try{f=t[u]}catch(h){w("warn","v2_bridge_sweep_read_failed",{key:u,message:Qr(h)});continue}if(typeof f==="function")w("warn","v2_bridge_skip_unmapped_hook",{key:u,reason:"no V2 equivalent mapped; left unregistered"})}return n}tr();_o();var Lv=H.schema;function NO(e){if(typeof e!=="object"||e===null)return{};let t=e,n=t._zod?.def??t.def;return typeof n==="object"&&n!==null?n:{}}function E1(e){if(typeof e!=="object"||e===null)return;try{let t=e.meta?.call(e);if(typeof t==="object"&&t!==null){let n=t.description;if(typeof n==="string"&&n.length>0)return n}}catch{}return}function en(e,t){let n=E1(t);if(n!==void 0)e.description=n;return e}function $d(e){let t=NO(e);switch(typeof t.type==="string"?t.type:""){case"string":return en({type:"string"},e);case"number":return en({type:"number"},e);case"boolean":return en({type:"boolean"},e);case"enum":{let o=t.entries,r=typeof o==="object"&&o!==null?Object.keys(o):[];return en({type:"string",enum:r},e)}case"literal":{let o=Array.isArray(t.values)?t.values:[];return en({enum:o},e)}case"array":{let o=t.element!==void 0?$d(t.element):{};return en({type:"array",items:o},e)}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"success":if(t.innerType!==void 0)return $d(t.innerType);return en({},e);case"object":{let o=e._zod?.def?.shape,r={},i=[];if(o&&typeof o==="object")for(let[a,l]of Object.entries(o)){r[a]=$d(l);let c=NO(l).type;if(c!=="optional"&&c!=="default")i.push(a)}let s={type:"object",properties:r};if(i.length>0)s.required=i;return en(s,e)}default:return en({},e)}}function $1(e,t){try{let n=Lv.toJSONSchema;if(typeof n==="function"){let o=n(Lv.object(t));if(typeof o==="object"&&o!==null){let{$schema:r,...i}=o;if(typeof i.type==="string")return{schema:i,usedFallback:!1};return{schema:{type:"object",...i},usedFallback:!1}}}}catch(n){w("warn",`v2-tools ${e}: toJSONSchema failed, trying structural fallback`,{message:n instanceof Error?n.message:String(n)})}try{return{schema:$d(Lv.object(t)),usedFallback:!0}}catch(n){return w("warn",`v2-tools ${e}: schema conversion failed, using {type:object}`,{message:n instanceof Error?n.message:String(n)}),{schema:{type:"object"},usedFallback:!0}}}function O1(e){if(typeof e==="object"&&e!==null){let t=e;if(typeof t.sessionID==="string"&&t.sessionID.length>0)return t.sessionID;if(typeof t.sessionId==="string"&&t.sessionId.length>0)return t.sessionId}return""}function D1(e,t){if(typeof t==="string")return{content:t,metadata:{tool:e}};return{content:t.output,metadata:t.metadata??{tool:e}}}function P1(e,t,n){return async(o,r)=>{try{let s={sessionID:O1(r),messageID:"",agent:"",directory:n,worktree:n,abort:new AbortController().signal,metadata:()=>{},ask:async()=>{}},a=await t.execute(o,s);return D1(e,a)}catch(i){let s=i instanceof Error?i.message:String(i);return w("warn",`v2-tools ${e}: execute failed`,{message:s}),{content:`${e} failed: ${s}`,metadata:{tool:e,ok:!1}}}}}function FO(e,t={}){let n=t.cwd??process.cwd(),o=t.graphRetrieval??pe(),r=t.sqlite??Io(),i=t.metrics??Nl({sessionID:"__v2_tools__"}),s=t.logFilePath??Ht,a=t.healthFilePath??ft().health,l=t.onDispatch,c=[{name:"omo_search",build:()=>Qc({graphRetrieval:o,cwd:n})},{name:"omo_recall",build:()=>el({sqlite:r})},{name:"omo_health",build:()=>tl({metrics:i,logFilePath:s,healthFilePath:a})},{name:"omo_find",build:()=>rl({cwd:n})},{name:"omo_impact",build:()=>nl({cwd:n})},{name:"omo_remember",build:()=>ol({onDispatch:l})},{name:"omo_recall_mcp",build:()=>il({onDispatch:l})},{name:"omo_path",build:()=>sl({cwd:n})},{name:"omo_explain",build:()=>al({cwd:n})},{name:"omo_files",build:()=>cl({graphRetrieval:o,cwd:n})},{name:"omo_callers",build:()=>ll({graphRetrieval:o,cwd:n})},{name:"omo_node",build:()=>ul({graphRetrieval:o,cwd:n})},{name:"omo_context",build:()=>dl({graphRetrieval:o,cwd:n})},{name:"omo_affected_cg",build:()=>pl({graphRetrieval:o,cwd:n})},{name:"omo_status",build:()=>ml({graphRetrieval:o,cwd:n})},{name:"omo_unlock",build:()=>fl({graphRetrieval:o,cwd:n})},{name:"omo_mark_dirty",build:()=>hl({graphRetrieval:o,cwd:n})},{name:"omo_sync_if_dirty",build:()=>gl({graphRetrieval:o,cwd:n})},{name:"omo_index",build:()=>yl({graphRetrieval:o,cwd:n})},{name:"omo_visualize",build:()=>xl({graphRetrieval:o,cwd:n})},{name:"omo_serve",build:()=>vl({graphRetrieval:o,cwd:n})},{name:"omo_uninit",build:()=>Sl({graphRetrieval:o,cwd:n})},{name:"omo_diagnose",build:()=>bl({graphRetrieval:o,cwd:n})},{name:"omo_merge_graphs",build:()=>_l({graphRetrieval:o,cwd:n})},{name:"omo_save_result",build:()=>kl({graphRetrieval:o,cwd:n})},{name:"omo_extract",build:()=>wl({graphRetrieval:o,cwd:n})},{name:"omo_cluster_only",build:()=>Il({graphRetrieval:o,cwd:n})},{name:"omo_label",build:()=>Tl({graphRetrieval:o,cwd:n})},{name:"omo_tree",build:()=>El({graphRetrieval:o,cwd:n})},{name:"omo_clone",build:()=>$l({graphRetrieval:o,cwd:n})},{name:"omo_add",build:()=>Ol({graphRetrieval:o,cwd:n})},{name:"omo_check_update",build:()=>Dl({graphRetrieval:o,cwd:n})},{name:"omo_hook_status",build:()=>Pl({cwd:n})},{name:"omo_cli_anything_install",build:()=>Rl({cwd:n})},{name:"omo_cli_anything_list",build:()=>Al({cwd:n})},{name:"omo_cli_anything_search",build:()=>Ml({cwd:n})},{name:"omo_cli_anything_info",build:()=>Ul({cwd:n})}],u=[];for(let f of c)try{let h=f.build(),{schema:m,usedFallback:y}=$1(f.name,h.args);if(y)w("warn",`v2-tools ${f.name}: registered with fallback JSON schema`,{tool:f.name});let k={name:f.name,description:h.description,input:m,execute:P1(f.name,h,n)};e.add(k),u.push(f.name)}catch(h){w("warn",`v2-tools: skipped ${f.name}`,{tool:f.name,message:h instanceof Error?h.message:String(h)})}return u}function zO(e={},t={}){return{id:"omo-meta-governor",setup:async(n)=>{w("info","v2_setup_start",{directory:n?.location?.directory??null});let o=CO(n),r=RO(n),i=Yl(e,t),s;try{s=await i(o,r)}catch(l){throw w("error","v2_setup_factory_failed",{message:l instanceof Error?l.message:String(l),stack:l instanceof Error?l.stack?.slice(0,800):void 0}),l}try{Yc(new zv(n))}catch(l){w("warn","v2_setup_session_client_failed",{message:l instanceof Error?l.message:String(l)})}let a=[];try{a=await UO(n,s)}catch(l){w("warn","v2_setup_bridge_failed",{message:l instanceof Error?l.message:String(l)})}try{await n.tool.transform((l)=>{try{let c=FO(l);w("info",`v2_setup_tools_registered: ${c.length} omo_* tools`)}catch(c){w("warn","v2_setup_tools_failed",{message:c instanceof Error?c.message:String(c)})}})}catch(l){w("warn","v2_setup_tool_transform_failed",{message:l instanceof Error?l.message:String(l)})}return w("info","v2_setup_ready",{hookRegistrations:a.length}),async()=>{for(let l of a)try{await l.dispose()}catch(c){w("warn","v2_setup_registration_dispose_failed",{message:c instanceof Error?c.message:String(c)})}try{await s.dispose?.()}catch(l){w("warn","v2_setup_v1_dispose_failed",{message:l instanceof Error?l.message:String(l)})}}}}}var C1=Yl();function R1(e,t){return C1(e,t)}var A1=vU(zO()),M1={...A1,id:"omo-meta-governor",server:R1},koe=M1;export{koe as default};
307
307
 
308
- //# debugId=D2535CFED22491B364756E2164756E21
308
+ //# debugId=B037FD0A2ED316A364756E2164756E21
309
309
  //# sourceMappingURL=index.js.map