@sreetej510/pi-shipd-checks 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/index.js +18 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,9 +76,13 @@ in `--all` since it's the most expensive stage (several full coding-agent runs w
|
|
|
76
76
|
- **Reviewer**: model and thinking level used by the focus reviewers, gap-finders, gap-validator,
|
|
77
77
|
and the solver-gap-finder's comparison reviewer.
|
|
78
78
|
- **Solver Gap Finder**: model, thinking level, per-agent timeout in minutes (default 30, clamped to
|
|
79
|
-
1–120),
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
1–120), number of parallel solver agents (default 3, clamped to 1–10), and a "Save artifacts"
|
|
80
|
+
on/off toggle (default on) — used only by the TDD-style solver agents spawned by
|
|
81
|
+
`--solver-gap-finder`. These write code and run shell commands (a heavier job than the
|
|
82
|
+
read-only reviewers), so you may want a stronger coding model here. Turning "Save artifacts"
|
|
83
|
+
off skips persisting `trajectory.json`/`solution.patch`/test output to
|
|
84
|
+
`.pi/shipd-checks/<run-id>/` for each run — useful if you don't need to inspect solver runs
|
|
85
|
+
after the fact and want to save disk space.
|
|
82
86
|
|
|
83
87
|
Use ↑/↓ to move between rows, Enter/Space to open a model picker or cycle a value in place, and
|
|
84
88
|
`Ctrl+S` to save and exit (Esc cancels without discarding already-saved changes). Everything is
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Uf=Object.defineProperty;var Ot=(e,t)=>{for(var r in t)Uf(e,r,{get:t[r],enumerable:!0})};import{Container as Cv,Key as Mv,Spacer as Av,Text as pi}from"@earendil-works/pi-tui";import{randomUUID as Tf}from"node:crypto";import{copyFileSync as $v,existsSync as kf,mkdirSync as wf,rmSync as Tv,writeFileSync as kv}from"node:fs";import{tmpdir as Ef}from"node:os";import{join as ct}from"node:path";import{getSettingsListTheme as wv}from"@earendil-works/pi-coding-agent";import{Container as Ev,Key as zt,matchesKey as Vt,Spacer as Rv,Text as Rf}from"@earendil-works/pi-tui";import{createAgentSession as un,SessionManager as cn}from"@earendil-works/pi-coding-agent";import{copyFileSync as Wf,existsSync as Wa,lstatSync as Hf,mkdirSync as Ha,readFileSync as Ya,rmSync as vi,symlinkSync as Yf,unlinkSync as Jf,writeFileSync as at}from"node:fs";import{join as ye}from"node:path";import{existsSync as bn,mkdirSync as Kf,readFileSync as _a,writeFileSync as _f}from"node:fs";import{dirname as zf,join as li}from"node:path";import{getAgentDir as di}from"@earendil-works/pi-coding-agent";var xn=li(di(),"checks-config.json"),In=li(di(),"settings.json"),fi=10,gi=60,za=20,Va=1,hi=5,vn=3,Ba=!0,Vf=["off","minimal","low","medium","high","xhigh","max"];function yi(e){return e?.reasoning?Vf.filter(t=>{let r=e.thinkingLevelMap?.[t];return r===null?!1:t==="xhigh"||t==="max"?r!==void 0:!0}):["off"]}function dt(){try{if(!bn(xn))return null;let e=JSON.parse(_a(xn,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function ft(e){let t=zf(xn);bn(t)||Kf(t,{recursive:!0}),_f(xn,JSON.stringify(e,null,2),"utf-8")}function xi(){let e=dt()?.solverGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e,timeoutMinutes:e.timeoutMinutes>0?e.timeoutMinutes:za,solverCount:e.solverCount>0?e.solverCount:vn,saveArtifacts:typeof e.saveArtifacts=="boolean"?e.saveArtifacts:Ba}}function Ii(){try{return bn(In)?JSON.parse(_a(In,"utf-8")).enabledModels??[]:[]}catch{return[]}}function bi(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Bf(){try{if(bn(In))return JSON.parse(_a(In,"utf-8"))}catch{}return{}}function $n(){let e=Bf().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function Tn(e){return e.replace(/\\/g,"/")}function kn(e){return`'${e.replace(/'/g,"'\\''")}'`}async function wn(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 ${kn(Tn(r))}`,s=await e.exec($n(),["-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 Ja=3e4,Xf=4e3,Zf=".pi/shipd-checks",kr="solver_gap_solutions";function Qf(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 eg(e,t){return e.length>t?e.slice(e.length-t):e}async function $i(e){let{pi:t,repoDir:r,solverDir:n,testPatchPath:a,agentPromptPath:s}=e,m=await wn(t,r,n);if(m.status==="error")return{status:"error",solverDir:n,error:m.error};let c={cwd:n,timeout:Ja},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 d=await t.exec("git",["add","-A"],c);if(d.code!==0)return{status:"error",solverDir:n,error:d.stderr?.trim()||"git add (baseline) failed"};let g=await t.exec("git",["commit","-m","baseline","--allow-empty"],c);if(g.code!==0)return{status:"error",solverDir:n,error:g.stderr?.trim()||"git commit (baseline) failed"};let b=ye(n,".gitignore"),V=Wa(b)?Ya(b,"utf-8"):"";if(!V.split(/\r?\n/).some(lt=>lt.trim()==="node_modules")){let lt=V.length>0&&!V.endsWith(`
|
|
2
2
|
`)?`
|
|
3
3
|
`:"";at(b,`${V}${lt}node_modules
|
|
4
|
-
`,"utf-8")}let G=ye(
|
|
5
|
-
${j.stderr}`.trim(),Jf);return{index:n,status:a,passed:le,diff:V,testOutputTail:ne,durationMs:s,testOutputXmlPath:G}}function $i(e){let{repoDir:t,runId:n,index:r,trajectory:a,solutionPatch:s,testOutputXmlPath:m,testOutputTail:c}=e,l=ye(t,Xf,n,`solver_${r}`);Wa(l,{recursive:!0}),at(ye(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),at(ye(l,"solution.patch"),s,"utf-8");try{let d=Ha(m,"utf-8");at(ye(l,"test_output.xml"),d,"utf-8")}catch{at(ye(l,"test_output.txt"),c,"utf-8")}return l}function Ti(e,t){let n=ye(e,wn);Wa(n,{recursive:!0});let r=t.map(a=>{let s=ye(n,`solver_${a.index}`);return Wa(s,{recursive:!0}),at(ye(s,"solution.diff"),a.diff,"utf-8"),at(ye(s,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return at(ye(n,"manifest.json"),JSON.stringify(r,null,2),"utf-8"),n}function ki(e){let t=ye(e,"node_modules");try{Wf(t).isSymbolicLink()&&Ii(t,{force:!0})}catch{}try{Ii(e,{recursive:!0,force:!0})}catch{}}var p={};St(p,{Assign:()=>eg,Clone:()=>On,Create:()=>ih,Discard:()=>sh,Metrics:()=>Ue,Update:()=>mh});var Ue={assign:0,create:0,clone:0,discard:0,update:0};function eg(e,t){return Ue.assign+=1,{...e,...t}}var i={};St(i,{Entries:()=>vg,EntriesRegExp:()=>bg,Every:()=>yg,EveryAll:()=>xg,GraphemeCount:()=>fg,HasPropertyKey:()=>Ig,IsArray:()=>Rn,IsBigInt:()=>En,IsBoolean:()=>Ai,IsClassInstance:()=>lg,IsConstructor:()=>ig,IsDeepEqual:()=>Qa,IsEqual:()=>M,IsFunction:()=>Li,IsGreaterEqualThan:()=>ji,IsGreaterThan:()=>pg,IsInteger:()=>Xa,IsLessEqualThan:()=>qi,IsLessThan:()=>ug,IsMaxLength:()=>gg,IsMinLength:()=>hg,IsMultipleOf:()=>cg,IsNull:()=>Sr,IsNumber:()=>Or,IsObject:()=>Sn,IsObjectNotArray:()=>sg,IsString:()=>Pr,IsSymbol:()=>mg,IsUndefined:()=>Za,IsUnsafePropertyKey:()=>Fi,IsValueLike:()=>dg,Keys:()=>Rr,ShiftLeft:()=>Cr,Symbols:()=>$g,Values:()=>Tg});function Pt(e,t,n){return e>=t&&e<=n}function tg(e){return e===8205}function ng(e){return Pt(e,55296,56319)}function wi(e){return Pt(e,127462,127487)}function Ri(e){return Pt(e,65024,65039)}function Si(e){return Pt(e,768,879)||Pt(e,6832,6911)||Pt(e,7616,7679)||Pt(e,65056,65071)}function Er(e){return e>65535?2:1}function Ei(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Si(n)||Ri(n))t+=Er(n);else break}return t}function Ja(e,t){let n=e.codePointAt(t),r=t+Er(n);for(r=Ei(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+Er(a),r=Ei(e,r)}return wi(n)&&r<e.length&&wi(e.codePointAt(r))&&(r+=Er(e.codePointAt(r))),r}function Oi(e){return ng(e)||Si(e)||Ri(e)||tg(e)}function Pi(e){let t=0,n=0;for(;n<e.length;)n=Ja(e,n),t++;return t}function rg(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=Ja(e,r),n++,n>=t)return!0;return!1}function ag(e,t){let n=0,r=0;for(;r<e.length;)if(r=Ja(e,r),n++,n>t)return!1;return!0}function Ci(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Oi(e.charCodeAt(n)))return rg(e,t);if(n++,n>=t)return!0}return!1}function Mi(e,t){let n=0;for(;n<e.length;){if(Oi(e.charCodeAt(n)))return ag(e,t);if(n++,n>t)return!1}return!0}function Rn(e){return Array.isArray(e)}function En(e){return M(typeof e,"bigint")}function Ai(e){return M(typeof e,"boolean")}function ig(e){if(Za(e)||!Li(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Li(e){return M(typeof e,"function")}function Xa(e){return Number.isInteger(e)}function Sr(e){return M(e,null)}function Or(e){return Number.isFinite(e)}function sg(e){return Sn(e)&&!Rn(e)}function Sn(e){return M(typeof e,"object")&&!Sr(e)}function Pr(e){return M(typeof e,"string")}function mg(e){return M(typeof e,"symbol")}function Za(e){return M(e,void 0)}function M(e,t){return e===t}function pg(e,t){return e>t}function ug(e,t){return e<t}function qi(e,t){return e<=t}function ji(e,t){return e>=t}function cg(e,t){if(En(e)||En(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!Or(e)||Xa(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 lg(e){if(!Sn(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Sr(t)?!1:M(typeof t.constructor,"function")&&!(M(t.constructor,globalThis.Object)||M(t.constructor.name,"Object"))}function dg(e){return En(e)||Ai(e)||Sr(e)||Or(e)||Pr(e)||Za(e)}function fg(e){return Pi(e)}function gg(e,t){return Mi(e,t)}function hg(e,t){return Ci(e,t)}function yg(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function xg(e,t,n){let r=!0;for(let a=t;a<e.length;a++)n(e[a],a)||(r=!1);return r}function Cr(e,t,n){return M(e.length,0)?n():t(e[0],e.slice(1))}function Fi(e){return M(e,"__proto__")||M(e,"constructor")||M(e,"prototype")}function Ig(e,t){return Fi(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function bg(e){return Rr(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function vg(e){return Object.entries(e)}function Rr(e){return Object.getOwnPropertyNames(e)}function $g(e){return Object.getOwnPropertySymbols(e)}function Tg(e){return Object.values(e)}function kg(e,t){if(!Sn(t))return!1;let n=Rr(e);return M(n.length,Rr(t).length)&&n.every(r=>Qa(e[r],t[r]))}function wg(e,t){return Rn(t)&&M(e.length,t.length)&&e.every((n,r)=>Qa(e[r],t[r]))}function Qa(e,t){return Rn(e)?wg(e,t):Sn(e)?kg(e,t):M(e,t)}var ft={};St(ft,{IsBigInt64Array:()=>Ng,IsBigUint64Array:()=>Ug,IsBoolean:()=>Rg,IsDate:()=>_g,IsFloat32Array:()=>Dg,IsFloat64Array:()=>Gg,IsInt16Array:()=>Lg,IsInt32Array:()=>jg,IsInt8Array:()=>Cg,IsMap:()=>Vg,IsNumber:()=>Sg,IsRegExp:()=>Kg,IsSet:()=>zg,IsString:()=>Og,IsTypeArray:()=>Pg,IsUint16Array:()=>qg,IsUint32Array:()=>Fg,IsUint8Array:()=>Mg,IsUint8ClampedArray:()=>Ag});function Rg(e){return e instanceof Boolean}function Sg(e){return e instanceof Number}function Og(e){return e instanceof String}function Pg(e){return globalThis.ArrayBuffer.isView(e)}function Cg(e){return e instanceof globalThis.Int8Array}function Mg(e){return e instanceof globalThis.Uint8Array}function Ag(e){return e instanceof globalThis.Uint8ClampedArray}function Lg(e){return e instanceof globalThis.Int16Array}function qg(e){return e instanceof globalThis.Uint16Array}function jg(e){return e instanceof globalThis.Int32Array}function Fg(e){return e instanceof globalThis.Uint32Array}function Dg(e){return e instanceof globalThis.Float32Array}function Gg(e){return e instanceof globalThis.Float64Array}function Ng(e){return e instanceof globalThis.BigInt64Array}function Ug(e){return e instanceof globalThis.BigUint64Array}function Kg(e){return e instanceof globalThis.RegExp}function _g(e){return e instanceof globalThis.Date}function zg(e){return e instanceof globalThis.Set}function Vg(e){return e instanceof globalThis.Map}function Wg(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function Hg(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:Ct(a.value)})}return t}function Yg(e){let t={};for(let n of i.Keys(e))i.IsUnsafePropertyKey(n)||(t[n]=Ct(e[n]));for(let n of i.Symbols(e))t[n]=Ct(e[n]);return t}function Jg(e){return i.IsClassInstance(e)?e:Wg(e)?Hg(e):Yg(e)}function Xg(e){return e.map(t=>Ct(t))}function Zg(e){return e.slice()}function Qg(e){return new RegExp(e.source,e.flags)}function eh(e){return new Map(Ct([...e.entries()]))}function th(e){return new Set(Ct([...e.values()]))}function Ct(e){return ft.IsTypeArray(e)?Zg(e):ft.IsRegExp(e)?Qg(e):ft.IsMap(e)?eh(e):ft.IsSet(e)?th(e):i.IsArray(e)?Xg(e):i.IsObject(e)?Jg(e):e}function On(e){return Ue.clone+=1,Ct(e)}var Mt={};St(Mt,{Get:()=>ah,Reset:()=>nh,Set:()=>rh});var ot={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function nh(){ot.immutableTypes=!1,ot.maxErrors=8,ot.useAcceleration=!0,ot.exactOptionalPropertyTypes=!1,ot.enumerableKind=!1,ot.correctiveParse=!1,ot.unionPrioritySort=!0}function rh(e){for(let t of i.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(ot,t,{value:n})}}function ah(){return ot}function oh(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 Di(e,t){return{...e,...t}}function ih(e,t,n={}){Ue.create+=1;let r=Mt.Get(),a=Di(t,n),s=r.enumerableKind?Di(a,e):oh(a,e);return r.immutableTypes?Object.freeze(s):s}function sh(e,t){Ue.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(On(e)),a=new Set(t);for(let s of Object.keys(r))a.has(s)||Object.defineProperty(n,s,r[s]);return n}function mh(e,t,n){Ue.update+=1;let r=Mt.Get(),a=On(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 re(e){return i.IsObject(e)}function I(e,t,n){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function gt(e){return y(e,"Deferred")}function ph(e){return p.Update(e,{"~readonly":!0},{})}function Pn(e,t){return p.Update(ph(e),{},t)}function Gi(e,t,n,r){let a=f(e,t,n);return Pn(a,r)}function uh(e){return p.Update(e,{"~optional":!0},{})}function Cn(e,t){return p.Update(uh(e),{},t)}function Ni(e,t,n,r){let a=f(e,t,n);return Cn(a,r)}function Ae(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function z(e){return y(e,"Array")}function Mr(e){return p.Discard(e,["~kind","type","items"])}function ze(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function ie(e){return y(e,"Constructor")}function Ui(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ve(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function se(e){return y(e,"Function")}function Ki(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function it(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function me(e){return y(e,"Ref")}function ht(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Wt(e){return y(e,"Generic")}function Ht(e){return p.Create({"~kind":"Any"},{},e)}function Z(e){return y(e,"Any")}var _i="(?!)";function D(e){return p.Create({"~kind":"Never"},{not:{}},e)}function yt(e){return y(e,"Never")}function Be(e,t={}){return I("AddOptional",[e],t)}function At(e,t={}){return Cn(e,t)}function zi(e){return At(e)}function xe(e){return re(e)&&i.HasPropertyKey(e,"~optional")}function Vi(e){return i.Keys(e).filter(t=>!xe(e[t]))}function Ar(e){return i.Keys(e)}function Lr(e){return i.Values(e)}function $(e,t={}){let n=Vi(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function A(e){return y(e,"Object")}function Bi(e){return p.Discard(e,["~kind","type","properties","required"])}function ue(e){return p.Create({"~kind":"Unknown"},{},e)}function ae(e){return y(e,"Unknown")}function We(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 de(e){return y(e,"Cyclic")}function Wi(e){return p.Update(e,{"~unsafe":null},{})}function qr(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var He={};St(He,{Match:()=>ch});function ch(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Mn(...e){let[t,n]=He.Match(e,{2:(r,a)=>[r,a,a],1:r=>[r,ue(),ue()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function J(e){return y(e,"Infer")}function Lt(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function H(e){return y(e,"Dependent")}function Hi(e){return p.Discard(e,["~kind","if","then","else"])}function Yi(e){return i.IsObjectNotArray(e)}function Ji(e){return i.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function Xi(e){return i.IsString(e)||i.IsNumber(e)}function Zi(e,t){let n=Yi(e)?Ji(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function be(e){return y(e,"Enum")}function Ie(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function O(e){return y(e,"Intersect")}function Qi(e){return p.Discard(e,["~kind","allOf"])}function X(){throw new Error("Unreachable")}var es;(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"})(es||(es={}));var XT=BigInt("14695981039346656037"),[ZT,QT]=[BigInt("1099511628211"),BigInt("18446744073709551616")],ek=Array.from({length:256}).map((e,t)=>BigInt(t)),ts=new Float64Array(1),tk=new DataView(ts.buffer),nk=new Uint8Array(ts.buffer);var rk=new TextEncoder;var An=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=jr(n)?m=>this.decode(n["~codec"].decode(m)):this.decode,a=jr(n)?m=>n["~codec"].encode(t(m)):t,s={decode:r,encode:a};return p.Update(this.type,{"~codec":s},{})}},Ln=class{constructor(t){this.type=t}Decode(t){return new An(this.type,t)}};function Fr(e){return new Ln(e)}function rs(e,t){return Fr(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function as(e,t){return Fr(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function jr(e){return re(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function os(e){return Yt(e)}function qt(e){return re(e)&&i.HasPropertyKey(e,"~immutable")}function Ye(e,t={}){return I("AddReadonly",[e],t)}function jt(e,t={}){return Pn(e,t)}function is(e){return jt(e)}function Ft(e){return re(e)&&i.HasPropertyKey(e,"~readonly")}function gh(e,t){let n=eo(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function ss(...e){let[t,n,r]=He.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return gh(t,{check:n,error:r})}function hh(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function eo(e){return re(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>hh(t))}var ms="-?(?:0|[1-9][0-9]*)n";function qn(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Je(e){return y(e,"BigInt")}function Dr(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Fe(e){return y(e,"Boolean")}function jn(e){return p.Create({"~kind":"Identifier"},{name:e})}function ps(e){return y(e,"Identifier")}var Gr="-?(?:0|[1-9][0-9]*)";function Dt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function ve(e){return y(e,"Integer")}var to=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function yh(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new to(e)})()}function P(e,t){return p.Create({"~kind":"Literal"},{type:yh(e),const:e},t)}function Nr(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function us(e){return L(e)&&i.IsNumber(e.const)}function cs(e){return L(e)&&i.IsString(e.const)}function L(e){return y(e,"Literal")}function Jt(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Xt(e){return y(e,"Null")}var Ur="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Se(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function Q(e){return y(e,"Number")}function Zt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xt(e){return y(e,"Symbol")}function Gt(...e){let[t,n,r]=He.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,ue(),ue()]});return p.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function ls(e){return y(e,"Parameter")}var Kr=".*";function De(e){return p.Create({"~kind":"String"},{type:"string"},e)}function $e(e){return y(e,"String")}function E(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function ds(e){return p.Discard(e,["~kind","anyOf"])}function Fn(e){let t=fs(e);return i.IsEqual(t.length,2)?t[0]:[]}function xh(e){return!0}function gs(e){return i.ShiftLeft(e,(t,n)=>Ih(t)?gs(n):!1,()=>!0)}function hs(e){return i.IsEqual(e.length,0)?!1:gs(e)}function Ih(e){return x(e)?hs(e.anyOf):L(e)?xh(e.const):!1}function _r(e){return hs(e)}function zr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function ys(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>ys(a,t,[...n,`${r}${t}`]),()=>n)}function bh(e,t){return i.IsEqual(e.length,0)?[`${t}`]:ys(e,t)}function xs(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>xs(e,a,[...n,...Is(e,r)]),()=>n)}function Is(e,t){return x(t)?xs(e,t.anyOf):L(t)?bh(e,t.const):X()}function bs(e,t){return i.ShiftLeft(t,(n,r)=>bs(Is(e,n),r),()=>e)}function vh(e){return e.map(t=>P(t))}function $h(e){let t=bs([],e),n=vh(t);return E(n)}function Th(e){return i.IsEqual(e.length,0)?X():i.IsEqual(e.length,1)&&L(e[0])?e[0]:$h(e)}function no(e){let t=Fn(e);return i.IsEqual(t.length,0)?De():_r(t)?Th(t):zr(e)}function vs(e){let t=no(e);return ee(t)?De():t}function ke(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function $s(e){return ke(Ke,e)}function Ts(e){return $({true:e,false:e})}function te(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 N(e){return y(e,"Tuple")}function ks(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function kh(e){return p.Discard(e,["~readonly"])}function ro(e,t){return p.Update(kh(e),{},t)}function ws(e,t,n,r){let a=f(e,t,n);return ro(a,r)}function Es(e,t={}){return I("RemoveReadonly",[e],t)}function Rs(e,t={}){return ro(e,t)}function wh(e){return p.Discard(e,["~optional"])}function ao(e,t){return p.Update(wh(e),{},t)}function Ss(e,t,n,r){let a=f(e,t,n);return ao(a,r)}function Os(e,t={}){return I("RemoveOptional",[e],t)}function Vr(e,t={}){return ao(e,t)}function oo(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function Ps(e){let t=oo(e.items);return $(t)}function Eh(e,t){return Ft(e)?!!Ft(t):!1}function Rh(e,t){return xe(e)?!!xe(t):!1}function Sh(e,t){let n=Eh(e,t),r=Rh(e,t),a=B([e,t]),s=Rs(Vr(a));return n&&r?jt(At(s)):n&&!r?jt(s):!n&&r?At(s):s}function Oh(e,t,n){return n in e?n in t?Sh(e[n],t[n]):e[n]:n in t?t[n]:D()}function Ph(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((r,a)=>({...r,[a]:Oh(e,t,a)}),{})}function Cs(e){return A(e)?e.properties:N(e)?oo(e.items):X()}function Ms(e,t){let n=Cs(e),r=Cs(t),a=Ph(n,r);return $(a)}function As(e,t){let n=Qt(e,t);return i.IsEqual(n,Gn)?e:i.IsEqual(n,Nn)||i.IsEqual(n,Dn)?t:D()}function Ls(e){return A(e)||N(e)}function Ch(e,t){let n=x(e),r=x(t);return n||r}function Mh(e,t){let n=Ge(e),r=Ge(t),a=Ch(n,r),s=Ls(n),m=Ls(r);return a?B([n,r]):s&&m?Ms(n,r):s&&!m?n:!s&&m?r:As(n,r)}function qs(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>qs(e,a,[...n,Mh(e,r)]),()=>i.IsEqual(n.length,0)?[e]:n)}function js(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>js(a,t,[...n,...Un([r],t)]),()=>n)}function Un(e,t=[]){return i.ShiftLeft(e,(n,r)=>x(n)?Un(r,js(n.anyOf,t)):Un(r,qs(n,t)),()=>t)}function Ah(e,t){let n=fe({},e,t);return v.IsExtendsTrueLike(n)?[]:[e]}function Lh(e,t){return e.reduce((n,r)=>[...n,...Ah(r,t)],[])}function Br(e,t){let n=Ge(e),r=x(n)?n.anyOf:[n],a=Lh(r,t);return Oe(a)}function _e(e,t,n){let r=Ie([e,t]),a=Br(n,e);return Oe([r,a])}function Le(e){let t=e.map(n=>P(n));return Oe(t)}function B(e){let t=Un(e),n=io(t);return st(n)}function we(e){let t=vs(e);return Ge(t)}function Oe(e){let t=io(e);return st(t)}function Ge(e){return H(e)?_e(e.if,e.then,e.else):be(e)?Le(e.enum):O(e)?B(e.allOf):ee(e)?we(e.pattern):x(e)?Oe(e.anyOf):e}function st(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?D():E(e)}function Fs(e,t){let n=Le(e);return It(n,t)}function Ds(e,t){return ke(bt,t)}function Gs(e,t){let n=B(e);return It(n,t)}function Ns(e,t){return i.IsString(e)||i.IsNumber(e)?$({[e]:t}):i.IsEqual(e,!1)?$({false:t}):i.IsEqual(e,!0)?$({true:t}):$({})}function Us(e,t){return ke(en,t)}function Ks(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?ke(e.pattern.toString(),t):ke(Ke,t)}function _s(e,t){let n=Fn(e);return _r(n)?It(we(e),t):ke(e,t)}function qh(e){return x(e)?Kn(e.anyOf):[e]}function Kn(e){return e.reduce((t,n)=>[...t,...qh(n)],[])}function jh(e){return e.some(t=>$e(t)||Q(t)||ve(t))}function Fh(e,t){return i.IsEqual(jh(e),!0)?ke(Ke,t):void 0}function Dh(e,t){return e.reduce((n,r)=>L(r)&&(i.IsString(r.const)||i.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function Gh(e,t){let n=Dh(e,t);return $(n)}function zs(e,t){let n=Kn(e),r=Fh(n,t);return re(r)?r:Gh(n,t)}function It(e,t){return Z(e)?$s(t):Fe(e)?Ts(t):be(e)?Fs(e.enum,t):ve(e)?Ds(e,t):O(e)?Gs(e.allOf,t):L(e)?Ns(e.const,t):Q(e)?Us(e,t):x(e)?zs(e.anyOf,t):$e(e)?Ks(e,t):ee(e)?_s(e.pattern,t):$({})}function so(e,t,n){return k([e])?p.Update(It(e,t),{},n):Wr(e,t,n)}function Vs(e,t,n,r,a){let s=f(e,t,n),m=f(e,t,r);return so(s,m,a)}var bt=`^${Gr}$`,en=`^${Ur}$`,Ke=`^${Kr}$`;function Wr(e,t,n={}){return I("Record",[e,t],n)}function Hr(e,t,n={}){return so(e,t,n)}function Bs(e,t){return ke(e,t)}function Yr(e){return i.IsEqual(e,Ke)?De():i.IsEqual(e,bt)?Dt():i.IsEqual(e,en)?Se():no(e)}function Ne(e){return i.Keys(e.patternProperties)[0]}function tn(e){let t=Ne(e);return Yr(t)}function Te(e){return e.patternProperties[Ne(e)]}function ge(e){return y(e,"Record")}function Nt(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 Xr(e){return y(e,"This")}function nn(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function rn(e){return y(e,"Undefined")}function Zr(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Xe(e){return y(e,"Void")}function Uh(e,t){return i.IsEqual(e,"Array")?Ae(t[0]):i.IsEqual(e,"Capitalize")?ea(t[0]):i.IsEqual(e,"ConstructorParameters")?oa(t[0]):i.IsEqual(e,"Evaluate")?Hp(t[0]):i.IsEqual(e,"Exclude")?ia(t[0],t[1]):i.IsEqual(e,"Extract")?sa(t[0],t[1]):i.IsEqual(e,"Index")?Bn(t[0],t[1]):i.IsEqual(e,"InstanceType")?ma(t[0]):i.IsEqual(e,"Lowercase")?ta(t[0]):i.IsEqual(e,"NonNullable")?pa(t[0]):i.IsEqual(e,"Omit")?ua(t[0],t[1]):i.IsEqual(e,"Parameters")?ca(t[0]):i.IsEqual(e,"Partial")?la(t[0]):i.IsEqual(e,"Pick")?da(t[0],t[1]):i.IsEqual(e,"Readonly")?fa(t[0]):i.IsEqual(e,"KeyOf")?Wn(t[0]):i.IsEqual(e,"Record")?Wr(t[0],t[1]):i.IsEqual(e,"Required")?ga(t[0]):i.IsEqual(e,"ReturnType")?ha(t[0]):i.IsEqual(e,"Uncapitalize")?na(t[0]):i.IsEqual(e,"Uppercase")?ra(t[0]):Vn(it(e),t)}function Ut(){throw Error("Unreachable")}var Kh=(e,t=[])=>e.reduce((n,r)=>i.IsArray(r)&&i.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),mt=e=>{let[t,n]=e;return Kh([...t,...n])};function Xs(e){return Gt(e[0],e[2],e[4])}function Zs(e){return Gt(e[0],e[2],e[2])}function Qs(e){return Gt(e[0],ue(),e[2])}function em(e){return Gt(e,ue(),ue())}function tm(e){return mt(e)}function nm(e){return e[1]}function rm(e){return mt(e)}function am(e){return e[1]}function om(e){return Uh(e[0],e[1])}function im(e){return null}function sm(e){return De()}function mm(e){return Se()}function pm(e){return Dr()}function um(e){return nn()}function cm(e){return Jt()}function lm(e){return Dt()}function dm(e){return qn()}function fm(e){return ue()}function gm(e){return Ht()}function hm(e){return $({})}function ym(e){return D()}function xm(e){return Zt()}function Im(e){return Zr()}function bm(e){return Jr()}function vm(e){return P(BigInt(e))}function $m(e){return P(i.IsEqual(e,"true"))}function Tm(e){return P(parseFloat(e))}function km(e){return P(e)}function wm(e){return e[1]}function Em(e){return P(e)}function Rm(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Sm(e){return e[1]}function Om(e){return Qr(e)}function Pm(e){return i.IsEqual(e.length,6)?Lt(e[1],e[3],e[5]):Lt(e[1],e[3],ue())}function Cm(e){return e.length>0}function Mm(e){return e.reduce((t,n)=>i.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function Am(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Lm(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function qm(e){return i.IsEqual(e.length,2)?e[1]:[]}function Ws(e,t){return t.reduce((n,r)=>{let a=r;return i.IsEqual(a.length,1)?Bn(n,a[0]):i.IsEqual(a.length,0)?Ae(n):Ut()},e)}function Hs(e,t){return i.IsEqual(t.length,3)?aa(e,t[0],t[1],t[2]):e}function _h(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:ya(e,t)}function jm(e){let[t,n,r,a,s]=e;return _h(Hs(t?Wn(Ws(n,r)):Ws(n,r),a),s)}function mo(e,t){return i.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,s=mo(r,a);if(i.IsEqual(n,"&"))return O(s)?Ie([e,...s.allOf]):Ie([e,s]);if(i.IsEqual(n,"|"))return x(s)?E([e,...s.anyOf]):E([e,s]);Ut()})():e}function Fm(e){let[t,n]=e;return mo(t,n)}function Dm(e){let[t,n]=e;return mo(t,n)}function Gm(e){return Wp(e[1])}function Nm(e){return e[1]}function Um(e){return ht(e[0],e[2])}function Km(e){return i.IsEqual(e.length,4)?Mn(e[1],e[3]):i.IsEqual(e.length,2)?Mn(e[1],ue()):Ut()}function _m(e){return`${e}`}function zm(e){return ve(e[3])?bt:Q(e[3])?en:xt(e[3])?Ke:$e(e[3])?Ke:Ut()}function Vm(e){return e.length>0}function Bm(e){return e.length>0}function Wm(e){let[t,n,r,a,s]=e;return{[n]:t&&r?Ye(Be(s)):t&&!r?Ye(s):!t&&r?Be(s):s}}function Hm(e){return mt(e)}function Ym(e){return e.reduce((t,n)=>i.HasPropertyKey(n,bt)||i.HasPropertyKey(n,en)||i.HasPropertyKey(n,Ke)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function Jm(e){return Ym(e[1])}function Xm(e){let[t,n]=e,r=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return $(t,r)}function Zm(e){return i.IsEqual(e.length,5)?Ye(Be(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?Ye(e[3]):Be(e[3]):Ut()}function Qm(e){return Ye(Be(e[1]))}function ep(e){return Ye(e[1])}function tp(e){return Be(e[0])}function np(e){return i.IsEqual(e.length,2)?Nt(e[1]):i.IsEqual(e.length,1)?e[0]:Ut()}function rp(e){return mt(e)}function ap(e){return te(e[1])}function op(e){return Ye(Be(e[4]))}function ip(e){return Ye(e[3])}function sp(e){return Be(e[3])}function mp(e){return e[2]}function pp(e){return i.IsEqual(e.length,2)?Nt(e[1]):i.IsEqual(e.length,1)?e[0]:Ut()}function up(e){return mt(e)}function cp(e){return Ve(e[1],e[4])}function lp(e){return ze(e[2],e[5])}function Ys(e,t){return i.IsEqual(e,"remove")?Es(t):i.IsEqual(e,"add")?Ye(t):t}function dp(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 Js(e,t){return i.IsEqual(e,"remove")?Os(t):i.IsEqual(e,"add")?Be(t):t}function fp(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 gp(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function hp(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?_n(jn(e[3]),e[5],e[6][0],Ys(e[1],Js(e[8],e[10]))):_n(jn(e[3]),e[5],it(e[3]),Ys(e[1],Js(e[8],e[10])))}function yp(e){return it(e)}function xp(e){return BigInt(e)}function Ip(e){return parseFloat(e)}function bp(e){return i.IsEqual(e,"true")}function vp(e){return null}function $p(e){return{[e[0]]:e[2]}}function Tp(e){return mt(e)}function zh(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function kp(e){return zh(e[1])}function wp(e){return mt(e)}function Ep(e){return e[1]}function Rp(e){return qn()}function Sp(e){return De()}function Op(e){return Se()}function Pp(e){return Dt()}function Cp(e){return D()}function Mp(e){return P(e)}function Ap(e){return E(e[1])}function Lp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function qp(e){return[e[0],...e[1]]}function jp(e){return e[1]}function Fp(e){return mt(e)}function Dp(e){return i.IsEqual(e.length,2)?e[1]:[]}function Gp(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]]:ht(t,zn(n,r,s))}}function Np(e){let t=e[2],[n,r]=e[3],a=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:zn(t,n,a)}}function Up(e){return{[e[1]]:ht(e[2],e[4])}}function Kp(e){return{[e[1]]:e[3]}}function _p(e){return null}function zp(e){return Ym(mt(e))}function Vp(e){return e[1]}function Bp(e){let t=e[0],n=e[1];return Yp(p.Assign(t,n[0]))}function Hn(e){return M(e.length,2)}function R(e,t,n){return Hn(e)?t(e[0],e[1]):n()}function Wh(e,t){return M(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function W(e,t){for(let n=0;n<e.length;n++){let r=Wh(e[n],t);if(Hn(r))return r}return[]}function po(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var Jp=[...po(97,122),...po(65,90)],uo="0",co=po(49,57),an=[uo,...co],Xp=" ",on=`
|
|
6
|
-
`;var
|
|
7
|
-
`,
|
|
8
|
-
`,
|
|
9
|
-
`,e),([t,
|
|
10
|
-
`,
|
|
11
|
-
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),_u=(e,t=[])=>o(o($o(e),([n,r])=>o(Jx(r),([a,s])=>[[n,a],s])),([n,r])=>_u(r,[...t,n]),()=>[t,e]),Xx=e=>o(o(_u(e),([t,n])=>o(o(o($o(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[zp(t),n]),$o=e=>o(o(Yx(e),([t,n])=>o(o(Vx(n),([r,a])=>[r,a],()=>o(Bx(n),([r,a])=>[r,a],()=>o(Wx(n),([r,a])=>[r,a],()=>o(Hx(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(hu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Vp(t),n]),Zx=e=>o(o($o(e),([t,n])=>o(Xx(n),([r,a])=>[[t,r],a])),([t,n])=>[Bp(t),n]),zu=e=>o(o(Zx(e),([t,n])=>[t,n],()=>o(ex(e),([t,n])=>[t,n],()=>o(S(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function Vu(e){let t=xo(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:X()}function eI(e){return e.join("|")}function tI(e){return e.slice(1,e.length-1)}function nI(e,t,n){return kt(t,`${n}${e}`)}function rI(e,t){return kt(e,`${t}${ms}`)}function aI(e,t){return kt(e,`${t}${Gr}`)}function oI(e,t){return kt(e,`${t}${Ur}`)}function iI(e,t){return Yn(E([P("false"),P("true")]),e,t)}function sI(e,t){return kt(e,`${t}${Kr}`)}function mI(e,t,n){return kt(t,`${n}${tI(e)}`)}function pI(e,t,n){let r=Jn(e,{});return Yn(r,t,n)}function uI(e,t,n){let r=Le(e);return Yn(r,t,n)}function Bu(e,t,n,r=[]){return i.ShiftLeft(e,(a,s)=>Bu(s,t,n,[...r,Yn(a,[],"")]),()=>kt(t,`${n}(${eI(r)})`))}function Yn(e,t,n){return be(e)?uI(e.enum,t,n):ve(e)?aI(t,n):L(e)?nI(e.const,t,n):Je(e)?rI(t,n):Fe(e)?iI(t,n):Q(e)?oI(t,n):$e(e)?sI(t,n):ee(e)?mI(e.pattern,t,n):Hu(e)?pI(e.parameters[0],t,n):x(e)?Bu(e.anyOf,t,n):_i}function kt(e,t){return i.ShiftLeft(e,(n,r)=>Yn(n,r,t),()=>t)}function cI(e){return`^${kt(e,"")}$`}function Wu(e){let t=cI(e);return zr(t)}function Jn(e,t){return k(e)?p.Update(Wu(e),{},t):Qr(e,t)}function Yu(e,t,n,r){let a=qe(e,t,n);return Jn(a,r)}function Qr(e,t={}){return I("TemplateLiteral",[e],t)}function Hu(e){return re(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function Ju(e){return Jn(e,{})}function lI(e){let t=Vu(e);return Ju(t)}function Xu(e,t={}){let n=i.IsString(e)?lI(e):Ju(e);return p.Update(n,{},t)}function ee(e){return y(e,"TemplateLiteral")}var v={};St(v,{ExtendsFalse:()=>T,ExtendsTrue:()=>h,ExtendsUnion:()=>To,IsExtendsFalse:()=>dI,IsExtendsTrue:()=>Qu,IsExtendsTrueLike:()=>mn,IsExtendsUnion:()=>Zu,Match:()=>_});function To(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 Qu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function T(){return p.Create({"~kind":"ExtendsFalse"},{})}function dI(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function mn(e){return Zu(e)||Qu(e)}function _(e,t,n){return mn(e)?t(e.inferred):n()}function fI(e,t,n,r){return _(C(e,n,r),a=>h(p.Assign(p.Assign(e,a),{[t]:n})),()=>T())}function gI(e,t){return h(e)}function hI(e,t,n,r,a){return _(C(e,t,n),s=>_(C(s,t,r),m=>h(m),()=>T()),()=>_(C(e,t,a),s=>h(s),()=>T()))}function yI(e,t,n){let r=Le(n);return C(e,t,r)}function ec(e,t,n){return i.ShiftLeft(n,(r,a)=>_(C(e,t,r),s=>ec(s,t,a),()=>T()),()=>h(e))}function xI(e,t,n){let r=we(n);return C(e,t,r)}function tc(e,t,n){return i.ShiftLeft(n,(r,a)=>_(C(e,t,r),s=>h(s),()=>tc(e,t,a)),()=>T())}function q(e,t,n){return Z(n)?gI(e,t):H(n)?hI(e,t,n.if,n.then,n.else):be(n)?yI(e,t,n.enum):J(n)?fI(e,n.name,t,n.extends):O(n)?ec(e,t,n.allOf):ee(n)?xI(e,t,n.pattern):x(n)?tc(e,t,n.anyOf):ae(n)?h(e):T()}function nc(e,t,n){return J(n)?q(e,t,n):Z(n)?h(e):ae(n)?h(e):To(e)}function II(e,t){let n=qt(e),r=qt(t);return n&&r||!n&&r?!0:!(n&&!r)}function rc(e,t,n,r){return z(r)?II(t,r)?C(e,n,r.items):T():q(e,t,r)}function ac(e,t,n){return Je(n)?h(e):q(e,t,n)}function oc(e,t,n){return Fe(n)?h(e):q(e,t,n)}function bI(e,t,n,r,a){let s=J(r)?t:r,m=J(r)?r:t,c=xe(t),l=xe(r);return!c&&l?T():_(C(e,s,m),d=>Xn(d,n,a),()=>T())}function vI(e,t,n,r){return i.ShiftLeft(r,(a,s)=>bI(e,t,n,a,s),()=>xe(t)?h(e):T())}function $I(e,t,n){return i.ShiftLeft(t,(r,a)=>vI(e,r,a,n),()=>h(e))}function Xn(e,t,n){return $I(e,t,n)}function Ea(e,t,n){return Xe(n)?h(e):C(e,t,n)}function ic(e,t,n,r){return Z(r)?h(e):ae(r)?h(e):ie(r)?_(Xn(e,t,r.parameters),a=>Ea(a,n,r.instanceType),()=>T()):T()}function sc(e,t,n,r,a){return _(C(e,t,a),()=>C(e,n,a),()=>C(e,r,a))}function mc(e,t,n){let r=Le(t);return C(e,r,n)}function pc(e,t,n,r){return Z(r)?h(e):ae(r)?h(e):se(r)?_(Xn(e,t,r.parameters),a=>Ea(a,n,r.returnType),()=>T()):T()}function uc(e,t,n){return ve(n)?h(e):Q(n)?h(e):q(e,t,n)}function cc(e,t,n){let r=B(t);return C(e,r,n)}function Ra(e,t,n){return t===n?h(e):T()}function TI(e,t,n){return L(n)?Ra(e,t,n.const):Je(n)?h(e):q(e,P(t),n)}function kI(e,t,n){return L(n)?Ra(e,t,n.const):Fe(n)?h(e):q(e,P(t),n)}function wI(e,t,n){return L(n)?Ra(e,t,n.const):Q(n)?h(e):q(e,P(t),n)}function EI(e,t,n){return L(n)?Ra(e,t,n.const):$e(n)?h(e):q(e,P(t),n)}function lc(e,t,n){return i.IsBigInt(t.const)?TI(e,t.const,n):i.IsBoolean(t.const)?kI(e,t.const,n):i.IsNumber(t.const)?wI(e,t.const,n):i.IsString(t.const)?EI(e,t.const,n):X()}function dc(e,t,n){return J(n)?q(e,t,n):h(e)}function fc(e,t,n){return Xt(n)?h(e):q(e,t,n)}function gc(e,t,n){return Q(n)?h(e):q(e,t,n)}function RI(e,t,n){return xe(t)?xe(n)?h(e):T():h(e)}function SI(e,t,n){return J(n)&&yt(n.extends)?T():_(C(e,t,n),r=>RI(r,t,n),()=>T())}function OI(e,t){return e.reduce((n,r)=>r in t?mn(t[r])?{...n,...t[r].inferred}:X():X(),{})}function PI(e,t,n){let r={};for(let m of i.Keys(n))r[m]=m in t?SI({},t[m],n[m]):xe(n[m])?J(n[m])?h(p.Assign(e,{[n[m].name]:n[m].extends})):h(e):T();let a=i.Values(r).every(m=>mn(m)),s=a?OI(i.Keys(r),r):{};return a?h(s):T()}function CI(e,t,n){let r=PI(e,t,n);return mn(r)?h(p.Assign(e,r.inferred)):T()}function MI(e,t,n){return CI(e,t,n)}function AI(e,t){return i.Keys(t).reduce((n,r)=>({...n,[r]:i.HasPropertyKey(e,r)?x(n[r])?E([...n[r].anyOf,t[r]]):E([e[r],t[r]]):t[r]}),e)}function hc(e,t,n,r){return i.ShiftLeft(t,(a,s)=>_(C({},e[a],n),m=>hc(e,s,n,AI(r,m)),()=>T()),()=>h(r))}function LI(e,t,n,r){let a=i.Keys(t);return hc(t,a,r,e)}function yc(e,t,n){return ge(n)?LI(e,t,Ne(n),Te(n)):A(n)?MI(e,t,n.properties):q(e,$(t),n)}function qI(e,t){return i.IsEqual(i.Keys(t).length,0)?h(e):T()}function jI(e,t,n,r,a){return C(e,n,a)}function xc(e,t,n,r){return ge(r)?jI(e,Yr(t),n,Yr(Ne(r)),Te(r)):A(r)?qI(e,r.properties):Z(r)?h(e):ae(r)?h(e):T()}function Ic(e,t,n){return $e(n)?h(e):q(e,t,n)}function bc(e,t,n){return xt(n)?h(e):q(e,t,n)}function vc(e,t,n){let r=we(t);return C(e,r,n)}function ko(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Zn(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 wo(e){return vt(e)?J(e.items)?z(e.items.extends)?ko(e.items.name,e.items.extends.items):ae(e.items.extends)?ko(e.items.name,e.items.extends):void 0:X():void 0}function Sa(e){return J(e)?ko(e.name,e.extends):void 0}function Eo(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>_(C({},r,t),()=>Eo(a,t,[...n,r]),()=>{}),()=>n)}function $c(e,t,n,r){let a=Eo(n,r);return i.IsArray(a)?h(p.Assign(e,{[t]:te(a)})):T()}function Oa(e,t,n,r){let a=Eo(n,r);return i.IsArray(a)?h(p.Assign(e,{[t]:E(a)})):T()}function FI(e){return[...e].reverse()}function Ro(e,t){return t?FI(e):e}function DI(e){let t=e.length>0?e[0]:void 0,n=re(t)?wo(t):void 0;return re(n)}function GI(e,t,n,r,a,s){return _(C(e,n,a),m=>Tc(m,t,r,s),()=>T())}function NI(e,t,n,r,a){let s=wo(r);return Zn(s)?$c(e,s.name,Ro(n,t),s.type):i.ShiftLeft(n,(m,c)=>GI(e,t,m,c,r,a),()=>T())}function UI(e,t,n,r){return i.ShiftLeft(r,(a,s)=>NI(e,t,n,a,s),()=>i.IsEqual(n.length,0)?h(e):T())}function Tc(e,t,n,r){return UI(e,t,n,r)}function KI(e,t,n){let r=wt(e,K([],[]),n),a=DI(r);return Tc(e,a,Ro(t,a),Ro(r,a))}function kc(e,t,n){let r=Sa(n);return Zn(r)?Oa(e,r.name,t,r.type):i.ShiftLeft(t,(a,s)=>_(C(e,a,n),m=>kc(m,s,n),()=>T()),()=>h(e))}function wc(e,t,n){let r=wt(e,K([],[]),t);return N(n)?KI(e,r,n.items):z(n)?kc(e,r,n.items):q(e,te(r),n)}function Ec(e,t,n){return Xe(n)?h(e):rn(n)?h(e):q(e,t,n)}function Rc(e,t,n){return i.ShiftLeft(n,(r,a)=>_(C(e,t,r),s=>h(s),()=>Rc(e,t,a)),()=>T())}function So(e,t,n){return i.ShiftLeft(t,(r,a)=>_(Rc(e,r,n),s=>So(s,a,n),()=>T()),()=>h(e))}function Sc(e,t,n){let r=Sa(n);return Zn(r)?Oa(e,r.name,t,r.type):x(n)?So(e,t,n.anyOf):So(e,t,[n])}function Oc(e,t,n){return J(n)?q(e,t,n):Z(n)?h(e):ae(n)?h(e):T()}function Pc(e,t,n){return Xe(n)?h(e):q(e,t,n)}function C(e,t,n){return Z(t)?nc(e,t,n):z(t)?rc(e,t,t.items,n):Je(t)?ac(e,t,n):Fe(t)?oc(e,t,n):ie(t)?ic(e,t.parameters,t.instanceType,n):H(t)?sc(e,t.if,t.then,t.else,n):be(t)?mc(e,t.enum,n):se(t)?pc(e,t.parameters,t.returnType,n):ve(t)?uc(e,t,n):O(t)?cc(e,t.allOf,n):L(t)?lc(e,t,n):yt(t)?dc(e,t,n):Xt(t)?fc(e,t,n):Q(t)?gc(e,t,n):A(t)?yc(e,t.properties,n):ge(t)?xc(e,Ne(t),Te(t),n):$e(t)?Ic(e,t,n):xt(t)?bc(e,t,n):ee(t)?vc(e,t.pattern,n):N(t)?wc(e,t.items,n):rn(t)?Ec(e,t,n):x(t)?Sc(e,t.anyOf,n):ae(t)?Oc(e,t,n):Xe(t)?Pc(e,t,n):T()}function _I(e,t){return B([...e,$(t)])}function Oo(e,t,n){return k(e)?p.Update(_I(e,t),{},n):zn(e,t,n)}function Cc(e,t,n,r,a){let s=qe(e,t,n),m=Qn(e,t,r);return Oo(s,m,a)}function zn(e,t,n={}){return I("Interface",[e,t],n)}function pn(e){return re(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function Mc(e,t,n={}){return Oo(e,t,n)}function zI(e,t,n){return e.includes(n)?!0:er([...e,n],t,t[n])}function Ac(e,t,n){let r=Lr(n);return Kt(e,t,r)}function Kt(e,t,n){return i.ShiftLeft(n,(r,a)=>er(e,t,r)?!0:Kt(e,t,a),()=>!1)}function er(e,t,n){return me(n)?zI(e,t,n.$ref):z(n)?er(e,t,n.items):ie(n)?Kt(e,t,[...n.parameters,n.instanceType]):se(n)?Kt(e,t,[...n.parameters,n.returnType]):pn(n)?Ac(e,t,n.parameters[1]):O(n)?Kt(e,t,n.allOf):A(n)?Ac(e,t,n.properties):x(n)?Kt(e,t,n.anyOf):N(n)?Kt(e,t,n.items):ge(n)?er(e,t,Te(n)):!1}function Lc(e,t,n){return er(e,t,n)}function VI(e,t){return t.reduce((n,r)=>Lc([r],e,e[r])?[...n,r]:n,[])}function qc(e){let t=Ar(e);return VI(e,t)}function BI(e,t,n){return n.includes(t)?n:t in e?tr(e,e[t],[...n,t]):X()}function jc(e,t,n){let r=Lr(t);return un(e,r,n)}function un(e,t,n){return t.reduce((r,a)=>tr(e,a,r),n)}function tr(e,t,n){return me(t)?BI(e,t.$ref,n):z(t)?tr(e,t.items,n):ie(t)?un(e,[...t.parameters,t.instanceType],n):se(t)?un(e,[...t.parameters,t.returnType],n):pn(t)?jc(e,t.parameters[1],n):O(t)?un(e,t.allOf,n):A(t)?jc(e,t.properties,n):x(t)?un(e,t.anyOf,n):N(t)?un(e,t.items,n):ge(t)?tr(e,Te(t),n):n}function Fc(e,t,n){return tr(e,n,[t])}function WI(e){return Ht()}function HI(e){return i.Keys(e).reduce((t,n)=>({...t,[n]:_t(e[n])}),{})}function nr(e){return e.reduce((t,n)=>[...t,_t(n)],[])}function _t(e){return me(e)?WI(e.$ref):z(e)?Ae(_t(e.items),Mr(e)):ie(e)?ze(nr(e.parameters),_t(e.instanceType)):se(e)?Ve(nr(e.parameters),_t(e.returnType)):O(e)?Ie(nr(e.allOf)):A(e)?$(HI(e.properties)):ge(e)?Hr(tn(e),_t(Te(e))):x(e)?E(nr(e.anyOf)):N(e)?te(nr(e.items)):e}function YI(e,t){return t in e?_t(e[t]):ue()}function Dc(e){return YI(e.$defs,e.$ref)}function JI(e,t,n){let r=qe(e,K([],[]),t),a=Qn({},K([],[]),n);return B([...r,$(a)])}function XI(e,t){return i.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let s=e[a],m=pn(s)?JI(e,s.parameters[0],s.parameters[1]):s;return{...r,[a]:m}},{})}function Gc(e,t,n){let r=Fc(e,t,n),a=XI(e,r);return We(a,t)}function Nc(e,t){return t in e?me(e[t])?Nc(e,e[t].$ref):e[t]:D()}function Ze(e,t){return Nc(e,t)}function Uc(e){return de(e)?Dc(e):qr(e)?ue():e}function fe(e,t,n){let r=Uc(t),a=Uc(n);return C(e,r,a)}var Dn="equal",ZI="disjoint",Gn="left-inside",Nn="right-inside";function Qt(e,t){let n=[ae(e)?v.ExtendsFalse():fe({},e,t),ae(e)?v.ExtendsTrue({}):fe({},t,e)];return v.IsExtendsTrueLike(n[0])&&v.IsExtendsTrueLike(n[1])?Dn:v.IsExtendsTrueLike(n[0])&&v.IsExtendsFalse(n[1])?Gn:v.IsExtendsFalse(n[0])&&v.IsExtendsTrueLike(n[1])?Nn:ZI}function QI(e,t){return t.filter(n=>Qt(e,n)!==Nn)}function eb(e,t){let n=t.some(r=>{let a=Qt(e,r);return i.IsEqual(a,Gn)||i.IsEqual(a,Dn)});return i.IsEqual(n,!1)}function tb(e,t){let n=Ge(e);return Z(n)?[n]:eb(n,t)?[...QI(n,t),n]:t}function nb(e){return e.reduce((t,n)=>A(n)?[...t,n]:yt(n)?t:tb(n,t),[])}function io(e){let t=nb(e);return Kn(t)}function Po(e,t){return p.Update(Ge(e),{},t)}function Kc(e,t,n,r){let a=f(e,t,n);return Po(a,r)}function rr(e,t=[]){return gt(e)&&i.IsEqual(e.action,"Conditional")?me(e.parameters[0])?rr(e.parameters[2],rr(e.parameters[3],[...t,e.parameters[0].$ref])):rr(e.parameters[2],rr(e.parameters[3],t)):gt(e)&&i.IsEqual(e.action,"Mapped")&>(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&me(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function rb(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function Vc(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>i.ShiftLeft(t,(s,m)=>Vc(a,m,[...n,[s,r]]),()=>n),()=>n)}function ab(e){return x(e)?[...e.anyOf]:[e]}function ob(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function _c(e,t){return t.reduce((n,r)=>[...n,...ob(e,r)],[])}function zc(e){return e.reduce((t,n)=>i.IsEqual(n[0],!0)?_c(t,ab(n[1])):_c(t,[n[1]]),[[]])}function Bc(e,t,n){let r=rr(n),a=rb(e,r),s=Vc(t,a);return gt(n)&&i.IsEqual(n.action,"Conditional")||gt(n)&&i.IsEqual(n.action,"Mapped")?zc(s):[t]}function ib(){return["(not-resolvable)",D()]}function sb(){return["(not-generic)",D()]}function mb(e,t,n){return[e,ht(t,n)]}function pb(e,t,n){return t in e?Wc(e,t,e[t],n):ib()}function Wc(e,t,n,r){return Wt(n)?mb(t,n.parameters,n.expression):me(n)?pb(e,n.$ref,r):sb()}function Hc(e,t,n){return Wc(e,"(anonymous)",t,n)}function ub(e,t,n){if(J(t)||cn(t)||v.IsExtendsTrueLike(fe({},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 Yc(e,t,n,r,a){let s=f(e,t,a);return ub(n,s,r),p.Assign(e,{[n]:s})}function cb(e,t,n,r,a){let s=f(e,t,n.extends),m=f(e,t,n.equals);return i.ShiftLeft(a,(c,l)=>Co(Yc(e,t,n.name,s,c),t,r,l),()=>Co(Yc(e,t,n.name,s,m),t,r,[]))}function Co(e,t,n,r){return i.ShiftLeft(n,(a,s)=>cb(e,t,a,s,r),()=>e)}function Jc(e,t,n,r){return Co(e,t,n,r)}function lb(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function db(e,t){return i.IsEqual(lb(e),t)}function fb(e,t,n,r,a,s){let m=Jc(e,t,r,s),c=f(m,K([...t.callstack,n.$ref],t.visited),a);return f(m,K([],[]),c)}function gb(e,t,n,r,a,s){return s.reduce((m,c)=>[...m,fb(e,t,n,r,a,c)],[])}function hb(e,t,n,r,a,s){let m=Bc(r,s,a),c=gb(e,t,n,r,a,m);return i.IsEqual(c.length,1)?c[0]:Oe(c)}function Pa(e,t,n,r){let a=qe(e,t,r),s=Hc(e,n,r),m=s[0],c=s[1];return Wt(c)?db(t,m)?Vn(it(m),a):hb(e,t,it(m),c.parameters,c.expression,a):Vn(n,a)}function Vn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Xc(e,t){return Pa({},K([],[]),e,t)}function cn(e){return y(e,"Call")}function yb(e){return p.Discard(e,["~immutable"])}function Zc(e,t){return p.Update(yb(e),{},t)}function Qc(e,t,n,r){let a=f(e,t,n);return Zc(a,r)}function el(e,t){return e(t)}function tl(e,t){return i.IsString(t)?P(el(e,t)):P(t)}function nl(e,t){let n=we(t);return pt(e,n)}function rl(e,t){let n=t.map(r=>pt(e,r));return E(n)}function pt(e,t){return L(t)?tl(e,t.const):ee(t)?nl(e,t.pattern):x(t)?rl(e,t.anyOf):t}function ea(e,t={}){return I("Capitalize",[e],t)}function al(e,t={}){return Mo(e,t)}function ta(e,t={}){return I("Lowercase",[e],t)}function ol(e,t={}){return Ao(e,t)}function na(e,t={}){return I("Uncapitalize",[e],t)}function il(e,t={}){return Lo(e,t)}function ra(e,t={}){return I("Uppercase",[e],t)}function sl(e,t={}){return qo(e,t)}var xb=e=>e[0].toUpperCase()+e.slice(1),Ib=e=>e.toLowerCase(),bb=e=>e[0].toLowerCase()+e.slice(1),vb=e=>e.toUpperCase();function Mo(e,t){return k([e])?p.Update(pt(xb,e),{},t):ea(e,t)}function Ao(e,t){return k([e])?p.Update(pt(Ib,e),{},t):ta(e,t)}function Lo(e,t){return k([e])?p.Update(pt(bb,e),{},t):na(e,t)}function qo(e,t){return k([e])?p.Update(pt(vb,e),{},t):ra(e,t)}function ml(e,t,n,r){let a=f(e,t,n);return Mo(a,r)}function pl(e,t,n,r){let a=f(e,t,n);return Ao(a,r)}function ul(e,t,n,r){let a=f(e,t,n);return Lo(a,r)}function cl(e,t,n,r){let a=f(e,t,n);return qo(a,r)}function aa(e,t,n,r,a={}){return I("Conditional",[e,t,n,r],a)}function ll(e,t,n,r,a={}){return jo({},K([],[]),e,t,n,r,a)}function $b(e,t,n,r,a,s){let m=fe(e,n,r);return v.IsExtendsUnion(m)?E([f(m.inferred,t,a),f(e,t,s)]):v.IsExtendsTrue(m)?f(m.inferred,t,a):f(e,t,s)}function jo(e,t,n,r,a,s,m){return k([n,r])?p.Update($b(e,t,n,r,a,s),{},m):aa(n,r,a,s,m)}function dl(e,t,n,r,a,s,m){let c=f(e,t,n),l=f(e,t,r);return jo(e,t,c,l,a,s,m)}function oa(e,t={}){return I("ConstructorParameters",[e],t)}function fl(e,t={}){return Fo(e,t)}function Tb(e){let t=ie(e)?e.parameters:[],n=wt({},K([],[]),t);return te(n)}function Fo(e,t){return k([e])?p.Update(Tb(e),{},t):oa(e,t)}function gl(e,t,n,r){let a=f(e,t,n);return Fo(a,r)}function ia(e,t,n={}){return I("Exclude",[e,t],n)}function hl(e,t,n={}){return ar(e,t,n)}function ar(e,t,n){return k([e,t])?p.Update(Br(e,t),{},n):ia(e,t,n)}function yl(e,t,n,r,a){let s=f(e,t,n),m=f(e,t,r);return ar(s,m,a)}function sa(e,t,n={}){return I("Extract",[e,t],n)}function xl(e,t,n={}){return Do(e,t,n)}function kb(e,t){let n=fe({},e,t);return v.IsExtendsTrueLike(n)?[e]:[]}function wb(e,t){return e.reduce((n,r)=>[...n,...kb(r,t)],[])}function Il(e,t){let n=Ge(e),r=x(n)?n.anyOf:[n],a=wb(r,t);return Oe(a)}function Do(e,t,n){return k([e,t])?p.Update(Il(e,t),{},n):sa(e,t,n)}function bl(e,t,n,r,a){let s=f(e,t,n),m=f(e,t,r);return Do(s,m,a)}function Eb(e){return e.reduce((t,n)=>Nr(n)?[...t,P(n)]:t,[])}function ln(e){let t=Eb(e);return E(t)}function Bn(e,t,n={}){return I("Index",[e,t],n)}function vl(e,t,n={}){let r=i.IsArray(t)?ln(t):t;return Go(e,r,n)}function $l(e,t){let n=Ze(e,t);return je(n)}function Tl(e,t,n){let r=_e(e,t,n);return je(r)}function Rb(e,t){let n=i.Keys(e).filter(g=>!i.HasPropertyKey(t,g)),r=i.Keys(t).filter(g=>!i.HasPropertyKey(e,g)),a=i.Keys(e).filter(g=>i.HasPropertyKey(t,g)),s=n.reduce((g,b)=>({...g,[b]:e[b]}),{}),m=r.reduce((g,b)=>({...g,[b]:t[b]}),{}),c=a.reduce((g,b)=>({...g,[b]:B([e[b],t[b]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function kl(e){return e.reduce((t,n)=>Rb(t,je(n)),{})}function wl(e){let t=Ps(te(e));return je(t)}function Sb(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:Oe([e[s],t[s]])}),{})}function El(e,t){return i.ShiftLeft(e,(n,r)=>El(r,Sb(t,je(n))),()=>t)}function Rl(e){return i.ShiftLeft(e,(t,n)=>El(n,je(t)),()=>X())}function je(e){return de(e)?$l(e.$defs,e.$ref):H(e)?Tl(e.if,e.then,e.else):O(e)?kl(e.allOf):x(e)?Rl(e.anyOf):N(e)?wl(e.items):A(e)?e.properties:{}}function dn(e){let t=je(e);return $(t)}var Ob=new RegExp("^(?:0|[1-9][0-9]*)$");function fn(e){let t=`${e}`;return Ob.test(t)?parseInt(t):e}function Pb(e){return P(fn(e))}function Sl(e){return e.map(t=>Ol(t))}function Ol(e){return O(e)?Ie(Sl(e.allOf)):x(e)?E(Sl(e.anyOf)):L(e)?Pb(e.const):e}function Pl(e,t){let n=Ol(t),r=fe({},n,Se());return v.IsExtendsTrueLike(r)?e:L(t)&&i.IsEqual(t.const,"length")?Se():D()}function Cl(e,t){let n=Ze(e,t);return Pe(n)}function Ml(e,t,n){let r=_e(e,t,n);return Pe(r)}function Al(e){let t=Le(e);return Pe(t)}function Ll(e){let t=B(e);return Pe(t)}function ql(e){return[`${e}`]}function jl(e){let t=we(e);return Pe(t)}function Fl(e){return e.reduce((t,n)=>[...t,...Pe(n)],[])}function Pe(e){return de(e)?Cl(e.$defs,e.$ref):H(e)?Ml(e.if,e.then,e.else):be(e)?Al(e.enum):O(e)?Ll(e.allOf):L(e)?ql(e.const):ee(e)?jl(e.pattern):x(e)?Fl(e.anyOf):[]}function gn(e){return Pe(e)}function or(e,t){return t.map(n=>ir(e,n))}function ir(e,t){return z(t)?Ae(ir(e,t.items)):ie(t)?ze(or(e,t.parameters),ir(e,t.instanceType)):se(t)?Ve(or(e,t.parameters),ir(e,t.returnType)):N(t)?te(or(e,t.items)):x(t)?E(or(e,t.anyOf)):O(t)?Ie(or(e,t.allOf)):Xr(t)?$(e):t}function Dl(e,t){return ir(e,t)}function Cb(e,t){let n=t in e?e[t]:D();return Dl(e,n)}function Gl(e,t){return t.reduce((n,r)=>[...n,Cb(e,r)],[])}function Mb(e,t){let n=gn(t),r=Gl(e,n);return Oe(r)}var Ab=new RegExp(bt);function Lb(e){return e.filter(n=>Ab.test(n))}function qb(e){let t=Ar(e),n=Lb(t),r=Gl(e,n);return Oe(r)}function Nl(e,t){return Q(t)?qb(e):Mb(e,t)}function jb(e){return P(fn(e))}function Ul(e){return e.map(t=>No(t))}function No(e){return O(e)?Ie(Ul(e.allOf)):x(e)?E(Ul(e.anyOf)):L(e)?jb(e.const):e}function Fb(e,t){return e.reduceRight((n,r,a)=>{let s=fe({},P(a),t);return v.IsExtendsTrueLike(s)?[r,...n]:n},[])}function Db(e,t){let n=No(t),r=Fb(e,n);return st(r)}function Gb(e){return st(e)}function Kl(e,t){return L(t)&&i.IsEqual(t.const,"length")?P(e.length):Q(t)||ve(t)?Gb(e):Db(e,t)}function _l(e,t){return z(e)?Pl(e.items,t):A(e)?Nl(e.properties,t):N(e)?Kl(e.items,t):D()}function Nb(e){return de(e)||H(e)||O(e)||x(e)?dn(e):e}function Go(e,t,n){return k([e,t])?p.Update(_l(Nb(e),t),{},n):Bn(e,t,n)}function zl(e,t,n,r,a){let s=f(e,t,n),m=f(e,t,r);return Go(s,m,a)}function ma(e,t={}){return I("InstanceType",[e],t)}function Vl(e,t={}){return Uo(e,t)}function Ub(e){return ie(e)?e.instanceType:D()}function Uo(e,t){return k([e])?p.Update(Ub(e),{},t):ma(e,t)}function Bl(e,t,n,r={}){let a=f(e,t,n);return Uo(a,r)}function Wn(e,t={}){return I("KeyOf",[e],t)}function Wl(e,t={}){return Ko(e,t)}function Hl(){return E([Se(),De(),Zt()])}function Yl(e){return Se()}function Kb(e){return e.reduce((n,r)=>Nr(r)?[...n,P(fn(r))]:X(),[])}function Jl(e){let t=i.Keys(e),n=Kb(t);return st(n)}function Xl(e){return tn(e)}function Zl(e){let t=e.map((n,r)=>P(r));return st(t)}function Ql(e){return Z(e)?Hl():z(e)?Yl(e.items):A(e)?Jl(e.properties):ge(e)?Xl(e):N(e)?Zl(e.items):D()}function _b(e){return de(e)||H(e)||O(e)||x(e)?dn(e):e}function Ko(e,t){return k([e])?p.Update(Ql(_b(e)),{},t):Wn(e,t)}function ed(e,t,n,r){let a=f(e,t,n);return Ko(a,r)}function _n(e,t,n,r,a={}){return I("Mapped",[e,t,n,r],a)}function td(e,t,n,r,a={}){return _o({},K([],[]),e,t,n,r,a)}function zb(e){let t=we(e);return Ca(t)}function Vb(e){return e.reduce((t,n)=>[...t,...Ca(n)],[])}function Bb(e){let t=Le(e);return Ca(t)}function Wb(e){return i.IsNumber(e)?[P(`${e}`)]:[P(e)]}function Ca(e){return be(e)?Bb(e.enum):L(e)?Wb(e.const):ee(e)?zb(e.pattern):x(e)?Vb(e.anyOf):[e]}function nd(e){return Ca(e)}function Hb(e){return ee(e)?we(e.pattern):e}function Yb(e,t,n,r,a,s){let m=p.Assign(e,{[n.name]:r}),c=f(m,t,a),l=Hb(c),d=f(m,t,s);return us(l)||cs(l)?{[l.const]:d}:{}}function Jb(e,t,n,r,a,s){return r.reduce((m,c)=>[...m,Yb(e,t,n,c,a,s)],[])}function Xb(e){return e.reduce((t,n)=>[...t,$(n)],[])}function rd(e,t,n,r,a,s){let m=nd(r),c=Jb(e,t,n,m,a,s),l=Xb(c);return B(l)}function _o(e,t,n,r,a,s,m){return k([r])?p.Update(rd(e,t,n,r,a,s),{},m):_n(n,r,a,s,m)}function ad(e,t,n,r,a,s,m){let c=f(e,t,r);return _o(e,t,n,c,a,s,m)}function Zb(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>n.includes(s)).reduce((s,m)=>({...s,[m]:Gc(r,m,t[m])}),{})}function Qb(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>!n.includes(s)).reduce((s,m)=>({...s,[m]:f(r,K([],[]),t[m])}),{})}function ev(e,t,n){let r=qc(t),a=Zb(e,t,r),s=Qb(e,t,r),m={...a,...s};return p.Update(m,{},n)}function Ma(e,t,n,r){return ev(e,n,r)}function pa(e,t={}){return I("NonNullable",[e],t)}function od(e,t={}){return zo(e,t)}function tv(e){let t=E([Jt(),nn()]);return ar(e,t,{})}function zo(e,t){return k([e])?p.Update(tv(e),{},t):pa(e,t)}function id(e,t,n,r){let a=f(e,t,n);return zo(a,r)}function ua(e,t,n={}){return I("Omit",[e,t],n)}function sd(e,t,n={}){let r=i.IsArray(t)?ln(t):t;return Vo(e,r,n)}function Aa(e){let t=dn(e);return A(t)?t.properties:X()}function nv(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function md(e,t){let n=Aa(e),r=gn(t),a=nv(n,r);return $(a)}function Vo(e,t,n){return k([e,t])?p.Update(md(e,t),{},n):ua(e,t,n)}function pd(e,t,n,r,a){let s=f(e,t,n),m=f(e,t,r);return Vo(s,m,a)}function ca(e,t={}){return I("Parameters",[e],t)}function ud(e,t={}){return Bo(e,t)}function rv(e){let t=se(e)?e.parameters:[],n=wt({},K([],[]),t);return te(n)}function Bo(e,t){return k([e])?p.Update(rv(e),{},t):ca(e,t)}function cd(e,t,n,r){let a=f(e,t,n);return Bo(a,r)}function la(e,t={}){return I("Partial",[e],t)}function ld(e,t={}){return Wo(e,t)}function dd(e,t){let n=Ze(e,t),r=Qe(n);return We(p.Assign(e,{[t]:r}),t)}function fd(e,t,n){let r=_e(e,t,n);return Qe(r)}function gd(e){let t=B(e);return Qe(t)}function hd(e){let t=e.map(n=>Qe(n));return E(t)}function yd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:At(e[a])}),{});return $(t)}function Qe(e){return de(e)?dd(e.$defs,e.$ref):H(e)?fd(e.if,e.then,e.else):O(e)?gd(e.allOf):x(e)?hd(e.anyOf):A(e)?yd(e.properties):$({})}function Wo(e,t){return k([e])?p.Update(Qe(e),{},t):la(e,t)}function xd(e,t,n,r){let a=f(e,t,n);return Wo(a,r)}function da(e,t,n={}){return I("Pick",[e,t],n)}function Id(e,t,n={}){let r=i.IsArray(t)?ln(t):t;return Ho(e,r,n)}function av(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function bd(e,t){let n=Aa(e),r=gn(t),a=av(n,r);return $(a)}function Ho(e,t,n){return k([e,t])?p.Update(bd(e,t),{},n):da(e,t,n)}function vd(e,t,n,r,a){let s=f(e,t,n),m=f(e,t,r);return Ho(s,m,a)}function fa(e,t={}){return I("ReadonlyObject",[e],t)}function Yo(e,t={}){return Jo(e,t)}var $d=Yo;function Td(e){return Yt(Ae(e))}function kd(e,t){let n=Ze(e,t),r=et(n);return We(p.Assign(e,{[t]:r}),t)}function wd(e,t,n){let r=_e(e,t,n);return et(r)}function Ed(e){let t=B(e);return et(t)}function Rd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:jt(e[a])}),{});return $(t)}function Sd(e){return Yt(te(e))}function Od(e){let t=e.map(n=>et(n));return E(t)}function et(e){return z(e)?Td(e.items):de(e)?kd(e.$defs,e.$ref):H(e)?wd(e.if,e.then,e.else):O(e)?Ed(e.allOf):A(e)?Rd(e.properties):N(e)?Sd(e.items):x(e)?Od(e.anyOf):e}function Jo(e,t){return k([e])?p.Update(et(e),{},t):fa(e)}function Pd(e,t,n,r){let a=f(e,t,n);return Jo(a,r)}function Cd(e,t,n,r){return t.visited.includes(r)?n:r in e?f(e,K(t.callstack,[...t.visited,r]),e[r]):n}function Md(e,t){let n=Ze(e,t),r=tt(n);return We(p.Assign(e,{[t]:r}),t)}function Ad(e,t,n){let r=_e(e,t,n);return tt(r)}function Ld(e){let t=B(e);return tt(t)}function qd(e){let t=e.map(n=>tt(n));return E(t)}function jd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Vr(e[a])}),{});return $(t)}function tt(e){return de(e)?Md(e.$defs,e.$ref):H(e)?Ad(e.if,e.then,e.else):O(e)?Ld(e.allOf):x(e)?qd(e.anyOf):A(e)?jd(e.properties):$({})}function ga(e,t={}){return I("Required",[e],t)}function Fd(e,t={}){return Xo(e,t)}function Xo(e,t){return k([e])?p.Update(tt(e),{},t):ga(e,t)}function Dd(e,t,n,r){let a=f(e,t,n);return Xo(a,r)}function ha(e,t={}){return I("ReturnType",[e],t)}function Gd(e,t={}){return Zo(e,t)}function ov(e){return se(e)?e.returnType:D()}function Zo(e,t){return k([e])?p.Update(ov(e),{},t):ha(e,t)}function Nd(e,t,n,r={}){let a=f(e,t,n);return Zo(a,r)}function ya(e,t){return I("With",[e,t],{})}function Ud(e,t){return Qo(e,t)}function Qo(e,t){return k([e])?p.Update(e,{},t):ya(e,t)}function Kd(e,t,n,r){let a=f(e,t,n);return Qo(a,r)}function iv(e){return vt(e)?N(e.items)?ei(e.items.items):J(e.items)?[e]:me(e.items)?[e]:[D()]:[e]}function ei(e){return e.reduce((n,r)=>[...n,...iv(r)],[])}function K(e,t){return{callstack:e,visited:t}}function k(e){return i.ShiftLeft(e,(t,n)=>me(t)?!1:k(n),()=>!0)}function Qn(e,t,n){return i.Keys(n).reduce((r,a)=>({...r,[a]:f(e,t,n[a])}),{})}function wt(e,t,n){let r=qe(e,t,n);return ei(r)}function qe(e,t,n){return n.map(r=>f(e,t,r))}function sv(e,t){let n=xe(e)?Cn(t,{}):t,r=Ft(e)?Pn(n,{}):n;return qt(e)?sr(r,{}):r}function mv(e,t,n,r,a){return i.IsEqual(n,"AddImmutable")?_d(e,t,r[0],a):i.IsEqual(n,"RemoveImmutable")?Qc(e,t,r[0],a):i.IsEqual(n,"AddReadonly")?Gi(e,t,r[0],a):i.IsEqual(n,"RemoveReadonly")?ws(e,t,r[0],a):i.IsEqual(n,"AddOptional")?Ni(e,t,r[0],a):i.IsEqual(n,"RemoveOptional")?Ss(e,t,r[0],a):i.IsEqual(n,"Capitalize")?ml(e,t,r[0],a):i.IsEqual(n,"Conditional")?dl(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"ConstructorParameters")?gl(e,t,r[0],a):i.IsEqual(n,"Evaluate")?Kc(e,t,r[0],a):i.IsEqual(n,"Exclude")?yl(e,t,r[0],r[1],a):i.IsEqual(n,"Extract")?bl(e,t,r[0],r[1],a):i.IsEqual(n,"Index")?zl(e,t,r[0],r[1],a):i.IsEqual(n,"InstanceType")?Bl(e,t,r[0],a):i.IsEqual(n,"Interface")?Cc(e,t,r[0],r[1],a):i.IsEqual(n,"KeyOf")?ed(e,t,r[0],a):i.IsEqual(n,"Lowercase")?pl(e,t,r[0],a):i.IsEqual(n,"Mapped")?ad(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"Module")?Ma(e,t,r[0],a):i.IsEqual(n,"NonNullable")?id(e,t,r[0],a):i.IsEqual(n,"Pick")?vd(e,t,r[0],r[1],a):i.IsEqual(n,"Parameters")?cd(e,t,r[0],a):i.IsEqual(n,"Partial")?xd(e,t,r[0],a):i.IsEqual(n,"Omit")?pd(e,t,r[0],r[1],a):i.IsEqual(n,"ReadonlyObject")?Pd(e,t,r[0],a):i.IsEqual(n,"Record")?Vs(e,t,r[0],r[1],a):i.IsEqual(n,"Required")?Dd(e,t,r[0],a):i.IsEqual(n,"ReturnType")?Nd(e,t,r[0],a):i.IsEqual(n,"TemplateLiteral")?Yu(e,t,r[0],a):i.IsEqual(n,"Uncapitalize")?ul(e,t,r[0],a):i.IsEqual(n,"Uppercase")?cl(e,t,r[0],a):i.IsEqual(n,"With")?Kd(e,t,r[0],r[1]):I(n,r,a)}function pv(e,t,n){let r=me(n)?Cd(e,t,n,n.$ref):z(n)?Ae(f(e,t,n.items),Mr(n)):cn(n)?Pa(e,t,n.target,n.arguments):ie(n)?ze(qe(e,t,n.parameters),f(e,t,n.instanceType),Ui(n)):se(n)?Ve(qe(e,t,n.parameters),f(e,t,n.returnType),Ki(n)):H(n)?Lt(f(e,t,n.if),f(e,t,n.then),f(e,t,n.else),Hi(n)):O(n)?Ie(qe(e,t,n.allOf),Qi(n)):A(n)?$(Qn(e,t,n.properties),Bi(n)):ge(n)?Bs(Ne(n),f(e,t,Te(n))):vt(n)?Nt(f(e,t,n.items)):N(n)?te(wt(e,t,n.items),ks(n)):x(n)?E(qe(e,t,n.anyOf),ds(n)):n;return sv(n,r)}function f(e,t,n){return gt(n)?mv(e,t,n.action,n.parameters,n.options):pv(e,t,n)}function ti(e,t){return f(e,K([],[]),t)}function uv(e){return p.Update(e,{"~immutable":!0},{})}function sr(e,t){return p.Update(uv(e),{},t)}function _d(e,t,n,r){let a=f(e,t,n);return sr(a,r)}function Wp(e,t={}){return I("AddImmutable",[e],t)}function Yt(e,t={}){return sr(e,t)}function Hp(e,t={}){return I("Evaluate",[e],t)}function zd(e,t={}){return Po(e,t)}function Yp(e,t={}){return I("Module",[e],t)}function Vd(e,t={}){return Ma({},K([],[]),e,t)}function Bd(...e){let[t,n,r]=He.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=zu(n),s=i.IsArray(a)&&i.IsEqual(a.length,2)?f(t,K([],[]),a[0]):D();return p.Update(s,{},r)}var U={};St(U,{Any:()=>Ht,Array:()=>Ae,BigInt:()=>qn,Boolean:()=>Dr,Call:()=>Xc,Capitalize:()=>al,Codec:()=>Fr,Conditional:()=>ll,Constructor:()=>ze,ConstructorParameters:()=>fl,Cyclic:()=>We,Decode:()=>rs,DecodeBuilder:()=>Ln,Dependent:()=>Lt,Encode:()=>as,EncodeBuilder:()=>An,Enum:()=>Zi,Evaluate:()=>zd,Exclude:()=>hl,Extends:()=>fe,ExtendsResult:()=>v,Extract:()=>xl,Function:()=>Ve,Generic:()=>ht,Identifier:()=>jn,Immutable:()=>os,Index:()=>vl,Infer:()=>Mn,InstanceType:()=>Vl,Instantiate:()=>ti,Integer:()=>Dt,Interface:()=>Mc,Intersect:()=>Ie,IsAny:()=>Z,IsArray:()=>z,IsBigInt:()=>Je,IsBoolean:()=>Fe,IsCall:()=>cn,IsCodec:()=>jr,IsConstructor:()=>ie,IsCyclic:()=>de,IsDependent:()=>H,IsEnum:()=>be,IsEnumValue:()=>Xi,IsFunction:()=>se,IsGeneric:()=>Wt,IsIdentifier:()=>ps,IsImmutable:()=>qt,IsInfer:()=>J,IsInteger:()=>ve,IsIntersect:()=>O,IsKind:()=>y,IsLiteral:()=>L,IsNever:()=>yt,IsNull:()=>Xt,IsNumber:()=>Q,IsObject:()=>A,IsOptional:()=>xe,IsParameter:()=>ls,IsReadonly:()=>Ft,IsRecord:()=>ge,IsRef:()=>me,IsRefine:()=>eo,IsRest:()=>vt,IsSchema:()=>re,IsString:()=>$e,IsSymbol:()=>xt,IsTemplateLiteral:()=>ee,IsThis:()=>Xr,IsTuple:()=>N,IsUndefined:()=>rn,IsUnion:()=>x,IsUnknown:()=>ae,IsUnsafe:()=>qr,IsVoid:()=>Xe,KeyOf:()=>Wl,Literal:()=>P,Lowercase:()=>ol,Mapped:()=>td,Module:()=>Vd,Never:()=>D,NonNullable:()=>od,Null:()=>Jt,Number:()=>Se,Object:()=>$,Omit:()=>sd,Optional:()=>zi,Parameter:()=>Gt,Parameters:()=>ud,Partial:()=>ld,Pick:()=>Id,Readonly:()=>is,ReadonlyObject:()=>Yo,ReadonlyType:()=>$d,Record:()=>Hr,RecordKey:()=>tn,RecordPattern:()=>Ne,RecordValue:()=>Te,Ref:()=>it,Refine:()=>ss,Required:()=>Fd,Rest:()=>Nt,ReturnType:()=>Gd,Script:()=>Bd,String:()=>De,Symbol:()=>Zt,TemplateLiteral:()=>Xu,This:()=>Jr,Tuple:()=>te,Uncapitalize:()=>il,Undefined:()=>nn,Union:()=>E,Unknown:()=>ue,Unsafe:()=>Wi,Uppercase:()=>sl,Void:()=>Zr,With:()=>Ud});var hn="submit_review_report",yn="submit_test_gap_candidates",mr="submit_filtered_test_gaps",pr="submit_solver_gaps",cv=U.Object({verdict:U.Union([U.Literal("PASS"),U.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:U.String({description:"One short sentence summarizing the verdict."}),reasons:U.Array(U.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:U.Array(U.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."})});function Wd(e){return{name:hn,label:"Submit Review Report",description:"Submit your final verdict for this review. 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. Do not write a plain-text final answer instead of calling this tool.",parameters:cv,async execute(t,n){return e.report={verdict:n.verdict,summary:n.summary,reasons:n.reasons??[],notes:n.notes??[]},{content:[{type:"text",text:`Report recorded: ${n.verdict}`}],details:void 0}}}}var lv=U.Object({gaps:U.Array(U.Object({description:U.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:U.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 Hd(e){return{name:yn,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:lv,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Recorded ${r.length} candidate gap(s)`}],details:void 0}}}}var dv=U.Object({gaps:U.Array(U.Object({description:U.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:U.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 Yd(e){return{name:mr,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:dv,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 fv=U.Object({gaps:U.Array(U.Object({description:U.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:U.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:U.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 Jd(e){return{name:pr,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:fv,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}}}}var gv={description:"Focus area: the task description in `agent_prompt.md`. Judge it strictly against rubric items P1-P5 below. You do not need to judge the tests or solution \u2014 other reviewers cover those.",tests:"Focus area: the tests added in `test.patch` (a unified diff). Judge them strictly against rubric items T1-T6 below. You cannot execute code or apply the patch, so read the diff carefully and reason about determinism, coverage, and strictness directly from the added code. Read `agent_prompt.md` for context on what behavior is in scope, and skim `solution.patch` only to understand what the tests are checking. Do not judge the description or the solution's code quality.\nMandatory symbol-fairness check: for every non-trivial method/function/property/export name that a test calls, mutates, mocks, or asserts on, use grep/read on the repository (the pre-existing code, not solution.patch) to confirm it actually exists there, OR confirm it is explicitly named in `agent_prompt.md`. Pay special attention to any such name that is new/invented and that duplicates, shadows, or conflicts with an existing, differently-named public API doing the same thing (e.g. a test calling `setFoo(...)` when the repo's real, visible API is `setBar(...)`) \u2014 that is a textbook unfair/undiscoverable test per the fairness methodology, and is blocking on its own even if every other test in the patch is fine.",solution:"Focus area: the golden solution in `solution.patch` (a unified diff). Judge it strictly against rubric items S1-S4 below. Read `agent_prompt.md` for the requirements and `test.patch` to see what must pass, and use read/grep/ls/find on the rest of the repository to check for regressions, inconsistent style, and irrelevant/unexplained changes. Do not judge the description's wording or the tests' coverage.\nMandatory repo-conventions check: for every file and area touched by `solution.patch`, read the corresponding pre-existing code in the repo \u2014 same directory, sibling modules, similar components/services/hooks, and any files the patch imports from or extends. Establish how this repo actually does things (error handling and logging, naming, exports, state management, async patterns, i18n, test helpers, DI/service boundaries, comment density, defensive checks) and judge whether the solution matches those conventions. Flag clear deviations as S2/S4 issues \u2014 e.g. inventing a new logger when the repo uses a shared one, raw `console.*` where the codebase uses a structured error reporter, a different hook/service pattern than neighboring features, or new abstractions where similar code inlines the same logic. Use grep/read to find 2\u20133 closest analogues before concluding a pattern is acceptable.\nMandatory dead-code check: scan every added/changed line in `solution.patch` for unused code \u2014 variables, parameters, imports, functions/methods, or fields that are declared/assigned but never read or called anywhere (including by `test.patch`) \u2014 and for dead/unreachable code (branches, conditions, or statements that can never execute, or code left behind after a return/throw/break that makes it unreachable). Use grep to confirm a symbol truly has no other usages in the repo before flagging it. This is a rubric S4 violation and is blocking on its own, even if the rest of the solution is otherwise excellent."};function Xd(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 Zd=["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."],Qd=["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)."];function ef(e,t,n){let r=["You are a careful, calibrated reviewer 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 may contain: `agent_prompt.md` (the task description), `test.patch` (unified diff adding tests), and `solution.patch` (unified diff of the golden solution). Read whichever are relevant to your focus, and read the rest of the repository as needed via grep/read/ls/find to judge things against real repo context.","",gv[e.key],"","Checklist for your focus area:",t];return n&&r.push("","Fairness methodology (use this to judge whether an issue is actually blocking, and to distinguish agent-fault from prompt-ambiguity from test-flaw problems):",n),e.key==="solution"&&r.push("","Solution-specific calibration for repo standards (S2/S4):","Before returning PASS, you must have read real analogue files in the repo and compared patterns. A clear, documented mismatch with established repo conventions \u2014 wrong error/logging approach, inconsistent service or hook structure vs neighboring code, new patterns where the repo consistently uses existing ones \u2014 is blocking under S2/S4, not a minor note. Purely cosmetic nits (spacing, import order) with no pattern break belong in `notes`."),r.push("","How to set the verdict \u2014 calibrate, don't nitpick:","FAIL only for a genuine BLOCKING issue: a checklist item is clearly violated, a requirement stated in `agent_prompt.md` is untested or contradicted, a test asserts something unfair/undiscoverable per the fairness methodology above (private internals, exact class names not in the prompt, exact call order, reference-solution-only structure, etc.), a test is genuinely non-deterministic in a way that risks real CI flakiness (real network calls, unseeded randomness, race-prone ordering), or the solution has a real regression, missing requirement, or unrelated/unexplained change.","Do NOT fail for: optional coverage suggestions, 'would also be nice to test X', dead/unused code that doesn't affect correctness, minor style inconsistencies, or defensible implementation choices the prompt didn't forbid. These are exactly the kind of thing a real reviewer leaves as a 'Minor/optional' note without failing the task \u2014 put them in `notes` and still return PASS.","When genuinely torn between PASS and FAIL, default to PASS with the concern captured in `notes`, unless the issue would let a materially incorrect agent solution pass the hidden tests, or would unfairly fail a correct one \u2014 that is always blocking.","A single blocking issue is enough to FAIL, even if it affects only one test or one line out of many, and even if the rest of the suite is excellent. Do NOT average it away or let a large, otherwise-strong test suite talk you into a PASS \u2014 one unfair or undiscoverable test (e.g. requiring a private/invented API name that doesn't exist in the repo and isn't named in the prompt, especially one that conflicts with an existing, differently-named public API) is exactly as blocking as many.","",`When you are done analyzing, call the \`${hn}\` tool exactly once with your structured verdict. That tool call is your only way to report a result.`),r.join(`
|
|
12
|
-
`)}function
|
|
13
|
-
`)}function nf(e,t){let
|
|
14
|
-
`)}function
|
|
15
|
-
`)}function
|
|
16
|
-
`)}function
|
|
17
|
-
`)}var
|
|
4
|
+
`,"utf-8")}let G=ye(r,"node_modules"),w=ye(n,"node_modules");if(Wa(G)&&!Wa(w))try{Yf(G,w,process.platform==="win32"?"junction":"dir")}catch{}try{Wf(s,ye(n,"agent_prompt.md"))}catch{}let Ce=Ya(a,"utf-8"),L=Qf(Ce),le=ye(n,"test.patch");at(le,Ce,"utf-8");let re=await t.exec("git",["apply","test.patch"],c);try{Jf(le)}catch{}if(re.code!==0)return{status:"patchFailed",solverDir:n,error:re.stderr?.trim()||"git apply test.patch failed"};let Me=await t.exec("git",["add","-A"],c);if(Me.code!==0)return{status:"error",solverDir:n,error:Me.stderr?.trim()||"git add (tests applied) failed"};let oe=await t.exec("git",["commit","-m","tests applied","--allow-empty"],c);if(oe.code!==0)return{status:"error",solverDir:n,error:oe.stderr?.trim()||"git commit (tests applied) failed"};let rt=await t.exec("git",["rev-parse","HEAD"],c);return rt.code!==0||!rt.stdout.trim()?{status:"error",solverDir:n,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:n,testsAppliedCommit:rt.stdout.trim(),testPatchPaths:L}}async function Ti(e){let{pi:t,index:r,workspace:n,status:a,durationMs:s}=e,{solverDir:m,testsAppliedCommit:c,testPatchPaths:l}=n,d={cwd:m,timeout:Ja};await t.exec("git",["add","-A"],d);let g=[...l,"agent_prompt.md"].map(Me=>`:(exclude)${Me}`),b=await t.exec("git",["diff","--cached",c,"--",".",...g],d),V=b.code===0?b.stdout:"",G=ye(m,"test_output.xml"),w=`bash test.sh --output_path ${kn(Tn(G))} new`,Ce=$n(),L=await t.exec(Ce,["-c",`cd ${kn(Tn(m))} && ${w}`],{timeout:Ja*10}),le=L.code===0,re=eg(`${L.stdout}
|
|
5
|
+
${L.stderr}`.trim(),Xf);return{index:r,status:a,passed:le,diff:V,testOutputTail:re,durationMs:s,testOutputXmlPath:G}}function ki(e){let{repoDir:t,runId:r,index:n,trajectory:a,solutionPatch:s,testOutputXmlPath:m,testOutputTail:c}=e,l=ye(t,Zf,r,`solver_${n}`);Ha(l,{recursive:!0}),at(ye(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),at(ye(l,"solution.patch"),s,"utf-8");try{let d=Ya(m,"utf-8");at(ye(l,"test_output.xml"),d,"utf-8")}catch{at(ye(l,"test_output.txt"),c,"utf-8")}return l}function wi(e,t){let r=ye(e,kr);Ha(r,{recursive:!0});let n=t.map(a=>{let s=ye(r,`solver_${a.index}`);return Ha(s,{recursive:!0}),at(ye(s,"solution.diff"),a.diff,"utf-8"),at(ye(s,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return at(ye(r,"manifest.json"),JSON.stringify(n,null,2),"utf-8"),r}function Ei(e){let t=ye(e,"node_modules");try{Hf(t).isSymbolicLink()&&vi(t,{force:!0})}catch{}try{vi(e,{recursive:!0,force:!0})}catch{}}var p={};Ot(p,{Assign:()=>tg,Clone:()=>Sr,Create:()=>sh,Discard:()=>mh,Metrics:()=>Ue,Update:()=>ph});var Ue={assign:0,create:0,clone:0,discard:0,update:0};function tg(e,t){return Ue.assign+=1,{...e,...t}}var i={};Ot(i,{Entries:()=>$g,EntriesRegExp:()=>vg,Every:()=>xg,EveryAll:()=>Ig,GraphemeCount:()=>gg,HasPropertyKey:()=>bg,IsArray:()=>Er,IsBigInt:()=>wr,IsBoolean:()=>qi,IsClassInstance:()=>dg,IsConstructor:()=>sg,IsDeepEqual:()=>eo,IsEqual:()=>M,IsFunction:()=>ji,IsGreaterEqualThan:()=>Di,IsGreaterThan:()=>ug,IsInteger:()=>Za,IsLessEqualThan:()=>Fi,IsLessThan:()=>cg,IsMaxLength:()=>hg,IsMinLength:()=>yg,IsMultipleOf:()=>lg,IsNull:()=>Sn,IsNumber:()=>On,IsObject:()=>Rr,IsObjectNotArray:()=>mg,IsString:()=>Pn,IsSymbol:()=>pg,IsUndefined:()=>Qa,IsUnsafePropertyKey:()=>Gi,IsValueLike:()=>fg,Keys:()=>Rn,ShiftLeft:()=>Cn,Symbols:()=>Tg,Values:()=>kg});function Pt(e,t,r){return e>=t&&e<=r}function rg(e){return e===8205}function ng(e){return Pt(e,55296,56319)}function Ri(e){return Pt(e,127462,127487)}function Oi(e){return Pt(e,65024,65039)}function Pi(e){return Pt(e,768,879)||Pt(e,6832,6911)||Pt(e,7616,7679)||Pt(e,65056,65071)}function En(e){return e>65535?2:1}function Si(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(Pi(r)||Oi(r))t+=En(r);else break}return t}function Xa(e,t){let r=e.codePointAt(t),n=t+En(r);for(n=Si(e,n);n<e.length-1&&e[n]==="\u200D";){let a=e.codePointAt(n+1);n+=1+En(a),n=Si(e,n)}return Ri(r)&&n<e.length&&Ri(e.codePointAt(n))&&(n+=En(e.codePointAt(n))),n}function Ci(e){return ng(e)||Pi(e)||Oi(e)||rg(e)}function Mi(e){let t=0,r=0;for(;r<e.length;)r=Xa(e,r),t++;return t}function ag(e,t){if(t===0)return!0;let r=0,n=0;for(;n<e.length;)if(n=Xa(e,n),r++,r>=t)return!0;return!1}function og(e,t){let r=0,n=0;for(;n<e.length;)if(n=Xa(e,n),r++,r>t)return!1;return!0}function Ai(e,t){if(t===0)return!0;let r=0;for(;r<e.length;){if(Ci(e.charCodeAt(r)))return ag(e,t);if(r++,r>=t)return!0}return!1}function Li(e,t){let r=0;for(;r<e.length;){if(Ci(e.charCodeAt(r)))return og(e,t);if(r++,r>t)return!1}return!0}function Er(e){return Array.isArray(e)}function wr(e){return M(typeof e,"bigint")}function qi(e){return M(typeof e,"boolean")}function sg(e){if(Qa(e)||!ji(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function ji(e){return M(typeof e,"function")}function Za(e){return Number.isInteger(e)}function Sn(e){return M(e,null)}function On(e){return Number.isFinite(e)}function mg(e){return Rr(e)&&!Er(e)}function Rr(e){return M(typeof e,"object")&&!Sn(e)}function Pn(e){return M(typeof e,"string")}function pg(e){return M(typeof e,"symbol")}function Qa(e){return M(e,void 0)}function M(e,t){return e===t}function ug(e,t){return e>t}function cg(e,t){return e<t}function Fi(e,t){return e<=t}function Di(e,t){return e>=t}function lg(e,t){if(wr(e)||wr(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!On(e)||Za(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 dg(e){if(!Rr(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Sn(t)?!1:M(typeof t.constructor,"function")&&!(M(t.constructor,globalThis.Object)||M(t.constructor.name,"Object"))}function fg(e){return wr(e)||qi(e)||Sn(e)||On(e)||Pn(e)||Qa(e)}function gg(e){return Mi(e)}function hg(e,t){return Li(e,t)}function yg(e,t){return Ai(e,t)}function xg(e,t,r){for(let n=t;n<e.length;n++)if(!r(e[n],n))return!1;return!0}function Ig(e,t,r){let n=!0;for(let a=t;a<e.length;a++)r(e[a],a)||(n=!1);return n}function Cn(e,t,r){return M(e.length,0)?r():t(e[0],e.slice(1))}function Gi(e){return M(e,"__proto__")||M(e,"constructor")||M(e,"prototype")}function bg(e,t){return Gi(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function vg(e){return Rn(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function $g(e){return Object.entries(e)}function Rn(e){return Object.getOwnPropertyNames(e)}function Tg(e){return Object.getOwnPropertySymbols(e)}function kg(e){return Object.values(e)}function wg(e,t){if(!Rr(t))return!1;let r=Rn(e);return M(r.length,Rn(t).length)&&r.every(n=>eo(e[n],t[n]))}function Eg(e,t){return Er(t)&&M(e.length,t.length)&&e.every((r,n)=>eo(e[n],t[n]))}function eo(e,t){return Er(e)?Eg(e,t):Rr(e)?wg(e,t):M(e,t)}var gt={};Ot(gt,{IsBigInt64Array:()=>Ug,IsBigUint64Array:()=>Kg,IsBoolean:()=>Sg,IsDate:()=>zg,IsFloat32Array:()=>Gg,IsFloat64Array:()=>Ng,IsInt16Array:()=>qg,IsInt32Array:()=>Fg,IsInt8Array:()=>Mg,IsMap:()=>Bg,IsNumber:()=>Og,IsRegExp:()=>_g,IsSet:()=>Vg,IsString:()=>Pg,IsTypeArray:()=>Cg,IsUint16Array:()=>jg,IsUint32Array:()=>Dg,IsUint8Array:()=>Ag,IsUint8ClampedArray:()=>Lg});function Sg(e){return e instanceof Boolean}function Og(e){return e instanceof Number}function Pg(e){return e instanceof String}function Cg(e){return globalThis.ArrayBuffer.isView(e)}function Mg(e){return e instanceof globalThis.Int8Array}function Ag(e){return e instanceof globalThis.Uint8Array}function Lg(e){return e instanceof globalThis.Uint8ClampedArray}function qg(e){return e instanceof globalThis.Int16Array}function jg(e){return e instanceof globalThis.Uint16Array}function Fg(e){return e instanceof globalThis.Int32Array}function Dg(e){return e instanceof globalThis.Uint32Array}function Gg(e){return e instanceof globalThis.Float32Array}function Ng(e){return e instanceof globalThis.Float64Array}function Ug(e){return e instanceof globalThis.BigInt64Array}function Kg(e){return e instanceof globalThis.BigUint64Array}function _g(e){return e instanceof globalThis.RegExp}function zg(e){return e instanceof globalThis.Date}function Vg(e){return e instanceof globalThis.Set}function Bg(e){return e instanceof globalThis.Map}function Hg(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function Yg(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:Ct(a.value)})}return t}function Jg(e){let t={};for(let r of i.Keys(e))i.IsUnsafePropertyKey(r)||(t[r]=Ct(e[r]));for(let r of i.Symbols(e))t[r]=Ct(e[r]);return t}function Xg(e){return i.IsClassInstance(e)?e:Hg(e)?Yg(e):Jg(e)}function Zg(e){return e.map(t=>Ct(t))}function Qg(e){return e.slice()}function eh(e){return new RegExp(e.source,e.flags)}function th(e){return new Map(Ct([...e.entries()]))}function rh(e){return new Set(Ct([...e.values()]))}function Ct(e){return gt.IsTypeArray(e)?Qg(e):gt.IsRegExp(e)?eh(e):gt.IsMap(e)?th(e):gt.IsSet(e)?rh(e):i.IsArray(e)?Zg(e):i.IsObject(e)?Xg(e):e}function Sr(e){return Ue.clone+=1,Ct(e)}var Mt={};Ot(Mt,{Get:()=>oh,Reset:()=>nh,Set:()=>ah});var ot={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function nh(){ot.immutableTypes=!1,ot.maxErrors=8,ot.useAcceleration=!0,ot.exactOptionalPropertyTypes=!1,ot.enumerableKind=!1,ot.correctiveParse=!1,ot.unionPrioritySort=!0}function ah(e){for(let t of i.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(ot,t,{value:r})}}function oh(){return ot}function ih(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 Ni(e,t){return{...e,...t}}function sh(e,t,r={}){Ue.create+=1;let n=Mt.Get(),a=Ni(t,r),s=n.enumerableKind?Ni(a,e):ih(a,e);return n.immutableTypes?Object.freeze(s):s}function mh(e,t){Ue.discard+=1;let r={},n=Object.getOwnPropertyDescriptors(Sr(e)),a=new Set(t);for(let s of Object.keys(n))a.has(s)||Object.defineProperty(r,s,n[s]);return r}function ph(e,t,r){Ue.update+=1;let n=Mt.Get(),a=Sr(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 ne(e){return i.IsObject(e)}function I(e,t,r){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function ht(e){return y(e,"Deferred")}function uh(e){return p.Update(e,{"~readonly":!0},{})}function Or(e,t){return p.Update(uh(e),{},t)}function Ui(e,t,r,n){let a=f(e,t,r);return Or(a,n)}function ch(e){return p.Update(e,{"~optional":!0},{})}function Pr(e,t){return p.Update(ch(e),{},t)}function Ki(e,t,r,n){let a=f(e,t,r);return Pr(a,n)}function Ae(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function z(e){return y(e,"Array")}function Mn(e){return p.Discard(e,["~kind","type","items"])}function ze(e,t,r={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function ie(e){return y(e,"Constructor")}function _i(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ve(e,t,r={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function se(e){return y(e,"Function")}function zi(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function it(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function me(e){return y(e,"Ref")}function yt(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Yt(e){return y(e,"Generic")}function Jt(e){return p.Create({"~kind":"Any"},{},e)}function Z(e){return y(e,"Any")}var Vi="(?!)";function D(e){return p.Create({"~kind":"Never"},{not:{}},e)}function xt(e){return y(e,"Never")}function Be(e,t={}){return I("AddOptional",[e],t)}function At(e,t={}){return Pr(e,t)}function Bi(e){return At(e)}function xe(e){return ne(e)&&i.HasPropertyKey(e,"~optional")}function Wi(e){return i.Keys(e).filter(t=>!xe(e[t]))}function An(e){return i.Keys(e)}function Ln(e){return i.Values(e)}function $(e,t={}){let r=Wi(e),n=r.length>0?{required:r}:{};return p.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function A(e){return y(e,"Object")}function Hi(e){return p.Discard(e,["~kind","type","properties","required"])}function ue(e){return p.Create({"~kind":"Unknown"},{},e)}function ae(e){return y(e,"Unknown")}function We(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 de(e){return y(e,"Cyclic")}function Yi(e){return p.Update(e,{"~unsafe":null},{})}function qn(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var He={};Ot(He,{Match:()=>lh});function lh(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Cr(...e){let[t,r]=He.Match(e,{2:(n,a)=>[n,a,a],1:n=>[n,ue(),ue()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function J(e){return y(e,"Infer")}function Lt(e,t,r,n={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function H(e){return y(e,"Dependent")}function Ji(e){return p.Discard(e,["~kind","if","then","else"])}function Xi(e){return i.IsObjectNotArray(e)}function Zi(e){return i.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function Qi(e){return i.IsString(e)||i.IsNumber(e)}function es(e,t){let r=Xi(e)?Zi(e):e;return p.Create({"~kind":"Enum"},{enum:r},t)}function be(e){return y(e,"Enum")}function Ie(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function O(e){return y(e,"Intersect")}function ts(e){return p.Discard(e,["~kind","allOf"])}function X(){throw new Error("Unreachable")}var rs;(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"})(rs||(rs={}));var ZT=BigInt("14695981039346656037"),[QT,ek]=[BigInt("1099511628211"),BigInt("18446744073709551616")],tk=Array.from({length:256}).map((e,t)=>BigInt(t)),ns=new Float64Array(1),rk=new DataView(ns.buffer),nk=new Uint8Array(ns.buffer);var ak=new TextEncoder;var Mr=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=jn(r)?m=>this.decode(r["~codec"].decode(m)):this.decode,a=jn(r)?m=>r["~codec"].encode(t(m)):t,s={decode:n,encode:a};return p.Update(this.type,{"~codec":s},{})}},Ar=class{constructor(t){this.type=t}Decode(t){return new Mr(this.type,t)}};function Fn(e){return new Ar(e)}function os(e,t){return Fn(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function is(e,t){return Fn(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function jn(e){return ne(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function ss(e){return Xt(e)}function qt(e){return ne(e)&&i.HasPropertyKey(e,"~immutable")}function Ye(e,t={}){return I("AddReadonly",[e],t)}function jt(e,t={}){return Or(e,t)}function ms(e){return jt(e)}function Ft(e){return ne(e)&&i.HasPropertyKey(e,"~readonly")}function hh(e,t){let r=to(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":r},{})}function ps(...e){let[t,r,n]=He.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return hh(t,{check:r,error:n})}function yh(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function to(e){return ne(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>yh(t))}var us="-?(?:0|[1-9][0-9]*)n";function Lr(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Je(e){return y(e,"BigInt")}function Dn(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Fe(e){return y(e,"Boolean")}function qr(e){return p.Create({"~kind":"Identifier"},{name:e})}function cs(e){return y(e,"Identifier")}var Gn="-?(?:0|[1-9][0-9]*)";function Dt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function ve(e){return y(e,"Integer")}var ro=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function xh(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new ro(e)})()}function P(e,t){return p.Create({"~kind":"Literal"},{type:xh(e),const:e},t)}function Nn(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function ls(e){return q(e)&&i.IsNumber(e.const)}function ds(e){return q(e)&&i.IsString(e.const)}function q(e){return y(e,"Literal")}function Zt(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Qt(e){return y(e,"Null")}var Un="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Se(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function Q(e){return y(e,"Number")}function er(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function It(e){return y(e,"Symbol")}function Gt(...e){let[t,r,n]=He.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,ue(),ue()]});return p.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function fs(e){return y(e,"Parameter")}var Kn=".*";function De(e){return p.Create({"~kind":"String"},{type:"string"},e)}function $e(e){return y(e,"String")}function E(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function gs(e){return p.Discard(e,["~kind","anyOf"])}function jr(e){let t=hs(e);return i.IsEqual(t.length,2)?t[0]:[]}function Ih(e){return!0}function ys(e){return i.ShiftLeft(e,(t,r)=>bh(t)?ys(r):!1,()=>!0)}function xs(e){return i.IsEqual(e.length,0)?!1:ys(e)}function bh(e){return x(e)?xs(e.anyOf):q(e)?Ih(e.const):!1}function _n(e){return xs(e)}function zn(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Is(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>Is(a,t,[...r,`${n}${t}`]),()=>r)}function vh(e,t){return i.IsEqual(e.length,0)?[`${t}`]:Is(e,t)}function bs(e,t,r=[]){return i.ShiftLeft(t,(n,a)=>bs(e,a,[...r,...vs(e,n)]),()=>r)}function vs(e,t){return x(t)?bs(e,t.anyOf):q(t)?vh(e,t.const):X()}function $s(e,t){return i.ShiftLeft(t,(r,n)=>$s(vs(e,r),n),()=>e)}function $h(e){return e.map(t=>P(t))}function Th(e){let t=$s([],e),r=$h(t);return E(r)}function kh(e){return i.IsEqual(e.length,0)?X():i.IsEqual(e.length,1)&&q(e[0])?e[0]:Th(e)}function no(e){let t=jr(e);return i.IsEqual(t.length,0)?De():_n(t)?kh(t):zn(e)}function Ts(e){let t=no(e);return ee(t)?De():t}function ke(e,t){let r="object",n={[e]:t};return p.Create({"~kind":"Record"},{type:r,patternProperties:n})}function ks(e){return ke(Ke,e)}function ws(e){return $({true:e,false:e})}function te(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 N(e){return y(e,"Tuple")}function Es(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function wh(e){return p.Discard(e,["~readonly"])}function ao(e,t){return p.Update(wh(e),{},t)}function Rs(e,t,r,n){let a=f(e,t,r);return ao(a,n)}function Ss(e,t={}){return I("RemoveReadonly",[e],t)}function Os(e,t={}){return ao(e,t)}function Eh(e){return p.Discard(e,["~optional"])}function oo(e,t){return p.Update(Eh(e),{},t)}function Ps(e,t,r,n){let a=f(e,t,r);return oo(a,n)}function Cs(e,t={}){return I("RemoveOptional",[e],t)}function Vn(e,t={}){return oo(e,t)}function io(e){return e.reduceRight((r,n,a)=>({[a]:n,...r}),{})}function Ms(e){let t=io(e.items);return $(t)}function Rh(e,t){return Ft(e)?!!Ft(t):!1}function Sh(e,t){return xe(e)?!!xe(t):!1}function Oh(e,t){let r=Rh(e,t),n=Sh(e,t),a=B([e,t]),s=Os(Vn(a));return r&&n?jt(At(s)):r&&!n?jt(s):!r&&n?At(s):s}function Ph(e,t,r){return r in e?r in t?Oh(e[r],t[r]):e[r]:r in t?t[r]:D()}function Ch(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((n,a)=>({...n,[a]:Ph(e,t,a)}),{})}function As(e){return A(e)?e.properties:N(e)?io(e.items):X()}function Ls(e,t){let r=As(e),n=As(t),a=Ch(r,n);return $(a)}function qs(e,t){let r=tr(e,t);return i.IsEqual(r,Dr)?e:i.IsEqual(r,Gr)||i.IsEqual(r,Fr)?t:D()}function js(e){return A(e)||N(e)}function Mh(e,t){let r=x(e),n=x(t);return r||n}function Ah(e,t){let r=Ge(e),n=Ge(t),a=Mh(r,n),s=js(r),m=js(n);return a?B([r,n]):s&&m?Ls(r,n):s&&!m?r:!s&&m?n:qs(r,n)}function Fs(e,t,r=[]){return i.ShiftLeft(t,(n,a)=>Fs(e,a,[...r,Ah(e,n)]),()=>i.IsEqual(r.length,0)?[e]:r)}function Ds(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>Ds(a,t,[...r,...Nr([n],t)]),()=>r)}function Nr(e,t=[]){return i.ShiftLeft(e,(r,n)=>x(r)?Nr(n,Ds(r.anyOf,t)):Nr(n,Fs(r,t)),()=>t)}function Lh(e,t){let r=fe({},e,t);return v.IsExtendsTrueLike(r)?[]:[e]}function qh(e,t){return e.reduce((r,n)=>[...r,...Lh(n,t)],[])}function Bn(e,t){let r=Ge(e),n=x(r)?r.anyOf:[r],a=qh(n,t);return Oe(a)}function _e(e,t,r){let n=Ie([e,t]),a=Bn(r,e);return Oe([n,a])}function Le(e){let t=e.map(r=>P(r));return Oe(t)}function B(e){let t=Nr(e),r=so(t);return st(r)}function we(e){let t=Ts(e);return Ge(t)}function Oe(e){let t=so(e);return st(t)}function Ge(e){return H(e)?_e(e.if,e.then,e.else):be(e)?Le(e.enum):O(e)?B(e.allOf):ee(e)?we(e.pattern):x(e)?Oe(e.anyOf):e}function st(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?D():E(e)}function Gs(e,t){let r=Le(e);return bt(r,t)}function Ns(e,t){return ke(vt,t)}function Us(e,t){let r=B(e);return bt(r,t)}function Ks(e,t){return i.IsString(e)||i.IsNumber(e)?$({[e]:t}):i.IsEqual(e,!1)?$({false:t}):i.IsEqual(e,!0)?$({true:t}):$({})}function _s(e,t){return ke(rr,t)}function zs(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?ke(e.pattern.toString(),t):ke(Ke,t)}function Vs(e,t){let r=jr(e);return _n(r)?bt(we(e),t):ke(e,t)}function jh(e){return x(e)?Ur(e.anyOf):[e]}function Ur(e){return e.reduce((t,r)=>[...t,...jh(r)],[])}function Fh(e){return e.some(t=>$e(t)||Q(t)||ve(t))}function Dh(e,t){return i.IsEqual(Fh(e),!0)?ke(Ke,t):void 0}function Gh(e,t){return e.reduce((r,n)=>q(n)&&(i.IsString(n.const)||i.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function Nh(e,t){let r=Gh(e,t);return $(r)}function Bs(e,t){let r=Ur(e),n=Dh(r,t);return ne(n)?n:Nh(r,t)}function bt(e,t){return Z(e)?ks(t):Fe(e)?ws(t):be(e)?Gs(e.enum,t):ve(e)?Ns(e,t):O(e)?Us(e.allOf,t):q(e)?Ks(e.const,t):Q(e)?_s(e,t):x(e)?Bs(e.anyOf,t):$e(e)?zs(e,t):ee(e)?Vs(e.pattern,t):$({})}function mo(e,t,r){return k([e])?p.Update(bt(e,t),{},r):Wn(e,t,r)}function Ws(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return mo(s,m,a)}var vt=`^${Gn}$`,rr=`^${Un}$`,Ke=`^${Kn}$`;function Wn(e,t,r={}){return I("Record",[e,t],r)}function Hn(e,t,r={}){return mo(e,t,r)}function Hs(e,t){return ke(e,t)}function Yn(e){return i.IsEqual(e,Ke)?De():i.IsEqual(e,vt)?Dt():i.IsEqual(e,rr)?Se():no(e)}function Ne(e){return i.Keys(e.patternProperties)[0]}function nr(e){let t=Ne(e);return Yn(t)}function Te(e){return e.patternProperties[Ne(e)]}function ge(e){return y(e,"Record")}function Nt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function $t(e){return y(e,"Rest")}function Jn(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function Xn(e){return y(e,"This")}function ar(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function or(e){return y(e,"Undefined")}function Zn(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Xe(e){return y(e,"Void")}function Kh(e,t){return i.IsEqual(e,"Array")?Ae(t[0]):i.IsEqual(e,"Capitalize")?ea(t[0]):i.IsEqual(e,"ConstructorParameters")?oa(t[0]):i.IsEqual(e,"Evaluate")?Jp(t[0]):i.IsEqual(e,"Exclude")?ia(t[0],t[1]):i.IsEqual(e,"Extract")?sa(t[0],t[1]):i.IsEqual(e,"Index")?Vr(t[0],t[1]):i.IsEqual(e,"InstanceType")?ma(t[0]):i.IsEqual(e,"Lowercase")?ta(t[0]):i.IsEqual(e,"NonNullable")?pa(t[0]):i.IsEqual(e,"Omit")?ua(t[0],t[1]):i.IsEqual(e,"Parameters")?ca(t[0]):i.IsEqual(e,"Partial")?la(t[0]):i.IsEqual(e,"Pick")?da(t[0],t[1]):i.IsEqual(e,"Readonly")?fa(t[0]):i.IsEqual(e,"KeyOf")?Br(t[0]):i.IsEqual(e,"Record")?Wn(t[0],t[1]):i.IsEqual(e,"Required")?ga(t[0]):i.IsEqual(e,"ReturnType")?ha(t[0]):i.IsEqual(e,"Uncapitalize")?ra(t[0]):i.IsEqual(e,"Uppercase")?na(t[0]):zr(it(e),t)}function Ut(){throw Error("Unreachable")}var _h=(e,t=[])=>e.reduce((r,n)=>i.IsArray(n)&&i.IsEqual(n.length,2)?[...r,n[0]]:[...r,n],[]),mt=e=>{let[t,r]=e;return _h([...t,...r])};function Qs(e){return Gt(e[0],e[2],e[4])}function em(e){return Gt(e[0],e[2],e[2])}function tm(e){return Gt(e[0],ue(),e[2])}function rm(e){return Gt(e,ue(),ue())}function nm(e){return mt(e)}function am(e){return e[1]}function om(e){return mt(e)}function im(e){return e[1]}function sm(e){return Kh(e[0],e[1])}function mm(e){return null}function pm(e){return De()}function um(e){return Se()}function cm(e){return Dn()}function lm(e){return ar()}function dm(e){return Zt()}function fm(e){return Dt()}function gm(e){return Lr()}function hm(e){return ue()}function ym(e){return Jt()}function xm(e){return $({})}function Im(e){return D()}function bm(e){return er()}function vm(e){return Zn()}function $m(e){return Jn()}function Tm(e){return P(BigInt(e))}function km(e){return P(i.IsEqual(e,"true"))}function wm(e){return P(parseFloat(e))}function Em(e){return P(e)}function Rm(e){return e[1]}function Sm(e){return P(e)}function Om(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Pm(e){return e[1]}function Cm(e){return Qn(e)}function Mm(e){return i.IsEqual(e.length,6)?Lt(e[1],e[3],e[5]):Lt(e[1],e[3],ue())}function Am(e){return e.length>0}function Lm(e){return e.reduce((t,r)=>i.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function qm(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function jm(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function Fm(e){return i.IsEqual(e.length,2)?e[1]:[]}function Ys(e,t){return t.reduce((r,n)=>{let a=n;return i.IsEqual(a.length,1)?Vr(r,a[0]):i.IsEqual(a.length,0)?Ae(r):Ut()},e)}function Js(e,t){return i.IsEqual(t.length,3)?aa(e,t[0],t[1],t[2]):e}function zh(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:ya(e,t)}function Dm(e){let[t,r,n,a,s]=e;return zh(Js(t?Br(Ys(r,n)):Ys(r,n),a),s)}function po(e,t){return i.IsEqual(t.length,3)?(()=>{let[r,n,a]=t,s=po(n,a);if(i.IsEqual(r,"&"))return O(s)?Ie([e,...s.allOf]):Ie([e,s]);if(i.IsEqual(r,"|"))return x(s)?E([e,...s.anyOf]):E([e,s]);Ut()})():e}function Gm(e){let[t,r]=e;return po(t,r)}function Nm(e){let[t,r]=e;return po(t,r)}function Um(e){return Yp(e[1])}function Km(e){return e[1]}function _m(e){return yt(e[0],e[2])}function zm(e){return i.IsEqual(e.length,4)?Cr(e[1],e[3]):i.IsEqual(e.length,2)?Cr(e[1],ue()):Ut()}function Vm(e){return`${e}`}function Bm(e){return ve(e[3])?vt:Q(e[3])?rr:It(e[3])?Ke:$e(e[3])?Ke:Ut()}function Wm(e){return e.length>0}function Hm(e){return e.length>0}function Ym(e){let[t,r,n,a,s]=e;return{[r]:t&&n?Ye(Be(s)):t&&!n?Ye(s):!t&&n?Be(s):s}}function Jm(e){return mt(e)}function Xm(e){return e.reduce((t,r)=>i.HasPropertyKey(r,vt)||i.HasPropertyKey(r,rr)||i.HasPropertyKey(r,Ke)?[t[0],p.Assign(t[1],r)]:[p.Assign(t[0],r),t[1]],[{},{}])}function Zm(e){return Xm(e[1])}function Qm(e){let[t,r]=e,n=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return $(t,n)}function ep(e){return i.IsEqual(e.length,5)?Ye(Be(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?Ye(e[3]):Be(e[3]):Ut()}function tp(e){return Ye(Be(e[1]))}function rp(e){return Ye(e[1])}function np(e){return Be(e[0])}function ap(e){return i.IsEqual(e.length,2)?Nt(e[1]):i.IsEqual(e.length,1)?e[0]:Ut()}function op(e){return mt(e)}function ip(e){return te(e[1])}function sp(e){return Ye(Be(e[4]))}function mp(e){return Ye(e[3])}function pp(e){return Be(e[3])}function up(e){return e[2]}function cp(e){return i.IsEqual(e.length,2)?Nt(e[1]):i.IsEqual(e.length,1)?e[0]:Ut()}function lp(e){return mt(e)}function dp(e){return Ve(e[1],e[4])}function fp(e){return ze(e[2],e[5])}function Xs(e,t){return i.IsEqual(e,"remove")?Ss(t):i.IsEqual(e,"add")?Ye(t):t}function gp(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")?Cs(t):i.IsEqual(e,"add")?Be(t):t}function hp(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 yp(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function xp(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?Kr(qr(e[3]),e[5],e[6][0],Xs(e[1],Zs(e[8],e[10]))):Kr(qr(e[3]),e[5],it(e[3]),Xs(e[1],Zs(e[8],e[10])))}function Ip(e){return it(e)}function bp(e){return BigInt(e)}function vp(e){return parseFloat(e)}function $p(e){return i.IsEqual(e,"true")}function Tp(e){return null}function kp(e){return{[e[0]]:e[2]}}function wp(e){return mt(e)}function Vh(e){return e.reduce((t,r)=>p.Assign(t,r),{})}function Ep(e){return Vh(e[1])}function Rp(e){return mt(e)}function Sp(e){return e[1]}function Op(e){return Lr()}function Pp(e){return De()}function Cp(e){return Se()}function Mp(e){return Dt()}function Ap(e){return D()}function Lp(e){return P(e)}function qp(e){return E(e[1])}function jp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Fp(e){return[e[0],...e[1]]}function Dp(e){return e[1]}function Gp(e){return mt(e)}function Np(e){return i.IsEqual(e.length,2)?e[1]:[]}function Up(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]]:yt(t,_r(r,n,s))}}function Kp(e){let t=e[2],[r,n]=e[3],a=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:_r(t,r,a)}}function _p(e){return{[e[1]]:yt(e[2],e[4])}}function zp(e){return{[e[1]]:e[3]}}function Vp(e){return null}function Bp(e){return Xm(mt(e))}function Wp(e){return e[1]}function Hp(e){let t=e[0],r=e[1];return Xp(p.Assign(t,r[0]))}function Wr(e){return M(e.length,2)}function R(e,t,r){return Wr(e)?t(e[0],e[1]):r()}function Hh(e,t){return M(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function W(e,t){for(let r=0;r<e.length;r++){let n=Hh(e[r],t);if(Wr(n))return n}return[]}function uo(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var Zp=[...uo(97,122),...uo(65,90)],co="0",lo=uo(49,57),ir=[co,...lo],Qp=" ",sr=`
|
|
6
|
+
`;var Tt="_",xa=".",eu="$",Ia="-";var tu="//",ru="/*",Jh="*/";function nu(e){let t=e.indexOf(Jh);return M(t,-1)?"":e.slice(t+2)}function au(e){let t=e.indexOf(sr);return M(t,-1)?"":e.slice(t)}function Xh(e){return e.replace(/^[ \t\r\f\v]+/,"")}function ba(e){let t=Xh(e);return t.startsWith(ru)?ba(nu(t.slice(2))):t.startsWith(tu)?ba(au(t.slice(2))):t}function ce(e){let t=e.trimStart();return t.startsWith(ru)?ce(nu(t.slice(2))):t.startsWith(tu)?ce(au(t.slice(2))):t}function va(e,t){return R(W([e],t),(r,n)=>[r,n],()=>["",t])}function Zh(e,t){return e.includes(t)}function mr(e,t,r,n=""){return R(W(e,r),(a,s)=>Zh(t,a)?mr(e,t,s,n):mr(e,t,s,`${n}${a}`),()=>[n,r])}function Qh(e){return W(lo,e)}var ey=[...ir,Tt];function ty(e){return mr(ey,[Tt],e)}function ry(e){return R(W([co],e),(t,r)=>[t,r],()=>R(Qh(e),(t,r)=>R(ty(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[]))}function $a(e){return ry(ce(e))}function ny(e){return va(Ia,e)}function ay(e){return R(ny(e),(t,r)=>R($a(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function ou(e){return ay(ce(e))}function oy(e){return R(ou(e),(t,r)=>R(W(["n"],r),(n,a)=>[`${t}`,a],()=>[]),()=>[])}function fo(e){return oy(e)}function go(e,t){return W([e],t)}function u(e,t){return M(e,"")?["",t]:e.startsWith(sr)?go(e,ba(t)):e.startsWith(Qp)?go(e,t):go(e,ce(t))}var iu=[...Zp,Tt,eu];function iy(e){return W(iu,e)}var sy=[...iu,...ir];function su(e,t=""){return R(W(sy,e),(r,n)=>su(n,`${t}${r}`),()=>[t,e])}function my(e){return R(iy(e),(t,r)=>R(su(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function Y(e){return my(ce(e))}var py=[...ir,Tt];function uy(e){return Wr(W([xa],e))}function mu(e){return R(mr(py,[Tt],e),(t,r)=>M(t,"")?[]:[t,r],()=>[])}function cy(e){return R(W([xa],e),(t,r)=>R(mu(r),(n,a)=>[`0${t}${n}`,a],()=>[]),()=>[])}function ly(e){return R($a(e),(t,r)=>R(W([xa],r),(n,a)=>R(mu(a),(s,m)=>[`${t}${n}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,r]),()=>[])}function dy(e){return uy(e)?cy(e):ly(e)}function pu(e){return dy(ce(e))}function fy(e){return va(Ia,e)}function gy(e){return R(fy(e),(t,r)=>R(pu(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function Ta(e){return gy(ce(e))}function hy(e){return M(e,"")?[]:[e.slice(0,1),e.slice(1)]}function uu(e,t){return Cn(e,(r,n)=>t.startsWith(r)?!0:uu(n,t),()=>!1)}function kt(e,t,r=""){return R(hy(t),(n,a)=>uu(e,t)?[r,t]:kt(e,a,`${r}${n}`),()=>[])}function yy(e,t,r){return R(W([e],r),(n,a)=>R(kt([t],a),(s,m)=>R(W([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function xy(e,t,r){return R(W([e],r),(n,a)=>R(kt([sr,t],a),(s,m)=>R(W([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function cu(e,t,r,n){return r?yy(e,t,ce(n)):xy(e,t,ce(n))}function Iy(e,t){return W(e,t)}function by(e,t){return cu(e,e,!1,t)}function vy(e,t){return R(Iy(e,t),(r,n)=>by(r,`${r}${n}`),()=>[])}function ka(e,t){return vy(e,ce(t))}function lu(e,t){return R(kt(e,t),(r,n)=>M(r,"")?[]:[r,n],()=>[])}var o=(e,t,r=()=>[])=>e.length===2?t(e):r(),Ty=e=>o(o(Y(e),([t,r])=>o(u("extends",r),([n,a])=>o(S(a),([s,m])=>o(u("=",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Qs(t),r]),ky=e=>o(o(Y(e),([t,r])=>o(u("extends",r),([n,a])=>o(S(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[em(t),r]),wy=e=>o(o(Y(e),([t,r])=>o(u("=",r),([n,a])=>o(S(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[tm(t),r]),Ey=e=>o(Y(e),([t,r])=>[rm(t),r]),gu=e=>o(o(Ty(e),([t,r])=>[t,r],()=>o(ky(e),([t,r])=>[t,r],()=>o(wy(e),([t,r])=>[t,r],()=>o(Ey(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),hu=(e,t=[])=>o(o(gu(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>hu(n,[...t,r]),()=>[t,e]),Ry=e=>o(o(hu(e),([t,r])=>o(o(o(gu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[nm(t),r]),xo=e=>o(o(u("<",e),([t,r])=>o(Ry(r),([n,a])=>o(u(">",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[am(t),r]),yu=(e,t=[])=>o(o(S(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>yu(n,[...t,r]),()=>[t,e]),Sy=e=>o(o(yu(e),([t,r])=>o(o(o(S(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[om(t),r]),Oy=e=>o(o(u("<",e),([t,r])=>o(Sy(r),([n,a])=>o(u(">",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[im(t),r]),Py=e=>o(o(Y(e),([t,r])=>o(Oy(r),([n,a])=>[[t,n],a])),([t,r])=>[sm(t),r]),xu=e=>o(o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[mm(t),r]),Iu=e=>o(u("string",e),([t,r])=>[pm(t),r]),bu=e=>o(u("number",e),([t,r])=>[um(t),r]),Cy=e=>o(u("boolean",e),([t,r])=>[cm(t),r]),My=e=>o(u("undefined",e),([t,r])=>[lm(t),r]),Ay=e=>o(u("null",e),([t,r])=>[dm(t),r]),vu=e=>o(u("integer",e),([t,r])=>[fm(t),r]),Ly=e=>o(u("bigint",e),([t,r])=>[gm(t),r]),qy=e=>o(u("unknown",e),([t,r])=>[hm(t),r]),jy=e=>o(u("any",e),([t,r])=>[ym(t),r]),Fy=e=>o(u("object",e),([t,r])=>[xm(t),r]),Dy=e=>o(u("never",e),([t,r])=>[Im(t),r]),$u=e=>o(u("symbol",e),([t,r])=>[bm(t),r]),Gy=e=>o(u("void",e),([t,r])=>[vm(t),r]),Ny=e=>o(u("this",e),([t,r])=>[$m(t),r]),Uy=e=>o(o(u("${",e),([t,r])=>o(S(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Rm(t),r]),ho=e=>o(kt(["${","`"],e),([t,r])=>[Sm(t),r]),Tu=e=>o(o(o(ho(e),([t,r])=>o(Uy(r),([n,a])=>o(Tu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(o(ho(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(ho(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[Om(t),r]),Io=e=>o(o(u("`",e),([t,r])=>o(Tu(r),([n,a])=>o(u("`",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Pm(t),r]),Ky=e=>o(Io(e),([t,r])=>[Cm(t),r]),_y=e=>o(o(o(u("if",e),([t,r])=>o(S(r),([n,a])=>o(u("then",a),([s,m])=>o(S(m),([c,l])=>o(u("else",l),([d,g])=>o(S(g),([b,V])=>[[t,n,s,c,d,b],V])))))),([t,r])=>[t,r],()=>o(o(u("if",e),([t,r])=>o(S(r),([n,a])=>o(u("then",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>[])),([t,r])=>[Mm(t),r]),zy=e=>o(fo(e),([t,r])=>[Tm(t),r]),Vy=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[km(t),r]),By=e=>o(Ta(e),([t,r])=>[wm(t),r]),Wy=e=>o(ka(["'",'"'],e),([t,r])=>[Em(t),r]),Hy=e=>o(o(o(u("keyof",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Am(t),r]),ku=(e,t=[])=>o(o(o(u("[",e),([r,n])=>o(S(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])=>ku(n,[...t,r]),()=>[t,e]),Yy=e=>o(ku(e),([t,r])=>[Lm(t),r]),Jy=e=>o(o(o(u("extends",e),([t,r])=>o(S(r),([n,a])=>o(u("?",a),([s,m])=>o(S(m),([c,l])=>o(u(":",l),([d,g])=>o(S(g),([b,V])=>[[t,n,s,c,d,b],V])))))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[qm(t),r]),Xy=e=>o(o(o(u("(",e),([t,r])=>o(S(r),([n,a])=>o(u(")",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(Iu(e),([t,r])=>[t,r],()=>o(bu(e),([t,r])=>[t,r],()=>o(Cy(e),([t,r])=>[t,r],()=>o(My(e),([t,r])=>[t,r],()=>o(Ay(e),([t,r])=>[t,r],()=>o(vu(e),([t,r])=>[t,r],()=>o(Ly(e),([t,r])=>[t,r],()=>o(qy(e),([t,r])=>[t,r],()=>o(jy(e),([t,r])=>[t,r],()=>o(Fy(e),([t,r])=>[t,r],()=>o(Dy(e),([t,r])=>[t,r],()=>o($u(e),([t,r])=>[t,r],()=>o(Gy(e),([t,r])=>[t,r],()=>o(Ny(e),([t,r])=>[t,r],()=>o(zy(e),([t,r])=>[t,r],()=>o(Vy(e),([t,r])=>[t,r],()=>o(By(e),([t,r])=>[t,r],()=>o(Wy(e),([t,r])=>[t,r],()=>o(Ky(e),([t,r])=>[t,r],()=>o(_y(e),([t,r])=>[t,r],()=>o(ux(e),([t,r])=>[t,r],()=>o(hx(e),([t,r])=>[t,r],()=>o($x(e),([t,r])=>[t,r],()=>o(vx(e),([t,r])=>[t,r],()=>o(Ex(e),([t,r])=>[t,r],()=>o(Py(e),([t,r])=>[t,r],()=>o(Rx(e),([t,r])=>[t,r],()=>[])))))))))))))))))))))))))))),([t,r])=>[jm(t),r]),Zy=e=>o(o(o(u("with",e),([t,r])=>o(Nu(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Fm(t),r]),wu=e=>o(o(Hy(e),([t,r])=>o(Xy(r),([n,a])=>o(Yy(a),([s,m])=>o(Jy(m),([c,l])=>o(Zy(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Dm(t),r]),Eu=e=>o(o(o(u("&",e),([t,r])=>o(wu(r),([n,a])=>o(Eu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Ru=e=>o(o(wu(e),([t,r])=>o(Eu(r),([n,a])=>[[t,n],a])),([t,r])=>[Gm(t),r]),Su=e=>o(o(o(u("|",e),([t,r])=>o(Ru(r),([n,a])=>o(Su(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),wa=e=>o(o(Ru(e),([t,r])=>o(Su(r),([n,a])=>[[t,n],a])),([t,r])=>[Nm(t),r]),Qy=e=>o(o(u("readonly",e),([t,r])=>o(wa(r),([n,a])=>[[t,n],a])),([t,r])=>[Um(t),r]),ex=e=>o(o(u("|",e),([t,r])=>o(wa(r),([n,a])=>[[t,n],a])),([t,r])=>[Km(t),r]),tx=e=>o(o(xo(e),([t,r])=>o(u("=",r),([n,a])=>o(S(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[_m(t),r]),rx=e=>o(o(o(u("infer",e),([t,r])=>o(Y(r),([n,a])=>o(u("extends",a),([s,m])=>o(wa(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(u("infer",e),([t,r])=>o(Y(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>[])),([t,r])=>[zm(t),r]),S=e=>o(o(rx(e),([t,r])=>[t,r],()=>o(ex(e),([t,r])=>[t,r],()=>o(Qy(e),([t,r])=>[t,r],()=>o(wa(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),nx=e=>o(Ta(e),([t,r])=>[Vm(t),r]),ax=e=>o(Y(e),([t,r])=>[t,r]),ox=e=>o(ka(["'",'"'],e),([t,r])=>[t,r]),ix=e=>o(o(u("[",e),([t,r])=>o(Y(r),([n,a])=>o(u(":",a),([s,m])=>o(o(vu(m),([c,l])=>[c,l],()=>o(bu(m),([c,l])=>[c,l],()=>o(Iu(m),([c,l])=>[c,l],()=>o($u(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Bm(t),r]),Ou=e=>o(o(nx(e),([t,r])=>[t,r],()=>o(ax(e),([t,r])=>[t,r],()=>o(ox(e),([t,r])=>[t,r],()=>o(ix(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),sx=e=>o(o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Wm(t),r]),mx=e=>o(o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Hm(t),r]),Pu=e=>o(o(sx(e),([t,r])=>o(Ou(r),([n,a])=>o(mx(a),([s,m])=>o(u(":",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Ym(t),r]),Cu=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]),Mu=(e,t=[])=>o(o(Pu(e),([r,n])=>o(Cu(n),([a,s])=>[[r,a],s])),([r,n])=>Mu(n,[...t,r]),()=>[t,e]),px=e=>o(o(Mu(e),([t,r])=>o(o(o(Pu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Jm(t),r]),bo=e=>o(o(u("{",e),([t,r])=>o(px(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Zm(t),r]),ux=e=>o(bo(e),([t,r])=>[Qm(t),r]),cx=e=>o(o(o(Y(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[t,r],()=>o(o(Y(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(Y(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(Y(e),([t,r])=>o(u(":",r),([n,a])=>o(S(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>[])))),([t,r])=>[ep(t),r]),lx=e=>o(o(u("readonly",e),([t,r])=>o(S(r),([n,a])=>o(u("?",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[tp(t),r]),dx=e=>o(o(u("readonly",e),([t,r])=>o(S(r),([n,a])=>[[t,n],a])),([t,r])=>[rp(t),r]),fx=e=>o(o(S(e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[np(t),r]),du=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(S(e),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),Au=e=>o(o(o(u("...",e),([t,r])=>o(du(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(du(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[ap(t),r]),Lu=(e,t=[])=>o(o(Au(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>Lu(n,[...t,r]),()=>[t,e]),gx=e=>o(o(Lu(e),([t,r])=>o(o(o(Au(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]),hx=e=>o(o(u("[",e),([t,r])=>o(gx(r),([n,a])=>o(u("]",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[ip(t),r]),yx=e=>o(o(Y(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[sp(t),r]),xx=e=>o(o(Y(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[mp(t),r]),Ix=e=>o(o(Y(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[pp(t),r]),bx=e=>o(o(Y(e),([t,r])=>o(u(":",r),([n,a])=>o(S(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[up(t),r]),fu=e=>o(o(yx(e),([t,r])=>[t,r],()=>o(xx(e),([t,r])=>[t,r],()=>o(Ix(e),([t,r])=>[t,r],()=>o(bx(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),qu=e=>o(o(o(u("...",e),([t,r])=>o(fu(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(fu(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[cp(t),r]),ju=(e,t=[])=>o(o(qu(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>ju(n,[...t,r]),()=>[t,e]),Fu=e=>o(o(ju(e),([t,r])=>o(o(o(qu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[lp(t),r]),vx=e=>o(o(u("(",e),([t,r])=>o(Fu(r),([n,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[dp(t),r]),$x=e=>o(o(u("new",e),([t,r])=>o(u("(",r),([n,a])=>o(Fu(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([d,g])=>o(S(g),([b,V])=>[[t,n,s,c,d,b],V])))))),([t,r])=>[fp(t),r]),Tx=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])=>[gp(t),r]),kx=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])=>[hp(t),r]),wx=e=>o(o(o(u("as",e),([t,r])=>o(S(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[yp(t),r]),Ex=e=>o(o(u("{",e),([t,r])=>o(Tx(r),([n,a])=>o(u("[",a),([s,m])=>o(Y(m),([c,l])=>o(u("in",l),([d,g])=>o(S(g),([b,V])=>o(wx(V),([G,w])=>o(u("]",w),([Ce,L])=>o(kx(L),([le,re])=>o(u(":",re),([Me,oe])=>o(S(oe),([rt,lt])=>o(xu(lt),([F,fn])=>o(u("}",fn),([Bt,Wt])=>[[t,n,s,c,d,b,G,Ce,le,Me,rt,F,Bt],Wt]))))))))))))),([t,r])=>[xp(t),r]),Rx=e=>o(Y(e),([t,r])=>[Ip(t),r]),Sx=e=>o(fo(e),([t,r])=>[bp(t),r]),Ox=e=>o(Ta(e),([t,r])=>[vp(t),r]),Px=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[$p(t),r]),Cx=e=>o(ka(['"',"'"],e),([t,r])=>[t,r]),Mx=e=>o(u("null",e),([t,r])=>[Tp(t),r]),Ax=e=>o(u("undefined",e),([t,r])=>[void 0,r]),Du=e=>o(o(Ou(e),([t,r])=>o(u(":",r),([n,a])=>o(vo(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[kp(t),r]),Gu=(e,t=[])=>o(o(Du(e),([r,n])=>o(Cu(n),([a,s])=>[[r,a],s])),([r,n])=>Gu(n,[...t,r]),()=>[t,e]),Lx=e=>o(o(Gu(e),([t,r])=>o(o(o(Du(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[wp(t),r]),Nu=e=>o(o(u("{",e),([t,r])=>o(Lx(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Ep(t),r]),Uu=(e,t=[])=>o(o(vo(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>Uu(n,[...t,r]),()=>[t,e]),qx=e=>o(o(Uu(e),([t,r])=>o(o(o(vo(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]),jx=e=>o(o(u("[",e),([t,r])=>o(qx(r),([n,a])=>o(u("]",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Sp(t),r]),vo=e=>o(o(Sx(e),([t,r])=>[t,r],()=>o(Ox(e),([t,r])=>[t,r],()=>o(Px(e),([t,r])=>[t,r],()=>o(Cx(e),([t,r])=>[t,r],()=>o(Mx(e),([t,r])=>[t,r],()=>o(Ax(e),([t,r])=>[t,r],()=>o(Nu(e),([t,r])=>[t,r],()=>o(jx(e),([t,r])=>[t,r],()=>[])))))))),([t,r])=>[t,r]),Fx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,r])=>[Op(t),r]),Dx=e=>o(u(".*",e),([t,r])=>[Pp(t),r]),Gx=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,r])=>[Cp(t),r]),Nx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,r])=>[Mp(t),r]),Ux=e=>o(u("(?!)",e),([t,r])=>[Ap(t),r]),Kx=e=>o(lu(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,r])=>[Lp(t),r]),_x=e=>o(o(Fx(e),([t,r])=>[t,r],()=>o(Dx(e),([t,r])=>[t,r],()=>o(Gx(e),([t,r])=>[t,r],()=>o(Nx(e),([t,r])=>[t,r],()=>o(Ux(e),([t,r])=>[t,r],()=>o(zx(e),([t,r])=>[t,r],()=>o(Kx(e),([t,r])=>[t,r],()=>[]))))))),([t,r])=>[t,r]),zx=e=>o(o(u("(",e),([t,r])=>o($o(r),([n,a])=>o(u(")",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[qp(t),r]),Ku=e=>o(o(o(yo(e),([t,r])=>o(u("|",r),([n,a])=>o(Ku(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(o(yo(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[]))),([t,r])=>[jp(t),r]),yo=e=>o(o(_x(e),([t,r])=>o($o(r),([n,a])=>[[t,n],a])),([t,r])=>[Fp(t),r]),$o=e=>o(o(Ku(e),([t,r])=>[t,r],()=>o(yo(e),([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),hs=e=>o(o(u("^",e),([t,r])=>o($o(r),([n,a])=>o(u("$",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Dp(t),r]),_u=(e,t=[])=>o(o(S(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>_u(n,[...t,r]),()=>[t,e]),Vx=e=>o(o(_u(e),([t,r])=>o(o(o(S(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]),zu=e=>o(o(o(u("extends",e),([t,r])=>o(Vx(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Np(t),r]),Bx=e=>o(o(u("interface",e),([t,r])=>o(Y(r),([n,a])=>o(xo(a),([s,m])=>o(zu(m),([c,l])=>o(bo(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Up(t),r]),Wx=e=>o(o(u("interface",e),([t,r])=>o(Y(r),([n,a])=>o(zu(a),([s,m])=>o(bo(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[Kp(t),r]),Hx=e=>o(o(u("type",e),([t,r])=>o(Y(r),([n,a])=>o(xo(a),([s,m])=>o(u("=",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[_p(t),r]),Yx=e=>o(o(u("type",e),([t,r])=>o(Y(r),([n,a])=>o(u("=",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[zp(t),r]),Jx=e=>o(o(o(u("export",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Vp(t),r]),Xx=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]),Vu=(e,t=[])=>o(o(To(e),([r,n])=>o(Xx(n),([a,s])=>[[r,a],s])),([r,n])=>Vu(n,[...t,r]),()=>[t,e]),Zx=e=>o(o(Vu(e),([t,r])=>o(o(o(To(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Bp(t),r]),To=e=>o(o(Jx(e),([t,r])=>o(o(Bx(r),([n,a])=>[n,a],()=>o(Wx(r),([n,a])=>[n,a],()=>o(Hx(r),([n,a])=>[n,a],()=>o(Yx(r),([n,a])=>[n,a],()=>[])))),([n,a])=>o(xu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Wp(t),r]),Qx=e=>o(o(To(e),([t,r])=>o(Zx(r),([n,a])=>[[t,n],a])),([t,r])=>[Hp(t),r]),Bu=e=>o(o(Qx(e),([t,r])=>[t,r],()=>o(tx(e),([t,r])=>[t,r],()=>o(S(e),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]);function Wu(e){let t=Io(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:X()}function tI(e){return e.join("|")}function rI(e){return e.slice(1,e.length-1)}function nI(e,t,r){return wt(t,`${r}${e}`)}function aI(e,t){return wt(e,`${t}${us}`)}function oI(e,t){return wt(e,`${t}${Gn}`)}function iI(e,t){return wt(e,`${t}${Un}`)}function sI(e,t){return Hr(E([P("false"),P("true")]),e,t)}function mI(e,t){return wt(e,`${t}${Kn}`)}function pI(e,t,r){return wt(t,`${r}${rI(e)}`)}function uI(e,t,r){let n=Yr(e,{});return Hr(n,t,r)}function cI(e,t,r){let n=Le(e);return Hr(n,t,r)}function Hu(e,t,r,n=[]){return i.ShiftLeft(e,(a,s)=>Hu(s,t,r,[...n,Hr(a,[],"")]),()=>wt(t,`${r}(${tI(n)})`))}function Hr(e,t,r){return be(e)?cI(e.enum,t,r):ve(e)?oI(t,r):q(e)?nI(e.const,t,r):Je(e)?aI(t,r):Fe(e)?sI(t,r):Q(e)?iI(t,r):$e(e)?mI(t,r):ee(e)?pI(e.pattern,t,r):Ju(e)?uI(e.parameters[0],t,r):x(e)?Hu(e.anyOf,t,r):Vi}function wt(e,t){return i.ShiftLeft(e,(r,n)=>Hr(r,n,t),()=>t)}function lI(e){return`^${wt(e,"")}$`}function Yu(e){let t=lI(e);return zn(t)}function Yr(e,t){return k(e)?p.Update(Yu(e),{},t):Qn(e,t)}function Xu(e,t,r,n){let a=qe(e,t,r);return Yr(a,n)}function Qn(e,t={}){return I("TemplateLiteral",[e],t)}function Ju(e){return ne(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function Zu(e){return Yr(e,{})}function dI(e){let t=Wu(e);return Zu(t)}function Qu(e,t={}){let r=i.IsString(e)?dI(e):Zu(e);return p.Update(r,{},t)}function ee(e){return y(e,"TemplateLiteral")}var v={};Ot(v,{ExtendsFalse:()=>T,ExtendsTrue:()=>h,ExtendsUnion:()=>ko,IsExtendsFalse:()=>fI,IsExtendsTrue:()=>tc,IsExtendsTrueLike:()=>pr,IsExtendsUnion:()=>ec,Match:()=>_});function ko(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function ec(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 tc(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function T(){return p.Create({"~kind":"ExtendsFalse"},{})}function fI(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function pr(e){return ec(e)||tc(e)}function _(e,t,r){return pr(e)?t(e.inferred):r()}function gI(e,t,r,n){return _(C(e,r,n),a=>h(p.Assign(p.Assign(e,a),{[t]:r})),()=>T())}function hI(e,t){return h(e)}function yI(e,t,r,n,a){return _(C(e,t,r),s=>_(C(s,t,n),m=>h(m),()=>T()),()=>_(C(e,t,a),s=>h(s),()=>T()))}function xI(e,t,r){let n=Le(r);return C(e,t,n)}function rc(e,t,r){return i.ShiftLeft(r,(n,a)=>_(C(e,t,n),s=>rc(s,t,a),()=>T()),()=>h(e))}function II(e,t,r){let n=we(r);return C(e,t,n)}function nc(e,t,r){return i.ShiftLeft(r,(n,a)=>_(C(e,t,n),s=>h(s),()=>nc(e,t,a)),()=>T())}function j(e,t,r){return Z(r)?hI(e,t):H(r)?yI(e,t,r.if,r.then,r.else):be(r)?xI(e,t,r.enum):J(r)?gI(e,r.name,t,r.extends):O(r)?rc(e,t,r.allOf):ee(r)?II(e,t,r.pattern):x(r)?nc(e,t,r.anyOf):ae(r)?h(e):T()}function ac(e,t,r){return J(r)?j(e,t,r):Z(r)?h(e):ae(r)?h(e):ko(e)}function bI(e,t){let r=qt(e),n=qt(t);return r&&n||!r&&n?!0:!(r&&!n)}function oc(e,t,r,n){return z(n)?bI(t,n)?C(e,r,n.items):T():j(e,t,n)}function ic(e,t,r){return Je(r)?h(e):j(e,t,r)}function sc(e,t,r){return Fe(r)?h(e):j(e,t,r)}function vI(e,t,r,n,a){let s=J(n)?t:n,m=J(n)?n:t,c=xe(t),l=xe(n);return!c&&l?T():_(C(e,s,m),d=>Jr(d,r,a),()=>T())}function $I(e,t,r,n){return i.ShiftLeft(n,(a,s)=>vI(e,t,r,a,s),()=>xe(t)?h(e):T())}function TI(e,t,r){return i.ShiftLeft(t,(n,a)=>$I(e,n,a,r),()=>h(e))}function Jr(e,t,r){return TI(e,t,r)}function Ea(e,t,r){return Xe(r)?h(e):C(e,t,r)}function mc(e,t,r,n){return Z(n)?h(e):ae(n)?h(e):ie(n)?_(Jr(e,t,n.parameters),a=>Ea(a,r,n.instanceType),()=>T()):T()}function pc(e,t,r,n,a){return _(C(e,t,a),()=>C(e,r,a),()=>C(e,n,a))}function uc(e,t,r){let n=Le(t);return C(e,n,r)}function cc(e,t,r,n){return Z(n)?h(e):ae(n)?h(e):se(n)?_(Jr(e,t,n.parameters),a=>Ea(a,r,n.returnType),()=>T()):T()}function lc(e,t,r){return ve(r)?h(e):Q(r)?h(e):j(e,t,r)}function dc(e,t,r){let n=B(t);return C(e,n,r)}function Ra(e,t,r){return t===r?h(e):T()}function kI(e,t,r){return q(r)?Ra(e,t,r.const):Je(r)?h(e):j(e,P(t),r)}function wI(e,t,r){return q(r)?Ra(e,t,r.const):Fe(r)?h(e):j(e,P(t),r)}function EI(e,t,r){return q(r)?Ra(e,t,r.const):Q(r)?h(e):j(e,P(t),r)}function RI(e,t,r){return q(r)?Ra(e,t,r.const):$e(r)?h(e):j(e,P(t),r)}function fc(e,t,r){return i.IsBigInt(t.const)?kI(e,t.const,r):i.IsBoolean(t.const)?wI(e,t.const,r):i.IsNumber(t.const)?EI(e,t.const,r):i.IsString(t.const)?RI(e,t.const,r):X()}function gc(e,t,r){return J(r)?j(e,t,r):h(e)}function hc(e,t,r){return Qt(r)?h(e):j(e,t,r)}function yc(e,t,r){return Q(r)?h(e):j(e,t,r)}function SI(e,t,r){return xe(t)?xe(r)?h(e):T():h(e)}function OI(e,t,r){return J(r)&&xt(r.extends)?T():_(C(e,t,r),n=>SI(n,t,r),()=>T())}function PI(e,t){return e.reduce((r,n)=>n in t?pr(t[n])?{...r,...t[n].inferred}:X():X(),{})}function CI(e,t,r){let n={};for(let m of i.Keys(r))n[m]=m in t?OI({},t[m],r[m]):xe(r[m])?J(r[m])?h(p.Assign(e,{[r[m].name]:r[m].extends})):h(e):T();let a=i.Values(n).every(m=>pr(m)),s=a?PI(i.Keys(n),n):{};return a?h(s):T()}function MI(e,t,r){let n=CI(e,t,r);return pr(n)?h(p.Assign(e,n.inferred)):T()}function AI(e,t,r){return MI(e,t,r)}function LI(e,t){return i.Keys(t).reduce((r,n)=>({...r,[n]:i.HasPropertyKey(e,n)?x(r[n])?E([...r[n].anyOf,t[n]]):E([e[n],t[n]]):t[n]}),e)}function xc(e,t,r,n){return i.ShiftLeft(t,(a,s)=>_(C({},e[a],r),m=>xc(e,s,r,LI(n,m)),()=>T()),()=>h(n))}function qI(e,t,r,n){let a=i.Keys(t);return xc(t,a,n,e)}function Ic(e,t,r){return ge(r)?qI(e,t,Ne(r),Te(r)):A(r)?AI(e,t,r.properties):j(e,$(t),r)}function jI(e,t){return i.IsEqual(i.Keys(t).length,0)?h(e):T()}function FI(e,t,r,n,a){return C(e,r,a)}function bc(e,t,r,n){return ge(n)?FI(e,Yn(t),r,Yn(Ne(n)),Te(n)):A(n)?jI(e,n.properties):Z(n)?h(e):ae(n)?h(e):T()}function vc(e,t,r){return $e(r)?h(e):j(e,t,r)}function $c(e,t,r){return It(r)?h(e):j(e,t,r)}function Tc(e,t,r){let n=we(t);return C(e,n,r)}function wo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Xr(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 Eo(e){return $t(e)?J(e.items)?z(e.items.extends)?wo(e.items.name,e.items.extends.items):ae(e.items.extends)?wo(e.items.name,e.items.extends):void 0:X():void 0}function Sa(e){return J(e)?wo(e.name,e.extends):void 0}function Ro(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>_(C({},n,t),()=>Ro(a,t,[...r,n]),()=>{}),()=>r)}function kc(e,t,r,n){let a=Ro(r,n);return i.IsArray(a)?h(p.Assign(e,{[t]:te(a)})):T()}function Oa(e,t,r,n){let a=Ro(r,n);return i.IsArray(a)?h(p.Assign(e,{[t]:E(a)})):T()}function DI(e){return[...e].reverse()}function So(e,t){return t?DI(e):e}function GI(e){let t=e.length>0?e[0]:void 0,r=ne(t)?Eo(t):void 0;return ne(r)}function NI(e,t,r,n,a,s){return _(C(e,r,a),m=>wc(m,t,n,s),()=>T())}function UI(e,t,r,n,a){let s=Eo(n);return Xr(s)?kc(e,s.name,So(r,t),s.type):i.ShiftLeft(r,(m,c)=>NI(e,t,m,c,n,a),()=>T())}function KI(e,t,r,n){return i.ShiftLeft(n,(a,s)=>UI(e,t,r,a,s),()=>i.IsEqual(r.length,0)?h(e):T())}function wc(e,t,r,n){return KI(e,t,r,n)}function _I(e,t,r){let n=Et(e,K([],[]),r),a=GI(n);return wc(e,a,So(t,a),So(n,a))}function Ec(e,t,r){let n=Sa(r);return Xr(n)?Oa(e,n.name,t,n.type):i.ShiftLeft(t,(a,s)=>_(C(e,a,r),m=>Ec(m,s,r),()=>T()),()=>h(e))}function Rc(e,t,r){let n=Et(e,K([],[]),t);return N(r)?_I(e,n,r.items):z(r)?Ec(e,n,r.items):j(e,te(n),r)}function Sc(e,t,r){return Xe(r)?h(e):or(r)?h(e):j(e,t,r)}function Oc(e,t,r){return i.ShiftLeft(r,(n,a)=>_(C(e,t,n),s=>h(s),()=>Oc(e,t,a)),()=>T())}function Oo(e,t,r){return i.ShiftLeft(t,(n,a)=>_(Oc(e,n,r),s=>Oo(s,a,r),()=>T()),()=>h(e))}function Pc(e,t,r){let n=Sa(r);return Xr(n)?Oa(e,n.name,t,n.type):x(r)?Oo(e,t,r.anyOf):Oo(e,t,[r])}function Cc(e,t,r){return J(r)?j(e,t,r):Z(r)?h(e):ae(r)?h(e):T()}function Mc(e,t,r){return Xe(r)?h(e):j(e,t,r)}function C(e,t,r){return Z(t)?ac(e,t,r):z(t)?oc(e,t,t.items,r):Je(t)?ic(e,t,r):Fe(t)?sc(e,t,r):ie(t)?mc(e,t.parameters,t.instanceType,r):H(t)?pc(e,t.if,t.then,t.else,r):be(t)?uc(e,t.enum,r):se(t)?cc(e,t.parameters,t.returnType,r):ve(t)?lc(e,t,r):O(t)?dc(e,t.allOf,r):q(t)?fc(e,t,r):xt(t)?gc(e,t,r):Qt(t)?hc(e,t,r):Q(t)?yc(e,t,r):A(t)?Ic(e,t.properties,r):ge(t)?bc(e,Ne(t),Te(t),r):$e(t)?vc(e,t,r):It(t)?$c(e,t,r):ee(t)?Tc(e,t.pattern,r):N(t)?Rc(e,t.items,r):or(t)?Sc(e,t,r):x(t)?Pc(e,t.anyOf,r):ae(t)?Cc(e,t,r):Xe(t)?Mc(e,t,r):T()}function zI(e,t){return B([...e,$(t)])}function Po(e,t,r){return k(e)?p.Update(zI(e,t),{},r):_r(e,t,r)}function Ac(e,t,r,n,a){let s=qe(e,t,r),m=Zr(e,t,n);return Po(s,m,a)}function _r(e,t,r={}){return I("Interface",[e,t],r)}function ur(e){return ne(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function Lc(e,t,r={}){return Po(e,t,r)}function VI(e,t,r){return e.includes(r)?!0:Qr([...e,r],t,t[r])}function qc(e,t,r){let n=Ln(r);return Kt(e,t,n)}function Kt(e,t,r){return i.ShiftLeft(r,(n,a)=>Qr(e,t,n)?!0:Kt(e,t,a),()=>!1)}function Qr(e,t,r){return me(r)?VI(e,t,r.$ref):z(r)?Qr(e,t,r.items):ie(r)?Kt(e,t,[...r.parameters,r.instanceType]):se(r)?Kt(e,t,[...r.parameters,r.returnType]):ur(r)?qc(e,t,r.parameters[1]):O(r)?Kt(e,t,r.allOf):A(r)?qc(e,t,r.properties):x(r)?Kt(e,t,r.anyOf):N(r)?Kt(e,t,r.items):ge(r)?Qr(e,t,Te(r)):!1}function jc(e,t,r){return Qr(e,t,r)}function BI(e,t){return t.reduce((r,n)=>jc([n],e,e[n])?[...r,n]:r,[])}function Fc(e){let t=An(e);return BI(e,t)}function WI(e,t,r){return r.includes(t)?r:t in e?en(e,e[t],[...r,t]):X()}function Dc(e,t,r){let n=Ln(t);return cr(e,n,r)}function cr(e,t,r){return t.reduce((n,a)=>en(e,a,n),r)}function en(e,t,r){return me(t)?WI(e,t.$ref,r):z(t)?en(e,t.items,r):ie(t)?cr(e,[...t.parameters,t.instanceType],r):se(t)?cr(e,[...t.parameters,t.returnType],r):ur(t)?Dc(e,t.parameters[1],r):O(t)?cr(e,t.allOf,r):A(t)?Dc(e,t.properties,r):x(t)?cr(e,t.anyOf,r):N(t)?cr(e,t.items,r):ge(t)?en(e,Te(t),r):r}function Gc(e,t,r){return en(e,r,[t])}function HI(e){return Jt()}function YI(e){return i.Keys(e).reduce((t,r)=>({...t,[r]:_t(e[r])}),{})}function tn(e){return e.reduce((t,r)=>[...t,_t(r)],[])}function _t(e){return me(e)?HI(e.$ref):z(e)?Ae(_t(e.items),Mn(e)):ie(e)?ze(tn(e.parameters),_t(e.instanceType)):se(e)?Ve(tn(e.parameters),_t(e.returnType)):O(e)?Ie(tn(e.allOf)):A(e)?$(YI(e.properties)):ge(e)?Hn(nr(e),_t(Te(e))):x(e)?E(tn(e.anyOf)):N(e)?te(tn(e.items)):e}function JI(e,t){return t in e?_t(e[t]):ue()}function Nc(e){return JI(e.$defs,e.$ref)}function XI(e,t,r){let n=qe(e,K([],[]),t),a=Zr({},K([],[]),r);return B([...n,$(a)])}function ZI(e,t){return i.Keys(e).filter(n=>t.includes(n)).reduce((n,a)=>{let s=e[a],m=ur(s)?XI(e,s.parameters[0],s.parameters[1]):s;return{...n,[a]:m}},{})}function Uc(e,t,r){let n=Gc(e,t,r),a=ZI(e,n);return We(a,t)}function Kc(e,t){return t in e?me(e[t])?Kc(e,e[t].$ref):e[t]:D()}function Ze(e,t){return Kc(e,t)}function _c(e){return de(e)?Nc(e):qn(e)?ue():e}function fe(e,t,r){let n=_c(t),a=_c(r);return C(e,n,a)}var Fr="equal",QI="disjoint",Dr="left-inside",Gr="right-inside";function tr(e,t){let r=[ae(e)?v.ExtendsFalse():fe({},e,t),ae(e)?v.ExtendsTrue({}):fe({},t,e)];return v.IsExtendsTrueLike(r[0])&&v.IsExtendsTrueLike(r[1])?Fr:v.IsExtendsTrueLike(r[0])&&v.IsExtendsFalse(r[1])?Dr:v.IsExtendsFalse(r[0])&&v.IsExtendsTrueLike(r[1])?Gr:QI}function eb(e,t){return t.filter(r=>tr(e,r)!==Gr)}function tb(e,t){let r=t.some(n=>{let a=tr(e,n);return i.IsEqual(a,Dr)||i.IsEqual(a,Fr)});return i.IsEqual(r,!1)}function rb(e,t){let r=Ge(e);return Z(r)?[r]:tb(r,t)?[...eb(r,t),r]:t}function nb(e){return e.reduce((t,r)=>A(r)?[...t,r]:xt(r)?t:rb(r,t),[])}function so(e){let t=nb(e);return Ur(t)}function Co(e,t){return p.Update(Ge(e),{},t)}function zc(e,t,r,n){let a=f(e,t,r);return Co(a,n)}function rn(e,t=[]){return ht(e)&&i.IsEqual(e.action,"Conditional")?me(e.parameters[0])?rn(e.parameters[2],rn(e.parameters[3],[...t,e.parameters[0].$ref])):rn(e.parameters[2],rn(e.parameters[3],t)):ht(e)&&i.IsEqual(e.action,"Mapped")&&ht(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&me(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function ab(e,t){return e.reduce((r,n)=>[...r,t.includes(n.name)],[])}function Wc(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>i.ShiftLeft(t,(s,m)=>Wc(a,m,[...r,[s,n]]),()=>r),()=>r)}function ob(e){return x(e)?[...e.anyOf]:[e]}function ib(e,t){return e.reduce((r,n)=>[...r,[...n,t]],[])}function Vc(e,t){return t.reduce((r,n)=>[...r,...ib(e,n)],[])}function Bc(e){return e.reduce((t,r)=>i.IsEqual(r[0],!0)?Vc(t,ob(r[1])):Vc(t,[r[1]]),[[]])}function Hc(e,t,r){let n=rn(r),a=ab(e,n),s=Wc(t,a);return ht(r)&&i.IsEqual(r.action,"Conditional")||ht(r)&&i.IsEqual(r.action,"Mapped")?Bc(s):[t]}function sb(){return["(not-resolvable)",D()]}function mb(){return["(not-generic)",D()]}function pb(e,t,r){return[e,yt(t,r)]}function ub(e,t,r){return t in e?Yc(e,t,e[t],r):sb()}function Yc(e,t,r,n){return Yt(r)?pb(t,r.parameters,r.expression):me(r)?ub(e,r.$ref,n):mb()}function Jc(e,t,r){return Yc(e,"(anonymous)",t,r)}function cb(e,t,r){if(J(t)||lr(t)||v.IsExtendsTrueLike(fe({},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 Xc(e,t,r,n,a){let s=f(e,t,a);return cb(r,s,n),p.Assign(e,{[r]:s})}function lb(e,t,r,n,a){let s=f(e,t,r.extends),m=f(e,t,r.equals);return i.ShiftLeft(a,(c,l)=>Mo(Xc(e,t,r.name,s,c),t,n,l),()=>Mo(Xc(e,t,r.name,s,m),t,n,[]))}function Mo(e,t,r,n){return i.ShiftLeft(r,(a,s)=>lb(e,t,a,s,n),()=>e)}function Zc(e,t,r,n){return Mo(e,t,r,n)}function db(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function fb(e,t){return i.IsEqual(db(e),t)}function gb(e,t,r,n,a,s){let m=Zc(e,t,n,s),c=f(m,K([...t.callstack,r.$ref],t.visited),a);return f(m,K([],[]),c)}function hb(e,t,r,n,a,s){return s.reduce((m,c)=>[...m,gb(e,t,r,n,a,c)],[])}function yb(e,t,r,n,a,s){let m=Hc(n,s,a),c=hb(e,t,r,n,a,m);return i.IsEqual(c.length,1)?c[0]:Oe(c)}function Pa(e,t,r,n){let a=qe(e,t,n),s=Jc(e,r,n),m=s[0],c=s[1];return Yt(c)?fb(t,m)?zr(it(m),a):yb(e,t,it(m),c.parameters,c.expression,a):zr(r,a)}function zr(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Qc(e,t){return Pa({},K([],[]),e,t)}function lr(e){return y(e,"Call")}function xb(e){return p.Discard(e,["~immutable"])}function el(e,t){return p.Update(xb(e),{},t)}function tl(e,t,r,n){let a=f(e,t,r);return el(a,n)}function rl(e,t){return e(t)}function nl(e,t){return i.IsString(t)?P(rl(e,t)):P(t)}function al(e,t){let r=we(t);return pt(e,r)}function ol(e,t){let r=t.map(n=>pt(e,n));return E(r)}function pt(e,t){return q(t)?nl(e,t.const):ee(t)?al(e,t.pattern):x(t)?ol(e,t.anyOf):t}function ea(e,t={}){return I("Capitalize",[e],t)}function il(e,t={}){return Ao(e,t)}function ta(e,t={}){return I("Lowercase",[e],t)}function sl(e,t={}){return Lo(e,t)}function ra(e,t={}){return I("Uncapitalize",[e],t)}function ml(e,t={}){return qo(e,t)}function na(e,t={}){return I("Uppercase",[e],t)}function pl(e,t={}){return jo(e,t)}var Ib=e=>e[0].toUpperCase()+e.slice(1),bb=e=>e.toLowerCase(),vb=e=>e[0].toLowerCase()+e.slice(1),$b=e=>e.toUpperCase();function Ao(e,t){return k([e])?p.Update(pt(Ib,e),{},t):ea(e,t)}function Lo(e,t){return k([e])?p.Update(pt(bb,e),{},t):ta(e,t)}function qo(e,t){return k([e])?p.Update(pt(vb,e),{},t):ra(e,t)}function jo(e,t){return k([e])?p.Update(pt($b,e),{},t):na(e,t)}function ul(e,t,r,n){let a=f(e,t,r);return Ao(a,n)}function cl(e,t,r,n){let a=f(e,t,r);return Lo(a,n)}function ll(e,t,r,n){let a=f(e,t,r);return qo(a,n)}function dl(e,t,r,n){let a=f(e,t,r);return jo(a,n)}function aa(e,t,r,n,a={}){return I("Conditional",[e,t,r,n],a)}function fl(e,t,r,n,a={}){return Fo({},K([],[]),e,t,r,n,a)}function Tb(e,t,r,n,a,s){let m=fe(e,r,n);return v.IsExtendsUnion(m)?E([f(m.inferred,t,a),f(e,t,s)]):v.IsExtendsTrue(m)?f(m.inferred,t,a):f(e,t,s)}function Fo(e,t,r,n,a,s,m){return k([r,n])?p.Update(Tb(e,t,r,n,a,s),{},m):aa(r,n,a,s,m)}function gl(e,t,r,n,a,s,m){let c=f(e,t,r),l=f(e,t,n);return Fo(e,t,c,l,a,s,m)}function oa(e,t={}){return I("ConstructorParameters",[e],t)}function hl(e,t={}){return Do(e,t)}function kb(e){let t=ie(e)?e.parameters:[],r=Et({},K([],[]),t);return te(r)}function Do(e,t){return k([e])?p.Update(kb(e),{},t):oa(e,t)}function yl(e,t,r,n){let a=f(e,t,r);return Do(a,n)}function ia(e,t,r={}){return I("Exclude",[e,t],r)}function xl(e,t,r={}){return nn(e,t,r)}function nn(e,t,r){return k([e,t])?p.Update(Bn(e,t),{},r):ia(e,t,r)}function Il(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return nn(s,m,a)}function sa(e,t,r={}){return I("Extract",[e,t],r)}function bl(e,t,r={}){return Go(e,t,r)}function wb(e,t){let r=fe({},e,t);return v.IsExtendsTrueLike(r)?[e]:[]}function Eb(e,t){return e.reduce((r,n)=>[...r,...wb(n,t)],[])}function vl(e,t){let r=Ge(e),n=x(r)?r.anyOf:[r],a=Eb(n,t);return Oe(a)}function Go(e,t,r){return k([e,t])?p.Update(vl(e,t),{},r):sa(e,t,r)}function $l(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return Go(s,m,a)}function Rb(e){return e.reduce((t,r)=>Nn(r)?[...t,P(r)]:t,[])}function dr(e){let t=Rb(e);return E(t)}function Vr(e,t,r={}){return I("Index",[e,t],r)}function Tl(e,t,r={}){let n=i.IsArray(t)?dr(t):t;return No(e,n,r)}function kl(e,t){let r=Ze(e,t);return je(r)}function wl(e,t,r){let n=_e(e,t,r);return je(n)}function Sb(e,t){let r=i.Keys(e).filter(g=>!i.HasPropertyKey(t,g)),n=i.Keys(t).filter(g=>!i.HasPropertyKey(e,g)),a=i.Keys(e).filter(g=>i.HasPropertyKey(t,g)),s=r.reduce((g,b)=>({...g,[b]:e[b]}),{}),m=n.reduce((g,b)=>({...g,[b]:t[b]}),{}),c=a.reduce((g,b)=>({...g,[b]:B([e[b],t[b]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function El(e){return e.reduce((t,r)=>Sb(t,je(r)),{})}function Rl(e){let t=Ms(te(e));return je(t)}function Ob(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:Oe([e[s],t[s]])}),{})}function Sl(e,t){return i.ShiftLeft(e,(r,n)=>Sl(n,Ob(t,je(r))),()=>t)}function Ol(e){return i.ShiftLeft(e,(t,r)=>Sl(r,je(t)),()=>X())}function je(e){return de(e)?kl(e.$defs,e.$ref):H(e)?wl(e.if,e.then,e.else):O(e)?El(e.allOf):x(e)?Ol(e.anyOf):N(e)?Rl(e.items):A(e)?e.properties:{}}function fr(e){let t=je(e);return $(t)}var Pb=new RegExp("^(?:0|[1-9][0-9]*)$");function gr(e){let t=`${e}`;return Pb.test(t)?parseInt(t):e}function Cb(e){return P(gr(e))}function Pl(e){return e.map(t=>Cl(t))}function Cl(e){return O(e)?Ie(Pl(e.allOf)):x(e)?E(Pl(e.anyOf)):q(e)?Cb(e.const):e}function Ml(e,t){let r=Cl(t),n=fe({},r,Se());return v.IsExtendsTrueLike(n)?e:q(t)&&i.IsEqual(t.const,"length")?Se():D()}function Al(e,t){let r=Ze(e,t);return Pe(r)}function Ll(e,t,r){let n=_e(e,t,r);return Pe(n)}function ql(e){let t=Le(e);return Pe(t)}function jl(e){let t=B(e);return Pe(t)}function Fl(e){return[`${e}`]}function Dl(e){let t=we(e);return Pe(t)}function Gl(e){return e.reduce((t,r)=>[...t,...Pe(r)],[])}function Pe(e){return de(e)?Al(e.$defs,e.$ref):H(e)?Ll(e.if,e.then,e.else):be(e)?ql(e.enum):O(e)?jl(e.allOf):q(e)?Fl(e.const):ee(e)?Dl(e.pattern):x(e)?Gl(e.anyOf):[]}function hr(e){return Pe(e)}function an(e,t){return t.map(r=>on(e,r))}function on(e,t){return z(t)?Ae(on(e,t.items)):ie(t)?ze(an(e,t.parameters),on(e,t.instanceType)):se(t)?Ve(an(e,t.parameters),on(e,t.returnType)):N(t)?te(an(e,t.items)):x(t)?E(an(e,t.anyOf)):O(t)?Ie(an(e,t.allOf)):Xn(t)?$(e):t}function Nl(e,t){return on(e,t)}function Mb(e,t){let r=t in e?e[t]:D();return Nl(e,r)}function Ul(e,t){return t.reduce((r,n)=>[...r,Mb(e,n)],[])}function Ab(e,t){let r=hr(t),n=Ul(e,r);return Oe(n)}var Lb=new RegExp(vt);function qb(e){return e.filter(r=>Lb.test(r))}function jb(e){let t=An(e),r=qb(t),n=Ul(e,r);return Oe(n)}function Kl(e,t){return Q(t)?jb(e):Ab(e,t)}function Fb(e){return P(gr(e))}function _l(e){return e.map(t=>Uo(t))}function Uo(e){return O(e)?Ie(_l(e.allOf)):x(e)?E(_l(e.anyOf)):q(e)?Fb(e.const):e}function Db(e,t){return e.reduceRight((r,n,a)=>{let s=fe({},P(a),t);return v.IsExtendsTrueLike(s)?[n,...r]:r},[])}function Gb(e,t){let r=Uo(t),n=Db(e,r);return st(n)}function Nb(e){return st(e)}function zl(e,t){return q(t)&&i.IsEqual(t.const,"length")?P(e.length):Q(t)||ve(t)?Nb(e):Gb(e,t)}function Vl(e,t){return z(e)?Ml(e.items,t):A(e)?Kl(e.properties,t):N(e)?zl(e.items,t):D()}function Ub(e){return de(e)||H(e)||O(e)||x(e)?fr(e):e}function No(e,t,r){return k([e,t])?p.Update(Vl(Ub(e),t),{},r):Vr(e,t,r)}function Bl(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return No(s,m,a)}function ma(e,t={}){return I("InstanceType",[e],t)}function Wl(e,t={}){return Ko(e,t)}function Kb(e){return ie(e)?e.instanceType:D()}function Ko(e,t){return k([e])?p.Update(Kb(e),{},t):ma(e,t)}function Hl(e,t,r,n={}){let a=f(e,t,r);return Ko(a,n)}function Br(e,t={}){return I("KeyOf",[e],t)}function Yl(e,t={}){return _o(e,t)}function Jl(){return E([Se(),De(),er()])}function Xl(e){return Se()}function _b(e){return e.reduce((r,n)=>Nn(n)?[...r,P(gr(n))]:X(),[])}function Zl(e){let t=i.Keys(e),r=_b(t);return st(r)}function Ql(e){return nr(e)}function ed(e){let t=e.map((r,n)=>P(n));return st(t)}function td(e){return Z(e)?Jl():z(e)?Xl(e.items):A(e)?Zl(e.properties):ge(e)?Ql(e):N(e)?ed(e.items):D()}function zb(e){return de(e)||H(e)||O(e)||x(e)?fr(e):e}function _o(e,t){return k([e])?p.Update(td(zb(e)),{},t):Br(e,t)}function rd(e,t,r,n){let a=f(e,t,r);return _o(a,n)}function Kr(e,t,r,n,a={}){return I("Mapped",[e,t,r,n],a)}function nd(e,t,r,n,a={}){return zo({},K([],[]),e,t,r,n,a)}function Vb(e){let t=we(e);return Ca(t)}function Bb(e){return e.reduce((t,r)=>[...t,...Ca(r)],[])}function Wb(e){let t=Le(e);return Ca(t)}function Hb(e){return i.IsNumber(e)?[P(`${e}`)]:[P(e)]}function Ca(e){return be(e)?Wb(e.enum):q(e)?Hb(e.const):ee(e)?Vb(e.pattern):x(e)?Bb(e.anyOf):[e]}function ad(e){return Ca(e)}function Yb(e){return ee(e)?we(e.pattern):e}function Jb(e,t,r,n,a,s){let m=p.Assign(e,{[r.name]:n}),c=f(m,t,a),l=Yb(c),d=f(m,t,s);return ls(l)||ds(l)?{[l.const]:d}:{}}function Xb(e,t,r,n,a,s){return n.reduce((m,c)=>[...m,Jb(e,t,r,c,a,s)],[])}function Zb(e){return e.reduce((t,r)=>[...t,$(r)],[])}function od(e,t,r,n,a,s){let m=ad(n),c=Xb(e,t,r,m,a,s),l=Zb(c);return B(l)}function zo(e,t,r,n,a,s,m){return k([n])?p.Update(od(e,t,r,n,a,s),{},m):Kr(r,n,a,s,m)}function id(e,t,r,n,a,s,m){let c=f(e,t,n);return zo(e,t,r,c,a,s,m)}function Qb(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>r.includes(s)).reduce((s,m)=>({...s,[m]:Uc(n,m,t[m])}),{})}function ev(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>!r.includes(s)).reduce((s,m)=>({...s,[m]:f(n,K([],[]),t[m])}),{})}function tv(e,t,r){let n=Fc(t),a=Qb(e,t,n),s=ev(e,t,n),m={...a,...s};return p.Update(m,{},r)}function Ma(e,t,r,n){return tv(e,r,n)}function pa(e,t={}){return I("NonNullable",[e],t)}function sd(e,t={}){return Vo(e,t)}function rv(e){let t=E([Zt(),ar()]);return nn(e,t,{})}function Vo(e,t){return k([e])?p.Update(rv(e),{},t):pa(e,t)}function md(e,t,r,n){let a=f(e,t,r);return Vo(a,n)}function ua(e,t,r={}){return I("Omit",[e,t],r)}function pd(e,t,r={}){let n=i.IsArray(t)?dr(t):t;return Bo(e,n,r)}function Aa(e){let t=fr(e);return A(t)?t.properties:X()}function nv(e,t){return i.Keys(e).reduce((n,a)=>t.includes(a)?n:{...n,[a]:e[a]},{})}function ud(e,t){let r=Aa(e),n=hr(t),a=nv(r,n);return $(a)}function Bo(e,t,r){return k([e,t])?p.Update(ud(e,t),{},r):ua(e,t,r)}function cd(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return Bo(s,m,a)}function ca(e,t={}){return I("Parameters",[e],t)}function ld(e,t={}){return Wo(e,t)}function av(e){let t=se(e)?e.parameters:[],r=Et({},K([],[]),t);return te(r)}function Wo(e,t){return k([e])?p.Update(av(e),{},t):ca(e,t)}function dd(e,t,r,n){let a=f(e,t,r);return Wo(a,n)}function la(e,t={}){return I("Partial",[e],t)}function fd(e,t={}){return Ho(e,t)}function gd(e,t){let r=Ze(e,t),n=Qe(r);return We(p.Assign(e,{[t]:n}),t)}function hd(e,t,r){let n=_e(e,t,r);return Qe(n)}function yd(e){let t=B(e);return Qe(t)}function xd(e){let t=e.map(r=>Qe(r));return E(t)}function Id(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:At(e[a])}),{});return $(t)}function Qe(e){return de(e)?gd(e.$defs,e.$ref):H(e)?hd(e.if,e.then,e.else):O(e)?yd(e.allOf):x(e)?xd(e.anyOf):A(e)?Id(e.properties):$({})}function Ho(e,t){return k([e])?p.Update(Qe(e),{},t):la(e,t)}function bd(e,t,r,n){let a=f(e,t,r);return Ho(a,n)}function da(e,t,r={}){return I("Pick",[e,t],r)}function vd(e,t,r={}){let n=i.IsArray(t)?dr(t):t;return Yo(e,n,r)}function ov(e,t){return i.Keys(e).reduce((n,a)=>t.includes(a)?p.Assign(n,{[a]:e[a]}):n,{})}function $d(e,t){let r=Aa(e),n=hr(t),a=ov(r,n);return $(a)}function Yo(e,t,r){return k([e,t])?p.Update($d(e,t),{},r):da(e,t,r)}function Td(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return Yo(s,m,a)}function fa(e,t={}){return I("ReadonlyObject",[e],t)}function Jo(e,t={}){return Xo(e,t)}var kd=Jo;function wd(e){return Xt(Ae(e))}function Ed(e,t){let r=Ze(e,t),n=et(r);return We(p.Assign(e,{[t]:n}),t)}function Rd(e,t,r){let n=_e(e,t,r);return et(n)}function Sd(e){let t=B(e);return et(t)}function Od(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:jt(e[a])}),{});return $(t)}function Pd(e){return Xt(te(e))}function Cd(e){let t=e.map(r=>et(r));return E(t)}function et(e){return z(e)?wd(e.items):de(e)?Ed(e.$defs,e.$ref):H(e)?Rd(e.if,e.then,e.else):O(e)?Sd(e.allOf):A(e)?Od(e.properties):N(e)?Pd(e.items):x(e)?Cd(e.anyOf):e}function Xo(e,t){return k([e])?p.Update(et(e),{},t):fa(e)}function Md(e,t,r,n){let a=f(e,t,r);return Xo(a,n)}function Ad(e,t,r,n){return t.visited.includes(n)?r:n in e?f(e,K(t.callstack,[...t.visited,n]),e[n]):r}function Ld(e,t){let r=Ze(e,t),n=tt(r);return We(p.Assign(e,{[t]:n}),t)}function qd(e,t,r){let n=_e(e,t,r);return tt(n)}function jd(e){let t=B(e);return tt(t)}function Fd(e){let t=e.map(r=>tt(r));return E(t)}function Dd(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:Vn(e[a])}),{});return $(t)}function tt(e){return de(e)?Ld(e.$defs,e.$ref):H(e)?qd(e.if,e.then,e.else):O(e)?jd(e.allOf):x(e)?Fd(e.anyOf):A(e)?Dd(e.properties):$({})}function ga(e,t={}){return I("Required",[e],t)}function Gd(e,t={}){return Zo(e,t)}function Zo(e,t){return k([e])?p.Update(tt(e),{},t):ga(e,t)}function Nd(e,t,r,n){let a=f(e,t,r);return Zo(a,n)}function ha(e,t={}){return I("ReturnType",[e],t)}function Ud(e,t={}){return Qo(e,t)}function iv(e){return se(e)?e.returnType:D()}function Qo(e,t){return k([e])?p.Update(iv(e),{},t):ha(e,t)}function Kd(e,t,r,n={}){let a=f(e,t,r);return Qo(a,n)}function ya(e,t){return I("With",[e,t],{})}function _d(e,t){return ei(e,t)}function ei(e,t){return k([e])?p.Update(e,{},t):ya(e,t)}function zd(e,t,r,n){let a=f(e,t,r);return ei(a,n)}function sv(e){return $t(e)?N(e.items)?ti(e.items.items):J(e.items)?[e]:me(e.items)?[e]:[D()]:[e]}function ti(e){return e.reduce((r,n)=>[...r,...sv(n)],[])}function K(e,t){return{callstack:e,visited:t}}function k(e){return i.ShiftLeft(e,(t,r)=>me(t)?!1:k(r),()=>!0)}function Zr(e,t,r){return i.Keys(r).reduce((n,a)=>({...n,[a]:f(e,t,r[a])}),{})}function Et(e,t,r){let n=qe(e,t,r);return ti(n)}function qe(e,t,r){return r.map(n=>f(e,t,n))}function mv(e,t){let r=xe(e)?Pr(t,{}):t,n=Ft(e)?Or(r,{}):r;return qt(e)?sn(n,{}):n}function pv(e,t,r,n,a){return i.IsEqual(r,"AddImmutable")?Vd(e,t,n[0],a):i.IsEqual(r,"RemoveImmutable")?tl(e,t,n[0],a):i.IsEqual(r,"AddReadonly")?Ui(e,t,n[0],a):i.IsEqual(r,"RemoveReadonly")?Rs(e,t,n[0],a):i.IsEqual(r,"AddOptional")?Ki(e,t,n[0],a):i.IsEqual(r,"RemoveOptional")?Ps(e,t,n[0],a):i.IsEqual(r,"Capitalize")?ul(e,t,n[0],a):i.IsEqual(r,"Conditional")?gl(e,t,n[0],n[1],n[2],n[3],a):i.IsEqual(r,"ConstructorParameters")?yl(e,t,n[0],a):i.IsEqual(r,"Evaluate")?zc(e,t,n[0],a):i.IsEqual(r,"Exclude")?Il(e,t,n[0],n[1],a):i.IsEqual(r,"Extract")?$l(e,t,n[0],n[1],a):i.IsEqual(r,"Index")?Bl(e,t,n[0],n[1],a):i.IsEqual(r,"InstanceType")?Hl(e,t,n[0],a):i.IsEqual(r,"Interface")?Ac(e,t,n[0],n[1],a):i.IsEqual(r,"KeyOf")?rd(e,t,n[0],a):i.IsEqual(r,"Lowercase")?cl(e,t,n[0],a):i.IsEqual(r,"Mapped")?id(e,t,n[0],n[1],n[2],n[3],a):i.IsEqual(r,"Module")?Ma(e,t,n[0],a):i.IsEqual(r,"NonNullable")?md(e,t,n[0],a):i.IsEqual(r,"Pick")?Td(e,t,n[0],n[1],a):i.IsEqual(r,"Parameters")?dd(e,t,n[0],a):i.IsEqual(r,"Partial")?bd(e,t,n[0],a):i.IsEqual(r,"Omit")?cd(e,t,n[0],n[1],a):i.IsEqual(r,"ReadonlyObject")?Md(e,t,n[0],a):i.IsEqual(r,"Record")?Ws(e,t,n[0],n[1],a):i.IsEqual(r,"Required")?Nd(e,t,n[0],a):i.IsEqual(r,"ReturnType")?Kd(e,t,n[0],a):i.IsEqual(r,"TemplateLiteral")?Xu(e,t,n[0],a):i.IsEqual(r,"Uncapitalize")?ll(e,t,n[0],a):i.IsEqual(r,"Uppercase")?dl(e,t,n[0],a):i.IsEqual(r,"With")?zd(e,t,n[0],n[1]):I(r,n,a)}function uv(e,t,r){let n=me(r)?Ad(e,t,r,r.$ref):z(r)?Ae(f(e,t,r.items),Mn(r)):lr(r)?Pa(e,t,r.target,r.arguments):ie(r)?ze(qe(e,t,r.parameters),f(e,t,r.instanceType),_i(r)):se(r)?Ve(qe(e,t,r.parameters),f(e,t,r.returnType),zi(r)):H(r)?Lt(f(e,t,r.if),f(e,t,r.then),f(e,t,r.else),Ji(r)):O(r)?Ie(qe(e,t,r.allOf),ts(r)):A(r)?$(Zr(e,t,r.properties),Hi(r)):ge(r)?Hs(Ne(r),f(e,t,Te(r))):$t(r)?Nt(f(e,t,r.items)):N(r)?te(Et(e,t,r.items),Es(r)):x(r)?E(qe(e,t,r.anyOf),gs(r)):r;return mv(r,n)}function f(e,t,r){return ht(r)?pv(e,t,r.action,r.parameters,r.options):uv(e,t,r)}function ri(e,t){return f(e,K([],[]),t)}function cv(e){return p.Update(e,{"~immutable":!0},{})}function sn(e,t){return p.Update(cv(e),{},t)}function Vd(e,t,r,n){let a=f(e,t,r);return sn(a,n)}function Yp(e,t={}){return I("AddImmutable",[e],t)}function Xt(e,t={}){return sn(e,t)}function Jp(e,t={}){return I("Evaluate",[e],t)}function Bd(e,t={}){return Co(e,t)}function Xp(e,t={}){return I("Module",[e],t)}function Wd(e,t={}){return Ma({},K([],[]),e,t)}function Hd(...e){let[t,r,n]=He.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Bu(r),s=i.IsArray(a)&&i.IsEqual(a.length,2)?f(t,K([],[]),a[0]):D();return p.Update(s,{},n)}var U={};Ot(U,{Any:()=>Jt,Array:()=>Ae,BigInt:()=>Lr,Boolean:()=>Dn,Call:()=>Qc,Capitalize:()=>il,Codec:()=>Fn,Conditional:()=>fl,Constructor:()=>ze,ConstructorParameters:()=>hl,Cyclic:()=>We,Decode:()=>os,DecodeBuilder:()=>Ar,Dependent:()=>Lt,Encode:()=>is,EncodeBuilder:()=>Mr,Enum:()=>es,Evaluate:()=>Bd,Exclude:()=>xl,Extends:()=>fe,ExtendsResult:()=>v,Extract:()=>bl,Function:()=>Ve,Generic:()=>yt,Identifier:()=>qr,Immutable:()=>ss,Index:()=>Tl,Infer:()=>Cr,InstanceType:()=>Wl,Instantiate:()=>ri,Integer:()=>Dt,Interface:()=>Lc,Intersect:()=>Ie,IsAny:()=>Z,IsArray:()=>z,IsBigInt:()=>Je,IsBoolean:()=>Fe,IsCall:()=>lr,IsCodec:()=>jn,IsConstructor:()=>ie,IsCyclic:()=>de,IsDependent:()=>H,IsEnum:()=>be,IsEnumValue:()=>Qi,IsFunction:()=>se,IsGeneric:()=>Yt,IsIdentifier:()=>cs,IsImmutable:()=>qt,IsInfer:()=>J,IsInteger:()=>ve,IsIntersect:()=>O,IsKind:()=>y,IsLiteral:()=>q,IsNever:()=>xt,IsNull:()=>Qt,IsNumber:()=>Q,IsObject:()=>A,IsOptional:()=>xe,IsParameter:()=>fs,IsReadonly:()=>Ft,IsRecord:()=>ge,IsRef:()=>me,IsRefine:()=>to,IsRest:()=>$t,IsSchema:()=>ne,IsString:()=>$e,IsSymbol:()=>It,IsTemplateLiteral:()=>ee,IsThis:()=>Xn,IsTuple:()=>N,IsUndefined:()=>or,IsUnion:()=>x,IsUnknown:()=>ae,IsUnsafe:()=>qn,IsVoid:()=>Xe,KeyOf:()=>Yl,Literal:()=>P,Lowercase:()=>sl,Mapped:()=>nd,Module:()=>Wd,Never:()=>D,NonNullable:()=>sd,Null:()=>Zt,Number:()=>Se,Object:()=>$,Omit:()=>pd,Optional:()=>Bi,Parameter:()=>Gt,Parameters:()=>ld,Partial:()=>fd,Pick:()=>vd,Readonly:()=>ms,ReadonlyObject:()=>Jo,ReadonlyType:()=>kd,Record:()=>Hn,RecordKey:()=>nr,RecordPattern:()=>Ne,RecordValue:()=>Te,Ref:()=>it,Refine:()=>ps,Required:()=>Gd,Rest:()=>Nt,ReturnType:()=>Ud,Script:()=>Hd,String:()=>De,Symbol:()=>er,TemplateLiteral:()=>Qu,This:()=>Jn,Tuple:()=>te,Uncapitalize:()=>ml,Undefined:()=>ar,Union:()=>E,Unknown:()=>ue,Unsafe:()=>Yi,Uppercase:()=>pl,Void:()=>Zn,With:()=>_d});var yr="submit_review_report",xr="submit_test_gap_candidates",mn="submit_filtered_test_gaps",pn="submit_solver_gaps",lv=U.Object({verdict:U.Union([U.Literal("PASS"),U.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:U.String({description:"One short sentence summarizing the verdict."}),reasons:U.Array(U.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:U.Array(U.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."})});function Yd(e){return{name:yr,label:"Submit Review Report",description:"Submit your final verdict for this review. 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. Do not write a plain-text final answer instead of calling this tool.",parameters:lv,async execute(t,r){return e.report={verdict:r.verdict,summary:r.summary,reasons:r.reasons??[],notes:r.notes??[]},{content:[{type:"text",text:`Report recorded: ${r.verdict}`}],details:void 0}}}}var dv=U.Object({gaps:U.Array(U.Object({description:U.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:U.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 Jd(e){return{name:xr,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:dv,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 fv=U.Object({gaps:U.Array(U.Object({description:U.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:U.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 Xd(e){return{name:mn,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:fv,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 gv=U.Object({gaps:U.Array(U.Object({description:U.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:U.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:U.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 Zd(e){return{name:pn,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:gv,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}}}}var hv={description:"Focus area: the task description in `agent_prompt.md`. Judge it strictly against rubric items P1-P5 below. You do not need to judge the tests or solution \u2014 other reviewers cover those.",tests:"Focus area: the tests added in `test.patch` (a unified diff). Judge them strictly against rubric items T1-T6 below. You cannot execute code or apply the patch, so read the diff carefully and reason about determinism, coverage, and strictness directly from the added code. Read `agent_prompt.md` for context on what behavior is in scope, and skim `solution.patch` only to understand what the tests are checking. Do not judge the description or the solution's code quality.\nMandatory symbol-fairness check: for every non-trivial method/function/property/export name that a test calls, mutates, mocks, or asserts on, use grep/read on the repository (the pre-existing code, not solution.patch) to confirm it actually exists there, OR confirm it is explicitly named in `agent_prompt.md`. Pay special attention to any such name that is new/invented and that duplicates, shadows, or conflicts with an existing, differently-named public API doing the same thing (e.g. a test calling `setFoo(...)` when the repo's real, visible API is `setBar(...)`) \u2014 that is a textbook unfair/undiscoverable test per the fairness methodology, and is blocking on its own even if every other test in the patch is fine.",solution:"Focus area: the golden solution in `solution.patch` (a unified diff). Judge it strictly against rubric items S1-S4 below. Read `agent_prompt.md` for the requirements and `test.patch` to see what must pass, and use read/grep/ls/find on the rest of the repository to check for regressions, inconsistent style, and irrelevant/unexplained changes. Do not judge the description's wording or the tests' coverage.\nMandatory repo-conventions check: for every file and area touched by `solution.patch`, read the corresponding pre-existing code in the repo \u2014 same directory, sibling modules, similar components/services/hooks, and any files the patch imports from or extends. Establish how this repo actually does things (error handling and logging, naming, exports, state management, async patterns, i18n, test helpers, DI/service boundaries, comment density, defensive checks) and judge whether the solution matches those conventions. Flag clear deviations as S2/S4 issues \u2014 e.g. inventing a new logger when the repo uses a shared one, raw `console.*` where the codebase uses a structured error reporter, a different hook/service pattern than neighboring features, or new abstractions where similar code inlines the same logic. Use grep/read to find 2\u20133 closest analogues before concluding a pattern is acceptable.\nMandatory dead-code check: scan every added/changed line in `solution.patch` for unused code \u2014 variables, parameters, imports, functions/methods, or fields that are declared/assigned but never read or called anywhere (including by `test.patch`) \u2014 and for dead/unreachable code (branches, conditions, or statements that can never execute, or code left behind after a return/throw/break that makes it unreachable). Use grep to confirm a symbol truly has no other usages in the repo before flagging it. This is a rubric S4 violation and is blocking on its own, even if the rest of the solution is otherwise excellent."};function Qd(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 ef=["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."],ni=["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)."];function tf(e,t,r){let n=["You are a careful, calibrated reviewer 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 may contain: `agent_prompt.md` (the task description), `test.patch` (unified diff adding tests), and `solution.patch` (unified diff of the golden solution). Read whichever are relevant to your focus, and read the rest of the repository as needed via grep/read/ls/find to judge things against real repo context.","",hv[e.key],"","Checklist for your focus area:",t];return r&&n.push("","Fairness methodology (use this to judge whether an issue is actually blocking, and to distinguish agent-fault from prompt-ambiguity from test-flaw problems):",r),e.key==="solution"&&n.push("","Solution-specific calibration for repo standards (S2/S4):","Before returning PASS, you must have read real analogue files in the repo and compared patterns. A clear, documented mismatch with established repo conventions \u2014 wrong error/logging approach, inconsistent service or hook structure vs neighboring code, new patterns where the repo consistently uses existing ones \u2014 is blocking under S2/S4, not a minor note. Purely cosmetic nits (spacing, import order) with no pattern break belong in `notes`."),n.push("","How to set the verdict \u2014 calibrate, don't nitpick:","FAIL only for a genuine BLOCKING issue: a checklist item is clearly violated, a requirement stated in `agent_prompt.md` is untested or contradicted, a test asserts something unfair/undiscoverable per the fairness methodology above (private internals, exact class names not in the prompt, exact call order, reference-solution-only structure, etc.), a test is genuinely non-deterministic in a way that risks real CI flakiness (real network calls, unseeded randomness, race-prone ordering), or the solution has a real regression, missing requirement, or unrelated/unexplained change.","Do NOT fail for: optional coverage suggestions, 'would also be nice to test X', dead/unused code that doesn't affect correctness, minor style inconsistencies, or defensible implementation choices the prompt didn't forbid. These are exactly the kind of thing a real reviewer leaves as a 'Minor/optional' note without failing the task \u2014 put them in `notes` and still return PASS.","When genuinely torn between PASS and FAIL, default to PASS with the concern captured in `notes`, unless the issue would let a materially incorrect agent solution pass the hidden tests, or would unfairly fail a correct one \u2014 that is always blocking.","A single blocking issue is enough to FAIL, even if it affects only one test or one line out of many, and even if the rest of the suite is excellent. Do NOT average it away or let a large, otherwise-strong test suite talk you into a PASS \u2014 one unfair or undiscoverable test (e.g. requiring a private/invented API name that doesn't exist in the repo and isn't named in the prompt, especially one that conflicts with an existing, differently-named public API) is exactly as blocking as many.","",`When you are done analyzing, call the \`${yr}\` tool exactly once with your structured verdict. That tool call is your only way to report a result.`),n.join(`
|
|
12
|
+
`)}function rf(e,t){let r=[...Qd("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.",...ef,"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.","",...ni,"","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 \`${xr}\` 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 nf(e,t){let r=[...Qd("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.",...ef,"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.","",...ni,"- 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 \`${xr}\` 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(`
|
|
14
|
+
`)}function af(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.","","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 \`${mn}\` 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(`
|
|
15
|
+
`)}function of(){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(`
|
|
16
|
+
`)}function yv(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 \`${kr}/solver_${e.index}/\``}function sf(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 \`${kr}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${kr}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(yv),"","Your job: read `agent_prompt.md` and `solution.patch` carefully, then read each PASSED solver's `solution.diff` to find concrete BEHAVIORAL GAPS \u2014 cases where a solver took a materially different approach from what `agent_prompt.md` requires or `solution.patch` implements, that solver's tests still PASSED, and the difference reveals a real requirement that `test.patch` fails to actually enforce.","","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 that PASSED, read its `solution.diff` and compare it against the reference approach. Look specifically for places where the solver's code takes a shortcut, ignores a constraint, mishandles an edge case, or omits a side effect that `agent_prompt.md` calls for or `solution.patch` implements \u2014 yet the tests didn't catch it.","4. A solver that FAILED is not itself a gap \u2014 but if you can see from its `solution.diff` that it was heading toward a plausible-but-wrong implementation of some requirement, and nothing in `test.patch` would have caught that wrong implementation even if it had otherwise passed, that is still worth surfacing; use its `test_output.txt` for extra context if useful.","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.","",...ni,"- Every gap must be evidenced by an actual, cited part of a specific solver's diff \u2014 do not report a gap that is purely theoretical with no solver diff demonstrating it.","- 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 \`${pn}\` tool exactly once with your final list (which may be empty). That tool call is your only way to report a result.`),n.join(`
|
|
17
|
+
`)}var mf=900*1e3,La=["read","grep","find","ls"];function ln(e){return e==="off"?void 0:e}async function dn(e,t,r=mf){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 pf(e){let t={},r=e.model,{session:n}=await un({cwd:e.tempDir,model:r,thinkingLevel:ln(e.thinkingLevel),tools:[...La,yr],customTools:[Yd(t)],sessionManager:cn.inMemory()});try{let a=await dn(async()=>{await n.prompt(tf(e.role,e.rubric,e.fairnessRules))},e.cancelSignal);if(a==="cancelled")return await n.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer cancelled`,reasons:["Cancelled by user."],notes:[]};if(a==="timedOut")return await n.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer timed out`,reasons:[`Reviewer did not finish within ${mf/1e3}s.`],notes:[]}}catch(a){return{verdict:"FAIL",summary:`${e.role.label} reviewer errored`,reasons:[`Reviewer agent failed: ${a instanceof Error?a.message:String(a)}`],notes:[]}}return t.report?t.report:{verdict:"FAIL",summary:`${e.role.label} reviewer did not submit a report`,reasons:[`The reviewer agent finished without calling ${yr}.`],notes:[]}}async function ai(e){let t={},r=e.kind==="positive"?rf:nf,n=e.model,{session:a}=await un({cwd:e.tempDir,model:n,thinkingLevel:ln(e.thinkingLevel),tools:[...La,xr],customTools:[Jd(t)],sessionManager:cn.inMemory()});try{let s=await dn(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 xv=["read","grep","find","ls","write","edit","bash"];async function uf(e){let t=e.model;try{let r=cn.inMemory(),{session:n}=await un({cwd:e.solverDir,model:t,thinkingLevel:ln(e.thinkingLevel),tools:[...xv],sessionManager:r}),a=await dn(async()=>{await n.prompt(of())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await n.abort(),{outcome:a,trajectory:r.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function cf(e){let t={},r=e.model,{session:n}=await un({cwd:e.tempDir,model:r,thinkingLevel:ln(e.thinkingLevel),tools:[...La,pn],customTools:[Zd(t)],sessionManager:cn.inMemory()});try{let a=await dn(async()=>{await n.prompt(sf(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 lf(e){let t={},r=e.model,{session:n}=await un({cwd:e.tempDir,model:r,thinkingLevel:ln(e.thinkingLevel),tools:[...La,mn],customTools:[Xd(t)],sessionManager:cn.inMemory()});try{let a=await dn(async()=>{await n.prompt(af(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 he="checks_progress";function Ee(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 Iv,readFileSync as bv}from"node:fs";var ut=[{key:"description",label:"Description",rubricHeading:/^## The problem description/i},{key:"tests",label:"Tests",rubricHeading:/^## The tests/i},{key:"solution",label:"Solution",rubricHeading:/^## The solution/i}];var oi=["agent_prompt.md","solution.patch","test.patch"];function ii(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 df(e){try{if(!Iv(e))return{};let t=JSON.parse(bv(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function ff(e){let{existingReport:t,config:r,runReviewers:n,byRole:a,runGapStages:s,testGaps:m,gapAnalysisIncomplete:c,positiveGapFinderStatus:l,negativeGapFinderStatus:d,gapFilterStatus:g,runSolverGapFinder:b,solverResults:V,solverGaps:G,solverGapAnalysisIncomplete:w,solverComparisonStatus:Ce}=e,L={...t,timestamp:ii(),model:`${r.provider}/${r.modelId}`,thinkingLevel:r.thinkingLevel};if(n){let re={...t.reports&&typeof t.reports=="object"?t.reports:{},...a};L.reports=re,ut.every(Me=>re[Me.key])?L.overall=ut.every(Me=>re[Me.key].verdict==="PASS")?"PASS":"FAIL":delete L.overall}return s&&(L.testGaps=m,c?L.testGapAnalysisNote=`Gap analysis did not fully complete (positive finder: ${l}, negative finder: ${d}, filter: ${g}); testGaps may be incomplete.`:delete L.testGapAnalysisNote),b&&(L.solverRunSummary=V.map(le=>({index:le.index,status:le.status,passed:le.passed,durationMs:le.durationMs,artifactsDir:le.artifactsDir})),L.solverGaps=G,w?L.solverGapAnalysisNote=`Solver-gap analysis did not fully complete (comparison reviewer: ${Ce}); solverGaps may be incomplete.`:delete L.solverGapAnalysisNote),L}function gf(e){let t=Math.round(e/1e3),r=Math.floor(t/60),n=t%60;return r>0?`${r}m ${n}s`:`${n}s`}function hf(e){let{merged:t,runReviewers:r,activeRoles:n,byRole:a,runGapStages:s,runSolverGapFinder:m}=e,c=Array.isArray(t.testGaps)?t.testGaps.length:0,l=r?Object.fromEntries(n.filter(w=>a[w.key]).map(w=>[w.key,a[w.key].verdict])):void 0,d=r&&typeof t.overall=="string"?t.overall:void 0,g=[];if(l&&g.push(n.map(w=>`${w.label}: ${l[w.key]??"?"}`).join(", ")),d){let w=d==="PASS"&&c>0?" (with test gaps)":"";g.push(`Overall: ${d}${w}`)}s&&g.push(c>0?`${c} test gap(s) found`:"no test gaps found");let b=m?(Array.isArray(t.solverRunSummary)?t.solverRunSummary:[]).map(w=>({index:w.index,status:w.status,passed:w.passed,durationMs:w.durationMs??0})):[],V=b.filter(w=>w.passed).length,G=Array.isArray(t.solverGaps)?t.solverGaps.length:0;return m&&g.push(`${V}/${b.length} solvers passed, ${G} gap(s) found`),{content:`Checks: ${g.join(" | ")}`,details:{overall:d,hasTestGaps:c>0,gapsCount:c,roleVerdicts:l,showGaps:s,showSolverGaps:m,solverDetails:b,solverGapsCount:G}}}var yf=`## The problem description (aka the task)\r
|
|
18
18
|
P1: Aligns with the repo's philosophy\r
|
|
19
19
|
P2: Self-contained \u2014 solvable from the repo and description alone\r
|
|
20
20
|
P3: Clear, concise, and unambiguous \u2014 describes what to build or fix and don't leave points for guessing\r
|
|
@@ -41,7 +41,7 @@ That's the golden solution \u2014 the proof that your task is solvable and that
|
|
|
41
41
|
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
|
|
42
42
|
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
|
|
43
43
|
S3: No irrelevant changes to the code \u2014 if something is unrelated to your task, keep it as it is.\r
|
|
44
|
-
S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,
|
|
44
|
+
S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,vv=`# Agent Evaluation Guidelines\r
|
|
45
45
|
\r
|
|
46
46
|
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
|
|
47
47
|
\r
|
|
@@ -321,5 +321,5 @@ Keep changes separated when possible:\r
|
|
|
321
321
|
- Avoid unrelated dependency or lockfile changes.\r
|
|
322
322
|
- Regenerate patches after every prompt/test/solution change.\r
|
|
323
323
|
\r
|
|
324
|
-
---`;function
|
|
325
|
-
`),"info");return}let a=[...new Set(
|
|
324
|
+
---`;function xf(){let e=yf.split(/\r?\n(?=## )/g),t={};for(let r of ut){let n=e.find(a=>r.rubricHeading.test(a.trim()));t[r.key]=(n??yf).trim()}return t}function If(){return vv.trim()}var qa=!1,Ir;function ja(){return qa}function bf(){return qa=!0,Ir=new AbortController,Ir}function vf(){qa=!1,Ir=void 0}function $f(){return!qa||!Ir||Ir.signal.aborted?!1:(Ir.abort(),!0)}var Sv="Ctrl+Shift+X",si=[{value:"--all",label:"--all",description:"Run everything: 3 focus reviewers + test-gap finder/filter"},{value:"--review",label:"--review",description:"Run only the 3 focus reviewer agents (description/tests/solution)"},{value:"--description",label:"--description",description:"Run only the problem-description (prompt) focus reviewer"},{value:"--tests",label:"--tests",description:"Run only the tests focus reviewer"},{value:"--solution",label:"--solution",description:"Run only the solution focus reviewer"},{value:"--gap-finder",label:"--gap-finder",description:"Run only the 3-agent test-gap flow: positive finder + negative finder (parallel), then validator"},{value:"--solver-gap-finder",label:"--solver-gap-finder",description:"Run several solver agents TDD-style against agent_prompt.md + test.patch (no solution.patch), then compare their solutions to find gaps"},{value:"--config",label:"--config",description:"Open the settings menu: reviewer model/thinking level + solver-gap-finder settings"}];function Ov(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(g=>g!=="--config"),d=si.filter(g=>s.has(g.value)||c||l&&g.value==="--config"?!1:g.value.startsWith(a));return d.length>0?d.map(g=>({...g,value:`${m}${g.value}`})):null}async function Sf(e,t,r){let n=Ii();if(n.length===0)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let a=e.modelRegistry.getAll(),s=n.map(d=>{let g=bi(d);if(!g)return null;let b=a.find(w=>w.provider===g.provider&&w.id===g.modelId),V=t?.provider===g.provider&&t?.modelId===g.modelId,G=b?`${b.name} (${d})`:d;return{ref:d,parsed:g,display:V?`${G} [current]`:G,isCurrent:V}}).filter(d=>d!==null);if(s.length===0)return e.ui.notify("Could not resolve any enabledModels entries.","error"),null;let m=[...s].sort((d,g)=>d.isCurrent===g.isCurrent?0:d.isCurrent?-1:1),c=await e.ui.select(r,m.map(d=>d.display));if(!c)return null;let l=s.find(d=>d.display===c);return l?{provider:l.parsed.provider,modelId:l.parsed.modelId}:null}function Da(e,t,r){let n=e.modelRegistry.getAll().find(a=>a.provider===t&&a.id===r);return yi(n)}var Fa={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:za,solverCount:vn,saveArtifacts:Ba};function Of(e,t,r){let n=t?Da(e,t.provider,t.modelId):["off"],a=r.provider?Da(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 Gap Finder",label:"Model",value:r.provider?`${r.provider}/${r.modelId}`:"not set",kind:"model"},{id:"solvergap-thinking",section:"Solver Gap Finder",label:"Thinking level",value:r.thinkingLevel,kind:"cycle",values:a},{id:"solvergap-timeout",section:"Solver Gap Finder",label:"Timeout",value:`${r.timeoutMinutes} min`,kind:"cycle",values:[10,20,30,40,50,gi].filter((s,m,c)=>s>=fi&&c.indexOf(s)===m).map(s=>`${s} min`)},{id:"solvergap-solver-count",section:"Solver Gap Finder",label:"Parallel agents",value:String(r.solverCount),kind:"cycle",values:Array.from({length:hi-Va+1},(s,m)=>`${Va+m}`)},{id:"solvergap-save-artifacts",section:"Solver Gap Finder",label:"Save artifacts",value:r.saveArtifacts?"on":"off",kind:"cycle",values:["on","off"]}]}var mi=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=Of(t,dt(),dt()?.solverGap??Fa)}selectedIndex=0;rows;refresh(){let t=dt();this.rows=Of(this.ctx,t,t?.solverGap??Fa),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:" ",d=m.label+" ".repeat(Math.max(0,n-m.label.length)),g=this.settingsListTheme.label(d,c),b=this.settingsListTheme.value(m.value,c);r.push(`${l}${g} ${b}`)}return r}handleInput(t){if(Vt(t,zt.ctrl("s"))||Vt(t,zt.escape)||Vt(t,zt.ctrl("c"))){this.onExit();return}if(Vt(t,zt.up)){this.selectedIndex=this.selectedIndex===0?this.rows.length-1:this.selectedIndex-1;return}if(Vt(t,zt.down)){this.selectedIndex=this.selectedIndex===this.rows.length-1?0:this.selectedIndex+1;return}if(Vt(t,zt.enter)||Vt(t,zt.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=dt();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??Fa,s=r.values.indexOf(r.value),m=r.values[(s+1)%r.values.length];if(m===void 0)return;r.id==="reviewer-thinking"?ft({...n,thinkingLevel:m,solverGap:a}):r.id==="solvergap-thinking"?ft({...n,solverGap:{...a,thinkingLevel:m}}):r.id==="solvergap-timeout"?ft({...n,solverGap:{...a,timeoutMinutes:Number.parseInt(m,10)}}):r.id==="solvergap-solver-count"?ft({...n,solverGap:{...a,solverCount:Number.parseInt(m,10)}}):r.id==="solvergap-save-artifacts"&&ft({...n,solverGap:{...a,saveArtifacts:m==="on"}}),this.refresh(),this.onCycleSaved()}}};async function Pv(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 d=new mi(e,wv(),m,()=>s.requestRender(),b=>l(b),()=>l(void 0));d.selectedIndex=t;let g=new Ev;return g.addChild(new Rf(m.bold(m.fg("accent","Checks settings")))),g.addChild({render:b=>d.render(b),invalidate:()=>d.invalidate()}),g.addChild(new Rv(1)),g.addChild(new Rf(m.fg("dim","\u2191\u2193 navigate enter select ctrl+s save & exit esc cancel"))),{render(b){return g.render(b)},invalidate(){g.invalidate()},handleInput(b){d.handleInput(b),t=d.selectedIndex,s.requestRender()}}});if(!r)return;let n=dt(),a=n?.solverGap??Fa;if(r==="reviewer-model"){let s=await Sf(e,n,"Select model for checks reviewer agents");if(!s)continue;let m=Da(e,s.provider,s.modelId),c=m.includes(n?.thinkingLevel??"off")?n?.thinkingLevel??"off":m[0]??"off";ft({...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 Sf(e,a.provider?a:null,"Select model for solver-gap-finder's solver agents");if(!s)continue;let m=Da(e,s.provider,s.modelId),c=m.includes(a.thinkingLevel)?a.thinkingLevel:m[0]??"off";ft({...n,solverGap:{...a,...s,thinkingLevel:c}}),e.ui.notify(`Solver-gap-finder model saved: ${s.provider}/${s.modelId}`,"info")}}}function Pf(e){e.registerCommand("checks",{description:"Strict review of agent_prompt.md/test.patch/solution.patch. Requires an option \u2014 see /checks.",getArgumentCompletions:Ov,handler:async(t,r)=>{let n=t.trim();if(n===""){r.ui.notify(si.map(F=>`${F.value} \u2014 ${F.description}`).join(`
|
|
325
|
+
`),"info");return}let a=[...new Set(n.split(/\s+/).filter(Boolean))],s=new Set(si.map(F=>F.value)),m=a.filter(F=>!s.has(F));if(m.length>0){r.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see the available options.`,"warning");return}if(a.includes("--config")){if(a.length>1){r.ui.notify("--config cannot be combined with other options.","warning");return}await Pv(r);return}let c=new Set;if(a.includes("--all")||a.includes("--review"))for(let F of ut)c.add(F.key);for(let F of ut)a.includes(`--${F.key}`)&&c.add(F.key);let l=a.includes("--all")||a.includes("--gap-finder"),d=a.includes("--solver-gap-finder"),g=ut.filter(F=>c.has(F.key)),b=g.length>0;if(!b&&!l&&!d){r.ui.notify(`Nothing to run for: ${a.join(" ")}. Run /checks with no arguments to see the available options.`,"warning");return}let V=a.join(" ");if(ja()){r.ui.notify("A checks run is already in progress.","warning");return}let G=dt();if(!G){r.ui.notify("No reviewer model configured. Run /checks --config first.","error");return}let w=r.modelRegistry.find(G.provider,G.modelId);if(!w){r.ui.notify(`Configured model ${G.provider}/${G.modelId} not found. Run /checks --config again.`,"error");return}if(!r.modelRegistry.hasConfiguredAuth(w)){r.ui.notify(`No auth configured for ${G.provider}/${G.modelId}.`,"error");return}let Ce=oi.filter(F=>!kf(ct(r.cwd,F)));if(Ce.length>0){r.ui.notify(`Missing required file(s) in project root: ${Ce.join(", ")}`,"error");return}let L=null,le;if(d){if(L=xi(),!L){r.ui.notify("No solver-gap-finder model configured. Run /checks --config and set it up.","error");return}if(le=r.modelRegistry.find(L.provider,L.modelId),!le){r.ui.notify(`Configured solver-gap-finder model ${L.provider}/${L.modelId} not found. Run /checks --config again.`,"error");return}if(!r.modelRegistry.hasConfiguredAuth(le)){r.ui.notify(`No auth configured for ${L.provider}/${L.modelId}.`,"error");return}if(!kf(ct(r.cwd,"test.sh"))){r.ui.notify("Missing required file in project root for --solver-gap-finder: test.sh","error");return}}let re=bf(),Me=L?.solverCount??vn,oe=(b?g.length:0)+(l?3:0)+(d?Me+1:0);r.ui.setWidget(he,Ee("preparing clean snapshot",0,oe)),r.ui.notify(`checks (${V}) started. Press ${Sv} to cancel.`,"info");let rt,lt=[];try{let F=ct(Ef(),`checks-${Tf()}`);wf(F,{recursive:!0}),rt=F;let fn=await wn(e,r.cwd,F);if(fn.status==="error"){r.ui.notify(`checks: ${fn.error}`,"error");return}for(let Re of oi)$v(ct(r.cwd,Re),ct(F,Re));let Bt=xf(),Wt=If(),pe=0,Ga=[];if(b&&(r.ui.setWidget(he,Ee("reviewing",pe,oe)),Ga=await Promise.all(g.map(Re=>pf({pi:e,role:Re,tempDir:F,model:w,thinkingLevel:G.thinkingLevel,rubric:Bt[Re.key],fairnessRules:Wt,cancelSignal:re.signal}).then(nt=>(pe+=1,r.ui.setWidget(he,Ee("reviewing",pe,oe)),nt)))),re.signal.aborted)){r.ui.notify("checks: cancelled.","warning");return}let br={status:"ok",gaps:[]},vr={status:"ok",gaps:[]},gn={status:"ok",gaps:[]};if(l){let Re={tempDir:F,model:w,thinkingLevel:G.thinkingLevel,testRubric:Bt.tests,fairnessRules:Wt,cancelSignal:re.signal};if(r.ui.setWidget(he,Ee("finding test gaps",pe,oe)),[br,vr]=await Promise.all([ai({...Re,kind:"positive"}).then($r=>(pe+=1,r.ui.setWidget(he,Ee("finding test gaps",pe,oe)),$r)),ai({...Re,kind:"negative"}).then($r=>(pe+=1,r.ui.setWidget(he,Ee("finding test gaps",pe,oe)),$r))]),re.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}let nt=[...br.gaps,...vr.gaps];if(nt.length>0&&(r.ui.setWidget(he,Ee("validating test gaps",pe,oe)),gn=await lf({tempDir:F,model:w,thinkingLevel:G.thinkingLevel,testRubric:Bt.tests,fairnessRules:Wt,candidates:nt,cancelSignal:re.signal})),pe+=1,r.ui.setWidget(he,Ee("validating test gaps",pe,oe)),re.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}}let Ht=[],hn={status:"ok",gaps:[]};if(d&&L){r.ui.setWidget(he,Ee("solver-gap-finder: solving",pe,oe));let Re=ct(r.cwd,"test.patch"),nt=ct(r.cwd,"agent_prompt.md"),$r=await Promise.all(Array.from({length:Me},async(Rt,St)=>{let Tr=ct(Ef(),`checks-solvergap-${Tf()}`);wf(Tr,{recursive:!0}),lt.push(Tr);let yn=await $i({pi:e,repoDir:r.cwd,solverDir:Tr,testPatchPath:Re,agentPromptPath:nt});return{index:St+1,setup:yn}})),Ff=ii().replace(/[:.]/g,"-");if(Ht=await Promise.all($r.map(async({index:Rt,setup:St})=>{if(St.status!=="ok")return pe+=1,r.ui.setWidget(he,Ee("solver-gap-finder: solving",pe,oe)),{index:Rt,status:St.status,passed:!1,diff:"",testOutputTail:St.error,durationMs:0};let Tr=Date.now(),{outcome:yn,trajectory:Df}=await uf({pi:e,solverDir:St.solverDir,model:le,thinkingLevel:L.thinkingLevel,timeoutMinutes:L.timeoutMinutes,cancelSignal:re.signal}),{testOutputXmlPath:Gf,...Ka}=await Ti({pi:e,index:Rt,workspace:St,status:yn==="done"?"ok":yn,durationMs:Date.now()-Tr}),Nf=L.saveArtifacts?ki({repoDir:r.cwd,runId:Ff,index:Rt,trajectory:Df,solutionPatch:Ka.diff,testOutputXmlPath:Gf,testOutputTail:Ka.testOutputTail}):void 0;return pe+=1,r.ui.setWidget(he,Ee("solver-gap-finder: solving",pe,oe)),{...Ka,artifactsDir:Nf}})),re.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}if(Ht.some(Rt=>Rt.status!=="patchFailed"&&Rt.status!=="error")?(r.ui.setWidget(he,Ee("solver-gap-finder: comparing solutions",pe,oe)),wi(F,Ht),hn=await cf({tempDir:F,model:w,thinkingLevel:G.thinkingLevel,solverResults:Ht,testRubric:Bt.tests,fairnessRules:Wt,cancelSignal:re.signal})):r.ui.notify("checks: all solver-gap-finder solvers failed to set up; skipping comparison.","warning"),pe+=1,r.ui.setWidget(he,Ee("solver-gap-finder: comparing solutions",pe,oe)),re.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}}r.ui.setWidget(he,Ee("finalizing report",oe,oe));let Na={};g.forEach((Re,nt)=>{Ga[nt]&&(Na[Re.key]=Ga[nt])});let Mf=gn.gaps,Af=br.gaps.length>0||vr.gaps.length>0,Lf=l&&(br.status!=="ok"||vr.status!=="ok"||Af&&gn.status!=="ok"),Ua=ct(r.cwd,"shipd_report.json"),qf=df(Ua),jf=d&&(Ht.some(Re=>Re.status==="error")||hn.status!=="ok"),ui=ff({existingReport:qf,config:G,runReviewers:b,byRole:Na,runGapStages:l,testGaps:Mf,gapAnalysisIncomplete:Lf,positiveGapFinderStatus:br.status,negativeGapFinderStatus:vr.status,gapFilterStatus:gn.status,runSolverGapFinder:d,solverResults:Ht,solverGaps:hn.gaps,solverGapAnalysisIncomplete:jf,solverComparisonStatus:hn.status}),ci=hf({merged:ui,runReviewers:b,activeRoles:g,byRole:Na,runGapStages:l,runSolverGapFinder:d});e.sendMessage({customType:"shipd_checks_report",content:ci.content,display:!0,details:ci.details}),kv(Ua,JSON.stringify(ui,null,2),"utf-8"),r.ui.notify(`checks: wrote details to ${Ua}`,"info")}catch(F){r.ui.notify(`checks failed: ${F instanceof Error?F.message:String(F)}`,"error")}finally{if(r.ui.setWidget(he,void 0),rt)try{Tv(rt,{recursive:!0,force:!0})}catch{}for(let F of lt)Ei(F);vf()}}})}var Cf=Mv.ctrlShift("x");function Lv(e){e.registerMessageRenderer("shipd_checks_report",(t,r,n)=>{let a=t.details??{},s=d=>d==="PASS"?n.fg("success",d):n.fg("error",d),m=new Cv;m.addChild(new pi(n.bold(n.fg("accent","Checks")),0,0));let c=!1,l=d=>{m.addChild(new pi(d,0,0)),c=!0};if(a.roleVerdicts&&Object.keys(a.roleVerdicts).length>0){for(let[d,g]of Object.entries(a.roleVerdicts)){let b=g==="PASS"?n.fg("success","\u2713"):n.fg("error","\u2717");l(` ${b} ${n.bold(d)}: ${s(g)}`)}if(a.overall){let d=a.overall==="PASS"&&a.hasTestGaps?" (with test gaps)":"";l(` ${n.bold("Overall:")} ${s(a.overall)}${d}`)}}if(a.showGaps){let d=a.gapsCount??0;l(d>0?n.fg("warning",` \u26A0 ${d} test gap(s) found`):n.fg("success"," \u2713 no test gaps found"))}if(a.showSolverGaps){let d=a.solverDetails??[],g=d.filter(w=>w.passed).length,b=a.solverGapsCount??0;m.addChild(new Av(1)),l(n.bold(n.fg("accent","Solver gap finder")));for(let w of d){let Ce=w.passed?n.fg("success","\u2713"):n.fg("error","\u2717"),L=w.passed?"passed":w.status==="ok"?"failed tests":w.status;l(` ${Ce} Solver ${w.index}: ${L} (${gf(w.durationMs)})`)}let V=g===d.length&&d.length>0?n.fg("success",`${g}/${d.length} solvers passed`):n.fg("warning",`${g}/${d.length} solvers passed`),G=b>0?n.fg("warning",`${b} behavioral gap(s) found`):n.fg("success","no behavioral gaps found");l(` ${V}, ${G}`)}return c||m.addChild(new pi(n.fg("dim"," nothing to report"),0,0)),m}),e.registerShortcut(Cf,{description:"Cancel an in-progress /checks run",handler:t=>{ja()&&$f()&&(t.ui.setWidget(he,[`checks: cancelling (${Cf})...`]),t.ui.notify("checks: cancelling...","warning"))}}),Pf(e)}export{Lv as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sreetej510/pi-shipd-checks",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
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",
|