@sreetej510/pi-shipd-checks 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +44 -10
  2. package/dist/index.js +17 -11
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -22,15 +22,38 @@ For the flags you pass, `/checks`:
22
22
  run in parallel (positive required-behavior gaps + negative forbidden-behavior gaps),
23
23
  then a strict validator filters the combined list. This never turns a `PASS` into a
24
24
  `FAIL` — it's purely informational.
25
- 5. Posts a one-line chat summary and merges the results into `shipd_report.json` in your
26
- project root. Running flags separately, in any order, builds up one combined report instead
27
- of overwriting it — `overall` only becomes a confident `PASS`/`FAIL` once all 3 focus
28
- reviewers have run at least once.
25
+ 5. Optionally runs the solver gap finder: several (configurable, default 3) TDD-style solver
26
+ agents, each in its own throwaway git repo with `test.patch` and `agent_prompt.md` applied
27
+ (never `solution.patch`), given write/edit/bash access to iterate until `./test.sh new`
28
+ passes or they give up. The extension independently re-verifies each
29
+ solver's result and captures its diff (excluding any files `test.patch` touched, and
30
+ including any new, previously-uncommitted files the solver created), writes each
31
+ solver's diff + test output to `solver_gap_solutions/solver_<n>/` inside the shared
32
+ snapshot dir (plus a `manifest.json` summary) — rather than embedding them directly in
33
+ a prompt — so a read-only comparison reviewer can read only what it needs via its
34
+ normal read/grep/find/ls tools, keeping its context usage independent of solver count
35
+ and diff size. That reviewer compares the solvers' diffs against the real
36
+ `agent_prompt.md`/`solution.patch` to surface behavioral gaps — cases where a passing
37
+ solver's approach diverges from the intended behavior, indicating a test that's
38
+ under-specified. This is empirical (grounded in real agent attempts) rather than
39
+ analytical, so it's reported separately from the `--gap-finder` results and is never
40
+ included in `--all` since it's by far the most expensive stage. Each solver's full
41
+ `trajectory.json` (its raw session entries), `solution.patch`, and `./test.sh new` output
42
+ are also persisted to `.pi/shipd-checks/<run-id>/solver_<n>/` in your project root, for
43
+ later inspection independent of `shipd_report.json`.
44
+ 6. Posts a chat summary (only for the stage(s) actually run this invocation — a `--tests`-only
45
+ run won't show a stale `Overall` verdict from a previous, unrelated run) and merges the
46
+ results into `shipd_report.json` in your project root. Running flags separately, in any
47
+ order, builds up one combined report instead of overwriting it — `overall` only becomes a
48
+ confident `PASS`/`FAIL` once all 3 focus reviewers have run at least once, in the same
49
+ invocation.
29
50
 
30
51
  ## Commands
31
52
 
32
53
  All flags except `--config` are additive/combinable, e.g. `/checks --tests --gap-finder` runs
33
54
  just the tests reviewer plus the gap-finder/filter stages. `--config` must be used alone.
55
+ `--solver-gap-finder` is additive like the other stage flags, but deliberately **not** included
56
+ in `--all` since it's the most expensive stage (several full coding-agent runs with shell access).
34
57
 
35
58
  | Command | Effect |
36
59
  |---|---|
@@ -41,16 +64,26 @@ just the tests reviewer plus the gap-finder/filter stages. `--config` must be us
41
64
  | `/checks --tests` | Run only the tests reviewer |
42
65
  | `/checks --solution` | Run only the solution reviewer |
43
66
  | `/checks --gap-finder` | Run positive + negative gap finders (parallel), then validator |
44
- | `/checks --config` | Set the reviewer model and thinking level |
67
+ | `/checks --solver-gap-finder` | Run several solver agents TDD-style against `agent_prompt.md` + `test.patch`, then compare their solutions to the real solution to find gaps |
68
+ | `/checks --config` | Open the settings menu (reviewer + solver-gap-finder settings) |
45
69
 
46
70
  **Shortcut:** `Ctrl+Shift+X` cancels an in-progress `/checks` run.
47
71
 
48
72
  ## Configuration
49
73
 
50
- `/checks --config` lets you pick a model from your `enabledModels` list in `settings.json`,
51
- then (if the model supports more than one) a thinking level. The currently configured
52
- model/level is highlighted `[current]` in the picker. Settings are saved globally to
53
- `~/.pi/agent/checks-config.json` and shared by all reviewer, gap-finder, and validator agents.
74
+ `/checks --config` opens a single row-based settings menu with two section headers:
75
+
76
+ - **Reviewer**: model and thinking level used by the focus reviewers, gap-finders, gap-validator,
77
+ and the solver-gap-finder's comparison reviewer.
78
+ - **Solver Gap Finder**: model, thinking level, per-agent timeout in minutes (default 30, clamped to
79
+ 1–120), and number of parallel solver agents (default 3, clamped to 1–10) — used only by the
80
+ TDD-style solver agents spawned by `--solver-gap-finder`. These write code and run shell commands
81
+ (a heavier job than the read-only reviewers), so you may want a stronger coding model here.
82
+
83
+ Use ↑/↓ to move between rows, Enter/Space to open a model picker or cycle a value in place, and
84
+ `Ctrl+S` to save and exit (Esc cancels without discarding already-saved changes). Everything is
85
+ saved immediately to `~/.pi/agent/checks-config.json`, with the solver-gap-finder settings nested
86
+ under a `solverGap` key.
54
87
 
55
88
  ## Install
56
89
 
@@ -80,7 +113,8 @@ Or, for local development, point at the entry point directly:
80
113
  |---|---|
81
114
  | `src/index.ts` | Extension entry point: message renderer, cancel shortcut, command registration |
82
115
  | `src/command.ts` | The `/checks` command: argument parsing, `--config` flow, run orchestration |
83
- | `src/agents.ts` | Spawns and races the reviewer + gap-finder/validator agent sessions |
116
+ | `src/agents.ts` | Spawns and races the reviewer + gap-finder/validator/solver agent sessions |
117
+ | `src/solvergap.ts` | Solver-gap-finder workspace lifecycle: setup, verification, artifact persistence, cleanup |
84
118
  | `src/prompts.ts` | All prompt text sent to those agents |
85
119
  | `src/tools.ts` | Custom tools the agents call to submit their structured results |
86
120
  | `src/rubric.ts` | Embedded guidelines/fairness rubric text + per-role section loaders |
package/dist/index.js CHANGED
@@ -1,14 +1,20 @@
1
- var Ad=Object.defineProperty;var yt=(e,t)=>{for(var n in t)Ad(e,n,{get:t[n],enumerable:!0})};import{Key as xb,Text as yb}from"@earendil-works/pi-tui";import{randomUUID as sb}from"node:crypto";import{copyFileSync as mb,existsSync as pb,mkdirSync as ub,rmSync as cb,writeFileSync as lb}from"node:fs";import{tmpdir as db}from"node:os";import{join as Wn}from"node:path";import{createAgentSession as xo,SessionManager as yo}from"@earendil-works/pi-coding-agent";var p={};yt(p,{Assign:()=>qd,Clone:()=>dn,Create:()=>Uf,Discard:()=>Gf,Metrics:()=>qe,Update:()=>_f});var qe={assign:0,create:0,clone:0,discard:0,update:0};function qd(e,t){return qe.assign+=1,{...e,...t}}var i={};yt(i,{Entries:()=>tf,EntriesRegExp:()=>ef,Every:()=>Zd,EveryAll:()=>Xd,GraphemeCount:()=>Hd,HasPropertyKey:()=>Qd,IsArray:()=>cn,IsBigInt:()=>un,IsBoolean:()=>Fo,IsClassInstance:()=>Vd,IsConstructor:()=>Kd,IsDeepEqual:()=>fa,IsEqual:()=>M,IsFunction:()=>Do,IsGreaterEqualThan:()=>Ko,IsGreaterThan:()=>_d,IsInteger:()=>la,IsLessEqualThan:()=>No,IsLessThan:()=>zd,IsMaxLength:()=>Yd,IsMinLength:()=>Jd,IsMultipleOf:()=>Bd,IsNull:()=>Zn,IsNumber:()=>Xn,IsObject:()=>ln,IsObjectNotArray:()=>Ud,IsString:()=>Qn,IsSymbol:()=>Gd,IsUndefined:()=>da,IsUnsafePropertyKey:()=>Uo,IsValueLike:()=>Wd,Keys:()=>Jn,ShiftLeft:()=>er,Symbols:()=>nf,Values:()=>rf});function It(e,t,n){return e>=t&&e<=n}function Ld(e){return e===8205}function jd(e){return It(e,55296,56319)}function Po(e){return It(e,127462,127487)}function Mo(e){return It(e,65024,65039)}function Co(e){return It(e,768,879)||It(e,6832,6911)||It(e,7616,7679)||It(e,65056,65071)}function Yn(e){return e>65535?2:1}function So(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Co(n)||Mo(n))t+=Yn(n);else break}return t}function ca(e,t){let n=e.codePointAt(t),r=t+Yn(n);for(r=So(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+Yn(a),r=So(e,r)}return Po(n)&&r<e.length&&Po(e.codePointAt(r))&&(r+=Yn(e.codePointAt(r))),r}function Ao(e){return jd(e)||Co(e)||Mo(e)||Ld(e)}function qo(e){let t=0,n=0;for(;n<e.length;)n=ca(e,n),t++;return t}function Fd(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=ca(e,r),n++,n>=t)return!0;return!1}function Dd(e,t){let n=0,r=0;for(;r<e.length;)if(r=ca(e,r),n++,n>t)return!1;return!0}function Lo(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Ao(e.charCodeAt(n)))return Fd(e,t);if(n++,n>=t)return!0}return!1}function jo(e,t){let n=0;for(;n<e.length;){if(Ao(e.charCodeAt(n)))return Dd(e,t);if(n++,n>t)return!1}return!0}function cn(e){return Array.isArray(e)}function un(e){return M(typeof e,"bigint")}function Fo(e){return M(typeof e,"boolean")}function Kd(e){if(da(e)||!Do(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Do(e){return M(typeof e,"function")}function la(e){return Number.isInteger(e)}function Zn(e){return M(e,null)}function Xn(e){return Number.isFinite(e)}function Ud(e){return ln(e)&&!cn(e)}function ln(e){return M(typeof e,"object")&&!Zn(e)}function Qn(e){return M(typeof e,"string")}function Gd(e){return M(typeof e,"symbol")}function da(e){return M(e,void 0)}function M(e,t){return e===t}function _d(e,t){return e>t}function zd(e,t){return e<t}function No(e,t){return e<=t}function Ko(e,t){return e>=t}function Bd(e,t){if(un(e)||un(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!Xn(e)||la(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 Vd(e){if(!ln(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Zn(t)?!1:M(typeof t.constructor,"function")&&!(M(t.constructor,globalThis.Object)||M(t.constructor.name,"Object"))}function Wd(e){return un(e)||Fo(e)||Zn(e)||Xn(e)||Qn(e)||da(e)}function Hd(e){return qo(e)}function Yd(e,t){return jo(e,t)}function Jd(e,t){return Lo(e,t)}function Zd(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Xd(e,t,n){let r=!0;for(let a=t;a<e.length;a++)n(e[a],a)||(r=!1);return r}function er(e,t,n){return M(e.length,0)?n():t(e[0],e.slice(1))}function Uo(e){return M(e,"__proto__")||M(e,"constructor")||M(e,"prototype")}function Qd(e,t){return Uo(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ef(e){return Jn(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function tf(e){return Object.entries(e)}function Jn(e){return Object.getOwnPropertyNames(e)}function nf(e){return Object.getOwnPropertySymbols(e)}function rf(e){return Object.values(e)}function af(e,t){if(!ln(t))return!1;let n=Jn(e);return M(n.length,Jn(t).length)&&n.every(r=>fa(e[r],t[r]))}function of(e,t){return cn(t)&&M(e.length,t.length)&&e.every((n,r)=>fa(e[r],t[r]))}function fa(e,t){return cn(e)?of(e,t):ln(e)?af(e,t):M(e,t)}var rt={};yt(rt,{IsBigInt64Array:()=>$f,IsBigUint64Array:()=>vf,IsBoolean:()=>mf,IsDate:()=>kf,IsFloat32Array:()=>If,IsFloat64Array:()=>bf,IsInt16Array:()=>gf,IsInt32Array:()=>xf,IsInt8Array:()=>lf,IsMap:()=>wf,IsNumber:()=>pf,IsRegExp:()=>Tf,IsSet:()=>Ef,IsString:()=>uf,IsTypeArray:()=>cf,IsUint16Array:()=>hf,IsUint32Array:()=>yf,IsUint8Array:()=>df,IsUint8ClampedArray:()=>ff});function mf(e){return e instanceof Boolean}function pf(e){return e instanceof Number}function uf(e){return e instanceof String}function cf(e){return globalThis.ArrayBuffer.isView(e)}function lf(e){return e instanceof globalThis.Int8Array}function df(e){return e instanceof globalThis.Uint8Array}function ff(e){return e instanceof globalThis.Uint8ClampedArray}function gf(e){return e instanceof globalThis.Int16Array}function hf(e){return e instanceof globalThis.Uint16Array}function xf(e){return e instanceof globalThis.Int32Array}function yf(e){return e instanceof globalThis.Uint32Array}function If(e){return e instanceof globalThis.Float32Array}function bf(e){return e instanceof globalThis.Float64Array}function $f(e){return e instanceof globalThis.BigInt64Array}function vf(e){return e instanceof globalThis.BigUint64Array}function Tf(e){return e instanceof globalThis.RegExp}function kf(e){return e instanceof globalThis.Date}function Ef(e){return e instanceof globalThis.Set}function wf(e){return e instanceof globalThis.Map}function Of(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function Pf(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:bt(a.value)})}return t}function Sf(e){let t={};for(let n of i.Keys(e))i.IsUnsafePropertyKey(n)||(t[n]=bt(e[n]));for(let n of i.Symbols(e))t[n]=bt(e[n]);return t}function Mf(e){return i.IsClassInstance(e)?e:Of(e)?Pf(e):Sf(e)}function Cf(e){return e.map(t=>bt(t))}function Af(e){return e.slice()}function qf(e){return new RegExp(e.source,e.flags)}function Lf(e){return new Map(bt([...e.entries()]))}function jf(e){return new Set(bt([...e.values()]))}function bt(e){return rt.IsTypeArray(e)?Af(e):rt.IsRegExp(e)?qf(e):rt.IsMap(e)?Lf(e):rt.IsSet(e)?jf(e):i.IsArray(e)?Cf(e):i.IsObject(e)?Mf(e):e}function dn(e){return qe.clone+=1,bt(e)}var $t={};yt($t,{Get:()=>Nf,Reset:()=>Ff,Set:()=>Df});var Ze={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Ff(){Ze.immutableTypes=!1,Ze.maxErrors=8,Ze.useAcceleration=!0,Ze.exactOptionalPropertyTypes=!1,Ze.enumerableKind=!1,Ze.correctiveParse=!1,Ze.unionPrioritySort=!0}function Df(e){for(let t of i.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(Ze,t,{value:n})}}function Nf(){return Ze}function Kf(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 Go(e,t){return{...e,...t}}function Uf(e,t,n={}){qe.create+=1;let r=$t.Get(),a=Go(t,n),s=r.enumerableKind?Go(a,e):Kf(a,e);return r.immutableTypes?Object.freeze(s):s}function Gf(e,t){qe.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(dn(e)),a=new Set(t);for(let s of Object.keys(r))a.has(s)||Object.defineProperty(n,s,r[s]);return n}function _f(e,t,n){qe.update+=1;let r=$t.Get(),a=dn(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 h(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function Q(e){return i.IsObject(e)}function y(e,t,n){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function at(e){return h(e,"Deferred")}function zf(e){return p.Update(e,{"~readonly":!0},{})}function fn(e,t){return p.Update(zf(e),{},t)}function _o(e,t,n,r){let a=d(e,t,n);return fn(a,r)}function Bf(e){return p.Update(e,{"~optional":!0},{})}function gn(e,t){return p.Update(Bf(e),{},t)}function zo(e,t,n,r){let a=d(e,t,n);return gn(a,r)}function ke(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function U(e){return h(e,"Array")}function tr(e){return p.Discard(e,["~kind","type","items"])}function De(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function ne(e){return h(e,"Constructor")}function Bo(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ne(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function re(e){return h(e,"Function")}function Vo(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function Xe(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function ae(e){return h(e,"Ref")}function ot(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function qt(e){return h(e,"Generic")}function Lt(e){return p.Create({"~kind":"Any"},{},e)}function Y(e){return h(e,"Any")}var Wo="(?!)";function L(e){return p.Create({"~kind":"Never"},{not:{}},e)}function it(e){return h(e,"Never")}function Ke(e,t={}){return y("AddOptional",[e],t)}function vt(e,t={}){return gn(e,t)}function Ho(e){return vt(e)}function ce(e){return Q(e)&&i.HasPropertyKey(e,"~optional")}function Yo(e){return i.Keys(e).filter(t=>!ce(e[t]))}function nr(e){return i.Keys(e)}function rr(e){return i.Values(e)}function $(e,t={}){let n=Yo(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function C(e){return h(e,"Object")}function Jo(e){return p.Discard(e,["~kind","type","properties","required"])}function oe(e){return p.Create({"~kind":"Unknown"},{},e)}function ee(e){return h(e,"Unknown")}function Ue(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 me(e){return h(e,"Cyclic")}function Zo(e){return p.Update(e,{"~unsafe":null},{})}function ar(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var Ge={};yt(Ge,{Match:()=>Vf});function Vf(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function hn(...e){let[t,n]=Ge.Match(e,{2:(r,a)=>[r,a,a],1:r=>[r,oe(),oe()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function V(e){return h(e,"Infer")}function Tt(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function z(e){return h(e,"Dependent")}function Xo(e){return p.Discard(e,["~kind","if","then","else"])}function Qo(e){return i.IsObjectNotArray(e)}function ei(e){return i.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function ti(e){return i.IsString(e)||i.IsNumber(e)}function ni(e,t){let n=Qo(e)?ei(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function de(e){return h(e,"Enum")}function le(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function R(e){return h(e,"Intersect")}function ri(e){return p.Discard(e,["~kind","allOf"])}function W(){throw new Error("Unreachable")}var ai;(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"})(ai||(ai={}));var Ev=BigInt("14695981039346656037"),[wv,Rv]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Ov=Array.from({length:256}).map((e,t)=>BigInt(t)),oi=new Float64Array(1),Pv=new DataView(oi.buffer),Sv=new Uint8Array(oi.buffer);var Mv=new TextEncoder;var xn=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=or(n)?m=>this.decode(n["~codec"].decode(m)):this.decode,a=or(n)?m=>n["~codec"].encode(t(m)):t,s={decode:r,encode:a};return p.Update(this.type,{"~codec":s},{})}},yn=class{constructor(t){this.type=t}Decode(t){return new xn(this.type,t)}};function ir(e){return new yn(e)}function si(e,t){return ir(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function mi(e,t){return ir(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function or(e){return Q(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function pi(e){return jt(e)}function kt(e){return Q(e)&&i.HasPropertyKey(e,"~immutable")}function _e(e,t={}){return y("AddReadonly",[e],t)}function Et(e,t={}){return fn(e,t)}function ui(e){return Et(e)}function wt(e){return Q(e)&&i.HasPropertyKey(e,"~readonly")}function Jf(e,t){let n=ga(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function ci(...e){let[t,n,r]=Ge.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return Jf(t,{check:n,error:r})}function Zf(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function ga(e){return Q(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>Zf(t))}var li="-?(?:0|[1-9][0-9]*)n";function In(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function ze(e){return h(e,"BigInt")}function sr(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Se(e){return h(e,"Boolean")}function bn(e){return p.Create({"~kind":"Identifier"},{name:e})}function di(e){return h(e,"Identifier")}var mr="-?(?:0|[1-9][0-9]*)";function Rt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function fe(e){return h(e,"Integer")}var ha=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function Xf(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new ha(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:Xf(e),const:e},t)}function pr(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function fi(e){return A(e)&&i.IsNumber(e.const)}function gi(e){return A(e)&&i.IsString(e.const)}function A(e){return h(e,"Literal")}function Ft(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Dt(e){return h(e,"Null")}var ur="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Ie(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function J(e){return h(e,"Number")}function Nt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function st(e){return h(e,"Symbol")}function Ot(...e){let[t,n,r]=Ge.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,oe(),oe()]});return p.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function hi(e){return h(e,"Parameter")}var cr=".*";function Me(e){return p.Create({"~kind":"String"},{type:"string"},e)}function ge(e){return h(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return h(e,"Union")}function xi(e){return p.Discard(e,["~kind","anyOf"])}function $n(e){let t=yi(e);return i.IsEqual(t.length,2)?t[0]:[]}function Qf(e){return!0}function Ii(e){return i.ShiftLeft(e,(t,n)=>eg(t)?Ii(n):!1,()=>!0)}function bi(e){return i.IsEqual(e.length,0)?!1:Ii(e)}function eg(e){return x(e)?bi(e.anyOf):A(e)?Qf(e.const):!1}function lr(e){return bi(e)}function dr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function $i(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>$i(a,t,[...n,`${r}${t}`]),()=>n)}function tg(e,t){return i.IsEqual(e.length,0)?[`${t}`]:$i(e,t)}function vi(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>vi(e,a,[...n,...Ti(e,r)]),()=>n)}function Ti(e,t){return x(t)?vi(e,t.anyOf):A(t)?tg(e,t.const):W()}function ki(e,t){return i.ShiftLeft(t,(n,r)=>ki(Ti(e,n),r),()=>e)}function ng(e){return e.map(t=>O(t))}function rg(e){let t=ki([],e),n=ng(t);return k(n)}function ag(e){return i.IsEqual(e.length,0)?W():i.IsEqual(e.length,1)&&A(e[0])?e[0]:rg(e)}function xa(e){let t=$n(e);return i.IsEqual(t.length,0)?Me():lr(t)?ag(t):dr(e)}function Ei(e){let t=xa(e);return Z(t)?Me():t}function xe(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function wi(e){return xe(Le,e)}function Ri(e){return $({true:e,false:e})}function X(e,t={}){let[n,r,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:n,minItems:r},t)}function j(e){return h(e,"Tuple")}function Oi(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function og(e){return p.Discard(e,["~readonly"])}function ya(e,t){return p.Update(og(e),{},t)}function Pi(e,t,n,r){let a=d(e,t,n);return ya(a,r)}function Si(e,t={}){return y("RemoveReadonly",[e],t)}function Mi(e,t={}){return ya(e,t)}function ig(e){return p.Discard(e,["~optional"])}function Ia(e,t){return p.Update(ig(e),{},t)}function Ci(e,t,n,r){let a=d(e,t,n);return Ia(a,r)}function Ai(e,t={}){return y("RemoveOptional",[e],t)}function fr(e,t={}){return Ia(e,t)}function ba(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function qi(e){let t=ba(e.items);return $(t)}function sg(e,t){return wt(e)?!!wt(t):!1}function mg(e,t){return ce(e)?!!ce(t):!1}function pg(e,t){let n=sg(e,t),r=mg(e,t),a=G([e,t]),s=Mi(fr(a));return n&&r?Et(vt(s)):n&&!r?Et(s):!n&&r?vt(s):s}function ug(e,t,n){return n in e?n in t?pg(e[n],t[n]):e[n]:n in t?t[n]:L()}function cg(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((r,a)=>({...r,[a]:ug(e,t,a)}),{})}function Li(e){return C(e)?e.properties:j(e)?ba(e.items):W()}function ji(e,t){let n=Li(e),r=Li(t),a=cg(n,r);return $(a)}function Fi(e,t){let n=Kt(e,t);return i.IsEqual(n,Tn)?e:i.IsEqual(n,kn)||i.IsEqual(n,vn)?t:L()}function Di(e){return C(e)||j(e)}function lg(e,t){let n=x(e),r=x(t);return n||r}function dg(e,t){let n=Ce(e),r=Ce(t),a=lg(n,r),s=Di(n),m=Di(r);return a?G([n,r]):s&&m?ji(n,r):s&&!m?n:!s&&m?r:Fi(n,r)}function Ni(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>Ni(e,a,[...n,dg(e,r)]),()=>i.IsEqual(n.length,0)?[e]:n)}function Ki(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>Ki(a,t,[...n,...En([r],t)]),()=>n)}function En(e,t=[]){return i.ShiftLeft(e,(n,r)=>x(n)?En(r,Ki(n.anyOf,t)):En(r,Ni(n,t)),()=>t)}function fg(e,t){let n=pe({},e,t);return b.IsExtendsTrueLike(n)?[]:[e]}function gg(e,t){return e.reduce((n,r)=>[...n,...fg(r,t)],[])}function gr(e,t){let n=Ce(e),r=x(n)?n.anyOf:[n],a=gg(r,t);return be(a)}function je(e,t,n){let r=le([e,t]),a=gr(n,e);return be([r,a])}function Ee(e){let t=e.map(n=>O(n));return be(t)}function G(e){let t=En(e),n=$a(t);return Qe(n)}function ye(e){let t=Ei(e);return Ce(t)}function be(e){let t=$a(e);return Qe(t)}function Ce(e){return z(e)?je(e.if,e.then,e.else):de(e)?Ee(e.enum):R(e)?G(e.allOf):Z(e)?ye(e.pattern):x(e)?be(e.anyOf):e}function Qe(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?L():k(e)}function Ui(e,t){let n=Ee(e);return mt(n,t)}function Gi(e,t){return xe(pt,t)}function _i(e,t){let n=G(e);return mt(n,t)}function zi(e,t){return i.IsString(e)||i.IsNumber(e)?$({[e]:t}):i.IsEqual(e,!1)?$({false:t}):i.IsEqual(e,!0)?$({true:t}):$({})}function Bi(e,t){return xe(Ut,t)}function Vi(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?xe(e.pattern.toString(),t):xe(Le,t)}function Wi(e,t){let n=$n(e);return lr(n)?mt(ye(e),t):xe(e,t)}function hg(e){return x(e)?wn(e.anyOf):[e]}function wn(e){return e.reduce((t,n)=>[...t,...hg(n)],[])}function xg(e){return e.some(t=>ge(t)||J(t)||fe(t))}function yg(e,t){return i.IsEqual(xg(e),!0)?xe(Le,t):void 0}function Ig(e,t){return e.reduce((n,r)=>A(r)&&(i.IsString(r.const)||i.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function bg(e,t){let n=Ig(e,t);return $(n)}function Hi(e,t){let n=wn(e),r=yg(n,t);return Q(r)?r:bg(n,t)}function mt(e,t){return Y(e)?wi(t):Se(e)?Ri(t):de(e)?Ui(e.enum,t):fe(e)?Gi(e,t):R(e)?_i(e.allOf,t):A(e)?zi(e.const,t):J(e)?Bi(e,t):x(e)?Hi(e.anyOf,t):ge(e)?Vi(e,t):Z(e)?Wi(e.pattern,t):$({})}function va(e,t,n){return T([e])?p.Update(mt(e,t),{},n):hr(e,t,n)}function Yi(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return va(s,m,a)}var pt=`^${mr}$`,Ut=`^${ur}$`,Le=`^${cr}$`;function hr(e,t,n={}){return y("Record",[e,t],n)}function xr(e,t,n={}){return va(e,t,n)}function Ji(e,t){return xe(e,t)}function yr(e){return i.IsEqual(e,Le)?Me():i.IsEqual(e,pt)?Rt():i.IsEqual(e,Ut)?Ie():xa(e)}function Ae(e){return i.Keys(e.patternProperties)[0]}function Gt(e){let t=Ae(e);return yr(t)}function he(e){return e.patternProperties[Ae(e)]}function ue(e){return h(e,"Record")}function Pt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function ut(e){return h(e,"Rest")}function Ir(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function br(e){return h(e,"This")}function _t(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function zt(e){return h(e,"Undefined")}function $r(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Be(e){return h(e,"Void")}function vg(e,t){return i.IsEqual(e,"Array")?ke(t[0]):i.IsEqual(e,"Capitalize")?Tr(t[0]):i.IsEqual(e,"ConstructorParameters")?Or(t[0]):i.IsEqual(e,"Evaluate")?Xm(t[0]):i.IsEqual(e,"Exclude")?Pr(t[0],t[1]):i.IsEqual(e,"Extract")?Sr(t[0],t[1]):i.IsEqual(e,"Index")?Sn(t[0],t[1]):i.IsEqual(e,"InstanceType")?Mr(t[0]):i.IsEqual(e,"Lowercase")?kr(t[0]):i.IsEqual(e,"NonNullable")?Cr(t[0]):i.IsEqual(e,"Omit")?Ar(t[0],t[1]):i.IsEqual(e,"Parameters")?qr(t[0]):i.IsEqual(e,"Partial")?Lr(t[0]):i.IsEqual(e,"Pick")?jr(t[0],t[1]):i.IsEqual(e,"Readonly")?Fr(t[0]):i.IsEqual(e,"KeyOf")?Mn(t[0]):i.IsEqual(e,"Record")?hr(t[0],t[1]):i.IsEqual(e,"Required")?Dr(t[0]):i.IsEqual(e,"ReturnType")?Nr(t[0]):i.IsEqual(e,"Uncapitalize")?Er(t[0]):i.IsEqual(e,"Uppercase")?wr(t[0]):Pn(Xe(e),t)}function St(){throw Error("Unreachable")}var Tg=(e,t=[])=>e.reduce((n,r)=>i.IsArray(r)&&i.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),et=e=>{let[t,n]=e;return Tg([...t,...n])};function ts(e){return Ot(e[0],e[2],e[4])}function ns(e){return Ot(e[0],e[2],e[2])}function rs(e){return Ot(e[0],oe(),e[2])}function as(e){return Ot(e,oe(),oe())}function os(e){return et(e)}function is(e){return e[1]}function ss(e){return et(e)}function ms(e){return e[1]}function ps(e){return vg(e[0],e[1])}function us(e){return null}function cs(e){return Me()}function ls(e){return Ie()}function ds(e){return sr()}function fs(e){return _t()}function gs(e){return Ft()}function hs(e){return Rt()}function xs(e){return In()}function ys(e){return oe()}function Is(e){return Lt()}function bs(e){return $({})}function $s(e){return L()}function vs(e){return Nt()}function Ts(e){return $r()}function ks(e){return Ir()}function Es(e){return O(BigInt(e))}function ws(e){return O(i.IsEqual(e,"true"))}function Rs(e){return O(parseFloat(e))}function Os(e){return O(e)}function Ps(e){return e[1]}function Ss(e){return O(e)}function Ms(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Cs(e){return e[1]}function As(e){return vr(e)}function qs(e){return i.IsEqual(e.length,6)?Tt(e[1],e[3],e[5]):Tt(e[1],e[3],oe())}function Ls(e){return e.length>0}function js(e){return e.reduce((t,n)=>i.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function Fs(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Ds(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function Ns(e){return i.IsEqual(e.length,2)?e[1]:[]}function Zi(e,t){return t.reduce((n,r)=>{let a=r;return i.IsEqual(a.length,1)?Sn(n,a[0]):i.IsEqual(a.length,0)?ke(n):St()},e)}function Xi(e,t){return i.IsEqual(t.length,3)?Rr(e,t[0],t[1],t[2]):e}function kg(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:Kr(e,t)}function Ks(e){let[t,n,r,a,s]=e;return kg(Xi(t?Mn(Zi(n,r)):Zi(n,r),a),s)}function Ta(e,t){return i.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,s=Ta(r,a);if(i.IsEqual(n,"&"))return R(s)?le([e,...s.allOf]):le([e,s]);if(i.IsEqual(n,"|"))return x(s)?k([e,...s.anyOf]):k([e,s]);St()})():e}function Us(e){let[t,n]=e;return Ta(t,n)}function Gs(e){let[t,n]=e;return Ta(t,n)}function _s(e){return Zm(e[1])}function zs(e){return e[1]}function Bs(e){return ot(e[0],e[2])}function Vs(e){return i.IsEqual(e.length,4)?hn(e[1],e[3]):i.IsEqual(e.length,2)?hn(e[1],oe()):St()}function Ws(e){return`${e}`}function Hs(e){return fe(e[3])?pt:J(e[3])?Ut:st(e[3])?Le:ge(e[3])?Le:St()}function Ys(e){return e.length>0}function Js(e){return e.length>0}function Zs(e){let[t,n,r,a,s]=e;return{[n]:t&&r?_e(Ke(s)):t&&!r?_e(s):!t&&r?Ke(s):s}}function Xs(e){return et(e)}function Qs(e){return e.reduce((t,n)=>i.HasPropertyKey(n,pt)||i.HasPropertyKey(n,Ut)||i.HasPropertyKey(n,Le)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function em(e){return Qs(e[1])}function tm(e){let[t,n]=e,r=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return $(t,r)}function nm(e){return i.IsEqual(e.length,5)?_e(Ke(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?_e(e[3]):Ke(e[3]):St()}function rm(e){return _e(Ke(e[1]))}function am(e){return _e(e[1])}function om(e){return Ke(e[0])}function im(e){return i.IsEqual(e.length,2)?Pt(e[1]):i.IsEqual(e.length,1)?e[0]:St()}function sm(e){return et(e)}function mm(e){return X(e[1])}function pm(e){return _e(Ke(e[4]))}function um(e){return _e(e[3])}function cm(e){return Ke(e[3])}function lm(e){return e[2]}function dm(e){return i.IsEqual(e.length,2)?Pt(e[1]):i.IsEqual(e.length,1)?e[0]:St()}function fm(e){return et(e)}function gm(e){return Ne(e[1],e[4])}function hm(e){return De(e[2],e[5])}function Qi(e,t){return i.IsEqual(e,"remove")?Si(t):i.IsEqual(e,"add")?_e(t):t}function xm(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 es(e,t){return i.IsEqual(e,"remove")?Ai(t):i.IsEqual(e,"add")?Ke(t):t}function ym(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 Im(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function bm(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?Rn(bn(e[3]),e[5],e[6][0],Qi(e[1],es(e[8],e[10]))):Rn(bn(e[3]),e[5],Xe(e[3]),Qi(e[1],es(e[8],e[10])))}function $m(e){return Xe(e)}function vm(e){return BigInt(e)}function Tm(e){return parseFloat(e)}function km(e){return i.IsEqual(e,"true")}function Em(e){return null}function wm(e){return{[e[0]]:e[2]}}function Rm(e){return et(e)}function Eg(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function Om(e){return Eg(e[1])}function Pm(e){return et(e)}function Sm(e){return e[1]}function Mm(e){return In()}function Cm(e){return Me()}function Am(e){return Ie()}function qm(e){return Rt()}function Lm(e){return L()}function jm(e){return O(e)}function Fm(e){return k(e[1])}function Dm(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Nm(e){return[e[0],...e[1]]}function Km(e){return e[1]}function Um(e){return et(e)}function Gm(e){return i.IsEqual(e.length,2)?e[1]:[]}function _m(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]]:ot(t,On(n,r,s))}}function zm(e){let t=e[2],[n,r]=e[3],a=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:On(t,n,a)}}function Bm(e){return{[e[1]]:ot(e[2],e[4])}}function Vm(e){return{[e[1]]:e[3]}}function Wm(e){return null}function Hm(e){return Qs(et(e))}function Ym(e){return e[1]}function Jm(e){let t=e[0],n=e[1];return Qm(p.Assign(t,n[0]))}function Cn(e){return M(e.length,2)}function E(e,t,n){return Cn(e)?t(e[0],e[1]):n()}function Og(e,t){return M(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function _(e,t){for(let n=0;n<e.length;n++){let r=Og(e[n],t);if(Cn(r))return r}return[]}function ka(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var ep=[...ka(97,122),...ka(65,90)],Ea="0",wa=ka(49,57),Bt=[Ea,...wa],tp=" ",Vt=`
2
- `;var ct="_",Ur=".",np="$",Gr="-";var rp="//",ap="/*",Sg="*/";function op(e){let t=e.indexOf(Sg);return M(t,-1)?"":e.slice(t+2)}function ip(e){let t=e.indexOf(Vt);return M(t,-1)?"":e.slice(t)}function Mg(e){return e.replace(/^[ \t\r\f\v]+/,"")}function _r(e){let t=Mg(e);return t.startsWith(ap)?_r(op(t.slice(2))):t.startsWith(rp)?_r(ip(t.slice(2))):t}function ie(e){let t=e.trimStart();return t.startsWith(ap)?ie(op(t.slice(2))):t.startsWith(rp)?ie(ip(t.slice(2))):t}function zr(e,t){return E(_([e],t),(n,r)=>[n,r],()=>["",t])}function Cg(e,t){return e.includes(t)}function Wt(e,t,n,r=""){return E(_(e,n),(a,s)=>Cg(t,a)?Wt(e,t,s,r):Wt(e,t,s,`${r}${a}`),()=>[r,n])}function Ag(e){return _(wa,e)}var qg=[...Bt,ct];function Lg(e){return Wt(qg,[ct],e)}function jg(e){return E(_([Ea],e),(t,n)=>[t,n],()=>E(Ag(e),(t,n)=>E(Lg(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function Br(e){return jg(ie(e))}function Fg(e){return zr(Gr,e)}function Dg(e){return E(Fg(e),(t,n)=>E(Br(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function sp(e){return Dg(ie(e))}function Ng(e){return E(sp(e),(t,n)=>E(_(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function Ra(e){return Ng(e)}function Oa(e,t){return _([e],t)}function u(e,t){return M(e,"")?["",t]:e.startsWith(Vt)?Oa(e,_r(t)):e.startsWith(tp)?Oa(e,t):Oa(e,ie(t))}var mp=[...ep,ct,np];function Kg(e){return _(mp,e)}var Ug=[...mp,...Bt];function pp(e,t=""){return E(_(Ug,e),(n,r)=>pp(r,`${t}${n}`),()=>[t,e])}function Gg(e){return E(Kg(e),(t,n)=>E(pp(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function B(e){return Gg(ie(e))}var _g=[...Bt,ct];function zg(e){return Cn(_([Ur],e))}function up(e){return E(Wt(_g,[ct],e),(t,n)=>M(t,"")?[]:[t,n],()=>[])}function Bg(e){return E(_([Ur],e),(t,n)=>E(up(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function Vg(e){return E(Br(e),(t,n)=>E(_([Ur],n),(r,a)=>E(up(a),(s,m)=>[`${t}${r}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function Wg(e){return zg(e)?Bg(e):Vg(e)}function cp(e){return Wg(ie(e))}function Hg(e){return zr(Gr,e)}function Yg(e){return E(Hg(e),(t,n)=>E(cp(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function Vr(e){return Yg(ie(e))}function Jg(e){return M(e,"")?[]:[e.slice(0,1),e.slice(1)]}function lp(e,t){return er(e,(n,r)=>t.startsWith(n)?!0:lp(r,t),()=>!1)}function lt(e,t,n=""){return E(Jg(t),(r,a)=>lp(e,t)?[n,t]:lt(e,a,`${n}${r}`),()=>[])}function Zg(e,t,n){return E(_([e],n),(r,a)=>E(lt([t],a),(s,m)=>E(_([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function Xg(e,t,n){return E(_([e],n),(r,a)=>E(lt([Vt,t],a),(s,m)=>E(_([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function dp(e,t,n,r){return n?Zg(e,t,ie(r)):Xg(e,t,ie(r))}function Qg(e,t){return _(e,t)}function eh(e,t){return dp(e,e,!1,t)}function th(e,t){return E(Qg(e,t),(n,r)=>eh(n,`${n}${r}`),()=>[])}function Wr(e,t){return th(e,ie(t))}function fp(e,t){return E(lt(e,t),(n,r)=>M(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),rh=e=>o(o(B(e),([t,n])=>o(u("extends",n),([r,a])=>o(w(a),([s,m])=>o(u("=",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[ts(t),n]),ah=e=>o(o(B(e),([t,n])=>o(u("extends",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[ns(t),n]),oh=e=>o(o(B(e),([t,n])=>o(u("=",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[rs(t),n]),ih=e=>o(B(e),([t,n])=>[as(t),n]),xp=e=>o(o(rh(e),([t,n])=>[t,n],()=>o(ah(e),([t,n])=>[t,n],()=>o(oh(e),([t,n])=>[t,n],()=>o(ih(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),yp=(e,t=[])=>o(o(xp(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>yp(r,[...t,n]),()=>[t,e]),sh=e=>o(o(yp(e),([t,n])=>o(o(o(xp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[os(t),n]),Ma=e=>o(o(u("<",e),([t,n])=>o(sh(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[is(t),n]),Ip=(e,t=[])=>o(o(w(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Ip(r,[...t,n]),()=>[t,e]),mh=e=>o(o(Ip(e),([t,n])=>o(o(o(w(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[ss(t),n]),ph=e=>o(o(u("<",e),([t,n])=>o(mh(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[ms(t),n]),uh=e=>o(o(B(e),([t,n])=>o(ph(n),([r,a])=>[[t,r],a])),([t,n])=>[ps(t),n]),bp=e=>o(o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[us(t),n]),$p=e=>o(u("string",e),([t,n])=>[cs(t),n]),vp=e=>o(u("number",e),([t,n])=>[ls(t),n]),ch=e=>o(u("boolean",e),([t,n])=>[ds(t),n]),lh=e=>o(u("undefined",e),([t,n])=>[fs(t),n]),dh=e=>o(u("null",e),([t,n])=>[gs(t),n]),Tp=e=>o(u("integer",e),([t,n])=>[hs(t),n]),fh=e=>o(u("bigint",e),([t,n])=>[xs(t),n]),gh=e=>o(u("unknown",e),([t,n])=>[ys(t),n]),hh=e=>o(u("any",e),([t,n])=>[Is(t),n]),xh=e=>o(u("object",e),([t,n])=>[bs(t),n]),yh=e=>o(u("never",e),([t,n])=>[$s(t),n]),kp=e=>o(u("symbol",e),([t,n])=>[vs(t),n]),Ih=e=>o(u("void",e),([t,n])=>[Ts(t),n]),bh=e=>o(u("this",e),([t,n])=>[ks(t),n]),$h=e=>o(o(u("${",e),([t,n])=>o(w(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Ps(t),n]),Pa=e=>o(lt(["${","`"],e),([t,n])=>[Ss(t),n]),Ep=e=>o(o(o(Pa(e),([t,n])=>o($h(n),([r,a])=>o(Ep(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(Pa(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(Pa(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[Ms(t),n]),Ca=e=>o(o(u("`",e),([t,n])=>o(Ep(n),([r,a])=>o(u("`",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Cs(t),n]),vh=e=>o(Ca(e),([t,n])=>[As(t),n]),Th=e=>o(o(o(u("if",e),([t,n])=>o(w(n),([r,a])=>o(u("then",a),([s,m])=>o(w(m),([c,l])=>o(u("else",l),([I,f])=>o(w(f),([P,N])=>[[t,r,s,c,I,P],N])))))),([t,n])=>[t,n],()=>o(o(u("if",e),([t,n])=>o(w(n),([r,a])=>o(u("then",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[qs(t),n]),kh=e=>o(Ra(e),([t,n])=>[Es(t),n]),Eh=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[ws(t),n]),wh=e=>o(Vr(e),([t,n])=>[Rs(t),n]),Rh=e=>o(Wr(["'",'"'],e),([t,n])=>[Os(t),n]),Oh=e=>o(o(o(u("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ls(t),n]),wp=(e,t=[])=>o(o(o(u("[",e),([n,r])=>o(w(r),([a,s])=>o(u("]",s),([m,c])=>[[n,a,m],c]))),([n,r])=>[n,r],()=>o(o(u("[",e),([n,r])=>o(u("]",r),([a,s])=>[[n,a],s])),([n,r])=>[n,r],()=>[])),([n,r])=>wp(r,[...t,n]),()=>[t,e]),Ph=e=>o(wp(e),([t,n])=>[js(t),n]),Sh=e=>o(o(o(u("extends",e),([t,n])=>o(w(n),([r,a])=>o(u("?",a),([s,m])=>o(w(m),([c,l])=>o(u(":",l),([I,f])=>o(w(f),([P,N])=>[[t,r,s,c,I,P],N])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Fs(t),n]),Mh=e=>o(o(o(u("(",e),([t,n])=>o(w(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o($p(e),([t,n])=>[t,n],()=>o(vp(e),([t,n])=>[t,n],()=>o(ch(e),([t,n])=>[t,n],()=>o(lh(e),([t,n])=>[t,n],()=>o(dh(e),([t,n])=>[t,n],()=>o(Tp(e),([t,n])=>[t,n],()=>o(fh(e),([t,n])=>[t,n],()=>o(gh(e),([t,n])=>[t,n],()=>o(hh(e),([t,n])=>[t,n],()=>o(xh(e),([t,n])=>[t,n],()=>o(yh(e),([t,n])=>[t,n],()=>o(kp(e),([t,n])=>[t,n],()=>o(Ih(e),([t,n])=>[t,n],()=>o(bh(e),([t,n])=>[t,n],()=>o(kh(e),([t,n])=>[t,n],()=>o(Eh(e),([t,n])=>[t,n],()=>o(wh(e),([t,n])=>[t,n],()=>o(Rh(e),([t,n])=>[t,n],()=>o(vh(e),([t,n])=>[t,n],()=>o(Th(e),([t,n])=>[t,n],()=>o(zh(e),([t,n])=>[t,n],()=>o(Jh(e),([t,n])=>[t,n],()=>o(nx(e),([t,n])=>[t,n],()=>o(tx(e),([t,n])=>[t,n],()=>o(ix(e),([t,n])=>[t,n],()=>o(uh(e),([t,n])=>[t,n],()=>o(sx(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[Ds(t),n]),Ch=e=>o(o(o(u("with",e),([t,n])=>o(Gp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ns(t),n]),Rp=e=>o(o(Oh(e),([t,n])=>o(Mh(n),([r,a])=>o(Ph(a),([s,m])=>o(Sh(m),([c,l])=>o(Ch(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Ks(t),n]),Op=e=>o(o(o(u("&",e),([t,n])=>o(Rp(n),([r,a])=>o(Op(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Pp=e=>o(o(Rp(e),([t,n])=>o(Op(n),([r,a])=>[[t,r],a])),([t,n])=>[Us(t),n]),Sp=e=>o(o(o(u("|",e),([t,n])=>o(Pp(n),([r,a])=>o(Sp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Hr=e=>o(o(Pp(e),([t,n])=>o(Sp(n),([r,a])=>[[t,r],a])),([t,n])=>[Gs(t),n]),Ah=e=>o(o(u("readonly",e),([t,n])=>o(Hr(n),([r,a])=>[[t,r],a])),([t,n])=>[_s(t),n]),qh=e=>o(o(u("|",e),([t,n])=>o(Hr(n),([r,a])=>[[t,r],a])),([t,n])=>[zs(t),n]),Lh=e=>o(o(Ma(e),([t,n])=>o(u("=",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Bs(t),n]),jh=e=>o(o(o(u("infer",e),([t,n])=>o(B(n),([r,a])=>o(u("extends",a),([s,m])=>o(Hr(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(u("infer",e),([t,n])=>o(B(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>[])),([t,n])=>[Vs(t),n]),w=e=>o(o(jh(e),([t,n])=>[t,n],()=>o(qh(e),([t,n])=>[t,n],()=>o(Ah(e),([t,n])=>[t,n],()=>o(Hr(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Fh=e=>o(Vr(e),([t,n])=>[Ws(t),n]),Dh=e=>o(B(e),([t,n])=>[t,n]),Nh=e=>o(Wr(["'",'"'],e),([t,n])=>[t,n]),Kh=e=>o(o(u("[",e),([t,n])=>o(B(n),([r,a])=>o(u(":",a),([s,m])=>o(o(Tp(m),([c,l])=>[c,l],()=>o(vp(m),([c,l])=>[c,l],()=>o($p(m),([c,l])=>[c,l],()=>o(kp(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Hs(t),n]),Mp=e=>o(o(Fh(e),([t,n])=>[t,n],()=>o(Dh(e),([t,n])=>[t,n],()=>o(Nh(e),([t,n])=>[t,n],()=>o(Kh(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Uh=e=>o(o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ys(t),n]),Gh=e=>o(o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Js(t),n]),Cp=e=>o(o(Uh(e),([t,n])=>o(Mp(n),([r,a])=>o(Gh(a),([s,m])=>o(u(":",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Zs(t),n]),Ap=e=>o(o(o(u(",",e),([t,n])=>o(u(`
1
+ var Nf=Object.defineProperty;var St=(e,t)=>{for(var n in t)Nf(e,n,{get:t[n],enumerable:!0})};import{Container as Pv,Key as Cv,Spacer as Mv,Text as si}from"@earendil-works/pi-tui";import{randomUUID as $f}from"node:crypto";import{copyFileSync as vv,existsSync as Tf,mkdirSync as kf,rmSync as $v,writeFileSync as Tv}from"node:fs";import{tmpdir as wf}from"node:os";import{join as ct}from"node:path";import{getSettingsListTheme as kv}from"@earendil-works/pi-coding-agent";import{Container as wv,Key as zt,matchesKey as Vt,Spacer as Ev,Text as Ef}from"@earendil-works/pi-tui";import{createAgentSession as ur,SessionManager as cr}from"@earendil-works/pi-coding-agent";import{copyFileSync as Bf,existsSync as Ba,lstatSync as Wf,mkdirSync as Wa,readFileSync as Ha,rmSync as Ii,symlinkSync as Hf,unlinkSync as Yf,writeFileSync as at}from"node:fs";import{join as ye}from"node:path";import{existsSync as br,mkdirSync as Uf,readFileSync as _a,writeFileSync as Kf}from"node:fs";import{dirname as _f,join as ui}from"node:path";import{getAgentDir as ci}from"@earendil-works/pi-coding-agent";var xr=ui(ci(),"checks-config.json"),Ir=ui(ci(),"settings.json"),li=10,di=60,za=20,Va=1,fi=5,vr=3,zf=["off","minimal","low","medium","high","xhigh","max"];function gi(e){return e?.reasoning?zf.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function dt(){try{if(!br(xr))return null;let e=JSON.parse(_a(xr,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function Ot(e){let t=_f(xr);br(t)||Uf(t,{recursive:!0}),Kf(xr,JSON.stringify(e,null,2),"utf-8")}function hi(){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:vr}}function yi(){try{return br(Ir)?JSON.parse(_a(Ir,"utf-8")).enabledModels??[]:[]}catch{return[]}}function xi(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Vf(){try{if(br(Ir))return JSON.parse(_a(Ir,"utf-8"))}catch{}return{}}function $r(){let e=Vf().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function Tr(e){return e.replace(/\\/g,"/")}function kr(e){return`'${e.replace(/'/g,"'\\''")}'`}async function wr(e,t,n){if((await e.exec("git",["rev-parse","HEAD"],{cwd:t,timeout:15e3})).code!==0)return{status:"error",error:"Not a git repository, or it has no commits yet."};let a=`git archive HEAD | tar -x -C ${kr(Tr(n))}`,s=await e.exec($r(),["-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 Ya=3e4,Jf=4e3,Xf=".pi/shipd-checks",wn="solver_gap_solutions";function Zf(e){let t=new Set,n=/^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/gm;for(let r of e.matchAll(n))r[1]&&t.add(r[1]),r[2]&&t.add(r[2]);return[...t]}function Qf(e,t){return e.length>t?e.slice(e.length-t):e}async function bi(e){let{pi:t,repoDir:n,solverDir:r,testPatchPath:a,agentPromptPath:s}=e,m=await wr(t,n,r);if(m.status==="error")return{status:"error",solverDir:r,error:m.error};let c={cwd:r,timeout:Ya},l=await t.exec("git",["init"],c);if(l.code!==0)return{status:"error",solverDir:r,error:l.stderr?.trim()||"git init failed"};await t.exec("git",["config","user.email","solvergap@shipd-checks.local"],c),await t.exec("git",["config","user.name","shipd-checks solver-gap-finder"],c);let d=await t.exec("git",["add","-A"],c);if(d.code!==0)return{status:"error",solverDir:r,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:r,error:g.stderr?.trim()||"git commit (baseline) failed"};let b=ye(r,".gitignore"),V=Ba(b)?Ha(b,"utf-8"):"";if(!V.split(/\r?\n/).some(lt=>lt.trim()==="node_modules")){let lt=V.length>0&&!V.endsWith(`
2
+ `)?`
3
+ `:"";at(b,`${V}${lt}node_modules
4
+ `,"utf-8")}let G=ye(n,"node_modules"),w=ye(r,"node_modules");if(Ba(G)&&!Ba(w))try{Hf(G,w,process.platform==="win32"?"junction":"dir")}catch{}try{Bf(s,ye(r,"agent_prompt.md"))}catch{}let Ce=Ha(a,"utf-8"),j=Zf(Ce),le=ye(r,"test.patch");at(le,Ce,"utf-8");let ne=await t.exec("git",["apply","test.patch"],c);try{Yf(le)}catch{}if(ne.code!==0)return{status:"patchFailed",solverDir:r,error:ne.stderr?.trim()||"git apply test.patch failed"};let Me=await t.exec("git",["add","-A"],c);if(Me.code!==0)return{status:"error",solverDir:r,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:r,error:oe.stderr?.trim()||"git commit (tests applied) failed"};let nt=await t.exec("git",["rev-parse","HEAD"],c);return nt.code!==0||!nt.stdout.trim()?{status:"error",solverDir:r,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:r,testsAppliedCommit:nt.stdout.trim(),testPatchPaths:j}}async function vi(e){let{pi:t,index:n,workspace:r,status:a,durationMs:s}=e,{solverDir:m,testsAppliedCommit:c,testPatchPaths:l}=r,d={cwd:m,timeout:Ya};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 ${kr(Tr(G))} new`,Ce=$r(),j=await t.exec(Ce,["-c",`cd ${kr(Tr(m))} && ${w}`],{timeout:Ya*10}),le=j.code===0,ne=Qf(`${j.stdout}
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 $t="_",xa=".",Zp="$",Ia="-";var Qp="//",eu="/*",Yh="*/";function tu(e){let t=e.indexOf(Yh);return M(t,-1)?"":e.slice(t+2)}function nu(e){let t=e.indexOf(on);return M(t,-1)?"":e.slice(t)}function Jh(e){return e.replace(/^[ \t\r\f\v]+/,"")}function ba(e){let t=Jh(e);return t.startsWith(eu)?ba(tu(t.slice(2))):t.startsWith(Qp)?ba(nu(t.slice(2))):t}function ce(e){let t=e.trimStart();return t.startsWith(eu)?ce(tu(t.slice(2))):t.startsWith(Qp)?ce(nu(t.slice(2))):t}function va(e,t){return R(W([e],t),(n,r)=>[n,r],()=>["",t])}function Xh(e,t){return e.includes(t)}function sn(e,t,n,r=""){return R(W(e,n),(a,s)=>Xh(t,a)?sn(e,t,s,r):sn(e,t,s,`${r}${a}`),()=>[r,n])}function Zh(e){return W(co,e)}var Qh=[...an,$t];function ey(e){return sn(Qh,[$t],e)}function ty(e){return R(W([uo],e),(t,n)=>[t,n],()=>R(Zh(e),(t,n)=>R(ey(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function $a(e){return ty(ce(e))}function ny(e){return va(Ia,e)}function ry(e){return R(ny(e),(t,n)=>R($a(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function ru(e){return ry(ce(e))}function ay(e){return R(ru(e),(t,n)=>R(W(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function lo(e){return ay(e)}function fo(e,t){return W([e],t)}function u(e,t){return M(e,"")?["",t]:e.startsWith(on)?fo(e,ba(t)):e.startsWith(Xp)?fo(e,t):fo(e,ce(t))}var au=[...Jp,$t,Zp];function oy(e){return W(au,e)}var iy=[...au,...an];function ou(e,t=""){return R(W(iy,e),(n,r)=>ou(r,`${t}${n}`),()=>[t,e])}function sy(e){return R(oy(e),(t,n)=>R(ou(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function Y(e){return sy(ce(e))}var my=[...an,$t];function py(e){return Hn(W([xa],e))}function iu(e){return R(sn(my,[$t],e),(t,n)=>M(t,"")?[]:[t,n],()=>[])}function uy(e){return R(W([xa],e),(t,n)=>R(iu(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function cy(e){return R($a(e),(t,n)=>R(W([xa],n),(r,a)=>R(iu(a),(s,m)=>[`${t}${r}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function ly(e){return py(e)?uy(e):cy(e)}function su(e){return ly(ce(e))}function dy(e){return va(Ia,e)}function fy(e){return R(dy(e),(t,n)=>R(su(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function Ta(e){return fy(ce(e))}function gy(e){return M(e,"")?[]:[e.slice(0,1),e.slice(1)]}function mu(e,t){return Cr(e,(n,r)=>t.startsWith(n)?!0:mu(r,t),()=>!1)}function Tt(e,t,n=""){return R(gy(t),(r,a)=>mu(e,t)?[n,t]:Tt(e,a,`${n}${r}`),()=>[])}function hy(e,t,n){return R(W([e],n),(r,a)=>R(Tt([t],a),(s,m)=>R(W([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function yy(e,t,n){return R(W([e],n),(r,a)=>R(Tt([on,t],a),(s,m)=>R(W([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function pu(e,t,n,r){return n?hy(e,t,ce(r)):yy(e,t,ce(r))}function xy(e,t){return W(e,t)}function Iy(e,t){return pu(e,e,!1,t)}function by(e,t){return R(xy(e,t),(n,r)=>Iy(n,`${n}${r}`),()=>[])}function ka(e,t){return by(e,ce(t))}function uu(e,t){return R(Tt(e,t),(n,r)=>M(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),$y=e=>o(o(Y(e),([t,n])=>o(u("extends",n),([r,a])=>o(S(a),([s,m])=>o(u("=",m),([c,l])=>o(S(l),([d,g])=>[[t,r,s,c,d],g]))))),([t,n])=>[Xs(t),n]),Ty=e=>o(o(Y(e),([t,n])=>o(u("extends",n),([r,a])=>o(S(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Zs(t),n]),ky=e=>o(o(Y(e),([t,n])=>o(u("=",n),([r,a])=>o(S(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Qs(t),n]),wy=e=>o(Y(e),([t,n])=>[em(t),n]),du=e=>o(o($y(e),([t,n])=>[t,n],()=>o(Ty(e),([t,n])=>[t,n],()=>o(ky(e),([t,n])=>[t,n],()=>o(wy(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),fu=(e,t=[])=>o(o(du(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>fu(r,[...t,n]),()=>[t,e]),Ey=e=>o(o(fu(e),([t,n])=>o(o(o(du(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[tm(t),n]),yo=e=>o(o(u("<",e),([t,n])=>o(Ey(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[nm(t),n]),gu=(e,t=[])=>o(o(S(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>gu(r,[...t,n]),()=>[t,e]),Ry=e=>o(o(gu(e),([t,n])=>o(o(o(S(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[rm(t),n]),Sy=e=>o(o(u("<",e),([t,n])=>o(Ry(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[am(t),n]),Oy=e=>o(o(Y(e),([t,n])=>o(Sy(n),([r,a])=>[[t,r],a])),([t,n])=>[om(t),n]),hu=e=>o(o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[im(t),n]),yu=e=>o(u("string",e),([t,n])=>[sm(t),n]),xu=e=>o(u("number",e),([t,n])=>[mm(t),n]),Py=e=>o(u("boolean",e),([t,n])=>[pm(t),n]),Cy=e=>o(u("undefined",e),([t,n])=>[um(t),n]),My=e=>o(u("null",e),([t,n])=>[cm(t),n]),Iu=e=>o(u("integer",e),([t,n])=>[lm(t),n]),Ay=e=>o(u("bigint",e),([t,n])=>[dm(t),n]),Ly=e=>o(u("unknown",e),([t,n])=>[fm(t),n]),qy=e=>o(u("any",e),([t,n])=>[gm(t),n]),jy=e=>o(u("object",e),([t,n])=>[hm(t),n]),Fy=e=>o(u("never",e),([t,n])=>[ym(t),n]),bu=e=>o(u("symbol",e),([t,n])=>[xm(t),n]),Dy=e=>o(u("void",e),([t,n])=>[Im(t),n]),Gy=e=>o(u("this",e),([t,n])=>[bm(t),n]),Ny=e=>o(o(u("${",e),([t,n])=>o(S(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[wm(t),n]),go=e=>o(Tt(["${","`"],e),([t,n])=>[Em(t),n]),vu=e=>o(o(o(go(e),([t,n])=>o(Ny(n),([r,a])=>o(vu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(go(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(go(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[Rm(t),n]),xo=e=>o(o(u("`",e),([t,n])=>o(vu(n),([r,a])=>o(u("`",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Sm(t),n]),Uy=e=>o(xo(e),([t,n])=>[Om(t),n]),Ky=e=>o(o(o(u("if",e),([t,n])=>o(S(n),([r,a])=>o(u("then",a),([s,m])=>o(S(m),([c,l])=>o(u("else",l),([d,g])=>o(S(g),([b,V])=>[[t,r,s,c,d,b],V])))))),([t,n])=>[t,n],()=>o(o(u("if",e),([t,n])=>o(S(n),([r,a])=>o(u("then",a),([s,m])=>o(S(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[Pm(t),n]),_y=e=>o(lo(e),([t,n])=>[vm(t),n]),zy=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[$m(t),n]),Vy=e=>o(Ta(e),([t,n])=>[Tm(t),n]),By=e=>o(ka(["'",'"'],e),([t,n])=>[km(t),n]),Wy=e=>o(o(o(u("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Cm(t),n]),$u=(e,t=[])=>o(o(o(u("[",e),([n,r])=>o(S(r),([a,s])=>o(u("]",s),([m,c])=>[[n,a,m],c]))),([n,r])=>[n,r],()=>o(o(u("[",e),([n,r])=>o(u("]",r),([a,s])=>[[n,a],s])),([n,r])=>[n,r],()=>[])),([n,r])=>$u(r,[...t,n]),()=>[t,e]),Hy=e=>o($u(e),([t,n])=>[Mm(t),n]),Yy=e=>o(o(o(u("extends",e),([t,n])=>o(S(n),([r,a])=>o(u("?",a),([s,m])=>o(S(m),([c,l])=>o(u(":",l),([d,g])=>o(S(g),([b,V])=>[[t,r,s,c,d,b],V])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Am(t),n]),Jy=e=>o(o(o(u("(",e),([t,n])=>o(S(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(yu(e),([t,n])=>[t,n],()=>o(xu(e),([t,n])=>[t,n],()=>o(Py(e),([t,n])=>[t,n],()=>o(Cy(e),([t,n])=>[t,n],()=>o(My(e),([t,n])=>[t,n],()=>o(Iu(e),([t,n])=>[t,n],()=>o(Ay(e),([t,n])=>[t,n],()=>o(Ly(e),([t,n])=>[t,n],()=>o(qy(e),([t,n])=>[t,n],()=>o(jy(e),([t,n])=>[t,n],()=>o(Fy(e),([t,n])=>[t,n],()=>o(bu(e),([t,n])=>[t,n],()=>o(Dy(e),([t,n])=>[t,n],()=>o(Gy(e),([t,n])=>[t,n],()=>o(_y(e),([t,n])=>[t,n],()=>o(zy(e),([t,n])=>[t,n],()=>o(Vy(e),([t,n])=>[t,n],()=>o(By(e),([t,n])=>[t,n],()=>o(Uy(e),([t,n])=>[t,n],()=>o(Ky(e),([t,n])=>[t,n],()=>o(px(e),([t,n])=>[t,n],()=>o(gx(e),([t,n])=>[t,n],()=>o(vx(e),([t,n])=>[t,n],()=>o(bx(e),([t,n])=>[t,n],()=>o(wx(e),([t,n])=>[t,n],()=>o(Oy(e),([t,n])=>[t,n],()=>o(Ex(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[Lm(t),n]),Xy=e=>o(o(o(u("with",e),([t,n])=>o(Du(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[qm(t),n]),Tu=e=>o(o(Wy(e),([t,n])=>o(Jy(n),([r,a])=>o(Hy(a),([s,m])=>o(Yy(m),([c,l])=>o(Xy(l),([d,g])=>[[t,r,s,c,d],g]))))),([t,n])=>[jm(t),n]),ku=e=>o(o(o(u("&",e),([t,n])=>o(Tu(n),([r,a])=>o(ku(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),wu=e=>o(o(Tu(e),([t,n])=>o(ku(n),([r,a])=>[[t,r],a])),([t,n])=>[Fm(t),n]),Eu=e=>o(o(o(u("|",e),([t,n])=>o(wu(n),([r,a])=>o(Eu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),wa=e=>o(o(wu(e),([t,n])=>o(Eu(n),([r,a])=>[[t,r],a])),([t,n])=>[Dm(t),n]),Zy=e=>o(o(u("readonly",e),([t,n])=>o(wa(n),([r,a])=>[[t,r],a])),([t,n])=>[Gm(t),n]),Qy=e=>o(o(u("|",e),([t,n])=>o(wa(n),([r,a])=>[[t,r],a])),([t,n])=>[Nm(t),n]),ex=e=>o(o(yo(e),([t,n])=>o(u("=",n),([r,a])=>o(S(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Um(t),n]),tx=e=>o(o(o(u("infer",e),([t,n])=>o(Y(n),([r,a])=>o(u("extends",a),([s,m])=>o(wa(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(u("infer",e),([t,n])=>o(Y(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>[])),([t,n])=>[Km(t),n]),S=e=>o(o(tx(e),([t,n])=>[t,n],()=>o(Qy(e),([t,n])=>[t,n],()=>o(Zy(e),([t,n])=>[t,n],()=>o(wa(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),nx=e=>o(Ta(e),([t,n])=>[_m(t),n]),rx=e=>o(Y(e),([t,n])=>[t,n]),ax=e=>o(ka(["'",'"'],e),([t,n])=>[t,n]),ox=e=>o(o(u("[",e),([t,n])=>o(Y(n),([r,a])=>o(u(":",a),([s,m])=>o(o(Iu(m),([c,l])=>[c,l],()=>o(xu(m),([c,l])=>[c,l],()=>o(yu(m),([c,l])=>[c,l],()=>o(bu(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([d,g])=>[[t,r,s,c,d],g]))))),([t,n])=>[zm(t),n]),Ru=e=>o(o(nx(e),([t,n])=>[t,n],()=>o(rx(e),([t,n])=>[t,n],()=>o(ax(e),([t,n])=>[t,n],()=>o(ox(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),ix=e=>o(o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Vm(t),n]),sx=e=>o(o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Bm(t),n]),Su=e=>o(o(ix(e),([t,n])=>o(Ru(n),([r,a])=>o(sx(a),([s,m])=>o(u(":",m),([c,l])=>o(S(l),([d,g])=>[[t,r,s,c,d],g]))))),([t,n])=>[Wm(t),n]),Ou=e=>o(o(o(u(",",e),([t,n])=>o(u(`
3
7
  `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>o(u(`
4
8
  `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(`
5
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),qp=(e,t=[])=>o(o(Cp(e),([n,r])=>o(Ap(r),([a,s])=>[[n,a],s])),([n,r])=>qp(r,[...t,n]),()=>[t,e]),_h=e=>o(o(qp(e),([t,n])=>o(o(o(Cp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Xs(t),n]),Aa=e=>o(o(u("{",e),([t,n])=>o(_h(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[em(t),n]),zh=e=>o(Aa(e),([t,n])=>[tm(t),n]),Bh=e=>o(o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[t,n],()=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[nm(t),n]),Vh=e=>o(o(u("readonly",e),([t,n])=>o(w(n),([r,a])=>o(u("?",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[rm(t),n]),Wh=e=>o(o(u("readonly",e),([t,n])=>o(w(n),([r,a])=>[[t,r],a])),([t,n])=>[am(t),n]),Hh=e=>o(o(w(e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[om(t),n]),gp=e=>o(o(Bh(e),([t,n])=>[t,n],()=>o(Vh(e),([t,n])=>[t,n],()=>o(Wh(e),([t,n])=>[t,n],()=>o(Hh(e),([t,n])=>[t,n],()=>o(w(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Lp=e=>o(o(o(u("...",e),([t,n])=>o(gp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(gp(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[im(t),n]),jp=(e,t=[])=>o(o(Lp(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>jp(r,[...t,n]),()=>[t,e]),Yh=e=>o(o(jp(e),([t,n])=>o(o(o(Lp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[sm(t),n]),Jh=e=>o(o(u("[",e),([t,n])=>o(Yh(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[mm(t),n]),Zh=e=>o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[pm(t),n]),Xh=e=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[um(t),n]),Qh=e=>o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[cm(t),n]),ex=e=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[lm(t),n]),hp=e=>o(o(Zh(e),([t,n])=>[t,n],()=>o(Xh(e),([t,n])=>[t,n],()=>o(Qh(e),([t,n])=>[t,n],()=>o(ex(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Fp=e=>o(o(o(u("...",e),([t,n])=>o(hp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(hp(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[dm(t),n]),Dp=(e,t=[])=>o(o(Fp(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Dp(r,[...t,n]),()=>[t,e]),Np=e=>o(o(Dp(e),([t,n])=>o(o(o(Fp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[fm(t),n]),tx=e=>o(o(u("(",e),([t,n])=>o(Np(n),([r,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[gm(t),n]),nx=e=>o(o(u("new",e),([t,n])=>o(u("(",n),([r,a])=>o(Np(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([I,f])=>o(w(f),([P,N])=>[[t,r,s,c,I,P],N])))))),([t,n])=>[hm(t),n]),rx=e=>o(o(o(u("+",e),([t,n])=>o(u("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("-",e),([t,n])=>o(u("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[xm(t),n]),ax=e=>o(o(o(u("+",e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("-",e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[ym(t),n]),ox=e=>o(o(o(u("as",e),([t,n])=>o(w(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Im(t),n]),ix=e=>o(o(u("{",e),([t,n])=>o(rx(n),([r,a])=>o(u("[",a),([s,m])=>o(B(m),([c,l])=>o(u("in",l),([I,f])=>o(w(f),([P,N])=>o(ox(N),([se,te])=>o(u("]",te),([ve,Pe])=>o(ax(Pe),([on,F])=>o(u(":",F),([Hn,sn])=>o(w(sn),([mn,Te])=>o(bp(Te),([pn,gt])=>o(u("}",gt),([ht,At])=>[[t,r,s,c,I,P,se,ve,on,Hn,mn,pn,ht],At]))))))))))))),([t,n])=>[bm(t),n]),sx=e=>o(B(e),([t,n])=>[$m(t),n]),mx=e=>o(Ra(e),([t,n])=>[vm(t),n]),px=e=>o(Vr(e),([t,n])=>[Tm(t),n]),ux=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[km(t),n]),cx=e=>o(Wr(['"',"'"],e),([t,n])=>[t,n]),lx=e=>o(u("null",e),([t,n])=>[Em(t),n]),dx=e=>o(u("undefined",e),([t,n])=>[void 0,n]),Kp=e=>o(o(Mp(e),([t,n])=>o(u(":",n),([r,a])=>o(qa(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[wm(t),n]),Up=(e,t=[])=>o(o(Kp(e),([n,r])=>o(Ap(r),([a,s])=>[[n,a],s])),([n,r])=>Up(r,[...t,n]),()=>[t,e]),fx=e=>o(o(Up(e),([t,n])=>o(o(o(Kp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Rm(t),n]),Gp=e=>o(o(u("{",e),([t,n])=>o(fx(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Om(t),n]),_p=(e,t=[])=>o(o(qa(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>_p(r,[...t,n]),()=>[t,e]),gx=e=>o(o(_p(e),([t,n])=>o(o(o(qa(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Pm(t),n]),hx=e=>o(o(u("[",e),([t,n])=>o(gx(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Sm(t),n]),qa=e=>o(o(mx(e),([t,n])=>[t,n],()=>o(px(e),([t,n])=>[t,n],()=>o(ux(e),([t,n])=>[t,n],()=>o(cx(e),([t,n])=>[t,n],()=>o(lx(e),([t,n])=>[t,n],()=>o(dx(e),([t,n])=>[t,n],()=>o(Gp(e),([t,n])=>[t,n],()=>o(hx(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),xx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[Mm(t),n]),yx=e=>o(u(".*",e),([t,n])=>[Cm(t),n]),Ix=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Am(t),n]),bx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[qm(t),n]),$x=e=>o(u("(?!)",e),([t,n])=>[Lm(t),n]),vx=e=>o(fp(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[jm(t),n]),Tx=e=>o(o(xx(e),([t,n])=>[t,n],()=>o(yx(e),([t,n])=>[t,n],()=>o(Ix(e),([t,n])=>[t,n],()=>o(bx(e),([t,n])=>[t,n],()=>o($x(e),([t,n])=>[t,n],()=>o(kx(e),([t,n])=>[t,n],()=>o(vx(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),kx=e=>o(o(u("(",e),([t,n])=>o(La(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Fm(t),n]),zp=e=>o(o(o(Sa(e),([t,n])=>o(u("|",n),([r,a])=>o(zp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(Sa(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[Dm(t),n]),Sa=e=>o(o(Tx(e),([t,n])=>o(La(n),([r,a])=>[[t,r],a])),([t,n])=>[Nm(t),n]),La=e=>o(o(zp(e),([t,n])=>[t,n],()=>o(Sa(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),yi=e=>o(o(u("^",e),([t,n])=>o(La(n),([r,a])=>o(u("$",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Km(t),n]),Bp=(e,t=[])=>o(o(w(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Bp(r,[...t,n]),()=>[t,e]),Ex=e=>o(o(Bp(e),([t,n])=>o(o(o(w(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Um(t),n]),Vp=e=>o(o(o(u("extends",e),([t,n])=>o(Ex(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Gm(t),n]),wx=e=>o(o(u("interface",e),([t,n])=>o(B(n),([r,a])=>o(Ma(a),([s,m])=>o(Vp(m),([c,l])=>o(Aa(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[_m(t),n]),Rx=e=>o(o(u("interface",e),([t,n])=>o(B(n),([r,a])=>o(Vp(a),([s,m])=>o(Aa(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[zm(t),n]),Ox=e=>o(o(u("type",e),([t,n])=>o(B(n),([r,a])=>o(Ma(a),([s,m])=>o(u("=",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Bm(t),n]),Px=e=>o(o(u("type",e),([t,n])=>o(B(n),([r,a])=>o(u("=",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[Vm(t),n]),Sx=e=>o(o(o(u("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Wm(t),n]),Mx=e=>o(o(o(u(";",e),([t,n])=>o(u(`
9
+ `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Pu=(e,t=[])=>o(o(Su(e),([n,r])=>o(Ou(r),([a,s])=>[[n,a],s])),([n,r])=>Pu(r,[...t,n]),()=>[t,e]),mx=e=>o(o(Pu(e),([t,n])=>o(o(o(Su(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Hm(t),n]),Io=e=>o(o(u("{",e),([t,n])=>o(mx(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Jm(t),n]),px=e=>o(Io(e),([t,n])=>[Xm(t),n]),ux=e=>o(o(o(Y(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(S(l),([d,g])=>[[t,r,s,c,d],g]))))),([t,n])=>[t,n],()=>o(o(Y(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(S(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(Y(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(S(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(Y(e),([t,n])=>o(u(":",n),([r,a])=>o(S(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[Zm(t),n]),cx=e=>o(o(u("readonly",e),([t,n])=>o(S(n),([r,a])=>o(u("?",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Qm(t),n]),lx=e=>o(o(u("readonly",e),([t,n])=>o(S(n),([r,a])=>[[t,r],a])),([t,n])=>[ep(t),n]),dx=e=>o(o(S(e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[tp(t),n]),cu=e=>o(o(ux(e),([t,n])=>[t,n],()=>o(cx(e),([t,n])=>[t,n],()=>o(lx(e),([t,n])=>[t,n],()=>o(dx(e),([t,n])=>[t,n],()=>o(S(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Cu=e=>o(o(o(u("...",e),([t,n])=>o(cu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(cu(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[np(t),n]),Mu=(e,t=[])=>o(o(Cu(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Mu(r,[...t,n]),()=>[t,e]),fx=e=>o(o(Mu(e),([t,n])=>o(o(o(Cu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[rp(t),n]),gx=e=>o(o(u("[",e),([t,n])=>o(fx(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[ap(t),n]),hx=e=>o(o(Y(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(S(l),([d,g])=>[[t,r,s,c,d],g]))))),([t,n])=>[op(t),n]),yx=e=>o(o(Y(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(S(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[ip(t),n]),xx=e=>o(o(Y(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(S(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[sp(t),n]),Ix=e=>o(o(Y(e),([t,n])=>o(u(":",n),([r,a])=>o(S(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[mp(t),n]),lu=e=>o(o(hx(e),([t,n])=>[t,n],()=>o(yx(e),([t,n])=>[t,n],()=>o(xx(e),([t,n])=>[t,n],()=>o(Ix(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Au=e=>o(o(o(u("...",e),([t,n])=>o(lu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(lu(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[pp(t),n]),Lu=(e,t=[])=>o(o(Au(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Lu(r,[...t,n]),()=>[t,e]),qu=e=>o(o(Lu(e),([t,n])=>o(o(o(Au(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[up(t),n]),bx=e=>o(o(u("(",e),([t,n])=>o(qu(n),([r,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(S(l),([d,g])=>[[t,r,s,c,d],g]))))),([t,n])=>[cp(t),n]),vx=e=>o(o(u("new",e),([t,n])=>o(u("(",n),([r,a])=>o(qu(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([d,g])=>o(S(g),([b,V])=>[[t,r,s,c,d,b],V])))))),([t,n])=>[lp(t),n]),$x=e=>o(o(o(u("+",e),([t,n])=>o(u("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("-",e),([t,n])=>o(u("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[dp(t),n]),Tx=e=>o(o(o(u("+",e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("-",e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[fp(t),n]),kx=e=>o(o(o(u("as",e),([t,n])=>o(S(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[gp(t),n]),wx=e=>o(o(u("{",e),([t,n])=>o($x(n),([r,a])=>o(u("[",a),([s,m])=>o(Y(m),([c,l])=>o(u("in",l),([d,g])=>o(S(g),([b,V])=>o(kx(V),([G,w])=>o(u("]",w),([Ce,j])=>o(Tx(j),([le,ne])=>o(u(":",ne),([Me,oe])=>o(S(oe),([nt,lt])=>o(hu(lt),([F,fr])=>o(u("}",fr),([In,bn])=>[[t,r,s,c,d,b,G,Ce,le,Me,nt,F,In],bn]))))))))))))),([t,n])=>[hp(t),n]),Ex=e=>o(Y(e),([t,n])=>[yp(t),n]),Rx=e=>o(lo(e),([t,n])=>[xp(t),n]),Sx=e=>o(Ta(e),([t,n])=>[Ip(t),n]),Ox=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[bp(t),n]),Px=e=>o(ka(['"',"'"],e),([t,n])=>[t,n]),Cx=e=>o(u("null",e),([t,n])=>[vp(t),n]),Mx=e=>o(u("undefined",e),([t,n])=>[void 0,n]),ju=e=>o(o(Ru(e),([t,n])=>o(u(":",n),([r,a])=>o(bo(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[$p(t),n]),Fu=(e,t=[])=>o(o(ju(e),([n,r])=>o(Ou(r),([a,s])=>[[n,a],s])),([n,r])=>Fu(r,[...t,n]),()=>[t,e]),Ax=e=>o(o(Fu(e),([t,n])=>o(o(o(ju(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Tp(t),n]),Du=e=>o(o(u("{",e),([t,n])=>o(Ax(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[kp(t),n]),Gu=(e,t=[])=>o(o(bo(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Gu(r,[...t,n]),()=>[t,e]),Lx=e=>o(o(Gu(e),([t,n])=>o(o(o(bo(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[wp(t),n]),qx=e=>o(o(u("[",e),([t,n])=>o(Lx(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Ep(t),n]),bo=e=>o(o(Rx(e),([t,n])=>[t,n],()=>o(Sx(e),([t,n])=>[t,n],()=>o(Ox(e),([t,n])=>[t,n],()=>o(Px(e),([t,n])=>[t,n],()=>o(Cx(e),([t,n])=>[t,n],()=>o(Mx(e),([t,n])=>[t,n],()=>o(Du(e),([t,n])=>[t,n],()=>o(qx(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),jx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[Rp(t),n]),Fx=e=>o(u(".*",e),([t,n])=>[Sp(t),n]),Dx=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Op(t),n]),Gx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[Pp(t),n]),Nx=e=>o(u("(?!)",e),([t,n])=>[Cp(t),n]),Ux=e=>o(uu(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[Mp(t),n]),Kx=e=>o(o(jx(e),([t,n])=>[t,n],()=>o(Fx(e),([t,n])=>[t,n],()=>o(Dx(e),([t,n])=>[t,n],()=>o(Gx(e),([t,n])=>[t,n],()=>o(Nx(e),([t,n])=>[t,n],()=>o(_x(e),([t,n])=>[t,n],()=>o(Ux(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),_x=e=>o(o(u("(",e),([t,n])=>o(vo(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Ap(t),n]),Nu=e=>o(o(o(ho(e),([t,n])=>o(u("|",n),([r,a])=>o(Nu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(ho(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[Lp(t),n]),ho=e=>o(o(Kx(e),([t,n])=>o(vo(n),([r,a])=>[[t,r],a])),([t,n])=>[qp(t),n]),vo=e=>o(o(Nu(e),([t,n])=>[t,n],()=>o(ho(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),fs=e=>o(o(u("^",e),([t,n])=>o(vo(n),([r,a])=>o(u("$",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[jp(t),n]),Uu=(e,t=[])=>o(o(S(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Uu(r,[...t,n]),()=>[t,e]),zx=e=>o(o(Uu(e),([t,n])=>o(o(o(S(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Fp(t),n]),Ku=e=>o(o(o(u("extends",e),([t,n])=>o(zx(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Dp(t),n]),Vx=e=>o(o(u("interface",e),([t,n])=>o(Y(n),([r,a])=>o(yo(a),([s,m])=>o(Ku(m),([c,l])=>o(Io(l),([d,g])=>[[t,r,s,c,d],g]))))),([t,n])=>[Gp(t),n]),Bx=e=>o(o(u("interface",e),([t,n])=>o(Y(n),([r,a])=>o(Ku(a),([s,m])=>o(Io(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[Np(t),n]),Wx=e=>o(o(u("type",e),([t,n])=>o(Y(n),([r,a])=>o(yo(a),([s,m])=>o(u("=",m),([c,l])=>o(S(l),([d,g])=>[[t,r,s,c,d],g]))))),([t,n])=>[Up(t),n]),Hx=e=>o(o(u("type",e),([t,n])=>o(Y(n),([r,a])=>o(u("=",a),([s,m])=>o(S(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[Kp(t),n]),Yx=e=>o(o(o(u("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[_p(t),n]),Jx=e=>o(o(o(u(";",e),([t,n])=>o(u(`
6
10
  `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(`
7
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),Wp=(e,t=[])=>o(o(ja(e),([n,r])=>o(Mx(r),([a,s])=>[[n,a],s])),([n,r])=>Wp(r,[...t,n]),()=>[t,e]),Cx=e=>o(o(Wp(e),([t,n])=>o(o(o(ja(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Hm(t),n]),ja=e=>o(o(Sx(e),([t,n])=>o(o(wx(n),([r,a])=>[r,a],()=>o(Rx(n),([r,a])=>[r,a],()=>o(Ox(n),([r,a])=>[r,a],()=>o(Px(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(bp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Ym(t),n]),Ax=e=>o(o(ja(e),([t,n])=>o(Cx(n),([r,a])=>[[t,r],a])),([t,n])=>[Jm(t),n]),Hp=e=>o(o(Ax(e),([t,n])=>[t,n],()=>o(Lh(e),([t,n])=>[t,n],()=>o(w(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function Yp(e){let t=Ca(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:W()}function Lx(e){return e.join("|")}function jx(e){return e.slice(1,e.length-1)}function Fx(e,t,n){return dt(t,`${n}${e}`)}function Dx(e,t){return dt(e,`${t}${li}`)}function Nx(e,t){return dt(e,`${t}${mr}`)}function Kx(e,t){return dt(e,`${t}${ur}`)}function Ux(e,t){return An(k([O("false"),O("true")]),e,t)}function Gx(e,t){return dt(e,`${t}${cr}`)}function _x(e,t,n){return dt(t,`${n}${jx(e)}`)}function zx(e,t,n){let r=qn(e,{});return An(r,t,n)}function Bx(e,t,n){let r=Ee(e);return An(r,t,n)}function Jp(e,t,n,r=[]){return i.ShiftLeft(e,(a,s)=>Jp(s,t,n,[...r,An(a,[],"")]),()=>dt(t,`${n}(${Lx(r)})`))}function An(e,t,n){return de(e)?Bx(e.enum,t,n):fe(e)?Nx(t,n):A(e)?Fx(e.const,t,n):ze(e)?Dx(t,n):Se(e)?Ux(t,n):J(e)?Kx(t,n):ge(e)?Gx(t,n):Z(e)?_x(e.pattern,t,n):Xp(e)?zx(e.parameters[0],t,n):x(e)?Jp(e.anyOf,t,n):Wo}function dt(e,t){return i.ShiftLeft(e,(n,r)=>An(n,r,t),()=>t)}function Vx(e){return`^${dt(e,"")}$`}function Zp(e){let t=Vx(e);return dr(t)}function qn(e,t){return T(e)?p.Update(Zp(e),{},t):vr(e,t)}function Qp(e,t,n,r){let a=we(e,t,n);return qn(a,r)}function vr(e,t={}){return y("TemplateLiteral",[e],t)}function Xp(e){return Q(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function eu(e){return qn(e,{})}function Wx(e){let t=Yp(e);return eu(t)}function tu(e,t={}){let n=i.IsString(e)?Wx(e):eu(e);return p.Update(n,{},t)}function Z(e){return h(e,"TemplateLiteral")}var b={};yt(b,{ExtendsFalse:()=>v,ExtendsTrue:()=>g,ExtendsUnion:()=>Fa,IsExtendsFalse:()=>Hx,IsExtendsTrue:()=>ru,IsExtendsTrueLike:()=>Ht,IsExtendsUnion:()=>nu,Match:()=>K});function Fa(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function nu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsUnion")&&i.IsObject(e.inferred)}function g(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function ru(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function v(){return p.Create({"~kind":"ExtendsFalse"},{})}function Hx(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function Ht(e){return nu(e)||ru(e)}function K(e,t,n){return Ht(e)?t(e.inferred):n()}function Yx(e,t,n,r){return K(S(e,n,r),a=>g(p.Assign(p.Assign(e,a),{[t]:n})),()=>v())}function Jx(e,t){return g(e)}function Zx(e,t,n,r,a){return K(S(e,t,n),s=>K(S(s,t,r),m=>g(m),()=>v()),()=>K(S(e,t,a),s=>g(s),()=>v()))}function Xx(e,t,n){let r=Ee(n);return S(e,t,r)}function au(e,t,n){return i.ShiftLeft(n,(r,a)=>K(S(e,t,r),s=>au(s,t,a),()=>v()),()=>g(e))}function Qx(e,t,n){let r=ye(n);return S(e,t,r)}function ou(e,t,n){return i.ShiftLeft(n,(r,a)=>K(S(e,t,r),s=>g(s),()=>ou(e,t,a)),()=>v())}function q(e,t,n){return Y(n)?Jx(e,t):z(n)?Zx(e,t,n.if,n.then,n.else):de(n)?Xx(e,t,n.enum):V(n)?Yx(e,n.name,t,n.extends):R(n)?au(e,t,n.allOf):Z(n)?Qx(e,t,n.pattern):x(n)?ou(e,t,n.anyOf):ee(n)?g(e):v()}function iu(e,t,n){return V(n)?q(e,t,n):Y(n)?g(e):ee(n)?g(e):Fa(e)}function ey(e,t){let n=kt(e),r=kt(t);return n&&r||!n&&r?!0:!(n&&!r)}function su(e,t,n,r){return U(r)?ey(t,r)?S(e,n,r.items):v():q(e,t,r)}function mu(e,t,n){return ze(n)?g(e):q(e,t,n)}function pu(e,t,n){return Se(n)?g(e):q(e,t,n)}function ty(e,t,n,r,a){let s=V(r)?t:r,m=V(r)?r:t,c=ce(t),l=ce(r);return!c&&l?v():K(S(e,s,m),I=>Ln(I,n,a),()=>v())}function ny(e,t,n,r){return i.ShiftLeft(r,(a,s)=>ty(e,t,n,a,s),()=>ce(t)?g(e):v())}function ry(e,t,n){return i.ShiftLeft(t,(r,a)=>ny(e,r,a,n),()=>g(e))}function Ln(e,t,n){return ry(e,t,n)}function Yr(e,t,n){return Be(n)?g(e):S(e,t,n)}function uu(e,t,n,r){return Y(r)?g(e):ee(r)?g(e):ne(r)?K(Ln(e,t,r.parameters),a=>Yr(a,n,r.instanceType),()=>v()):v()}function cu(e,t,n,r,a){return K(S(e,t,a),()=>S(e,n,a),()=>S(e,r,a))}function lu(e,t,n){let r=Ee(t);return S(e,r,n)}function du(e,t,n,r){return Y(r)?g(e):ee(r)?g(e):re(r)?K(Ln(e,t,r.parameters),a=>Yr(a,n,r.returnType),()=>v()):v()}function fu(e,t,n){return fe(n)?g(e):J(n)?g(e):q(e,t,n)}function gu(e,t,n){let r=G(t);return S(e,r,n)}function Jr(e,t,n){return t===n?g(e):v()}function ay(e,t,n){return A(n)?Jr(e,t,n.const):ze(n)?g(e):q(e,O(t),n)}function oy(e,t,n){return A(n)?Jr(e,t,n.const):Se(n)?g(e):q(e,O(t),n)}function iy(e,t,n){return A(n)?Jr(e,t,n.const):J(n)?g(e):q(e,O(t),n)}function sy(e,t,n){return A(n)?Jr(e,t,n.const):ge(n)?g(e):q(e,O(t),n)}function hu(e,t,n){return i.IsBigInt(t.const)?ay(e,t.const,n):i.IsBoolean(t.const)?oy(e,t.const,n):i.IsNumber(t.const)?iy(e,t.const,n):i.IsString(t.const)?sy(e,t.const,n):W()}function xu(e,t,n){return V(n)?q(e,t,n):g(e)}function yu(e,t,n){return Dt(n)?g(e):q(e,t,n)}function Iu(e,t,n){return J(n)?g(e):q(e,t,n)}function my(e,t,n){return ce(t)?ce(n)?g(e):v():g(e)}function py(e,t,n){return V(n)&&it(n.extends)?v():K(S(e,t,n),r=>my(r,t,n),()=>v())}function uy(e,t){return e.reduce((n,r)=>r in t?Ht(t[r])?{...n,...t[r].inferred}:W():W(),{})}function cy(e,t,n){let r={};for(let m of i.Keys(n))r[m]=m in t?py({},t[m],n[m]):ce(n[m])?V(n[m])?g(p.Assign(e,{[n[m].name]:n[m].extends})):g(e):v();let a=i.Values(r).every(m=>Ht(m)),s=a?uy(i.Keys(r),r):{};return a?g(s):v()}function ly(e,t,n){let r=cy(e,t,n);return Ht(r)?g(p.Assign(e,r.inferred)):v()}function dy(e,t,n){return ly(e,t,n)}function fy(e,t){return i.Keys(t).reduce((n,r)=>({...n,[r]:i.HasPropertyKey(e,r)?x(n[r])?k([...n[r].anyOf,t[r]]):k([e[r],t[r]]):t[r]}),e)}function bu(e,t,n,r){return i.ShiftLeft(t,(a,s)=>K(S({},e[a],n),m=>bu(e,s,n,fy(r,m)),()=>v()),()=>g(r))}function gy(e,t,n,r){let a=i.Keys(t);return bu(t,a,r,e)}function $u(e,t,n){return ue(n)?gy(e,t,Ae(n),he(n)):C(n)?dy(e,t,n.properties):q(e,$(t),n)}function hy(e,t){return i.IsEqual(i.Keys(t).length,0)?g(e):v()}function xy(e,t,n,r,a){return S(e,n,a)}function vu(e,t,n,r){return ue(r)?xy(e,yr(t),n,yr(Ae(r)),he(r)):C(r)?hy(e,r.properties):Y(r)?g(e):ee(r)?g(e):v()}function Tu(e,t,n){return ge(n)?g(e):q(e,t,n)}function ku(e,t,n){return st(n)?g(e):q(e,t,n)}function Eu(e,t,n){let r=ye(t);return S(e,r,n)}function Da(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function jn(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 Na(e){return ut(e)?V(e.items)?U(e.items.extends)?Da(e.items.name,e.items.extends.items):ee(e.items.extends)?Da(e.items.name,e.items.extends):void 0:W():void 0}function Zr(e){return V(e)?Da(e.name,e.extends):void 0}function Ka(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>K(S({},r,t),()=>Ka(a,t,[...n,r]),()=>{}),()=>n)}function wu(e,t,n,r){let a=Ka(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:X(a)})):v()}function Xr(e,t,n,r){let a=Ka(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:k(a)})):v()}function yy(e){return[...e].reverse()}function Ua(e,t){return t?yy(e):e}function Iy(e){let t=e.length>0?e[0]:void 0,n=Q(t)?Na(t):void 0;return Q(n)}function by(e,t,n,r,a,s){return K(S(e,n,a),m=>Ru(m,t,r,s),()=>v())}function $y(e,t,n,r,a){let s=Na(r);return jn(s)?wu(e,s.name,Ua(n,t),s.type):i.ShiftLeft(n,(m,c)=>by(e,t,m,c,r,a),()=>v())}function vy(e,t,n,r){return i.ShiftLeft(r,(a,s)=>$y(e,t,n,a,s),()=>i.IsEqual(n.length,0)?g(e):v())}function Ru(e,t,n,r){return vy(e,t,n,r)}function Ty(e,t,n){let r=ft(e,D([],[]),n),a=Iy(r);return Ru(e,a,Ua(t,a),Ua(r,a))}function Ou(e,t,n){let r=Zr(n);return jn(r)?Xr(e,r.name,t,r.type):i.ShiftLeft(t,(a,s)=>K(S(e,a,n),m=>Ou(m,s,n),()=>v()),()=>g(e))}function Pu(e,t,n){let r=ft(e,D([],[]),t);return j(n)?Ty(e,r,n.items):U(n)?Ou(e,r,n.items):q(e,X(r),n)}function Su(e,t,n){return Be(n)?g(e):zt(n)?g(e):q(e,t,n)}function Mu(e,t,n){return i.ShiftLeft(n,(r,a)=>K(S(e,t,r),s=>g(s),()=>Mu(e,t,a)),()=>v())}function Ga(e,t,n){return i.ShiftLeft(t,(r,a)=>K(Mu(e,r,n),s=>Ga(s,a,n),()=>v()),()=>g(e))}function Cu(e,t,n){let r=Zr(n);return jn(r)?Xr(e,r.name,t,r.type):x(n)?Ga(e,t,n.anyOf):Ga(e,t,[n])}function Au(e,t,n){return V(n)?q(e,t,n):Y(n)?g(e):ee(n)?g(e):v()}function qu(e,t,n){return Be(n)?g(e):q(e,t,n)}function S(e,t,n){return Y(t)?iu(e,t,n):U(t)?su(e,t,t.items,n):ze(t)?mu(e,t,n):Se(t)?pu(e,t,n):ne(t)?uu(e,t.parameters,t.instanceType,n):z(t)?cu(e,t.if,t.then,t.else,n):de(t)?lu(e,t.enum,n):re(t)?du(e,t.parameters,t.returnType,n):fe(t)?fu(e,t,n):R(t)?gu(e,t.allOf,n):A(t)?hu(e,t,n):it(t)?xu(e,t,n):Dt(t)?yu(e,t,n):J(t)?Iu(e,t,n):C(t)?$u(e,t.properties,n):ue(t)?vu(e,Ae(t),he(t),n):ge(t)?Tu(e,t,n):st(t)?ku(e,t,n):Z(t)?Eu(e,t.pattern,n):j(t)?Pu(e,t.items,n):zt(t)?Su(e,t,n):x(t)?Cu(e,t.anyOf,n):ee(t)?Au(e,t,n):Be(t)?qu(e,t,n):v()}function ky(e,t){return G([...e,$(t)])}function _a(e,t,n){return T(e)?p.Update(ky(e,t),{},n):On(e,t,n)}function Lu(e,t,n,r,a){let s=we(e,t,n),m=Fn(e,t,r);return _a(s,m,a)}function On(e,t,n={}){return y("Interface",[e,t],n)}function Yt(e){return Q(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function ju(e,t,n={}){return _a(e,t,n)}function Ey(e,t,n){return e.includes(n)?!0:Dn([...e,n],t,t[n])}function Fu(e,t,n){let r=rr(n);return Mt(e,t,r)}function Mt(e,t,n){return i.ShiftLeft(n,(r,a)=>Dn(e,t,r)?!0:Mt(e,t,a),()=>!1)}function Dn(e,t,n){return ae(n)?Ey(e,t,n.$ref):U(n)?Dn(e,t,n.items):ne(n)?Mt(e,t,[...n.parameters,n.instanceType]):re(n)?Mt(e,t,[...n.parameters,n.returnType]):Yt(n)?Fu(e,t,n.parameters[1]):R(n)?Mt(e,t,n.allOf):C(n)?Fu(e,t,n.properties):x(n)?Mt(e,t,n.anyOf):j(n)?Mt(e,t,n.items):ue(n)?Dn(e,t,he(n)):!1}function Du(e,t,n){return Dn(e,t,n)}function wy(e,t){return t.reduce((n,r)=>Du([r],e,e[r])?[...n,r]:n,[])}function Nu(e){let t=nr(e);return wy(e,t)}function Ry(e,t,n){return n.includes(t)?n:t in e?Nn(e,e[t],[...n,t]):W()}function Ku(e,t,n){let r=rr(t);return Jt(e,r,n)}function Jt(e,t,n){return t.reduce((r,a)=>Nn(e,a,r),n)}function Nn(e,t,n){return ae(t)?Ry(e,t.$ref,n):U(t)?Nn(e,t.items,n):ne(t)?Jt(e,[...t.parameters,t.instanceType],n):re(t)?Jt(e,[...t.parameters,t.returnType],n):Yt(t)?Ku(e,t.parameters[1],n):R(t)?Jt(e,t.allOf,n):C(t)?Ku(e,t.properties,n):x(t)?Jt(e,t.anyOf,n):j(t)?Jt(e,t.items,n):ue(t)?Nn(e,he(t),n):n}function Uu(e,t,n){return Nn(e,n,[t])}function Oy(e){return Lt()}function Py(e){return i.Keys(e).reduce((t,n)=>({...t,[n]:Ct(e[n])}),{})}function Kn(e){return e.reduce((t,n)=>[...t,Ct(n)],[])}function Ct(e){return ae(e)?Oy(e.$ref):U(e)?ke(Ct(e.items),tr(e)):ne(e)?De(Kn(e.parameters),Ct(e.instanceType)):re(e)?Ne(Kn(e.parameters),Ct(e.returnType)):R(e)?le(Kn(e.allOf)):C(e)?$(Py(e.properties)):ue(e)?xr(Gt(e),Ct(he(e))):x(e)?k(Kn(e.anyOf)):j(e)?X(Kn(e.items)):e}function Sy(e,t){return t in e?Ct(e[t]):oe()}function Gu(e){return Sy(e.$defs,e.$ref)}function My(e,t,n){let r=we(e,D([],[]),t),a=Fn({},D([],[]),n);return G([...r,$(a)])}function Cy(e,t){return i.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let s=e[a],m=Yt(s)?My(e,s.parameters[0],s.parameters[1]):s;return{...r,[a]:m}},{})}function _u(e,t,n){let r=Uu(e,t,n),a=Cy(e,r);return Ue(a,t)}function zu(e,t){return t in e?ae(e[t])?zu(e,e[t].$ref):e[t]:L()}function Ve(e,t){return zu(e,t)}function Bu(e){return me(e)?Gu(e):ar(e)?oe():e}function pe(e,t,n){let r=Bu(t),a=Bu(n);return S(e,r,a)}var vn="equal",Ay="disjoint",Tn="left-inside",kn="right-inside";function Kt(e,t){let n=[ee(e)?b.ExtendsFalse():pe({},e,t),ee(e)?b.ExtendsTrue({}):pe({},t,e)];return b.IsExtendsTrueLike(n[0])&&b.IsExtendsTrueLike(n[1])?vn:b.IsExtendsTrueLike(n[0])&&b.IsExtendsFalse(n[1])?Tn:b.IsExtendsFalse(n[0])&&b.IsExtendsTrueLike(n[1])?kn:Ay}function qy(e,t){return t.filter(n=>Kt(e,n)!==kn)}function Ly(e,t){let n=t.some(r=>{let a=Kt(e,r);return i.IsEqual(a,Tn)||i.IsEqual(a,vn)});return i.IsEqual(n,!1)}function jy(e,t){let n=Ce(e);return Y(n)?[n]:Ly(n,t)?[...qy(n,t),n]:t}function Fy(e){return e.reduce((t,n)=>C(n)?[...t,n]:it(n)?t:jy(n,t),[])}function $a(e){let t=Fy(e);return wn(t)}function za(e,t){return p.Update(Ce(e),{},t)}function Vu(e,t,n,r){let a=d(e,t,n);return za(a,r)}function Un(e,t=[]){return at(e)&&i.IsEqual(e.action,"Conditional")?ae(e.parameters[0])?Un(e.parameters[2],Un(e.parameters[3],[...t,e.parameters[0].$ref])):Un(e.parameters[2],Un(e.parameters[3],t)):at(e)&&i.IsEqual(e.action,"Mapped")&&at(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&ae(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function Dy(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function Yu(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>i.ShiftLeft(t,(s,m)=>Yu(a,m,[...n,[s,r]]),()=>n),()=>n)}function Ny(e){return x(e)?[...e.anyOf]:[e]}function Ky(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Wu(e,t){return t.reduce((n,r)=>[...n,...Ky(e,r)],[])}function Hu(e){return e.reduce((t,n)=>i.IsEqual(n[0],!0)?Wu(t,Ny(n[1])):Wu(t,[n[1]]),[[]])}function Ju(e,t,n){let r=Un(n),a=Dy(e,r),s=Yu(t,a);return at(n)&&i.IsEqual(n.action,"Conditional")||at(n)&&i.IsEqual(n.action,"Mapped")?Hu(s):[t]}function Uy(){return["(not-resolvable)",L()]}function Gy(){return["(not-generic)",L()]}function _y(e,t,n){return[e,ot(t,n)]}function zy(e,t,n){return t in e?Zu(e,t,e[t],n):Uy()}function Zu(e,t,n,r){return qt(n)?_y(t,n.parameters,n.expression):ae(n)?zy(e,n.$ref,r):Gy()}function Xu(e,t,n){return Zu(e,"(anonymous)",t,n)}function By(e,t,n){if(V(t)||Zt(t)||b.IsExtendsTrueLike(pe({},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 Qu(e,t,n,r,a){let s=d(e,t,a);return By(n,s,r),p.Assign(e,{[n]:s})}function Vy(e,t,n,r,a){let s=d(e,t,n.extends),m=d(e,t,n.equals);return i.ShiftLeft(a,(c,l)=>Ba(Qu(e,t,n.name,s,c),t,r,l),()=>Ba(Qu(e,t,n.name,s,m),t,r,[]))}function Ba(e,t,n,r){return i.ShiftLeft(n,(a,s)=>Vy(e,t,a,s,r),()=>e)}function ec(e,t,n,r){return Ba(e,t,n,r)}function Wy(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function Hy(e,t){return i.IsEqual(Wy(e),t)}function Yy(e,t,n,r,a,s){let m=ec(e,t,r,s),c=d(m,D([...t.callstack,n.$ref],t.visited),a);return d(m,D([],[]),c)}function Jy(e,t,n,r,a,s){return s.reduce((m,c)=>[...m,Yy(e,t,n,r,a,c)],[])}function Zy(e,t,n,r,a,s){let m=Ju(r,s,a),c=Jy(e,t,n,r,a,m);return i.IsEqual(c.length,1)?c[0]:be(c)}function Qr(e,t,n,r){let a=we(e,t,r),s=Xu(e,n,r),m=s[0],c=s[1];return qt(c)?Hy(t,m)?Pn(Xe(m),a):Zy(e,t,Xe(m),c.parameters,c.expression,a):Pn(n,a)}function Pn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function tc(e,t){return Qr({},D([],[]),e,t)}function Zt(e){return h(e,"Call")}function Xy(e){return p.Discard(e,["~immutable"])}function nc(e,t){return p.Update(Xy(e),{},t)}function rc(e,t,n,r){let a=d(e,t,n);return nc(a,r)}function ac(e,t){return e(t)}function oc(e,t){return i.IsString(t)?O(ac(e,t)):O(t)}function ic(e,t){let n=ye(t);return tt(e,n)}function sc(e,t){let n=t.map(r=>tt(e,r));return k(n)}function tt(e,t){return A(t)?oc(e,t.const):Z(t)?ic(e,t.pattern):x(t)?sc(e,t.anyOf):t}function Tr(e,t={}){return y("Capitalize",[e],t)}function mc(e,t={}){return Va(e,t)}function kr(e,t={}){return y("Lowercase",[e],t)}function pc(e,t={}){return Wa(e,t)}function Er(e,t={}){return y("Uncapitalize",[e],t)}function uc(e,t={}){return Ha(e,t)}function wr(e,t={}){return y("Uppercase",[e],t)}function cc(e,t={}){return Ya(e,t)}var Qy=e=>e[0].toUpperCase()+e.slice(1),eI=e=>e.toLowerCase(),tI=e=>e[0].toLowerCase()+e.slice(1),nI=e=>e.toUpperCase();function Va(e,t){return T([e])?p.Update(tt(Qy,e),{},t):Tr(e,t)}function Wa(e,t){return T([e])?p.Update(tt(eI,e),{},t):kr(e,t)}function Ha(e,t){return T([e])?p.Update(tt(tI,e),{},t):Er(e,t)}function Ya(e,t){return T([e])?p.Update(tt(nI,e),{},t):wr(e,t)}function lc(e,t,n,r){let a=d(e,t,n);return Va(a,r)}function dc(e,t,n,r){let a=d(e,t,n);return Wa(a,r)}function fc(e,t,n,r){let a=d(e,t,n);return Ha(a,r)}function gc(e,t,n,r){let a=d(e,t,n);return Ya(a,r)}function Rr(e,t,n,r,a={}){return y("Conditional",[e,t,n,r],a)}function hc(e,t,n,r,a={}){return Ja({},D([],[]),e,t,n,r,a)}function rI(e,t,n,r,a,s){let m=pe(e,n,r);return b.IsExtendsUnion(m)?k([d(m.inferred,t,a),d(e,t,s)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,s)}function Ja(e,t,n,r,a,s,m){return T([n,r])?p.Update(rI(e,t,n,r,a,s),{},m):Rr(n,r,a,s,m)}function xc(e,t,n,r,a,s,m){let c=d(e,t,n),l=d(e,t,r);return Ja(e,t,c,l,a,s,m)}function Or(e,t={}){return y("ConstructorParameters",[e],t)}function yc(e,t={}){return Za(e,t)}function aI(e){let t=ne(e)?e.parameters:[],n=ft({},D([],[]),t);return X(n)}function Za(e,t){return T([e])?p.Update(aI(e),{},t):Or(e,t)}function Ic(e,t,n,r){let a=d(e,t,n);return Za(a,r)}function Pr(e,t,n={}){return y("Exclude",[e,t],n)}function bc(e,t,n={}){return Gn(e,t,n)}function Gn(e,t,n){return T([e,t])?p.Update(gr(e,t),{},n):Pr(e,t,n)}function $c(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Gn(s,m,a)}function Sr(e,t,n={}){return y("Extract",[e,t],n)}function vc(e,t,n={}){return Xa(e,t,n)}function oI(e,t){let n=pe({},e,t);return b.IsExtendsTrueLike(n)?[e]:[]}function iI(e,t){return e.reduce((n,r)=>[...n,...oI(r,t)],[])}function Tc(e,t){let n=Ce(e),r=x(n)?n.anyOf:[n],a=iI(r,t);return be(a)}function Xa(e,t,n){return T([e,t])?p.Update(Tc(e,t),{},n):Sr(e,t,n)}function kc(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Xa(s,m,a)}function sI(e){return e.reduce((t,n)=>pr(n)?[...t,O(n)]:t,[])}function Xt(e){let t=sI(e);return k(t)}function Sn(e,t,n={}){return y("Index",[e,t],n)}function Ec(e,t,n={}){let r=i.IsArray(t)?Xt(t):t;return Qa(e,r,n)}function wc(e,t){let n=Ve(e,t);return Re(n)}function Rc(e,t,n){let r=je(e,t,n);return Re(r)}function mI(e,t){let n=i.Keys(e).filter(f=>!i.HasPropertyKey(t,f)),r=i.Keys(t).filter(f=>!i.HasPropertyKey(e,f)),a=i.Keys(e).filter(f=>i.HasPropertyKey(t,f)),s=n.reduce((f,P)=>({...f,[P]:e[P]}),{}),m=r.reduce((f,P)=>({...f,[P]:t[P]}),{}),c=a.reduce((f,P)=>({...f,[P]:G([e[P],t[P]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function Oc(e){return e.reduce((t,n)=>mI(t,Re(n)),{})}function Pc(e){let t=qi(X(e));return Re(t)}function pI(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:be([e[s],t[s]])}),{})}function Sc(e,t){return i.ShiftLeft(e,(n,r)=>Sc(r,pI(t,Re(n))),()=>t)}function Mc(e){return i.ShiftLeft(e,(t,n)=>Sc(n,Re(t)),()=>W())}function Re(e){return me(e)?wc(e.$defs,e.$ref):z(e)?Rc(e.if,e.then,e.else):R(e)?Oc(e.allOf):x(e)?Mc(e.anyOf):j(e)?Pc(e.items):C(e)?e.properties:{}}function Qt(e){let t=Re(e);return $(t)}var uI=new RegExp("^(?:0|[1-9][0-9]*)$");function en(e){let t=`${e}`;return uI.test(t)?parseInt(t):e}function cI(e){return O(en(e))}function Cc(e){return e.map(t=>Ac(t))}function Ac(e){return R(e)?le(Cc(e.allOf)):x(e)?k(Cc(e.anyOf)):A(e)?cI(e.const):e}function qc(e,t){let n=Ac(t),r=pe({},n,Ie());return b.IsExtendsTrueLike(r)?e:A(t)&&i.IsEqual(t.const,"length")?Ie():L()}function Lc(e,t){let n=Ve(e,t);return $e(n)}function jc(e,t,n){let r=je(e,t,n);return $e(r)}function Fc(e){let t=Ee(e);return $e(t)}function Dc(e){let t=G(e);return $e(t)}function Nc(e){return[`${e}`]}function Kc(e){let t=ye(e);return $e(t)}function Uc(e){return e.reduce((t,n)=>[...t,...$e(n)],[])}function $e(e){return me(e)?Lc(e.$defs,e.$ref):z(e)?jc(e.if,e.then,e.else):de(e)?Fc(e.enum):R(e)?Dc(e.allOf):A(e)?Nc(e.const):Z(e)?Kc(e.pattern):x(e)?Uc(e.anyOf):[]}function tn(e){return $e(e)}function _n(e,t){return t.map(n=>zn(e,n))}function zn(e,t){return U(t)?ke(zn(e,t.items)):ne(t)?De(_n(e,t.parameters),zn(e,t.instanceType)):re(t)?Ne(_n(e,t.parameters),zn(e,t.returnType)):j(t)?X(_n(e,t.items)):x(t)?k(_n(e,t.anyOf)):R(t)?le(_n(e,t.allOf)):br(t)?$(e):t}function Gc(e,t){return zn(e,t)}function lI(e,t){let n=t in e?e[t]:L();return Gc(e,n)}function _c(e,t){return t.reduce((n,r)=>[...n,lI(e,r)],[])}function dI(e,t){let n=tn(t),r=_c(e,n);return be(r)}var fI=new RegExp(pt);function gI(e){return e.filter(n=>fI.test(n))}function hI(e){let t=nr(e),n=gI(t),r=_c(e,n);return be(r)}function zc(e,t){return J(t)?hI(e):dI(e,t)}function xI(e){return O(en(e))}function Bc(e){return e.map(t=>eo(t))}function eo(e){return R(e)?le(Bc(e.allOf)):x(e)?k(Bc(e.anyOf)):A(e)?xI(e.const):e}function yI(e,t){return e.reduceRight((n,r,a)=>{let s=pe({},O(a),t);return b.IsExtendsTrueLike(s)?[r,...n]:n},[])}function II(e,t){let n=eo(t),r=yI(e,n);return Qe(r)}function bI(e){return Qe(e)}function Vc(e,t){return A(t)&&i.IsEqual(t.const,"length")?O(e.length):J(t)||fe(t)?bI(e):II(e,t)}function Wc(e,t){return U(e)?qc(e.items,t):C(e)?zc(e.properties,t):j(e)?Vc(e.items,t):L()}function $I(e){return me(e)||z(e)||R(e)||x(e)?Qt(e):e}function Qa(e,t,n){return T([e,t])?p.Update(Wc($I(e),t),{},n):Sn(e,t,n)}function Hc(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Qa(s,m,a)}function Mr(e,t={}){return y("InstanceType",[e],t)}function Yc(e,t={}){return to(e,t)}function vI(e){return ne(e)?e.instanceType:L()}function to(e,t){return T([e])?p.Update(vI(e),{},t):Mr(e,t)}function Jc(e,t,n,r={}){let a=d(e,t,n);return to(a,r)}function Mn(e,t={}){return y("KeyOf",[e],t)}function Zc(e,t={}){return no(e,t)}function Xc(){return k([Ie(),Me(),Nt()])}function Qc(e){return Ie()}function TI(e){return e.reduce((n,r)=>pr(r)?[...n,O(en(r))]:W(),[])}function el(e){let t=i.Keys(e),n=TI(t);return Qe(n)}function tl(e){return Gt(e)}function nl(e){let t=e.map((n,r)=>O(r));return Qe(t)}function rl(e){return Y(e)?Xc():U(e)?Qc(e.items):C(e)?el(e.properties):ue(e)?tl(e):j(e)?nl(e.items):L()}function kI(e){return me(e)||z(e)||R(e)||x(e)?Qt(e):e}function no(e,t){return T([e])?p.Update(rl(kI(e)),{},t):Mn(e,t)}function al(e,t,n,r){let a=d(e,t,n);return no(a,r)}function Rn(e,t,n,r,a={}){return y("Mapped",[e,t,n,r],a)}function ol(e,t,n,r,a={}){return ro({},D([],[]),e,t,n,r,a)}function EI(e){let t=ye(e);return ea(t)}function wI(e){return e.reduce((t,n)=>[...t,...ea(n)],[])}function RI(e){let t=Ee(e);return ea(t)}function OI(e){return i.IsNumber(e)?[O(`${e}`)]:[O(e)]}function ea(e){return de(e)?RI(e.enum):A(e)?OI(e.const):Z(e)?EI(e.pattern):x(e)?wI(e.anyOf):[e]}function il(e){return ea(e)}function PI(e){return Z(e)?ye(e.pattern):e}function SI(e,t,n,r,a,s){let m=p.Assign(e,{[n.name]:r}),c=d(m,t,a),l=PI(c),I=d(m,t,s);return fi(l)||gi(l)?{[l.const]:I}:{}}function MI(e,t,n,r,a,s){return r.reduce((m,c)=>[...m,SI(e,t,n,c,a,s)],[])}function CI(e){return e.reduce((t,n)=>[...t,$(n)],[])}function sl(e,t,n,r,a,s){let m=il(r),c=MI(e,t,n,m,a,s),l=CI(c);return G(l)}function ro(e,t,n,r,a,s,m){return T([r])?p.Update(sl(e,t,n,r,a,s),{},m):Rn(n,r,a,s,m)}function ml(e,t,n,r,a,s,m){let c=d(e,t,r);return ro(e,t,n,c,a,s,m)}function AI(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>n.includes(s)).reduce((s,m)=>({...s,[m]:_u(r,m,t[m])}),{})}function qI(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>!n.includes(s)).reduce((s,m)=>({...s,[m]:d(r,D([],[]),t[m])}),{})}function LI(e,t,n){let r=Nu(t),a=AI(e,t,r),s=qI(e,t,r),m={...a,...s};return p.Update(m,{},n)}function ta(e,t,n,r){return LI(e,n,r)}function Cr(e,t={}){return y("NonNullable",[e],t)}function pl(e,t={}){return ao(e,t)}function jI(e){let t=k([Ft(),_t()]);return Gn(e,t,{})}function ao(e,t){return T([e])?p.Update(jI(e),{},t):Cr(e,t)}function ul(e,t,n,r){let a=d(e,t,n);return ao(a,r)}function Ar(e,t,n={}){return y("Omit",[e,t],n)}function cl(e,t,n={}){let r=i.IsArray(t)?Xt(t):t;return oo(e,r,n)}function na(e){let t=Qt(e);return C(t)?t.properties:W()}function FI(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function ll(e,t){let n=na(e),r=tn(t),a=FI(n,r);return $(a)}function oo(e,t,n){return T([e,t])?p.Update(ll(e,t),{},n):Ar(e,t,n)}function dl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return oo(s,m,a)}function qr(e,t={}){return y("Parameters",[e],t)}function fl(e,t={}){return io(e,t)}function DI(e){let t=re(e)?e.parameters:[],n=ft({},D([],[]),t);return X(n)}function io(e,t){return T([e])?p.Update(DI(e),{},t):qr(e,t)}function gl(e,t,n,r){let a=d(e,t,n);return io(a,r)}function Lr(e,t={}){return y("Partial",[e],t)}function hl(e,t={}){return so(e,t)}function xl(e,t){let n=Ve(e,t),r=We(n);return Ue(p.Assign(e,{[t]:r}),t)}function yl(e,t,n){let r=je(e,t,n);return We(r)}function Il(e){let t=G(e);return We(t)}function bl(e){let t=e.map(n=>We(n));return k(t)}function $l(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:vt(e[a])}),{});return $(t)}function We(e){return me(e)?xl(e.$defs,e.$ref):z(e)?yl(e.if,e.then,e.else):R(e)?Il(e.allOf):x(e)?bl(e.anyOf):C(e)?$l(e.properties):$({})}function so(e,t){return T([e])?p.Update(We(e),{},t):Lr(e,t)}function vl(e,t,n,r){let a=d(e,t,n);return so(a,r)}function jr(e,t,n={}){return y("Pick",[e,t],n)}function Tl(e,t,n={}){let r=i.IsArray(t)?Xt(t):t;return mo(e,r,n)}function NI(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function kl(e,t){let n=na(e),r=tn(t),a=NI(n,r);return $(a)}function mo(e,t,n){return T([e,t])?p.Update(kl(e,t),{},n):jr(e,t,n)}function El(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return mo(s,m,a)}function Fr(e,t={}){return y("ReadonlyObject",[e],t)}function po(e,t={}){return uo(e,t)}var wl=po;function Rl(e){return jt(ke(e))}function Ol(e,t){let n=Ve(e,t),r=He(n);return Ue(p.Assign(e,{[t]:r}),t)}function Pl(e,t,n){let r=je(e,t,n);return He(r)}function Sl(e){let t=G(e);return He(t)}function Ml(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Et(e[a])}),{});return $(t)}function Cl(e){return jt(X(e))}function Al(e){let t=e.map(n=>He(n));return k(t)}function He(e){return U(e)?Rl(e.items):me(e)?Ol(e.$defs,e.$ref):z(e)?Pl(e.if,e.then,e.else):R(e)?Sl(e.allOf):C(e)?Ml(e.properties):j(e)?Cl(e.items):x(e)?Al(e.anyOf):e}function uo(e,t){return T([e])?p.Update(He(e),{},t):Fr(e)}function ql(e,t,n,r){let a=d(e,t,n);return uo(a,r)}function Ll(e,t,n,r){return t.visited.includes(r)?n:r in e?d(e,D(t.callstack,[...t.visited,r]),e[r]):n}function jl(e,t){let n=Ve(e,t),r=Ye(n);return Ue(p.Assign(e,{[t]:r}),t)}function Fl(e,t,n){let r=je(e,t,n);return Ye(r)}function Dl(e){let t=G(e);return Ye(t)}function Nl(e){let t=e.map(n=>Ye(n));return k(t)}function Kl(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:fr(e[a])}),{});return $(t)}function Ye(e){return me(e)?jl(e.$defs,e.$ref):z(e)?Fl(e.if,e.then,e.else):R(e)?Dl(e.allOf):x(e)?Nl(e.anyOf):C(e)?Kl(e.properties):$({})}function Dr(e,t={}){return y("Required",[e],t)}function Ul(e,t={}){return co(e,t)}function co(e,t){return T([e])?p.Update(Ye(e),{},t):Dr(e,t)}function Gl(e,t,n,r){let a=d(e,t,n);return co(a,r)}function Nr(e,t={}){return y("ReturnType",[e],t)}function _l(e,t={}){return lo(e,t)}function KI(e){return re(e)?e.returnType:L()}function lo(e,t){return T([e])?p.Update(KI(e),{},t):Nr(e,t)}function zl(e,t,n,r={}){let a=d(e,t,n);return lo(a,r)}function Kr(e,t){return y("With",[e,t],{})}function Bl(e,t){return fo(e,t)}function fo(e,t){return T([e])?p.Update(e,{},t):Kr(e,t)}function Vl(e,t,n,r){let a=d(e,t,n);return fo(a,r)}function UI(e){return ut(e)?j(e.items)?go(e.items.items):V(e.items)?[e]:ae(e.items)?[e]:[L()]:[e]}function go(e){return e.reduce((n,r)=>[...n,...UI(r)],[])}function D(e,t){return{callstack:e,visited:t}}function T(e){return i.ShiftLeft(e,(t,n)=>ae(t)?!1:T(n),()=>!0)}function Fn(e,t,n){return i.Keys(n).reduce((r,a)=>({...r,[a]:d(e,t,n[a])}),{})}function ft(e,t,n){let r=we(e,t,n);return go(r)}function we(e,t,n){return n.map(r=>d(e,t,r))}function GI(e,t){let n=ce(e)?gn(t,{}):t,r=wt(e)?fn(n,{}):n;return kt(e)?Bn(r,{}):r}function _I(e,t,n,r,a){return i.IsEqual(n,"AddImmutable")?Wl(e,t,r[0],a):i.IsEqual(n,"RemoveImmutable")?rc(e,t,r[0],a):i.IsEqual(n,"AddReadonly")?_o(e,t,r[0],a):i.IsEqual(n,"RemoveReadonly")?Pi(e,t,r[0],a):i.IsEqual(n,"AddOptional")?zo(e,t,r[0],a):i.IsEqual(n,"RemoveOptional")?Ci(e,t,r[0],a):i.IsEqual(n,"Capitalize")?lc(e,t,r[0],a):i.IsEqual(n,"Conditional")?xc(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"ConstructorParameters")?Ic(e,t,r[0],a):i.IsEqual(n,"Evaluate")?Vu(e,t,r[0],a):i.IsEqual(n,"Exclude")?$c(e,t,r[0],r[1],a):i.IsEqual(n,"Extract")?kc(e,t,r[0],r[1],a):i.IsEqual(n,"Index")?Hc(e,t,r[0],r[1],a):i.IsEqual(n,"InstanceType")?Jc(e,t,r[0],a):i.IsEqual(n,"Interface")?Lu(e,t,r[0],r[1],a):i.IsEqual(n,"KeyOf")?al(e,t,r[0],a):i.IsEqual(n,"Lowercase")?dc(e,t,r[0],a):i.IsEqual(n,"Mapped")?ml(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"Module")?ta(e,t,r[0],a):i.IsEqual(n,"NonNullable")?ul(e,t,r[0],a):i.IsEqual(n,"Pick")?El(e,t,r[0],r[1],a):i.IsEqual(n,"Parameters")?gl(e,t,r[0],a):i.IsEqual(n,"Partial")?vl(e,t,r[0],a):i.IsEqual(n,"Omit")?dl(e,t,r[0],r[1],a):i.IsEqual(n,"ReadonlyObject")?ql(e,t,r[0],a):i.IsEqual(n,"Record")?Yi(e,t,r[0],r[1],a):i.IsEqual(n,"Required")?Gl(e,t,r[0],a):i.IsEqual(n,"ReturnType")?zl(e,t,r[0],a):i.IsEqual(n,"TemplateLiteral")?Qp(e,t,r[0],a):i.IsEqual(n,"Uncapitalize")?fc(e,t,r[0],a):i.IsEqual(n,"Uppercase")?gc(e,t,r[0],a):i.IsEqual(n,"With")?Vl(e,t,r[0],r[1]):y(n,r,a)}function zI(e,t,n){let r=ae(n)?Ll(e,t,n,n.$ref):U(n)?ke(d(e,t,n.items),tr(n)):Zt(n)?Qr(e,t,n.target,n.arguments):ne(n)?De(we(e,t,n.parameters),d(e,t,n.instanceType),Bo(n)):re(n)?Ne(we(e,t,n.parameters),d(e,t,n.returnType),Vo(n)):z(n)?Tt(d(e,t,n.if),d(e,t,n.then),d(e,t,n.else),Xo(n)):R(n)?le(we(e,t,n.allOf),ri(n)):C(n)?$(Fn(e,t,n.properties),Jo(n)):ue(n)?Ji(Ae(n),d(e,t,he(n))):ut(n)?Pt(d(e,t,n.items)):j(n)?X(ft(e,t,n.items),Oi(n)):x(n)?k(we(e,t,n.anyOf),xi(n)):n;return GI(n,r)}function d(e,t,n){return at(n)?_I(e,t,n.action,n.parameters,n.options):zI(e,t,n)}function ho(e,t){return d(e,D([],[]),t)}function BI(e){return p.Update(e,{"~immutable":!0},{})}function Bn(e,t){return p.Update(BI(e),{},t)}function Wl(e,t,n,r){let a=d(e,t,n);return Bn(a,r)}function Zm(e,t={}){return y("AddImmutable",[e],t)}function jt(e,t={}){return Bn(e,t)}function Xm(e,t={}){return y("Evaluate",[e],t)}function Hl(e,t={}){return za(e,t)}function Qm(e,t={}){return y("Module",[e],t)}function Yl(e,t={}){return ta({},D([],[]),e,t)}function Jl(...e){let[t,n,r]=Ge.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Hp(n),s=i.IsArray(a)&&i.IsEqual(a.length,2)?d(t,D([],[]),a[0]):L();return p.Update(s,{},r)}var H={};yt(H,{Any:()=>Lt,Array:()=>ke,BigInt:()=>In,Boolean:()=>sr,Call:()=>tc,Capitalize:()=>mc,Codec:()=>ir,Conditional:()=>hc,Constructor:()=>De,ConstructorParameters:()=>yc,Cyclic:()=>Ue,Decode:()=>si,DecodeBuilder:()=>yn,Dependent:()=>Tt,Encode:()=>mi,EncodeBuilder:()=>xn,Enum:()=>ni,Evaluate:()=>Hl,Exclude:()=>bc,Extends:()=>pe,ExtendsResult:()=>b,Extract:()=>vc,Function:()=>Ne,Generic:()=>ot,Identifier:()=>bn,Immutable:()=>pi,Index:()=>Ec,Infer:()=>hn,InstanceType:()=>Yc,Instantiate:()=>ho,Integer:()=>Rt,Interface:()=>ju,Intersect:()=>le,IsAny:()=>Y,IsArray:()=>U,IsBigInt:()=>ze,IsBoolean:()=>Se,IsCall:()=>Zt,IsCodec:()=>or,IsConstructor:()=>ne,IsCyclic:()=>me,IsDependent:()=>z,IsEnum:()=>de,IsEnumValue:()=>ti,IsFunction:()=>re,IsGeneric:()=>qt,IsIdentifier:()=>di,IsImmutable:()=>kt,IsInfer:()=>V,IsInteger:()=>fe,IsIntersect:()=>R,IsKind:()=>h,IsLiteral:()=>A,IsNever:()=>it,IsNull:()=>Dt,IsNumber:()=>J,IsObject:()=>C,IsOptional:()=>ce,IsParameter:()=>hi,IsReadonly:()=>wt,IsRecord:()=>ue,IsRef:()=>ae,IsRefine:()=>ga,IsRest:()=>ut,IsSchema:()=>Q,IsString:()=>ge,IsSymbol:()=>st,IsTemplateLiteral:()=>Z,IsThis:()=>br,IsTuple:()=>j,IsUndefined:()=>zt,IsUnion:()=>x,IsUnknown:()=>ee,IsUnsafe:()=>ar,IsVoid:()=>Be,KeyOf:()=>Zc,Literal:()=>O,Lowercase:()=>pc,Mapped:()=>ol,Module:()=>Yl,Never:()=>L,NonNullable:()=>pl,Null:()=>Ft,Number:()=>Ie,Object:()=>$,Omit:()=>cl,Optional:()=>Ho,Parameter:()=>Ot,Parameters:()=>fl,Partial:()=>hl,Pick:()=>Tl,Readonly:()=>ui,ReadonlyObject:()=>po,ReadonlyType:()=>wl,Record:()=>xr,RecordKey:()=>Gt,RecordPattern:()=>Ae,RecordValue:()=>he,Ref:()=>Xe,Refine:()=>ci,Required:()=>Ul,Rest:()=>Pt,ReturnType:()=>_l,Script:()=>Jl,String:()=>Me,Symbol:()=>Nt,TemplateLiteral:()=>tu,This:()=>Ir,Tuple:()=>X,Uncapitalize:()=>uc,Undefined:()=>_t,Union:()=>k,Unknown:()=>oe,Unsafe:()=>Zo,Uppercase:()=>cc,Void:()=>$r,With:()=>Bl});var nn="submit_review_report",rn="submit_test_gap_candidates",Vn="submit_filtered_test_gaps",VI=H.Object({verdict:H.Union([H.Literal("PASS"),H.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:H.String({description:"One short sentence summarizing the verdict."}),reasons:H.Array(H.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:H.Array(H.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 Zl(e){return{name:nn,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:VI,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 WI=H.Object({gaps:H.Array(H.Object({description:H.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:H.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 Xl(e){return{name:rn,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:WI,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 HI=H.Object({gaps:H.Array(H.Object({description:H.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:H.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 Ql(e){return{name:Vn,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:HI,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 YI={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 ed(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 td=["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."],nd=["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 rd(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.","",YI[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 \`${nn}\` tool exactly once with your structured verdict. That tool call is your only way to report a result.`),r.join(`
8
- `)}function ad(e,t){let n=[...ed("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.",...td,"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.","",...nd,"","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&&n.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),n.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 \`${rn}\` 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.`),n.join(`
9
- `)}function od(e,t){let n=[...ed("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.",...td,"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.","",...nd,"- 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&&n.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),n.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 \`${rn}\` 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.`),n.join(`
10
- `)}function id(e,t,n){let r=["You are a strict, skeptical fairness auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","Two specialized research agents reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) 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 n&&r.push("","Fairness methodology:",n),r.push("","For every gap you keep, give a short justification citing where in `agent_prompt.md` or the repo it is grounded. Preserve POSITIVE:/NEGATIVE: prefix when applicable.",`When you are done, call the \`${Vn}\` tool exactly once with your final filtered list (which may be empty). That tool call is your only way to report a result.`),r.join(`
11
- `)}var sd=900*1e3,Io=["read","grep","find","ls"];function bo(e){return e==="off"?void 0:e}async function $o(e,t){let n=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(n="done")}),new Promise(r=>{setTimeout(()=>{n="timedOut",r()},sd)}),new Promise(r=>{if(t.aborted)return r();t.addEventListener("abort",()=>{n="cancelled",r()},{once:!0})})]),n}async function md(e){let t={},n=e.model,{session:r}=await xo({cwd:e.tempDir,model:n,thinkingLevel:bo(e.thinkingLevel),tools:[...Io,nn],customTools:[Zl(t)],sessionManager:yo.inMemory()});try{let a=await $o(async()=>{await r.prompt(rd(e.role,e.rubric,e.fairnessRules))},e.cancelSignal);if(a==="cancelled")return await r.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer cancelled`,reasons:["Cancelled by user."],notes:[]};if(a==="timedOut")return await r.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer timed out`,reasons:[`Reviewer did not finish within ${sd/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 ${nn}.`],notes:[]}}async function vo(e){let t={},n=e.kind==="positive"?ad:od,r=e.model,{session:a}=await xo({cwd:e.tempDir,model:r,thinkingLevel:bo(e.thinkingLevel),tools:[...Io,rn],customTools:[Xl(t)],sessionManager:yo.inMemory()});try{let s=await $o(async()=>{await a.prompt(n(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:[]}}async function pd(e){let t={},n=e.model,{session:r}=await xo({cwd:e.tempDir,model:n,thinkingLevel:bo(e.thinkingLevel),tools:[...Io,Vn],customTools:[Ql(t)],sessionManager:yo.inMemory()});try{let a=await $o(async()=>{await r.prompt(id(e.candidates,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}import{existsSync as oa,mkdirSync as JI,readFileSync as To,writeFileSync as ZI}from"node:fs";import{dirname as XI,join as ud}from"node:path";import{getAgentDir as cd}from"@earendil-works/pi-coding-agent";var ra=ud(cd(),"checks-config.json"),aa=ud(cd(),"settings.json"),QI=["off","minimal","low","medium","high","xhigh","max"];function ld(e){return e?.reasoning?QI.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function ko(){try{if(!oa(ra))return null;let e=JSON.parse(To(ra,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function dd(e){let t=XI(ra);oa(t)||JI(t,{recursive:!0}),ZI(ra,JSON.stringify(e,null,2),"utf-8")}function fd(){try{return oa(aa)?JSON.parse(To(aa,"utf-8")).enabledModels??[]:[]}catch{return[]}}function gd(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function eb(){try{if(oa(aa))return JSON.parse(To(aa,"utf-8"))}catch{}return{}}function hd(){let e=eb().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function tb(e){return e.replace(/\\/g,"/")}function nb(e){return`'${e.replace(/'/g,"'\\''")}'`}async function xd(e,t,n){if((await e.exec("git",["rev-parse","HEAD"],{cwd:t,timeout:15e3})).code!==0)return{status:"error",error:"Not a git repository, or it has no commits yet."};let a=`git archive HEAD | tar -x -C ${nb(tb(n))}`,s=await e.exec(hd(),["-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 Oe="checks_progress";function Je(e,t,n){let r=n>0?Math.min(1,t/n):0,a=Math.round(24*r),s="\u2588".repeat(a)+"\u2591".repeat(Math.max(0,24-a));return[`checks: ${e} [${s}] ${t}/${n}`]}import{existsSync as rb,readFileSync as ab}from"node:fs";var nt=[{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 Eo=["agent_prompt.md","solution.patch","test.patch"];function ob(e=new Date){let t=(s,m=2)=>String(s).padStart(m,"0"),n=-e.getTimezoneOffset(),r=n>=0?"+":"-",a=Math.abs(n);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${r}${t(Math.floor(a/60))}:${t(a%60)}`}function yd(e){try{if(!rb(e))return{};let t=JSON.parse(ab(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Id(e){let{existingReport:t,config:n,runReviewers:r,byRole:a,runGapStages:s,testGaps:m,gapAnalysisIncomplete:c,positiveGapFinderStatus:l,negativeGapFinderStatus:I,gapFilterStatus:f}=e,P={...t,timestamp:ob(),model:`${n.provider}/${n.modelId}`,thinkingLevel:n.thinkingLevel};if(r){let se={...t.reports&&typeof t.reports=="object"?t.reports:{},...a};P.reports=se,nt.every(te=>se[te.key])?P.overall=nt.every(te=>se[te.key].verdict==="PASS")?"PASS":"FAIL":delete P.overall}return s&&(P.testGaps=m,c?P.testGapAnalysisNote=`Gap analysis did not fully complete (positive finder: ${l}, negative finder: ${I}, filter: ${f}); testGaps may be incomplete.`:delete P.testGapAnalysisNote),P}function bd(e){let{merged:t,runReviewers:n,activeRoles:r,byRole:a,runGapStages:s}=e,m=typeof t.overall=="string"?t.overall:void 0,c=Array.isArray(t.testGaps)?t.testGaps.length:0,l=n?Object.fromEntries(r.filter(f=>a[f.key]).map(f=>[f.key,a[f.key].verdict])):void 0,I=[];if(l&&I.push(r.map(f=>`${f.label}: ${l[f.key]??"?"}`).join(", ")),m){let f=m==="PASS"&&c>0?" (with test gaps)":"";I.push(`Overall: ${m}${f}`)}return s&&I.push(c>0?`${c} test gap(s) found`:"no test gaps found"),{content:`Checks: ${I.join(" | ")}`,details:{overall:m,hasTestGaps:c>0,gapsCount:c,roleVerdicts:l,showGaps:s}}}var $d=`## The problem description (aka the task)\r
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")&&gt(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 tf(e,t){let n=[...Xd("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.",...Zd,"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.","",...Qd,"","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&&n.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),n.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 \`${yn}\` 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.`),n.join(`
13
+ `)}function nf(e,t){let n=[...Xd("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.",...Zd,"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.","",...Qd,"- 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&&n.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),n.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 \`${yn}\` 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.`),n.join(`
14
+ `)}function rf(e,t,n){let r=["You are a strict, skeptical fairness auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","Two specialized research agents reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) 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 n&&r.push("","Fairness methodology:",n),r.push("","For every gap you keep, give a short justification citing where in `agent_prompt.md` or the repo it is grounded. Preserve POSITIVE:/NEGATIVE: prefix when applicable.",`When you are done, call the \`${mr}\` tool exactly once with your final filtered list (which may be empty). That tool call is your only way to report a result.`),r.join(`
15
+ `)}function af(){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 hv(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 \`${wn}/solver_${e.index}/\``}function of(e){return["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 \`${wn}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${wn}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(hv),"","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.","","Ground rules \u2014 do not overreach:","- Every gap must be grounded in a specific requirement/sentence in `agent_prompt.md` (or an unambiguous behavior in `solution.patch` that directly implements a prompt requirement) \u2014 do not invent requirements the prompt doesn't support.","- 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.","- Do not flag a solver difference if `test.patch` already exercises and would catch the wrong behavior, or if the difference is a defensible implementation detail the prompt doesn't mandate (naming, file layout, helper structure, etc. \u2014 unless the prompt or repo conventions specifically call for 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.","",`When you are done, call the \`${pr}\` tool exactly once with your final list (which may be empty). That tool call is your only way to report a result.`].join(`
17
+ `)}var sf=900*1e3,La=["read","grep","find","ls"];function lr(e){return e==="off"?void 0:e}async function dr(e,t,n=sf){let r=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(r="done")}),new Promise(a=>{setTimeout(()=>{r="timedOut",a()},n)}),new Promise(a=>{if(t.aborted)return a();t.addEventListener("abort",()=>{r="cancelled",a()},{once:!0})})]),r}async function mf(e){let t={},n=e.model,{session:r}=await ur({cwd:e.tempDir,model:n,thinkingLevel:lr(e.thinkingLevel),tools:[...La,hn],customTools:[Wd(t)],sessionManager:cr.inMemory()});try{let a=await dr(async()=>{await r.prompt(ef(e.role,e.rubric,e.fairnessRules))},e.cancelSignal);if(a==="cancelled")return await r.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer cancelled`,reasons:["Cancelled by user."],notes:[]};if(a==="timedOut")return await r.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer timed out`,reasons:[`Reviewer did not finish within ${sf/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 ${hn}.`],notes:[]}}async function ni(e){let t={},n=e.kind==="positive"?tf:nf,r=e.model,{session:a}=await ur({cwd:e.tempDir,model:r,thinkingLevel:lr(e.thinkingLevel),tools:[...La,yn],customTools:[Hd(t)],sessionManager:cr.inMemory()});try{let s=await dr(async()=>{await a.prompt(n(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 yv=["read","grep","find","ls","write","edit","bash"];async function pf(e){let t=e.model;try{let n=cr.inMemory(),{session:r}=await ur({cwd:e.solverDir,model:t,thinkingLevel:lr(e.thinkingLevel),tools:[...yv],sessionManager:n}),a=await dr(async()=>{await r.prompt(af())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await r.abort(),{outcome:a,trajectory:n.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function uf(e){let t={},n=e.model,{session:r}=await ur({cwd:e.tempDir,model:n,thinkingLevel:lr(e.thinkingLevel),tools:[...La,pr],customTools:[Jd(t)],sessionManager:cr.inMemory()});try{let a=await dr(async()=>{await r.prompt(of(e.solverResults))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}async function cf(e){let t={},n=e.model,{session:r}=await ur({cwd:e.tempDir,model:n,thinkingLevel:lr(e.thinkingLevel),tools:[...La,mr],customTools:[Yd(t)],sessionManager:cr.inMemory()});try{let a=await dr(async()=>{await r.prompt(rf(e.candidates,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var he="checks_progress";function Ee(e,t,n){let r=n>0?Math.min(1,t/n):0,a=Math.round(24*r),s="\u2588".repeat(a)+"\u2591".repeat(Math.max(0,24-a));return[`checks: ${e} [${s}] ${t}/${n}`]}import{existsSync as xv,readFileSync as Iv}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 ri=["agent_prompt.md","solution.patch","test.patch"];function ai(e=new Date){let t=(s,m=2)=>String(s).padStart(m,"0"),n=-e.getTimezoneOffset(),r=n>=0?"+":"-",a=Math.abs(n);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${r}${t(Math.floor(a/60))}:${t(a%60)}`}function lf(e){try{if(!xv(e))return{};let t=JSON.parse(Iv(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function df(e){let{existingReport:t,config:n,runReviewers:r,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,j={...t,timestamp:ai(),model:`${n.provider}/${n.modelId}`,thinkingLevel:n.thinkingLevel};if(r){let ne={...t.reports&&typeof t.reports=="object"?t.reports:{},...a};j.reports=ne,ut.every(Me=>ne[Me.key])?j.overall=ut.every(Me=>ne[Me.key].verdict==="PASS")?"PASS":"FAIL":delete j.overall}return s&&(j.testGaps=m,c?j.testGapAnalysisNote=`Gap analysis did not fully complete (positive finder: ${l}, negative finder: ${d}, filter: ${g}); testGaps may be incomplete.`:delete j.testGapAnalysisNote),b&&(j.solverRunSummary=V.map(le=>({index:le.index,status:le.status,passed:le.passed,durationMs:le.durationMs,artifactsDir:le.artifactsDir})),j.solverGaps=G,w?j.solverGapAnalysisNote=`Solver-gap analysis did not fully complete (comparison reviewer: ${Ce}); solverGaps may be incomplete.`:delete j.solverGapAnalysisNote),j}function ff(e){let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n>0?`${n}m ${r}s`:`${r}s`}function gf(e){let{merged:t,runReviewers:n,activeRoles:r,byRole:a,runGapStages:s,runSolverGapFinder:m}=e,c=Array.isArray(t.testGaps)?t.testGaps.length:0,l=n?Object.fromEntries(r.filter(w=>a[w.key]).map(w=>[w.key,a[w.key].verdict])):void 0,d=n&&typeof t.overall=="string"?t.overall:void 0,g=[];if(l&&g.push(r.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 hf=`## The problem description (aka the task)\r
12
18
  P1: Aligns with the repo's philosophy\r
13
19
  P2: Self-contained \u2014 solvable from the repo and description alone\r
14
20
  P3: Clear, concise, and unambiguous \u2014 describes what to build or fix and don't leave points for guessing\r
@@ -35,7 +41,7 @@ That's the golden solution \u2014 the proof that your task is solvable and that
35
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
36
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
37
43
  S3: No irrelevant changes to the code \u2014 if something is unrelated to your task, keep it as it is.\r
38
- S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,ib=`# Agent Evaluation Guidelines\r
44
+ S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,bv=`# Agent Evaluation Guidelines\r
39
45
  \r
40
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
41
47
  \r
@@ -315,5 +321,5 @@ Keep changes separated when possible:\r
315
321
  - Avoid unrelated dependency or lockfile changes.\r
316
322
  - Regenerate patches after every prompt/test/solution change.\r
317
323
  \r
318
- ---`;function vd(){let e=$d.split(/\r?\n(?=## )/g),t={};for(let n of nt){let r=e.find(a=>n.rubricHeading.test(a.trim()));t[n.key]=(r??$d).trim()}return t}function Td(){return ib.trim()}var ia=!1,an;function sa(){return ia}function kd(){return ia=!0,an=new AbortController,an}function Ed(){ia=!1,an=void 0}function wd(){return!ia||!an||an.signal.aborted?!1:(an.abort(),!0)}var fb="Ctrl+Shift+X",wo=[{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:"--config",label:"--config",description:"Set the reviewer model and thinking level"}];function gb(e){let t=e.trimStart(),n=/\s$/.test(t),r=t.trimEnd().split(/\s+/).filter(Boolean),a=n?"":r.at(-1)??"",s=new Set(n?r:r.slice(0,-1)),m=n?t:t.slice(0,t.length-a.length),c=s.has("--config"),l=[...s].some(f=>f!=="--config"),I=wo.filter(f=>s.has(f.value)||c||l&&f.value==="--config"?!1:f.value.startsWith(a));return I.length>0?I.map(f=>({...f,value:`${m}${f.value}`})):null}async function hb(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=fd();if(t.length===0){e.ui.notify("No enabledModels configured in settings.json.","error");return}let n=ko(),r=e.modelRegistry.getAll(),a=t.map(f=>{let P=gd(f);if(!P)return null;let N=r.find(ve=>ve.provider===P.provider&&ve.id===P.modelId),se=n?.provider===P.provider&&n?.modelId===P.modelId,te=N?`${N.name} (${f})`:f;return{ref:f,parsed:P,display:se?`${te} [current]`:te,found:N,isCurrent:se}}).filter(f=>f!==null);if(a.length===0){e.ui.notify("Could not resolve any enabledModels entries.","error");return}let s=[...a].sort((f,P)=>f.isCurrent===P.isCurrent?0:f.isCurrent?-1:1),m=await e.ui.select("Select model for checks reviewer agents",s.map(f=>f.display));if(!m)return;let c=a.find(f=>f.display===m);if(!c)return;let l="off",I=ld(c.found);if(I.length>1){let f=c.isCurrent?n?.thinkingLevel:void 0,P=[...I].sort((te,ve)=>te===f==(ve===f)?0:te===f?-1:1),N=te=>te===f?`${te} [current]`:te,se=await e.ui.select("Select thinking level for reviewer agents",P.map(N));if(!se)return;l=P.find(te=>N(te)===se)??se}dd({provider:c.parsed.provider,modelId:c.parsed.modelId,thinkingLevel:l}),e.ui.notify(`checks config saved: ${c.parsed.provider}/${c.parsed.modelId} (thinking: ${l})`,"info")}function Rd(e){e.registerCommand("checks",{description:"Strict review of agent_prompt.md/test.patch/solution.patch. Requires an option \u2014 see /checks.",getArgumentCompletions:gb,handler:async(t,n)=>{let r=t.trim();if(r===""){n.ui.notify(wo.map(F=>`${F.value} \u2014 ${F.description}`).join(`
319
- `),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],s=new Set(wo.map(F=>F.value)),m=a.filter(F=>!s.has(F));if(m.length>0){n.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){n.ui.notify("--config cannot be combined with other options.","warning");return}await hb(n);return}let c=new Set;if(a.includes("--all")||a.includes("--review"))for(let F of nt)c.add(F.key);for(let F of nt)a.includes(`--${F.key}`)&&c.add(F.key);let l=a.includes("--all")||a.includes("--gap-finder"),I=nt.filter(F=>c.has(F.key)),f=I.length>0;if(!f&&!l){n.ui.notify(`Nothing to run for: ${a.join(" ")}. Run /checks with no arguments to see the available options.`,"warning");return}let P=a.join(" ");if(sa()){n.ui.notify("A checks run is already in progress.","warning");return}let N=ko();if(!N){n.ui.notify("No reviewer model configured. Run /checks --config first.","error");return}let se=n.modelRegistry.find(N.provider,N.modelId);if(!se){n.ui.notify(`Configured model ${N.provider}/${N.modelId} not found. Run /checks --config again.`,"error");return}if(!n.modelRegistry.hasConfiguredAuth(se)){n.ui.notify(`No auth configured for ${N.provider}/${N.modelId}.`,"error");return}let te=Eo.filter(F=>!pb(Wn(n.cwd,F)));if(te.length>0){n.ui.notify(`Missing required file(s) in project root: ${te.join(", ")}`,"error");return}let ve=kd(),Pe=(f?I.length:0)+(l?3:0);n.ui.setWidget(Oe,Je("preparing clean snapshot",0,Pe)),n.ui.notify(`checks (${P}) started. Press ${fb} to cancel.`,"info");let on;try{let F=Wn(db(),`checks-${sb()}`);ub(F,{recursive:!0}),on=F;let Hn=await xd(e,n.cwd,F);if(Hn.status==="error"){n.ui.notify(`checks: ${Hn.error}`,"error");return}for(let Fe of Eo)mb(Wn(n.cwd,Fe),Wn(F,Fe));let sn=vd(),mn=Td(),Te=0,pn=[];if(f&&(n.ui.setWidget(Oe,Je("reviewing",Te,Pe)),pn=await Promise.all(I.map(Fe=>md({pi:e,role:Fe,tempDir:F,model:se,thinkingLevel:N.thinkingLevel,rubric:sn[Fe.key],fairnessRules:mn,cancelSignal:ve.signal}).then(xt=>(Te+=1,n.ui.setWidget(Oe,Je("reviewing",Te,Pe)),xt)))),ve.signal.aborted)){n.ui.notify("checks: cancelled.","warning");return}let gt={status:"ok",gaps:[]},ht={status:"ok",gaps:[]},At={status:"ok",gaps:[]};if(l){let Fe={tempDir:F,model:se,thinkingLevel:N.thinkingLevel,testRubric:sn.tests,fairnessRules:mn,cancelSignal:ve.signal};if(n.ui.setWidget(Oe,Je("finding test gaps",Te,Pe)),[gt,ht]=await Promise.all([vo({...Fe,kind:"positive"}).then(ua=>(Te+=1,n.ui.setWidget(Oe,Je("finding test gaps",Te,Pe)),ua)),vo({...Fe,kind:"negative"}).then(ua=>(Te+=1,n.ui.setWidget(Oe,Je("finding test gaps",Te,Pe)),ua))]),ve.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}let xt=[...gt.gaps,...ht.gaps];if(xt.length>0&&(n.ui.setWidget(Oe,Je("validating test gaps",Te,Pe)),At=await pd({tempDir:F,model:se,thinkingLevel:N.thinkingLevel,testRubric:sn.tests,fairnessRules:mn,candidates:xt,cancelSignal:ve.signal})),Te+=1,n.ui.setWidget(Oe,Je("validating test gaps",Te,Pe)),ve.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}n.ui.setWidget(Oe,Je("finalizing report",Pe,Pe));let ma={};I.forEach((Fe,xt)=>{pn[xt]&&(ma[Fe.key]=pn[xt])});let Pd=At.gaps,Sd=gt.gaps.length>0||ht.gaps.length>0,Md=l&&(gt.status!=="ok"||ht.status!=="ok"||Sd&&At.status!=="ok"),pa=Wn(n.cwd,"shipd_report.json"),Cd=yd(pa),Ro=Id({existingReport:Cd,config:N,runReviewers:f,byRole:ma,runGapStages:l,testGaps:Pd,gapAnalysisIncomplete:Md,positiveGapFinderStatus:gt.status,negativeGapFinderStatus:ht.status,gapFilterStatus:At.status}),Oo=bd({merged:Ro,runReviewers:f,activeRoles:I,byRole:ma,runGapStages:l});e.sendMessage({customType:"shipd_checks_report",content:Oo.content,display:!0,details:Oo.details}),lb(pa,JSON.stringify(Ro,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${pa}`,"info")}catch(F){n.ui.notify(`checks failed: ${F instanceof Error?F.message:String(F)}`,"error")}finally{if(n.ui.setWidget(Oe,void 0),on)try{cb(on,{recursive:!0,force:!0})}catch{}Ed()}}})}var Od=xb.ctrlShift("x");function Ib(e){e.registerMessageRenderer("shipd_checks_report",(t,n,r)=>{let a=t.details??{},s=l=>l==="PASS"?r.fg("success",l):r.fg("error",l),m=[];if(a.roleVerdicts)for(let[l,I]of Object.entries(a.roleVerdicts))m.push(`${l}: ${s(I)}`);if(a.overall){let l=a.overall==="PASS"&&a.hasTestGaps?" (with test gaps)":"";m.push(`Overall: ${s(a.overall)}${l}`)}if(a.showGaps){let l=a.gapsCount??0;m.push(l>0?r.fg("warning",`${l} test gap(s) found`):r.fg("success","no test gaps found"))}let c=m.length>0?m.join(" "):r.fg("dim","nothing to report");return new yb(`${r.bold("Checks: ")}${c}`,0,0)}),e.registerShortcut(Od,{description:"Cancel an in-progress /checks run",handler:t=>{sa()&&wd()&&(t.ui.setWidget(Oe,[`checks: cancelling (${Od})...`]),t.ui.notify("checks: cancelling...","warning"))}}),Rd(e)}export{Ib as default};
324
+ ---`;function yf(){let e=hf.split(/\r?\n(?=## )/g),t={};for(let n of ut){let r=e.find(a=>n.rubricHeading.test(a.trim()));t[n.key]=(r??hf).trim()}return t}function xf(){return bv.trim()}var qa=!1,xn;function ja(){return qa}function If(){return qa=!0,xn=new AbortController,xn}function bf(){qa=!1,xn=void 0}function vf(){return!qa||!xn||xn.signal.aborted?!1:(xn.abort(),!0)}var Rv="Ctrl+Shift+X",oi=[{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 Sv(e){let t=e.trimStart(),n=/\s$/.test(t),r=t.trimEnd().split(/\s+/).filter(Boolean),a=n?"":r.at(-1)??"",s=new Set(n?r:r.slice(0,-1)),m=n?t:t.slice(0,t.length-a.length),c=s.has("--config"),l=[...s].some(g=>g!=="--config"),d=oi.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 Rf(e,t,n){let r=yi();if(r.length===0)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let a=e.modelRegistry.getAll(),s=r.map(d=>{let g=xi(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(n,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,n){let r=e.modelRegistry.getAll().find(a=>a.provider===t&&a.id===n);return gi(r)}var Fa={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:za,solverCount:vr};function Sf(e,t,n){let r=t?Da(e,t.provider,t.modelId):["off"],a=n.provider?Da(e,n.provider,n.modelId):["off"];return[{id:"reviewer-model",section:"Reviewer",label:"Model",value:t?`${t.provider}/${t.modelId}`:"not set",kind:"model"},{id:"reviewer-thinking",section:"Reviewer",label:"Thinking level",value:t?.thinkingLevel??"off",kind:"cycle",values:r},{id:"solvergap-model",section:"Solver Gap Finder",label:"Model",value:n.provider?`${n.provider}/${n.modelId}`:"not set",kind:"model"},{id:"solvergap-thinking",section:"Solver Gap Finder",label:"Thinking level",value:n.thinkingLevel,kind:"cycle",values:a},{id:"solvergap-timeout",section:"Solver Gap Finder",label:"Timeout",value:`${n.timeoutMinutes} min`,kind:"cycle",values:[10,20,30,40,50,di].filter((s,m,c)=>s>=li&&c.indexOf(s)===m).map(s=>`${s} min`)},{id:"solvergap-solver-count",section:"Solver Gap Finder",label:"Parallel agents",value:String(n.solverCount),kind:"cycle",values:Array.from({length:fi-Va+1},(s,m)=>`${Va+m}`)}]}var ii=class{constructor(t,n,r,a,s,m){this.ctx=t;this.settingsListTheme=n;this.theme=r;this.onCycleSaved=a;this.onActivateModel=s;this.onExit=m;this.rows=Sf(t,dt(),dt()?.solverGap??Fa)}selectedIndex=0;rows;refresh(){let t=dt();this.rows=Sf(this.ctx,t,t?.solverGap??Fa),this.selectedIndex=Math.min(this.selectedIndex,this.rows.length-1)}invalidate(){}render(t){let n=[],r=Math.min(30,Math.max(...this.rows.map(s=>s.label.length))),a;for(let s=0;s<this.rows.length;s++){let m=this.rows[s];if(!m)continue;m.section!==a&&(a!==void 0&&n.push(""),n.push(this.theme.bold(this.theme.fg("accent",m.section))),a=m.section);let c=s===this.selectedIndex,l=c?this.settingsListTheme.cursor:" ",d=m.label+" ".repeat(Math.max(0,r-m.label.length)),g=this.settingsListTheme.label(d,c),b=this.settingsListTheme.value(m.value,c);n.push(`${l}${g} ${b}`)}return n}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 n=this.rows[this.selectedIndex];if(!n)return;if(n.kind==="model"){this.onActivateModel(n.id);return}if(!n.values||n.values.length===0)return;let r=dt();if(!r){this.ctx.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");return}let a=r.solverGap??Fa,s=n.values.indexOf(n.value),m=n.values[(s+1)%n.values.length];if(m===void 0)return;n.id==="reviewer-thinking"?Ot({...r,thinkingLevel:m,solverGap:a}):n.id==="solvergap-thinking"?Ot({...r,solverGap:{...a,thinkingLevel:m}}):n.id==="solvergap-timeout"?Ot({...r,solverGap:{...a,timeoutMinutes:Number.parseInt(m,10)}}):n.id==="solvergap-solver-count"&&Ot({...r,solverGap:{...a,solverCount:Number.parseInt(m,10)}}),this.refresh(),this.onCycleSaved()}}};async function Ov(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=0;for(;;){let n=await e.ui.custom((s,m,c,l)=>{let d=new ii(e,kv(),m,()=>s.requestRender(),b=>l(b),()=>l(void 0));d.selectedIndex=t;let g=new wv;return g.addChild(new Ef(m.bold(m.fg("accent","Checks settings")))),g.addChild({render:b=>d.render(b),invalidate:()=>d.invalidate()}),g.addChild(new Ev(1)),g.addChild(new Ef(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(!n)return;let r=dt(),a=r?.solverGap??Fa;if(n==="reviewer-model"){let s=await Rf(e,r,"Select model for checks reviewer agents");if(!s)continue;let m=Da(e,s.provider,s.modelId),c=m.includes(r?.thinkingLevel??"off")?r?.thinkingLevel??"off":m[0]??"off";Ot({...s,thinkingLevel:c,solverGap:a}),e.ui.notify(`Reviewer model saved: ${s.provider}/${s.modelId}`,"info");continue}if(n==="solvergap-model"){if(!r){e.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");continue}let s=await Rf(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";Ot({...r,solverGap:{...a,...s,thinkingLevel:c}}),e.ui.notify(`Solver-gap-finder model saved: ${s.provider}/${s.modelId}`,"info")}}}function Of(e){e.registerCommand("checks",{description:"Strict review of agent_prompt.md/test.patch/solution.patch. Requires an option \u2014 see /checks.",getArgumentCompletions:Sv,handler:async(t,n)=>{let r=t.trim();if(r===""){n.ui.notify(oi.map(F=>`${F.value} \u2014 ${F.description}`).join(`
325
+ `),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],s=new Set(oi.map(F=>F.value)),m=a.filter(F=>!s.has(F));if(m.length>0){n.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){n.ui.notify("--config cannot be combined with other options.","warning");return}await Ov(n);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){n.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()){n.ui.notify("A checks run is already in progress.","warning");return}let G=dt();if(!G){n.ui.notify("No reviewer model configured. Run /checks --config first.","error");return}let w=n.modelRegistry.find(G.provider,G.modelId);if(!w){n.ui.notify(`Configured model ${G.provider}/${G.modelId} not found. Run /checks --config again.`,"error");return}if(!n.modelRegistry.hasConfiguredAuth(w)){n.ui.notify(`No auth configured for ${G.provider}/${G.modelId}.`,"error");return}let Ce=ri.filter(F=>!Tf(ct(n.cwd,F)));if(Ce.length>0){n.ui.notify(`Missing required file(s) in project root: ${Ce.join(", ")}`,"error");return}let j=null,le;if(d){if(j=hi(),!j){n.ui.notify("No solver-gap-finder model configured. Run /checks --config and set it up.","error");return}if(le=n.modelRegistry.find(j.provider,j.modelId),!le){n.ui.notify(`Configured solver-gap-finder model ${j.provider}/${j.modelId} not found. Run /checks --config again.`,"error");return}if(!n.modelRegistry.hasConfiguredAuth(le)){n.ui.notify(`No auth configured for ${j.provider}/${j.modelId}.`,"error");return}if(!Tf(ct(n.cwd,"test.sh"))){n.ui.notify("Missing required file in project root for --solver-gap-finder: test.sh","error");return}}let ne=If(),Me=j?.solverCount??vr,oe=(b?g.length:0)+(l?3:0)+(d?Me+1:0);n.ui.setWidget(he,Ee("preparing clean snapshot",0,oe)),n.ui.notify(`checks (${V}) started. Press ${Rv} to cancel.`,"info");let nt,lt=[];try{let F=ct(wf(),`checks-${$f()}`);kf(F,{recursive:!0}),nt=F;let fr=await wr(e,n.cwd,F);if(fr.status==="error"){n.ui.notify(`checks: ${fr.error}`,"error");return}for(let Re of ri)vv(ct(n.cwd,Re),ct(F,Re));let In=yf(),bn=xf(),pe=0,Ga=[];if(b&&(n.ui.setWidget(he,Ee("reviewing",pe,oe)),Ga=await Promise.all(g.map(Re=>mf({pi:e,role:Re,tempDir:F,model:w,thinkingLevel:G.thinkingLevel,rubric:In[Re.key],fairnessRules:bn,cancelSignal:ne.signal}).then(rt=>(pe+=1,n.ui.setWidget(he,Ee("reviewing",pe,oe)),rt)))),ne.signal.aborted)){n.ui.notify("checks: cancelled.","warning");return}let vn={status:"ok",gaps:[]},$n={status:"ok",gaps:[]},gr={status:"ok",gaps:[]};if(l){let Re={tempDir:F,model:w,thinkingLevel:G.thinkingLevel,testRubric:In.tests,fairnessRules:bn,cancelSignal:ne.signal};if(n.ui.setWidget(he,Ee("finding test gaps",pe,oe)),[vn,$n]=await Promise.all([ni({...Re,kind:"positive"}).then(Tn=>(pe+=1,n.ui.setWidget(he,Ee("finding test gaps",pe,oe)),Tn)),ni({...Re,kind:"negative"}).then(Tn=>(pe+=1,n.ui.setWidget(he,Ee("finding test gaps",pe,oe)),Tn))]),ne.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}let rt=[...vn.gaps,...$n.gaps];if(rt.length>0&&(n.ui.setWidget(he,Ee("validating test gaps",pe,oe)),gr=await cf({tempDir:F,model:w,thinkingLevel:G.thinkingLevel,testRubric:In.tests,fairnessRules:bn,candidates:rt,cancelSignal:ne.signal})),pe+=1,n.ui.setWidget(he,Ee("validating test gaps",pe,oe)),ne.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let Bt=[],hr={status:"ok",gaps:[]};if(d&&j){n.ui.setWidget(he,Ee("solver-gap-finder: solving",pe,oe));let Re=ct(n.cwd,"test.patch"),rt=ct(n.cwd,"agent_prompt.md"),Tn=await Promise.all(Array.from({length:Me},async(Et,Rt)=>{let kn=ct(wf(),`checks-solvergap-${$f()}`);kf(kn,{recursive:!0}),lt.push(kn);let yr=await bi({pi:e,repoDir:n.cwd,solverDir:kn,testPatchPath:Re,agentPromptPath:rt});return{index:Rt+1,setup:yr}})),jf=ai().replace(/[:.]/g,"-");if(Bt=await Promise.all(Tn.map(async({index:Et,setup:Rt})=>{if(Rt.status!=="ok")return pe+=1,n.ui.setWidget(he,Ee("solver-gap-finder: solving",pe,oe)),{index:Et,status:Rt.status,passed:!1,diff:"",testOutputTail:Rt.error,durationMs:0};let kn=Date.now(),{outcome:yr,trajectory:Ff}=await pf({pi:e,solverDir:Rt.solverDir,model:le,thinkingLevel:j.thinkingLevel,timeoutMinutes:j.timeoutMinutes,cancelSignal:ne.signal}),{testOutputXmlPath:Df,...Ka}=await vi({pi:e,index:Et,workspace:Rt,status:yr==="done"?"ok":yr,durationMs:Date.now()-kn}),Gf=$i({repoDir:n.cwd,runId:jf,index:Et,trajectory:Ff,solutionPatch:Ka.diff,testOutputXmlPath:Df,testOutputTail:Ka.testOutputTail});return pe+=1,n.ui.setWidget(he,Ee("solver-gap-finder: solving",pe,oe)),{...Ka,artifactsDir:Gf}})),ne.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}if(Bt.some(Et=>Et.status!=="patchFailed"&&Et.status!=="error")?(n.ui.setWidget(he,Ee("solver-gap-finder: comparing solutions",pe,oe)),Ti(F,Bt),hr=await uf({tempDir:F,model:w,thinkingLevel:G.thinkingLevel,solverResults:Bt,cancelSignal:ne.signal})):n.ui.notify("checks: all solver-gap-finder solvers failed to set up; skipping comparison.","warning"),pe+=1,n.ui.setWidget(he,Ee("solver-gap-finder: comparing solutions",pe,oe)),ne.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}n.ui.setWidget(he,Ee("finalizing report",oe,oe));let Na={};g.forEach((Re,rt)=>{Ga[rt]&&(Na[Re.key]=Ga[rt])});let Cf=gr.gaps,Mf=vn.gaps.length>0||$n.gaps.length>0,Af=l&&(vn.status!=="ok"||$n.status!=="ok"||Mf&&gr.status!=="ok"),Ua=ct(n.cwd,"shipd_report.json"),Lf=lf(Ua),qf=d&&(Bt.some(Re=>Re.status==="error")||hr.status!=="ok"),mi=df({existingReport:Lf,config:G,runReviewers:b,byRole:Na,runGapStages:l,testGaps:Cf,gapAnalysisIncomplete:Af,positiveGapFinderStatus:vn.status,negativeGapFinderStatus:$n.status,gapFilterStatus:gr.status,runSolverGapFinder:d,solverResults:Bt,solverGaps:hr.gaps,solverGapAnalysisIncomplete:qf,solverComparisonStatus:hr.status}),pi=gf({merged:mi,runReviewers:b,activeRoles:g,byRole:Na,runGapStages:l,runSolverGapFinder:d});e.sendMessage({customType:"shipd_checks_report",content:pi.content,display:!0,details:pi.details}),Tv(Ua,JSON.stringify(mi,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${Ua}`,"info")}catch(F){n.ui.notify(`checks failed: ${F instanceof Error?F.message:String(F)}`,"error")}finally{if(n.ui.setWidget(he,void 0),nt)try{$v(nt,{recursive:!0,force:!0})}catch{}for(let F of lt)ki(F);bf()}}})}var Pf=Cv.ctrlShift("x");function Av(e){e.registerMessageRenderer("shipd_checks_report",(t,n,r)=>{let a=t.details??{},s=d=>d==="PASS"?r.fg("success",d):r.fg("error",d),m=new Pv;m.addChild(new si(r.bold(r.fg("accent","Checks")),0,0));let c=!1,l=d=>{m.addChild(new si(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"?r.fg("success","\u2713"):r.fg("error","\u2717");l(` ${b} ${r.bold(d)}: ${s(g)}`)}if(a.overall){let d=a.overall==="PASS"&&a.hasTestGaps?" (with test gaps)":"";l(` ${r.bold("Overall:")} ${s(a.overall)}${d}`)}}if(a.showGaps){let d=a.gapsCount??0;l(d>0?r.fg("warning",` \u26A0 ${d} test gap(s) found`):r.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 Mv(1)),l(r.bold(r.fg("accent","Solver gap finder")));for(let w of d){let Ce=w.passed?r.fg("success","\u2713"):r.fg("error","\u2717"),j=w.passed?"passed":w.status==="ok"?"failed tests":w.status;l(` ${Ce} Solver ${w.index}: ${j} (${ff(w.durationMs)})`)}let V=g===d.length&&d.length>0?r.fg("success",`${g}/${d.length} solvers passed`):r.fg("warning",`${g}/${d.length} solvers passed`),G=b>0?r.fg("warning",`${b} behavioral gap(s) found`):r.fg("success","no behavioral gaps found");l(` ${V}, ${G}`)}return c||m.addChild(new si(r.fg("dim"," nothing to report"),0,0)),m}),e.registerShortcut(Pf,{description:"Cancel an in-progress /checks run",handler:t=>{ja()&&vf()&&(t.ui.setWidget(he,[`checks: cancelling (${Pf})...`]),t.ui.notify("checks: cancelling...","warning"))}}),Of(e)}export{Av as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sreetej510/pi-shipd-checks",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
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",