@sreetej510/pi-shipd-checks 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +5 -5
  2. package/dist/index.js +16 -17
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -12,9 +12,9 @@ For the flags you pass, `/checks`:
12
12
  uncommitted changes.
13
13
  2. Copies `agent_prompt.md`, `solution.patch`, and `test.patch` from your project root into
14
14
  that temp dir.
15
- 3. Optionally runs a 3-agent behavioral test-gap analysis: two specialized finders
16
- run in parallel (positive required-behavior gaps + negative forbidden-behavior gaps),
17
- then a strict validator filters the combined list.
15
+ 3. Optionally runs a two-agent behavioral test-gap analysis: one finder works through every
16
+ meaningful prompt sentence, submitting positive and negative candidates for each; a strict
17
+ reviewer then filters the combined list for fair, public behavioral assertions.
18
18
  4. Optionally runs the solver gap finder: several (configurable, default 3) TDD-style solver
19
19
  agents, each in its own throwaway git repo with `test.patch` and `agent_prompt.md` applied
20
20
  (never `solution.patch`), given write/edit/bash access to iterate until `./test.sh new`
@@ -44,7 +44,7 @@ The two finder flags are additive/combinable; `--config` must be used alone.
44
44
  | Command | Effect |
45
45
  |---|---|
46
46
  | `/checks` | List available options (runs nothing) |
47
- | `/checks --gap-finder` | Run positive + negative gap finders (parallel), then validator |
47
+ | `/checks --gap-finder` | Find gaps sentence-by-sentence, then review them for fairness |
48
48
  | `/checks --solver-gap-finder` | Run several solver agents TDD-style against `agent_prompt.md` + `test.patch`, then compare their solutions to the real solution to find gaps |
49
49
  | `/checks --config` | Configure behavioral and solver gap-finder models |
50
50
 
@@ -91,7 +91,7 @@ Or, for local development, point at the entry point directly:
91
91
  |---|---|
92
92
  | `src/index.ts` | Extension entry point: message renderer, cancel shortcut, command registration |
93
93
  | `src/command.ts` | The `/checks` command: argument parsing, `--config` flow, run orchestration |
94
- | `src/agents.ts` | Spawns and races the reviewer + gap-finder/validator/solver agent sessions |
94
+ | `src/agents.ts` | Spawns and races the gap-finder/reviewer/solver agent sessions |
95
95
  | `src/solvergap.ts` | Solver-gap-finder workspace lifecycle: setup, verification, artifact persistence, cleanup |
96
96
  | `src/prompts.ts` | All prompt text sent to those agents |
97
97
  | `src/tools.ts` | Custom tools the agents call to submit their structured results |
package/dist/index.js CHANGED
@@ -1,19 +1,18 @@
1
- var kf=Object.defineProperty;var Et=(e,t)=>{for(var r in t)kf(e,r,{get:t[r],enumerable:!0})};import{Container as dv,Key as fv,Spacer as gv,Text as Xo}from"@earendil-works/pi-tui";import{randomUUID as uf}from"node:crypto";import{copyFileSync as av,existsSync as cf,mkdirSync as lf,rmSync as ov,writeFileSync as iv}from"node:fs";import{tmpdir as df}from"node:os";import{join as Je}from"node:path";import{getSettingsListTheme as sv}from"@earendil-works/pi-coding-agent";import{Container as mv,Key as Kt,matchesKey as _t,Spacer as pv,Text as ff}from"@earendil-works/pi-tui";import{createAgentSession as ba,SessionManager as va}from"@earendil-works/pi-coding-agent";import{copyFileSync as Pf,existsSync as qa,lstatSync as Cf,mkdirSync as ja,readFileSync as Fa,rmSync as ci,symlinkSync as Mf,unlinkSync as Af,writeFileSync as Ze}from"node:fs";import{join as ce}from"node:path";import{existsSync as sn,mkdirSync as wf,readFileSync as Pa,writeFileSync as Ef}from"node:fs";import{dirname as Rf,join as ri}from"node:path";import{getAgentDir as ni}from"@earendil-works/pi-coding-agent";var an=ri(ni(),"checks-config.json"),on=ri(ni(),"settings.json"),ai=10,oi=60,Ca=20,Ma=1,ii=5,Aa=3,La=!0,Sf=["off","minimal","low","medium","high","xhigh","max"];function si(e){return e?.reasoning?Sf.filter(t=>{let r=e.thinkingLevelMap?.[t];return r===null?!1:t==="xhigh"||t==="max"?r!==void 0:!0}):["off"]}function st(){try{if(!sn(an))return null;let e=JSON.parse(Pa(an,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function mt(e){let t=Rf(an);sn(t)||wf(t,{recursive:!0}),Ef(an,JSON.stringify(e,null,2),"utf-8")}function mi(){let e=st()?.solverGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e,timeoutMinutes:e.timeoutMinutes>0?e.timeoutMinutes:Ca,solverCount:e.solverCount>0?e.solverCount:Aa,saveArtifacts:typeof e.saveArtifacts=="boolean"?e.saveArtifacts:La}}function pi(){try{return sn(on)?JSON.parse(Pa(on,"utf-8")).enabledModels??[]:[]}catch{return[]}}function ui(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Of(){try{if(sn(on))return JSON.parse(Pa(on,"utf-8"))}catch{}return{}}function mn(){let e=Of().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function pn(e){return e.replace(/\\/g,"/")}function un(e){return`'${e.replace(/'/g,"'\\''")}'`}async function cn(e,t,r){if((await e.exec("git",["rev-parse","HEAD"],{cwd:t,timeout:15e3})).code!==0)return{status:"error",error:"Not a git repository, or it has no commits yet."};let a=`git archive HEAD | tar -x -C ${un(pn(r))}`,s=await e.exec(mn(),["-c",a],{cwd:t,timeout:6e4});return s.code!==0?{status:"error",error:s.stderr?.trim()||`git archive failed (exit ${s.code})`}:{status:"ok"}}var Da=3e4,Lf=4e3,qf=".pi/shipd-checks",yr="solver_gap_solutions";function jf(e){let t=new Set,r=/^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/gm;for(let n of e.matchAll(r))n[1]&&t.add(n[1]),n[2]&&t.add(n[2]);return[...t]}function Ff(e,t){return e.length>t?e.slice(e.length-t):e}async function li(e){let{pi:t,repoDir:r,solverDir:n,testPatchPath:a,agentPromptPath:s}=e,m=await cn(t,r,n);if(m.status==="error")return{status:"error",solverDir:n,error:m.error};let c={cwd:n,timeout:Da},l=await t.exec("git",["init"],c);if(l.code!==0)return{status:"error",solverDir:n,error:l.stderr?.trim()||"git init failed"};await t.exec("git",["config","user.email","solvergap@shipd-checks.local"],c),await t.exec("git",["config","user.name","shipd-checks solver-gap-finder"],c);let g=await t.exec("git",["add","-A"],c);if(g.code!==0)return{status:"error",solverDir:n,error:g.stderr?.trim()||"git add (baseline) failed"};let f=await t.exec("git",["commit","-m","baseline","--allow-empty"],c);if(f.code!==0)return{status:"error",solverDir:n,error:f.stderr?.trim()||"git commit (baseline) failed"};let w=ce(n,".gitignore"),F=qa(w)?Fa(w,"utf-8"):"";if(!F.split(/\r?\n/).some(ot=>ot.trim()==="node_modules")){let ot=F.length>0&&!F.endsWith(`
1
+ var Tf=Object.defineProperty;var Rt=(e,t)=>{for(var n in t)Tf(e,n,{get:t[n],enumerable:!0})};import{Container as hv,Key as gv,Spacer as yv,Text as Xo}from"@earendil-works/pi-tui";import{randomUUID as uf}from"node:crypto";import{copyFileSync as iv,existsSync as cf,mkdirSync as lf,rmSync as sv,writeFileSync as mv}from"node:fs";import{tmpdir as df}from"node:os";import{join as Ze}from"node:path";import{getSettingsListTheme as pv}from"@earendil-works/pi-coding-agent";import{Container as uv,Key as Kt,matchesKey as _t,Spacer as cv,Text as ff}from"@earendil-works/pi-tui";import{createAgentSession as ba,SessionManager as va}from"@earendil-works/pi-coding-agent";import{copyFileSync as Of,existsSync as Fa,lstatSync as Pf,mkdirSync as Da,readFileSync as cr,rmSync as di,symlinkSync as Cf,unlinkSync as Mf,writeFileSync as rt}from"node:fs";import{join as ce}from"node:path";import{existsSync as ir,mkdirSync as kf,readFileSync as Ma,writeFileSync as wf}from"node:fs";import{dirname as Ef,join as ai}from"node:path";import{getAgentDir as oi}from"@earendil-works/pi-coding-agent";var ar=ai(oi(),"checks-config.json"),or=ai(oi(),"settings.json"),ii=10,si=60,Aa=20,La=1,mi=5,qa=3,ja=!0,Rf=["off","minimal","low","medium","high","xhigh","max"];function pi(e){return e?.reasoning?Rf.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function lt(){try{if(!ir(ar))return null;let e=JSON.parse(Ma(ar,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function dt(e){let t=Ef(ar);ir(t)||kf(t,{recursive:!0}),wf(ar,JSON.stringify(e,null,2),"utf-8")}function ui(){let e=lt()?.solverGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e,timeoutMinutes:e.timeoutMinutes>0?e.timeoutMinutes:Aa,solverCount:e.solverCount>0?e.solverCount:qa,saveArtifacts:typeof e.saveArtifacts=="boolean"?e.saveArtifacts:ja}}function ci(){try{return ir(or)?JSON.parse(Ma(or,"utf-8")).enabledModels??[]:[]}catch{return[]}}function li(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Sf(){try{if(ir(or))return JSON.parse(Ma(or,"utf-8"))}catch{}return{}}function sr(){let e=Sf().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function mr(e){return e.replace(/\\/g,"/")}function pr(e){return`'${e.replace(/'/g,"'\\''")}'`}async function ur(e,t,n){if((await e.exec("git",["rev-parse","HEAD"],{cwd:t,timeout:15e3})).code!==0)return{status:"error",error:"Not a git repository, or it has no commits yet."};let a=`git archive HEAD | tar -x -C ${pr(mr(n))}`,s=await e.exec(sr(),["-c",a],{cwd:t,timeout:6e4});return s.code!==0?{status:"error",error:s.stderr?.trim()||`git archive failed (exit ${s.code})`}:{status:"ok"}}var Na=3e4,Af=4e3,Lf=".pi/shipd-checks",gn="solver_gap_solutions";function qf(e){let t=new Set,n=/^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/gm;for(let r of e.matchAll(n))r[1]&&t.add(r[1]),r[2]&&t.add(r[2]);return[...t]}function jf(e,t){return e.length>t?e.slice(e.length-t):e}async function fi(e){let{pi:t,repoDir:n,solverDir:r,testPatchPath:a,agentPromptPath:s}=e,m=await ur(t,n,r);if(m.status==="error")return{status:"error",solverDir:r,error:m.error};let c={cwd:r,timeout:Na},l=await t.exec("git",["init"],c);if(l.code!==0)return{status:"error",solverDir:r,error:l.stderr?.trim()||"git init failed"};await t.exec("git",["config","user.email","solvergap@shipd-checks.local"],c),await t.exec("git",["config","user.name","shipd-checks solver-gap-finder"],c);let h=await t.exec("git",["add","-A"],c);if(h.code!==0)return{status:"error",solverDir:r,error:h.stderr?.trim()||"git add (baseline) failed"};let f=await t.exec("git",["commit","-m","baseline","--allow-empty"],c);if(f.code!==0)return{status:"error",solverDir:r,error:f.stderr?.trim()||"git commit (baseline) failed"};let w=ce(r,".gitignore"),D=Fa(w)?cr(w,"utf-8"):"";if(!D.split(/\r?\n/).some(pt=>pt.trim()==="node_modules")){let pt=D.length>0&&!D.endsWith(`
2
2
  `)?`
3
- `:"";Ze(w,`${F}${ot}node_modules
4
- `,"utf-8")}let B=ce(r,"node_modules"),ue=ce(n,"node_modules");if(qa(B)&&!qa(ue))try{Mf(B,ue,process.platform==="win32"?"junction":"dir")}catch{}try{Pf(s,ce(n,"agent_prompt.md"))}catch{}let Ce=Fa(a,"utf-8"),Me=jf(Ce),je=ce(n,"test.patch");Ze(je,Ce,"utf-8");let Xe=await t.exec("git",["apply","test.patch"],c);try{Af(je)}catch{}if(Xe.code!==0)return{status:"patchFailed",solverDir:n,error:Xe.stderr?.trim()||"git apply test.patch failed"};let D=await t.exec("git",["add","-A"],c);if(D.code!==0)return{status:"error",solverDir:n,error:D.stderr?.trim()||"git add (tests applied) failed"};let vt=await t.exec("git",["commit","-m","tests applied","--allow-empty"],c);if(vt.code!==0)return{status:"error",solverDir:n,error:vt.stderr?.trim()||"git commit (tests applied) failed"};let at=await t.exec("git",["rev-parse","HEAD"],c);return at.code!==0||!at.stdout.trim()?{status:"error",solverDir:n,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:n,testsAppliedCommit:at.stdout.trim(),testPatchPaths:Me}}async function di(e){let{pi:t,index:r,workspace:n,status:a,durationMs:s}=e,{solverDir:m,testsAppliedCommit:c,testPatchPaths:l}=n,g={cwd:m,timeout:Da};await t.exec("git",["add","-A"],g);let f=[...l,"agent_prompt.md"].map(D=>`:(exclude)${D}`),w=await t.exec("git",["diff","--cached",c,"--",".",...f],g),F=w.code===0?w.stdout:"",B=ce(m,"test_output.xml"),ue=`bash test.sh --output_path ${un(pn(B))} new`,Ce=mn(),Me=await t.exec(Ce,["-c",`cd ${un(pn(m))} && ${ue}`],{timeout:Da*10}),je=Me.code===0,Xe=Ff(`${Me.stdout}
5
- ${Me.stderr}`.trim(),Lf);return{index:r,status:a,passed:je,diff:F,testOutputTail:Xe,durationMs:s,testOutputXmlPath:B}}function fi(e){let{repoDir:t,runId:r,index:n,trajectory:a,solutionPatch:s,testOutputXmlPath:m,testOutputTail:c}=e,l=ce(t,qf,r,`solver_${n}`);ja(l,{recursive:!0}),Ze(ce(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),Ze(ce(l,"solution.patch"),s,"utf-8");try{let g=Fa(m,"utf-8");Ze(ce(l,"test_output.xml"),g,"utf-8")}catch{Ze(ce(l,"test_output.txt"),c,"utf-8")}return l}function gi(e,t){let r=ce(e,yr);ja(r,{recursive:!0});let n=t.map(a=>{let s=ce(r,`solver_${a.index}`);return ja(s,{recursive:!0}),Ze(ce(s,"solution.diff"),a.diff,"utf-8"),Ze(ce(s,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return Ze(ce(r,"manifest.json"),JSON.stringify(n,null,2),"utf-8"),r}function hi(e){let t=ce(e,"node_modules");try{Cf(t).isSymbolicLink()&&ci(t,{force:!0})}catch{}try{ci(e,{recursive:!0,force:!0})}catch{}}var p={};Et(p,{Assign:()=>Df,Clone:()=>vr,Create:()=>zg,Discard:()=>Bg,Metrics:()=>Ae,Update:()=>Vg});var Ae={assign:0,create:0,clone:0,discard:0,update:0};function Df(e,t){return Ae.assign+=1,{...e,...t}}var i={};Et(i,{Entries:()=>og,EntriesRegExp:()=>ag,Every:()=>tg,EveryAll:()=>rg,GraphemeCount:()=>Zf,HasPropertyKey:()=>ng,IsArray:()=>Ir,IsBigInt:()=>xr,IsBoolean:()=>wi,IsClassInstance:()=>Jf,IsConstructor:()=>zf,IsDeepEqual:()=>Ka,IsEqual:()=>C,IsFunction:()=>Ei,IsGreaterEqualThan:()=>Si,IsGreaterThan:()=>Wf,IsInteger:()=>Ga,IsLessEqualThan:()=>Ri,IsLessThan:()=>Hf,IsMaxLength:()=>Qf,IsMinLength:()=>eg,IsMultipleOf:()=>Yf,IsNull:()=>fn,IsNumber:()=>gn,IsObject:()=>br,IsObjectNotArray:()=>Bf,IsString:()=>hn,IsSymbol:()=>Vf,IsUndefined:()=>Ua,IsUnsafePropertyKey:()=>Oi,IsValueLike:()=>Xf,Keys:()=>dn,ShiftLeft:()=>yn,Symbols:()=>ig,Values:()=>sg});function Rt(e,t,r){return e>=t&&e<=r}function Nf(e){return e===8205}function Gf(e){return Rt(e,55296,56319)}function yi(e){return Rt(e,127462,127487)}function Ii(e){return Rt(e,65024,65039)}function bi(e){return Rt(e,768,879)||Rt(e,6832,6911)||Rt(e,7616,7679)||Rt(e,65056,65071)}function ln(e){return e>65535?2:1}function xi(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(bi(r)||Ii(r))t+=ln(r);else break}return t}function Na(e,t){let r=e.codePointAt(t),n=t+ln(r);for(n=xi(e,n);n<e.length-1&&e[n]==="\u200D";){let a=e.codePointAt(n+1);n+=1+ln(a),n=xi(e,n)}return yi(r)&&n<e.length&&yi(e.codePointAt(n))&&(n+=ln(e.codePointAt(n))),n}function vi(e){return Gf(e)||bi(e)||Ii(e)||Nf(e)}function $i(e){let t=0,r=0;for(;r<e.length;)r=Na(e,r),t++;return t}function Uf(e,t){if(t===0)return!0;let r=0,n=0;for(;n<e.length;)if(n=Na(e,n),r++,r>=t)return!0;return!1}function Kf(e,t){let r=0,n=0;for(;n<e.length;)if(n=Na(e,n),r++,r>t)return!1;return!0}function Ti(e,t){if(t===0)return!0;let r=0;for(;r<e.length;){if(vi(e.charCodeAt(r)))return Uf(e,t);if(r++,r>=t)return!0}return!1}function ki(e,t){let r=0;for(;r<e.length;){if(vi(e.charCodeAt(r)))return Kf(e,t);if(r++,r>t)return!1}return!0}function Ir(e){return Array.isArray(e)}function xr(e){return C(typeof e,"bigint")}function wi(e){return C(typeof e,"boolean")}function zf(e){if(Ua(e)||!Ei(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Ei(e){return C(typeof e,"function")}function Ga(e){return Number.isInteger(e)}function fn(e){return C(e,null)}function gn(e){return Number.isFinite(e)}function Bf(e){return br(e)&&!Ir(e)}function br(e){return C(typeof e,"object")&&!fn(e)}function hn(e){return C(typeof e,"string")}function Vf(e){return C(typeof e,"symbol")}function Ua(e){return C(e,void 0)}function C(e,t){return e===t}function Wf(e,t){return e>t}function Hf(e,t){return e<t}function Ri(e,t){return e<=t}function Si(e,t){return e>=t}function Yf(e,t){if(xr(e)||xr(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!gn(e)||Ga(e)&&1/t%1===0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<r}function Jf(e){if(!br(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return fn(t)?!1:C(typeof t.constructor,"function")&&!(C(t.constructor,globalThis.Object)||C(t.constructor.name,"Object"))}function Xf(e){return xr(e)||wi(e)||fn(e)||gn(e)||hn(e)||Ua(e)}function Zf(e){return $i(e)}function Qf(e,t){return ki(e,t)}function eg(e,t){return Ti(e,t)}function tg(e,t,r){for(let n=t;n<e.length;n++)if(!r(e[n],n))return!1;return!0}function rg(e,t,r){let n=!0;for(let a=t;a<e.length;a++)r(e[a],a)||(n=!1);return n}function yn(e,t,r){return C(e.length,0)?r():t(e[0],e.slice(1))}function Oi(e){return C(e,"__proto__")||C(e,"constructor")||C(e,"prototype")}function ng(e,t){return Oi(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ag(e){return dn(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function og(e){return Object.entries(e)}function dn(e){return Object.getOwnPropertyNames(e)}function ig(e){return Object.getOwnPropertySymbols(e)}function sg(e){return Object.values(e)}function mg(e,t){if(!br(t))return!1;let r=dn(e);return C(r.length,dn(t).length)&&r.every(n=>Ka(e[n],t[n]))}function pg(e,t){return Ir(t)&&C(e.length,t.length)&&e.every((r,n)=>Ka(e[n],t[n]))}function Ka(e,t){return Ir(e)?pg(e,t):br(e)?mg(e,t):C(e,t)}var pt={};Et(pt,{IsBigInt64Array:()=>kg,IsBigUint64Array:()=>wg,IsBoolean:()=>cg,IsDate:()=>Rg,IsFloat32Array:()=>$g,IsFloat64Array:()=>Tg,IsInt16Array:()=>xg,IsInt32Array:()=>bg,IsInt8Array:()=>gg,IsMap:()=>Og,IsNumber:()=>lg,IsRegExp:()=>Eg,IsSet:()=>Sg,IsString:()=>dg,IsTypeArray:()=>fg,IsUint16Array:()=>Ig,IsUint32Array:()=>vg,IsUint8Array:()=>hg,IsUint8ClampedArray:()=>yg});function cg(e){return e instanceof Boolean}function lg(e){return e instanceof Number}function dg(e){return e instanceof String}function fg(e){return globalThis.ArrayBuffer.isView(e)}function gg(e){return e instanceof globalThis.Int8Array}function hg(e){return e instanceof globalThis.Uint8Array}function yg(e){return e instanceof globalThis.Uint8ClampedArray}function xg(e){return e instanceof globalThis.Int16Array}function Ig(e){return e instanceof globalThis.Uint16Array}function bg(e){return e instanceof globalThis.Int32Array}function vg(e){return e instanceof globalThis.Uint32Array}function $g(e){return e instanceof globalThis.Float32Array}function Tg(e){return e instanceof globalThis.Float64Array}function kg(e){return e instanceof globalThis.BigInt64Array}function wg(e){return e instanceof globalThis.BigUint64Array}function Eg(e){return e instanceof globalThis.RegExp}function Rg(e){return e instanceof globalThis.Date}function Sg(e){return e instanceof globalThis.Set}function Og(e){return e instanceof globalThis.Map}function Cg(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function Mg(e){let t={},r=Object.getOwnPropertyDescriptors(e);for(let n of Object.keys(r)){if(i.IsUnsafePropertyKey(n))continue;let a=r[n];i.HasPropertyKey(a,"value")&&Object.defineProperty(t,n,{...a,value:St(a.value)})}return t}function Ag(e){let t={};for(let r of i.Keys(e))i.IsUnsafePropertyKey(r)||(t[r]=St(e[r]));for(let r of i.Symbols(e))t[r]=St(e[r]);return t}function Lg(e){return i.IsClassInstance(e)?e:Cg(e)?Mg(e):Ag(e)}function qg(e){return e.map(t=>St(t))}function jg(e){return e.slice()}function Fg(e){return new RegExp(e.source,e.flags)}function Dg(e){return new Map(St([...e.entries()]))}function Ng(e){return new Set(St([...e.values()]))}function St(e){return pt.IsTypeArray(e)?jg(e):pt.IsRegExp(e)?Fg(e):pt.IsMap(e)?Dg(e):pt.IsSet(e)?Ng(e):i.IsArray(e)?qg(e):i.IsObject(e)?Lg(e):e}function vr(e){return Ae.clone+=1,St(e)}var Ot={};Et(Ot,{Get:()=>Kg,Reset:()=>Gg,Set:()=>Ug});var Qe={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Gg(){Qe.immutableTypes=!1,Qe.maxErrors=8,Qe.useAcceleration=!0,Qe.exactOptionalPropertyTypes=!1,Qe.enumerableKind=!1,Qe.correctiveParse=!1,Qe.unionPrioritySort=!0}function Ug(e){for(let t of i.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(Qe,t,{value:r})}}function Kg(){return Qe}function _g(e,t){for(let r of Object.keys(t))Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:!1,value:t[r]});return e}function Pi(e,t){return{...e,...t}}function zg(e,t,r={}){Ae.create+=1;let n=Ot.Get(),a=Pi(t,r),s=n.enumerableKind?Pi(a,e):_g(a,e);return n.immutableTypes?Object.freeze(s):s}function Bg(e,t){Ae.discard+=1;let r={},n=Object.getOwnPropertyDescriptors(vr(e)),a=new Set(t);for(let s of Object.keys(n))a.has(s)||Object.defineProperty(r,s,n[s]);return r}function Vg(e,t,r){Ae.update+=1;let n=Ot.Get(),a=vr(e);for(let s of Object.keys(t))Object.defineProperty(a,s,{configurable:!0,writable:!0,enumerable:n.enumerableKind,value:t[s]});for(let s of Object.keys(r))Object.defineProperty(a,s,{configurable:!0,enumerable:!0,writable:!0,value:r[s]});return a}function y(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function ee(e){return i.IsObject(e)}function I(e,t,r){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function ut(e){return y(e,"Deferred")}function Wg(e){return p.Update(e,{"~readonly":!0},{})}function $r(e,t){return p.Update(Wg(e),{},t)}function Ci(e,t,r,n){let a=d(e,t,r);return $r(a,n)}function Hg(e){return p.Update(e,{"~optional":!0},{})}function Tr(e,t){return p.Update(Hg(e),{},t)}function Mi(e,t,r,n){let a=d(e,t,r);return Tr(a,n)}function Te(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function K(e){return y(e,"Array")}function xn(e){return p.Discard(e,["~kind","type","items"])}function De(e,t,r={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function re(e){return y(e,"Constructor")}function Ai(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ne(e,t,r={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function ne(e){return y(e,"Function")}function Li(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function et(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function ae(e){return y(e,"Ref")}function ct(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Vt(e){return y(e,"Generic")}function Wt(e){return p.Create({"~kind":"Any"},{},e)}function J(e){return y(e,"Any")}var qi="(?!)";function q(e){return p.Create({"~kind":"Never"},{not:{}},e)}function lt(e){return y(e,"Never")}function Ge(e,t={}){return I("AddOptional",[e],t)}function Pt(e,t={}){return Tr(e,t)}function ji(e){return Pt(e)}function le(e){return ee(e)&&i.HasPropertyKey(e,"~optional")}function Fi(e){return i.Keys(e).filter(t=>!le(e[t]))}function In(e){return i.Keys(e)}function bn(e){return i.Values(e)}function v(e,t={}){let r=Fi(e),n=r.length>0?{required:r}:{};return p.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function M(e){return y(e,"Object")}function Di(e){return p.Discard(e,["~kind","type","properties","required"])}function oe(e){return p.Create({"~kind":"Unknown"},{},e)}function te(e){return y(e,"Unknown")}function Ue(e,t,r){let n=i.Keys(e).reduce((a,s)=>({...a,[s]:p.Update(e[s],{},{$id:s})}),{});return p.Create({"~kind":"Cyclic"},{$defs:n,$ref:t},r)}function se(e){return y(e,"Cyclic")}function Ni(e){return p.Update(e,{"~unsafe":null},{})}function vn(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var Ke={};Et(Ke,{Match:()=>Yg});function Yg(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function kr(...e){let[t,r]=Ke.Match(e,{2:(n,a)=>[n,a,a],1:n=>[n,oe(),oe()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function H(e){return y(e,"Infer")}function Ct(e,t,r,n={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function V(e){return y(e,"Dependent")}function Gi(e){return p.Discard(e,["~kind","if","then","else"])}function Ui(e){return i.IsObjectNotArray(e)}function Ki(e){return i.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function _i(e){return i.IsString(e)||i.IsNumber(e)}function zi(e,t){let r=Ui(e)?Ki(e):e;return p.Create({"~kind":"Enum"},{enum:r},t)}function fe(e){return y(e,"Enum")}function de(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function S(e){return y(e,"Intersect")}function Bi(e){return p.Discard(e,["~kind","allOf"])}function Y(){throw new Error("Unreachable")}var Vi;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(Vi||(Vi={}));var AT=BigInt("14695981039346656037"),[LT,qT]=[BigInt("1099511628211"),BigInt("18446744073709551616")],jT=Array.from({length:256}).map((e,t)=>BigInt(t)),Wi=new Float64Array(1),FT=new DataView(Wi.buffer),DT=new Uint8Array(Wi.buffer);var NT=new TextEncoder;var wr=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=$n(r)?m=>this.decode(r["~codec"].decode(m)):this.decode,a=$n(r)?m=>r["~codec"].encode(t(m)):t,s={decode:n,encode:a};return p.Update(this.type,{"~codec":s},{})}},Er=class{constructor(t){this.type=t}Decode(t){return new wr(this.type,t)}};function Tn(e){return new Er(e)}function Yi(e,t){return Tn(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Ji(e,t){return Tn(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function $n(e){return ee(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function Xi(e){return Ht(e)}function Mt(e){return ee(e)&&i.HasPropertyKey(e,"~immutable")}function _e(e,t={}){return I("AddReadonly",[e],t)}function At(e,t={}){return $r(e,t)}function Zi(e){return At(e)}function Lt(e){return ee(e)&&i.HasPropertyKey(e,"~readonly")}function Qg(e,t){let r=_a(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":r},{})}function Qi(...e){let[t,r,n]=Ke.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return Qg(t,{check:r,error:n})}function eh(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function _a(e){return ee(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>eh(t))}var es="-?(?:0|[1-9][0-9]*)n";function Rr(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function ze(e){return y(e,"BigInt")}function kn(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Re(e){return y(e,"Boolean")}function Sr(e){return p.Create({"~kind":"Identifier"},{name:e})}function ts(e){return y(e,"Identifier")}var wn="-?(?:0|[1-9][0-9]*)";function qt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function ge(e){return y(e,"Integer")}var za=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function th(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new za(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:th(e),const:e},t)}function En(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function rs(e){return A(e)&&i.IsNumber(e.const)}function ns(e){return A(e)&&i.IsString(e.const)}function A(e){return y(e,"Literal")}function Yt(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Jt(e){return y(e,"Null")}var Rn="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function be(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function X(e){return y(e,"Number")}function Xt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function dt(e){return y(e,"Symbol")}function jt(...e){let[t,r,n]=Ke.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,oe(),oe()]});return p.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function as(e){return y(e,"Parameter")}var Sn=".*";function Se(e){return p.Create({"~kind":"String"},{type:"string"},e)}function he(e){return y(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function os(e){return p.Discard(e,["~kind","anyOf"])}function Or(e){let t=is(e);return i.IsEqual(t.length,2)?t[0]:[]}function rh(e){return!0}function ss(e){return i.ShiftLeft(e,(t,r)=>nh(t)?ss(r):!1,()=>!0)}function ms(e){return i.IsEqual(e.length,0)?!1:ss(e)}function nh(e){return x(e)?ms(e.anyOf):A(e)?rh(e.const):!1}function On(e){return ms(e)}function Pn(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function ps(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>ps(a,t,[...r,`${n}${t}`]),()=>r)}function ah(e,t){return i.IsEqual(e.length,0)?[`${t}`]:ps(e,t)}function us(e,t,r=[]){return i.ShiftLeft(t,(n,a)=>us(e,a,[...r,...cs(e,n)]),()=>r)}function cs(e,t){return x(t)?us(e,t.anyOf):A(t)?ah(e,t.const):Y()}function ls(e,t){return i.ShiftLeft(t,(r,n)=>ls(cs(e,r),n),()=>e)}function oh(e){return e.map(t=>O(t))}function ih(e){let t=ls([],e),r=oh(t);return k(r)}function sh(e){return i.IsEqual(e.length,0)?Y():i.IsEqual(e.length,1)&&A(e[0])?e[0]:ih(e)}function Ba(e){let t=Or(e);return i.IsEqual(t.length,0)?Se():On(t)?sh(t):Pn(e)}function ds(e){let t=Ba(e);return Z(t)?Se():t}function xe(e,t){let r="object",n={[e]:t};return p.Create({"~kind":"Record"},{type:r,patternProperties:n})}function fs(e){return xe(Le,e)}function gs(e){return v({true:e,false:e})}function Q(e,t={}){let[r,n,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:r,minItems:n},t)}function j(e){return y(e,"Tuple")}function hs(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function mh(e){return p.Discard(e,["~readonly"])}function Va(e,t){return p.Update(mh(e),{},t)}function ys(e,t,r,n){let a=d(e,t,r);return Va(a,n)}function xs(e,t={}){return I("RemoveReadonly",[e],t)}function Is(e,t={}){return Va(e,t)}function ph(e){return p.Discard(e,["~optional"])}function Wa(e,t){return p.Update(ph(e),{},t)}function bs(e,t,r,n){let a=d(e,t,r);return Wa(a,n)}function vs(e,t={}){return I("RemoveOptional",[e],t)}function Cn(e,t={}){return Wa(e,t)}function Ha(e){return e.reduceRight((r,n,a)=>({[a]:n,...r}),{})}function $s(e){let t=Ha(e.items);return v(t)}function uh(e,t){return Lt(e)?!!Lt(t):!1}function ch(e,t){return le(e)?!!le(t):!1}function lh(e,t){let r=uh(e,t),n=ch(e,t),a=_([e,t]),s=Is(Cn(a));return r&&n?At(Pt(s)):r&&!n?At(s):!r&&n?Pt(s):s}function dh(e,t,r){return r in e?r in t?lh(e[r],t[r]):e[r]:r in t?t[r]:q()}function fh(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((n,a)=>({...n,[a]:dh(e,t,a)}),{})}function Ts(e){return M(e)?e.properties:j(e)?Ha(e.items):Y()}function ks(e,t){let r=Ts(e),n=Ts(t),a=fh(r,n);return v(a)}function ws(e,t){let r=Zt(e,t);return i.IsEqual(r,Cr)?e:i.IsEqual(r,Mr)||i.IsEqual(r,Pr)?t:q()}function Es(e){return M(e)||j(e)}function gh(e,t){let r=x(e),n=x(t);return r||n}function hh(e,t){let r=Oe(e),n=Oe(t),a=gh(r,n),s=Es(r),m=Es(n);return a?_([r,n]):s&&m?ks(r,n):s&&!m?r:!s&&m?n:ws(r,n)}function Rs(e,t,r=[]){return i.ShiftLeft(t,(n,a)=>Rs(e,a,[...r,hh(e,n)]),()=>i.IsEqual(r.length,0)?[e]:r)}function Ss(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>Ss(a,t,[...r,...Ar([n],t)]),()=>r)}function Ar(e,t=[]){return i.ShiftLeft(e,(r,n)=>x(r)?Ar(n,Ss(r.anyOf,t)):Ar(n,Rs(r,t)),()=>t)}function yh(e,t){let r=me({},e,t);return b.IsExtendsTrueLike(r)?[]:[e]}function xh(e,t){return e.reduce((r,n)=>[...r,...yh(n,t)],[])}function Mn(e,t){let r=Oe(e),n=x(r)?r.anyOf:[r],a=xh(n,t);return ve(a)}function qe(e,t,r){let n=de([e,t]),a=Mn(r,e);return ve([n,a])}function ke(e){let t=e.map(r=>O(r));return ve(t)}function _(e){let t=Ar(e),r=Ya(t);return tt(r)}function Ie(e){let t=ds(e);return Oe(t)}function ve(e){let t=Ya(e);return tt(t)}function Oe(e){return V(e)?qe(e.if,e.then,e.else):fe(e)?ke(e.enum):S(e)?_(e.allOf):Z(e)?Ie(e.pattern):x(e)?ve(e.anyOf):e}function tt(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?q():k(e)}function Os(e,t){let r=ke(e);return ft(r,t)}function Ps(e,t){return xe(gt,t)}function Cs(e,t){let r=_(e);return ft(r,t)}function Ms(e,t){return i.IsString(e)||i.IsNumber(e)?v({[e]:t}):i.IsEqual(e,!1)?v({false:t}):i.IsEqual(e,!0)?v({true:t}):v({})}function As(e,t){return xe(Qt,t)}function Ls(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?xe(e.pattern.toString(),t):xe(Le,t)}function qs(e,t){let r=Or(e);return On(r)?ft(Ie(e),t):xe(e,t)}function Ih(e){return x(e)?Lr(e.anyOf):[e]}function Lr(e){return e.reduce((t,r)=>[...t,...Ih(r)],[])}function bh(e){return e.some(t=>he(t)||X(t)||ge(t))}function vh(e,t){return i.IsEqual(bh(e),!0)?xe(Le,t):void 0}function $h(e,t){return e.reduce((r,n)=>A(n)&&(i.IsString(n.const)||i.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function Th(e,t){let r=$h(e,t);return v(r)}function js(e,t){let r=Lr(e),n=vh(r,t);return ee(n)?n:Th(r,t)}function ft(e,t){return J(e)?fs(t):Re(e)?gs(t):fe(e)?Os(e.enum,t):ge(e)?Ps(e,t):S(e)?Cs(e.allOf,t):A(e)?Ms(e.const,t):X(e)?As(e,t):x(e)?js(e.anyOf,t):he(e)?Ls(e,t):Z(e)?qs(e.pattern,t):v({})}function Ja(e,t,r){return T([e])?p.Update(ft(e,t),{},r):An(e,t,r)}function Fs(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Ja(s,m,a)}var gt=`^${wn}$`,Qt=`^${Rn}$`,Le=`^${Sn}$`;function An(e,t,r={}){return I("Record",[e,t],r)}function Ln(e,t,r={}){return Ja(e,t,r)}function Ds(e,t){return xe(e,t)}function qn(e){return i.IsEqual(e,Le)?Se():i.IsEqual(e,gt)?qt():i.IsEqual(e,Qt)?be():Ba(e)}function Pe(e){return i.Keys(e.patternProperties)[0]}function er(e){let t=Pe(e);return qn(t)}function ye(e){return e.patternProperties[Pe(e)]}function pe(e){return y(e,"Record")}function Ft(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function ht(e){return y(e,"Rest")}function jn(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function Fn(e){return y(e,"This")}function tr(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function rr(e){return y(e,"Undefined")}function Dn(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Be(e){return y(e,"Void")}function wh(e,t){return i.IsEqual(e,"Array")?Te(t[0]):i.IsEqual(e,"Capitalize")?Gn(t[0]):i.IsEqual(e,"ConstructorParameters")?Bn(t[0]):i.IsEqual(e,"Evaluate")?Gp(t[0]):i.IsEqual(e,"Exclude")?Vn(t[0],t[1]):i.IsEqual(e,"Extract")?Wn(t[0],t[1]):i.IsEqual(e,"Index")?Dr(t[0],t[1]):i.IsEqual(e,"InstanceType")?Hn(t[0]):i.IsEqual(e,"Lowercase")?Un(t[0]):i.IsEqual(e,"NonNullable")?Yn(t[0]):i.IsEqual(e,"Omit")?Jn(t[0],t[1]):i.IsEqual(e,"Parameters")?Xn(t[0]):i.IsEqual(e,"Partial")?Zn(t[0]):i.IsEqual(e,"Pick")?Qn(t[0],t[1]):i.IsEqual(e,"Readonly")?ea(t[0]):i.IsEqual(e,"KeyOf")?Nr(t[0]):i.IsEqual(e,"Record")?An(t[0],t[1]):i.IsEqual(e,"Required")?ta(t[0]):i.IsEqual(e,"ReturnType")?ra(t[0]):i.IsEqual(e,"Uncapitalize")?Kn(t[0]):i.IsEqual(e,"Uppercase")?_n(t[0]):Fr(et(e),t)}function Dt(){throw Error("Unreachable")}var Eh=(e,t=[])=>e.reduce((r,n)=>i.IsArray(n)&&i.IsEqual(n.length,2)?[...r,n[0]]:[...r,n],[]),rt=e=>{let[t,r]=e;return Eh([...t,...r])};function _s(e){return jt(e[0],e[2],e[4])}function zs(e){return jt(e[0],e[2],e[2])}function Bs(e){return jt(e[0],oe(),e[2])}function Vs(e){return jt(e,oe(),oe())}function Ws(e){return rt(e)}function Hs(e){return e[1]}function Ys(e){return rt(e)}function Js(e){return e[1]}function Xs(e){return wh(e[0],e[1])}function Zs(e){return null}function Qs(e){return Se()}function em(e){return be()}function tm(e){return kn()}function rm(e){return tr()}function nm(e){return Yt()}function am(e){return qt()}function om(e){return Rr()}function im(e){return oe()}function sm(e){return Wt()}function mm(e){return v({})}function pm(e){return q()}function um(e){return Xt()}function cm(e){return Dn()}function lm(e){return jn()}function dm(e){return O(BigInt(e))}function fm(e){return O(i.IsEqual(e,"true"))}function gm(e){return O(parseFloat(e))}function hm(e){return O(e)}function ym(e){return e[1]}function xm(e){return O(e)}function Im(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function bm(e){return e[1]}function vm(e){return Nn(e)}function $m(e){return i.IsEqual(e.length,6)?Ct(e[1],e[3],e[5]):Ct(e[1],e[3],oe())}function Tm(e){return e.length>0}function km(e){return e.reduce((t,r)=>i.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function wm(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Em(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function Rm(e){return i.IsEqual(e.length,2)?e[1]:[]}function Ns(e,t){return t.reduce((r,n)=>{let a=n;return i.IsEqual(a.length,1)?Dr(r,a[0]):i.IsEqual(a.length,0)?Te(r):Dt()},e)}function Gs(e,t){return i.IsEqual(t.length,3)?zn(e,t[0],t[1],t[2]):e}function Rh(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:na(e,t)}function Sm(e){let[t,r,n,a,s]=e;return Rh(Gs(t?Nr(Ns(r,n)):Ns(r,n),a),s)}function Xa(e,t){return i.IsEqual(t.length,3)?(()=>{let[r,n,a]=t,s=Xa(n,a);if(i.IsEqual(r,"&"))return S(s)?de([e,...s.allOf]):de([e,s]);if(i.IsEqual(r,"|"))return x(s)?k([e,...s.anyOf]):k([e,s]);Dt()})():e}function Om(e){let[t,r]=e;return Xa(t,r)}function Pm(e){let[t,r]=e;return Xa(t,r)}function Cm(e){return Np(e[1])}function Mm(e){return e[1]}function Am(e){return ct(e[0],e[2])}function Lm(e){return i.IsEqual(e.length,4)?kr(e[1],e[3]):i.IsEqual(e.length,2)?kr(e[1],oe()):Dt()}function qm(e){return`${e}`}function jm(e){return ge(e[3])?gt:X(e[3])?Qt:dt(e[3])?Le:he(e[3])?Le:Dt()}function Fm(e){return e.length>0}function Dm(e){return e.length>0}function Nm(e){let[t,r,n,a,s]=e;return{[r]:t&&n?_e(Ge(s)):t&&!n?_e(s):!t&&n?Ge(s):s}}function Gm(e){return rt(e)}function Um(e){return e.reduce((t,r)=>i.HasPropertyKey(r,gt)||i.HasPropertyKey(r,Qt)||i.HasPropertyKey(r,Le)?[t[0],p.Assign(t[1],r)]:[p.Assign(t[0],r),t[1]],[{},{}])}function Km(e){return Um(e[1])}function _m(e){let[t,r]=e,n=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return v(t,n)}function zm(e){return i.IsEqual(e.length,5)?_e(Ge(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?_e(e[3]):Ge(e[3]):Dt()}function Bm(e){return _e(Ge(e[1]))}function Vm(e){return _e(e[1])}function Wm(e){return Ge(e[0])}function Hm(e){return i.IsEqual(e.length,2)?Ft(e[1]):i.IsEqual(e.length,1)?e[0]:Dt()}function Ym(e){return rt(e)}function Jm(e){return Q(e[1])}function Xm(e){return _e(Ge(e[4]))}function Zm(e){return _e(e[3])}function Qm(e){return Ge(e[3])}function ep(e){return e[2]}function tp(e){return i.IsEqual(e.length,2)?Ft(e[1]):i.IsEqual(e.length,1)?e[0]:Dt()}function rp(e){return rt(e)}function np(e){return Ne(e[1],e[4])}function ap(e){return De(e[2],e[5])}function Us(e,t){return i.IsEqual(e,"remove")?xs(t):i.IsEqual(e,"add")?_e(t):t}function op(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function Ks(e,t){return i.IsEqual(e,"remove")?vs(t):i.IsEqual(e,"add")?Ge(t):t}function ip(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function sp(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function mp(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?qr(Sr(e[3]),e[5],e[6][0],Us(e[1],Ks(e[8],e[10]))):qr(Sr(e[3]),e[5],et(e[3]),Us(e[1],Ks(e[8],e[10])))}function pp(e){return et(e)}function up(e){return BigInt(e)}function cp(e){return parseFloat(e)}function lp(e){return i.IsEqual(e,"true")}function dp(e){return null}function fp(e){return{[e[0]]:e[2]}}function gp(e){return rt(e)}function Sh(e){return e.reduce((t,r)=>p.Assign(t,r),{})}function hp(e){return Sh(e[1])}function yp(e){return rt(e)}function xp(e){return e[1]}function Ip(e){return Rr()}function bp(e){return Se()}function vp(e){return be()}function $p(e){return qt()}function Tp(e){return q()}function kp(e){return O(e)}function wp(e){return k(e[1])}function Ep(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Rp(e){return[e[0],...e[1]]}function Sp(e){return e[1]}function Op(e){return rt(e)}function Pp(e){return i.IsEqual(e.length,2)?e[1]:[]}function Cp(e){let t=e[2],r=e[3],[n,a]=e[4],s=i.IsEqual(i.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:ct(t,jr(r,n,s))}}function Mp(e){let t=e[2],[r,n]=e[3],a=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:jr(t,r,a)}}function Ap(e){return{[e[1]]:ct(e[2],e[4])}}function Lp(e){return{[e[1]]:e[3]}}function qp(e){return null}function jp(e){return Um(rt(e))}function Fp(e){return e[1]}function Dp(e){let t=e[0],r=e[1];return Up(p.Assign(t,r[0]))}function Gr(e){return C(e.length,2)}function E(e,t,r){return Gr(e)?t(e[0],e[1]):r()}function Ch(e,t){return C(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function z(e,t){for(let r=0;r<e.length;r++){let n=Ch(e[r],t);if(Gr(n))return n}return[]}function Za(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var Kp=[...Za(97,122),...Za(65,90)],Qa="0",eo=Za(49,57),nr=[Qa,...eo],_p=" ",ar=`
6
- `;var yt="_",aa=".",zp="$",oa="-";var Bp="//",Vp="/*",Ah="*/";function Wp(e){let t=e.indexOf(Ah);return C(t,-1)?"":e.slice(t+2)}function Hp(e){let t=e.indexOf(ar);return C(t,-1)?"":e.slice(t)}function Lh(e){return e.replace(/^[ \t\r\f\v]+/,"")}function ia(e){let t=Lh(e);return t.startsWith(Vp)?ia(Wp(t.slice(2))):t.startsWith(Bp)?ia(Hp(t.slice(2))):t}function ie(e){let t=e.trimStart();return t.startsWith(Vp)?ie(Wp(t.slice(2))):t.startsWith(Bp)?ie(Hp(t.slice(2))):t}function sa(e,t){return E(z([e],t),(r,n)=>[r,n],()=>["",t])}function qh(e,t){return e.includes(t)}function or(e,t,r,n=""){return E(z(e,r),(a,s)=>qh(t,a)?or(e,t,s,n):or(e,t,s,`${n}${a}`),()=>[n,r])}function jh(e){return z(eo,e)}var Fh=[...nr,yt];function Dh(e){return or(Fh,[yt],e)}function Nh(e){return E(z([Qa],e),(t,r)=>[t,r],()=>E(jh(e),(t,r)=>E(Dh(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[]))}function ma(e){return Nh(ie(e))}function Gh(e){return sa(oa,e)}function Uh(e){return E(Gh(e),(t,r)=>E(ma(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function Yp(e){return Uh(ie(e))}function Kh(e){return E(Yp(e),(t,r)=>E(z(["n"],r),(n,a)=>[`${t}`,a],()=>[]),()=>[])}function to(e){return Kh(e)}function ro(e,t){return z([e],t)}function u(e,t){return C(e,"")?["",t]:e.startsWith(ar)?ro(e,ia(t)):e.startsWith(_p)?ro(e,t):ro(e,ie(t))}var Jp=[...Kp,yt,zp];function _h(e){return z(Jp,e)}var zh=[...Jp,...nr];function Xp(e,t=""){return E(z(zh,e),(r,n)=>Xp(n,`${t}${r}`),()=>[t,e])}function Bh(e){return E(_h(e),(t,r)=>E(Xp(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function W(e){return Bh(ie(e))}var Vh=[...nr,yt];function Wh(e){return Gr(z([aa],e))}function Zp(e){return E(or(Vh,[yt],e),(t,r)=>C(t,"")?[]:[t,r],()=>[])}function Hh(e){return E(z([aa],e),(t,r)=>E(Zp(r),(n,a)=>[`0${t}${n}`,a],()=>[]),()=>[])}function Yh(e){return E(ma(e),(t,r)=>E(z([aa],r),(n,a)=>E(Zp(a),(s,m)=>[`${t}${n}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,r]),()=>[])}function Jh(e){return Wh(e)?Hh(e):Yh(e)}function Qp(e){return Jh(ie(e))}function Xh(e){return sa(oa,e)}function Zh(e){return E(Xh(e),(t,r)=>E(Qp(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function pa(e){return Zh(ie(e))}function Qh(e){return C(e,"")?[]:[e.slice(0,1),e.slice(1)]}function eu(e,t){return yn(e,(r,n)=>t.startsWith(r)?!0:eu(n,t),()=>!1)}function xt(e,t,r=""){return E(Qh(t),(n,a)=>eu(e,t)?[r,t]:xt(e,a,`${r}${n}`),()=>[])}function ey(e,t,r){return E(z([e],r),(n,a)=>E(xt([t],a),(s,m)=>E(z([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function ty(e,t,r){return E(z([e],r),(n,a)=>E(xt([ar,t],a),(s,m)=>E(z([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function tu(e,t,r,n){return r?ey(e,t,ie(n)):ty(e,t,ie(n))}function ry(e,t){return z(e,t)}function ny(e,t){return tu(e,e,!1,t)}function ay(e,t){return E(ry(e,t),(r,n)=>ny(r,`${r}${n}`),()=>[])}function ua(e,t){return ay(e,ie(t))}function ru(e,t){return E(xt(e,t),(r,n)=>C(r,"")?[]:[r,n],()=>[])}var o=(e,t,r=()=>[])=>e.length===2?t(e):r(),iy=e=>o(o(W(e),([t,r])=>o(u("extends",r),([n,a])=>o(R(a),([s,m])=>o(u("=",m),([c,l])=>o(R(l),([g,f])=>[[t,n,s,c,g],f]))))),([t,r])=>[_s(t),r]),sy=e=>o(o(W(e),([t,r])=>o(u("extends",r),([n,a])=>o(R(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[zs(t),r]),my=e=>o(o(W(e),([t,r])=>o(u("=",r),([n,a])=>o(R(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Bs(t),r]),py=e=>o(W(e),([t,r])=>[Vs(t),r]),ou=e=>o(o(iy(e),([t,r])=>[t,r],()=>o(sy(e),([t,r])=>[t,r],()=>o(my(e),([t,r])=>[t,r],()=>o(py(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),iu=(e,t=[])=>o(o(ou(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>iu(n,[...t,r]),()=>[t,e]),uy=e=>o(o(iu(e),([t,r])=>o(o(o(ou(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Ws(t),r]),oo=e=>o(o(u("<",e),([t,r])=>o(uy(r),([n,a])=>o(u(">",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Hs(t),r]),su=(e,t=[])=>o(o(R(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>su(n,[...t,r]),()=>[t,e]),cy=e=>o(o(su(e),([t,r])=>o(o(o(R(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Ys(t),r]),ly=e=>o(o(u("<",e),([t,r])=>o(cy(r),([n,a])=>o(u(">",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Js(t),r]),dy=e=>o(o(W(e),([t,r])=>o(ly(r),([n,a])=>[[t,n],a])),([t,r])=>[Xs(t),r]),mu=e=>o(o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Zs(t),r]),pu=e=>o(u("string",e),([t,r])=>[Qs(t),r]),uu=e=>o(u("number",e),([t,r])=>[em(t),r]),fy=e=>o(u("boolean",e),([t,r])=>[tm(t),r]),gy=e=>o(u("undefined",e),([t,r])=>[rm(t),r]),hy=e=>o(u("null",e),([t,r])=>[nm(t),r]),cu=e=>o(u("integer",e),([t,r])=>[am(t),r]),yy=e=>o(u("bigint",e),([t,r])=>[om(t),r]),xy=e=>o(u("unknown",e),([t,r])=>[im(t),r]),Iy=e=>o(u("any",e),([t,r])=>[sm(t),r]),by=e=>o(u("object",e),([t,r])=>[mm(t),r]),vy=e=>o(u("never",e),([t,r])=>[pm(t),r]),lu=e=>o(u("symbol",e),([t,r])=>[um(t),r]),$y=e=>o(u("void",e),([t,r])=>[cm(t),r]),Ty=e=>o(u("this",e),([t,r])=>[lm(t),r]),ky=e=>o(o(u("${",e),([t,r])=>o(R(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[ym(t),r]),no=e=>o(xt(["${","`"],e),([t,r])=>[xm(t),r]),du=e=>o(o(o(no(e),([t,r])=>o(ky(r),([n,a])=>o(du(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(o(no(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(no(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[Im(t),r]),io=e=>o(o(u("`",e),([t,r])=>o(du(r),([n,a])=>o(u("`",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[bm(t),r]),wy=e=>o(io(e),([t,r])=>[vm(t),r]),Ey=e=>o(o(o(u("if",e),([t,r])=>o(R(r),([n,a])=>o(u("then",a),([s,m])=>o(R(m),([c,l])=>o(u("else",l),([g,f])=>o(R(f),([w,F])=>[[t,n,s,c,g,w],F])))))),([t,r])=>[t,r],()=>o(o(u("if",e),([t,r])=>o(R(r),([n,a])=>o(u("then",a),([s,m])=>o(R(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>[])),([t,r])=>[$m(t),r]),Ry=e=>o(to(e),([t,r])=>[dm(t),r]),Sy=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[fm(t),r]),Oy=e=>o(pa(e),([t,r])=>[gm(t),r]),Py=e=>o(ua(["'",'"'],e),([t,r])=>[hm(t),r]),Cy=e=>o(o(o(u("keyof",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Tm(t),r]),fu=(e,t=[])=>o(o(o(u("[",e),([r,n])=>o(R(n),([a,s])=>o(u("]",s),([m,c])=>[[r,a,m],c]))),([r,n])=>[r,n],()=>o(o(u("[",e),([r,n])=>o(u("]",n),([a,s])=>[[r,a],s])),([r,n])=>[r,n],()=>[])),([r,n])=>fu(n,[...t,r]),()=>[t,e]),My=e=>o(fu(e),([t,r])=>[km(t),r]),Ay=e=>o(o(o(u("extends",e),([t,r])=>o(R(r),([n,a])=>o(u("?",a),([s,m])=>o(R(m),([c,l])=>o(u(":",l),([g,f])=>o(R(f),([w,F])=>[[t,n,s,c,g,w],F])))))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[wm(t),r]),Ly=e=>o(o(o(u("(",e),([t,r])=>o(R(r),([n,a])=>o(u(")",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(pu(e),([t,r])=>[t,r],()=>o(uu(e),([t,r])=>[t,r],()=>o(fy(e),([t,r])=>[t,r],()=>o(gy(e),([t,r])=>[t,r],()=>o(hy(e),([t,r])=>[t,r],()=>o(cu(e),([t,r])=>[t,r],()=>o(yy(e),([t,r])=>[t,r],()=>o(xy(e),([t,r])=>[t,r],()=>o(Iy(e),([t,r])=>[t,r],()=>o(by(e),([t,r])=>[t,r],()=>o(vy(e),([t,r])=>[t,r],()=>o(lu(e),([t,r])=>[t,r],()=>o($y(e),([t,r])=>[t,r],()=>o(Ty(e),([t,r])=>[t,r],()=>o(Ry(e),([t,r])=>[t,r],()=>o(Sy(e),([t,r])=>[t,r],()=>o(Oy(e),([t,r])=>[t,r],()=>o(Py(e),([t,r])=>[t,r],()=>o(wy(e),([t,r])=>[t,r],()=>o(Ey(e),([t,r])=>[t,r],()=>o(Wy(e),([t,r])=>[t,r],()=>o(Qy(e),([t,r])=>[t,r],()=>o(ox(e),([t,r])=>[t,r],()=>o(ax(e),([t,r])=>[t,r],()=>o(px(e),([t,r])=>[t,r],()=>o(dy(e),([t,r])=>[t,r],()=>o(ux(e),([t,r])=>[t,r],()=>[])))))))))))))))))))))))))))),([t,r])=>[Em(t),r]),qy=e=>o(o(o(u("with",e),([t,r])=>o(Pu(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Rm(t),r]),gu=e=>o(o(Cy(e),([t,r])=>o(Ly(r),([n,a])=>o(My(a),([s,m])=>o(Ay(m),([c,l])=>o(qy(l),([g,f])=>[[t,n,s,c,g],f]))))),([t,r])=>[Sm(t),r]),hu=e=>o(o(o(u("&",e),([t,r])=>o(gu(r),([n,a])=>o(hu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),yu=e=>o(o(gu(e),([t,r])=>o(hu(r),([n,a])=>[[t,n],a])),([t,r])=>[Om(t),r]),xu=e=>o(o(o(u("|",e),([t,r])=>o(yu(r),([n,a])=>o(xu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),ca=e=>o(o(yu(e),([t,r])=>o(xu(r),([n,a])=>[[t,n],a])),([t,r])=>[Pm(t),r]),jy=e=>o(o(u("readonly",e),([t,r])=>o(ca(r),([n,a])=>[[t,n],a])),([t,r])=>[Cm(t),r]),Fy=e=>o(o(u("|",e),([t,r])=>o(ca(r),([n,a])=>[[t,n],a])),([t,r])=>[Mm(t),r]),Dy=e=>o(o(oo(e),([t,r])=>o(u("=",r),([n,a])=>o(R(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Am(t),r]),Ny=e=>o(o(o(u("infer",e),([t,r])=>o(W(r),([n,a])=>o(u("extends",a),([s,m])=>o(ca(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(u("infer",e),([t,r])=>o(W(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>[])),([t,r])=>[Lm(t),r]),R=e=>o(o(Ny(e),([t,r])=>[t,r],()=>o(Fy(e),([t,r])=>[t,r],()=>o(jy(e),([t,r])=>[t,r],()=>o(ca(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Gy=e=>o(pa(e),([t,r])=>[qm(t),r]),Uy=e=>o(W(e),([t,r])=>[t,r]),Ky=e=>o(ua(["'",'"'],e),([t,r])=>[t,r]),_y=e=>o(o(u("[",e),([t,r])=>o(W(r),([n,a])=>o(u(":",a),([s,m])=>o(o(cu(m),([c,l])=>[c,l],()=>o(uu(m),([c,l])=>[c,l],()=>o(pu(m),([c,l])=>[c,l],()=>o(lu(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([g,f])=>[[t,n,s,c,g],f]))))),([t,r])=>[jm(t),r]),Iu=e=>o(o(Gy(e),([t,r])=>[t,r],()=>o(Uy(e),([t,r])=>[t,r],()=>o(Ky(e),([t,r])=>[t,r],()=>o(_y(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),zy=e=>o(o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Fm(t),r]),By=e=>o(o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Dm(t),r]),bu=e=>o(o(zy(e),([t,r])=>o(Iu(r),([n,a])=>o(By(a),([s,m])=>o(u(":",m),([c,l])=>o(R(l),([g,f])=>[[t,n,s,c,g],f]))))),([t,r])=>[Nm(t),r]),vu=e=>o(o(o(u(",",e),([t,r])=>o(u(`
7
- `,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>o(u(`
8
- `,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(",",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(`
9
- `,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),$u=(e,t=[])=>o(o(bu(e),([r,n])=>o(vu(n),([a,s])=>[[r,a],s])),([r,n])=>$u(n,[...t,r]),()=>[t,e]),Vy=e=>o(o($u(e),([t,r])=>o(o(o(bu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Gm(t),r]),so=e=>o(o(u("{",e),([t,r])=>o(Vy(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Km(t),r]),Wy=e=>o(so(e),([t,r])=>[_m(t),r]),Hy=e=>o(o(o(W(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(R(l),([g,f])=>[[t,n,s,c,g],f]))))),([t,r])=>[t,r],()=>o(o(W(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([s,m])=>o(R(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(W(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(R(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(W(e),([t,r])=>o(u(":",r),([n,a])=>o(R(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>[])))),([t,r])=>[zm(t),r]),Yy=e=>o(o(u("readonly",e),([t,r])=>o(R(r),([n,a])=>o(u("?",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Bm(t),r]),Jy=e=>o(o(u("readonly",e),([t,r])=>o(R(r),([n,a])=>[[t,n],a])),([t,r])=>[Vm(t),r]),Xy=e=>o(o(R(e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[Wm(t),r]),nu=e=>o(o(Hy(e),([t,r])=>[t,r],()=>o(Yy(e),([t,r])=>[t,r],()=>o(Jy(e),([t,r])=>[t,r],()=>o(Xy(e),([t,r])=>[t,r],()=>o(R(e),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),Tu=e=>o(o(o(u("...",e),([t,r])=>o(nu(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(nu(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[Hm(t),r]),ku=(e,t=[])=>o(o(Tu(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>ku(n,[...t,r]),()=>[t,e]),Zy=e=>o(o(ku(e),([t,r])=>o(o(o(Tu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Ym(t),r]),Qy=e=>o(o(u("[",e),([t,r])=>o(Zy(r),([n,a])=>o(u("]",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Jm(t),r]),ex=e=>o(o(W(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(R(l),([g,f])=>[[t,n,s,c,g],f]))))),([t,r])=>[Xm(t),r]),tx=e=>o(o(W(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([s,m])=>o(R(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[Zm(t),r]),rx=e=>o(o(W(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(R(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[Qm(t),r]),nx=e=>o(o(W(e),([t,r])=>o(u(":",r),([n,a])=>o(R(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[ep(t),r]),au=e=>o(o(ex(e),([t,r])=>[t,r],()=>o(tx(e),([t,r])=>[t,r],()=>o(rx(e),([t,r])=>[t,r],()=>o(nx(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),wu=e=>o(o(o(u("...",e),([t,r])=>o(au(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(au(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[tp(t),r]),Eu=(e,t=[])=>o(o(wu(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>Eu(n,[...t,r]),()=>[t,e]),Ru=e=>o(o(Eu(e),([t,r])=>o(o(o(wu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[rp(t),r]),ax=e=>o(o(u("(",e),([t,r])=>o(Ru(r),([n,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(R(l),([g,f])=>[[t,n,s,c,g],f]))))),([t,r])=>[np(t),r]),ox=e=>o(o(u("new",e),([t,r])=>o(u("(",r),([n,a])=>o(Ru(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([g,f])=>o(R(f),([w,F])=>[[t,n,s,c,g,w],F])))))),([t,r])=>[ap(t),r]),ix=e=>o(o(o(u("+",e),([t,r])=>o(u("readonly",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("-",e),([t,r])=>o(u("readonly",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[op(t),r]),sx=e=>o(o(o(u("+",e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("-",e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[ip(t),r]),mx=e=>o(o(o(u("as",e),([t,r])=>o(R(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[sp(t),r]),px=e=>o(o(u("{",e),([t,r])=>o(ix(r),([n,a])=>o(u("[",a),([s,m])=>o(W(m),([c,l])=>o(u("in",l),([g,f])=>o(R(f),([w,F])=>o(mx(F),([B,ue])=>o(u("]",ue),([Ce,Me])=>o(sx(Me),([je,Xe])=>o(u(":",Xe),([D,vt])=>o(R(vt),([at,ot])=>o(mu(ot),([it,$t])=>o(u("}",$t),([Tt,zt])=>[[t,n,s,c,g,w,B,Ce,je,D,at,it,Tt],zt]))))))))))))),([t,r])=>[mp(t),r]),ux=e=>o(W(e),([t,r])=>[pp(t),r]),cx=e=>o(to(e),([t,r])=>[up(t),r]),lx=e=>o(pa(e),([t,r])=>[cp(t),r]),dx=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[lp(t),r]),fx=e=>o(ua(['"',"'"],e),([t,r])=>[t,r]),gx=e=>o(u("null",e),([t,r])=>[dp(t),r]),hx=e=>o(u("undefined",e),([t,r])=>[void 0,r]),Su=e=>o(o(Iu(e),([t,r])=>o(u(":",r),([n,a])=>o(mo(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[fp(t),r]),Ou=(e,t=[])=>o(o(Su(e),([r,n])=>o(vu(n),([a,s])=>[[r,a],s])),([r,n])=>Ou(n,[...t,r]),()=>[t,e]),yx=e=>o(o(Ou(e),([t,r])=>o(o(o(Su(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[gp(t),r]),Pu=e=>o(o(u("{",e),([t,r])=>o(yx(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[hp(t),r]),Cu=(e,t=[])=>o(o(mo(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>Cu(n,[...t,r]),()=>[t,e]),xx=e=>o(o(Cu(e),([t,r])=>o(o(o(mo(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[yp(t),r]),Ix=e=>o(o(u("[",e),([t,r])=>o(xx(r),([n,a])=>o(u("]",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[xp(t),r]),mo=e=>o(o(cx(e),([t,r])=>[t,r],()=>o(lx(e),([t,r])=>[t,r],()=>o(dx(e),([t,r])=>[t,r],()=>o(fx(e),([t,r])=>[t,r],()=>o(gx(e),([t,r])=>[t,r],()=>o(hx(e),([t,r])=>[t,r],()=>o(Pu(e),([t,r])=>[t,r],()=>o(Ix(e),([t,r])=>[t,r],()=>[])))))))),([t,r])=>[t,r]),bx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,r])=>[Ip(t),r]),vx=e=>o(u(".*",e),([t,r])=>[bp(t),r]),$x=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,r])=>[vp(t),r]),Tx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,r])=>[$p(t),r]),kx=e=>o(u("(?!)",e),([t,r])=>[Tp(t),r]),wx=e=>o(ru(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,r])=>[kp(t),r]),Ex=e=>o(o(bx(e),([t,r])=>[t,r],()=>o(vx(e),([t,r])=>[t,r],()=>o($x(e),([t,r])=>[t,r],()=>o(Tx(e),([t,r])=>[t,r],()=>o(kx(e),([t,r])=>[t,r],()=>o(Rx(e),([t,r])=>[t,r],()=>o(wx(e),([t,r])=>[t,r],()=>[]))))))),([t,r])=>[t,r]),Rx=e=>o(o(u("(",e),([t,r])=>o(po(r),([n,a])=>o(u(")",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[wp(t),r]),Mu=e=>o(o(o(ao(e),([t,r])=>o(u("|",r),([n,a])=>o(Mu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(o(ao(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[]))),([t,r])=>[Ep(t),r]),ao=e=>o(o(Ex(e),([t,r])=>o(po(r),([n,a])=>[[t,n],a])),([t,r])=>[Rp(t),r]),po=e=>o(o(Mu(e),([t,r])=>[t,r],()=>o(ao(e),([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),is=e=>o(o(u("^",e),([t,r])=>o(po(r),([n,a])=>o(u("$",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Sp(t),r]),Au=(e,t=[])=>o(o(R(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>Au(n,[...t,r]),()=>[t,e]),Sx=e=>o(o(Au(e),([t,r])=>o(o(o(R(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Op(t),r]),Lu=e=>o(o(o(u("extends",e),([t,r])=>o(Sx(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Pp(t),r]),Ox=e=>o(o(u("interface",e),([t,r])=>o(W(r),([n,a])=>o(oo(a),([s,m])=>o(Lu(m),([c,l])=>o(so(l),([g,f])=>[[t,n,s,c,g],f]))))),([t,r])=>[Cp(t),r]),Px=e=>o(o(u("interface",e),([t,r])=>o(W(r),([n,a])=>o(Lu(a),([s,m])=>o(so(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[Mp(t),r]),Cx=e=>o(o(u("type",e),([t,r])=>o(W(r),([n,a])=>o(oo(a),([s,m])=>o(u("=",m),([c,l])=>o(R(l),([g,f])=>[[t,n,s,c,g],f]))))),([t,r])=>[Ap(t),r]),Mx=e=>o(o(u("type",e),([t,r])=>o(W(r),([n,a])=>o(u("=",a),([s,m])=>o(R(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[Lp(t),r]),Ax=e=>o(o(o(u("export",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[qp(t),r]),Lx=e=>o(o(o(u(";",e),([t,r])=>o(u(`
10
- `,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(`
11
- `,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]),qu=(e,t=[])=>o(o(uo(e),([r,n])=>o(Lx(n),([a,s])=>[[r,a],s])),([r,n])=>qu(n,[...t,r]),()=>[t,e]),qx=e=>o(o(qu(e),([t,r])=>o(o(o(uo(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[jp(t),r]),uo=e=>o(o(Ax(e),([t,r])=>o(o(Ox(r),([n,a])=>[n,a],()=>o(Px(r),([n,a])=>[n,a],()=>o(Cx(r),([n,a])=>[n,a],()=>o(Mx(r),([n,a])=>[n,a],()=>[])))),([n,a])=>o(mu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Fp(t),r]),jx=e=>o(o(uo(e),([t,r])=>o(qx(r),([n,a])=>[[t,n],a])),([t,r])=>[Dp(t),r]),ju=e=>o(o(jx(e),([t,r])=>[t,r],()=>o(Dy(e),([t,r])=>[t,r],()=>o(R(e),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]);function Fu(e){let t=io(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:Y()}function Dx(e){return e.join("|")}function Nx(e){return e.slice(1,e.length-1)}function Gx(e,t,r){return It(t,`${r}${e}`)}function Ux(e,t){return It(e,`${t}${es}`)}function Kx(e,t){return It(e,`${t}${wn}`)}function _x(e,t){return It(e,`${t}${Rn}`)}function zx(e,t){return Ur(k([O("false"),O("true")]),e,t)}function Bx(e,t){return It(e,`${t}${Sn}`)}function Vx(e,t,r){return It(t,`${r}${Nx(e)}`)}function Wx(e,t,r){let n=Kr(e,{});return Ur(n,t,r)}function Hx(e,t,r){let n=ke(e);return Ur(n,t,r)}function Du(e,t,r,n=[]){return i.ShiftLeft(e,(a,s)=>Du(s,t,r,[...n,Ur(a,[],"")]),()=>It(t,`${r}(${Dx(n)})`))}function Ur(e,t,r){return fe(e)?Hx(e.enum,t,r):ge(e)?Kx(t,r):A(e)?Gx(e.const,t,r):ze(e)?Ux(t,r):Re(e)?zx(t,r):X(e)?_x(t,r):he(e)?Bx(t,r):Z(e)?Vx(e.pattern,t,r):Gu(e)?Wx(e.parameters[0],t,r):x(e)?Du(e.anyOf,t,r):qi}function It(e,t){return i.ShiftLeft(e,(r,n)=>Ur(r,n,t),()=>t)}function Yx(e){return`^${It(e,"")}$`}function Nu(e){let t=Yx(e);return Pn(t)}function Kr(e,t){return T(e)?p.Update(Nu(e),{},t):Nn(e,t)}function Uu(e,t,r,n){let a=we(e,t,r);return Kr(a,n)}function Nn(e,t={}){return I("TemplateLiteral",[e],t)}function Gu(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function Ku(e){return Kr(e,{})}function Jx(e){let t=Fu(e);return Ku(t)}function _u(e,t={}){let r=i.IsString(e)?Jx(e):Ku(e);return p.Update(r,{},t)}function Z(e){return y(e,"TemplateLiteral")}var b={};Et(b,{ExtendsFalse:()=>$,ExtendsTrue:()=>h,ExtendsUnion:()=>co,IsExtendsFalse:()=>Xx,IsExtendsTrue:()=>Bu,IsExtendsTrueLike:()=>ir,IsExtendsUnion:()=>zu,Match:()=>U});function co(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function zu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsUnion")&&i.IsObject(e.inferred)}function h(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Bu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function $(){return p.Create({"~kind":"ExtendsFalse"},{})}function Xx(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function ir(e){return zu(e)||Bu(e)}function U(e,t,r){return ir(e)?t(e.inferred):r()}function Zx(e,t,r,n){return U(P(e,r,n),a=>h(p.Assign(p.Assign(e,a),{[t]:r})),()=>$())}function Qx(e,t){return h(e)}function eI(e,t,r,n,a){return U(P(e,t,r),s=>U(P(s,t,n),m=>h(m),()=>$()),()=>U(P(e,t,a),s=>h(s),()=>$()))}function tI(e,t,r){let n=ke(r);return P(e,t,n)}function Vu(e,t,r){return i.ShiftLeft(r,(n,a)=>U(P(e,t,n),s=>Vu(s,t,a),()=>$()),()=>h(e))}function rI(e,t,r){let n=Ie(r);return P(e,t,n)}function Wu(e,t,r){return i.ShiftLeft(r,(n,a)=>U(P(e,t,n),s=>h(s),()=>Wu(e,t,a)),()=>$())}function L(e,t,r){return J(r)?Qx(e,t):V(r)?eI(e,t,r.if,r.then,r.else):fe(r)?tI(e,t,r.enum):H(r)?Zx(e,r.name,t,r.extends):S(r)?Vu(e,t,r.allOf):Z(r)?rI(e,t,r.pattern):x(r)?Wu(e,t,r.anyOf):te(r)?h(e):$()}function Hu(e,t,r){return H(r)?L(e,t,r):J(r)?h(e):te(r)?h(e):co(e)}function nI(e,t){let r=Mt(e),n=Mt(t);return r&&n||!r&&n?!0:!(r&&!n)}function Yu(e,t,r,n){return K(n)?nI(t,n)?P(e,r,n.items):$():L(e,t,n)}function Ju(e,t,r){return ze(r)?h(e):L(e,t,r)}function Xu(e,t,r){return Re(r)?h(e):L(e,t,r)}function aI(e,t,r,n,a){let s=H(n)?t:n,m=H(n)?n:t,c=le(t),l=le(n);return!c&&l?$():U(P(e,s,m),g=>_r(g,r,a),()=>$())}function oI(e,t,r,n){return i.ShiftLeft(n,(a,s)=>aI(e,t,r,a,s),()=>le(t)?h(e):$())}function iI(e,t,r){return i.ShiftLeft(t,(n,a)=>oI(e,n,a,r),()=>h(e))}function _r(e,t,r){return iI(e,t,r)}function la(e,t,r){return Be(r)?h(e):P(e,t,r)}function Zu(e,t,r,n){return J(n)?h(e):te(n)?h(e):re(n)?U(_r(e,t,n.parameters),a=>la(a,r,n.instanceType),()=>$()):$()}function Qu(e,t,r,n,a){return U(P(e,t,a),()=>P(e,r,a),()=>P(e,n,a))}function ec(e,t,r){let n=ke(t);return P(e,n,r)}function tc(e,t,r,n){return J(n)?h(e):te(n)?h(e):ne(n)?U(_r(e,t,n.parameters),a=>la(a,r,n.returnType),()=>$()):$()}function rc(e,t,r){return ge(r)?h(e):X(r)?h(e):L(e,t,r)}function nc(e,t,r){let n=_(t);return P(e,n,r)}function da(e,t,r){return t===r?h(e):$()}function sI(e,t,r){return A(r)?da(e,t,r.const):ze(r)?h(e):L(e,O(t),r)}function mI(e,t,r){return A(r)?da(e,t,r.const):Re(r)?h(e):L(e,O(t),r)}function pI(e,t,r){return A(r)?da(e,t,r.const):X(r)?h(e):L(e,O(t),r)}function uI(e,t,r){return A(r)?da(e,t,r.const):he(r)?h(e):L(e,O(t),r)}function ac(e,t,r){return i.IsBigInt(t.const)?sI(e,t.const,r):i.IsBoolean(t.const)?mI(e,t.const,r):i.IsNumber(t.const)?pI(e,t.const,r):i.IsString(t.const)?uI(e,t.const,r):Y()}function oc(e,t,r){return H(r)?L(e,t,r):h(e)}function ic(e,t,r){return Jt(r)?h(e):L(e,t,r)}function sc(e,t,r){return X(r)?h(e):L(e,t,r)}function cI(e,t,r){return le(t)?le(r)?h(e):$():h(e)}function lI(e,t,r){return H(r)&&lt(r.extends)?$():U(P(e,t,r),n=>cI(n,t,r),()=>$())}function dI(e,t){return e.reduce((r,n)=>n in t?ir(t[n])?{...r,...t[n].inferred}:Y():Y(),{})}function fI(e,t,r){let n={};for(let m of i.Keys(r))n[m]=m in t?lI({},t[m],r[m]):le(r[m])?H(r[m])?h(p.Assign(e,{[r[m].name]:r[m].extends})):h(e):$();let a=i.Values(n).every(m=>ir(m)),s=a?dI(i.Keys(n),n):{};return a?h(s):$()}function gI(e,t,r){let n=fI(e,t,r);return ir(n)?h(p.Assign(e,n.inferred)):$()}function hI(e,t,r){return gI(e,t,r)}function yI(e,t){return i.Keys(t).reduce((r,n)=>({...r,[n]:i.HasPropertyKey(e,n)?x(r[n])?k([...r[n].anyOf,t[n]]):k([e[n],t[n]]):t[n]}),e)}function mc(e,t,r,n){return i.ShiftLeft(t,(a,s)=>U(P({},e[a],r),m=>mc(e,s,r,yI(n,m)),()=>$()),()=>h(n))}function xI(e,t,r,n){let a=i.Keys(t);return mc(t,a,n,e)}function pc(e,t,r){return pe(r)?xI(e,t,Pe(r),ye(r)):M(r)?hI(e,t,r.properties):L(e,v(t),r)}function II(e,t){return i.IsEqual(i.Keys(t).length,0)?h(e):$()}function bI(e,t,r,n,a){return P(e,r,a)}function uc(e,t,r,n){return pe(n)?bI(e,qn(t),r,qn(Pe(n)),ye(n)):M(n)?II(e,n.properties):J(n)?h(e):te(n)?h(e):$()}function cc(e,t,r){return he(r)?h(e):L(e,t,r)}function lc(e,t,r){return dt(r)?h(e):L(e,t,r)}function dc(e,t,r){let n=Ie(t);return P(e,n,r)}function lo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function zr(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"name")&&i.HasPropertyKey(e,"type")&&i.IsEqual(e["~kind"],"Inferrable")&&i.IsString(e.name)&&i.IsObject(e.type)}function fo(e){return ht(e)?H(e.items)?K(e.items.extends)?lo(e.items.name,e.items.extends.items):te(e.items.extends)?lo(e.items.name,e.items.extends):void 0:Y():void 0}function fa(e){return H(e)?lo(e.name,e.extends):void 0}function go(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>U(P({},n,t),()=>go(a,t,[...r,n]),()=>{}),()=>r)}function fc(e,t,r,n){let a=go(r,n);return i.IsArray(a)?h(p.Assign(e,{[t]:Q(a)})):$()}function ga(e,t,r,n){let a=go(r,n);return i.IsArray(a)?h(p.Assign(e,{[t]:k(a)})):$()}function vI(e){return[...e].reverse()}function ho(e,t){return t?vI(e):e}function $I(e){let t=e.length>0?e[0]:void 0,r=ee(t)?fo(t):void 0;return ee(r)}function TI(e,t,r,n,a,s){return U(P(e,r,a),m=>gc(m,t,n,s),()=>$())}function kI(e,t,r,n,a){let s=fo(n);return zr(s)?fc(e,s.name,ho(r,t),s.type):i.ShiftLeft(r,(m,c)=>TI(e,t,m,c,n,a),()=>$())}function wI(e,t,r,n){return i.ShiftLeft(n,(a,s)=>kI(e,t,r,a,s),()=>i.IsEqual(r.length,0)?h(e):$())}function gc(e,t,r,n){return wI(e,t,r,n)}function EI(e,t,r){let n=bt(e,G([],[]),r),a=$I(n);return gc(e,a,ho(t,a),ho(n,a))}function hc(e,t,r){let n=fa(r);return zr(n)?ga(e,n.name,t,n.type):i.ShiftLeft(t,(a,s)=>U(P(e,a,r),m=>hc(m,s,r),()=>$()),()=>h(e))}function yc(e,t,r){let n=bt(e,G([],[]),t);return j(r)?EI(e,n,r.items):K(r)?hc(e,n,r.items):L(e,Q(n),r)}function xc(e,t,r){return Be(r)?h(e):rr(r)?h(e):L(e,t,r)}function Ic(e,t,r){return i.ShiftLeft(r,(n,a)=>U(P(e,t,n),s=>h(s),()=>Ic(e,t,a)),()=>$())}function yo(e,t,r){return i.ShiftLeft(t,(n,a)=>U(Ic(e,n,r),s=>yo(s,a,r),()=>$()),()=>h(e))}function bc(e,t,r){let n=fa(r);return zr(n)?ga(e,n.name,t,n.type):x(r)?yo(e,t,r.anyOf):yo(e,t,[r])}function vc(e,t,r){return H(r)?L(e,t,r):J(r)?h(e):te(r)?h(e):$()}function $c(e,t,r){return Be(r)?h(e):L(e,t,r)}function P(e,t,r){return J(t)?Hu(e,t,r):K(t)?Yu(e,t,t.items,r):ze(t)?Ju(e,t,r):Re(t)?Xu(e,t,r):re(t)?Zu(e,t.parameters,t.instanceType,r):V(t)?Qu(e,t.if,t.then,t.else,r):fe(t)?ec(e,t.enum,r):ne(t)?tc(e,t.parameters,t.returnType,r):ge(t)?rc(e,t,r):S(t)?nc(e,t.allOf,r):A(t)?ac(e,t,r):lt(t)?oc(e,t,r):Jt(t)?ic(e,t,r):X(t)?sc(e,t,r):M(t)?pc(e,t.properties,r):pe(t)?uc(e,Pe(t),ye(t),r):he(t)?cc(e,t,r):dt(t)?lc(e,t,r):Z(t)?dc(e,t.pattern,r):j(t)?yc(e,t.items,r):rr(t)?xc(e,t,r):x(t)?bc(e,t.anyOf,r):te(t)?vc(e,t,r):Be(t)?$c(e,t,r):$()}function RI(e,t){return _([...e,v(t)])}function xo(e,t,r){return T(e)?p.Update(RI(e,t),{},r):jr(e,t,r)}function Tc(e,t,r,n,a){let s=we(e,t,r),m=Br(e,t,n);return xo(s,m,a)}function jr(e,t,r={}){return I("Interface",[e,t],r)}function sr(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function kc(e,t,r={}){return xo(e,t,r)}function SI(e,t,r){return e.includes(r)?!0:Vr([...e,r],t,t[r])}function wc(e,t,r){let n=bn(r);return Nt(e,t,n)}function Nt(e,t,r){return i.ShiftLeft(r,(n,a)=>Vr(e,t,n)?!0:Nt(e,t,a),()=>!1)}function Vr(e,t,r){return ae(r)?SI(e,t,r.$ref):K(r)?Vr(e,t,r.items):re(r)?Nt(e,t,[...r.parameters,r.instanceType]):ne(r)?Nt(e,t,[...r.parameters,r.returnType]):sr(r)?wc(e,t,r.parameters[1]):S(r)?Nt(e,t,r.allOf):M(r)?wc(e,t,r.properties):x(r)?Nt(e,t,r.anyOf):j(r)?Nt(e,t,r.items):pe(r)?Vr(e,t,ye(r)):!1}function Ec(e,t,r){return Vr(e,t,r)}function OI(e,t){return t.reduce((r,n)=>Ec([n],e,e[n])?[...r,n]:r,[])}function Rc(e){let t=In(e);return OI(e,t)}function PI(e,t,r){return r.includes(t)?r:t in e?Wr(e,e[t],[...r,t]):Y()}function Sc(e,t,r){let n=bn(t);return mr(e,n,r)}function mr(e,t,r){return t.reduce((n,a)=>Wr(e,a,n),r)}function Wr(e,t,r){return ae(t)?PI(e,t.$ref,r):K(t)?Wr(e,t.items,r):re(t)?mr(e,[...t.parameters,t.instanceType],r):ne(t)?mr(e,[...t.parameters,t.returnType],r):sr(t)?Sc(e,t.parameters[1],r):S(t)?mr(e,t.allOf,r):M(t)?Sc(e,t.properties,r):x(t)?mr(e,t.anyOf,r):j(t)?mr(e,t.items,r):pe(t)?Wr(e,ye(t),r):r}function Oc(e,t,r){return Wr(e,r,[t])}function CI(e){return Wt()}function MI(e){return i.Keys(e).reduce((t,r)=>({...t,[r]:Gt(e[r])}),{})}function Hr(e){return e.reduce((t,r)=>[...t,Gt(r)],[])}function Gt(e){return ae(e)?CI(e.$ref):K(e)?Te(Gt(e.items),xn(e)):re(e)?De(Hr(e.parameters),Gt(e.instanceType)):ne(e)?Ne(Hr(e.parameters),Gt(e.returnType)):S(e)?de(Hr(e.allOf)):M(e)?v(MI(e.properties)):pe(e)?Ln(er(e),Gt(ye(e))):x(e)?k(Hr(e.anyOf)):j(e)?Q(Hr(e.items)):e}function AI(e,t){return t in e?Gt(e[t]):oe()}function Pc(e){return AI(e.$defs,e.$ref)}function LI(e,t,r){let n=we(e,G([],[]),t),a=Br({},G([],[]),r);return _([...n,v(a)])}function qI(e,t){return i.Keys(e).filter(n=>t.includes(n)).reduce((n,a)=>{let s=e[a],m=sr(s)?LI(e,s.parameters[0],s.parameters[1]):s;return{...n,[a]:m}},{})}function Cc(e,t,r){let n=Oc(e,t,r),a=qI(e,n);return Ue(a,t)}function Mc(e,t){return t in e?ae(e[t])?Mc(e,e[t].$ref):e[t]:q()}function Ve(e,t){return Mc(e,t)}function Ac(e){return se(e)?Pc(e):vn(e)?oe():e}function me(e,t,r){let n=Ac(t),a=Ac(r);return P(e,n,a)}var Pr="equal",jI="disjoint",Cr="left-inside",Mr="right-inside";function Zt(e,t){let r=[te(e)?b.ExtendsFalse():me({},e,t),te(e)?b.ExtendsTrue({}):me({},t,e)];return b.IsExtendsTrueLike(r[0])&&b.IsExtendsTrueLike(r[1])?Pr:b.IsExtendsTrueLike(r[0])&&b.IsExtendsFalse(r[1])?Cr:b.IsExtendsFalse(r[0])&&b.IsExtendsTrueLike(r[1])?Mr:jI}function FI(e,t){return t.filter(r=>Zt(e,r)!==Mr)}function DI(e,t){let r=t.some(n=>{let a=Zt(e,n);return i.IsEqual(a,Cr)||i.IsEqual(a,Pr)});return i.IsEqual(r,!1)}function NI(e,t){let r=Oe(e);return J(r)?[r]:DI(r,t)?[...FI(r,t),r]:t}function GI(e){return e.reduce((t,r)=>M(r)?[...t,r]:lt(r)?t:NI(r,t),[])}function Ya(e){let t=GI(e);return Lr(t)}function Io(e,t){return p.Update(Oe(e),{},t)}function Lc(e,t,r,n){let a=d(e,t,r);return Io(a,n)}function Yr(e,t=[]){return ut(e)&&i.IsEqual(e.action,"Conditional")?ae(e.parameters[0])?Yr(e.parameters[2],Yr(e.parameters[3],[...t,e.parameters[0].$ref])):Yr(e.parameters[2],Yr(e.parameters[3],t)):ut(e)&&i.IsEqual(e.action,"Mapped")&&ut(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&ae(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function UI(e,t){return e.reduce((r,n)=>[...r,t.includes(n.name)],[])}function Fc(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>i.ShiftLeft(t,(s,m)=>Fc(a,m,[...r,[s,n]]),()=>r),()=>r)}function KI(e){return x(e)?[...e.anyOf]:[e]}function _I(e,t){return e.reduce((r,n)=>[...r,[...n,t]],[])}function qc(e,t){return t.reduce((r,n)=>[...r,..._I(e,n)],[])}function jc(e){return e.reduce((t,r)=>i.IsEqual(r[0],!0)?qc(t,KI(r[1])):qc(t,[r[1]]),[[]])}function Dc(e,t,r){let n=Yr(r),a=UI(e,n),s=Fc(t,a);return ut(r)&&i.IsEqual(r.action,"Conditional")||ut(r)&&i.IsEqual(r.action,"Mapped")?jc(s):[t]}function zI(){return["(not-resolvable)",q()]}function BI(){return["(not-generic)",q()]}function VI(e,t,r){return[e,ct(t,r)]}function WI(e,t,r){return t in e?Nc(e,t,e[t],r):zI()}function Nc(e,t,r,n){return Vt(r)?VI(t,r.parameters,r.expression):ae(r)?WI(e,r.$ref,n):BI()}function Gc(e,t,r){return Nc(e,"(anonymous)",t,r)}function HI(e,t,r){if(H(t)||pr(t)||b.IsExtendsTrueLike(me({},t,r)))return;let n={parameter:e,expect:r,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:n})}function Uc(e,t,r,n,a){let s=d(e,t,a);return HI(r,s,n),p.Assign(e,{[r]:s})}function YI(e,t,r,n,a){let s=d(e,t,r.extends),m=d(e,t,r.equals);return i.ShiftLeft(a,(c,l)=>bo(Uc(e,t,r.name,s,c),t,n,l),()=>bo(Uc(e,t,r.name,s,m),t,n,[]))}function bo(e,t,r,n){return i.ShiftLeft(r,(a,s)=>YI(e,t,a,s,n),()=>e)}function Kc(e,t,r,n){return bo(e,t,r,n)}function JI(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function XI(e,t){return i.IsEqual(JI(e),t)}function ZI(e,t,r,n,a,s){let m=Kc(e,t,n,s),c=d(m,G([...t.callstack,r.$ref],t.visited),a);return d(m,G([],[]),c)}function QI(e,t,r,n,a,s){return s.reduce((m,c)=>[...m,ZI(e,t,r,n,a,c)],[])}function eb(e,t,r,n,a,s){let m=Dc(n,s,a),c=QI(e,t,r,n,a,m);return i.IsEqual(c.length,1)?c[0]:ve(c)}function ha(e,t,r,n){let a=we(e,t,n),s=Gc(e,r,n),m=s[0],c=s[1];return Vt(c)?XI(t,m)?Fr(et(m),a):eb(e,t,et(m),c.parameters,c.expression,a):Fr(r,a)}function Fr(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function _c(e,t){return ha({},G([],[]),e,t)}function pr(e){return y(e,"Call")}function tb(e){return p.Discard(e,["~immutable"])}function zc(e,t){return p.Update(tb(e),{},t)}function Bc(e,t,r,n){let a=d(e,t,r);return zc(a,n)}function Vc(e,t){return e(t)}function Wc(e,t){return i.IsString(t)?O(Vc(e,t)):O(t)}function Hc(e,t){let r=Ie(t);return nt(e,r)}function Yc(e,t){let r=t.map(n=>nt(e,n));return k(r)}function nt(e,t){return A(t)?Wc(e,t.const):Z(t)?Hc(e,t.pattern):x(t)?Yc(e,t.anyOf):t}function Gn(e,t={}){return I("Capitalize",[e],t)}function Jc(e,t={}){return vo(e,t)}function Un(e,t={}){return I("Lowercase",[e],t)}function Xc(e,t={}){return $o(e,t)}function Kn(e,t={}){return I("Uncapitalize",[e],t)}function Zc(e,t={}){return To(e,t)}function _n(e,t={}){return I("Uppercase",[e],t)}function Qc(e,t={}){return ko(e,t)}var rb=e=>e[0].toUpperCase()+e.slice(1),nb=e=>e.toLowerCase(),ab=e=>e[0].toLowerCase()+e.slice(1),ob=e=>e.toUpperCase();function vo(e,t){return T([e])?p.Update(nt(rb,e),{},t):Gn(e,t)}function $o(e,t){return T([e])?p.Update(nt(nb,e),{},t):Un(e,t)}function To(e,t){return T([e])?p.Update(nt(ab,e),{},t):Kn(e,t)}function ko(e,t){return T([e])?p.Update(nt(ob,e),{},t):_n(e,t)}function el(e,t,r,n){let a=d(e,t,r);return vo(a,n)}function tl(e,t,r,n){let a=d(e,t,r);return $o(a,n)}function rl(e,t,r,n){let a=d(e,t,r);return To(a,n)}function nl(e,t,r,n){let a=d(e,t,r);return ko(a,n)}function zn(e,t,r,n,a={}){return I("Conditional",[e,t,r,n],a)}function al(e,t,r,n,a={}){return wo({},G([],[]),e,t,r,n,a)}function ib(e,t,r,n,a,s){let m=me(e,r,n);return b.IsExtendsUnion(m)?k([d(m.inferred,t,a),d(e,t,s)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,s)}function wo(e,t,r,n,a,s,m){return T([r,n])?p.Update(ib(e,t,r,n,a,s),{},m):zn(r,n,a,s,m)}function ol(e,t,r,n,a,s,m){let c=d(e,t,r),l=d(e,t,n);return wo(e,t,c,l,a,s,m)}function Bn(e,t={}){return I("ConstructorParameters",[e],t)}function il(e,t={}){return Eo(e,t)}function sb(e){let t=re(e)?e.parameters:[],r=bt({},G([],[]),t);return Q(r)}function Eo(e,t){return T([e])?p.Update(sb(e),{},t):Bn(e,t)}function sl(e,t,r,n){let a=d(e,t,r);return Eo(a,n)}function Vn(e,t,r={}){return I("Exclude",[e,t],r)}function ml(e,t,r={}){return Jr(e,t,r)}function Jr(e,t,r){return T([e,t])?p.Update(Mn(e,t),{},r):Vn(e,t,r)}function pl(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Jr(s,m,a)}function Wn(e,t,r={}){return I("Extract",[e,t],r)}function ul(e,t,r={}){return Ro(e,t,r)}function mb(e,t){let r=me({},e,t);return b.IsExtendsTrueLike(r)?[e]:[]}function pb(e,t){return e.reduce((r,n)=>[...r,...mb(n,t)],[])}function cl(e,t){let r=Oe(e),n=x(r)?r.anyOf:[r],a=pb(n,t);return ve(a)}function Ro(e,t,r){return T([e,t])?p.Update(cl(e,t),{},r):Wn(e,t,r)}function ll(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Ro(s,m,a)}function ub(e){return e.reduce((t,r)=>En(r)?[...t,O(r)]:t,[])}function ur(e){let t=ub(e);return k(t)}function Dr(e,t,r={}){return I("Index",[e,t],r)}function dl(e,t,r={}){let n=i.IsArray(t)?ur(t):t;return So(e,n,r)}function fl(e,t){let r=Ve(e,t);return Ee(r)}function gl(e,t,r){let n=qe(e,t,r);return Ee(n)}function cb(e,t){let r=i.Keys(e).filter(f=>!i.HasPropertyKey(t,f)),n=i.Keys(t).filter(f=>!i.HasPropertyKey(e,f)),a=i.Keys(e).filter(f=>i.HasPropertyKey(t,f)),s=r.reduce((f,w)=>({...f,[w]:e[w]}),{}),m=n.reduce((f,w)=>({...f,[w]:t[w]}),{}),c=a.reduce((f,w)=>({...f,[w]:_([e[w],t[w]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function hl(e){return e.reduce((t,r)=>cb(t,Ee(r)),{})}function yl(e){let t=$s(Q(e));return Ee(t)}function lb(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:ve([e[s],t[s]])}),{})}function xl(e,t){return i.ShiftLeft(e,(r,n)=>xl(n,lb(t,Ee(r))),()=>t)}function Il(e){return i.ShiftLeft(e,(t,r)=>xl(r,Ee(t)),()=>Y())}function Ee(e){return se(e)?fl(e.$defs,e.$ref):V(e)?gl(e.if,e.then,e.else):S(e)?hl(e.allOf):x(e)?Il(e.anyOf):j(e)?yl(e.items):M(e)?e.properties:{}}function cr(e){let t=Ee(e);return v(t)}var db=new RegExp("^(?:0|[1-9][0-9]*)$");function lr(e){let t=`${e}`;return db.test(t)?parseInt(t):e}function fb(e){return O(lr(e))}function bl(e){return e.map(t=>vl(t))}function vl(e){return S(e)?de(bl(e.allOf)):x(e)?k(bl(e.anyOf)):A(e)?fb(e.const):e}function $l(e,t){let r=vl(t),n=me({},r,be());return b.IsExtendsTrueLike(n)?e:A(t)&&i.IsEqual(t.const,"length")?be():q()}function Tl(e,t){let r=Ve(e,t);return $e(r)}function kl(e,t,r){let n=qe(e,t,r);return $e(n)}function wl(e){let t=ke(e);return $e(t)}function El(e){let t=_(e);return $e(t)}function Rl(e){return[`${e}`]}function Sl(e){let t=Ie(e);return $e(t)}function Ol(e){return e.reduce((t,r)=>[...t,...$e(r)],[])}function $e(e){return se(e)?Tl(e.$defs,e.$ref):V(e)?kl(e.if,e.then,e.else):fe(e)?wl(e.enum):S(e)?El(e.allOf):A(e)?Rl(e.const):Z(e)?Sl(e.pattern):x(e)?Ol(e.anyOf):[]}function dr(e){return $e(e)}function Xr(e,t){return t.map(r=>Zr(e,r))}function Zr(e,t){return K(t)?Te(Zr(e,t.items)):re(t)?De(Xr(e,t.parameters),Zr(e,t.instanceType)):ne(t)?Ne(Xr(e,t.parameters),Zr(e,t.returnType)):j(t)?Q(Xr(e,t.items)):x(t)?k(Xr(e,t.anyOf)):S(t)?de(Xr(e,t.allOf)):Fn(t)?v(e):t}function Pl(e,t){return Zr(e,t)}function gb(e,t){let r=t in e?e[t]:q();return Pl(e,r)}function Cl(e,t){return t.reduce((r,n)=>[...r,gb(e,n)],[])}function hb(e,t){let r=dr(t),n=Cl(e,r);return ve(n)}var yb=new RegExp(gt);function xb(e){return e.filter(r=>yb.test(r))}function Ib(e){let t=In(e),r=xb(t),n=Cl(e,r);return ve(n)}function Ml(e,t){return X(t)?Ib(e):hb(e,t)}function bb(e){return O(lr(e))}function Al(e){return e.map(t=>Oo(t))}function Oo(e){return S(e)?de(Al(e.allOf)):x(e)?k(Al(e.anyOf)):A(e)?bb(e.const):e}function vb(e,t){return e.reduceRight((r,n,a)=>{let s=me({},O(a),t);return b.IsExtendsTrueLike(s)?[n,...r]:r},[])}function $b(e,t){let r=Oo(t),n=vb(e,r);return tt(n)}function Tb(e){return tt(e)}function Ll(e,t){return A(t)&&i.IsEqual(t.const,"length")?O(e.length):X(t)||ge(t)?Tb(e):$b(e,t)}function ql(e,t){return K(e)?$l(e.items,t):M(e)?Ml(e.properties,t):j(e)?Ll(e.items,t):q()}function kb(e){return se(e)||V(e)||S(e)||x(e)?cr(e):e}function So(e,t,r){return T([e,t])?p.Update(ql(kb(e),t),{},r):Dr(e,t,r)}function jl(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return So(s,m,a)}function Hn(e,t={}){return I("InstanceType",[e],t)}function Fl(e,t={}){return Po(e,t)}function wb(e){return re(e)?e.instanceType:q()}function Po(e,t){return T([e])?p.Update(wb(e),{},t):Hn(e,t)}function Dl(e,t,r,n={}){let a=d(e,t,r);return Po(a,n)}function Nr(e,t={}){return I("KeyOf",[e],t)}function Nl(e,t={}){return Co(e,t)}function Gl(){return k([be(),Se(),Xt()])}function Ul(e){return be()}function Eb(e){return e.reduce((r,n)=>En(n)?[...r,O(lr(n))]:Y(),[])}function Kl(e){let t=i.Keys(e),r=Eb(t);return tt(r)}function _l(e){return er(e)}function zl(e){let t=e.map((r,n)=>O(n));return tt(t)}function Bl(e){return J(e)?Gl():K(e)?Ul(e.items):M(e)?Kl(e.properties):pe(e)?_l(e):j(e)?zl(e.items):q()}function Rb(e){return se(e)||V(e)||S(e)||x(e)?cr(e):e}function Co(e,t){return T([e])?p.Update(Bl(Rb(e)),{},t):Nr(e,t)}function Vl(e,t,r,n){let a=d(e,t,r);return Co(a,n)}function qr(e,t,r,n,a={}){return I("Mapped",[e,t,r,n],a)}function Wl(e,t,r,n,a={}){return Mo({},G([],[]),e,t,r,n,a)}function Sb(e){let t=Ie(e);return ya(t)}function Ob(e){return e.reduce((t,r)=>[...t,...ya(r)],[])}function Pb(e){let t=ke(e);return ya(t)}function Cb(e){return i.IsNumber(e)?[O(`${e}`)]:[O(e)]}function ya(e){return fe(e)?Pb(e.enum):A(e)?Cb(e.const):Z(e)?Sb(e.pattern):x(e)?Ob(e.anyOf):[e]}function Hl(e){return ya(e)}function Mb(e){return Z(e)?Ie(e.pattern):e}function Ab(e,t,r,n,a,s){let m=p.Assign(e,{[r.name]:n}),c=d(m,t,a),l=Mb(c),g=d(m,t,s);return rs(l)||ns(l)?{[l.const]:g}:{}}function Lb(e,t,r,n,a,s){return n.reduce((m,c)=>[...m,Ab(e,t,r,c,a,s)],[])}function qb(e){return e.reduce((t,r)=>[...t,v(r)],[])}function Yl(e,t,r,n,a,s){let m=Hl(n),c=Lb(e,t,r,m,a,s),l=qb(c);return _(l)}function Mo(e,t,r,n,a,s,m){return T([n])?p.Update(Yl(e,t,r,n,a,s),{},m):qr(r,n,a,s,m)}function Jl(e,t,r,n,a,s,m){let c=d(e,t,n);return Mo(e,t,r,c,a,s,m)}function jb(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>r.includes(s)).reduce((s,m)=>({...s,[m]:Cc(n,m,t[m])}),{})}function Fb(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>!r.includes(s)).reduce((s,m)=>({...s,[m]:d(n,G([],[]),t[m])}),{})}function Db(e,t,r){let n=Rc(t),a=jb(e,t,n),s=Fb(e,t,n),m={...a,...s};return p.Update(m,{},r)}function xa(e,t,r,n){return Db(e,r,n)}function Yn(e,t={}){return I("NonNullable",[e],t)}function Xl(e,t={}){return Ao(e,t)}function Nb(e){let t=k([Yt(),tr()]);return Jr(e,t,{})}function Ao(e,t){return T([e])?p.Update(Nb(e),{},t):Yn(e,t)}function Zl(e,t,r,n){let a=d(e,t,r);return Ao(a,n)}function Jn(e,t,r={}){return I("Omit",[e,t],r)}function Ql(e,t,r={}){let n=i.IsArray(t)?ur(t):t;return Lo(e,n,r)}function Ia(e){let t=cr(e);return M(t)?t.properties:Y()}function Gb(e,t){return i.Keys(e).reduce((n,a)=>t.includes(a)?n:{...n,[a]:e[a]},{})}function ed(e,t){let r=Ia(e),n=dr(t),a=Gb(r,n);return v(a)}function Lo(e,t,r){return T([e,t])?p.Update(ed(e,t),{},r):Jn(e,t,r)}function td(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Lo(s,m,a)}function Xn(e,t={}){return I("Parameters",[e],t)}function rd(e,t={}){return qo(e,t)}function Ub(e){let t=ne(e)?e.parameters:[],r=bt({},G([],[]),t);return Q(r)}function qo(e,t){return T([e])?p.Update(Ub(e),{},t):Xn(e,t)}function nd(e,t,r,n){let a=d(e,t,r);return qo(a,n)}function Zn(e,t={}){return I("Partial",[e],t)}function ad(e,t={}){return jo(e,t)}function od(e,t){let r=Ve(e,t),n=We(r);return Ue(p.Assign(e,{[t]:n}),t)}function id(e,t,r){let n=qe(e,t,r);return We(n)}function sd(e){let t=_(e);return We(t)}function md(e){let t=e.map(r=>We(r));return k(t)}function pd(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:Pt(e[a])}),{});return v(t)}function We(e){return se(e)?od(e.$defs,e.$ref):V(e)?id(e.if,e.then,e.else):S(e)?sd(e.allOf):x(e)?md(e.anyOf):M(e)?pd(e.properties):v({})}function jo(e,t){return T([e])?p.Update(We(e),{},t):Zn(e,t)}function ud(e,t,r,n){let a=d(e,t,r);return jo(a,n)}function Qn(e,t,r={}){return I("Pick",[e,t],r)}function cd(e,t,r={}){let n=i.IsArray(t)?ur(t):t;return Fo(e,n,r)}function Kb(e,t){return i.Keys(e).reduce((n,a)=>t.includes(a)?p.Assign(n,{[a]:e[a]}):n,{})}function ld(e,t){let r=Ia(e),n=dr(t),a=Kb(r,n);return v(a)}function Fo(e,t,r){return T([e,t])?p.Update(ld(e,t),{},r):Qn(e,t,r)}function dd(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Fo(s,m,a)}function ea(e,t={}){return I("ReadonlyObject",[e],t)}function Do(e,t={}){return No(e,t)}var fd=Do;function gd(e){return Ht(Te(e))}function hd(e,t){let r=Ve(e,t),n=He(r);return Ue(p.Assign(e,{[t]:n}),t)}function yd(e,t,r){let n=qe(e,t,r);return He(n)}function xd(e){let t=_(e);return He(t)}function Id(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:At(e[a])}),{});return v(t)}function bd(e){return Ht(Q(e))}function vd(e){let t=e.map(r=>He(r));return k(t)}function He(e){return K(e)?gd(e.items):se(e)?hd(e.$defs,e.$ref):V(e)?yd(e.if,e.then,e.else):S(e)?xd(e.allOf):M(e)?Id(e.properties):j(e)?bd(e.items):x(e)?vd(e.anyOf):e}function No(e,t){return T([e])?p.Update(He(e),{},t):ea(e)}function $d(e,t,r,n){let a=d(e,t,r);return No(a,n)}function Td(e,t,r,n){return t.visited.includes(n)?r:n in e?d(e,G(t.callstack,[...t.visited,n]),e[n]):r}function kd(e,t){let r=Ve(e,t),n=Ye(r);return Ue(p.Assign(e,{[t]:n}),t)}function wd(e,t,r){let n=qe(e,t,r);return Ye(n)}function Ed(e){let t=_(e);return Ye(t)}function Rd(e){let t=e.map(r=>Ye(r));return k(t)}function Sd(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:Cn(e[a])}),{});return v(t)}function Ye(e){return se(e)?kd(e.$defs,e.$ref):V(e)?wd(e.if,e.then,e.else):S(e)?Ed(e.allOf):x(e)?Rd(e.anyOf):M(e)?Sd(e.properties):v({})}function ta(e,t={}){return I("Required",[e],t)}function Od(e,t={}){return Go(e,t)}function Go(e,t){return T([e])?p.Update(Ye(e),{},t):ta(e,t)}function Pd(e,t,r,n){let a=d(e,t,r);return Go(a,n)}function ra(e,t={}){return I("ReturnType",[e],t)}function Cd(e,t={}){return Uo(e,t)}function _b(e){return ne(e)?e.returnType:q()}function Uo(e,t){return T([e])?p.Update(_b(e),{},t):ra(e,t)}function Md(e,t,r,n={}){let a=d(e,t,r);return Uo(a,n)}function na(e,t){return I("With",[e,t],{})}function Ad(e,t){return Ko(e,t)}function Ko(e,t){return T([e])?p.Update(e,{},t):na(e,t)}function Ld(e,t,r,n){let a=d(e,t,r);return Ko(a,n)}function zb(e){return ht(e)?j(e.items)?_o(e.items.items):H(e.items)?[e]:ae(e.items)?[e]:[q()]:[e]}function _o(e){return e.reduce((r,n)=>[...r,...zb(n)],[])}function G(e,t){return{callstack:e,visited:t}}function T(e){return i.ShiftLeft(e,(t,r)=>ae(t)?!1:T(r),()=>!0)}function Br(e,t,r){return i.Keys(r).reduce((n,a)=>({...n,[a]:d(e,t,r[a])}),{})}function bt(e,t,r){let n=we(e,t,r);return _o(n)}function we(e,t,r){return r.map(n=>d(e,t,n))}function Bb(e,t){let r=le(e)?Tr(t,{}):t,n=Lt(e)?$r(r,{}):r;return Mt(e)?Qr(n,{}):n}function Vb(e,t,r,n,a){return i.IsEqual(r,"AddImmutable")?qd(e,t,n[0],a):i.IsEqual(r,"RemoveImmutable")?Bc(e,t,n[0],a):i.IsEqual(r,"AddReadonly")?Ci(e,t,n[0],a):i.IsEqual(r,"RemoveReadonly")?ys(e,t,n[0],a):i.IsEqual(r,"AddOptional")?Mi(e,t,n[0],a):i.IsEqual(r,"RemoveOptional")?bs(e,t,n[0],a):i.IsEqual(r,"Capitalize")?el(e,t,n[0],a):i.IsEqual(r,"Conditional")?ol(e,t,n[0],n[1],n[2],n[3],a):i.IsEqual(r,"ConstructorParameters")?sl(e,t,n[0],a):i.IsEqual(r,"Evaluate")?Lc(e,t,n[0],a):i.IsEqual(r,"Exclude")?pl(e,t,n[0],n[1],a):i.IsEqual(r,"Extract")?ll(e,t,n[0],n[1],a):i.IsEqual(r,"Index")?jl(e,t,n[0],n[1],a):i.IsEqual(r,"InstanceType")?Dl(e,t,n[0],a):i.IsEqual(r,"Interface")?Tc(e,t,n[0],n[1],a):i.IsEqual(r,"KeyOf")?Vl(e,t,n[0],a):i.IsEqual(r,"Lowercase")?tl(e,t,n[0],a):i.IsEqual(r,"Mapped")?Jl(e,t,n[0],n[1],n[2],n[3],a):i.IsEqual(r,"Module")?xa(e,t,n[0],a):i.IsEqual(r,"NonNullable")?Zl(e,t,n[0],a):i.IsEqual(r,"Pick")?dd(e,t,n[0],n[1],a):i.IsEqual(r,"Parameters")?nd(e,t,n[0],a):i.IsEqual(r,"Partial")?ud(e,t,n[0],a):i.IsEqual(r,"Omit")?td(e,t,n[0],n[1],a):i.IsEqual(r,"ReadonlyObject")?$d(e,t,n[0],a):i.IsEqual(r,"Record")?Fs(e,t,n[0],n[1],a):i.IsEqual(r,"Required")?Pd(e,t,n[0],a):i.IsEqual(r,"ReturnType")?Md(e,t,n[0],a):i.IsEqual(r,"TemplateLiteral")?Uu(e,t,n[0],a):i.IsEqual(r,"Uncapitalize")?rl(e,t,n[0],a):i.IsEqual(r,"Uppercase")?nl(e,t,n[0],a):i.IsEqual(r,"With")?Ld(e,t,n[0],n[1]):I(r,n,a)}function Wb(e,t,r){let n=ae(r)?Td(e,t,r,r.$ref):K(r)?Te(d(e,t,r.items),xn(r)):pr(r)?ha(e,t,r.target,r.arguments):re(r)?De(we(e,t,r.parameters),d(e,t,r.instanceType),Ai(r)):ne(r)?Ne(we(e,t,r.parameters),d(e,t,r.returnType),Li(r)):V(r)?Ct(d(e,t,r.if),d(e,t,r.then),d(e,t,r.else),Gi(r)):S(r)?de(we(e,t,r.allOf),Bi(r)):M(r)?v(Br(e,t,r.properties),Di(r)):pe(r)?Ds(Pe(r),d(e,t,ye(r))):ht(r)?Ft(d(e,t,r.items)):j(r)?Q(bt(e,t,r.items),hs(r)):x(r)?k(we(e,t,r.anyOf),os(r)):r;return Bb(r,n)}function d(e,t,r){return ut(r)?Vb(e,t,r.action,r.parameters,r.options):Wb(e,t,r)}function zo(e,t){return d(e,G([],[]),t)}function Hb(e){return p.Update(e,{"~immutable":!0},{})}function Qr(e,t){return p.Update(Hb(e),{},t)}function qd(e,t,r,n){let a=d(e,t,r);return Qr(a,n)}function Np(e,t={}){return I("AddImmutable",[e],t)}function Ht(e,t={}){return Qr(e,t)}function Gp(e,t={}){return I("Evaluate",[e],t)}function jd(e,t={}){return Io(e,t)}function Up(e,t={}){return I("Module",[e],t)}function Fd(e,t={}){return xa({},G([],[]),e,t)}function Dd(...e){let[t,r,n]=Ke.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=ju(r),s=i.IsArray(a)&&i.IsEqual(a.length,2)?d(t,G([],[]),a[0]):q();return p.Update(s,{},n)}var N={};Et(N,{Any:()=>Wt,Array:()=>Te,BigInt:()=>Rr,Boolean:()=>kn,Call:()=>_c,Capitalize:()=>Jc,Codec:()=>Tn,Conditional:()=>al,Constructor:()=>De,ConstructorParameters:()=>il,Cyclic:()=>Ue,Decode:()=>Yi,DecodeBuilder:()=>Er,Dependent:()=>Ct,Encode:()=>Ji,EncodeBuilder:()=>wr,Enum:()=>zi,Evaluate:()=>jd,Exclude:()=>ml,Extends:()=>me,ExtendsResult:()=>b,Extract:()=>ul,Function:()=>Ne,Generic:()=>ct,Identifier:()=>Sr,Immutable:()=>Xi,Index:()=>dl,Infer:()=>kr,InstanceType:()=>Fl,Instantiate:()=>zo,Integer:()=>qt,Interface:()=>kc,Intersect:()=>de,IsAny:()=>J,IsArray:()=>K,IsBigInt:()=>ze,IsBoolean:()=>Re,IsCall:()=>pr,IsCodec:()=>$n,IsConstructor:()=>re,IsCyclic:()=>se,IsDependent:()=>V,IsEnum:()=>fe,IsEnumValue:()=>_i,IsFunction:()=>ne,IsGeneric:()=>Vt,IsIdentifier:()=>ts,IsImmutable:()=>Mt,IsInfer:()=>H,IsInteger:()=>ge,IsIntersect:()=>S,IsKind:()=>y,IsLiteral:()=>A,IsNever:()=>lt,IsNull:()=>Jt,IsNumber:()=>X,IsObject:()=>M,IsOptional:()=>le,IsParameter:()=>as,IsReadonly:()=>Lt,IsRecord:()=>pe,IsRef:()=>ae,IsRefine:()=>_a,IsRest:()=>ht,IsSchema:()=>ee,IsString:()=>he,IsSymbol:()=>dt,IsTemplateLiteral:()=>Z,IsThis:()=>Fn,IsTuple:()=>j,IsUndefined:()=>rr,IsUnion:()=>x,IsUnknown:()=>te,IsUnsafe:()=>vn,IsVoid:()=>Be,KeyOf:()=>Nl,Literal:()=>O,Lowercase:()=>Xc,Mapped:()=>Wl,Module:()=>Fd,Never:()=>q,NonNullable:()=>Xl,Null:()=>Yt,Number:()=>be,Object:()=>v,Omit:()=>Ql,Optional:()=>ji,Parameter:()=>jt,Parameters:()=>rd,Partial:()=>ad,Pick:()=>cd,Readonly:()=>Zi,ReadonlyObject:()=>Do,ReadonlyType:()=>fd,Record:()=>Ln,RecordKey:()=>er,RecordPattern:()=>Pe,RecordValue:()=>ye,Ref:()=>et,Refine:()=>Qi,Required:()=>Od,Rest:()=>Ft,ReturnType:()=>Cd,Script:()=>Dd,String:()=>Se,Symbol:()=>Xt,TemplateLiteral:()=>_u,This:()=>jn,Tuple:()=>Q,Uncapitalize:()=>Zc,Undefined:()=>tr,Union:()=>k,Unknown:()=>oe,Unsafe:()=>Ni,Uppercase:()=>Qc,Void:()=>Dn,With:()=>Ad});var fr="submit_test_gap_candidates",en="submit_filtered_test_gaps",tn="submit_solver_gaps",h4=N.Object({verdict:N.Union([N.Literal("PASS"),N.Literal("FAIL")],{description:"FAIL only for a genuine blocking issue (clear rubric violation, agent-fault-worthy gap, unfair/undiscoverable test requirement, or a real determinism/regression risk). Optional, minor, or stylistic points are NOT grounds for FAIL \u2014 put those in `notes` instead and use PASS."}),summary:N.String({description:"One short sentence summarizing the verdict."}),reasons:N.Array(N.String(),{description:"Specific BLOCKING justifications only, citing rubric item IDs and concrete evidence from the files you read. Required (non-empty) when verdict is FAIL. Use an empty array when verdict is PASS."}),notes:N.Array(N.String(),{description:"Non-blocking, optional/minor observations or suggested improvements \u2014 the kind of feedback a real reviewer leaves as 'Minor/optional' without failing the task. Include these regardless of verdict; use an empty array if you truly have none."})});var Yb=N.Object({gaps:N.Array(N.Object({description:N.String({description:"The specific untested behavior or edge case, in plain terms. Prefix with POSITIVE: or NEGATIVE: to indicate whether this is a missing required-behavior test or a missing forbidden/wrong-behavior test."}),risk:N.String({description:"Concretely why a plausible-but-incorrect implementation could still pass every test in test.patch despite missing, misimplementing, or violating this behavior (including doing a forbidden thing because no test asserts it must not happen)."})}),{description:"Candidate behavioral test gaps (positive and negative) grounded in agent_prompt.md or clear existing repo behavior. Use an empty array if you found none \u2014 do not manufacture gaps just to report something."})});function Nd(e){return{name:fr,label:"Submit Candidate Test Gaps",description:"Submit your candidate list of behavioral test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished reading and analyzing the relevant files.",parameters:Yb,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Recorded ${n.length} candidate gap(s)`}],details:void 0}}}}var Jb=N.Object({gaps:N.Array(N.Object({description:N.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:N.String({description:"Why this is genuinely grounded in agent_prompt.md or the repo, fair to test per the fairness methodology, and a real (non-duplicate) coverage hole in test.patch \u2014 for negative gaps, cite the prompt's prohibition/constraint and why no existing test catches the forbidden outcome."})}),{description:"The filtered, final list of confirmed test gaps. Use an empty array if none of the candidates survive strict scrutiny."})});function Gd(e){return{name:en,label:"Submit Filtered Test Gaps",description:"Submit your final, strictly filtered list of confirmed test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have independently verified each candidate.",parameters:Jb,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Confirmed ${n.length} gap(s) after filtering`}],details:void 0}}}}var Xb=N.Object({gaps:N.Array(N.Object({description:N.String({description:"The specific behavioral gap: a way one or more solver's diff differs materially from what agent_prompt.md/solution.patch require, despite that solver passing `./test.sh new`."}),justification:N.String({description:"Why this is a genuine requirement from agent_prompt.md or solution.patch (cite the specific requirement/line) that the solver's diff misses, contradicts, or diverges from \u2014 and why the current tests fail to catch that divergence."}),evidence:N.String({description:"Which solver(s) (by index) exhibit this, and the specific part of their diff that grounds the gap."})}),{description:"Concrete, diff-grounded behavioral gaps \u2014 cases where a passing solver's materially different approach reveals that `test.sh new` under-specifies a real requirement. Use an empty array if the solvers converged on equivalent behavior; do not manufacture gaps just to report something."})});function Ud(e){return{name:tn,label:"Submit Solver Gaps",description:"Submit your final list of behavioral gaps found by comparing the solver diffs against the real solution.patch. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished comparing every solver.",parameters:Xb,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Recorded ${n.length} solver gap(s)`}],details:void 0}}}}function Kd(e){return[e,"You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the task description given to a coding agent), `test.patch` (a unified diff adding the hidden tests that will grade that agent's solution), and `solution.patch` (a unified diff of one golden/reference solution).","Another specialized agent is searching the complementary direction in parallel \u2014 stay in your lane and do not duplicate its work."]}var _d=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- Find every gap you can justify with concrete evidence. Do not stop after the first obvious ones \u2014 keep reading until you have systematically covered the prompt, `solution.patch`, and relevant repo context.","- After your first pass, run at least one deliberate second sweep (re-read `agent_prompt.md`, re-scan `solution.patch`, grep the repo) before submitting \u2014 but if that sweep still finds nothing, submit an empty list.","- Do not self-censor or merge distinct genuine gaps into one \u2014 the validator will prune. Never invent or pad the list to seem thorough; an empty array is correct when exhaustive analysis truly finds none.","- Hunt subtle gaps too: partial coverage (asserted once but not under other valid inputs), behaviors implied by repo convention, interaction effects, ordering/timing, and branches visible in `solution.patch` that no test forces.","- Include a candidate only when you can cite specific grounding and a concrete false-pass risk \u2014 not to meet a quota."],Bo=["Ground rules \u2014 do not overreach:","- Every gap must trace back to a specific requirement or sentence in `agent_prompt.md`, or to behavior that is unambiguous from the existing, visible repo. Do not invent requirements the prompt doesn't support.","- Do not propose gaps for things `agent_prompt.md` leaves intentionally open, or for implementation details/style the prompt doesn't mandate.","- Read `test.patch` carefully before deciding something is untested \u2014 do not propose a gap that an existing test already covers (even indirectly).","- Keep findings strictly behavioral and publicly observable: a user, caller, or documented public contract must be able to observe the required outcome. Do not report internal helper calls, private state, implementation structure, call order, file placement, or other incidental mechanics.","- Do not require DOM classes, DOM/data/test attributes, selectors, or exact string literals unless the prompt explicitly names them or they are an established, already-present public contract in the repository. Prefer a visible outcome or public API behavior that accepts equivalent implementations."];function zd(e,t){let r=[...Kd("You are an exhaustive, research-minded POSITIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine POSITIVE behavioral test gap \u2014 required behavior that `test.patch` never asserts but `agent_prompt.md` requires. Do NOT search for forbidden/wrong-behavior gaps; a separate negative-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real POSITIVE TEST GAPS. A positive gap is required or clearly-implied behavior from `agent_prompt.md` (and, where relevant, obvious existing repo conventions) that `test.patch` does NOT actually verify \u2014 such that a plausible implementation could skip or misimplement that required behavior and STILL pass every test in `test.patch` as written.","","Focus on required outcomes: happy paths, side effects, state changes, outputs, transitions, edge inputs where the prompt still expects correct handling, combined/interacting behaviors, and branches in `solution.patch` whose correct outcome is never forced by a test.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Go through `agent_prompt.md` sentence by sentence. For every distinct required behavior, constraint, or implied rule, check which test(s) in `test.patch` exercise it and how thoroughly.","2. Go through `solution.patch` branch by branch \u2014 every conditional, loop, early return, error path, and state transition. For each one, ask whether `test.patch` forces the correct outcome to be checked.","3. Consider standard positive edge-case categories: boundary/limit values, empty/missing/null/zero inputs that should still produce the required correct behavior, duplicate or repeated inputs handled correctly, ordering and interleaving, concurrent or repeated invocations, error/failure/rollback paths that should recover correctly, interaction between two or more required behaviors at once, and state left behind after an operation.","4. Cross-check overlapping/interacting requirements \u2014 behaviors each tested alone but never tested together.","5. Second-pass sweep: return to any requirement you marked 'covered' and ask whether coverage is shallow \u2014 one happy-path assertion is not enough if other valid inputs, sequences, or combinations could still slip through.",..._d,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on POSITIVE gaps only.","",...Bo,"","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),r.push("","For each gap, prefix the description with `POSITIVE:` and explain: (1) the specific untested required behavior/edge case, and (2) concretely why a plausible-but-incomplete implementation would still pass every given test despite missing or misimplementing it.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${fr}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),r.join(`
12
- `)}function Bd(e,t){let r=[...Kd("You are an exhaustive, research-minded NEGATIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine NEGATIVE behavioral test gap \u2014 forbidden behavior, invalid states, or wrong outcomes that `test.patch` never asserts against but `agent_prompt.md` prohibits or implies must not happen. Do NOT search for missing required-behavior gaps; a separate positive-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real NEGATIVE TEST GAPS. A negative gap is a prohibition, guard, or 'must not' constraint from `agent_prompt.md` (or unambiguous repo convention) that `test.patch` does NOT verify \u2014 such that an agent could violate `agent_prompt.md` by doing the forbidden thing, leaving the wrong state enabled, applying an effect to the wrong target, skipping a guard, or accepting invalid input, and STILL pass every test because the suite only checks that correct actions work, not that incorrect ones are rejected.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Re-read `agent_prompt.md` specifically for prohibitions, conditions, guards, and 'only when' / 'must not' / 'never' / 'disabled when' / 'should not' language. For each, ask: does `test.patch` assert the WRONG thing does NOT happen?","2. Go through `solution.patch` for every guard, early return, disabled branch, isolation check, and rejection path. Ask whether a sloppy implementation that bypassed that guard would still pass.","3. Hunt these negative patterns explicitly:"," - Controls that must be disabled/unavailable in a given state, but no test drives that state and asserts disabled."," - Operations that must NOT affect a separate scope/target (isolation), but tests never prove the wrong scope is untouched."," - Side effects that must NOT occur (duplicate entries, spurious history steps, refresh on no-op)."," - Invalid, out-of-order, or repeated input that should be ignored/rejected/coalesced differently."," - Undo/redo or rollback boundaries where the first action must NOT be undoable, or redo must NOT be available."," - Mutual exclusion: doing A must NOT silently change B, but no test proves independence.","4. For every prompt prohibition, ask: 'Is there a test that would catch an agent doing the forbidden thing or applying the requirement in the wrong context?' If not, it is a gap.","5. Adversarial pass: imagine a lazy or slightly-wrong implementation that satisfies the obvious tests \u2014 list every way it could still violate the prompt (wrong scope, wrong timing, wrong guard, spurious side effect, missing rejection) and check whether `test.patch` would catch each one.",..._d,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on NEGATIVE gaps only.","",...Bo,"- Negative gaps must be grounded in an explicit or clearly implied prohibition/constraint in `agent_prompt.md` \u2014 not generic 'more negative tests would be nice'.","- A single test that asserts both the positive outcome AND that the forbidden/wrong outcome did not occur counts as covered.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),r.push("","For each gap, prefix the description with `NEGATIVE:` and explain: (1) the specific untested forbidden/wrong behavior or invalid state, and (2) concretely why a plausible-but-wrong implementation would still pass every given test despite violating this constraint.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${fr}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),r.join(`
13
- `)}function Vd(e,t,r){let n=["You are a strict, skeptical fairness auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","Two specialized research agents reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) in parallel \u2014 one hunting POSITIVE gaps (missing required-behavior tests), one hunting NEGATIVE gaps (missing forbidden/wrong-behavior tests). They proposed the following combined CANDIDATE list:","",JSON.stringify(e,null,2),"","Your job is to independently re-verify the files yourself and FILTER this list down to only candidates that are ALL of the following:","1. Genuinely grounded \u2014 actually required by a specific statement in `agent_prompt.md`, or unambiguous from clearly visible, existing repo behavior. Drop anything speculative, nice-to-have, or invented beyond what the prompt actually asks for.","2. Fair to test \u2014 verifying it would not require undiscoverable private internals, an invented/unnamed API, or exact incidental structure that only `solution.patch` happens to use. Judge this precisely against the fairness methodology below.","3. A real, distinct coverage hole \u2014 re-check `test.patch` yourself; drop any candidate an existing test already covers, and drop near-duplicate candidates (keep only the clearest phrasing of each distinct gap). For negative-case candidates, keep them only if `test.patch` does not already assert that the forbidden/wrong outcome does not occur.","4. Behaviorally testable through a public contract \u2014 drop candidates that would require an internal helper, private state, implementation structure, call order, DOM class/attribute/data hook, selector, or exact string literal. The sole exceptions are details explicitly named in `agent_prompt.md` or already established as a public contract in the existing repository.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return r&&n.push("","Fairness methodology:",r),n.push("","For every gap you keep, give a short justification citing where in `agent_prompt.md` or the repo it is grounded. Preserve POSITIVE:/NEGATIVE: prefix when applicable.",`When you are done, call the \`${en}\` tool exactly once with your final filtered list (which may be empty). That tool call is your only way to report a result.`),n.join(`
3
+ `:"";rt(w,`${D}${pt}node_modules
4
+ `,"utf-8")}let _=ce(n,"node_modules"),ue=ce(r,"node_modules");if(Fa(_)&&!Fa(ue))try{Cf(_,ue,process.platform==="win32"?"junction":"dir")}catch{}try{Of(s,ce(r,"agent_prompt.md"))}catch{}let Me=cr(a,"utf-8"),Re=qf(Me),De=ce(r,"test.patch");rt(De,Me,"utf-8");let Qe=await t.exec("git",["apply","test.patch"],c);try{Mf(De)}catch{}if(Qe.code!==0)return{status:"patchFailed",solverDir:r,error:Qe.stderr?.trim()||"git apply test.patch failed"};let N=await t.exec("git",["add","-A"],c);if(N.code!==0)return{status:"error",solverDir:r,error:N.stderr?.trim()||"git add (tests applied) failed"};let et=await t.exec("git",["commit","-m","tests applied","--allow-empty"],c);if(et.code!==0)return{status:"error",solverDir:r,error:et.stderr?.trim()||"git commit (tests applied) failed"};let Ne=await t.exec("git",["rev-parse","HEAD"],c);return Ne.code!==0||!Ne.stdout.trim()?{status:"error",solverDir:r,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:r,testsAppliedCommit:Ne.stdout.trim(),testPatchPaths:Re}}function Ff(e){try{let t=cr(e,"utf-8").match(/<testsuites\b[^>]*>/i)?.[0];if(!t)return{totalTests:null,failedTests:null};let n=m=>Number.parseInt(t.match(new RegExp(`\\b${m}="(\\d+)"`,"i"))?.[1]??"",10),r=n("tests"),a=n("failures"),s=n("errors");return{totalTests:Number.isFinite(r)?r:null,failedTests:Number.isFinite(a)?a+(Number.isFinite(s)?s:0):null}}catch{return{totalTests:null,failedTests:null}}}async function hi(e){let{pi:t,index:n,workspace:r,status:a,durationMs:s}=e,{solverDir:m,testsAppliedCommit:c,testPatchPaths:l}=r,h={cwd:m,timeout:Na};await t.exec("git",["add","-A"],h);let f=[...l,"agent_prompt.md"].map(Ne=>`:(exclude)${Ne}`),w=await t.exec("git",["diff","--cached",c,"--",".",...f],h),D=w.code===0?w.stdout:"",_=ce(m,"test_output.xml"),ue=`bash test.sh --output_path ${pr(mr(_))} new`,Me=sr(),Re=await t.exec(Me,["-c",`cd ${pr(mr(m))} && ${ue}`],{timeout:Na*10}),De=Re.code===0,Qe=jf(`${Re.stdout}
5
+ ${Re.stderr}`.trim(),Af),{totalTests:N,failedTests:et}=Ff(_);return{index:n,status:a,passed:De,diff:D,testOutputTail:Qe,durationMs:s,totalTests:N,failedTests:et,testOutputXmlPath:_}}function gi(e){let{repoDir:t,runId:n,index:r,trajectory:a,solutionPatch:s,testOutputXmlPath:m,testOutputTail:c}=e,l=ce(t,Lf,n,`solver_${r}`);Da(l,{recursive:!0}),rt(ce(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),rt(ce(l,"solution.patch"),s,"utf-8");try{let h=cr(m,"utf-8");rt(ce(l,"test_output.xml"),h,"utf-8")}catch{rt(ce(l,"test_output.txt"),c,"utf-8")}return l}function yi(e,t){let n=ce(e,gn);Da(n,{recursive:!0});let r=t.map(a=>{let s=ce(n,`solver_${a.index}`);return Da(s,{recursive:!0}),rt(ce(s,"solution.diff"),a.diff,"utf-8"),rt(ce(s,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return rt(ce(n,"manifest.json"),JSON.stringify(r,null,2),"utf-8"),n}function xi(e){let t=ce(e,"node_modules");try{Pf(t).isSymbolicLink()&&di(t,{force:!0})}catch{}try{di(e,{recursive:!0,force:!0})}catch{}}var p={};Rt(p,{Assign:()=>Df,Clone:()=>bn,Create:()=>zh,Discard:()=>Bh,Metrics:()=>qe,Update:()=>Vh});var qe={assign:0,create:0,clone:0,discard:0,update:0};function Df(e,t){return qe.assign+=1,{...e,...t}}var i={};Rt(i,{Entries:()=>oh,EntriesRegExp:()=>ah,Every:()=>th,EveryAll:()=>nh,GraphemeCount:()=>Zf,HasPropertyKey:()=>rh,IsArray:()=>xn,IsBigInt:()=>yn,IsBoolean:()=>Ri,IsClassInstance:()=>Jf,IsConstructor:()=>zf,IsDeepEqual:()=>_a,IsEqual:()=>C,IsFunction:()=>Si,IsGreaterEqualThan:()=>Pi,IsGreaterThan:()=>Wf,IsInteger:()=>Ua,IsLessEqualThan:()=>Oi,IsLessThan:()=>Hf,IsMaxLength:()=>Qf,IsMinLength:()=>eh,IsMultipleOf:()=>Yf,IsNull:()=>fr,IsNumber:()=>hr,IsObject:()=>In,IsObjectNotArray:()=>Bf,IsString:()=>gr,IsSymbol:()=>Vf,IsUndefined:()=>Ka,IsUnsafePropertyKey:()=>Ci,IsValueLike:()=>Xf,Keys:()=>dr,ShiftLeft:()=>yr,Symbols:()=>ih,Values:()=>sh});function St(e,t,n){return e>=t&&e<=n}function Nf(e){return e===8205}function Gf(e){return St(e,55296,56319)}function Ii(e){return St(e,127462,127487)}function vi(e){return St(e,65024,65039)}function $i(e){return St(e,768,879)||St(e,6832,6911)||St(e,7616,7679)||St(e,65056,65071)}function lr(e){return e>65535?2:1}function bi(e,t){for(;t<e.length;){let n=e.codePointAt(t);if($i(n)||vi(n))t+=lr(n);else break}return t}function Ga(e,t){let n=e.codePointAt(t),r=t+lr(n);for(r=bi(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+lr(a),r=bi(e,r)}return Ii(n)&&r<e.length&&Ii(e.codePointAt(r))&&(r+=lr(e.codePointAt(r))),r}function Ti(e){return Gf(e)||$i(e)||vi(e)||Nf(e)}function ki(e){let t=0,n=0;for(;n<e.length;)n=Ga(e,n),t++;return t}function Uf(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=Ga(e,r),n++,n>=t)return!0;return!1}function Kf(e,t){let n=0,r=0;for(;r<e.length;)if(r=Ga(e,r),n++,n>t)return!1;return!0}function wi(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Ti(e.charCodeAt(n)))return Uf(e,t);if(n++,n>=t)return!0}return!1}function Ei(e,t){let n=0;for(;n<e.length;){if(Ti(e.charCodeAt(n)))return Kf(e,t);if(n++,n>t)return!1}return!0}function xn(e){return Array.isArray(e)}function yn(e){return C(typeof e,"bigint")}function Ri(e){return C(typeof e,"boolean")}function zf(e){if(Ka(e)||!Si(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Si(e){return C(typeof e,"function")}function Ua(e){return Number.isInteger(e)}function fr(e){return C(e,null)}function hr(e){return Number.isFinite(e)}function Bf(e){return In(e)&&!xn(e)}function In(e){return C(typeof e,"object")&&!fr(e)}function gr(e){return C(typeof e,"string")}function Vf(e){return C(typeof e,"symbol")}function Ka(e){return C(e,void 0)}function C(e,t){return e===t}function Wf(e,t){return e>t}function Hf(e,t){return e<t}function Oi(e,t){return e<=t}function Pi(e,t){return e>=t}function Yf(e,t){if(yn(e)||yn(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!hr(e)||Ua(e)&&1/t%1===0)return!0;let r=e%t;return Math.min(Math.abs(r),Math.abs(r-t),Math.abs(r+t))<n}function Jf(e){if(!In(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return fr(t)?!1:C(typeof t.constructor,"function")&&!(C(t.constructor,globalThis.Object)||C(t.constructor.name,"Object"))}function Xf(e){return yn(e)||Ri(e)||fr(e)||hr(e)||gr(e)||Ka(e)}function Zf(e){return ki(e)}function Qf(e,t){return Ei(e,t)}function eh(e,t){return wi(e,t)}function th(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function nh(e,t,n){let r=!0;for(let a=t;a<e.length;a++)n(e[a],a)||(r=!1);return r}function yr(e,t,n){return C(e.length,0)?n():t(e[0],e.slice(1))}function Ci(e){return C(e,"__proto__")||C(e,"constructor")||C(e,"prototype")}function rh(e,t){return Ci(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ah(e){return dr(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function oh(e){return Object.entries(e)}function dr(e){return Object.getOwnPropertyNames(e)}function ih(e){return Object.getOwnPropertySymbols(e)}function sh(e){return Object.values(e)}function mh(e,t){if(!In(t))return!1;let n=dr(e);return C(n.length,dr(t).length)&&n.every(r=>_a(e[r],t[r]))}function ph(e,t){return xn(t)&&C(e.length,t.length)&&e.every((n,r)=>_a(e[r],t[r]))}function _a(e,t){return xn(e)?ph(e,t):In(e)?mh(e,t):C(e,t)}var ft={};Rt(ft,{IsBigInt64Array:()=>kh,IsBigUint64Array:()=>wh,IsBoolean:()=>ch,IsDate:()=>Rh,IsFloat32Array:()=>$h,IsFloat64Array:()=>Th,IsInt16Array:()=>xh,IsInt32Array:()=>bh,IsInt8Array:()=>hh,IsMap:()=>Oh,IsNumber:()=>lh,IsRegExp:()=>Eh,IsSet:()=>Sh,IsString:()=>dh,IsTypeArray:()=>fh,IsUint16Array:()=>Ih,IsUint32Array:()=>vh,IsUint8Array:()=>gh,IsUint8ClampedArray:()=>yh});function ch(e){return e instanceof Boolean}function lh(e){return e instanceof Number}function dh(e){return e instanceof String}function fh(e){return globalThis.ArrayBuffer.isView(e)}function hh(e){return e instanceof globalThis.Int8Array}function gh(e){return e instanceof globalThis.Uint8Array}function yh(e){return e instanceof globalThis.Uint8ClampedArray}function xh(e){return e instanceof globalThis.Int16Array}function Ih(e){return e instanceof globalThis.Uint16Array}function bh(e){return e instanceof globalThis.Int32Array}function vh(e){return e instanceof globalThis.Uint32Array}function $h(e){return e instanceof globalThis.Float32Array}function Th(e){return e instanceof globalThis.Float64Array}function kh(e){return e instanceof globalThis.BigInt64Array}function wh(e){return e instanceof globalThis.BigUint64Array}function Eh(e){return e instanceof globalThis.RegExp}function Rh(e){return e instanceof globalThis.Date}function Sh(e){return e instanceof globalThis.Set}function Oh(e){return e instanceof globalThis.Map}function Ch(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function Mh(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let r of Object.keys(n)){if(i.IsUnsafePropertyKey(r))continue;let a=n[r];i.HasPropertyKey(a,"value")&&Object.defineProperty(t,r,{...a,value:Ot(a.value)})}return t}function Ah(e){let t={};for(let n of i.Keys(e))i.IsUnsafePropertyKey(n)||(t[n]=Ot(e[n]));for(let n of i.Symbols(e))t[n]=Ot(e[n]);return t}function Lh(e){return i.IsClassInstance(e)?e:Ch(e)?Mh(e):Ah(e)}function qh(e){return e.map(t=>Ot(t))}function jh(e){return e.slice()}function Fh(e){return new RegExp(e.source,e.flags)}function Dh(e){return new Map(Ot([...e.entries()]))}function Nh(e){return new Set(Ot([...e.values()]))}function Ot(e){return ft.IsTypeArray(e)?jh(e):ft.IsRegExp(e)?Fh(e):ft.IsMap(e)?Dh(e):ft.IsSet(e)?Nh(e):i.IsArray(e)?qh(e):i.IsObject(e)?Lh(e):e}function bn(e){return qe.clone+=1,Ot(e)}var Pt={};Rt(Pt,{Get:()=>Kh,Reset:()=>Gh,Set:()=>Uh});var at={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Gh(){at.immutableTypes=!1,at.maxErrors=8,at.useAcceleration=!0,at.exactOptionalPropertyTypes=!1,at.enumerableKind=!1,at.correctiveParse=!1,at.unionPrioritySort=!0}function Uh(e){for(let t of i.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(at,t,{value:n})}}function Kh(){return at}function _h(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Mi(e,t){return{...e,...t}}function zh(e,t,n={}){qe.create+=1;let r=Pt.Get(),a=Mi(t,n),s=r.enumerableKind?Mi(a,e):_h(a,e);return r.immutableTypes?Object.freeze(s):s}function Bh(e,t){qe.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(bn(e)),a=new Set(t);for(let s of Object.keys(r))a.has(s)||Object.defineProperty(n,s,r[s]);return n}function Vh(e,t,n){qe.update+=1;let r=Pt.Get(),a=bn(e);for(let s of Object.keys(t))Object.defineProperty(a,s,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[s]});for(let s of Object.keys(n))Object.defineProperty(a,s,{configurable:!0,enumerable:!0,writable:!0,value:n[s]});return a}function y(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function ee(e){return i.IsObject(e)}function I(e,t,n){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ht(e){return y(e,"Deferred")}function Wh(e){return p.Update(e,{"~readonly":!0},{})}function vn(e,t){return p.Update(Wh(e),{},t)}function Ai(e,t,n,r){let a=d(e,t,n);return vn(a,r)}function Hh(e){return p.Update(e,{"~optional":!0},{})}function $n(e,t){return p.Update(Hh(e),{},t)}function Li(e,t,n,r){let a=d(e,t,n);return $n(a,r)}function Te(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function K(e){return y(e,"Array")}function xr(e){return p.Discard(e,["~kind","type","items"])}function Ge(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function ne(e){return y(e,"Constructor")}function qi(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ue(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function re(e){return y(e,"Function")}function ji(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function ot(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function ae(e){return y(e,"Ref")}function gt(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Bt(e){return y(e,"Generic")}function Vt(e){return p.Create({"~kind":"Any"},{},e)}function J(e){return y(e,"Any")}var Fi="(?!)";function q(e){return p.Create({"~kind":"Never"},{not:{}},e)}function yt(e){return y(e,"Never")}function Ke(e,t={}){return I("AddOptional",[e],t)}function Ct(e,t={}){return $n(e,t)}function Di(e){return Ct(e)}function le(e){return ee(e)&&i.HasPropertyKey(e,"~optional")}function Ni(e){return i.Keys(e).filter(t=>!le(e[t]))}function Ir(e){return i.Keys(e)}function br(e){return i.Values(e)}function v(e,t={}){let n=Ni(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function M(e){return y(e,"Object")}function Gi(e){return p.Discard(e,["~kind","type","properties","required"])}function oe(e){return p.Create({"~kind":"Unknown"},{},e)}function te(e){return y(e,"Unknown")}function _e(e,t,n){let r=i.Keys(e).reduce((a,s)=>({...a,[s]:p.Update(e[s],{},{$id:s})}),{});return p.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function se(e){return y(e,"Cyclic")}function Ui(e){return p.Update(e,{"~unsafe":null},{})}function vr(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var ze={};Rt(ze,{Match:()=>Yh});function Yh(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Tn(...e){let[t,n]=ze.Match(e,{2:(r,a)=>[r,a,a],1:r=>[r,oe(),oe()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function H(e){return y(e,"Infer")}function Mt(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function V(e){return y(e,"Dependent")}function Ki(e){return p.Discard(e,["~kind","if","then","else"])}function _i(e){return i.IsObjectNotArray(e)}function zi(e){return i.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function Bi(e){return i.IsString(e)||i.IsNumber(e)}function Vi(e,t){let n=_i(e)?zi(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function fe(e){return y(e,"Enum")}function de(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function S(e){return y(e,"Intersect")}function Wi(e){return p.Discard(e,["~kind","allOf"])}function Y(){throw new Error("Unreachable")}var Hi;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(Hi||(Hi={}));var qT=BigInt("14695981039346656037"),[jT,FT]=[BigInt("1099511628211"),BigInt("18446744073709551616")],DT=Array.from({length:256}).map((e,t)=>BigInt(t)),Yi=new Float64Array(1),NT=new DataView(Yi.buffer),GT=new Uint8Array(Yi.buffer);var UT=new TextEncoder;var kn=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=$r(n)?m=>this.decode(n["~codec"].decode(m)):this.decode,a=$r(n)?m=>n["~codec"].encode(t(m)):t,s={decode:r,encode:a};return p.Update(this.type,{"~codec":s},{})}},wn=class{constructor(t){this.type=t}Decode(t){return new kn(this.type,t)}};function Tr(e){return new wn(e)}function Xi(e,t){return Tr(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Zi(e,t){return Tr(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function $r(e){return ee(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function Qi(e){return Wt(e)}function At(e){return ee(e)&&i.HasPropertyKey(e,"~immutable")}function Be(e,t={}){return I("AddReadonly",[e],t)}function Lt(e,t={}){return vn(e,t)}function es(e){return Lt(e)}function qt(e){return ee(e)&&i.HasPropertyKey(e,"~readonly")}function Qh(e,t){let n=za(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function ts(...e){let[t,n,r]=ze.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return Qh(t,{check:n,error:r})}function eg(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function za(e){return ee(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>eg(t))}var ns="-?(?:0|[1-9][0-9]*)n";function En(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Ve(e){return y(e,"BigInt")}function kr(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Se(e){return y(e,"Boolean")}function Rn(e){return p.Create({"~kind":"Identifier"},{name:e})}function rs(e){return y(e,"Identifier")}var wr="-?(?:0|[1-9][0-9]*)";function jt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function he(e){return y(e,"Integer")}var Ba=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function tg(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new Ba(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:tg(e),const:e},t)}function Er(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function as(e){return A(e)&&i.IsNumber(e.const)}function os(e){return A(e)&&i.IsString(e.const)}function A(e){return y(e,"Literal")}function Ht(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Yt(e){return y(e,"Null")}var Rr="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function be(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function X(e){return y(e,"Number")}function Jt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xt(e){return y(e,"Symbol")}function Ft(...e){let[t,n,r]=ze.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,oe(),oe()]});return p.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function is(e){return y(e,"Parameter")}var Sr=".*";function Oe(e){return p.Create({"~kind":"String"},{type:"string"},e)}function ge(e){return y(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function ss(e){return p.Discard(e,["~kind","anyOf"])}function Sn(e){let t=ms(e);return i.IsEqual(t.length,2)?t[0]:[]}function ng(e){return!0}function ps(e){return i.ShiftLeft(e,(t,n)=>rg(t)?ps(n):!1,()=>!0)}function us(e){return i.IsEqual(e.length,0)?!1:ps(e)}function rg(e){return x(e)?us(e.anyOf):A(e)?ng(e.const):!1}function Or(e){return us(e)}function Pr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function cs(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>cs(a,t,[...n,`${r}${t}`]),()=>n)}function ag(e,t){return i.IsEqual(e.length,0)?[`${t}`]:cs(e,t)}function ls(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>ls(e,a,[...n,...ds(e,r)]),()=>n)}function ds(e,t){return x(t)?ls(e,t.anyOf):A(t)?ag(e,t.const):Y()}function fs(e,t){return i.ShiftLeft(t,(n,r)=>fs(ds(e,n),r),()=>e)}function og(e){return e.map(t=>O(t))}function ig(e){let t=fs([],e),n=og(t);return k(n)}function sg(e){return i.IsEqual(e.length,0)?Y():i.IsEqual(e.length,1)&&A(e[0])?e[0]:ig(e)}function Va(e){let t=Sn(e);return i.IsEqual(t.length,0)?Oe():Or(t)?sg(t):Pr(e)}function hs(e){let t=Va(e);return Z(t)?Oe():t}function xe(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function gs(e){return xe(je,e)}function ys(e){return v({true:e,false:e})}function Q(e,t={}){let[n,r,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:n,minItems:r},t)}function j(e){return y(e,"Tuple")}function xs(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function mg(e){return p.Discard(e,["~readonly"])}function Wa(e,t){return p.Update(mg(e),{},t)}function Is(e,t,n,r){let a=d(e,t,n);return Wa(a,r)}function bs(e,t={}){return I("RemoveReadonly",[e],t)}function vs(e,t={}){return Wa(e,t)}function pg(e){return p.Discard(e,["~optional"])}function Ha(e,t){return p.Update(pg(e),{},t)}function $s(e,t,n,r){let a=d(e,t,n);return Ha(a,r)}function Ts(e,t={}){return I("RemoveOptional",[e],t)}function Cr(e,t={}){return Ha(e,t)}function Ya(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function ks(e){let t=Ya(e.items);return v(t)}function ug(e,t){return qt(e)?!!qt(t):!1}function cg(e,t){return le(e)?!!le(t):!1}function lg(e,t){let n=ug(e,t),r=cg(e,t),a=z([e,t]),s=vs(Cr(a));return n&&r?Lt(Ct(s)):n&&!r?Lt(s):!n&&r?Ct(s):s}function dg(e,t,n){return n in e?n in t?lg(e[n],t[n]):e[n]:n in t?t[n]:q()}function fg(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((r,a)=>({...r,[a]:dg(e,t,a)}),{})}function ws(e){return M(e)?e.properties:j(e)?Ya(e.items):Y()}function Es(e,t){let n=ws(e),r=ws(t),a=fg(n,r);return v(a)}function Rs(e,t){let n=Xt(e,t);return i.IsEqual(n,Pn)?e:i.IsEqual(n,Cn)||i.IsEqual(n,On)?t:q()}function Ss(e){return M(e)||j(e)}function hg(e,t){let n=x(e),r=x(t);return n||r}function gg(e,t){let n=Pe(e),r=Pe(t),a=hg(n,r),s=Ss(n),m=Ss(r);return a?z([n,r]):s&&m?Es(n,r):s&&!m?n:!s&&m?r:Rs(n,r)}function Os(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>Os(e,a,[...n,gg(e,r)]),()=>i.IsEqual(n.length,0)?[e]:n)}function Ps(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>Ps(a,t,[...n,...Mn([r],t)]),()=>n)}function Mn(e,t=[]){return i.ShiftLeft(e,(n,r)=>x(n)?Mn(r,Ps(n.anyOf,t)):Mn(r,Os(n,t)),()=>t)}function yg(e,t){let n=me({},e,t);return b.IsExtendsTrueLike(n)?[]:[e]}function xg(e,t){return e.reduce((n,r)=>[...n,...yg(r,t)],[])}function Mr(e,t){let n=Pe(e),r=x(n)?n.anyOf:[n],a=xg(r,t);return ve(a)}function Fe(e,t,n){let r=de([e,t]),a=Mr(n,e);return ve([r,a])}function ke(e){let t=e.map(n=>O(n));return ve(t)}function z(e){let t=Mn(e),n=Ja(t);return it(n)}function Ie(e){let t=hs(e);return Pe(t)}function ve(e){let t=Ja(e);return it(t)}function Pe(e){return V(e)?Fe(e.if,e.then,e.else):fe(e)?ke(e.enum):S(e)?z(e.allOf):Z(e)?Ie(e.pattern):x(e)?ve(e.anyOf):e}function it(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?q():k(e)}function Cs(e,t){let n=ke(e);return It(n,t)}function Ms(e,t){return xe(bt,t)}function As(e,t){let n=z(e);return It(n,t)}function Ls(e,t){return i.IsString(e)||i.IsNumber(e)?v({[e]:t}):i.IsEqual(e,!1)?v({false:t}):i.IsEqual(e,!0)?v({true:t}):v({})}function qs(e,t){return xe(Zt,t)}function js(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?xe(e.pattern.toString(),t):xe(je,t)}function Fs(e,t){let n=Sn(e);return Or(n)?It(Ie(e),t):xe(e,t)}function Ig(e){return x(e)?An(e.anyOf):[e]}function An(e){return e.reduce((t,n)=>[...t,...Ig(n)],[])}function bg(e){return e.some(t=>ge(t)||X(t)||he(t))}function vg(e,t){return i.IsEqual(bg(e),!0)?xe(je,t):void 0}function $g(e,t){return e.reduce((n,r)=>A(r)&&(i.IsString(r.const)||i.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function Tg(e,t){let n=$g(e,t);return v(n)}function Ds(e,t){let n=An(e),r=vg(n,t);return ee(r)?r:Tg(n,t)}function It(e,t){return J(e)?gs(t):Se(e)?ys(t):fe(e)?Cs(e.enum,t):he(e)?Ms(e,t):S(e)?As(e.allOf,t):A(e)?Ls(e.const,t):X(e)?qs(e,t):x(e)?Ds(e.anyOf,t):ge(e)?js(e,t):Z(e)?Fs(e.pattern,t):v({})}function Xa(e,t,n){return T([e])?p.Update(It(e,t),{},n):Ar(e,t,n)}function Ns(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Xa(s,m,a)}var bt=`^${wr}$`,Zt=`^${Rr}$`,je=`^${Sr}$`;function Ar(e,t,n={}){return I("Record",[e,t],n)}function Lr(e,t,n={}){return Xa(e,t,n)}function Gs(e,t){return xe(e,t)}function qr(e){return i.IsEqual(e,je)?Oe():i.IsEqual(e,bt)?jt():i.IsEqual(e,Zt)?be():Va(e)}function Ce(e){return i.Keys(e.patternProperties)[0]}function Qt(e){let t=Ce(e);return qr(t)}function ye(e){return e.patternProperties[Ce(e)]}function pe(e){return y(e,"Record")}function Dt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function vt(e){return y(e,"Rest")}function jr(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function Fr(e){return y(e,"This")}function en(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function tn(e){return y(e,"Undefined")}function Dr(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function We(e){return y(e,"Void")}function wg(e,t){return i.IsEqual(e,"Array")?Te(t[0]):i.IsEqual(e,"Capitalize")?Gr(t[0]):i.IsEqual(e,"ConstructorParameters")?Br(t[0]):i.IsEqual(e,"Evaluate")?Kp(t[0]):i.IsEqual(e,"Exclude")?Vr(t[0],t[1]):i.IsEqual(e,"Extract")?Wr(t[0],t[1]):i.IsEqual(e,"Index")?Fn(t[0],t[1]):i.IsEqual(e,"InstanceType")?Hr(t[0]):i.IsEqual(e,"Lowercase")?Ur(t[0]):i.IsEqual(e,"NonNullable")?Yr(t[0]):i.IsEqual(e,"Omit")?Jr(t[0],t[1]):i.IsEqual(e,"Parameters")?Xr(t[0]):i.IsEqual(e,"Partial")?Zr(t[0]):i.IsEqual(e,"Pick")?Qr(t[0],t[1]):i.IsEqual(e,"Readonly")?ea(t[0]):i.IsEqual(e,"KeyOf")?Dn(t[0]):i.IsEqual(e,"Record")?Ar(t[0],t[1]):i.IsEqual(e,"Required")?ta(t[0]):i.IsEqual(e,"ReturnType")?na(t[0]):i.IsEqual(e,"Uncapitalize")?Kr(t[0]):i.IsEqual(e,"Uppercase")?_r(t[0]):jn(ot(e),t)}function Nt(){throw Error("Unreachable")}var Eg=(e,t=[])=>e.reduce((n,r)=>i.IsArray(r)&&i.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),st=e=>{let[t,n]=e;return Eg([...t,...n])};function Bs(e){return Ft(e[0],e[2],e[4])}function Vs(e){return Ft(e[0],e[2],e[2])}function Ws(e){return Ft(e[0],oe(),e[2])}function Hs(e){return Ft(e,oe(),oe())}function Ys(e){return st(e)}function Js(e){return e[1]}function Xs(e){return st(e)}function Zs(e){return e[1]}function Qs(e){return wg(e[0],e[1])}function em(e){return null}function tm(e){return Oe()}function nm(e){return be()}function rm(e){return kr()}function am(e){return en()}function om(e){return Ht()}function im(e){return jt()}function sm(e){return En()}function mm(e){return oe()}function pm(e){return Vt()}function um(e){return v({})}function cm(e){return q()}function lm(e){return Jt()}function dm(e){return Dr()}function fm(e){return jr()}function hm(e){return O(BigInt(e))}function gm(e){return O(i.IsEqual(e,"true"))}function ym(e){return O(parseFloat(e))}function xm(e){return O(e)}function Im(e){return e[1]}function bm(e){return O(e)}function vm(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function $m(e){return e[1]}function Tm(e){return Nr(e)}function km(e){return i.IsEqual(e.length,6)?Mt(e[1],e[3],e[5]):Mt(e[1],e[3],oe())}function wm(e){return e.length>0}function Em(e){return e.reduce((t,n)=>i.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function Rm(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Sm(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function Om(e){return i.IsEqual(e.length,2)?e[1]:[]}function Us(e,t){return t.reduce((n,r)=>{let a=r;return i.IsEqual(a.length,1)?Fn(n,a[0]):i.IsEqual(a.length,0)?Te(n):Nt()},e)}function Ks(e,t){return i.IsEqual(t.length,3)?zr(e,t[0],t[1],t[2]):e}function Rg(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:ra(e,t)}function Pm(e){let[t,n,r,a,s]=e;return Rg(Ks(t?Dn(Us(n,r)):Us(n,r),a),s)}function Za(e,t){return i.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,s=Za(r,a);if(i.IsEqual(n,"&"))return S(s)?de([e,...s.allOf]):de([e,s]);if(i.IsEqual(n,"|"))return x(s)?k([e,...s.anyOf]):k([e,s]);Nt()})():e}function Cm(e){let[t,n]=e;return Za(t,n)}function Mm(e){let[t,n]=e;return Za(t,n)}function Am(e){return Up(e[1])}function Lm(e){return e[1]}function qm(e){return gt(e[0],e[2])}function jm(e){return i.IsEqual(e.length,4)?Tn(e[1],e[3]):i.IsEqual(e.length,2)?Tn(e[1],oe()):Nt()}function Fm(e){return`${e}`}function Dm(e){return he(e[3])?bt:X(e[3])?Zt:xt(e[3])?je:ge(e[3])?je:Nt()}function Nm(e){return e.length>0}function Gm(e){return e.length>0}function Um(e){let[t,n,r,a,s]=e;return{[n]:t&&r?Be(Ke(s)):t&&!r?Be(s):!t&&r?Ke(s):s}}function Km(e){return st(e)}function _m(e){return e.reduce((t,n)=>i.HasPropertyKey(n,bt)||i.HasPropertyKey(n,Zt)||i.HasPropertyKey(n,je)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function zm(e){return _m(e[1])}function Bm(e){let[t,n]=e,r=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return v(t,r)}function Vm(e){return i.IsEqual(e.length,5)?Be(Ke(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?Be(e[3]):Ke(e[3]):Nt()}function Wm(e){return Be(Ke(e[1]))}function Hm(e){return Be(e[1])}function Ym(e){return Ke(e[0])}function Jm(e){return i.IsEqual(e.length,2)?Dt(e[1]):i.IsEqual(e.length,1)?e[0]:Nt()}function Xm(e){return st(e)}function Zm(e){return Q(e[1])}function Qm(e){return Be(Ke(e[4]))}function ep(e){return Be(e[3])}function tp(e){return Ke(e[3])}function np(e){return e[2]}function rp(e){return i.IsEqual(e.length,2)?Dt(e[1]):i.IsEqual(e.length,1)?e[0]:Nt()}function ap(e){return st(e)}function op(e){return Ue(e[1],e[4])}function ip(e){return Ge(e[2],e[5])}function _s(e,t){return i.IsEqual(e,"remove")?bs(t):i.IsEqual(e,"add")?Be(t):t}function sp(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function zs(e,t){return i.IsEqual(e,"remove")?Ts(t):i.IsEqual(e,"add")?Ke(t):t}function mp(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function pp(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function up(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?Ln(Rn(e[3]),e[5],e[6][0],_s(e[1],zs(e[8],e[10]))):Ln(Rn(e[3]),e[5],ot(e[3]),_s(e[1],zs(e[8],e[10])))}function cp(e){return ot(e)}function lp(e){return BigInt(e)}function dp(e){return parseFloat(e)}function fp(e){return i.IsEqual(e,"true")}function hp(e){return null}function gp(e){return{[e[0]]:e[2]}}function yp(e){return st(e)}function Sg(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function xp(e){return Sg(e[1])}function Ip(e){return st(e)}function bp(e){return e[1]}function vp(e){return En()}function $p(e){return Oe()}function Tp(e){return be()}function kp(e){return jt()}function wp(e){return q()}function Ep(e){return O(e)}function Rp(e){return k(e[1])}function Sp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Op(e){return[e[0],...e[1]]}function Pp(e){return e[1]}function Cp(e){return st(e)}function Mp(e){return i.IsEqual(e.length,2)?e[1]:[]}function Ap(e){let t=e[2],n=e[3],[r,a]=e[4],s=i.IsEqual(i.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:gt(t,qn(n,r,s))}}function Lp(e){let t=e[2],[n,r]=e[3],a=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:qn(t,n,a)}}function qp(e){return{[e[1]]:gt(e[2],e[4])}}function jp(e){return{[e[1]]:e[3]}}function Fp(e){return null}function Dp(e){return _m(st(e))}function Np(e){return e[1]}function Gp(e){let t=e[0],n=e[1];return _p(p.Assign(t,n[0]))}function Nn(e){return C(e.length,2)}function E(e,t,n){return Nn(e)?t(e[0],e[1]):n()}function Cg(e,t){return C(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function B(e,t){for(let n=0;n<e.length;n++){let r=Cg(e[n],t);if(Nn(r))return r}return[]}function Qa(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var zp=[...Qa(97,122),...Qa(65,90)],eo="0",to=Qa(49,57),nn=[eo,...to],Bp=" ",rn=`
6
+ `;var $t="_",aa=".",Vp="$",oa="-";var Wp="//",Hp="/*",Ag="*/";function Yp(e){let t=e.indexOf(Ag);return C(t,-1)?"":e.slice(t+2)}function Jp(e){let t=e.indexOf(rn);return C(t,-1)?"":e.slice(t)}function Lg(e){return e.replace(/^[ \t\r\f\v]+/,"")}function ia(e){let t=Lg(e);return t.startsWith(Hp)?ia(Yp(t.slice(2))):t.startsWith(Wp)?ia(Jp(t.slice(2))):t}function ie(e){let t=e.trimStart();return t.startsWith(Hp)?ie(Yp(t.slice(2))):t.startsWith(Wp)?ie(Jp(t.slice(2))):t}function sa(e,t){return E(B([e],t),(n,r)=>[n,r],()=>["",t])}function qg(e,t){return e.includes(t)}function an(e,t,n,r=""){return E(B(e,n),(a,s)=>qg(t,a)?an(e,t,s,r):an(e,t,s,`${r}${a}`),()=>[r,n])}function jg(e){return B(to,e)}var Fg=[...nn,$t];function Dg(e){return an(Fg,[$t],e)}function Ng(e){return E(B([eo],e),(t,n)=>[t,n],()=>E(jg(e),(t,n)=>E(Dg(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function ma(e){return Ng(ie(e))}function Gg(e){return sa(oa,e)}function Ug(e){return E(Gg(e),(t,n)=>E(ma(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function Xp(e){return Ug(ie(e))}function Kg(e){return E(Xp(e),(t,n)=>E(B(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function no(e){return Kg(e)}function ro(e,t){return B([e],t)}function u(e,t){return C(e,"")?["",t]:e.startsWith(rn)?ro(e,ia(t)):e.startsWith(Bp)?ro(e,t):ro(e,ie(t))}var Zp=[...zp,$t,Vp];function _g(e){return B(Zp,e)}var zg=[...Zp,...nn];function Qp(e,t=""){return E(B(zg,e),(n,r)=>Qp(r,`${t}${n}`),()=>[t,e])}function Bg(e){return E(_g(e),(t,n)=>E(Qp(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function W(e){return Bg(ie(e))}var Vg=[...nn,$t];function Wg(e){return Nn(B([aa],e))}function eu(e){return E(an(Vg,[$t],e),(t,n)=>C(t,"")?[]:[t,n],()=>[])}function Hg(e){return E(B([aa],e),(t,n)=>E(eu(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function Yg(e){return E(ma(e),(t,n)=>E(B([aa],n),(r,a)=>E(eu(a),(s,m)=>[`${t}${r}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function Jg(e){return Wg(e)?Hg(e):Yg(e)}function tu(e){return Jg(ie(e))}function Xg(e){return sa(oa,e)}function Zg(e){return E(Xg(e),(t,n)=>E(tu(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function pa(e){return Zg(ie(e))}function Qg(e){return C(e,"")?[]:[e.slice(0,1),e.slice(1)]}function nu(e,t){return yr(e,(n,r)=>t.startsWith(n)?!0:nu(r,t),()=>!1)}function Tt(e,t,n=""){return E(Qg(t),(r,a)=>nu(e,t)?[n,t]:Tt(e,a,`${n}${r}`),()=>[])}function ey(e,t,n){return E(B([e],n),(r,a)=>E(Tt([t],a),(s,m)=>E(B([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function ty(e,t,n){return E(B([e],n),(r,a)=>E(Tt([rn,t],a),(s,m)=>E(B([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function ru(e,t,n,r){return n?ey(e,t,ie(r)):ty(e,t,ie(r))}function ny(e,t){return B(e,t)}function ry(e,t){return ru(e,e,!1,t)}function ay(e,t){return E(ny(e,t),(n,r)=>ry(n,`${n}${r}`),()=>[])}function ua(e,t){return ay(e,ie(t))}function au(e,t){return E(Tt(e,t),(n,r)=>C(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),iy=e=>o(o(W(e),([t,n])=>o(u("extends",n),([r,a])=>o(R(a),([s,m])=>o(u("=",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Bs(t),n]),sy=e=>o(o(W(e),([t,n])=>o(u("extends",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Vs(t),n]),my=e=>o(o(W(e),([t,n])=>o(u("=",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Ws(t),n]),py=e=>o(W(e),([t,n])=>[Hs(t),n]),su=e=>o(o(iy(e),([t,n])=>[t,n],()=>o(sy(e),([t,n])=>[t,n],()=>o(my(e),([t,n])=>[t,n],()=>o(py(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),mu=(e,t=[])=>o(o(su(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>mu(r,[...t,n]),()=>[t,e]),uy=e=>o(o(mu(e),([t,n])=>o(o(o(su(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Ys(t),n]),io=e=>o(o(u("<",e),([t,n])=>o(uy(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Js(t),n]),pu=(e,t=[])=>o(o(R(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>pu(r,[...t,n]),()=>[t,e]),cy=e=>o(o(pu(e),([t,n])=>o(o(o(R(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Xs(t),n]),ly=e=>o(o(u("<",e),([t,n])=>o(cy(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Zs(t),n]),dy=e=>o(o(W(e),([t,n])=>o(ly(n),([r,a])=>[[t,r],a])),([t,n])=>[Qs(t),n]),uu=e=>o(o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[em(t),n]),cu=e=>o(u("string",e),([t,n])=>[tm(t),n]),lu=e=>o(u("number",e),([t,n])=>[nm(t),n]),fy=e=>o(u("boolean",e),([t,n])=>[rm(t),n]),hy=e=>o(u("undefined",e),([t,n])=>[am(t),n]),gy=e=>o(u("null",e),([t,n])=>[om(t),n]),du=e=>o(u("integer",e),([t,n])=>[im(t),n]),yy=e=>o(u("bigint",e),([t,n])=>[sm(t),n]),xy=e=>o(u("unknown",e),([t,n])=>[mm(t),n]),Iy=e=>o(u("any",e),([t,n])=>[pm(t),n]),by=e=>o(u("object",e),([t,n])=>[um(t),n]),vy=e=>o(u("never",e),([t,n])=>[cm(t),n]),fu=e=>o(u("symbol",e),([t,n])=>[lm(t),n]),$y=e=>o(u("void",e),([t,n])=>[dm(t),n]),Ty=e=>o(u("this",e),([t,n])=>[fm(t),n]),ky=e=>o(o(u("${",e),([t,n])=>o(R(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Im(t),n]),ao=e=>o(Tt(["${","`"],e),([t,n])=>[bm(t),n]),hu=e=>o(o(o(ao(e),([t,n])=>o(ky(n),([r,a])=>o(hu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(ao(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(ao(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[vm(t),n]),so=e=>o(o(u("`",e),([t,n])=>o(hu(n),([r,a])=>o(u("`",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[$m(t),n]),wy=e=>o(so(e),([t,n])=>[Tm(t),n]),Ey=e=>o(o(o(u("if",e),([t,n])=>o(R(n),([r,a])=>o(u("then",a),([s,m])=>o(R(m),([c,l])=>o(u("else",l),([h,f])=>o(R(f),([w,D])=>[[t,r,s,c,h,w],D])))))),([t,n])=>[t,n],()=>o(o(u("if",e),([t,n])=>o(R(n),([r,a])=>o(u("then",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[km(t),n]),Ry=e=>o(no(e),([t,n])=>[hm(t),n]),Sy=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[gm(t),n]),Oy=e=>o(pa(e),([t,n])=>[ym(t),n]),Py=e=>o(ua(["'",'"'],e),([t,n])=>[xm(t),n]),Cy=e=>o(o(o(u("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[wm(t),n]),gu=(e,t=[])=>o(o(o(u("[",e),([n,r])=>o(R(r),([a,s])=>o(u("]",s),([m,c])=>[[n,a,m],c]))),([n,r])=>[n,r],()=>o(o(u("[",e),([n,r])=>o(u("]",r),([a,s])=>[[n,a],s])),([n,r])=>[n,r],()=>[])),([n,r])=>gu(r,[...t,n]),()=>[t,e]),My=e=>o(gu(e),([t,n])=>[Em(t),n]),Ay=e=>o(o(o(u("extends",e),([t,n])=>o(R(n),([r,a])=>o(u("?",a),([s,m])=>o(R(m),([c,l])=>o(u(":",l),([h,f])=>o(R(f),([w,D])=>[[t,r,s,c,h,w],D])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Rm(t),n]),Ly=e=>o(o(o(u("(",e),([t,n])=>o(R(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(cu(e),([t,n])=>[t,n],()=>o(lu(e),([t,n])=>[t,n],()=>o(fy(e),([t,n])=>[t,n],()=>o(hy(e),([t,n])=>[t,n],()=>o(gy(e),([t,n])=>[t,n],()=>o(du(e),([t,n])=>[t,n],()=>o(yy(e),([t,n])=>[t,n],()=>o(xy(e),([t,n])=>[t,n],()=>o(Iy(e),([t,n])=>[t,n],()=>o(by(e),([t,n])=>[t,n],()=>o(vy(e),([t,n])=>[t,n],()=>o(fu(e),([t,n])=>[t,n],()=>o($y(e),([t,n])=>[t,n],()=>o(Ty(e),([t,n])=>[t,n],()=>o(Ry(e),([t,n])=>[t,n],()=>o(Sy(e),([t,n])=>[t,n],()=>o(Oy(e),([t,n])=>[t,n],()=>o(Py(e),([t,n])=>[t,n],()=>o(wy(e),([t,n])=>[t,n],()=>o(Ey(e),([t,n])=>[t,n],()=>o(Wy(e),([t,n])=>[t,n],()=>o(Qy(e),([t,n])=>[t,n],()=>o(ox(e),([t,n])=>[t,n],()=>o(ax(e),([t,n])=>[t,n],()=>o(px(e),([t,n])=>[t,n],()=>o(dy(e),([t,n])=>[t,n],()=>o(ux(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[Sm(t),n]),qy=e=>o(o(o(u("with",e),([t,n])=>o(Mu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Om(t),n]),yu=e=>o(o(Cy(e),([t,n])=>o(Ly(n),([r,a])=>o(My(a),([s,m])=>o(Ay(m),([c,l])=>o(qy(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Pm(t),n]),xu=e=>o(o(o(u("&",e),([t,n])=>o(yu(n),([r,a])=>o(xu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Iu=e=>o(o(yu(e),([t,n])=>o(xu(n),([r,a])=>[[t,r],a])),([t,n])=>[Cm(t),n]),bu=e=>o(o(o(u("|",e),([t,n])=>o(Iu(n),([r,a])=>o(bu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ca=e=>o(o(Iu(e),([t,n])=>o(bu(n),([r,a])=>[[t,r],a])),([t,n])=>[Mm(t),n]),jy=e=>o(o(u("readonly",e),([t,n])=>o(ca(n),([r,a])=>[[t,r],a])),([t,n])=>[Am(t),n]),Fy=e=>o(o(u("|",e),([t,n])=>o(ca(n),([r,a])=>[[t,r],a])),([t,n])=>[Lm(t),n]),Dy=e=>o(o(io(e),([t,n])=>o(u("=",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[qm(t),n]),Ny=e=>o(o(o(u("infer",e),([t,n])=>o(W(n),([r,a])=>o(u("extends",a),([s,m])=>o(ca(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(u("infer",e),([t,n])=>o(W(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>[])),([t,n])=>[jm(t),n]),R=e=>o(o(Ny(e),([t,n])=>[t,n],()=>o(Fy(e),([t,n])=>[t,n],()=>o(jy(e),([t,n])=>[t,n],()=>o(ca(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Gy=e=>o(pa(e),([t,n])=>[Fm(t),n]),Uy=e=>o(W(e),([t,n])=>[t,n]),Ky=e=>o(ua(["'",'"'],e),([t,n])=>[t,n]),_y=e=>o(o(u("[",e),([t,n])=>o(W(n),([r,a])=>o(u(":",a),([s,m])=>o(o(du(m),([c,l])=>[c,l],()=>o(lu(m),([c,l])=>[c,l],()=>o(cu(m),([c,l])=>[c,l],()=>o(fu(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Dm(t),n]),vu=e=>o(o(Gy(e),([t,n])=>[t,n],()=>o(Uy(e),([t,n])=>[t,n],()=>o(Ky(e),([t,n])=>[t,n],()=>o(_y(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),zy=e=>o(o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Nm(t),n]),By=e=>o(o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Gm(t),n]),$u=e=>o(o(zy(e),([t,n])=>o(vu(n),([r,a])=>o(By(a),([s,m])=>o(u(":",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Um(t),n]),Tu=e=>o(o(o(u(",",e),([t,n])=>o(u(`
7
+ `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>o(u(`
8
+ `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(`
9
+ `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),ku=(e,t=[])=>o(o($u(e),([n,r])=>o(Tu(r),([a,s])=>[[n,a],s])),([n,r])=>ku(r,[...t,n]),()=>[t,e]),Vy=e=>o(o(ku(e),([t,n])=>o(o(o($u(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Km(t),n]),mo=e=>o(o(u("{",e),([t,n])=>o(Vy(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[zm(t),n]),Wy=e=>o(mo(e),([t,n])=>[Bm(t),n]),Hy=e=>o(o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[Vm(t),n]),Yy=e=>o(o(u("readonly",e),([t,n])=>o(R(n),([r,a])=>o(u("?",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Wm(t),n]),Jy=e=>o(o(u("readonly",e),([t,n])=>o(R(n),([r,a])=>[[t,r],a])),([t,n])=>[Hm(t),n]),Xy=e=>o(o(R(e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[Ym(t),n]),ou=e=>o(o(Hy(e),([t,n])=>[t,n],()=>o(Yy(e),([t,n])=>[t,n],()=>o(Jy(e),([t,n])=>[t,n],()=>o(Xy(e),([t,n])=>[t,n],()=>o(R(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),wu=e=>o(o(o(u("...",e),([t,n])=>o(ou(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(ou(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[Jm(t),n]),Eu=(e,t=[])=>o(o(wu(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Eu(r,[...t,n]),()=>[t,e]),Zy=e=>o(o(Eu(e),([t,n])=>o(o(o(wu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Xm(t),n]),Qy=e=>o(o(u("[",e),([t,n])=>o(Zy(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Zm(t),n]),ex=e=>o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Qm(t),n]),tx=e=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[ep(t),n]),nx=e=>o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[tp(t),n]),rx=e=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[np(t),n]),iu=e=>o(o(ex(e),([t,n])=>[t,n],()=>o(tx(e),([t,n])=>[t,n],()=>o(nx(e),([t,n])=>[t,n],()=>o(rx(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ru=e=>o(o(o(u("...",e),([t,n])=>o(iu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(iu(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[rp(t),n]),Su=(e,t=[])=>o(o(Ru(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Su(r,[...t,n]),()=>[t,e]),Ou=e=>o(o(Su(e),([t,n])=>o(o(o(Ru(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[ap(t),n]),ax=e=>o(o(u("(",e),([t,n])=>o(Ou(n),([r,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[op(t),n]),ox=e=>o(o(u("new",e),([t,n])=>o(u("(",n),([r,a])=>o(Ou(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([h,f])=>o(R(f),([w,D])=>[[t,r,s,c,h,w],D])))))),([t,n])=>[ip(t),n]),ix=e=>o(o(o(u("+",e),([t,n])=>o(u("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("-",e),([t,n])=>o(u("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[sp(t),n]),sx=e=>o(o(o(u("+",e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("-",e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[mp(t),n]),mx=e=>o(o(o(u("as",e),([t,n])=>o(R(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[pp(t),n]),px=e=>o(o(u("{",e),([t,n])=>o(ix(n),([r,a])=>o(u("[",a),([s,m])=>o(W(m),([c,l])=>o(u("in",l),([h,f])=>o(R(f),([w,D])=>o(mx(D),([_,ue])=>o(u("]",ue),([Me,Re])=>o(sx(Re),([De,Qe])=>o(u(":",Qe),([N,et])=>o(R(et),([Ne,pt])=>o(uu(pt),([tt,ut])=>o(u("}",ut),([zt,ct])=>[[t,r,s,c,h,w,_,Me,De,N,Ne,tt,zt],ct]))))))))))))),([t,n])=>[up(t),n]),ux=e=>o(W(e),([t,n])=>[cp(t),n]),cx=e=>o(no(e),([t,n])=>[lp(t),n]),lx=e=>o(pa(e),([t,n])=>[dp(t),n]),dx=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[fp(t),n]),fx=e=>o(ua(['"',"'"],e),([t,n])=>[t,n]),hx=e=>o(u("null",e),([t,n])=>[hp(t),n]),gx=e=>o(u("undefined",e),([t,n])=>[void 0,n]),Pu=e=>o(o(vu(e),([t,n])=>o(u(":",n),([r,a])=>o(po(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[gp(t),n]),Cu=(e,t=[])=>o(o(Pu(e),([n,r])=>o(Tu(r),([a,s])=>[[n,a],s])),([n,r])=>Cu(r,[...t,n]),()=>[t,e]),yx=e=>o(o(Cu(e),([t,n])=>o(o(o(Pu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[yp(t),n]),Mu=e=>o(o(u("{",e),([t,n])=>o(yx(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[xp(t),n]),Au=(e,t=[])=>o(o(po(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Au(r,[...t,n]),()=>[t,e]),xx=e=>o(o(Au(e),([t,n])=>o(o(o(po(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Ip(t),n]),Ix=e=>o(o(u("[",e),([t,n])=>o(xx(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[bp(t),n]),po=e=>o(o(cx(e),([t,n])=>[t,n],()=>o(lx(e),([t,n])=>[t,n],()=>o(dx(e),([t,n])=>[t,n],()=>o(fx(e),([t,n])=>[t,n],()=>o(hx(e),([t,n])=>[t,n],()=>o(gx(e),([t,n])=>[t,n],()=>o(Mu(e),([t,n])=>[t,n],()=>o(Ix(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),bx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[vp(t),n]),vx=e=>o(u(".*",e),([t,n])=>[$p(t),n]),$x=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Tp(t),n]),Tx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[kp(t),n]),kx=e=>o(u("(?!)",e),([t,n])=>[wp(t),n]),wx=e=>o(au(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[Ep(t),n]),Ex=e=>o(o(bx(e),([t,n])=>[t,n],()=>o(vx(e),([t,n])=>[t,n],()=>o($x(e),([t,n])=>[t,n],()=>o(Tx(e),([t,n])=>[t,n],()=>o(kx(e),([t,n])=>[t,n],()=>o(Rx(e),([t,n])=>[t,n],()=>o(wx(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),Rx=e=>o(o(u("(",e),([t,n])=>o(uo(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Rp(t),n]),Lu=e=>o(o(o(oo(e),([t,n])=>o(u("|",n),([r,a])=>o(Lu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(oo(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[Sp(t),n]),oo=e=>o(o(Ex(e),([t,n])=>o(uo(n),([r,a])=>[[t,r],a])),([t,n])=>[Op(t),n]),uo=e=>o(o(Lu(e),([t,n])=>[t,n],()=>o(oo(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ms=e=>o(o(u("^",e),([t,n])=>o(uo(n),([r,a])=>o(u("$",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Pp(t),n]),qu=(e,t=[])=>o(o(R(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>qu(r,[...t,n]),()=>[t,e]),Sx=e=>o(o(qu(e),([t,n])=>o(o(o(R(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Cp(t),n]),ju=e=>o(o(o(u("extends",e),([t,n])=>o(Sx(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Mp(t),n]),Ox=e=>o(o(u("interface",e),([t,n])=>o(W(n),([r,a])=>o(io(a),([s,m])=>o(ju(m),([c,l])=>o(mo(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Ap(t),n]),Px=e=>o(o(u("interface",e),([t,n])=>o(W(n),([r,a])=>o(ju(a),([s,m])=>o(mo(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[Lp(t),n]),Cx=e=>o(o(u("type",e),([t,n])=>o(W(n),([r,a])=>o(io(a),([s,m])=>o(u("=",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[qp(t),n]),Mx=e=>o(o(u("type",e),([t,n])=>o(W(n),([r,a])=>o(u("=",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[jp(t),n]),Ax=e=>o(o(o(u("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Fp(t),n]),Lx=e=>o(o(o(u(";",e),([t,n])=>o(u(`
10
+ `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(`
11
+ `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),Fu=(e,t=[])=>o(o(co(e),([n,r])=>o(Lx(r),([a,s])=>[[n,a],s])),([n,r])=>Fu(r,[...t,n]),()=>[t,e]),qx=e=>o(o(Fu(e),([t,n])=>o(o(o(co(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Dp(t),n]),co=e=>o(o(Ax(e),([t,n])=>o(o(Ox(n),([r,a])=>[r,a],()=>o(Px(n),([r,a])=>[r,a],()=>o(Cx(n),([r,a])=>[r,a],()=>o(Mx(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(uu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Np(t),n]),jx=e=>o(o(co(e),([t,n])=>o(qx(n),([r,a])=>[[t,r],a])),([t,n])=>[Gp(t),n]),Du=e=>o(o(jx(e),([t,n])=>[t,n],()=>o(Dy(e),([t,n])=>[t,n],()=>o(R(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function Nu(e){let t=so(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:Y()}function Dx(e){return e.join("|")}function Nx(e){return e.slice(1,e.length-1)}function Gx(e,t,n){return kt(t,`${n}${e}`)}function Ux(e,t){return kt(e,`${t}${ns}`)}function Kx(e,t){return kt(e,`${t}${wr}`)}function _x(e,t){return kt(e,`${t}${Rr}`)}function zx(e,t){return Gn(k([O("false"),O("true")]),e,t)}function Bx(e,t){return kt(e,`${t}${Sr}`)}function Vx(e,t,n){return kt(t,`${n}${Nx(e)}`)}function Wx(e,t,n){let r=Un(e,{});return Gn(r,t,n)}function Hx(e,t,n){let r=ke(e);return Gn(r,t,n)}function Gu(e,t,n,r=[]){return i.ShiftLeft(e,(a,s)=>Gu(s,t,n,[...r,Gn(a,[],"")]),()=>kt(t,`${n}(${Dx(r)})`))}function Gn(e,t,n){return fe(e)?Hx(e.enum,t,n):he(e)?Kx(t,n):A(e)?Gx(e.const,t,n):Ve(e)?Ux(t,n):Se(e)?zx(t,n):X(e)?_x(t,n):ge(e)?Bx(t,n):Z(e)?Vx(e.pattern,t,n):Ku(e)?Wx(e.parameters[0],t,n):x(e)?Gu(e.anyOf,t,n):Fi}function kt(e,t){return i.ShiftLeft(e,(n,r)=>Gn(n,r,t),()=>t)}function Yx(e){return`^${kt(e,"")}$`}function Uu(e){let t=Yx(e);return Pr(t)}function Un(e,t){return T(e)?p.Update(Uu(e),{},t):Nr(e,t)}function _u(e,t,n,r){let a=we(e,t,n);return Un(a,r)}function Nr(e,t={}){return I("TemplateLiteral",[e],t)}function Ku(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function zu(e){return Un(e,{})}function Jx(e){let t=Nu(e);return zu(t)}function Bu(e,t={}){let n=i.IsString(e)?Jx(e):zu(e);return p.Update(n,{},t)}function Z(e){return y(e,"TemplateLiteral")}var b={};Rt(b,{ExtendsFalse:()=>$,ExtendsTrue:()=>g,ExtendsUnion:()=>lo,IsExtendsFalse:()=>Xx,IsExtendsTrue:()=>Wu,IsExtendsTrueLike:()=>on,IsExtendsUnion:()=>Vu,Match:()=>U});function lo(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Vu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsUnion")&&i.IsObject(e.inferred)}function g(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Wu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function $(){return p.Create({"~kind":"ExtendsFalse"},{})}function Xx(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function on(e){return Vu(e)||Wu(e)}function U(e,t,n){return on(e)?t(e.inferred):n()}function Zx(e,t,n,r){return U(P(e,n,r),a=>g(p.Assign(p.Assign(e,a),{[t]:n})),()=>$())}function Qx(e,t){return g(e)}function eI(e,t,n,r,a){return U(P(e,t,n),s=>U(P(s,t,r),m=>g(m),()=>$()),()=>U(P(e,t,a),s=>g(s),()=>$()))}function tI(e,t,n){let r=ke(n);return P(e,t,r)}function Hu(e,t,n){return i.ShiftLeft(n,(r,a)=>U(P(e,t,r),s=>Hu(s,t,a),()=>$()),()=>g(e))}function nI(e,t,n){let r=Ie(n);return P(e,t,r)}function Yu(e,t,n){return i.ShiftLeft(n,(r,a)=>U(P(e,t,r),s=>g(s),()=>Yu(e,t,a)),()=>$())}function L(e,t,n){return J(n)?Qx(e,t):V(n)?eI(e,t,n.if,n.then,n.else):fe(n)?tI(e,t,n.enum):H(n)?Zx(e,n.name,t,n.extends):S(n)?Hu(e,t,n.allOf):Z(n)?nI(e,t,n.pattern):x(n)?Yu(e,t,n.anyOf):te(n)?g(e):$()}function Ju(e,t,n){return H(n)?L(e,t,n):J(n)?g(e):te(n)?g(e):lo(e)}function rI(e,t){let n=At(e),r=At(t);return n&&r||!n&&r?!0:!(n&&!r)}function Xu(e,t,n,r){return K(r)?rI(t,r)?P(e,n,r.items):$():L(e,t,r)}function Zu(e,t,n){return Ve(n)?g(e):L(e,t,n)}function Qu(e,t,n){return Se(n)?g(e):L(e,t,n)}function aI(e,t,n,r,a){let s=H(r)?t:r,m=H(r)?r:t,c=le(t),l=le(r);return!c&&l?$():U(P(e,s,m),h=>Kn(h,n,a),()=>$())}function oI(e,t,n,r){return i.ShiftLeft(r,(a,s)=>aI(e,t,n,a,s),()=>le(t)?g(e):$())}function iI(e,t,n){return i.ShiftLeft(t,(r,a)=>oI(e,r,a,n),()=>g(e))}function Kn(e,t,n){return iI(e,t,n)}function la(e,t,n){return We(n)?g(e):P(e,t,n)}function ec(e,t,n,r){return J(r)?g(e):te(r)?g(e):ne(r)?U(Kn(e,t,r.parameters),a=>la(a,n,r.instanceType),()=>$()):$()}function tc(e,t,n,r,a){return U(P(e,t,a),()=>P(e,n,a),()=>P(e,r,a))}function nc(e,t,n){let r=ke(t);return P(e,r,n)}function rc(e,t,n,r){return J(r)?g(e):te(r)?g(e):re(r)?U(Kn(e,t,r.parameters),a=>la(a,n,r.returnType),()=>$()):$()}function ac(e,t,n){return he(n)?g(e):X(n)?g(e):L(e,t,n)}function oc(e,t,n){let r=z(t);return P(e,r,n)}function da(e,t,n){return t===n?g(e):$()}function sI(e,t,n){return A(n)?da(e,t,n.const):Ve(n)?g(e):L(e,O(t),n)}function mI(e,t,n){return A(n)?da(e,t,n.const):Se(n)?g(e):L(e,O(t),n)}function pI(e,t,n){return A(n)?da(e,t,n.const):X(n)?g(e):L(e,O(t),n)}function uI(e,t,n){return A(n)?da(e,t,n.const):ge(n)?g(e):L(e,O(t),n)}function ic(e,t,n){return i.IsBigInt(t.const)?sI(e,t.const,n):i.IsBoolean(t.const)?mI(e,t.const,n):i.IsNumber(t.const)?pI(e,t.const,n):i.IsString(t.const)?uI(e,t.const,n):Y()}function sc(e,t,n){return H(n)?L(e,t,n):g(e)}function mc(e,t,n){return Yt(n)?g(e):L(e,t,n)}function pc(e,t,n){return X(n)?g(e):L(e,t,n)}function cI(e,t,n){return le(t)?le(n)?g(e):$():g(e)}function lI(e,t,n){return H(n)&&yt(n.extends)?$():U(P(e,t,n),r=>cI(r,t,n),()=>$())}function dI(e,t){return e.reduce((n,r)=>r in t?on(t[r])?{...n,...t[r].inferred}:Y():Y(),{})}function fI(e,t,n){let r={};for(let m of i.Keys(n))r[m]=m in t?lI({},t[m],n[m]):le(n[m])?H(n[m])?g(p.Assign(e,{[n[m].name]:n[m].extends})):g(e):$();let a=i.Values(r).every(m=>on(m)),s=a?dI(i.Keys(r),r):{};return a?g(s):$()}function hI(e,t,n){let r=fI(e,t,n);return on(r)?g(p.Assign(e,r.inferred)):$()}function gI(e,t,n){return hI(e,t,n)}function yI(e,t){return i.Keys(t).reduce((n,r)=>({...n,[r]:i.HasPropertyKey(e,r)?x(n[r])?k([...n[r].anyOf,t[r]]):k([e[r],t[r]]):t[r]}),e)}function uc(e,t,n,r){return i.ShiftLeft(t,(a,s)=>U(P({},e[a],n),m=>uc(e,s,n,yI(r,m)),()=>$()),()=>g(r))}function xI(e,t,n,r){let a=i.Keys(t);return uc(t,a,r,e)}function cc(e,t,n){return pe(n)?xI(e,t,Ce(n),ye(n)):M(n)?gI(e,t,n.properties):L(e,v(t),n)}function II(e,t){return i.IsEqual(i.Keys(t).length,0)?g(e):$()}function bI(e,t,n,r,a){return P(e,n,a)}function lc(e,t,n,r){return pe(r)?bI(e,qr(t),n,qr(Ce(r)),ye(r)):M(r)?II(e,r.properties):J(r)?g(e):te(r)?g(e):$()}function dc(e,t,n){return ge(n)?g(e):L(e,t,n)}function fc(e,t,n){return xt(n)?g(e):L(e,t,n)}function hc(e,t,n){let r=Ie(t);return P(e,r,n)}function fo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function _n(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"name")&&i.HasPropertyKey(e,"type")&&i.IsEqual(e["~kind"],"Inferrable")&&i.IsString(e.name)&&i.IsObject(e.type)}function ho(e){return vt(e)?H(e.items)?K(e.items.extends)?fo(e.items.name,e.items.extends.items):te(e.items.extends)?fo(e.items.name,e.items.extends):void 0:Y():void 0}function fa(e){return H(e)?fo(e.name,e.extends):void 0}function go(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>U(P({},r,t),()=>go(a,t,[...n,r]),()=>{}),()=>n)}function gc(e,t,n,r){let a=go(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:Q(a)})):$()}function ha(e,t,n,r){let a=go(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:k(a)})):$()}function vI(e){return[...e].reverse()}function yo(e,t){return t?vI(e):e}function $I(e){let t=e.length>0?e[0]:void 0,n=ee(t)?ho(t):void 0;return ee(n)}function TI(e,t,n,r,a,s){return U(P(e,n,a),m=>yc(m,t,r,s),()=>$())}function kI(e,t,n,r,a){let s=ho(r);return _n(s)?gc(e,s.name,yo(n,t),s.type):i.ShiftLeft(n,(m,c)=>TI(e,t,m,c,r,a),()=>$())}function wI(e,t,n,r){return i.ShiftLeft(r,(a,s)=>kI(e,t,n,a,s),()=>i.IsEqual(n.length,0)?g(e):$())}function yc(e,t,n,r){return wI(e,t,n,r)}function EI(e,t,n){let r=wt(e,G([],[]),n),a=$I(r);return yc(e,a,yo(t,a),yo(r,a))}function xc(e,t,n){let r=fa(n);return _n(r)?ha(e,r.name,t,r.type):i.ShiftLeft(t,(a,s)=>U(P(e,a,n),m=>xc(m,s,n),()=>$()),()=>g(e))}function Ic(e,t,n){let r=wt(e,G([],[]),t);return j(n)?EI(e,r,n.items):K(n)?xc(e,r,n.items):L(e,Q(r),n)}function bc(e,t,n){return We(n)?g(e):tn(n)?g(e):L(e,t,n)}function vc(e,t,n){return i.ShiftLeft(n,(r,a)=>U(P(e,t,r),s=>g(s),()=>vc(e,t,a)),()=>$())}function xo(e,t,n){return i.ShiftLeft(t,(r,a)=>U(vc(e,r,n),s=>xo(s,a,n),()=>$()),()=>g(e))}function $c(e,t,n){let r=fa(n);return _n(r)?ha(e,r.name,t,r.type):x(n)?xo(e,t,n.anyOf):xo(e,t,[n])}function Tc(e,t,n){return H(n)?L(e,t,n):J(n)?g(e):te(n)?g(e):$()}function kc(e,t,n){return We(n)?g(e):L(e,t,n)}function P(e,t,n){return J(t)?Ju(e,t,n):K(t)?Xu(e,t,t.items,n):Ve(t)?Zu(e,t,n):Se(t)?Qu(e,t,n):ne(t)?ec(e,t.parameters,t.instanceType,n):V(t)?tc(e,t.if,t.then,t.else,n):fe(t)?nc(e,t.enum,n):re(t)?rc(e,t.parameters,t.returnType,n):he(t)?ac(e,t,n):S(t)?oc(e,t.allOf,n):A(t)?ic(e,t,n):yt(t)?sc(e,t,n):Yt(t)?mc(e,t,n):X(t)?pc(e,t,n):M(t)?cc(e,t.properties,n):pe(t)?lc(e,Ce(t),ye(t),n):ge(t)?dc(e,t,n):xt(t)?fc(e,t,n):Z(t)?hc(e,t.pattern,n):j(t)?Ic(e,t.items,n):tn(t)?bc(e,t,n):x(t)?$c(e,t.anyOf,n):te(t)?Tc(e,t,n):We(t)?kc(e,t,n):$()}function RI(e,t){return z([...e,v(t)])}function Io(e,t,n){return T(e)?p.Update(RI(e,t),{},n):qn(e,t,n)}function wc(e,t,n,r,a){let s=we(e,t,n),m=zn(e,t,r);return Io(s,m,a)}function qn(e,t,n={}){return I("Interface",[e,t],n)}function sn(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function Ec(e,t,n={}){return Io(e,t,n)}function SI(e,t,n){return e.includes(n)?!0:Bn([...e,n],t,t[n])}function Rc(e,t,n){let r=br(n);return Gt(e,t,r)}function Gt(e,t,n){return i.ShiftLeft(n,(r,a)=>Bn(e,t,r)?!0:Gt(e,t,a),()=>!1)}function Bn(e,t,n){return ae(n)?SI(e,t,n.$ref):K(n)?Bn(e,t,n.items):ne(n)?Gt(e,t,[...n.parameters,n.instanceType]):re(n)?Gt(e,t,[...n.parameters,n.returnType]):sn(n)?Rc(e,t,n.parameters[1]):S(n)?Gt(e,t,n.allOf):M(n)?Rc(e,t,n.properties):x(n)?Gt(e,t,n.anyOf):j(n)?Gt(e,t,n.items):pe(n)?Bn(e,t,ye(n)):!1}function Sc(e,t,n){return Bn(e,t,n)}function OI(e,t){return t.reduce((n,r)=>Sc([r],e,e[r])?[...n,r]:n,[])}function Oc(e){let t=Ir(e);return OI(e,t)}function PI(e,t,n){return n.includes(t)?n:t in e?Vn(e,e[t],[...n,t]):Y()}function Pc(e,t,n){let r=br(t);return mn(e,r,n)}function mn(e,t,n){return t.reduce((r,a)=>Vn(e,a,r),n)}function Vn(e,t,n){return ae(t)?PI(e,t.$ref,n):K(t)?Vn(e,t.items,n):ne(t)?mn(e,[...t.parameters,t.instanceType],n):re(t)?mn(e,[...t.parameters,t.returnType],n):sn(t)?Pc(e,t.parameters[1],n):S(t)?mn(e,t.allOf,n):M(t)?Pc(e,t.properties,n):x(t)?mn(e,t.anyOf,n):j(t)?mn(e,t.items,n):pe(t)?Vn(e,ye(t),n):n}function Cc(e,t,n){return Vn(e,n,[t])}function CI(e){return Vt()}function MI(e){return i.Keys(e).reduce((t,n)=>({...t,[n]:Ut(e[n])}),{})}function Wn(e){return e.reduce((t,n)=>[...t,Ut(n)],[])}function Ut(e){return ae(e)?CI(e.$ref):K(e)?Te(Ut(e.items),xr(e)):ne(e)?Ge(Wn(e.parameters),Ut(e.instanceType)):re(e)?Ue(Wn(e.parameters),Ut(e.returnType)):S(e)?de(Wn(e.allOf)):M(e)?v(MI(e.properties)):pe(e)?Lr(Qt(e),Ut(ye(e))):x(e)?k(Wn(e.anyOf)):j(e)?Q(Wn(e.items)):e}function AI(e,t){return t in e?Ut(e[t]):oe()}function Mc(e){return AI(e.$defs,e.$ref)}function LI(e,t,n){let r=we(e,G([],[]),t),a=zn({},G([],[]),n);return z([...r,v(a)])}function qI(e,t){return i.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let s=e[a],m=sn(s)?LI(e,s.parameters[0],s.parameters[1]):s;return{...r,[a]:m}},{})}function Ac(e,t,n){let r=Cc(e,t,n),a=qI(e,r);return _e(a,t)}function Lc(e,t){return t in e?ae(e[t])?Lc(e,e[t].$ref):e[t]:q()}function He(e,t){return Lc(e,t)}function qc(e){return se(e)?Mc(e):vr(e)?oe():e}function me(e,t,n){let r=qc(t),a=qc(n);return P(e,r,a)}var On="equal",jI="disjoint",Pn="left-inside",Cn="right-inside";function Xt(e,t){let n=[te(e)?b.ExtendsFalse():me({},e,t),te(e)?b.ExtendsTrue({}):me({},t,e)];return b.IsExtendsTrueLike(n[0])&&b.IsExtendsTrueLike(n[1])?On:b.IsExtendsTrueLike(n[0])&&b.IsExtendsFalse(n[1])?Pn:b.IsExtendsFalse(n[0])&&b.IsExtendsTrueLike(n[1])?Cn:jI}function FI(e,t){return t.filter(n=>Xt(e,n)!==Cn)}function DI(e,t){let n=t.some(r=>{let a=Xt(e,r);return i.IsEqual(a,Pn)||i.IsEqual(a,On)});return i.IsEqual(n,!1)}function NI(e,t){let n=Pe(e);return J(n)?[n]:DI(n,t)?[...FI(n,t),n]:t}function GI(e){return e.reduce((t,n)=>M(n)?[...t,n]:yt(n)?t:NI(n,t),[])}function Ja(e){let t=GI(e);return An(t)}function bo(e,t){return p.Update(Pe(e),{},t)}function jc(e,t,n,r){let a=d(e,t,n);return bo(a,r)}function Hn(e,t=[]){return ht(e)&&i.IsEqual(e.action,"Conditional")?ae(e.parameters[0])?Hn(e.parameters[2],Hn(e.parameters[3],[...t,e.parameters[0].$ref])):Hn(e.parameters[2],Hn(e.parameters[3],t)):ht(e)&&i.IsEqual(e.action,"Mapped")&&ht(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&ae(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function UI(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function Nc(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>i.ShiftLeft(t,(s,m)=>Nc(a,m,[...n,[s,r]]),()=>n),()=>n)}function KI(e){return x(e)?[...e.anyOf]:[e]}function _I(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Fc(e,t){return t.reduce((n,r)=>[...n,..._I(e,r)],[])}function Dc(e){return e.reduce((t,n)=>i.IsEqual(n[0],!0)?Fc(t,KI(n[1])):Fc(t,[n[1]]),[[]])}function Gc(e,t,n){let r=Hn(n),a=UI(e,r),s=Nc(t,a);return ht(n)&&i.IsEqual(n.action,"Conditional")||ht(n)&&i.IsEqual(n.action,"Mapped")?Dc(s):[t]}function zI(){return["(not-resolvable)",q()]}function BI(){return["(not-generic)",q()]}function VI(e,t,n){return[e,gt(t,n)]}function WI(e,t,n){return t in e?Uc(e,t,e[t],n):zI()}function Uc(e,t,n,r){return Bt(n)?VI(t,n.parameters,n.expression):ae(n)?WI(e,n.$ref,r):BI()}function Kc(e,t,n){return Uc(e,"(anonymous)",t,n)}function HI(e,t,n){if(H(t)||pn(t)||b.IsExtendsTrueLike(me({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function _c(e,t,n,r,a){let s=d(e,t,a);return HI(n,s,r),p.Assign(e,{[n]:s})}function YI(e,t,n,r,a){let s=d(e,t,n.extends),m=d(e,t,n.equals);return i.ShiftLeft(a,(c,l)=>vo(_c(e,t,n.name,s,c),t,r,l),()=>vo(_c(e,t,n.name,s,m),t,r,[]))}function vo(e,t,n,r){return i.ShiftLeft(n,(a,s)=>YI(e,t,a,s,r),()=>e)}function zc(e,t,n,r){return vo(e,t,n,r)}function JI(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function XI(e,t){return i.IsEqual(JI(e),t)}function ZI(e,t,n,r,a,s){let m=zc(e,t,r,s),c=d(m,G([...t.callstack,n.$ref],t.visited),a);return d(m,G([],[]),c)}function QI(e,t,n,r,a,s){return s.reduce((m,c)=>[...m,ZI(e,t,n,r,a,c)],[])}function eb(e,t,n,r,a,s){let m=Gc(r,s,a),c=QI(e,t,n,r,a,m);return i.IsEqual(c.length,1)?c[0]:ve(c)}function ga(e,t,n,r){let a=we(e,t,r),s=Kc(e,n,r),m=s[0],c=s[1];return Bt(c)?XI(t,m)?jn(ot(m),a):eb(e,t,ot(m),c.parameters,c.expression,a):jn(n,a)}function jn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Bc(e,t){return ga({},G([],[]),e,t)}function pn(e){return y(e,"Call")}function tb(e){return p.Discard(e,["~immutable"])}function Vc(e,t){return p.Update(tb(e),{},t)}function Wc(e,t,n,r){let a=d(e,t,n);return Vc(a,r)}function Hc(e,t){return e(t)}function Yc(e,t){return i.IsString(t)?O(Hc(e,t)):O(t)}function Jc(e,t){let n=Ie(t);return mt(e,n)}function Xc(e,t){let n=t.map(r=>mt(e,r));return k(n)}function mt(e,t){return A(t)?Yc(e,t.const):Z(t)?Jc(e,t.pattern):x(t)?Xc(e,t.anyOf):t}function Gr(e,t={}){return I("Capitalize",[e],t)}function Zc(e,t={}){return $o(e,t)}function Ur(e,t={}){return I("Lowercase",[e],t)}function Qc(e,t={}){return To(e,t)}function Kr(e,t={}){return I("Uncapitalize",[e],t)}function el(e,t={}){return ko(e,t)}function _r(e,t={}){return I("Uppercase",[e],t)}function tl(e,t={}){return wo(e,t)}var nb=e=>e[0].toUpperCase()+e.slice(1),rb=e=>e.toLowerCase(),ab=e=>e[0].toLowerCase()+e.slice(1),ob=e=>e.toUpperCase();function $o(e,t){return T([e])?p.Update(mt(nb,e),{},t):Gr(e,t)}function To(e,t){return T([e])?p.Update(mt(rb,e),{},t):Ur(e,t)}function ko(e,t){return T([e])?p.Update(mt(ab,e),{},t):Kr(e,t)}function wo(e,t){return T([e])?p.Update(mt(ob,e),{},t):_r(e,t)}function nl(e,t,n,r){let a=d(e,t,n);return $o(a,r)}function rl(e,t,n,r){let a=d(e,t,n);return To(a,r)}function al(e,t,n,r){let a=d(e,t,n);return ko(a,r)}function ol(e,t,n,r){let a=d(e,t,n);return wo(a,r)}function zr(e,t,n,r,a={}){return I("Conditional",[e,t,n,r],a)}function il(e,t,n,r,a={}){return Eo({},G([],[]),e,t,n,r,a)}function ib(e,t,n,r,a,s){let m=me(e,n,r);return b.IsExtendsUnion(m)?k([d(m.inferred,t,a),d(e,t,s)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,s)}function Eo(e,t,n,r,a,s,m){return T([n,r])?p.Update(ib(e,t,n,r,a,s),{},m):zr(n,r,a,s,m)}function sl(e,t,n,r,a,s,m){let c=d(e,t,n),l=d(e,t,r);return Eo(e,t,c,l,a,s,m)}function Br(e,t={}){return I("ConstructorParameters",[e],t)}function ml(e,t={}){return Ro(e,t)}function sb(e){let t=ne(e)?e.parameters:[],n=wt({},G([],[]),t);return Q(n)}function Ro(e,t){return T([e])?p.Update(sb(e),{},t):Br(e,t)}function pl(e,t,n,r){let a=d(e,t,n);return Ro(a,r)}function Vr(e,t,n={}){return I("Exclude",[e,t],n)}function ul(e,t,n={}){return Yn(e,t,n)}function Yn(e,t,n){return T([e,t])?p.Update(Mr(e,t),{},n):Vr(e,t,n)}function cl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Yn(s,m,a)}function Wr(e,t,n={}){return I("Extract",[e,t],n)}function ll(e,t,n={}){return So(e,t,n)}function mb(e,t){let n=me({},e,t);return b.IsExtendsTrueLike(n)?[e]:[]}function pb(e,t){return e.reduce((n,r)=>[...n,...mb(r,t)],[])}function dl(e,t){let n=Pe(e),r=x(n)?n.anyOf:[n],a=pb(r,t);return ve(a)}function So(e,t,n){return T([e,t])?p.Update(dl(e,t),{},n):Wr(e,t,n)}function fl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return So(s,m,a)}function ub(e){return e.reduce((t,n)=>Er(n)?[...t,O(n)]:t,[])}function un(e){let t=ub(e);return k(t)}function Fn(e,t,n={}){return I("Index",[e,t],n)}function hl(e,t,n={}){let r=i.IsArray(t)?un(t):t;return Oo(e,r,n)}function gl(e,t){let n=He(e,t);return Ee(n)}function yl(e,t,n){let r=Fe(e,t,n);return Ee(r)}function cb(e,t){let n=i.Keys(e).filter(f=>!i.HasPropertyKey(t,f)),r=i.Keys(t).filter(f=>!i.HasPropertyKey(e,f)),a=i.Keys(e).filter(f=>i.HasPropertyKey(t,f)),s=n.reduce((f,w)=>({...f,[w]:e[w]}),{}),m=r.reduce((f,w)=>({...f,[w]:t[w]}),{}),c=a.reduce((f,w)=>({...f,[w]:z([e[w],t[w]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function xl(e){return e.reduce((t,n)=>cb(t,Ee(n)),{})}function Il(e){let t=ks(Q(e));return Ee(t)}function lb(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:ve([e[s],t[s]])}),{})}function bl(e,t){return i.ShiftLeft(e,(n,r)=>bl(r,lb(t,Ee(n))),()=>t)}function vl(e){return i.ShiftLeft(e,(t,n)=>bl(n,Ee(t)),()=>Y())}function Ee(e){return se(e)?gl(e.$defs,e.$ref):V(e)?yl(e.if,e.then,e.else):S(e)?xl(e.allOf):x(e)?vl(e.anyOf):j(e)?Il(e.items):M(e)?e.properties:{}}function cn(e){let t=Ee(e);return v(t)}var db=new RegExp("^(?:0|[1-9][0-9]*)$");function ln(e){let t=`${e}`;return db.test(t)?parseInt(t):e}function fb(e){return O(ln(e))}function $l(e){return e.map(t=>Tl(t))}function Tl(e){return S(e)?de($l(e.allOf)):x(e)?k($l(e.anyOf)):A(e)?fb(e.const):e}function kl(e,t){let n=Tl(t),r=me({},n,be());return b.IsExtendsTrueLike(r)?e:A(t)&&i.IsEqual(t.const,"length")?be():q()}function wl(e,t){let n=He(e,t);return $e(n)}function El(e,t,n){let r=Fe(e,t,n);return $e(r)}function Rl(e){let t=ke(e);return $e(t)}function Sl(e){let t=z(e);return $e(t)}function Ol(e){return[`${e}`]}function Pl(e){let t=Ie(e);return $e(t)}function Cl(e){return e.reduce((t,n)=>[...t,...$e(n)],[])}function $e(e){return se(e)?wl(e.$defs,e.$ref):V(e)?El(e.if,e.then,e.else):fe(e)?Rl(e.enum):S(e)?Sl(e.allOf):A(e)?Ol(e.const):Z(e)?Pl(e.pattern):x(e)?Cl(e.anyOf):[]}function dn(e){return $e(e)}function Jn(e,t){return t.map(n=>Xn(e,n))}function Xn(e,t){return K(t)?Te(Xn(e,t.items)):ne(t)?Ge(Jn(e,t.parameters),Xn(e,t.instanceType)):re(t)?Ue(Jn(e,t.parameters),Xn(e,t.returnType)):j(t)?Q(Jn(e,t.items)):x(t)?k(Jn(e,t.anyOf)):S(t)?de(Jn(e,t.allOf)):Fr(t)?v(e):t}function Ml(e,t){return Xn(e,t)}function hb(e,t){let n=t in e?e[t]:q();return Ml(e,n)}function Al(e,t){return t.reduce((n,r)=>[...n,hb(e,r)],[])}function gb(e,t){let n=dn(t),r=Al(e,n);return ve(r)}var yb=new RegExp(bt);function xb(e){return e.filter(n=>yb.test(n))}function Ib(e){let t=Ir(e),n=xb(t),r=Al(e,n);return ve(r)}function Ll(e,t){return X(t)?Ib(e):gb(e,t)}function bb(e){return O(ln(e))}function ql(e){return e.map(t=>Po(t))}function Po(e){return S(e)?de(ql(e.allOf)):x(e)?k(ql(e.anyOf)):A(e)?bb(e.const):e}function vb(e,t){return e.reduceRight((n,r,a)=>{let s=me({},O(a),t);return b.IsExtendsTrueLike(s)?[r,...n]:n},[])}function $b(e,t){let n=Po(t),r=vb(e,n);return it(r)}function Tb(e){return it(e)}function jl(e,t){return A(t)&&i.IsEqual(t.const,"length")?O(e.length):X(t)||he(t)?Tb(e):$b(e,t)}function Fl(e,t){return K(e)?kl(e.items,t):M(e)?Ll(e.properties,t):j(e)?jl(e.items,t):q()}function kb(e){return se(e)||V(e)||S(e)||x(e)?cn(e):e}function Oo(e,t,n){return T([e,t])?p.Update(Fl(kb(e),t),{},n):Fn(e,t,n)}function Dl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Oo(s,m,a)}function Hr(e,t={}){return I("InstanceType",[e],t)}function Nl(e,t={}){return Co(e,t)}function wb(e){return ne(e)?e.instanceType:q()}function Co(e,t){return T([e])?p.Update(wb(e),{},t):Hr(e,t)}function Gl(e,t,n,r={}){let a=d(e,t,n);return Co(a,r)}function Dn(e,t={}){return I("KeyOf",[e],t)}function Ul(e,t={}){return Mo(e,t)}function Kl(){return k([be(),Oe(),Jt()])}function _l(e){return be()}function Eb(e){return e.reduce((n,r)=>Er(r)?[...n,O(ln(r))]:Y(),[])}function zl(e){let t=i.Keys(e),n=Eb(t);return it(n)}function Bl(e){return Qt(e)}function Vl(e){let t=e.map((n,r)=>O(r));return it(t)}function Wl(e){return J(e)?Kl():K(e)?_l(e.items):M(e)?zl(e.properties):pe(e)?Bl(e):j(e)?Vl(e.items):q()}function Rb(e){return se(e)||V(e)||S(e)||x(e)?cn(e):e}function Mo(e,t){return T([e])?p.Update(Wl(Rb(e)),{},t):Dn(e,t)}function Hl(e,t,n,r){let a=d(e,t,n);return Mo(a,r)}function Ln(e,t,n,r,a={}){return I("Mapped",[e,t,n,r],a)}function Yl(e,t,n,r,a={}){return Ao({},G([],[]),e,t,n,r,a)}function Sb(e){let t=Ie(e);return ya(t)}function Ob(e){return e.reduce((t,n)=>[...t,...ya(n)],[])}function Pb(e){let t=ke(e);return ya(t)}function Cb(e){return i.IsNumber(e)?[O(`${e}`)]:[O(e)]}function ya(e){return fe(e)?Pb(e.enum):A(e)?Cb(e.const):Z(e)?Sb(e.pattern):x(e)?Ob(e.anyOf):[e]}function Jl(e){return ya(e)}function Mb(e){return Z(e)?Ie(e.pattern):e}function Ab(e,t,n,r,a,s){let m=p.Assign(e,{[n.name]:r}),c=d(m,t,a),l=Mb(c),h=d(m,t,s);return as(l)||os(l)?{[l.const]:h}:{}}function Lb(e,t,n,r,a,s){return r.reduce((m,c)=>[...m,Ab(e,t,n,c,a,s)],[])}function qb(e){return e.reduce((t,n)=>[...t,v(n)],[])}function Xl(e,t,n,r,a,s){let m=Jl(r),c=Lb(e,t,n,m,a,s),l=qb(c);return z(l)}function Ao(e,t,n,r,a,s,m){return T([r])?p.Update(Xl(e,t,n,r,a,s),{},m):Ln(n,r,a,s,m)}function Zl(e,t,n,r,a,s,m){let c=d(e,t,r);return Ao(e,t,n,c,a,s,m)}function jb(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>n.includes(s)).reduce((s,m)=>({...s,[m]:Ac(r,m,t[m])}),{})}function Fb(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>!n.includes(s)).reduce((s,m)=>({...s,[m]:d(r,G([],[]),t[m])}),{})}function Db(e,t,n){let r=Oc(t),a=jb(e,t,r),s=Fb(e,t,r),m={...a,...s};return p.Update(m,{},n)}function xa(e,t,n,r){return Db(e,n,r)}function Yr(e,t={}){return I("NonNullable",[e],t)}function Ql(e,t={}){return Lo(e,t)}function Nb(e){let t=k([Ht(),en()]);return Yn(e,t,{})}function Lo(e,t){return T([e])?p.Update(Nb(e),{},t):Yr(e,t)}function ed(e,t,n,r){let a=d(e,t,n);return Lo(a,r)}function Jr(e,t,n={}){return I("Omit",[e,t],n)}function td(e,t,n={}){let r=i.IsArray(t)?un(t):t;return qo(e,r,n)}function Ia(e){let t=cn(e);return M(t)?t.properties:Y()}function Gb(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function nd(e,t){let n=Ia(e),r=dn(t),a=Gb(n,r);return v(a)}function qo(e,t,n){return T([e,t])?p.Update(nd(e,t),{},n):Jr(e,t,n)}function rd(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return qo(s,m,a)}function Xr(e,t={}){return I("Parameters",[e],t)}function ad(e,t={}){return jo(e,t)}function Ub(e){let t=re(e)?e.parameters:[],n=wt({},G([],[]),t);return Q(n)}function jo(e,t){return T([e])?p.Update(Ub(e),{},t):Xr(e,t)}function od(e,t,n,r){let a=d(e,t,n);return jo(a,r)}function Zr(e,t={}){return I("Partial",[e],t)}function id(e,t={}){return Fo(e,t)}function sd(e,t){let n=He(e,t),r=Ye(n);return _e(p.Assign(e,{[t]:r}),t)}function md(e,t,n){let r=Fe(e,t,n);return Ye(r)}function pd(e){let t=z(e);return Ye(t)}function ud(e){let t=e.map(n=>Ye(n));return k(t)}function cd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Ct(e[a])}),{});return v(t)}function Ye(e){return se(e)?sd(e.$defs,e.$ref):V(e)?md(e.if,e.then,e.else):S(e)?pd(e.allOf):x(e)?ud(e.anyOf):M(e)?cd(e.properties):v({})}function Fo(e,t){return T([e])?p.Update(Ye(e),{},t):Zr(e,t)}function ld(e,t,n,r){let a=d(e,t,n);return Fo(a,r)}function Qr(e,t,n={}){return I("Pick",[e,t],n)}function dd(e,t,n={}){let r=i.IsArray(t)?un(t):t;return Do(e,r,n)}function Kb(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function fd(e,t){let n=Ia(e),r=dn(t),a=Kb(n,r);return v(a)}function Do(e,t,n){return T([e,t])?p.Update(fd(e,t),{},n):Qr(e,t,n)}function hd(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Do(s,m,a)}function ea(e,t={}){return I("ReadonlyObject",[e],t)}function No(e,t={}){return Go(e,t)}var gd=No;function yd(e){return Wt(Te(e))}function xd(e,t){let n=He(e,t),r=Je(n);return _e(p.Assign(e,{[t]:r}),t)}function Id(e,t,n){let r=Fe(e,t,n);return Je(r)}function bd(e){let t=z(e);return Je(t)}function vd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Lt(e[a])}),{});return v(t)}function $d(e){return Wt(Q(e))}function Td(e){let t=e.map(n=>Je(n));return k(t)}function Je(e){return K(e)?yd(e.items):se(e)?xd(e.$defs,e.$ref):V(e)?Id(e.if,e.then,e.else):S(e)?bd(e.allOf):M(e)?vd(e.properties):j(e)?$d(e.items):x(e)?Td(e.anyOf):e}function Go(e,t){return T([e])?p.Update(Je(e),{},t):ea(e)}function kd(e,t,n,r){let a=d(e,t,n);return Go(a,r)}function wd(e,t,n,r){return t.visited.includes(r)?n:r in e?d(e,G(t.callstack,[...t.visited,r]),e[r]):n}function Ed(e,t){let n=He(e,t),r=Xe(n);return _e(p.Assign(e,{[t]:r}),t)}function Rd(e,t,n){let r=Fe(e,t,n);return Xe(r)}function Sd(e){let t=z(e);return Xe(t)}function Od(e){let t=e.map(n=>Xe(n));return k(t)}function Pd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Cr(e[a])}),{});return v(t)}function Xe(e){return se(e)?Ed(e.$defs,e.$ref):V(e)?Rd(e.if,e.then,e.else):S(e)?Sd(e.allOf):x(e)?Od(e.anyOf):M(e)?Pd(e.properties):v({})}function ta(e,t={}){return I("Required",[e],t)}function Cd(e,t={}){return Uo(e,t)}function Uo(e,t){return T([e])?p.Update(Xe(e),{},t):ta(e,t)}function Md(e,t,n,r){let a=d(e,t,n);return Uo(a,r)}function na(e,t={}){return I("ReturnType",[e],t)}function Ad(e,t={}){return Ko(e,t)}function _b(e){return re(e)?e.returnType:q()}function Ko(e,t){return T([e])?p.Update(_b(e),{},t):na(e,t)}function Ld(e,t,n,r={}){let a=d(e,t,n);return Ko(a,r)}function ra(e,t){return I("With",[e,t],{})}function qd(e,t){return _o(e,t)}function _o(e,t){return T([e])?p.Update(e,{},t):ra(e,t)}function jd(e,t,n,r){let a=d(e,t,n);return _o(a,r)}function zb(e){return vt(e)?j(e.items)?zo(e.items.items):H(e.items)?[e]:ae(e.items)?[e]:[q()]:[e]}function zo(e){return e.reduce((n,r)=>[...n,...zb(r)],[])}function G(e,t){return{callstack:e,visited:t}}function T(e){return i.ShiftLeft(e,(t,n)=>ae(t)?!1:T(n),()=>!0)}function zn(e,t,n){return i.Keys(n).reduce((r,a)=>({...r,[a]:d(e,t,n[a])}),{})}function wt(e,t,n){let r=we(e,t,n);return zo(r)}function we(e,t,n){return n.map(r=>d(e,t,r))}function Bb(e,t){let n=le(e)?$n(t,{}):t,r=qt(e)?vn(n,{}):n;return At(e)?Zn(r,{}):r}function Vb(e,t,n,r,a){return i.IsEqual(n,"AddImmutable")?Fd(e,t,r[0],a):i.IsEqual(n,"RemoveImmutable")?Wc(e,t,r[0],a):i.IsEqual(n,"AddReadonly")?Ai(e,t,r[0],a):i.IsEqual(n,"RemoveReadonly")?Is(e,t,r[0],a):i.IsEqual(n,"AddOptional")?Li(e,t,r[0],a):i.IsEqual(n,"RemoveOptional")?$s(e,t,r[0],a):i.IsEqual(n,"Capitalize")?nl(e,t,r[0],a):i.IsEqual(n,"Conditional")?sl(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"ConstructorParameters")?pl(e,t,r[0],a):i.IsEqual(n,"Evaluate")?jc(e,t,r[0],a):i.IsEqual(n,"Exclude")?cl(e,t,r[0],r[1],a):i.IsEqual(n,"Extract")?fl(e,t,r[0],r[1],a):i.IsEqual(n,"Index")?Dl(e,t,r[0],r[1],a):i.IsEqual(n,"InstanceType")?Gl(e,t,r[0],a):i.IsEqual(n,"Interface")?wc(e,t,r[0],r[1],a):i.IsEqual(n,"KeyOf")?Hl(e,t,r[0],a):i.IsEqual(n,"Lowercase")?rl(e,t,r[0],a):i.IsEqual(n,"Mapped")?Zl(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"Module")?xa(e,t,r[0],a):i.IsEqual(n,"NonNullable")?ed(e,t,r[0],a):i.IsEqual(n,"Pick")?hd(e,t,r[0],r[1],a):i.IsEqual(n,"Parameters")?od(e,t,r[0],a):i.IsEqual(n,"Partial")?ld(e,t,r[0],a):i.IsEqual(n,"Omit")?rd(e,t,r[0],r[1],a):i.IsEqual(n,"ReadonlyObject")?kd(e,t,r[0],a):i.IsEqual(n,"Record")?Ns(e,t,r[0],r[1],a):i.IsEqual(n,"Required")?Md(e,t,r[0],a):i.IsEqual(n,"ReturnType")?Ld(e,t,r[0],a):i.IsEqual(n,"TemplateLiteral")?_u(e,t,r[0],a):i.IsEqual(n,"Uncapitalize")?al(e,t,r[0],a):i.IsEqual(n,"Uppercase")?ol(e,t,r[0],a):i.IsEqual(n,"With")?jd(e,t,r[0],r[1]):I(n,r,a)}function Wb(e,t,n){let r=ae(n)?wd(e,t,n,n.$ref):K(n)?Te(d(e,t,n.items),xr(n)):pn(n)?ga(e,t,n.target,n.arguments):ne(n)?Ge(we(e,t,n.parameters),d(e,t,n.instanceType),qi(n)):re(n)?Ue(we(e,t,n.parameters),d(e,t,n.returnType),ji(n)):V(n)?Mt(d(e,t,n.if),d(e,t,n.then),d(e,t,n.else),Ki(n)):S(n)?de(we(e,t,n.allOf),Wi(n)):M(n)?v(zn(e,t,n.properties),Gi(n)):pe(n)?Gs(Ce(n),d(e,t,ye(n))):vt(n)?Dt(d(e,t,n.items)):j(n)?Q(wt(e,t,n.items),xs(n)):x(n)?k(we(e,t,n.anyOf),ss(n)):n;return Bb(n,r)}function d(e,t,n){return ht(n)?Vb(e,t,n.action,n.parameters,n.options):Wb(e,t,n)}function Bo(e,t){return d(e,G([],[]),t)}function Hb(e){return p.Update(e,{"~immutable":!0},{})}function Zn(e,t){return p.Update(Hb(e),{},t)}function Fd(e,t,n,r){let a=d(e,t,n);return Zn(a,r)}function Up(e,t={}){return I("AddImmutable",[e],t)}function Wt(e,t={}){return Zn(e,t)}function Kp(e,t={}){return I("Evaluate",[e],t)}function Dd(e,t={}){return bo(e,t)}function _p(e,t={}){return I("Module",[e],t)}function Nd(e,t={}){return xa({},G([],[]),e,t)}function Gd(...e){let[t,n,r]=ze.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Du(n),s=i.IsArray(a)&&i.IsEqual(a.length,2)?d(t,G([],[]),a[0]):q();return p.Update(s,{},r)}var F={};Rt(F,{Any:()=>Vt,Array:()=>Te,BigInt:()=>En,Boolean:()=>kr,Call:()=>Bc,Capitalize:()=>Zc,Codec:()=>Tr,Conditional:()=>il,Constructor:()=>Ge,ConstructorParameters:()=>ml,Cyclic:()=>_e,Decode:()=>Xi,DecodeBuilder:()=>wn,Dependent:()=>Mt,Encode:()=>Zi,EncodeBuilder:()=>kn,Enum:()=>Vi,Evaluate:()=>Dd,Exclude:()=>ul,Extends:()=>me,ExtendsResult:()=>b,Extract:()=>ll,Function:()=>Ue,Generic:()=>gt,Identifier:()=>Rn,Immutable:()=>Qi,Index:()=>hl,Infer:()=>Tn,InstanceType:()=>Nl,Instantiate:()=>Bo,Integer:()=>jt,Interface:()=>Ec,Intersect:()=>de,IsAny:()=>J,IsArray:()=>K,IsBigInt:()=>Ve,IsBoolean:()=>Se,IsCall:()=>pn,IsCodec:()=>$r,IsConstructor:()=>ne,IsCyclic:()=>se,IsDependent:()=>V,IsEnum:()=>fe,IsEnumValue:()=>Bi,IsFunction:()=>re,IsGeneric:()=>Bt,IsIdentifier:()=>rs,IsImmutable:()=>At,IsInfer:()=>H,IsInteger:()=>he,IsIntersect:()=>S,IsKind:()=>y,IsLiteral:()=>A,IsNever:()=>yt,IsNull:()=>Yt,IsNumber:()=>X,IsObject:()=>M,IsOptional:()=>le,IsParameter:()=>is,IsReadonly:()=>qt,IsRecord:()=>pe,IsRef:()=>ae,IsRefine:()=>za,IsRest:()=>vt,IsSchema:()=>ee,IsString:()=>ge,IsSymbol:()=>xt,IsTemplateLiteral:()=>Z,IsThis:()=>Fr,IsTuple:()=>j,IsUndefined:()=>tn,IsUnion:()=>x,IsUnknown:()=>te,IsUnsafe:()=>vr,IsVoid:()=>We,KeyOf:()=>Ul,Literal:()=>O,Lowercase:()=>Qc,Mapped:()=>Yl,Module:()=>Nd,Never:()=>q,NonNullable:()=>Ql,Null:()=>Ht,Number:()=>be,Object:()=>v,Omit:()=>td,Optional:()=>Di,Parameter:()=>Ft,Parameters:()=>ad,Partial:()=>id,Pick:()=>dd,Readonly:()=>es,ReadonlyObject:()=>No,ReadonlyType:()=>gd,Record:()=>Lr,RecordKey:()=>Qt,RecordPattern:()=>Ce,RecordValue:()=>ye,Ref:()=>ot,Refine:()=>ts,Required:()=>Cd,Rest:()=>Dt,ReturnType:()=>Ad,Script:()=>Gd,String:()=>Oe,Symbol:()=>Jt,TemplateLiteral:()=>Bu,This:()=>jr,Tuple:()=>Q,Uncapitalize:()=>el,Undefined:()=>en,Union:()=>k,Unknown:()=>oe,Unsafe:()=>Ui,Uppercase:()=>tl,Void:()=>Dr,With:()=>qd});var Qn="submit_test_gap_candidates",er="submit_filtered_test_gaps",tr="submit_solver_gaps",x4=F.Object({verdict:F.Union([F.Literal("PASS"),F.Literal("FAIL")],{description:"FAIL only for a genuine blocking issue (clear rubric violation, agent-fault-worthy gap, unfair/undiscoverable test requirement, or a real determinism/regression risk). Optional, minor, or stylistic points are NOT grounds for FAIL \u2014 put those in `notes` instead and use PASS."}),summary:F.String({description:"One short sentence summarizing the verdict."}),reasons:F.Array(F.String(),{description:"Specific BLOCKING justifications only, citing rubric item IDs and concrete evidence from the files you read. Required (non-empty) when verdict is FAIL. Use an empty array when verdict is PASS."}),notes:F.Array(F.String(),{description:"Non-blocking, optional/minor observations or suggested improvements \u2014 the kind of feedback a real reviewer leaves as 'Minor/optional' without failing the task. Include these regardless of verdict; use an empty array if you truly have none."})});var Yb=F.Object({statement:F.String({description:"One sentence from agent_prompt.md, copied verbatim."}),gaps:F.Array(F.Object({description:F.String({description:"A fair, publicly observable missing behavioral test."}),risk:F.String({description:"Why an incorrect implementation could pass the current tests despite this missing behavior."})}),{description:"All candidate positive and negative gaps for this sentence; use an empty array when none exist."})});function Ud(e){return{name:Qn,label:"Submit Candidate Test Gaps",description:"Submit one candidate-gap list for one prompt sentence. Call this after each sentence so the orchestrator can track the todo list; empty lists are required when that sentence has no gaps.",parameters:Yb,async execute(t,n){let r=e.statements??[];return r.push({statement:n.statement,gaps:n.gaps??[]}),e.statements=r,{content:[{type:"text",text:`Recorded ${n.gaps?.length??0} candidate gap(s)`}],details:void 0}}}}var Jb=F.Object({gaps:F.Array(F.Object({description:F.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:F.String({description:"Why this is genuinely grounded in agent_prompt.md or the repo, fair to test per the fairness methodology, and a real (non-duplicate) coverage hole in test.patch \u2014 for negative gaps, cite the prompt's prohibition/constraint and why no existing test catches the forbidden outcome."})}),{description:"The filtered, final list of confirmed test gaps. Use an empty array if none of the candidates survive strict scrutiny."})});function Kd(e){return{name:er,label:"Submit Filtered Test Gaps",description:"Submit your final, strictly filtered list of confirmed test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have independently verified each candidate.",parameters:Jb,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Confirmed ${r.length} gap(s) after filtering`}],details:void 0}}}}var Xb=F.Object({gaps:F.Array(F.Object({description:F.String({description:"The specific behavioral gap: a way one or more solver's diff differs materially from what agent_prompt.md/solution.patch require, despite that solver passing `./test.sh new`."}),justification:F.String({description:"Why this is a genuine requirement from agent_prompt.md or solution.patch (cite the specific requirement/line) that the solver's diff misses, contradicts, or diverges from \u2014 and why the current tests fail to catch that divergence."}),evidence:F.String({description:"Which solver(s) (by index) exhibit this, and the specific part of their diff that grounds the gap."})}),{description:"Concrete, diff-grounded behavioral gaps \u2014 cases where a passing solver's materially different approach reveals that `test.sh new` under-specifies a real requirement. Use an empty array if the solvers converged on equivalent behavior; do not manufacture gaps just to report something."})});function _d(e){return{name:tr,label:"Submit Solver Gaps",description:"Submit your final list of behavioral gaps found by comparing the solver diffs against the real solution.patch. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished comparing every solver.",parameters:Xb,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Recorded ${r.length} solver gap(s)`}],details:void 0}}}}function Zb(e){return[e,"You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the task description given to a coding agent), `test.patch` (a unified diff adding the hidden tests that will grade that agent's solution), and `solution.patch` (a unified diff of one golden/reference solution).","Another specialized agent is searching the complementary direction in parallel \u2014 stay in your lane and do not duplicate its work."]}var Qb=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- Find every gap you can justify with concrete evidence. Do not stop after the first obvious ones \u2014 keep reading until you have systematically covered the prompt, `solution.patch`, and relevant repo context.","- After your first pass, run at least one deliberate second sweep (re-read `agent_prompt.md`, re-scan `solution.patch`, grep the repo) before submitting \u2014 but if that sweep still finds nothing, submit an empty list.","- Do not self-censor or merge distinct genuine gaps into one \u2014 the validator will prune. Never invent or pad the list to seem thorough; an empty array is correct when exhaustive analysis truly finds none.","- Hunt subtle gaps too: partial coverage (asserted once but not under other valid inputs), behaviors implied by repo convention, interaction effects, ordering/timing, and branches visible in `solution.patch` that no test forces.","- Include a candidate only when you can cite specific grounding and a concrete false-pass risk \u2014 not to meet a quota."],zd=["Ground rules \u2014 do not overreach:","- Every gap must trace back to a specific requirement or sentence in `agent_prompt.md`, or to behavior that is unambiguous from the existing, visible repo. Do not invent requirements the prompt doesn't support.","- Do not propose gaps for things `agent_prompt.md` leaves intentionally open, or for implementation details/style the prompt doesn't mandate.","- Read `test.patch` carefully before deciding something is untested \u2014 do not propose a gap that an existing test already covers (even indirectly).","- Keep findings strictly behavioral and publicly observable: a user, caller, or documented public contract must be able to observe the required outcome. Do not report internal helper calls, private state, implementation structure, call order, file placement, or other incidental mechanics.","- Do not require DOM classes, DOM/data/test attributes, selectors, or exact string literals unless the prompt explicitly names them or they are an established, already-present public contract in the repository. Prefer a visible outcome or public API behavior that accepts equivalent implementations."];function Bd(e,t){let n=[...Zb("You are an exhaustive behavioral test-gap finder. Review the task prompt sentence by sentence, finding both missing required-behavior (positive) and missing forbidden/wrong-behavior (negative) tests."),"","First split `agent_prompt.md` into its meaningful sentences using periods (`.`) as the sentence boundary. Create an explicit TODO checklist of every resulting requirement sentence. Work through it one item at a time; do not finish until every item is checked off.","","For each sentence: read `test.patch`, `solution.patch`, and relevant repository context; identify every distinct behavioral edge case or prohibition that the sentence requires but the tests do not catch. A candidate must describe a plausible incorrect implementation that still passes the current suite. Include positive and negative gaps together for that sentence.","",...Qb,"",...zd,"","Test-coverage checklist for calibration:",e];return t&&n.push("","Fairness methodology:",t),n.push("","For every candidate, state the missing fair behavioral test and why the current suite permits the incorrect behavior. Do not propose the exact test implementation.",`After completing EACH TODO sentence, call \`${Qn}\` with that exact sentence and its gap array (including an empty array when none exist). You may and must call the tool multiple times: once per sentence. Only finish after every TODO item has been submitted.`),n.join(`
12
+ `)}function Vd(e,t,n){let r=["You are a strict, skeptical fairness auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","Two specialized research agents reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) sentence by sentence, proposing both positive (missing required-behavior) and negative (missing forbidden/wrong-behavior) gaps. It submitted the following per-sentence candidate report:","",JSON.stringify(e,null,2),"","Your job is to independently re-verify the files yourself and FILTER this list down to only candidates that are ALL of the following:","1. Genuinely grounded \u2014 actually required by a specific statement in `agent_prompt.md`, or unambiguous from clearly visible, existing repo behavior. Drop anything speculative, nice-to-have, or invented beyond what the prompt actually asks for.","2. Fair to test \u2014 verifying it would not require undiscoverable private internals, an invented/unnamed API, or exact incidental structure that only `solution.patch` happens to use. Judge this precisely against the fairness methodology below.","3. A real, distinct coverage hole \u2014 re-check `test.patch` yourself; drop any candidate an existing test already covers, and drop near-duplicate candidates (keep only the clearest phrasing of each distinct gap). For negative-case candidates, keep them only if `test.patch` does not already assert that the forbidden/wrong outcome does not occur.","4. Behaviorally testable through a public contract \u2014 drop candidates that would require an internal helper, private state, implementation structure, call order, DOM class/attribute/data hook, selector, or exact string literal. The sole exceptions are details explicitly named in `agent_prompt.md` or already established as a public contract in the existing repository.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return n&&r.push("","Fairness methodology:",n),r.push("","For every gap you keep, give a short justification citing where in `agent_prompt.md` or the repo it is grounded. Preserve POSITIVE:/NEGATIVE: prefix when applicable.",`When you are done, call the \`${er}\` tool exactly once with your final filtered list (which may be empty). That tool call is your only way to report a result.`),r.join(`
14
13
  `)}function Wd(){return["You are a software engineer practicing test-driven development in a real git repository (this is your current directory).","`agent_prompt.md` in the repo root describes your task. Tests for it already exist and are currently failing \u2014 that's normal in TDD, the tests come first.","","Goal: make all of the new tests pass.","1. Read `agent_prompt.md`.","2. Run `bash test.sh new` to see the failures and what the tests expect.","3. Read the failing tests \u2014 they are the precise spec \u2014 and the surrounding repo code for conventions and utilities to reuse.","4. Implement the code needed to satisfy both `agent_prompt.md` and the tests, matching repo style.","5. Re-run `bash test.sh new` and iterate until everything passes, or you're confident you can't progress further.","","Rules:","- Do NOT modify the test files or `test.sh`. Only change application/library code.","- You have shell access \u2014 install any dependencies you need.","- Prefer the smallest, most direct change that satisfies the tests and `agent_prompt.md` using existing repo patterns."].join(`
15
- `)}function Zb(e){let t=e.status==="ok"?e.passed?"PASSED all new tests":"did NOT pass all new tests":`did not complete normally (status: ${e.status})`;return`- Solver ${e.index} \u2014 ${t} \u2014 solution.diff / test_output.txt in \`${yr}/solver_${e.index}/\``}function Hd(e,t,r){let n=["You are a strict, skeptical behavioral-gap auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the real task description), `solution.patch` (a unified diff of the real golden/reference solution), and `test.patch` (a unified diff adding the hidden tests).","",`Separately, several coding agents ('solvers') were each given the same \`agent_prompt.md\` plus the failing tests from \`test.patch\` \u2014 but never \`solution.patch\` \u2014 and asked to implement the task TDD-style, iterating with real shell access until the tests passed or they gave up. Each solver's diff and full \`test.sh new\` output \u2014 captured and verified independently by the harness, not self-reported \u2014 is saved under \`${yr}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${yr}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(Zb),"","Your job: compare the reference `solution.patch` with each solver's `solution.diff` to find concrete BEHAVIORAL GAPS. Keep only a difference where: (a) `agent_prompt.md` explicitly requires the behavior, (b) the solver passed the relevant tests (even if it failed elsewhere), (c) the reference and solver produce observably different behavior for a real edge case or scenario, and (d) a fair public-facing test could distinguish them. The reference solution is evidence for scenarios to inspect, never a specification by itself.","","How to work:","1. Read `agent_prompt.md` sentence by sentence and note every distinct requirement, constraint, and prohibition.","2. Read `solution.patch` to see how the reference solution satisfies those requirements.","3. For each solver, read its `solution.diff` and compare it against the reference behavior. Look specifically for a solver shortcut, missed constraint, edge case, or side effect that the PROMPT requires, where the solver still passes because the tests do not observe the behavioral difference.","4. A solver that did not pass the full suite may still provide evidence for a completed, relevant part of its diff, but only when its test output shows the failure is unrelated to that behavior (or shows the relevant tests already passed). Do not treat its failing behavior as a gap, and do not infer gaps from a hypothetical wrong implementation.","5. Treat multiple solvers converging on the same divergent-but-passing shortcut as stronger evidence of a real gap, not proof it's acceptable \u2014 the tests are what's under scrutiny, not majority solver behavior.","",...Bo,"- Every gap must be evidenced by an actual, cited solver diff and a contrasting reference behavior. For a solver that failed the full suite, also cite its test output showing that the relevant behavior already passed or is unrelated to the failure. Cite the prompt sentence that makes the behavioral difference required; do not report a gap that is purely theoretical or based only on the reference implementation.","- It is fine, and expected, to submit an empty list if the solvers that passed all converged on behavior equivalent to the reference solution with no material gaps.","- Do not self-censor for volume, but do not pad the list either \u2014 only include what you can concretely justify with cited evidence.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",t];return r&&n.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",r),n.push("",`When you are done, call the \`${tn}\` tool exactly once with your final list (which may be empty). That tool call is your only way to report a result.`),n.join(`
16
- `)}var Qb=900*1e3,Vo=["read","grep","find","ls"];function $a(e){return e==="off"?void 0:e}async function Ta(e,t,r=Qb){let n=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(n="done")}),new Promise(a=>{setTimeout(()=>{n="timedOut",a()},r)}),new Promise(a=>{if(t.aborted)return a();t.addEventListener("abort",()=>{n="cancelled",a()},{once:!0})})]),n}async function Yd(e){let t={},r=e.kind==="positive"?zd:Bd,n=e.model,{session:a}=await ba({cwd:e.tempDir,model:n,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,fr],customTools:[Nd(t)],sessionManager:va.inMemory()});try{let s=await Ta(async()=>{await a.prompt(r(e.testRubric,e.fairnessRules))},e.cancelSignal);if(s!=="done")return await a.abort(),{status:s,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var ev=["read","grep","find","ls","write","edit","bash"];async function Jd(e){let t=e.model;try{let r=va.inMemory(),{session:n}=await ba({cwd:e.solverDir,model:t,thinkingLevel:$a(e.thinkingLevel),tools:[...ev],sessionManager:r}),a=await Ta(async()=>{await n.prompt(Wd())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await n.abort(),{outcome:a,trajectory:r.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function Xd(e){let t={},r=e.model,{session:n}=await ba({cwd:e.tempDir,model:r,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,tn],customTools:[Ud(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await n.prompt(Hd(e.solverResults,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await n.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}async function Zd(e){let t={},r=e.model,{session:n}=await ba({cwd:e.tempDir,model:r,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,en],customTools:[Gd(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await n.prompt(Vd(e.candidates,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await n.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var Ut="checks_progress";function ka(e,t,r){let n=r>0?Math.min(1,t/r):0,a=Math.round(24*n),s="\u2588".repeat(a)+"\u2591".repeat(Math.max(0,24-a));return[`checks: ${e} [${s}] ${t}/${r}`]}import{existsSync as tv,readFileSync as rv}from"node:fs";var Wo=["agent_prompt.md","solution.patch","test.patch"];function Ho(e=new Date){let t=(s,m=2)=>String(s).padStart(m,"0"),r=-e.getTimezoneOffset(),n=r>=0?"+":"-",a=Math.abs(r);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${n}${t(Math.floor(a/60))}:${t(a%60)}`}function Qd(e){try{if(!tv(e))return{};let t=JSON.parse(rv(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function ef(e){let t={...e.existingReport,timestamp:Ho(),model:`${e.config.provider}/${e.config.modelId}`,thinkingLevel:e.config.thinkingLevel};return delete t.overall,delete t.reports,e.runGapFinder&&(t.testGaps=e.testGaps,e.gapAnalysisIncomplete?t.testGapAnalysisNote=`Gap analysis did not fully complete (positive finder: ${e.positiveGapFinderStatus}, negative finder: ${e.negativeGapFinderStatus}, filter: ${e.gapFilterStatus}); testGaps may be incomplete.`:delete t.testGapAnalysisNote),e.runSolverGapFinder&&(t.solverRunSummary=e.solverResults.map(r=>({index:r.index,status:r.status,passed:r.passed,durationMs:r.durationMs,artifactsDir:r.artifactsDir})),t.solverGaps=e.solverGaps,e.solverGapAnalysisIncomplete?t.solverGapAnalysisNote=`Solver-gap analysis did not fully complete (comparison reviewer: ${e.solverComparisonStatus}); solverGaps may be incomplete.`:delete t.solverGapAnalysisNote),t}function tf(e){let t=Math.round(e/1e3);return t>=60?`${Math.floor(t/60)}m ${t%60}s`:`${t}s`}function rf(e){let t=Array.isArray(e.merged.testGaps)?e.merged.testGaps.length:0,r=e.runSolverGapFinder&&Array.isArray(e.merged.solverRunSummary)?e.merged.solverRunSummary.map(s=>({...s,durationMs:s.durationMs??0})):[],n=Array.isArray(e.merged.solverGaps)?e.merged.solverGaps.length:0,a=[];return e.runGapFinder&&a.push(t>0?`${t} test gap(s) found`:"no test gaps found"),e.runSolverGapFinder&&a.push(`${r.filter(s=>s.passed).length}/${r.length} solvers passed, ${n} gap(s) found`),{content:`Gap finders: ${a.join(" | ")}`,details:{gapsCount:t,showGaps:e.runGapFinder,showSolverGaps:e.runSolverGapFinder,solverDetails:r,solverGapsCount:n}}}var nf=`## The problem description (aka the task)\r
14
+ `)}function ev(e){let t=e.status==="ok"?e.passed?"PASSED all new tests":"did NOT pass all new tests":`did not complete normally (status: ${e.status})`;return`- Solver ${e.index} \u2014 ${t} \u2014 solution.diff / test_output.txt in \`${gn}/solver_${e.index}/\``}function Hd(e,t,n){let r=["You are a strict, skeptical behavioral-gap auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the real task description), `solution.patch` (a unified diff of the real golden/reference solution), and `test.patch` (a unified diff adding the hidden tests).","",`Separately, several coding agents ('solvers') were each given the same \`agent_prompt.md\` plus the failing tests from \`test.patch\` \u2014 but never \`solution.patch\` \u2014 and asked to implement the task TDD-style, iterating with real shell access until the tests passed or they gave up. Each solver's diff and full \`test.sh new\` output \u2014 captured and verified independently by the harness, not self-reported \u2014 is saved under \`${gn}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${gn}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(ev),"","Your job: compare the reference `solution.patch` with each solver's `solution.diff` to find concrete BEHAVIORAL GAPS. Keep only a difference where: (a) `agent_prompt.md` explicitly requires the behavior, (b) the solver passed the relevant tests (even if it failed elsewhere), (c) the reference and solver produce observably different behavior for a real edge case or scenario, and (d) a fair public-facing test could distinguish them. The reference solution is evidence for scenarios to inspect, never a specification by itself.","","How to work:","1. Read `agent_prompt.md` sentence by sentence and note every distinct requirement, constraint, and prohibition.","2. Read `solution.patch` to see how the reference solution satisfies those requirements.","3. For each solver, read its `solution.diff` and compare it against the reference behavior. Look specifically for a solver shortcut, missed constraint, edge case, or side effect that the PROMPT requires, where the solver still passes because the tests do not observe the behavioral difference.","4. A solver that did not pass the full suite may still provide evidence for a completed, relevant part of its diff, but only when its test output shows the failure is unrelated to that behavior (or shows the relevant tests already passed). Do not treat its failing behavior as a gap, and do not infer gaps from a hypothetical wrong implementation.","5. Treat multiple solvers converging on the same divergent-but-passing shortcut as stronger evidence of a real gap, not proof it's acceptable \u2014 the tests are what's under scrutiny, not majority solver behavior.","",...zd,"- Every gap must be evidenced by an actual, cited solver diff and a contrasting reference behavior. For a solver that failed the full suite, also cite its test output showing that the relevant behavior already passed or is unrelated to the failure. Cite the prompt sentence that makes the behavioral difference required; do not report a gap that is purely theoretical or based only on the reference implementation.","- It is fine, and expected, to submit an empty list if the solvers that passed all converged on behavior equivalent to the reference solution with no material gaps.","- Do not self-censor for volume, but do not pad the list either \u2014 only include what you can concretely justify with cited evidence.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",t];return n&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",n),r.push("",`When you are done, call the \`${tr}\` tool exactly once with your final list (which may be empty). That tool call is your only way to report a result.`),r.join(`
15
+ `)}var tv=900*1e3,Vo=["read","grep","find","ls"];function $a(e){return e==="off"?void 0:e}async function Ta(e,t,n=tv){let r=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(r="done")}),new Promise(a=>{setTimeout(()=>{r="timedOut",a()},n)}),new Promise(a=>{if(t.aborted)return a();t.addEventListener("abort",()=>{r="cancelled",a()},{once:!0})})]),r}async function Yd(e){let t={},n=e.model,{session:r}=await ba({cwd:e.tempDir,model:n,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,Qn],customTools:[Ud(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await r.prompt(Bd(e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.statements?{status:"ok",gaps:t.statements}:{status:"noSubmission",gaps:[]}}var nv=["read","grep","find","ls","write","edit","bash"];async function Jd(e){let t=e.model;try{let n=va.inMemory(),{session:r}=await ba({cwd:e.solverDir,model:t,thinkingLevel:$a(e.thinkingLevel),tools:[...nv],sessionManager:n}),a=await Ta(async()=>{await r.prompt(Wd())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await r.abort(),{outcome:a,trajectory:n.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function Xd(e){let t={},n=e.model,{session:r}=await ba({cwd:e.tempDir,model:n,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,tr],customTools:[_d(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await r.prompt(Hd(e.solverResults,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}async function Zd(e){let t={},n=e.model,{session:r}=await ba({cwd:e.tempDir,model:n,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,er],customTools:[Kd(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await r.prompt(Vd(e.statementReports,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var Et="checks_progress";function nr(e,t,n,r){let a=n>0?Math.min(1,t/n):0,s=Math.round(24*a),m="\u2588".repeat(s)+"\u2591".repeat(Math.max(0,24-s)),c=r?` pass:${r.passed} fail:${r.failed}`:"";return[`checks: ${e} [${m}] ${t}/${n}${c}`]}import{existsSync as rv,readFileSync as av}from"node:fs";var Wo=["agent_prompt.md","solution.patch","test.patch"];function Ho(e=new Date){let t=(s,m=2)=>String(s).padStart(m,"0"),n=-e.getTimezoneOffset(),r=n>=0?"+":"-",a=Math.abs(n);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${r}${t(Math.floor(a/60))}:${t(a%60)}`}function Qd(e){try{if(!rv(e))return{};let t=JSON.parse(av(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function ef(e){let t={...e.existingReport,timestamp:Ho(),model:`${e.config.provider}/${e.config.modelId}`,thinkingLevel:e.config.thinkingLevel};return delete t.overall,delete t.reports,e.runGapFinder&&(t.testGaps=e.testGaps,e.gapAnalysisIncomplete?t.testGapAnalysisNote=`Gap analysis did not fully complete (sentence finder: ${e.gapFinderStatus}, review: ${e.gapFilterStatus}); testGaps may be incomplete.`:delete t.testGapAnalysisNote),e.runSolverGapFinder&&(t.solverRunSummary=e.solverResults.map(n=>({index:n.index,status:n.status,passed:n.passed,durationMs:n.durationMs,totalTests:n.totalTests,failedTests:n.failedTests,artifactsDir:n.artifactsDir})),t.solverGaps=e.solverGaps,e.solverGapAnalysisIncomplete?t.solverGapAnalysisNote=`Solver-gap analysis did not fully complete (comparison reviewer: ${e.solverComparisonStatus}); solverGaps may be incomplete.`:delete t.solverGapAnalysisNote),t}function tf(e){let t=Math.round(e/1e3);return t>=60?`${Math.floor(t/60)}m ${t%60}s`:`${t}s`}function nf(e){let t=Array.isArray(e.merged.testGaps)?e.merged.testGaps.length:0,n=e.runSolverGapFinder&&Array.isArray(e.merged.solverRunSummary)?e.merged.solverRunSummary.map(s=>({...s,durationMs:s.durationMs??0})):[],r=Array.isArray(e.merged.solverGaps)?e.merged.solverGaps.length:0,a=[];return e.runGapFinder&&a.push(t>0?`${t} test gap(s) found`:"no test gaps found"),e.runSolverGapFinder&&a.push(`${n.filter(s=>s.passed).length}/${n.length} solvers passed, ${r} gap(s) found`),{content:`Gap finders: ${a.join(" | ")}`,details:{gapsCount:t,showGaps:e.runGapFinder,showSolverGaps:e.runSolverGapFinder,solverDetails:n,solverGapsCount:r}}}var rf=`## The problem description (aka the task)\r
17
16
  P1: Aligns with the repo's philosophy\r
18
17
  P2: Self-contained \u2014 solvable from the repo and description alone\r
19
18
  P3: Clear, concise, and unambiguous \u2014 describes what to build or fix and don't leave points for guessing\r
@@ -40,7 +39,7 @@ That's the golden solution \u2014 the proof that your task is solvable and that
40
39
  S1: The solution should meet all the requirements. (If it's missing a requirement and it manages to pass your tests, you're in a bad position \u{1F620}.)\r
41
40
  S2: No regressions and follow existing code patterns. Don't break existing working code by mistake (we'll still run the repo's existing tests).\r
42
41
  S3: No irrelevant changes to the code \u2014 if something is unrelated to your task, keep it as it is.\r
43
- S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,nv=`# Agent Evaluation Guidelines\r
42
+ S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,ov=`# Agent Evaluation Guidelines\r
44
43
  \r
45
44
  This file describes how to align a task prompt, reference solution, and tests for fair coding-agent evaluation. It is generic and can be reused across repositories and tasks.\r
46
45
  \r
@@ -320,5 +319,5 @@ Keep changes separated when possible:\r
320
319
  - Avoid unrelated dependency or lockfile changes.\r
321
320
  - Regenerate patches after every prompt/test/solution change.\r
322
321
  \r
323
- ---`;function af(){return(nf.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??nf).trim()}function of(){return nv.trim()}var wa=!1,gr;function Ea(){return wa}function sf(){return wa=!0,gr=new AbortController,gr}function mf(){wa=!1,gr=void 0}function pf(){return!wa||!gr||gr.signal.aborted?!1:(gr.abort(),!0)}var uv="Ctrl+Shift+X",Yo=[{value:"--gap-finder",label:"--gap-finder",description:"Find and validate behavioral test-coverage gaps"},{value:"--solver-gap-finder",label:"--solver-gap-finder",description:"Use TDD solver attempts to find behavioral gaps"},{value:"--config",label:"--config",description:"Configure gap-finder models"}];function cv(e){let t=e.trimStart(),r=/\s$/.test(t),n=t.trimEnd().split(/\s+/).filter(Boolean),a=r?"":n.at(-1)??"",s=new Set(r?n:n.slice(0,-1)),m=r?t:t.slice(0,t.length-a.length),c=s.has("--config"),l=[...s].some(f=>f!=="--config"),g=Yo.filter(f=>!s.has(f.value)&&!c&&!(l&&f.value==="--config")&&f.value.startsWith(a));return g.length?g.map(f=>({...f,value:`${m}${f.value}`})):null}async function gf(e,t,r){let n=pi();if(n.length===0)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let a=e.modelRegistry.getAll(),s=n.map(g=>{let f=ui(g);if(!f)return null;let w=a.find(ue=>ue.provider===f.provider&&ue.id===f.modelId),F=t?.provider===f.provider&&t?.modelId===f.modelId,B=w?`${w.name} (${g})`:g;return{ref:g,parsed:f,display:F?`${B} [current]`:B,isCurrent:F}}).filter(g=>g!==null);if(s.length===0)return e.ui.notify("Could not resolve any enabledModels entries.","error"),null;let m=[...s].sort((g,f)=>g.isCurrent===f.isCurrent?0:g.isCurrent?-1:1),c=await e.ui.select(r,m.map(g=>g.display));if(!c)return null;let l=s.find(g=>g.display===c);return l?{provider:l.parsed.provider,modelId:l.parsed.modelId}:null}function Sa(e,t,r){let n=e.modelRegistry.getAll().find(a=>a.provider===t&&a.id===r);return si(n)}var Ra={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:Ca,solverCount:Aa,saveArtifacts:La};function hf(e,t,r){let n=t?Sa(e,t.provider,t.modelId):["off"],a=r.provider?Sa(e,r.provider,r.modelId):["off"];return[{id:"reviewer-model",section:"Reviewer",label:"Model",value:t?`${t.provider}/${t.modelId}`:"not set",kind:"model"},{id:"reviewer-thinking",section:"Reviewer",label:"Thinking level",value:t?.thinkingLevel??"off",kind:"cycle",values:n},{id:"solvergap-model",section:"Solver",label:"Model",value:r.provider?`${r.provider}/${r.modelId}`:"not set",kind:"model"},{id:"solvergap-thinking",section:"Solver",label:"Thinking level",value:r.thinkingLevel,kind:"cycle",values:a},{id:"solvergap-timeout",section:"Solver",label:"Timeout",value:`${r.timeoutMinutes} min`,kind:"cycle",values:[10,20,30,40,50,oi].filter((s,m,c)=>s>=ai&&c.indexOf(s)===m).map(s=>`${s} min`)},{id:"solvergap-solver-count",section:"Solver",label:"Parallel agents",value:String(r.solverCount),kind:"cycle",values:Array.from({length:ii-Ma+1},(s,m)=>`${Ma+m}`)},{id:"solvergap-save-artifacts",section:"Solver",label:"Save artifacts",value:r.saveArtifacts?"on":"off",kind:"cycle",values:["on","off"]}]}var Jo=class{constructor(t,r,n,a,s,m){this.ctx=t;this.settingsListTheme=r;this.theme=n;this.onCycleSaved=a;this.onActivateModel=s;this.onExit=m;this.rows=hf(t,st(),st()?.solverGap??Ra)}selectedIndex=0;rows;refresh(){let t=st();this.rows=hf(this.ctx,t,t?.solverGap??Ra),this.selectedIndex=Math.min(this.selectedIndex,this.rows.length-1)}invalidate(){}render(t){let r=[],n=Math.min(30,Math.max(...this.rows.map(s=>s.label.length))),a;for(let s=0;s<this.rows.length;s++){let m=this.rows[s];if(!m)continue;m.section!==a&&(a!==void 0&&r.push(""),r.push(this.theme.bold(this.theme.fg("accent",m.section))),a=m.section);let c=s===this.selectedIndex,l=c?this.settingsListTheme.cursor:" ",g=m.label+" ".repeat(Math.max(0,n-m.label.length)),f=this.settingsListTheme.label(g,c),w=this.settingsListTheme.value(m.value,c);r.push(`${l}${f} ${w}`)}return r}handleInput(t){if(_t(t,Kt.ctrl("s"))||_t(t,Kt.escape)||_t(t,Kt.ctrl("c"))){this.onExit();return}if(_t(t,Kt.up)){this.selectedIndex=this.selectedIndex===0?this.rows.length-1:this.selectedIndex-1;return}if(_t(t,Kt.down)){this.selectedIndex=this.selectedIndex===this.rows.length-1?0:this.selectedIndex+1;return}if(_t(t,Kt.enter)||_t(t,Kt.return)||t===" "){let r=this.rows[this.selectedIndex];if(!r)return;if(r.kind==="model"){this.onActivateModel(r.id);return}if(!r.values||r.values.length===0)return;let n=st();if(!n){this.ctx.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");return}let a=n.solverGap??Ra,s=r.values.indexOf(r.value),m=r.values[(s+1)%r.values.length];if(m===void 0)return;r.id==="reviewer-thinking"?mt({...n,thinkingLevel:m,solverGap:a}):r.id==="solvergap-thinking"?mt({...n,solverGap:{...a,thinkingLevel:m}}):r.id==="solvergap-timeout"?mt({...n,solverGap:{...a,timeoutMinutes:Number.parseInt(m,10)}}):r.id==="solvergap-solver-count"?mt({...n,solverGap:{...a,solverCount:Number.parseInt(m,10)}}):r.id==="solvergap-save-artifacts"&&mt({...n,solverGap:{...a,saveArtifacts:m==="on"}}),this.refresh(),this.onCycleSaved()}}};async function lv(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=0;for(;;){let r=await e.ui.custom((s,m,c,l)=>{let g=new Jo(e,sv(),m,()=>s.requestRender(),w=>l(w),()=>l(void 0));g.selectedIndex=t;let f=new mv;return f.addChild(new ff(m.bold(m.fg("accent","Checks settings")))),f.addChild({render:w=>g.render(w),invalidate:()=>g.invalidate()}),f.addChild(new pv(1)),f.addChild(new ff(m.fg("dim","\u2191\u2193 navigate enter select ctrl+s save & exit esc cancel"))),{render(w){return f.render(w)},invalidate(){f.invalidate()},handleInput(w){g.handleInput(w),t=g.selectedIndex,s.requestRender()}}});if(!r)return;let n=st(),a=n?.solverGap??Ra;if(r==="reviewer-model"){let s=await gf(e,n,"Select reviewer model");if(!s)continue;let m=Sa(e,s.provider,s.modelId),c=m.includes(n?.thinkingLevel??"off")?n?.thinkingLevel??"off":m[0]??"off";mt({...s,thinkingLevel:c,solverGap:a}),e.ui.notify(`Reviewer model saved: ${s.provider}/${s.modelId}`,"info");continue}if(r==="solvergap-model"){if(!n){e.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");continue}let s=await gf(e,a.provider?a:null,"Select solver model");if(!s)continue;let m=Sa(e,s.provider,s.modelId),c=m.includes(a.thinkingLevel)?a.thinkingLevel:m[0]??"off";mt({...n,solverGap:{...a,...s,thinkingLevel:c}}),e.ui.notify(`Solver model saved: ${s.provider}/${s.modelId}`,"info")}}}function xf(e){e.registerCommand("checks",{description:"Find behavioral gaps in test coverage. Requires an option \u2014 see /checks.",getArgumentCompletions:cv,handler:async(t,r)=>{let n=t.trim();if(!n){r.ui.notify(Yo.map(D=>`${D.value} \u2014 ${D.description}`).join(`
324
- `),"info");return}let a=[...new Set(n.split(/\s+/).filter(Boolean))],s=new Set(Yo.map(D=>D.value)),m=a.filter(D=>!s.has(D));if(m.length){r.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see options.`,"warning");return}if(a.includes("--config")){a.length>1?r.ui.notify("--config cannot be combined with other options.","warning"):await lv(r);return}let c=a.includes("--gap-finder"),l=a.includes("--solver-gap-finder");if(!c&&!l)return;if(Ea()){r.ui.notify("A checks run is already in progress.","warning");return}let g=st();if(!g){r.ui.notify("No gap-finder model configured. Run /checks --config first.","error");return}let f=r.modelRegistry.find(g.provider,g.modelId);if(!f||!r.modelRegistry.hasConfiguredAuth(f)){r.ui.notify("Configured behavioral gap-finder model is unavailable or unauthenticated. Run /checks --config.","error");return}let w=Wo.filter(D=>!cf(Je(r.cwd,D)));if(w.length){r.ui.notify(`Missing required file(s): ${w.join(", ")}`,"error");return}let F=null,B;if(l){if(F=mi(),!F||!cf(Je(r.cwd,"test.sh"))){r.ui.notify("Configure solver gap finder and provide test.sh before running it.","error");return}if(B=r.modelRegistry.find(F.provider,F.modelId),!B||!r.modelRegistry.hasConfiguredAuth(B)){r.ui.notify("Configured solver gap-finder model is unavailable or unauthenticated.","error");return}}let ue=sf(),Ce=F?.solverCount??0,Me=(c?3:0)+(l?Ce+1:0);r.ui.setWidget(Ut,ka("preparing clean snapshot",0,Me)),r.ui.notify(`gap finders (${a.join(" ")}) started. Press ${uv} to cancel.`,"info");let je,Xe=[];try{let D=Je(df(),`checks-${uf()}`);lf(D,{recursive:!0}),je=D;let vt=await cn(e,r.cwd,D);if(vt.status==="error"){r.ui.notify(`checks: ${vt.error}`,"error");return}for(let Fe of Wo)av(Je(r.cwd,Fe),Je(D,Fe));let at=af(),ot=of(),it=0,$t={status:"ok",gaps:[]},Tt={status:"ok",gaps:[]},zt={status:"ok",gaps:[]};if(c){let Fe={tempDir:D,model:f,thinkingLevel:g.thinkingLevel,testRubric:at,fairnessRules:ot,cancelSignal:ue.signal};[$t,Tt]=await Promise.all([yf(Fe,"positive"),yf(Fe,"negative")]),it+=2,r.ui.setWidget(Ut,ka("validating test gaps",it,Me));let nn=[...$t.gaps,...Tt.gaps];if(nn.length&&(zt=await Zd({...Fe,candidates:nn})),it+=1,ue.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}}let Bt=[],rn={status:"ok",gaps:[]};if(l&&F){let Fe=await Promise.all(Array.from({length:Ce},async(kt,wt)=>{let hr=Je(df(),`checks-solvergap-${uf()}`);return lf(hr,{recursive:!0}),Xe.push(hr),{index:wt+1,setup:await li({pi:e,repoDir:r.cwd,solverDir:hr,testPatchPath:Je(r.cwd,"test.patch"),agentPromptPath:Je(r.cwd,"agent_prompt.md")})}})),nn=Ho().replace(/[:.]/g,"-");if(Bt=await Promise.all(Fe.map(async({index:kt,setup:wt})=>{if(wt.status!=="ok")return{index:kt,status:wt.status,passed:!1,diff:"",testOutputTail:wt.error,durationMs:0};let hr=Date.now(),{outcome:ti,trajectory:vf}=await Jd({pi:e,solverDir:wt.solverDir,model:B,thinkingLevel:F.thinkingLevel,timeoutMinutes:F.timeoutMinutes,cancelSignal:ue.signal}),{testOutputXmlPath:$f,...Oa}=await di({pi:e,index:kt,workspace:wt,status:ti==="done"?"ok":ti,durationMs:Date.now()-hr}),Tf=F.saveArtifacts?fi({repoDir:r.cwd,runId:nn,index:kt,trajectory:vf,solutionPatch:Oa.diff,testOutputXmlPath:$f,testOutputTail:Oa.testOutputTail}):void 0;return it+=1,r.ui.setWidget(Ut,ka("solver gap finder: solving",it,Me)),{...Oa,artifactsDir:Tf}})),Bt.some(kt=>kt.status!=="patchFailed"&&kt.status!=="error")&&(gi(D,Bt),rn=await Xd({tempDir:D,model:f,thinkingLevel:g.thinkingLevel,solverResults:Bt,testRubric:at,fairnessRules:ot,cancelSignal:ue.signal})),it+=1,ue.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}}let bf=c&&($t.status!=="ok"||Tt.status!=="ok"||($t.gaps.length>0||Tt.gaps.length>0)&&zt.status!=="ok"),Zo=ef({existingReport:Qd(Je(r.cwd,"shipd_report.json")),config:g,runGapFinder:c,testGaps:zt.gaps,gapAnalysisIncomplete:bf,positiveGapFinderStatus:$t.status,negativeGapFinderStatus:Tt.status,gapFilterStatus:zt.status,runSolverGapFinder:l,solverResults:Bt,solverGaps:rn.gaps,solverGapAnalysisIncomplete:l&&(Bt.some(Fe=>Fe.status==="error")||rn.status!=="ok"),solverComparisonStatus:rn.status}),Qo=rf({merged:Zo,runGapFinder:c,runSolverGapFinder:l});e.sendMessage({customType:"shipd_checks_report",content:Qo.content,display:!0,details:Qo.details});let ei=Je(r.cwd,"shipd_report.json");iv(ei,JSON.stringify(Zo,null,2),"utf-8"),r.ui.notify(`checks: wrote details to ${ei}`,"info")}catch(D){r.ui.notify(`checks failed: ${D instanceof Error?D.message:String(D)}`,"error")}finally{r.ui.setWidget(Ut,void 0),je&&ov(je,{recursive:!0,force:!0});for(let D of Xe)hi(D);mf()}}})}async function yf(e,t){return Yd({...e,kind:t})}var If=fv.ctrlShift("x");function hv(e){e.registerMessageRenderer("shipd_checks_report",(t,r,n)=>{let a=t.details??{},s=new dv;s.addChild(new Xo(n.bold(n.fg("accent","Checks")),0,0));let m=!1,c=l=>{s.addChild(new Xo(l,0,0)),m=!0};if(a.showGaps){let l=a.gapsCount??0;c(l>0?n.fg("warning",` \u26A0 ${l} test gap(s) found`):n.fg("success"," \u2713 no test gaps found"))}if(a.showSolverGaps){let l=a.solverDetails??[],g=l.filter(B=>B.passed).length,f=a.solverGapsCount??0;s.addChild(new gv(1)),c(n.bold(n.fg("accent","Solver gap finder")));for(let B of l){let ue=B.passed?n.fg("success","\u2713"):n.fg("error","\u2717"),Ce=B.passed?"passed":B.status==="ok"?"failed tests":B.status;c(` ${ue} Solver ${B.index}: ${Ce} (${tf(B.durationMs)})`)}let w=g===l.length&&l.length>0?n.fg("success",`${g}/${l.length} solvers passed`):n.fg("warning",`${g}/${l.length} solvers passed`),F=f>0?n.fg("warning",`${f} behavioral gap(s) found`):n.fg("success","no behavioral gaps found");c(` ${w}, ${F}`)}return m||s.addChild(new Xo(n.fg("dim"," nothing to report"),0,0)),s}),e.registerShortcut(If,{description:"Cancel an in-progress /checks run",handler:t=>{Ea()&&pf()&&(t.ui.setWidget(Ut,[`checks: cancelling (${If})...`]),t.ui.notify("checks: cancelling...","warning"))}}),xf(e)}export{hv as default};
322
+ ---`;function af(){return(rf.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??rf).trim()}function of(){return ov.trim()}var ka=!1,fn;function wa(){return ka}function sf(){return ka=!0,fn=new AbortController,fn}function mf(){ka=!1,fn=void 0}function pf(){return!ka||!fn||fn.signal.aborted?!1:(fn.abort(),!0)}var lv="Ctrl+Shift+X",Yo=[{value:"--gap-finder",label:"--gap-finder",description:"Find and validate behavioral test-coverage gaps"},{value:"--solver-gap-finder",label:"--solver-gap-finder",description:"Use TDD solver attempts to find behavioral gaps"},{value:"--config",label:"--config",description:"Configure gap-finder models"}];function dv(e){let t=e.trimStart(),n=/\s$/.test(t),r=t.trimEnd().split(/\s+/).filter(Boolean),a=n?"":r.at(-1)??"",s=new Set(n?r:r.slice(0,-1)),m=n?t:t.slice(0,t.length-a.length),c=s.has("--config"),l=[...s].some(f=>f!=="--config"),h=Yo.filter(f=>!s.has(f.value)&&!c&&!(l&&f.value==="--config")&&f.value.startsWith(a));return h.length?h.map(f=>({...f,value:`${m}${f.value}`})):null}async function hf(e,t,n){let r=ci();if(r.length===0)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let a=e.modelRegistry.getAll(),s=r.map(h=>{let f=li(h);if(!f)return null;let w=a.find(ue=>ue.provider===f.provider&&ue.id===f.modelId),D=t?.provider===f.provider&&t?.modelId===f.modelId,_=w?`${w.name} (${h})`:h;return{ref:h,parsed:f,display:D?`${_} [current]`:_,isCurrent:D}}).filter(h=>h!==null);if(s.length===0)return e.ui.notify("Could not resolve any enabledModels entries.","error"),null;let m=[...s].sort((h,f)=>h.isCurrent===f.isCurrent?0:h.isCurrent?-1:1),c=await e.ui.select(n,m.map(h=>h.display));if(!c)return null;let l=s.find(h=>h.display===c);return l?{provider:l.parsed.provider,modelId:l.parsed.modelId}:null}function Ra(e,t,n){let r=e.modelRegistry.getAll().find(a=>a.provider===t&&a.id===n);return pi(r)}var Ea={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:Aa,solverCount:qa,saveArtifacts:ja};function gf(e,t,n){let r=t?Ra(e,t.provider,t.modelId):["off"],a=n.provider?Ra(e,n.provider,n.modelId):["off"];return[{id:"reviewer-model",section:"Reviewer",label:"Model",value:t?`${t.provider}/${t.modelId}`:"not set",kind:"model"},{id:"reviewer-thinking",section:"Reviewer",label:"Thinking level",value:t?.thinkingLevel??"off",kind:"cycle",values:r},{id:"solvergap-model",section:"Solver",label:"Model",value:n.provider?`${n.provider}/${n.modelId}`:"not set",kind:"model"},{id:"solvergap-thinking",section:"Solver",label:"Thinking level",value:n.thinkingLevel,kind:"cycle",values:a},{id:"solvergap-timeout",section:"Solver",label:"Timeout",value:`${n.timeoutMinutes} min`,kind:"cycle",values:[10,20,30,40,50,si].filter((s,m,c)=>s>=ii&&c.indexOf(s)===m).map(s=>`${s} min`)},{id:"solvergap-solver-count",section:"Solver",label:"Parallel agents",value:String(n.solverCount),kind:"cycle",values:Array.from({length:mi-La+1},(s,m)=>`${La+m}`)},{id:"solvergap-save-artifacts",section:"Solver",label:"Save artifacts",value:n.saveArtifacts?"on":"off",kind:"cycle",values:["on","off"]}]}var Jo=class{constructor(t,n,r,a,s,m){this.ctx=t;this.settingsListTheme=n;this.theme=r;this.onCycleSaved=a;this.onActivateModel=s;this.onExit=m;this.rows=gf(t,lt(),lt()?.solverGap??Ea)}selectedIndex=0;rows;refresh(){let t=lt();this.rows=gf(this.ctx,t,t?.solverGap??Ea),this.selectedIndex=Math.min(this.selectedIndex,this.rows.length-1)}invalidate(){}render(t){let n=[],r=Math.min(30,Math.max(...this.rows.map(s=>s.label.length))),a;for(let s=0;s<this.rows.length;s++){let m=this.rows[s];if(!m)continue;m.section!==a&&(a!==void 0&&n.push(""),n.push(this.theme.bold(this.theme.fg("accent",m.section))),a=m.section);let c=s===this.selectedIndex,l=c?this.settingsListTheme.cursor:" ",h=m.label+" ".repeat(Math.max(0,r-m.label.length)),f=this.settingsListTheme.label(h,c),w=this.settingsListTheme.value(m.value,c);n.push(`${l}${f} ${w}`)}return n}handleInput(t){if(_t(t,Kt.ctrl("s"))||_t(t,Kt.escape)||_t(t,Kt.ctrl("c"))){this.onExit();return}if(_t(t,Kt.up)){this.selectedIndex=this.selectedIndex===0?this.rows.length-1:this.selectedIndex-1;return}if(_t(t,Kt.down)){this.selectedIndex=this.selectedIndex===this.rows.length-1?0:this.selectedIndex+1;return}if(_t(t,Kt.enter)||_t(t,Kt.return)||t===" "){let n=this.rows[this.selectedIndex];if(!n)return;if(n.kind==="model"){this.onActivateModel(n.id);return}if(!n.values||n.values.length===0)return;let r=lt();if(!r){this.ctx.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");return}let a=r.solverGap??Ea,s=n.values.indexOf(n.value),m=n.values[(s+1)%n.values.length];if(m===void 0)return;n.id==="reviewer-thinking"?dt({...r,thinkingLevel:m,solverGap:a}):n.id==="solvergap-thinking"?dt({...r,solverGap:{...a,thinkingLevel:m}}):n.id==="solvergap-timeout"?dt({...r,solverGap:{...a,timeoutMinutes:Number.parseInt(m,10)}}):n.id==="solvergap-solver-count"?dt({...r,solverGap:{...a,solverCount:Number.parseInt(m,10)}}):n.id==="solvergap-save-artifacts"&&dt({...r,solverGap:{...a,saveArtifacts:m==="on"}}),this.refresh(),this.onCycleSaved()}}};async function fv(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=0;for(;;){let n=await e.ui.custom((s,m,c,l)=>{let h=new Jo(e,pv(),m,()=>s.requestRender(),w=>l(w),()=>l(void 0));h.selectedIndex=t;let f=new uv;return f.addChild(new ff(m.bold(m.fg("accent","Checks settings")))),f.addChild({render:w=>h.render(w),invalidate:()=>h.invalidate()}),f.addChild(new cv(1)),f.addChild(new ff(m.fg("dim","\u2191\u2193 navigate enter select ctrl+s save & exit esc cancel"))),{render(w){return f.render(w)},invalidate(){f.invalidate()},handleInput(w){h.handleInput(w),t=h.selectedIndex,s.requestRender()}}});if(!n)return;let r=lt(),a=r?.solverGap??Ea;if(n==="reviewer-model"){let s=await hf(e,r,"Select reviewer model");if(!s)continue;let m=Ra(e,s.provider,s.modelId),c=m.includes(r?.thinkingLevel??"off")?r?.thinkingLevel??"off":m[0]??"off";dt({...s,thinkingLevel:c,solverGap:a}),e.ui.notify(`Reviewer model saved: ${s.provider}/${s.modelId}`,"info");continue}if(n==="solvergap-model"){if(!r){e.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");continue}let s=await hf(e,a.provider?a:null,"Select solver model");if(!s)continue;let m=Ra(e,s.provider,s.modelId),c=m.includes(a.thinkingLevel)?a.thinkingLevel:m[0]??"off";dt({...r,solverGap:{...a,...s,thinkingLevel:c}}),e.ui.notify(`Solver model saved: ${s.provider}/${s.modelId}`,"info")}}}function yf(e){e.registerCommand("checks",{description:"Find behavioral gaps in test coverage. Requires an option \u2014 see /checks.",getArgumentCompletions:dv,handler:async(t,n)=>{let r=t.trim();if(!r){n.ui.notify(Yo.map(N=>`${N.value} \u2014 ${N.description}`).join(`
323
+ `),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],s=new Set(Yo.map(N=>N.value)),m=a.filter(N=>!s.has(N));if(m.length){n.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see options.`,"warning");return}if(a.includes("--config")){a.length>1?n.ui.notify("--config cannot be combined with other options.","warning"):await fv(n);return}let c=a.includes("--gap-finder"),l=a.includes("--solver-gap-finder");if(!c&&!l)return;if(wa()){n.ui.notify("A checks run is already in progress.","warning");return}let h=lt();if(!h){n.ui.notify("No gap-finder model configured. Run /checks --config first.","error");return}let f=n.modelRegistry.find(h.provider,h.modelId);if(!f||!n.modelRegistry.hasConfiguredAuth(f)){n.ui.notify("Configured behavioral gap-finder model is unavailable or unauthenticated. Run /checks --config.","error");return}let w=Wo.filter(N=>!cf(Ze(n.cwd,N)));if(w.length){n.ui.notify(`Missing required file(s): ${w.join(", ")}`,"error");return}let D=null,_;if(l){if(D=ui(),!D||!cf(Ze(n.cwd,"test.sh"))){n.ui.notify("Configure solver gap finder and provide test.sh before running it.","error");return}if(_=n.modelRegistry.find(D.provider,D.modelId),!_||!n.modelRegistry.hasConfiguredAuth(_)){n.ui.notify("Configured solver gap-finder model is unavailable or unauthenticated.","error");return}}let ue=sf(),Me=D?.solverCount??0,Re=(c?2:0)+(l?Me+1:0);n.ui.setWidget(Et,nr("preparing clean snapshot",0,Re)),n.ui.notify(`gap finders (${a.join(" ")}) started. Press ${lv} to cancel.`,"info");let De,Qe=[];try{let N=Ze(df(),`checks-${uf()}`);lf(N,{recursive:!0}),De=N;let et=await ur(e,n.cwd,N);if(et.status==="error"){n.ui.notify(`checks: ${et.error}`,"error");return}for(let Ae of Wo)iv(Ze(n.cwd,Ae),Ze(N,Ae));let Ne=af(),pt=of(),tt=0,ut={status:"ok",gaps:[]},zt={status:"ok",gaps:[]};if(c){let Ae={tempDir:N,model:f,thinkingLevel:h.thinkingLevel,testRubric:Ne,fairnessRules:pt,cancelSignal:ue.signal};if(n.ui.setWidget(Et,nr("finding sentence-by-sentence test gaps",tt,Re)),ut=await Yd(Ae),tt+=1,n.ui.setWidget(Et,nr("reviewing test gaps",tt,Re)),ut.gaps.reduce((Oa,Pa)=>Oa+Pa.gaps.length,0)>0&&(zt=await Zd({...Ae,statementReports:ut.gaps})),tt+=1,ue.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let ct=[],rr={status:"ok",gaps:[]};if(l&&D){let Ae=[],Sa=nt=>{Ae.push(nt),tt+=1,n.ui.setWidget(Et,nr("solver gap finder: solving",tt,Re,{passed:Ae.filter(Le=>Le.passed).length,failed:Ae.filter(Le=>!Le.passed).length}))},Oa=await Promise.all(Array.from({length:Me},async(nt,Le)=>{let hn=Ze(df(),`checks-solvergap-${uf()}`);return lf(hn,{recursive:!0}),Qe.push(hn),{index:Le+1,setup:await fi({pi:e,repoDir:n.cwd,solverDir:hn,testPatchPath:Ze(n.cwd,"test.patch"),agentPromptPath:Ze(n.cwd,"agent_prompt.md")})}})),Pa=Ho().replace(/[:.]/g,"-");if(ct=await Promise.all(Oa.map(async({index:nt,setup:Le})=>{if(Le.status!=="ok"){let ri={index:nt,status:Le.status,passed:!1,diff:"",testOutputTail:Le.error,durationMs:0,totalTests:null,failedTests:null};return Sa(ri),ri}let hn=Date.now(),{outcome:ti,trajectory:bf}=await Jd({pi:e,solverDir:Le.solverDir,model:_,thinkingLevel:D.thinkingLevel,timeoutMinutes:D.timeoutMinutes,cancelSignal:ue.signal}),{testOutputXmlPath:vf,...Ca}=await hi({pi:e,index:nt,workspace:Le,status:ti==="done"?"ok":ti,durationMs:Date.now()-hn}),$f=D.saveArtifacts?gi({repoDir:n.cwd,runId:Pa,index:nt,trajectory:bf,solutionPatch:Ca.diff,testOutputXmlPath:vf,testOutputTail:Ca.testOutputTail}):void 0,ni={...Ca,artifactsDir:$f};return Sa(ni),ni})),ct.some(nt=>nt.status!=="patchFailed"&&nt.status!=="error")&&(yi(N,ct),rr=await Xd({tempDir:N,model:f,thinkingLevel:h.thinkingLevel,solverResults:ct,testRubric:Ne,fairnessRules:pt,cancelSignal:ue.signal})),tt+=1,ue.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let If=c&&(ut.status!=="ok"||ut.gaps.length>0&&zt.status!=="ok"),Zo=ef({existingReport:Qd(Ze(n.cwd,"shipd_report.json")),config:h,runGapFinder:c,testGaps:zt.gaps,gapAnalysisIncomplete:If,gapFinderStatus:ut.status,gapFilterStatus:zt.status,runSolverGapFinder:l,solverResults:ct,solverGaps:rr.gaps,solverGapAnalysisIncomplete:l&&(ct.some(Ae=>Ae.status==="error")||rr.status!=="ok"),solverComparisonStatus:rr.status}),Qo=nf({merged:Zo,runGapFinder:c,runSolverGapFinder:l});e.sendMessage({customType:"shipd_checks_report",content:Qo.content,display:!0,details:Qo.details});let ei=Ze(n.cwd,"shipd_report.json");mv(ei,JSON.stringify(Zo,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${ei}`,"info")}catch(N){n.ui.notify(`checks failed: ${N instanceof Error?N.message:String(N)}`,"error")}finally{n.ui.setWidget(Et,void 0),De&&sv(De,{recursive:!0,force:!0});for(let N of Qe)xi(N);mf()}}})}var xf=gv.ctrlShift("x");function xv(e){e.registerMessageRenderer("shipd_checks_report",(t,n,r)=>{let a=t.details??{},s=new hv;s.addChild(new Xo(r.bold(r.fg("accent","Checks")),0,0));let m=!1,c=l=>{s.addChild(new Xo(l,0,0)),m=!0};if(a.showGaps){let l=a.gapsCount??0;c(l>0?r.fg("warning",` \u26A0 ${l} test gap(s) found`):r.fg("success"," \u2713 no test gaps found"))}if(a.showSolverGaps){let l=a.solverDetails??[],h=l.filter(_=>_.passed).length,f=a.solverGapsCount??0;s.addChild(new yv(1)),c(r.bold(r.fg("accent","Solver gap finder")));for(let _ of l){let ue=_.passed?r.fg("success","\u2713"):r.fg("error","\u2717"),Me=_.passed?"passed":_.status==="ok"?"failed tests":_.status;c(` ${ue} Solver ${_.index}: ${Me} (${tf(_.durationMs)})`)}let w=h===l.length&&l.length>0?r.fg("success",`${h}/${l.length} solvers passed`):r.fg("warning",`${h}/${l.length} solvers passed`),D=f>0?r.fg("warning",`${f} behavioral gap(s) found`):r.fg("success","no behavioral gaps found");c(` ${w}, ${D}`)}return m||s.addChild(new Xo(r.fg("dim"," nothing to report"),0,0)),s}),e.registerShortcut(xf,{description:"Cancel an in-progress /checks run",handler:t=>{wa()&&pf()&&(t.ui.setWidget(Et,[`checks: cancelling (${xf})...`]),t.ui.notify("checks: cancelling...","warning"))}}),yf(e)}export{xv as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sreetej510/pi-shipd-checks",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Pi extension that runs a strict, multi-agent fairness review of a benchmark task's agent_prompt.md, test.patch, and solution.patch, plus behavioral test-gap analysis, via /checks.",
5
5
  "type": "module",
6
6
  "license": "MIT",