@sreetej510/pi-shipd-checks 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +318 -0
- package/package.json +6 -6
- package/src/agents.ts +0 -198
- package/src/command.ts +0 -387
- package/src/config.ts +0 -84
- package/src/git.ts +0 -30
- package/src/index.ts +0 -125
- package/src/progress.ts +0 -11
- package/src/prompts.ts +0 -202
- package/src/report.ts +0 -142
- package/src/roles.ts +0 -20
- package/src/rubric.ts +0 -32
- package/src/state.ts +0 -31
- package/src/tools.ts +0 -140
- package/src/types.ts +0 -56
package/dist/index.js
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
var Ed=Object.defineProperty;var gt=(e,t)=>{for(var n in t)Ed(e,n,{get:t[n],enumerable:!0})};import{Key as mb,Text as pb}from"@earendil-works/pi-tui";import{randomUUID as XI}from"node:crypto";import{copyFileSync as QI,existsSync as eb,mkdirSync as tb,rmSync as nb,writeFileSync as rb}from"node:fs";import{tmpdir as ab}from"node:os";import{join as Wn}from"node:path";import{createAgentSession as xo,SessionManager as go}from"@earendil-works/pi-coding-agent";var p={};gt(p,{Assign:()=>wd,Clone:()=>cn,Create:()=>Af,Discard:()=>qf,Metrics:()=>qe,Update:()=>Lf});var qe={assign:0,create:0,clone:0,discard:0,update:0};function wd(e,t){return qe.assign+=1,{...e,...t}}var i={};gt(i,{Entries:()=>Vd,EntriesRegExp:()=>Wd,Every:()=>_d,EveryAll:()=>zd,GraphemeCount:()=>Kd,HasPropertyKey:()=>Bd,IsArray:()=>pn,IsBigInt:()=>mn,IsBoolean:()=>Ao,IsClassInstance:()=>Dd,IsConstructor:()=>Cd,IsDeepEqual:()=>la,IsEqual:()=>S,IsFunction:()=>qo,IsGreaterEqualThan:()=>jo,IsGreaterThan:()=>Ld,IsInteger:()=>ua,IsLessEqualThan:()=>Lo,IsLessThan:()=>jd,IsMaxLength:()=>Ud,IsMinLength:()=>Gd,IsMultipleOf:()=>Fd,IsNull:()=>Zn,IsNumber:()=>Xn,IsObject:()=>un,IsObjectNotArray:()=>Ad,IsString:()=>Qn,IsSymbol:()=>qd,IsUndefined:()=>ca,IsUnsafePropertyKey:()=>Fo,IsValueLike:()=>Nd,Keys:()=>Jn,ShiftLeft:()=>er,Symbols:()=>Hd,Values:()=>Yd});function yt(e,t,n){return e>=t&&e<=n}function Rd(e){return e===8205}function Od(e){return yt(e,55296,56319)}function Eo(e){return yt(e,127462,127487)}function Ro(e){return yt(e,65024,65039)}function Oo(e){return yt(e,768,879)||yt(e,6832,6911)||yt(e,7616,7679)||yt(e,65056,65071)}function Yn(e){return e>65535?2:1}function wo(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Oo(n)||Ro(n))t+=Yn(n);else break}return t}function pa(e,t){let n=e.codePointAt(t),r=t+Yn(n);for(r=wo(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+Yn(a),r=wo(e,r)}return Eo(n)&&r<e.length&&Eo(e.codePointAt(r))&&(r+=Yn(e.codePointAt(r))),r}function Po(e){return Od(e)||Oo(e)||Ro(e)||Rd(e)}function So(e){let t=0,n=0;for(;n<e.length;)n=pa(e,n),t++;return t}function Pd(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=pa(e,r),n++,n>=t)return!0;return!1}function Sd(e,t){let n=0,r=0;for(;r<e.length;)if(r=pa(e,r),n++,n>t)return!1;return!0}function Mo(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Po(e.charCodeAt(n)))return Pd(e,t);if(n++,n>=t)return!0}return!1}function Co(e,t){let n=0;for(;n<e.length;){if(Po(e.charCodeAt(n)))return Sd(e,t);if(n++,n>t)return!1}return!0}function pn(e){return Array.isArray(e)}function mn(e){return S(typeof e,"bigint")}function Ao(e){return S(typeof e,"boolean")}function Cd(e){if(ca(e)||!qo(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function qo(e){return S(typeof e,"function")}function ua(e){return Number.isInteger(e)}function Zn(e){return S(e,null)}function Xn(e){return Number.isFinite(e)}function Ad(e){return un(e)&&!pn(e)}function un(e){return S(typeof e,"object")&&!Zn(e)}function Qn(e){return S(typeof e,"string")}function qd(e){return S(typeof e,"symbol")}function ca(e){return S(e,void 0)}function S(e,t){return e===t}function Ld(e,t){return e>t}function jd(e,t){return e<t}function Lo(e,t){return e<=t}function jo(e,t){return e>=t}function Fd(e,t){if(mn(e)||mn(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!Xn(e)||ua(e)&&1/t%1===0)return!0;let r=e%t;return Math.min(Math.abs(r),Math.abs(r-t),Math.abs(r+t))<n}function Dd(e){if(!un(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Zn(t)?!1:S(typeof t.constructor,"function")&&!(S(t.constructor,globalThis.Object)||S(t.constructor.name,"Object"))}function Nd(e){return mn(e)||Ao(e)||Zn(e)||Xn(e)||Qn(e)||ca(e)}function Kd(e){return So(e)}function Ud(e,t){return Co(e,t)}function Gd(e,t){return Mo(e,t)}function _d(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function zd(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 S(e.length,0)?n():t(e[0],e.slice(1))}function Fo(e){return S(e,"__proto__")||S(e,"constructor")||S(e,"prototype")}function Bd(e,t){return Fo(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Wd(e){return Jn(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function Vd(e){return Object.entries(e)}function Jn(e){return Object.getOwnPropertyNames(e)}function Hd(e){return Object.getOwnPropertySymbols(e)}function Yd(e){return Object.values(e)}function Jd(e,t){if(!un(t))return!1;let n=Jn(e);return S(n.length,Jn(t).length)&&n.every(r=>la(e[r],t[r]))}function Zd(e,t){return pn(t)&&S(e.length,t.length)&&e.every((n,r)=>la(e[r],t[r]))}function la(e,t){return pn(e)?Zd(e,t):un(e)?Jd(e,t):S(e,t)}var rt={};gt(rt,{IsBigInt64Array:()=>df,IsBigUint64Array:()=>ff,IsBoolean:()=>Qd,IsDate:()=>gf,IsFloat32Array:()=>cf,IsFloat64Array:()=>lf,IsInt16Array:()=>sf,IsInt32Array:()=>pf,IsInt8Array:()=>rf,IsMap:()=>hf,IsNumber:()=>ef,IsRegExp:()=>xf,IsSet:()=>yf,IsString:()=>tf,IsTypeArray:()=>nf,IsUint16Array:()=>mf,IsUint32Array:()=>uf,IsUint8Array:()=>af,IsUint8ClampedArray:()=>of});function Qd(e){return e instanceof Boolean}function ef(e){return e instanceof Number}function tf(e){return e instanceof String}function nf(e){return globalThis.ArrayBuffer.isView(e)}function rf(e){return e instanceof globalThis.Int8Array}function af(e){return e instanceof globalThis.Uint8Array}function of(e){return e instanceof globalThis.Uint8ClampedArray}function sf(e){return e instanceof globalThis.Int16Array}function mf(e){return e instanceof globalThis.Uint16Array}function pf(e){return e instanceof globalThis.Int32Array}function uf(e){return e instanceof globalThis.Uint32Array}function cf(e){return e instanceof globalThis.Float32Array}function lf(e){return e instanceof globalThis.Float64Array}function df(e){return e instanceof globalThis.BigInt64Array}function ff(e){return e instanceof globalThis.BigUint64Array}function xf(e){return e instanceof globalThis.RegExp}function gf(e){return e instanceof globalThis.Date}function yf(e){return e instanceof globalThis.Set}function hf(e){return e instanceof globalThis.Map}function bf(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function $f(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:ht(a.value)})}return t}function Tf(e){let t={};for(let n of i.Keys(e))i.IsUnsafePropertyKey(n)||(t[n]=ht(e[n]));for(let n of i.Symbols(e))t[n]=ht(e[n]);return t}function vf(e){return i.IsClassInstance(e)?e:bf(e)?$f(e):Tf(e)}function kf(e){return e.map(t=>ht(t))}function Ef(e){return e.slice()}function wf(e){return new RegExp(e.source,e.flags)}function Rf(e){return new Map(ht([...e.entries()]))}function Of(e){return new Set(ht([...e.values()]))}function ht(e){return rt.IsTypeArray(e)?Ef(e):rt.IsRegExp(e)?wf(e):rt.IsMap(e)?Rf(e):rt.IsSet(e)?Of(e):i.IsArray(e)?kf(e):i.IsObject(e)?vf(e):e}function cn(e){return qe.clone+=1,ht(e)}var It={};gt(It,{Get:()=>Mf,Reset:()=>Pf,Set:()=>Sf});var Ye={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Pf(){Ye.immutableTypes=!1,Ye.maxErrors=8,Ye.useAcceleration=!0,Ye.exactOptionalPropertyTypes=!1,Ye.enumerableKind=!1,Ye.correctiveParse=!1,Ye.unionPrioritySort=!0}function Sf(e){for(let t of i.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(Ye,t,{value:n})}}function Mf(){return Ye}function Cf(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 Do(e,t){return{...e,...t}}function Af(e,t,n={}){qe.create+=1;let r=It.Get(),a=Do(t,n),s=r.enumerableKind?Do(a,e):Cf(a,e);return r.immutableTypes?Object.freeze(s):s}function qf(e,t){qe.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(cn(e)),a=new Set(t);for(let s of Object.keys(r))a.has(s)||Object.defineProperty(n,s,r[s]);return n}function Lf(e,t,n){qe.update+=1;let r=It.Get(),a=cn(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 g(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function Q(e){return i.IsObject(e)}function h(e,t,n){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function at(e){return g(e,"Deferred")}function jf(e){return p.Update(e,{"~readonly":!0},{})}function ln(e,t){return p.Update(jf(e),{},t)}function No(e,t,n,r){let a=d(e,t,n);return ln(a,r)}function Ff(e){return p.Update(e,{"~optional":!0},{})}function dn(e,t){return p.Update(Ff(e),{},t)}function Ko(e,t,n,r){let a=d(e,t,n);return dn(a,r)}function ve(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function U(e){return g(e,"Array")}function tr(e){return p.Discard(e,["~kind","type","items"])}function Fe(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function te(e){return g(e,"Constructor")}function Uo(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function De(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function ne(e){return g(e,"Function")}function Go(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function Je(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function re(e){return g(e,"Ref")}function ot(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Ct(e){return g(e,"Generic")}function At(e){return p.Create({"~kind":"Any"},{},e)}function Y(e){return g(e,"Any")}var _o="(?!)";function L(e){return p.Create({"~kind":"Never"},{not:{}},e)}function it(e){return g(e,"Never")}function Ne(e,t={}){return h("AddOptional",[e],t)}function bt(e,t={}){return dn(e,t)}function zo(e){return bt(e)}function ue(e){return Q(e)&&i.HasPropertyKey(e,"~optional")}function Bo(e){return i.Keys(e).filter(t=>!ue(e[t]))}function nr(e){return i.Keys(e)}function rr(e){return i.Values(e)}function $(e,t={}){let n=Bo(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function M(e){return g(e,"Object")}function Wo(e){return p.Discard(e,["~kind","type","properties","required"])}function ae(e){return p.Create({"~kind":"Unknown"},{},e)}function ee(e){return g(e,"Unknown")}function Ke(e,t,n){let r=i.Keys(e).reduce((a,s)=>({...a,[s]:p.Update(e[s],{},{$id:s})}),{});return p.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function se(e){return g(e,"Cyclic")}function Vo(e){return p.Update(e,{"~unsafe":null},{})}function ar(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var Ue={};gt(Ue,{Match:()=>Df});function Df(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function fn(...e){let[t,n]=Ue.Match(e,{2:(r,a)=>[r,a,a],1:r=>[r,ae(),ae()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function W(e){return g(e,"Infer")}function $t(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function z(e){return g(e,"Dependent")}function Ho(e){return p.Discard(e,["~kind","if","then","else"])}function Yo(e){return i.IsObjectNotArray(e)}function Jo(e){return i.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function Zo(e){return i.IsString(e)||i.IsNumber(e)}function Xo(e,t){let n=Yo(e)?Jo(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function de(e){return g(e,"Enum")}function ce(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function R(e){return g(e,"Intersect")}function Qo(e){return p.Discard(e,["~kind","allOf"])}function V(){throw new Error("Unreachable")}var ei;(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"})(ei||(ei={}));var gT=BigInt("14695981039346656037"),[yT,hT]=[BigInt("1099511628211"),BigInt("18446744073709551616")],IT=Array.from({length:256}).map((e,t)=>BigInt(t)),ti=new Float64Array(1),bT=new DataView(ti.buffer),$T=new Uint8Array(ti.buffer);var TT=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},{})}},gn=class{constructor(t){this.type=t}Decode(t){return new xn(this.type,t)}};function ir(e){return new gn(e)}function ri(e,t){return ir(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function ai(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 oi(e){return qt(e)}function Tt(e){return Q(e)&&i.HasPropertyKey(e,"~immutable")}function Ge(e,t={}){return h("AddReadonly",[e],t)}function vt(e,t={}){return ln(e,t)}function ii(e){return vt(e)}function kt(e){return Q(e)&&i.HasPropertyKey(e,"~readonly")}function Gf(e,t){let n=da(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function si(...e){let[t,n,r]=Ue.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return Gf(t,{check:n,error:r})}function _f(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function da(e){return Q(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>_f(t))}var mi="-?(?:0|[1-9][0-9]*)n";function yn(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function _e(e){return g(e,"BigInt")}function sr(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Re(e){return g(e,"Boolean")}function hn(e){return p.Create({"~kind":"Identifier"},{name:e})}function pi(e){return g(e,"Identifier")}var mr="-?(?:0|[1-9][0-9]*)";function Et(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function fe(e){return g(e,"Integer")}var fa=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function zf(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new fa(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:zf(e),const:e},t)}function pr(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function ui(e){return C(e)&&i.IsNumber(e.const)}function ci(e){return C(e)&&i.IsString(e.const)}function C(e){return g(e,"Literal")}function Lt(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function jt(e){return g(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 g(e,"Number")}function Ft(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function st(e){return g(e,"Symbol")}function wt(...e){let[t,n,r]=Ue.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,ae(),ae()]});return p.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function li(e){return g(e,"Parameter")}var cr=".*";function Oe(e){return p.Create({"~kind":"String"},{type:"string"},e)}function xe(e){return g(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function y(e){return g(e,"Union")}function di(e){return p.Discard(e,["~kind","anyOf"])}function In(e){let t=fi(e);return i.IsEqual(t.length,2)?t[0]:[]}function Bf(e){return!0}function xi(e){return i.ShiftLeft(e,(t,n)=>Wf(t)?xi(n):!1,()=>!0)}function gi(e){return i.IsEqual(e.length,0)?!1:xi(e)}function Wf(e){return y(e)?gi(e.anyOf):C(e)?Bf(e.const):!1}function lr(e){return gi(e)}function dr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function yi(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>yi(a,t,[...n,`${r}${t}`]),()=>n)}function Vf(e,t){return i.IsEqual(e.length,0)?[`${t}`]:yi(e,t)}function hi(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>hi(e,a,[...n,...Ii(e,r)]),()=>n)}function Ii(e,t){return y(t)?hi(e,t.anyOf):C(t)?Vf(e,t.const):V()}function bi(e,t){return i.ShiftLeft(t,(n,r)=>bi(Ii(e,n),r),()=>e)}function Hf(e){return e.map(t=>O(t))}function Yf(e){let t=bi([],e),n=Hf(t);return k(n)}function Jf(e){return i.IsEqual(e.length,0)?V():i.IsEqual(e.length,1)&&C(e[0])?e[0]:Yf(e)}function xa(e){let t=In(e);return i.IsEqual(t.length,0)?Oe():lr(t)?Jf(t):dr(e)}function $i(e){let t=xa(e);return Z(t)?Oe():t}function ye(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function Ti(e){return ye(Le,e)}function vi(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 F(e){return g(e,"Tuple")}function ki(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Zf(e){return p.Discard(e,["~readonly"])}function ga(e,t){return p.Update(Zf(e),{},t)}function Ei(e,t,n,r){let a=d(e,t,n);return ga(a,r)}function wi(e,t={}){return h("RemoveReadonly",[e],t)}function Ri(e,t={}){return ga(e,t)}function Xf(e){return p.Discard(e,["~optional"])}function ya(e,t){return p.Update(Xf(e),{},t)}function Oi(e,t,n,r){let a=d(e,t,n);return ya(a,r)}function Pi(e,t={}){return h("RemoveOptional",[e],t)}function fr(e,t={}){return ya(e,t)}function ha(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function Si(e){let t=ha(e.items);return $(t)}function Qf(e,t){return kt(e)?!!kt(t):!1}function ex(e,t){return ue(e)?!!ue(t):!1}function tx(e,t){let n=Qf(e,t),r=ex(e,t),a=G([e,t]),s=Ri(fr(a));return n&&r?vt(bt(s)):n&&!r?vt(s):!n&&r?bt(s):s}function nx(e,t,n){return n in e?n in t?tx(e[n],t[n]):e[n]:n in t?t[n]:L()}function rx(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((r,a)=>({...r,[a]:nx(e,t,a)}),{})}function Mi(e){return M(e)?e.properties:F(e)?ha(e.items):V()}function Ci(e,t){let n=Mi(e),r=Mi(t),a=rx(n,r);return $(a)}function Ai(e,t){let n=Dt(e,t);return i.IsEqual(n,$n)?e:i.IsEqual(n,Tn)||i.IsEqual(n,bn)?t:L()}function qi(e){return M(e)||F(e)}function ax(e,t){let n=y(e),r=y(t);return n||r}function ox(e,t){let n=Pe(e),r=Pe(t),a=ax(n,r),s=qi(n),m=qi(r);return a?G([n,r]):s&&m?Ci(n,r):s&&!m?n:!s&&m?r:Ai(n,r)}function Li(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>Li(e,a,[...n,ox(e,r)]),()=>i.IsEqual(n.length,0)?[e]:n)}function ji(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>ji(a,t,[...n,...vn([r],t)]),()=>n)}function vn(e,t=[]){return i.ShiftLeft(e,(n,r)=>y(n)?vn(r,ji(n.anyOf,t)):vn(r,Li(n,t)),()=>t)}function ix(e,t){let n=me({},e,t);return b.IsExtendsTrueLike(n)?[]:[e]}function sx(e,t){return e.reduce((n,r)=>[...n,...ix(r,t)],[])}function xr(e,t){let n=Pe(e),r=y(n)?n.anyOf:[n],a=sx(r,t);return be(a)}function je(e,t,n){let r=ce([e,t]),a=xr(n,e);return be([r,a])}function ke(e){let t=e.map(n=>O(n));return be(t)}function G(e){let t=vn(e),n=Ia(t);return Ze(n)}function he(e){let t=$i(e);return Pe(t)}function be(e){let t=Ia(e);return Ze(t)}function Pe(e){return z(e)?je(e.if,e.then,e.else):de(e)?ke(e.enum):R(e)?G(e.allOf):Z(e)?he(e.pattern):y(e)?be(e.anyOf):e}function Ze(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?L():k(e)}function Fi(e,t){let n=ke(e);return mt(n,t)}function Di(e,t){return ye(pt,t)}function Ni(e,t){let n=G(e);return mt(n,t)}function Ki(e,t){return i.IsString(e)||i.IsNumber(e)?$({[e]:t}):i.IsEqual(e,!1)?$({false:t}):i.IsEqual(e,!0)?$({true:t}):$({})}function Ui(e,t){return ye(Nt,t)}function Gi(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?ye(e.pattern.toString(),t):ye(Le,t)}function _i(e,t){let n=In(e);return lr(n)?mt(he(e),t):ye(e,t)}function mx(e){return y(e)?kn(e.anyOf):[e]}function kn(e){return e.reduce((t,n)=>[...t,...mx(n)],[])}function px(e){return e.some(t=>xe(t)||J(t)||fe(t))}function ux(e,t){return i.IsEqual(px(e),!0)?ye(Le,t):void 0}function cx(e,t){return e.reduce((n,r)=>C(r)&&(i.IsString(r.const)||i.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function lx(e,t){let n=cx(e,t);return $(n)}function zi(e,t){let n=kn(e),r=ux(n,t);return Q(r)?r:lx(n,t)}function mt(e,t){return Y(e)?Ti(t):Re(e)?vi(t):de(e)?Fi(e.enum,t):fe(e)?Di(e,t):R(e)?Ni(e.allOf,t):C(e)?Ki(e.const,t):J(e)?Ui(e,t):y(e)?zi(e.anyOf,t):xe(e)?Gi(e,t):Z(e)?_i(e.pattern,t):$({})}function ba(e,t,n){return v([e])?p.Update(mt(e,t),{},n):gr(e,t,n)}function Bi(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return ba(s,m,a)}var pt=`^${mr}$`,Nt=`^${ur}$`,Le=`^${cr}$`;function gr(e,t,n={}){return h("Record",[e,t],n)}function yr(e,t,n={}){return ba(e,t,n)}function Wi(e,t){return ye(e,t)}function hr(e){return i.IsEqual(e,Le)?Oe():i.IsEqual(e,pt)?Et():i.IsEqual(e,Nt)?Ie():xa(e)}function Se(e){return i.Keys(e.patternProperties)[0]}function Kt(e){let t=Se(e);return hr(t)}function ge(e){return e.patternProperties[Se(e)]}function pe(e){return g(e,"Record")}function Rt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function ut(e){return g(e,"Rest")}function Ir(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function br(e){return g(e,"This")}function Ut(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Gt(e){return g(e,"Undefined")}function $r(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function ze(e){return g(e,"Void")}function fx(e,t){return i.IsEqual(e,"Array")?ve(t[0]):i.IsEqual(e,"Capitalize")?vr(t[0]):i.IsEqual(e,"ConstructorParameters")?Or(t[0]):i.IsEqual(e,"Evaluate")?Hm(t[0]):i.IsEqual(e,"Exclude")?Pr(t[0],t[1]):i.IsEqual(e,"Extract")?Sr(t[0],t[1]):i.IsEqual(e,"Index")?On(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")?Pn(t[0]):i.IsEqual(e,"Record")?gr(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]):Rn(Je(e),t)}function Ot(){throw Error("Unreachable")}var xx=(e,t=[])=>e.reduce((n,r)=>i.IsArray(r)&&i.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),Xe=e=>{let[t,n]=e;return xx([...t,...n])};function Zi(e){return wt(e[0],e[2],e[4])}function Xi(e){return wt(e[0],e[2],e[2])}function Qi(e){return wt(e[0],ae(),e[2])}function es(e){return wt(e,ae(),ae())}function ts(e){return Xe(e)}function ns(e){return e[1]}function rs(e){return Xe(e)}function as(e){return e[1]}function os(e){return fx(e[0],e[1])}function is(e){return null}function ss(e){return Oe()}function ms(e){return Ie()}function ps(e){return sr()}function us(e){return Ut()}function cs(e){return Lt()}function ls(e){return Et()}function ds(e){return yn()}function fs(e){return ae()}function xs(e){return At()}function gs(e){return $({})}function ys(e){return L()}function hs(e){return Ft()}function Is(e){return $r()}function bs(e){return Ir()}function $s(e){return O(BigInt(e))}function Ts(e){return O(i.IsEqual(e,"true"))}function vs(e){return O(parseFloat(e))}function ks(e){return O(e)}function Es(e){return e[1]}function ws(e){return O(e)}function Rs(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Os(e){return e[1]}function Ps(e){return Tr(e)}function Ss(e){return i.IsEqual(e.length,6)?$t(e[1],e[3],e[5]):$t(e[1],e[3],ae())}function Ms(e){return e.length>0}function Cs(e){return e.reduce((t,n)=>i.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function As(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function qs(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function Ls(e){return i.IsEqual(e.length,2)?e[1]:[]}function Vi(e,t){return t.reduce((n,r)=>{let a=r;return i.IsEqual(a.length,1)?On(n,a[0]):i.IsEqual(a.length,0)?ve(n):Ot()},e)}function Hi(e,t){return i.IsEqual(t.length,3)?Rr(e,t[0],t[1],t[2]):e}function gx(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:Kr(e,t)}function js(e){let[t,n,r,a,s]=e;return gx(Hi(t?Pn(Vi(n,r)):Vi(n,r),a),s)}function $a(e,t){return i.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,s=$a(r,a);if(i.IsEqual(n,"&"))return R(s)?ce([e,...s.allOf]):ce([e,s]);if(i.IsEqual(n,"|"))return y(s)?k([e,...s.anyOf]):k([e,s]);Ot()})():e}function Fs(e){let[t,n]=e;return $a(t,n)}function Ds(e){let[t,n]=e;return $a(t,n)}function Ns(e){return Vm(e[1])}function Ks(e){return e[1]}function Us(e){return ot(e[0],e[2])}function Gs(e){return i.IsEqual(e.length,4)?fn(e[1],e[3]):i.IsEqual(e.length,2)?fn(e[1],ae()):Ot()}function _s(e){return`${e}`}function zs(e){return fe(e[3])?pt:J(e[3])?Nt:st(e[3])?Le:xe(e[3])?Le:Ot()}function Bs(e){return e.length>0}function Ws(e){return e.length>0}function Vs(e){let[t,n,r,a,s]=e;return{[n]:t&&r?Ge(Ne(s)):t&&!r?Ge(s):!t&&r?Ne(s):s}}function Hs(e){return Xe(e)}function Ys(e){return e.reduce((t,n)=>i.HasPropertyKey(n,pt)||i.HasPropertyKey(n,Nt)||i.HasPropertyKey(n,Le)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function Js(e){return Ys(e[1])}function Zs(e){let[t,n]=e,r=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return $(t,r)}function Xs(e){return i.IsEqual(e.length,5)?Ge(Ne(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?Ge(e[3]):Ne(e[3]):Ot()}function Qs(e){return Ge(Ne(e[1]))}function em(e){return Ge(e[1])}function tm(e){return Ne(e[0])}function nm(e){return i.IsEqual(e.length,2)?Rt(e[1]):i.IsEqual(e.length,1)?e[0]:Ot()}function rm(e){return Xe(e)}function am(e){return X(e[1])}function om(e){return Ge(Ne(e[4]))}function im(e){return Ge(e[3])}function sm(e){return Ne(e[3])}function mm(e){return e[2]}function pm(e){return i.IsEqual(e.length,2)?Rt(e[1]):i.IsEqual(e.length,1)?e[0]:Ot()}function um(e){return Xe(e)}function cm(e){return De(e[1],e[4])}function lm(e){return Fe(e[2],e[5])}function Yi(e,t){return i.IsEqual(e,"remove")?wi(t):i.IsEqual(e,"add")?Ge(t):t}function dm(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 Ji(e,t){return i.IsEqual(e,"remove")?Pi(t):i.IsEqual(e,"add")?Ne(t):t}function fm(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 xm(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function gm(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?En(hn(e[3]),e[5],e[6][0],Yi(e[1],Ji(e[8],e[10]))):En(hn(e[3]),e[5],Je(e[3]),Yi(e[1],Ji(e[8],e[10])))}function ym(e){return Je(e)}function hm(e){return BigInt(e)}function Im(e){return parseFloat(e)}function bm(e){return i.IsEqual(e,"true")}function $m(e){return null}function Tm(e){return{[e[0]]:e[2]}}function vm(e){return Xe(e)}function yx(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function km(e){return yx(e[1])}function Em(e){return Xe(e)}function wm(e){return e[1]}function Rm(e){return yn()}function Om(e){return Oe()}function Pm(e){return Ie()}function Sm(e){return Et()}function Mm(e){return L()}function Cm(e){return O(e)}function Am(e){return k(e[1])}function qm(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Lm(e){return[e[0],...e[1]]}function jm(e){return e[1]}function Fm(e){return Xe(e)}function Dm(e){return i.IsEqual(e.length,2)?e[1]:[]}function Nm(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,wn(n,r,s))}}function Km(e){let t=e[2],[n,r]=e[3],a=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:wn(t,n,a)}}function Um(e){return{[e[1]]:ot(e[2],e[4])}}function Gm(e){return{[e[1]]:e[3]}}function _m(e){return null}function zm(e){return Ys(Xe(e))}function Bm(e){return e[1]}function Wm(e){let t=e[0],n=e[1];return Ym(p.Assign(t,n[0]))}function Sn(e){return S(e.length,2)}function E(e,t,n){return Sn(e)?t(e[0],e[1]):n()}function bx(e,t){return S(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function _(e,t){for(let n=0;n<e.length;n++){let r=bx(e[n],t);if(Sn(r))return r}return[]}function Ta(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var Jm=[...Ta(97,122),...Ta(65,90)],va="0",ka=Ta(49,57),_t=[va,...ka],Zm=" ",zt=`
|
|
2
|
+
`;var ct="_",Ur=".",Xm="$",Gr="-";var Qm="//",ep="/*",Tx="*/";function tp(e){let t=e.indexOf(Tx);return S(t,-1)?"":e.slice(t+2)}function np(e){let t=e.indexOf(zt);return S(t,-1)?"":e.slice(t)}function vx(e){return e.replace(/^[ \t\r\f\v]+/,"")}function _r(e){let t=vx(e);return t.startsWith(ep)?_r(tp(t.slice(2))):t.startsWith(Qm)?_r(np(t.slice(2))):t}function oe(e){let t=e.trimStart();return t.startsWith(ep)?oe(tp(t.slice(2))):t.startsWith(Qm)?oe(np(t.slice(2))):t}function zr(e,t){return E(_([e],t),(n,r)=>[n,r],()=>["",t])}function kx(e,t){return e.includes(t)}function Bt(e,t,n,r=""){return E(_(e,n),(a,s)=>kx(t,a)?Bt(e,t,s,r):Bt(e,t,s,`${r}${a}`),()=>[r,n])}function Ex(e){return _(ka,e)}var wx=[..._t,ct];function Rx(e){return Bt(wx,[ct],e)}function Ox(e){return E(_([va],e),(t,n)=>[t,n],()=>E(Ex(e),(t,n)=>E(Rx(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function Br(e){return Ox(oe(e))}function Px(e){return zr(Gr,e)}function Sx(e){return E(Px(e),(t,n)=>E(Br(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function rp(e){return Sx(oe(e))}function Mx(e){return E(rp(e),(t,n)=>E(_(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function Ea(e){return Mx(e)}function wa(e,t){return _([e],t)}function u(e,t){return S(e,"")?["",t]:e.startsWith(zt)?wa(e,_r(t)):e.startsWith(Zm)?wa(e,t):wa(e,oe(t))}var ap=[...Jm,ct,Xm];function Cx(e){return _(ap,e)}var Ax=[...ap,..._t];function op(e,t=""){return E(_(Ax,e),(n,r)=>op(r,`${t}${n}`),()=>[t,e])}function qx(e){return E(Cx(e),(t,n)=>E(op(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function B(e){return qx(oe(e))}var Lx=[..._t,ct];function jx(e){return Sn(_([Ur],e))}function ip(e){return E(Bt(Lx,[ct],e),(t,n)=>S(t,"")?[]:[t,n],()=>[])}function Fx(e){return E(_([Ur],e),(t,n)=>E(ip(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function Dx(e){return E(Br(e),(t,n)=>E(_([Ur],n),(r,a)=>E(ip(a),(s,m)=>[`${t}${r}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function Nx(e){return jx(e)?Fx(e):Dx(e)}function sp(e){return Nx(oe(e))}function Kx(e){return zr(Gr,e)}function Ux(e){return E(Kx(e),(t,n)=>E(sp(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function Wr(e){return Ux(oe(e))}function Gx(e){return S(e,"")?[]:[e.slice(0,1),e.slice(1)]}function mp(e,t){return er(e,(n,r)=>t.startsWith(n)?!0:mp(r,t),()=>!1)}function lt(e,t,n=""){return E(Gx(t),(r,a)=>mp(e,t)?[n,t]:lt(e,a,`${n}${r}`),()=>[])}function _x(e,t,n){return E(_([e],n),(r,a)=>E(lt([t],a),(s,m)=>E(_([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function zx(e,t,n){return E(_([e],n),(r,a)=>E(lt([zt,t],a),(s,m)=>E(_([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function pp(e,t,n,r){return n?_x(e,t,oe(r)):zx(e,t,oe(r))}function Bx(e,t){return _(e,t)}function Wx(e,t){return pp(e,e,!1,t)}function Vx(e,t){return E(Bx(e,t),(n,r)=>Wx(n,`${n}${r}`),()=>[])}function Vr(e,t){return Vx(e,oe(t))}function up(e,t){return E(lt(e,t),(n,r)=>S(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),Yx=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])=>[Zi(t),n]),Jx=e=>o(o(B(e),([t,n])=>o(u("extends",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Xi(t),n]),Zx=e=>o(o(B(e),([t,n])=>o(u("=",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Qi(t),n]),Xx=e=>o(B(e),([t,n])=>[es(t),n]),dp=e=>o(o(Yx(e),([t,n])=>[t,n],()=>o(Jx(e),([t,n])=>[t,n],()=>o(Zx(e),([t,n])=>[t,n],()=>o(Xx(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),fp=(e,t=[])=>o(o(dp(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>fp(r,[...t,n]),()=>[t,e]),Qx=e=>o(o(fp(e),([t,n])=>o(o(o(dp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[ts(t),n]),Pa=e=>o(o(u("<",e),([t,n])=>o(Qx(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[ns(t),n]),xp=(e,t=[])=>o(o(w(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>xp(r,[...t,n]),()=>[t,e]),eg=e=>o(o(xp(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])=>[rs(t),n]),tg=e=>o(o(u("<",e),([t,n])=>o(eg(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[as(t),n]),ng=e=>o(o(B(e),([t,n])=>o(tg(n),([r,a])=>[[t,r],a])),([t,n])=>[os(t),n]),gp=e=>o(o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[is(t),n]),yp=e=>o(u("string",e),([t,n])=>[ss(t),n]),hp=e=>o(u("number",e),([t,n])=>[ms(t),n]),rg=e=>o(u("boolean",e),([t,n])=>[ps(t),n]),ag=e=>o(u("undefined",e),([t,n])=>[us(t),n]),og=e=>o(u("null",e),([t,n])=>[cs(t),n]),Ip=e=>o(u("integer",e),([t,n])=>[ls(t),n]),ig=e=>o(u("bigint",e),([t,n])=>[ds(t),n]),sg=e=>o(u("unknown",e),([t,n])=>[fs(t),n]),mg=e=>o(u("any",e),([t,n])=>[xs(t),n]),pg=e=>o(u("object",e),([t,n])=>[gs(t),n]),ug=e=>o(u("never",e),([t,n])=>[ys(t),n]),bp=e=>o(u("symbol",e),([t,n])=>[hs(t),n]),cg=e=>o(u("void",e),([t,n])=>[Is(t),n]),lg=e=>o(u("this",e),([t,n])=>[bs(t),n]),dg=e=>o(o(u("${",e),([t,n])=>o(w(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Es(t),n]),Ra=e=>o(lt(["${","`"],e),([t,n])=>[ws(t),n]),$p=e=>o(o(o(Ra(e),([t,n])=>o(dg(n),([r,a])=>o($p(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(Ra(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(Ra(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[Rs(t),n]),Sa=e=>o(o(u("`",e),([t,n])=>o($p(n),([r,a])=>o(u("`",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Os(t),n]),fg=e=>o(Sa(e),([t,n])=>[Ps(t),n]),xg=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),([q,j])=>[[t,r,s,c,I,q],j])))))),([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])=>[Ss(t),n]),gg=e=>o(Ea(e),([t,n])=>[$s(t),n]),yg=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Ts(t),n]),hg=e=>o(Wr(e),([t,n])=>[vs(t),n]),Ig=e=>o(Vr(["'",'"'],e),([t,n])=>[ks(t),n]),bg=e=>o(o(o(u("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ms(t),n]),Tp=(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])=>Tp(r,[...t,n]),()=>[t,e]),$g=e=>o(Tp(e),([t,n])=>[Cs(t),n]),Tg=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),([q,j])=>[[t,r,s,c,I,q],j])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[As(t),n]),vg=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(yp(e),([t,n])=>[t,n],()=>o(hp(e),([t,n])=>[t,n],()=>o(rg(e),([t,n])=>[t,n],()=>o(ag(e),([t,n])=>[t,n],()=>o(og(e),([t,n])=>[t,n],()=>o(Ip(e),([t,n])=>[t,n],()=>o(ig(e),([t,n])=>[t,n],()=>o(sg(e),([t,n])=>[t,n],()=>o(mg(e),([t,n])=>[t,n],()=>o(pg(e),([t,n])=>[t,n],()=>o(ug(e),([t,n])=>[t,n],()=>o(bp(e),([t,n])=>[t,n],()=>o(cg(e),([t,n])=>[t,n],()=>o(lg(e),([t,n])=>[t,n],()=>o(gg(e),([t,n])=>[t,n],()=>o(yg(e),([t,n])=>[t,n],()=>o(hg(e),([t,n])=>[t,n],()=>o(Ig(e),([t,n])=>[t,n],()=>o(fg(e),([t,n])=>[t,n],()=>o(xg(e),([t,n])=>[t,n],()=>o(jg(e),([t,n])=>[t,n],()=>o(Gg(e),([t,n])=>[t,n],()=>o(Hg(e),([t,n])=>[t,n],()=>o(Vg(e),([t,n])=>[t,n],()=>o(Xg(e),([t,n])=>[t,n],()=>o(ng(e),([t,n])=>[t,n],()=>o(Qg(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[qs(t),n]),kg=e=>o(o(o(u("with",e),([t,n])=>o(Dp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ls(t),n]),vp=e=>o(o(bg(e),([t,n])=>o(vg(n),([r,a])=>o($g(a),([s,m])=>o(Tg(m),([c,l])=>o(kg(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[js(t),n]),kp=e=>o(o(o(u("&",e),([t,n])=>o(vp(n),([r,a])=>o(kp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Ep=e=>o(o(vp(e),([t,n])=>o(kp(n),([r,a])=>[[t,r],a])),([t,n])=>[Fs(t),n]),wp=e=>o(o(o(u("|",e),([t,n])=>o(Ep(n),([r,a])=>o(wp(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(Ep(e),([t,n])=>o(wp(n),([r,a])=>[[t,r],a])),([t,n])=>[Ds(t),n]),Eg=e=>o(o(u("readonly",e),([t,n])=>o(Hr(n),([r,a])=>[[t,r],a])),([t,n])=>[Ns(t),n]),wg=e=>o(o(u("|",e),([t,n])=>o(Hr(n),([r,a])=>[[t,r],a])),([t,n])=>[Ks(t),n]),Rg=e=>o(o(Pa(e),([t,n])=>o(u("=",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Us(t),n]),Og=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])=>[Gs(t),n]),w=e=>o(o(Og(e),([t,n])=>[t,n],()=>o(wg(e),([t,n])=>[t,n],()=>o(Eg(e),([t,n])=>[t,n],()=>o(Hr(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Pg=e=>o(Wr(e),([t,n])=>[_s(t),n]),Sg=e=>o(B(e),([t,n])=>[t,n]),Mg=e=>o(Vr(["'",'"'],e),([t,n])=>[t,n]),Cg=e=>o(o(u("[",e),([t,n])=>o(B(n),([r,a])=>o(u(":",a),([s,m])=>o(o(Ip(m),([c,l])=>[c,l],()=>o(hp(m),([c,l])=>[c,l],()=>o(yp(m),([c,l])=>[c,l],()=>o(bp(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[zs(t),n]),Rp=e=>o(o(Pg(e),([t,n])=>[t,n],()=>o(Sg(e),([t,n])=>[t,n],()=>o(Mg(e),([t,n])=>[t,n],()=>o(Cg(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ag=e=>o(o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Bs(t),n]),qg=e=>o(o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ws(t),n]),Op=e=>o(o(Ag(e),([t,n])=>o(Rp(n),([r,a])=>o(qg(a),([s,m])=>o(u(":",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Vs(t),n]),Pp=e=>o(o(o(u(",",e),([t,n])=>o(u(`
|
|
3
|
+
`,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>o(u(`
|
|
4
|
+
`,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]),Sp=(e,t=[])=>o(o(Op(e),([n,r])=>o(Pp(r),([a,s])=>[[n,a],s])),([n,r])=>Sp(r,[...t,n]),()=>[t,e]),Lg=e=>o(o(Sp(e),([t,n])=>o(o(o(Op(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Hs(t),n]),Ma=e=>o(o(u("{",e),([t,n])=>o(Lg(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Js(t),n]),jg=e=>o(Ma(e),([t,n])=>[Zs(t),n]),Fg=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])=>[Xs(t),n]),Dg=e=>o(o(u("readonly",e),([t,n])=>o(w(n),([r,a])=>o(u("?",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Qs(t),n]),Ng=e=>o(o(u("readonly",e),([t,n])=>o(w(n),([r,a])=>[[t,r],a])),([t,n])=>[em(t),n]),Kg=e=>o(o(w(e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[tm(t),n]),cp=e=>o(o(Fg(e),([t,n])=>[t,n],()=>o(Dg(e),([t,n])=>[t,n],()=>o(Ng(e),([t,n])=>[t,n],()=>o(Kg(e),([t,n])=>[t,n],()=>o(w(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Mp=e=>o(o(o(u("...",e),([t,n])=>o(cp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(cp(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[nm(t),n]),Cp=(e,t=[])=>o(o(Mp(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Cp(r,[...t,n]),()=>[t,e]),Ug=e=>o(o(Cp(e),([t,n])=>o(o(o(Mp(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]),Gg=e=>o(o(u("[",e),([t,n])=>o(Ug(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[am(t),n]),_g=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])=>[om(t),n]),zg=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])=>[im(t),n]),Bg=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])=>[sm(t),n]),Wg=e=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[mm(t),n]),lp=e=>o(o(_g(e),([t,n])=>[t,n],()=>o(zg(e),([t,n])=>[t,n],()=>o(Bg(e),([t,n])=>[t,n],()=>o(Wg(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ap=e=>o(o(o(u("...",e),([t,n])=>o(lp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(lp(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[pm(t),n]),qp=(e,t=[])=>o(o(Ap(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>qp(r,[...t,n]),()=>[t,e]),Lp=e=>o(o(qp(e),([t,n])=>o(o(o(Ap(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]),Vg=e=>o(o(u("(",e),([t,n])=>o(Lp(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])=>[cm(t),n]),Hg=e=>o(o(u("new",e),([t,n])=>o(u("(",n),([r,a])=>o(Lp(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([I,f])=>o(w(f),([q,j])=>[[t,r,s,c,I,q],j])))))),([t,n])=>[lm(t),n]),Yg=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])=>[dm(t),n]),Jg=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])=>[fm(t),n]),Zg=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])=>[xm(t),n]),Xg=e=>o(o(u("{",e),([t,n])=>o(Yg(n),([r,a])=>o(u("[",a),([s,m])=>o(B(m),([c,l])=>o(u("in",l),([I,f])=>o(w(f),([q,j])=>o(Zg(j),([ie,le])=>o(u("]",le),([Te,Ce])=>o(Jg(Ce),([nn,D])=>o(u(":",D),([Vn,rn])=>o(w(rn),([an,Ae])=>o(gp(Ae),([on,nt])=>o(u("}",nt),([Mt,sn])=>[[t,r,s,c,I,q,ie,Te,nn,Vn,an,on,Mt],sn]))))))))))))),([t,n])=>[gm(t),n]),Qg=e=>o(B(e),([t,n])=>[ym(t),n]),ey=e=>o(Ea(e),([t,n])=>[hm(t),n]),ty=e=>o(Wr(e),([t,n])=>[Im(t),n]),ny=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[bm(t),n]),ry=e=>o(Vr(['"',"'"],e),([t,n])=>[t,n]),ay=e=>o(u("null",e),([t,n])=>[$m(t),n]),oy=e=>o(u("undefined",e),([t,n])=>[void 0,n]),jp=e=>o(o(Rp(e),([t,n])=>o(u(":",n),([r,a])=>o(Ca(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Tm(t),n]),Fp=(e,t=[])=>o(o(jp(e),([n,r])=>o(Pp(r),([a,s])=>[[n,a],s])),([n,r])=>Fp(r,[...t,n]),()=>[t,e]),iy=e=>o(o(Fp(e),([t,n])=>o(o(o(jp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[vm(t),n]),Dp=e=>o(o(u("{",e),([t,n])=>o(iy(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[km(t),n]),Np=(e,t=[])=>o(o(Ca(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Np(r,[...t,n]),()=>[t,e]),sy=e=>o(o(Np(e),([t,n])=>o(o(o(Ca(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Em(t),n]),my=e=>o(o(u("[",e),([t,n])=>o(sy(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[wm(t),n]),Ca=e=>o(o(ey(e),([t,n])=>[t,n],()=>o(ty(e),([t,n])=>[t,n],()=>o(ny(e),([t,n])=>[t,n],()=>o(ry(e),([t,n])=>[t,n],()=>o(ay(e),([t,n])=>[t,n],()=>o(oy(e),([t,n])=>[t,n],()=>o(Dp(e),([t,n])=>[t,n],()=>o(my(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),py=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[Rm(t),n]),uy=e=>o(u(".*",e),([t,n])=>[Om(t),n]),cy=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Pm(t),n]),ly=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[Sm(t),n]),dy=e=>o(u("(?!)",e),([t,n])=>[Mm(t),n]),fy=e=>o(up(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[Cm(t),n]),xy=e=>o(o(py(e),([t,n])=>[t,n],()=>o(uy(e),([t,n])=>[t,n],()=>o(cy(e),([t,n])=>[t,n],()=>o(ly(e),([t,n])=>[t,n],()=>o(dy(e),([t,n])=>[t,n],()=>o(gy(e),([t,n])=>[t,n],()=>o(fy(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),gy=e=>o(o(u("(",e),([t,n])=>o(Aa(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Am(t),n]),Kp=e=>o(o(o(Oa(e),([t,n])=>o(u("|",n),([r,a])=>o(Kp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(Oa(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[qm(t),n]),Oa=e=>o(o(xy(e),([t,n])=>o(Aa(n),([r,a])=>[[t,r],a])),([t,n])=>[Lm(t),n]),Aa=e=>o(o(Kp(e),([t,n])=>[t,n],()=>o(Oa(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),fi=e=>o(o(u("^",e),([t,n])=>o(Aa(n),([r,a])=>o(u("$",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[jm(t),n]),Up=(e,t=[])=>o(o(w(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Up(r,[...t,n]),()=>[t,e]),yy=e=>o(o(Up(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])=>[Fm(t),n]),Gp=e=>o(o(o(u("extends",e),([t,n])=>o(yy(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Dm(t),n]),hy=e=>o(o(u("interface",e),([t,n])=>o(B(n),([r,a])=>o(Pa(a),([s,m])=>o(Gp(m),([c,l])=>o(Ma(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Nm(t),n]),Iy=e=>o(o(u("interface",e),([t,n])=>o(B(n),([r,a])=>o(Gp(a),([s,m])=>o(Ma(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[Km(t),n]),by=e=>o(o(u("type",e),([t,n])=>o(B(n),([r,a])=>o(Pa(a),([s,m])=>o(u("=",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Um(t),n]),$y=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])=>[Gm(t),n]),Ty=e=>o(o(o(u("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[_m(t),n]),vy=e=>o(o(o(u(";",e),([t,n])=>o(u(`
|
|
6
|
+
`,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]),_p=(e,t=[])=>o(o(qa(e),([n,r])=>o(vy(r),([a,s])=>[[n,a],s])),([n,r])=>_p(r,[...t,n]),()=>[t,e]),ky=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])=>[zm(t),n]),qa=e=>o(o(Ty(e),([t,n])=>o(o(hy(n),([r,a])=>[r,a],()=>o(Iy(n),([r,a])=>[r,a],()=>o(by(n),([r,a])=>[r,a],()=>o($y(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(gp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Bm(t),n]),Ey=e=>o(o(qa(e),([t,n])=>o(ky(n),([r,a])=>[[t,r],a])),([t,n])=>[Wm(t),n]),zp=e=>o(o(Ey(e),([t,n])=>[t,n],()=>o(Rg(e),([t,n])=>[t,n],()=>o(w(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function Bp(e){let t=Sa(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:V()}function Ry(e){return e.join("|")}function Oy(e){return e.slice(1,e.length-1)}function Py(e,t,n){return dt(t,`${n}${e}`)}function Sy(e,t){return dt(e,`${t}${mi}`)}function My(e,t){return dt(e,`${t}${mr}`)}function Cy(e,t){return dt(e,`${t}${ur}`)}function Ay(e,t){return Mn(k([O("false"),O("true")]),e,t)}function qy(e,t){return dt(e,`${t}${cr}`)}function Ly(e,t,n){return dt(t,`${n}${Oy(e)}`)}function jy(e,t,n){let r=Cn(e,{});return Mn(r,t,n)}function Fy(e,t,n){let r=ke(e);return Mn(r,t,n)}function Wp(e,t,n,r=[]){return i.ShiftLeft(e,(a,s)=>Wp(s,t,n,[...r,Mn(a,[],"")]),()=>dt(t,`${n}(${Ry(r)})`))}function Mn(e,t,n){return de(e)?Fy(e.enum,t,n):fe(e)?My(t,n):C(e)?Py(e.const,t,n):_e(e)?Sy(t,n):Re(e)?Ay(t,n):J(e)?Cy(t,n):xe(e)?qy(t,n):Z(e)?Ly(e.pattern,t,n):Hp(e)?jy(e.parameters[0],t,n):y(e)?Wp(e.anyOf,t,n):_o}function dt(e,t){return i.ShiftLeft(e,(n,r)=>Mn(n,r,t),()=>t)}function Dy(e){return`^${dt(e,"")}$`}function Vp(e){let t=Dy(e);return dr(t)}function Cn(e,t){return v(e)?p.Update(Vp(e),{},t):Tr(e,t)}function Yp(e,t,n,r){let a=Ee(e,t,n);return Cn(a,r)}function Tr(e,t={}){return h("TemplateLiteral",[e],t)}function Hp(e){return Q(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function Jp(e){return Cn(e,{})}function Ny(e){let t=Bp(e);return Jp(t)}function Zp(e,t={}){let n=i.IsString(e)?Ny(e):Jp(e);return p.Update(n,{},t)}function Z(e){return g(e,"TemplateLiteral")}var b={};gt(b,{ExtendsFalse:()=>T,ExtendsTrue:()=>x,ExtendsUnion:()=>La,IsExtendsFalse:()=>Ky,IsExtendsTrue:()=>Qp,IsExtendsTrueLike:()=>Wt,IsExtendsUnion:()=>Xp,Match:()=>K});function La(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Xp(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsUnion")&&i.IsObject(e.inferred)}function x(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Qp(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 Ky(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function Wt(e){return Xp(e)||Qp(e)}function K(e,t,n){return Wt(e)?t(e.inferred):n()}function Uy(e,t,n,r){return K(P(e,n,r),a=>x(p.Assign(p.Assign(e,a),{[t]:n})),()=>T())}function Gy(e,t){return x(e)}function _y(e,t,n,r,a){return K(P(e,t,n),s=>K(P(s,t,r),m=>x(m),()=>T()),()=>K(P(e,t,a),s=>x(s),()=>T()))}function zy(e,t,n){let r=ke(n);return P(e,t,r)}function eu(e,t,n){return i.ShiftLeft(n,(r,a)=>K(P(e,t,r),s=>eu(s,t,a),()=>T()),()=>x(e))}function By(e,t,n){let r=he(n);return P(e,t,r)}function tu(e,t,n){return i.ShiftLeft(n,(r,a)=>K(P(e,t,r),s=>x(s),()=>tu(e,t,a)),()=>T())}function A(e,t,n){return Y(n)?Gy(e,t):z(n)?_y(e,t,n.if,n.then,n.else):de(n)?zy(e,t,n.enum):W(n)?Uy(e,n.name,t,n.extends):R(n)?eu(e,t,n.allOf):Z(n)?By(e,t,n.pattern):y(n)?tu(e,t,n.anyOf):ee(n)?x(e):T()}function nu(e,t,n){return W(n)?A(e,t,n):Y(n)?x(e):ee(n)?x(e):La(e)}function Wy(e,t){let n=Tt(e),r=Tt(t);return n&&r||!n&&r?!0:!(n&&!r)}function ru(e,t,n,r){return U(r)?Wy(t,r)?P(e,n,r.items):T():A(e,t,r)}function au(e,t,n){return _e(n)?x(e):A(e,t,n)}function ou(e,t,n){return Re(n)?x(e):A(e,t,n)}function Vy(e,t,n,r,a){let s=W(r)?t:r,m=W(r)?r:t,c=ue(t),l=ue(r);return!c&&l?T():K(P(e,s,m),I=>An(I,n,a),()=>T())}function Hy(e,t,n,r){return i.ShiftLeft(r,(a,s)=>Vy(e,t,n,a,s),()=>ue(t)?x(e):T())}function Yy(e,t,n){return i.ShiftLeft(t,(r,a)=>Hy(e,r,a,n),()=>x(e))}function An(e,t,n){return Yy(e,t,n)}function Yr(e,t,n){return ze(n)?x(e):P(e,t,n)}function iu(e,t,n,r){return Y(r)?x(e):ee(r)?x(e):te(r)?K(An(e,t,r.parameters),a=>Yr(a,n,r.instanceType),()=>T()):T()}function su(e,t,n,r,a){return K(P(e,t,a),()=>P(e,n,a),()=>P(e,r,a))}function mu(e,t,n){let r=ke(t);return P(e,r,n)}function pu(e,t,n,r){return Y(r)?x(e):ee(r)?x(e):ne(r)?K(An(e,t,r.parameters),a=>Yr(a,n,r.returnType),()=>T()):T()}function uu(e,t,n){return fe(n)?x(e):J(n)?x(e):A(e,t,n)}function cu(e,t,n){let r=G(t);return P(e,r,n)}function Jr(e,t,n){return t===n?x(e):T()}function Jy(e,t,n){return C(n)?Jr(e,t,n.const):_e(n)?x(e):A(e,O(t),n)}function Zy(e,t,n){return C(n)?Jr(e,t,n.const):Re(n)?x(e):A(e,O(t),n)}function Xy(e,t,n){return C(n)?Jr(e,t,n.const):J(n)?x(e):A(e,O(t),n)}function Qy(e,t,n){return C(n)?Jr(e,t,n.const):xe(n)?x(e):A(e,O(t),n)}function lu(e,t,n){return i.IsBigInt(t.const)?Jy(e,t.const,n):i.IsBoolean(t.const)?Zy(e,t.const,n):i.IsNumber(t.const)?Xy(e,t.const,n):i.IsString(t.const)?Qy(e,t.const,n):V()}function du(e,t,n){return W(n)?A(e,t,n):x(e)}function fu(e,t,n){return jt(n)?x(e):A(e,t,n)}function xu(e,t,n){return J(n)?x(e):A(e,t,n)}function eh(e,t,n){return ue(t)?ue(n)?x(e):T():x(e)}function th(e,t,n){return W(n)&&it(n.extends)?T():K(P(e,t,n),r=>eh(r,t,n),()=>T())}function nh(e,t){return e.reduce((n,r)=>r in t?Wt(t[r])?{...n,...t[r].inferred}:V():V(),{})}function rh(e,t,n){let r={};for(let m of i.Keys(n))r[m]=m in t?th({},t[m],n[m]):ue(n[m])?W(n[m])?x(p.Assign(e,{[n[m].name]:n[m].extends})):x(e):T();let a=i.Values(r).every(m=>Wt(m)),s=a?nh(i.Keys(r),r):{};return a?x(s):T()}function ah(e,t,n){let r=rh(e,t,n);return Wt(r)?x(p.Assign(e,r.inferred)):T()}function oh(e,t,n){return ah(e,t,n)}function ih(e,t){return i.Keys(t).reduce((n,r)=>({...n,[r]:i.HasPropertyKey(e,r)?y(n[r])?k([...n[r].anyOf,t[r]]):k([e[r],t[r]]):t[r]}),e)}function gu(e,t,n,r){return i.ShiftLeft(t,(a,s)=>K(P({},e[a],n),m=>gu(e,s,n,ih(r,m)),()=>T()),()=>x(r))}function sh(e,t,n,r){let a=i.Keys(t);return gu(t,a,r,e)}function yu(e,t,n){return pe(n)?sh(e,t,Se(n),ge(n)):M(n)?oh(e,t,n.properties):A(e,$(t),n)}function mh(e,t){return i.IsEqual(i.Keys(t).length,0)?x(e):T()}function ph(e,t,n,r,a){return P(e,n,a)}function hu(e,t,n,r){return pe(r)?ph(e,hr(t),n,hr(Se(r)),ge(r)):M(r)?mh(e,r.properties):Y(r)?x(e):ee(r)?x(e):T()}function Iu(e,t,n){return xe(n)?x(e):A(e,t,n)}function bu(e,t,n){return st(n)?x(e):A(e,t,n)}function $u(e,t,n){let r=he(t);return P(e,r,n)}function ja(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function qn(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 Fa(e){return ut(e)?W(e.items)?U(e.items.extends)?ja(e.items.name,e.items.extends.items):ee(e.items.extends)?ja(e.items.name,e.items.extends):void 0:V():void 0}function Zr(e){return W(e)?ja(e.name,e.extends):void 0}function Da(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>K(P({},r,t),()=>Da(a,t,[...n,r]),()=>{}),()=>n)}function Tu(e,t,n,r){let a=Da(n,r);return i.IsArray(a)?x(p.Assign(e,{[t]:X(a)})):T()}function Xr(e,t,n,r){let a=Da(n,r);return i.IsArray(a)?x(p.Assign(e,{[t]:k(a)})):T()}function uh(e){return[...e].reverse()}function Na(e,t){return t?uh(e):e}function ch(e){let t=e.length>0?e[0]:void 0,n=Q(t)?Fa(t):void 0;return Q(n)}function lh(e,t,n,r,a,s){return K(P(e,n,a),m=>vu(m,t,r,s),()=>T())}function dh(e,t,n,r,a){let s=Fa(r);return qn(s)?Tu(e,s.name,Na(n,t),s.type):i.ShiftLeft(n,(m,c)=>lh(e,t,m,c,r,a),()=>T())}function fh(e,t,n,r){return i.ShiftLeft(r,(a,s)=>dh(e,t,n,a,s),()=>i.IsEqual(n.length,0)?x(e):T())}function vu(e,t,n,r){return fh(e,t,n,r)}function xh(e,t,n){let r=ft(e,N([],[]),n),a=ch(r);return vu(e,a,Na(t,a),Na(r,a))}function ku(e,t,n){let r=Zr(n);return qn(r)?Xr(e,r.name,t,r.type):i.ShiftLeft(t,(a,s)=>K(P(e,a,n),m=>ku(m,s,n),()=>T()),()=>x(e))}function Eu(e,t,n){let r=ft(e,N([],[]),t);return F(n)?xh(e,r,n.items):U(n)?ku(e,r,n.items):A(e,X(r),n)}function wu(e,t,n){return ze(n)?x(e):Gt(n)?x(e):A(e,t,n)}function Ru(e,t,n){return i.ShiftLeft(n,(r,a)=>K(P(e,t,r),s=>x(s),()=>Ru(e,t,a)),()=>T())}function Ka(e,t,n){return i.ShiftLeft(t,(r,a)=>K(Ru(e,r,n),s=>Ka(s,a,n),()=>T()),()=>x(e))}function Ou(e,t,n){let r=Zr(n);return qn(r)?Xr(e,r.name,t,r.type):y(n)?Ka(e,t,n.anyOf):Ka(e,t,[n])}function Pu(e,t,n){return W(n)?A(e,t,n):Y(n)?x(e):ee(n)?x(e):T()}function Su(e,t,n){return ze(n)?x(e):A(e,t,n)}function P(e,t,n){return Y(t)?nu(e,t,n):U(t)?ru(e,t,t.items,n):_e(t)?au(e,t,n):Re(t)?ou(e,t,n):te(t)?iu(e,t.parameters,t.instanceType,n):z(t)?su(e,t.if,t.then,t.else,n):de(t)?mu(e,t.enum,n):ne(t)?pu(e,t.parameters,t.returnType,n):fe(t)?uu(e,t,n):R(t)?cu(e,t.allOf,n):C(t)?lu(e,t,n):it(t)?du(e,t,n):jt(t)?fu(e,t,n):J(t)?xu(e,t,n):M(t)?yu(e,t.properties,n):pe(t)?hu(e,Se(t),ge(t),n):xe(t)?Iu(e,t,n):st(t)?bu(e,t,n):Z(t)?$u(e,t.pattern,n):F(t)?Eu(e,t.items,n):Gt(t)?wu(e,t,n):y(t)?Ou(e,t.anyOf,n):ee(t)?Pu(e,t,n):ze(t)?Su(e,t,n):T()}function gh(e,t){return G([...e,$(t)])}function Ua(e,t,n){return v(e)?p.Update(gh(e,t),{},n):wn(e,t,n)}function Mu(e,t,n,r,a){let s=Ee(e,t,n),m=Ln(e,t,r);return Ua(s,m,a)}function wn(e,t,n={}){return h("Interface",[e,t],n)}function Vt(e){return Q(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function Cu(e,t,n={}){return Ua(e,t,n)}function yh(e,t,n){return e.includes(n)?!0:jn([...e,n],t,t[n])}function Au(e,t,n){let r=rr(n);return Pt(e,t,r)}function Pt(e,t,n){return i.ShiftLeft(n,(r,a)=>jn(e,t,r)?!0:Pt(e,t,a),()=>!1)}function jn(e,t,n){return re(n)?yh(e,t,n.$ref):U(n)?jn(e,t,n.items):te(n)?Pt(e,t,[...n.parameters,n.instanceType]):ne(n)?Pt(e,t,[...n.parameters,n.returnType]):Vt(n)?Au(e,t,n.parameters[1]):R(n)?Pt(e,t,n.allOf):M(n)?Au(e,t,n.properties):y(n)?Pt(e,t,n.anyOf):F(n)?Pt(e,t,n.items):pe(n)?jn(e,t,ge(n)):!1}function qu(e,t,n){return jn(e,t,n)}function hh(e,t){return t.reduce((n,r)=>qu([r],e,e[r])?[...n,r]:n,[])}function Lu(e){let t=nr(e);return hh(e,t)}function Ih(e,t,n){return n.includes(t)?n:t in e?Fn(e,e[t],[...n,t]):V()}function ju(e,t,n){let r=rr(t);return Ht(e,r,n)}function Ht(e,t,n){return t.reduce((r,a)=>Fn(e,a,r),n)}function Fn(e,t,n){return re(t)?Ih(e,t.$ref,n):U(t)?Fn(e,t.items,n):te(t)?Ht(e,[...t.parameters,t.instanceType],n):ne(t)?Ht(e,[...t.parameters,t.returnType],n):Vt(t)?ju(e,t.parameters[1],n):R(t)?Ht(e,t.allOf,n):M(t)?ju(e,t.properties,n):y(t)?Ht(e,t.anyOf,n):F(t)?Ht(e,t.items,n):pe(t)?Fn(e,ge(t),n):n}function Fu(e,t,n){return Fn(e,n,[t])}function bh(e){return At()}function $h(e){return i.Keys(e).reduce((t,n)=>({...t,[n]:St(e[n])}),{})}function Dn(e){return e.reduce((t,n)=>[...t,St(n)],[])}function St(e){return re(e)?bh(e.$ref):U(e)?ve(St(e.items),tr(e)):te(e)?Fe(Dn(e.parameters),St(e.instanceType)):ne(e)?De(Dn(e.parameters),St(e.returnType)):R(e)?ce(Dn(e.allOf)):M(e)?$($h(e.properties)):pe(e)?yr(Kt(e),St(ge(e))):y(e)?k(Dn(e.anyOf)):F(e)?X(Dn(e.items)):e}function Th(e,t){return t in e?St(e[t]):ae()}function Du(e){return Th(e.$defs,e.$ref)}function vh(e,t,n){let r=Ee(e,N([],[]),t),a=Ln({},N([],[]),n);return G([...r,$(a)])}function kh(e,t){return i.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let s=e[a],m=Vt(s)?vh(e,s.parameters[0],s.parameters[1]):s;return{...r,[a]:m}},{})}function Nu(e,t,n){let r=Fu(e,t,n),a=kh(e,r);return Ke(a,t)}function Ku(e,t){return t in e?re(e[t])?Ku(e,e[t].$ref):e[t]:L()}function Be(e,t){return Ku(e,t)}function Uu(e){return se(e)?Du(e):ar(e)?ae():e}function me(e,t,n){let r=Uu(t),a=Uu(n);return P(e,r,a)}var bn="equal",Eh="disjoint",$n="left-inside",Tn="right-inside";function Dt(e,t){let n=[ee(e)?b.ExtendsFalse():me({},e,t),ee(e)?b.ExtendsTrue({}):me({},t,e)];return b.IsExtendsTrueLike(n[0])&&b.IsExtendsTrueLike(n[1])?bn:b.IsExtendsTrueLike(n[0])&&b.IsExtendsFalse(n[1])?$n:b.IsExtendsFalse(n[0])&&b.IsExtendsTrueLike(n[1])?Tn:Eh}function wh(e,t){return t.filter(n=>Dt(e,n)!==Tn)}function Rh(e,t){let n=t.some(r=>{let a=Dt(e,r);return i.IsEqual(a,$n)||i.IsEqual(a,bn)});return i.IsEqual(n,!1)}function Oh(e,t){let n=Pe(e);return Y(n)?[n]:Rh(n,t)?[...wh(n,t),n]:t}function Ph(e){return e.reduce((t,n)=>M(n)?[...t,n]:it(n)?t:Oh(n,t),[])}function Ia(e){let t=Ph(e);return kn(t)}function Ga(e,t){return p.Update(Pe(e),{},t)}function Gu(e,t,n,r){let a=d(e,t,n);return Ga(a,r)}function Nn(e,t=[]){return at(e)&&i.IsEqual(e.action,"Conditional")?re(e.parameters[0])?Nn(e.parameters[2],Nn(e.parameters[3],[...t,e.parameters[0].$ref])):Nn(e.parameters[2],Nn(e.parameters[3],t)):at(e)&&i.IsEqual(e.action,"Mapped")&&at(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&re(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function Sh(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function Bu(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>i.ShiftLeft(t,(s,m)=>Bu(a,m,[...n,[s,r]]),()=>n),()=>n)}function Mh(e){return y(e)?[...e.anyOf]:[e]}function Ch(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function _u(e,t){return t.reduce((n,r)=>[...n,...Ch(e,r)],[])}function zu(e){return e.reduce((t,n)=>i.IsEqual(n[0],!0)?_u(t,Mh(n[1])):_u(t,[n[1]]),[[]])}function Wu(e,t,n){let r=Nn(n),a=Sh(e,r),s=Bu(t,a);return at(n)&&i.IsEqual(n.action,"Conditional")||at(n)&&i.IsEqual(n.action,"Mapped")?zu(s):[t]}function Ah(){return["(not-resolvable)",L()]}function qh(){return["(not-generic)",L()]}function Lh(e,t,n){return[e,ot(t,n)]}function jh(e,t,n){return t in e?Vu(e,t,e[t],n):Ah()}function Vu(e,t,n,r){return Ct(n)?Lh(t,n.parameters,n.expression):re(n)?jh(e,n.$ref,r):qh()}function Hu(e,t,n){return Vu(e,"(anonymous)",t,n)}function Fh(e,t,n){if(W(t)||Yt(t)||b.IsExtendsTrueLike(me({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function Yu(e,t,n,r,a){let s=d(e,t,a);return Fh(n,s,r),p.Assign(e,{[n]:s})}function Dh(e,t,n,r,a){let s=d(e,t,n.extends),m=d(e,t,n.equals);return i.ShiftLeft(a,(c,l)=>_a(Yu(e,t,n.name,s,c),t,r,l),()=>_a(Yu(e,t,n.name,s,m),t,r,[]))}function _a(e,t,n,r){return i.ShiftLeft(n,(a,s)=>Dh(e,t,a,s,r),()=>e)}function Ju(e,t,n,r){return _a(e,t,n,r)}function Nh(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function Kh(e,t){return i.IsEqual(Nh(e),t)}function Uh(e,t,n,r,a,s){let m=Ju(e,t,r,s),c=d(m,N([...t.callstack,n.$ref],t.visited),a);return d(m,N([],[]),c)}function Gh(e,t,n,r,a,s){return s.reduce((m,c)=>[...m,Uh(e,t,n,r,a,c)],[])}function _h(e,t,n,r,a,s){let m=Wu(r,s,a),c=Gh(e,t,n,r,a,m);return i.IsEqual(c.length,1)?c[0]:be(c)}function Qr(e,t,n,r){let a=Ee(e,t,r),s=Hu(e,n,r),m=s[0],c=s[1];return Ct(c)?Kh(t,m)?Rn(Je(m),a):_h(e,t,Je(m),c.parameters,c.expression,a):Rn(n,a)}function Rn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Zu(e,t){return Qr({},N([],[]),e,t)}function Yt(e){return g(e,"Call")}function zh(e){return p.Discard(e,["~immutable"])}function Xu(e,t){return p.Update(zh(e),{},t)}function Qu(e,t,n,r){let a=d(e,t,n);return Xu(a,r)}function ec(e,t){return e(t)}function tc(e,t){return i.IsString(t)?O(ec(e,t)):O(t)}function nc(e,t){let n=he(t);return Qe(e,n)}function rc(e,t){let n=t.map(r=>Qe(e,r));return k(n)}function Qe(e,t){return C(t)?tc(e,t.const):Z(t)?nc(e,t.pattern):y(t)?rc(e,t.anyOf):t}function vr(e,t={}){return h("Capitalize",[e],t)}function ac(e,t={}){return za(e,t)}function kr(e,t={}){return h("Lowercase",[e],t)}function oc(e,t={}){return Ba(e,t)}function Er(e,t={}){return h("Uncapitalize",[e],t)}function ic(e,t={}){return Wa(e,t)}function wr(e,t={}){return h("Uppercase",[e],t)}function sc(e,t={}){return Va(e,t)}var Bh=e=>e[0].toUpperCase()+e.slice(1),Wh=e=>e.toLowerCase(),Vh=e=>e[0].toLowerCase()+e.slice(1),Hh=e=>e.toUpperCase();function za(e,t){return v([e])?p.Update(Qe(Bh,e),{},t):vr(e,t)}function Ba(e,t){return v([e])?p.Update(Qe(Wh,e),{},t):kr(e,t)}function Wa(e,t){return v([e])?p.Update(Qe(Vh,e),{},t):Er(e,t)}function Va(e,t){return v([e])?p.Update(Qe(Hh,e),{},t):wr(e,t)}function mc(e,t,n,r){let a=d(e,t,n);return za(a,r)}function pc(e,t,n,r){let a=d(e,t,n);return Ba(a,r)}function uc(e,t,n,r){let a=d(e,t,n);return Wa(a,r)}function cc(e,t,n,r){let a=d(e,t,n);return Va(a,r)}function Rr(e,t,n,r,a={}){return h("Conditional",[e,t,n,r],a)}function lc(e,t,n,r,a={}){return Ha({},N([],[]),e,t,n,r,a)}function Yh(e,t,n,r,a,s){let m=me(e,n,r);return b.IsExtendsUnion(m)?k([d(m.inferred,t,a),d(e,t,s)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,s)}function Ha(e,t,n,r,a,s,m){return v([n,r])?p.Update(Yh(e,t,n,r,a,s),{},m):Rr(n,r,a,s,m)}function dc(e,t,n,r,a,s,m){let c=d(e,t,n),l=d(e,t,r);return Ha(e,t,c,l,a,s,m)}function Or(e,t={}){return h("ConstructorParameters",[e],t)}function fc(e,t={}){return Ya(e,t)}function Jh(e){let t=te(e)?e.parameters:[],n=ft({},N([],[]),t);return X(n)}function Ya(e,t){return v([e])?p.Update(Jh(e),{},t):Or(e,t)}function xc(e,t,n,r){let a=d(e,t,n);return Ya(a,r)}function Pr(e,t,n={}){return h("Exclude",[e,t],n)}function gc(e,t,n={}){return Kn(e,t,n)}function Kn(e,t,n){return v([e,t])?p.Update(xr(e,t),{},n):Pr(e,t,n)}function yc(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Kn(s,m,a)}function Sr(e,t,n={}){return h("Extract",[e,t],n)}function hc(e,t,n={}){return Ja(e,t,n)}function Zh(e,t){let n=me({},e,t);return b.IsExtendsTrueLike(n)?[e]:[]}function Xh(e,t){return e.reduce((n,r)=>[...n,...Zh(r,t)],[])}function Ic(e,t){let n=Pe(e),r=y(n)?n.anyOf:[n],a=Xh(r,t);return be(a)}function Ja(e,t,n){return v([e,t])?p.Update(Ic(e,t),{},n):Sr(e,t,n)}function bc(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Ja(s,m,a)}function Qh(e){return e.reduce((t,n)=>pr(n)?[...t,O(n)]:t,[])}function Jt(e){let t=Qh(e);return k(t)}function On(e,t,n={}){return h("Index",[e,t],n)}function $c(e,t,n={}){let r=i.IsArray(t)?Jt(t):t;return Za(e,r,n)}function Tc(e,t){let n=Be(e,t);return we(n)}function vc(e,t,n){let r=je(e,t,n);return we(r)}function eI(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,q)=>({...f,[q]:e[q]}),{}),m=r.reduce((f,q)=>({...f,[q]:t[q]}),{}),c=a.reduce((f,q)=>({...f,[q]:G([e[q],t[q]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function kc(e){return e.reduce((t,n)=>eI(t,we(n)),{})}function Ec(e){let t=Si(X(e));return we(t)}function tI(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:be([e[s],t[s]])}),{})}function wc(e,t){return i.ShiftLeft(e,(n,r)=>wc(r,tI(t,we(n))),()=>t)}function Rc(e){return i.ShiftLeft(e,(t,n)=>wc(n,we(t)),()=>V())}function we(e){return se(e)?Tc(e.$defs,e.$ref):z(e)?vc(e.if,e.then,e.else):R(e)?kc(e.allOf):y(e)?Rc(e.anyOf):F(e)?Ec(e.items):M(e)?e.properties:{}}function Zt(e){let t=we(e);return $(t)}var nI=new RegExp("^(?:0|[1-9][0-9]*)$");function Xt(e){let t=`${e}`;return nI.test(t)?parseInt(t):e}function rI(e){return O(Xt(e))}function Oc(e){return e.map(t=>Pc(t))}function Pc(e){return R(e)?ce(Oc(e.allOf)):y(e)?k(Oc(e.anyOf)):C(e)?rI(e.const):e}function Sc(e,t){let n=Pc(t),r=me({},n,Ie());return b.IsExtendsTrueLike(r)?e:C(t)&&i.IsEqual(t.const,"length")?Ie():L()}function Mc(e,t){let n=Be(e,t);return $e(n)}function Cc(e,t,n){let r=je(e,t,n);return $e(r)}function Ac(e){let t=ke(e);return $e(t)}function qc(e){let t=G(e);return $e(t)}function Lc(e){return[`${e}`]}function jc(e){let t=he(e);return $e(t)}function Fc(e){return e.reduce((t,n)=>[...t,...$e(n)],[])}function $e(e){return se(e)?Mc(e.$defs,e.$ref):z(e)?Cc(e.if,e.then,e.else):de(e)?Ac(e.enum):R(e)?qc(e.allOf):C(e)?Lc(e.const):Z(e)?jc(e.pattern):y(e)?Fc(e.anyOf):[]}function Qt(e){return $e(e)}function Un(e,t){return t.map(n=>Gn(e,n))}function Gn(e,t){return U(t)?ve(Gn(e,t.items)):te(t)?Fe(Un(e,t.parameters),Gn(e,t.instanceType)):ne(t)?De(Un(e,t.parameters),Gn(e,t.returnType)):F(t)?X(Un(e,t.items)):y(t)?k(Un(e,t.anyOf)):R(t)?ce(Un(e,t.allOf)):br(t)?$(e):t}function Dc(e,t){return Gn(e,t)}function aI(e,t){let n=t in e?e[t]:L();return Dc(e,n)}function Nc(e,t){return t.reduce((n,r)=>[...n,aI(e,r)],[])}function oI(e,t){let n=Qt(t),r=Nc(e,n);return be(r)}var iI=new RegExp(pt);function sI(e){return e.filter(n=>iI.test(n))}function mI(e){let t=nr(e),n=sI(t),r=Nc(e,n);return be(r)}function Kc(e,t){return J(t)?mI(e):oI(e,t)}function pI(e){return O(Xt(e))}function Uc(e){return e.map(t=>Xa(t))}function Xa(e){return R(e)?ce(Uc(e.allOf)):y(e)?k(Uc(e.anyOf)):C(e)?pI(e.const):e}function uI(e,t){return e.reduceRight((n,r,a)=>{let s=me({},O(a),t);return b.IsExtendsTrueLike(s)?[r,...n]:n},[])}function cI(e,t){let n=Xa(t),r=uI(e,n);return Ze(r)}function lI(e){return Ze(e)}function Gc(e,t){return C(t)&&i.IsEqual(t.const,"length")?O(e.length):J(t)||fe(t)?lI(e):cI(e,t)}function _c(e,t){return U(e)?Sc(e.items,t):M(e)?Kc(e.properties,t):F(e)?Gc(e.items,t):L()}function dI(e){return se(e)||z(e)||R(e)||y(e)?Zt(e):e}function Za(e,t,n){return v([e,t])?p.Update(_c(dI(e),t),{},n):On(e,t,n)}function zc(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Za(s,m,a)}function Mr(e,t={}){return h("InstanceType",[e],t)}function Bc(e,t={}){return Qa(e,t)}function fI(e){return te(e)?e.instanceType:L()}function Qa(e,t){return v([e])?p.Update(fI(e),{},t):Mr(e,t)}function Wc(e,t,n,r={}){let a=d(e,t,n);return Qa(a,r)}function Pn(e,t={}){return h("KeyOf",[e],t)}function Vc(e,t={}){return eo(e,t)}function Hc(){return k([Ie(),Oe(),Ft()])}function Yc(e){return Ie()}function xI(e){return e.reduce((n,r)=>pr(r)?[...n,O(Xt(r))]:V(),[])}function Jc(e){let t=i.Keys(e),n=xI(t);return Ze(n)}function Zc(e){return Kt(e)}function Xc(e){let t=e.map((n,r)=>O(r));return Ze(t)}function Qc(e){return Y(e)?Hc():U(e)?Yc(e.items):M(e)?Jc(e.properties):pe(e)?Zc(e):F(e)?Xc(e.items):L()}function gI(e){return se(e)||z(e)||R(e)||y(e)?Zt(e):e}function eo(e,t){return v([e])?p.Update(Qc(gI(e)),{},t):Pn(e,t)}function el(e,t,n,r){let a=d(e,t,n);return eo(a,r)}function En(e,t,n,r,a={}){return h("Mapped",[e,t,n,r],a)}function tl(e,t,n,r,a={}){return to({},N([],[]),e,t,n,r,a)}function yI(e){let t=he(e);return ea(t)}function hI(e){return e.reduce((t,n)=>[...t,...ea(n)],[])}function II(e){let t=ke(e);return ea(t)}function bI(e){return i.IsNumber(e)?[O(`${e}`)]:[O(e)]}function ea(e){return de(e)?II(e.enum):C(e)?bI(e.const):Z(e)?yI(e.pattern):y(e)?hI(e.anyOf):[e]}function nl(e){return ea(e)}function $I(e){return Z(e)?he(e.pattern):e}function TI(e,t,n,r,a,s){let m=p.Assign(e,{[n.name]:r}),c=d(m,t,a),l=$I(c),I=d(m,t,s);return ui(l)||ci(l)?{[l.const]:I}:{}}function vI(e,t,n,r,a,s){return r.reduce((m,c)=>[...m,TI(e,t,n,c,a,s)],[])}function kI(e){return e.reduce((t,n)=>[...t,$(n)],[])}function rl(e,t,n,r,a,s){let m=nl(r),c=vI(e,t,n,m,a,s),l=kI(c);return G(l)}function to(e,t,n,r,a,s,m){return v([r])?p.Update(rl(e,t,n,r,a,s),{},m):En(n,r,a,s,m)}function al(e,t,n,r,a,s,m){let c=d(e,t,r);return to(e,t,n,c,a,s,m)}function EI(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>n.includes(s)).reduce((s,m)=>({...s,[m]:Nu(r,m,t[m])}),{})}function wI(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,N([],[]),t[m])}),{})}function RI(e,t,n){let r=Lu(t),a=EI(e,t,r),s=wI(e,t,r),m={...a,...s};return p.Update(m,{},n)}function ta(e,t,n,r){return RI(e,n,r)}function Cr(e,t={}){return h("NonNullable",[e],t)}function ol(e,t={}){return no(e,t)}function OI(e){let t=k([Lt(),Ut()]);return Kn(e,t,{})}function no(e,t){return v([e])?p.Update(OI(e),{},t):Cr(e,t)}function il(e,t,n,r){let a=d(e,t,n);return no(a,r)}function Ar(e,t,n={}){return h("Omit",[e,t],n)}function sl(e,t,n={}){let r=i.IsArray(t)?Jt(t):t;return ro(e,r,n)}function na(e){let t=Zt(e);return M(t)?t.properties:V()}function PI(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function ml(e,t){let n=na(e),r=Qt(t),a=PI(n,r);return $(a)}function ro(e,t,n){return v([e,t])?p.Update(ml(e,t),{},n):Ar(e,t,n)}function pl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return ro(s,m,a)}function qr(e,t={}){return h("Parameters",[e],t)}function ul(e,t={}){return ao(e,t)}function SI(e){let t=ne(e)?e.parameters:[],n=ft({},N([],[]),t);return X(n)}function ao(e,t){return v([e])?p.Update(SI(e),{},t):qr(e,t)}function cl(e,t,n,r){let a=d(e,t,n);return ao(a,r)}function Lr(e,t={}){return h("Partial",[e],t)}function ll(e,t={}){return oo(e,t)}function dl(e,t){let n=Be(e,t),r=We(n);return Ke(p.Assign(e,{[t]:r}),t)}function fl(e,t,n){let r=je(e,t,n);return We(r)}function xl(e){let t=G(e);return We(t)}function gl(e){let t=e.map(n=>We(n));return k(t)}function yl(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:bt(e[a])}),{});return $(t)}function We(e){return se(e)?dl(e.$defs,e.$ref):z(e)?fl(e.if,e.then,e.else):R(e)?xl(e.allOf):y(e)?gl(e.anyOf):M(e)?yl(e.properties):$({})}function oo(e,t){return v([e])?p.Update(We(e),{},t):Lr(e,t)}function hl(e,t,n,r){let a=d(e,t,n);return oo(a,r)}function jr(e,t,n={}){return h("Pick",[e,t],n)}function Il(e,t,n={}){let r=i.IsArray(t)?Jt(t):t;return io(e,r,n)}function MI(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function bl(e,t){let n=na(e),r=Qt(t),a=MI(n,r);return $(a)}function io(e,t,n){return v([e,t])?p.Update(bl(e,t),{},n):jr(e,t,n)}function $l(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return io(s,m,a)}function Fr(e,t={}){return h("ReadonlyObject",[e],t)}function so(e,t={}){return mo(e,t)}var Tl=so;function vl(e){return qt(ve(e))}function kl(e,t){let n=Be(e,t),r=Ve(n);return Ke(p.Assign(e,{[t]:r}),t)}function El(e,t,n){let r=je(e,t,n);return Ve(r)}function wl(e){let t=G(e);return Ve(t)}function Rl(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:vt(e[a])}),{});return $(t)}function Ol(e){return qt(X(e))}function Pl(e){let t=e.map(n=>Ve(n));return k(t)}function Ve(e){return U(e)?vl(e.items):se(e)?kl(e.$defs,e.$ref):z(e)?El(e.if,e.then,e.else):R(e)?wl(e.allOf):M(e)?Rl(e.properties):F(e)?Ol(e.items):y(e)?Pl(e.anyOf):e}function mo(e,t){return v([e])?p.Update(Ve(e),{},t):Fr(e)}function Sl(e,t,n,r){let a=d(e,t,n);return mo(a,r)}function Ml(e,t,n,r){return t.visited.includes(r)?n:r in e?d(e,N(t.callstack,[...t.visited,r]),e[r]):n}function Cl(e,t){let n=Be(e,t),r=He(n);return Ke(p.Assign(e,{[t]:r}),t)}function Al(e,t,n){let r=je(e,t,n);return He(r)}function ql(e){let t=G(e);return He(t)}function Ll(e){let t=e.map(n=>He(n));return k(t)}function jl(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:fr(e[a])}),{});return $(t)}function He(e){return se(e)?Cl(e.$defs,e.$ref):z(e)?Al(e.if,e.then,e.else):R(e)?ql(e.allOf):y(e)?Ll(e.anyOf):M(e)?jl(e.properties):$({})}function Dr(e,t={}){return h("Required",[e],t)}function Fl(e,t={}){return po(e,t)}function po(e,t){return v([e])?p.Update(He(e),{},t):Dr(e,t)}function Dl(e,t,n,r){let a=d(e,t,n);return po(a,r)}function Nr(e,t={}){return h("ReturnType",[e],t)}function Nl(e,t={}){return uo(e,t)}function CI(e){return ne(e)?e.returnType:L()}function uo(e,t){return v([e])?p.Update(CI(e),{},t):Nr(e,t)}function Kl(e,t,n,r={}){let a=d(e,t,n);return uo(a,r)}function Kr(e,t){return h("With",[e,t],{})}function Ul(e,t){return co(e,t)}function co(e,t){return v([e])?p.Update(e,{},t):Kr(e,t)}function Gl(e,t,n,r){let a=d(e,t,n);return co(a,r)}function AI(e){return ut(e)?F(e.items)?lo(e.items.items):W(e.items)?[e]:re(e.items)?[e]:[L()]:[e]}function lo(e){return e.reduce((n,r)=>[...n,...AI(r)],[])}function N(e,t){return{callstack:e,visited:t}}function v(e){return i.ShiftLeft(e,(t,n)=>re(t)?!1:v(n),()=>!0)}function Ln(e,t,n){return i.Keys(n).reduce((r,a)=>({...r,[a]:d(e,t,n[a])}),{})}function ft(e,t,n){let r=Ee(e,t,n);return lo(r)}function Ee(e,t,n){return n.map(r=>d(e,t,r))}function qI(e,t){let n=ue(e)?dn(t,{}):t,r=kt(e)?ln(n,{}):n;return Tt(e)?_n(r,{}):r}function LI(e,t,n,r,a){return i.IsEqual(n,"AddImmutable")?_l(e,t,r[0],a):i.IsEqual(n,"RemoveImmutable")?Qu(e,t,r[0],a):i.IsEqual(n,"AddReadonly")?No(e,t,r[0],a):i.IsEqual(n,"RemoveReadonly")?Ei(e,t,r[0],a):i.IsEqual(n,"AddOptional")?Ko(e,t,r[0],a):i.IsEqual(n,"RemoveOptional")?Oi(e,t,r[0],a):i.IsEqual(n,"Capitalize")?mc(e,t,r[0],a):i.IsEqual(n,"Conditional")?dc(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"ConstructorParameters")?xc(e,t,r[0],a):i.IsEqual(n,"Evaluate")?Gu(e,t,r[0],a):i.IsEqual(n,"Exclude")?yc(e,t,r[0],r[1],a):i.IsEqual(n,"Extract")?bc(e,t,r[0],r[1],a):i.IsEqual(n,"Index")?zc(e,t,r[0],r[1],a):i.IsEqual(n,"InstanceType")?Wc(e,t,r[0],a):i.IsEqual(n,"Interface")?Mu(e,t,r[0],r[1],a):i.IsEqual(n,"KeyOf")?el(e,t,r[0],a):i.IsEqual(n,"Lowercase")?pc(e,t,r[0],a):i.IsEqual(n,"Mapped")?al(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")?il(e,t,r[0],a):i.IsEqual(n,"Pick")?$l(e,t,r[0],r[1],a):i.IsEqual(n,"Parameters")?cl(e,t,r[0],a):i.IsEqual(n,"Partial")?hl(e,t,r[0],a):i.IsEqual(n,"Omit")?pl(e,t,r[0],r[1],a):i.IsEqual(n,"ReadonlyObject")?Sl(e,t,r[0],a):i.IsEqual(n,"Record")?Bi(e,t,r[0],r[1],a):i.IsEqual(n,"Required")?Dl(e,t,r[0],a):i.IsEqual(n,"ReturnType")?Kl(e,t,r[0],a):i.IsEqual(n,"TemplateLiteral")?Yp(e,t,r[0],a):i.IsEqual(n,"Uncapitalize")?uc(e,t,r[0],a):i.IsEqual(n,"Uppercase")?cc(e,t,r[0],a):i.IsEqual(n,"With")?Gl(e,t,r[0],r[1]):h(n,r,a)}function jI(e,t,n){let r=re(n)?Ml(e,t,n,n.$ref):U(n)?ve(d(e,t,n.items),tr(n)):Yt(n)?Qr(e,t,n.target,n.arguments):te(n)?Fe(Ee(e,t,n.parameters),d(e,t,n.instanceType),Uo(n)):ne(n)?De(Ee(e,t,n.parameters),d(e,t,n.returnType),Go(n)):z(n)?$t(d(e,t,n.if),d(e,t,n.then),d(e,t,n.else),Ho(n)):R(n)?ce(Ee(e,t,n.allOf),Qo(n)):M(n)?$(Ln(e,t,n.properties),Wo(n)):pe(n)?Wi(Se(n),d(e,t,ge(n))):ut(n)?Rt(d(e,t,n.items)):F(n)?X(ft(e,t,n.items),ki(n)):y(n)?k(Ee(e,t,n.anyOf),di(n)):n;return qI(n,r)}function d(e,t,n){return at(n)?LI(e,t,n.action,n.parameters,n.options):jI(e,t,n)}function fo(e,t){return d(e,N([],[]),t)}function FI(e){return p.Update(e,{"~immutable":!0},{})}function _n(e,t){return p.Update(FI(e),{},t)}function _l(e,t,n,r){let a=d(e,t,n);return _n(a,r)}function Vm(e,t={}){return h("AddImmutable",[e],t)}function qt(e,t={}){return _n(e,t)}function Hm(e,t={}){return h("Evaluate",[e],t)}function zl(e,t={}){return Ga(e,t)}function Ym(e,t={}){return h("Module",[e],t)}function Bl(e,t={}){return ta({},N([],[]),e,t)}function Wl(...e){let[t,n,r]=Ue.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=zp(n),s=i.IsArray(a)&&i.IsEqual(a.length,2)?d(t,N([],[]),a[0]):L();return p.Update(s,{},r)}var H={};gt(H,{Any:()=>At,Array:()=>ve,BigInt:()=>yn,Boolean:()=>sr,Call:()=>Zu,Capitalize:()=>ac,Codec:()=>ir,Conditional:()=>lc,Constructor:()=>Fe,ConstructorParameters:()=>fc,Cyclic:()=>Ke,Decode:()=>ri,DecodeBuilder:()=>gn,Dependent:()=>$t,Encode:()=>ai,EncodeBuilder:()=>xn,Enum:()=>Xo,Evaluate:()=>zl,Exclude:()=>gc,Extends:()=>me,ExtendsResult:()=>b,Extract:()=>hc,Function:()=>De,Generic:()=>ot,Identifier:()=>hn,Immutable:()=>oi,Index:()=>$c,Infer:()=>fn,InstanceType:()=>Bc,Instantiate:()=>fo,Integer:()=>Et,Interface:()=>Cu,Intersect:()=>ce,IsAny:()=>Y,IsArray:()=>U,IsBigInt:()=>_e,IsBoolean:()=>Re,IsCall:()=>Yt,IsCodec:()=>or,IsConstructor:()=>te,IsCyclic:()=>se,IsDependent:()=>z,IsEnum:()=>de,IsEnumValue:()=>Zo,IsFunction:()=>ne,IsGeneric:()=>Ct,IsIdentifier:()=>pi,IsImmutable:()=>Tt,IsInfer:()=>W,IsInteger:()=>fe,IsIntersect:()=>R,IsKind:()=>g,IsLiteral:()=>C,IsNever:()=>it,IsNull:()=>jt,IsNumber:()=>J,IsObject:()=>M,IsOptional:()=>ue,IsParameter:()=>li,IsReadonly:()=>kt,IsRecord:()=>pe,IsRef:()=>re,IsRefine:()=>da,IsRest:()=>ut,IsSchema:()=>Q,IsString:()=>xe,IsSymbol:()=>st,IsTemplateLiteral:()=>Z,IsThis:()=>br,IsTuple:()=>F,IsUndefined:()=>Gt,IsUnion:()=>y,IsUnknown:()=>ee,IsUnsafe:()=>ar,IsVoid:()=>ze,KeyOf:()=>Vc,Literal:()=>O,Lowercase:()=>oc,Mapped:()=>tl,Module:()=>Bl,Never:()=>L,NonNullable:()=>ol,Null:()=>Lt,Number:()=>Ie,Object:()=>$,Omit:()=>sl,Optional:()=>zo,Parameter:()=>wt,Parameters:()=>ul,Partial:()=>ll,Pick:()=>Il,Readonly:()=>ii,ReadonlyObject:()=>so,ReadonlyType:()=>Tl,Record:()=>yr,RecordKey:()=>Kt,RecordPattern:()=>Se,RecordValue:()=>ge,Ref:()=>Je,Refine:()=>si,Required:()=>Fl,Rest:()=>Rt,ReturnType:()=>Nl,Script:()=>Wl,String:()=>Oe,Symbol:()=>Ft,TemplateLiteral:()=>Zp,This:()=>Ir,Tuple:()=>X,Uncapitalize:()=>ic,Undefined:()=>Ut,Union:()=>k,Unknown:()=>ae,Unsafe:()=>Vo,Uppercase:()=>sc,Void:()=>$r,With:()=>Ul});var en="submit_review_report",zn="submit_test_gap_candidates",Bn="submit_filtered_test_gaps",DI=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 Vl(e){return{name:en,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:DI,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 NI=H.Object({gaps:H.Array(H.Object({description:H.String({description:"The specific untested behavior or edge case, in plain terms."}),risk:H.String({description:"Concretely why a plausible-but-incorrect implementation could still pass every test in test.patch despite missing or misimplementing this behavior."})}),{description:"Candidate behavioral test gaps 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 Hl(e){return{name:zn,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:NI,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 KI=H.Object({gaps:H.Array(H.Object({description:H.String({description:"The confirmed, real, fair test gap (may be reworded for clarity)."}),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."})}),{description:"The filtered, final list of confirmed test gaps. Use an empty array if none of the candidates survive strict scrutiny."})});function Yl(e){return{name:Bn,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:KI,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 UI={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 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 Jl(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.","",UI[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),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 \`${en}\` tool exactly once with your structured verdict. That tool call is your only way to report a result.`),r.join(`
|
|
8
|
+
`)}function Zl(e,t){let n=["You are an exhaustive, research-minded test-coverage analyst for a coding-agent benchmark task. Your mandate is to dig as deep as possible and surface EVERY genuine behavioral test gap you can find \u2014 not just the first one or two obvious ones. Treat a short list as a signal that you stopped too early, not as success.","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).","","Your job: find real BEHAVIORAL TEST GAPS. A 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 alternative implementation could satisfy `agent_prompt.md` on its face, differ from `solution.patch`, get that behavior wrong or skip it entirely, and STILL pass every test in `test.patch` as written.","","Be systematic and exhaustive \u2014 do not stop after finding one or two gaps. Work through ALL of the following passes before you consider yourself done:","1. Go through `agent_prompt.md` sentence by sentence. For every distinct requirement, constraint, or implied rule, explicitly 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` actually forces that branch to be taken and its outcome checked, or whether an implementation that got that branch wrong would still pass.","3. Systematically consider standard edge-case categories against the required behavior: boundary/limit values, empty/missing/null/zero inputs, duplicate or repeated inputs, ordering and interleaving, concurrent or repeated invocations, error/failure/rollback paths, interaction between two or more required behaviors at once (not just each in isolation), and state left behind after an operation.","4. Cross-check overlapping/interacting requirements \u2014 behaviors that are each tested alone but never tested together \u2014 since that's exactly where a plausible-looking but incomplete implementation slips through.","Do not filter yourself or self-censor for volume. List every gap that survives your own check against the ground rules below \u2014 a long, thorough list is expected and desired. A separate, independent agent will strictly filter this list afterward, so your job here is coverage and recall, not brevity.","","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).","","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, describe: (1) the specific untested behavior/edge case, in plain terms, and (2) concretely why a plausible-but-incorrect implementation would still pass every given test despite missing or misimplementing it.",`When you are done \u2014 after completing ALL the passes above \u2014 call the \`${zn}\` 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 Xl(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.","Another research agent reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) and proposed the following CANDIDATE test gaps \u2014 behaviors it believes are required but untested:","",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).","","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.",`When you are done, call the \`${Bn}\` 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(`
|
|
10
|
+
`)}var Ql=900*1e3,yo=["read","grep","find","ls"];async function ho(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()},Ql)}),new Promise(r=>{if(t.aborted)return r();t.addEventListener("abort",()=>{n="cancelled",r()},{once:!0})})]),n}async function ed(e){let t={},n=e.model,{session:r}=await xo({cwd:e.tempDir,model:n,thinkingLevel:e.thinkingLevel==="off"?void 0:e.thinkingLevel,tools:[...yo,en],customTools:[Vl(t)],sessionManager:go.inMemory()});try{let a=await ho(async()=>{await r.prompt(Jl(e.role,e.rubric,e.fairnessRules)),await r.waitForIdle()},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 ${Ql/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 ${en}.`],notes:[]}}async function td(e){let t={},n=e.model,{session:r}=await xo({cwd:e.tempDir,model:n,thinkingLevel:e.thinkingLevel==="off"?void 0:e.thinkingLevel,tools:[...yo,zn],customTools:[Hl(t)],sessionManager:go.inMemory()});try{let a=await ho(async()=>{await r.prompt(Zl(e.testRubric,e.fairnessRules)),await r.waitForIdle()},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 nd(e){let t={},n=e.model,{session:r}=await xo({cwd:e.tempDir,model:n,thinkingLevel:e.thinkingLevel==="off"?void 0:e.thinkingLevel,tools:[...yo,Bn],customTools:[Yl(t)],sessionManager:go.inMemory()});try{let a=await ho(async()=>{await r.prompt(Xl(e.candidates,e.testRubric,e.fairnessRules)),await r.waitForIdle()},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 GI,readFileSync as Io,writeFileSync as _I}from"node:fs";import{dirname as zI,join as rd}from"node:path";import{getAgentDir as ad}from"@earendil-works/pi-coding-agent";var ra=rd(ad(),"checks-config.json"),aa=rd(ad(),"settings.json"),BI=["off","minimal","low","medium","high","xhigh","max"];function od(e){return e?.reasoning?BI.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function bo(){try{if(!oa(ra))return null;let e=JSON.parse(Io(ra,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function id(e){let t=zI(ra);oa(t)||GI(t,{recursive:!0}),_I(ra,JSON.stringify(e,null,2),"utf-8")}function sd(){try{return oa(aa)?JSON.parse(Io(aa,"utf-8")).enabledModels??[]:[]}catch{return[]}}function md(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function WI(){try{if(oa(aa))return JSON.parse(Io(aa,"utf-8"))}catch{}return{}}function pd(){let e=WI().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function VI(e){return e.replace(/\\/g,"/")}function HI(e){return`'${e.replace(/'/g,"'\\''")}'`}async function ud(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 ${HI(VI(n))}`,s=await e.exec(pd(),["-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 Me="checks_progress";function et(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 YI,readFileSync as JI}from"node:fs";var tt=[{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 $o=["agent_prompt.md","solution.patch","test.patch"];function cd(e){try{if(!YI(e))return{};let t=JSON.parse(JI(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function ld(e){let{existingReport:t,config:n,runReviewers:r,byRole:a,runGapStages:s,testGaps:m,gapAnalysisIncomplete:c,gapFinderStatus:l,gapFilterStatus:I}=e,f={...t,timestamp:new Date().toISOString(),model:`${n.provider}/${n.modelId}`,thinkingLevel:n.thinkingLevel};if(r){let j={...t.reports&&typeof t.reports=="object"?t.reports:{},...a};f.reports=j,tt.every(ie=>j[ie.key])?f.overall=tt.every(ie=>j[ie.key].verdict==="PASS")?"PASS":"FAIL":delete f.overall}return s&&(f.testGaps=m,c?f.testGapAnalysisNote=`Gap analysis did not fully complete (finder: ${l}, filter: ${I}); testGaps may be incomplete.`:delete f.testGapAnalysisNote),f}function dd(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 fd=`## The problem description (aka the task)\r
|
|
11
|
+
P1: Aligns with the repo's philosophy\r
|
|
12
|
+
P2: Self-contained \u2014 solvable from the repo and description alone\r
|
|
13
|
+
P3: Clear, concise, and unambiguous \u2014 describes what to build or fix and don't leave points for guessing\r
|
|
14
|
+
P4: Verifiable \u2014 success is objectively testable\r
|
|
15
|
+
P5: Not prescriptive \u2014 don't leak the solution, we want to challenge the agents, remember!!\r
|
|
16
|
+
\r
|
|
17
|
+
A note on how it should read: write it the way a maintainer writes an issue \u2014\r
|
|
18
|
+
natural prose, full sentences. Open with the ask itself (\u201CAdd X to Y\u201D, \u201CFix Z when \u2026\u201D) and let the first line stand on its own without the title. Skip the motivation and the \u201Cwhat the repo currently lacks\u201D preamble.\r
|
|
19
|
+
Keep it out of spec-sheet territory \u2014 no bulleted requirement lists, no headings, no code snippets doing the describing. And don't spell out what a developer in the repo would find on their own (internal class names, helpers, field names, the file layout);\r
|
|
20
|
+
describe the behavior, not the implementation. That said, use your judgment\r
|
|
21
|
+
\u2014 if a detail is genuinely part of the contract and the task can't be pinned down without it, state it. A task nobody can implement is worse than one that names a field.\r
|
|
22
|
+
\r
|
|
23
|
+
## The tests\r
|
|
24
|
+
Your tests are the backbone; the agent only gets the repo and the problem description and is expected to create a solution to pass your tests (they'll be hidden \u{1F92B}). They should follow these requirements:\r
|
|
25
|
+
T1: They highlight the missing or incorrect behavior (depending on the task's category \u2014 feature request, bug fix, etc). They should 100% fail at the base commit and 100% pass after adding your solution.\r
|
|
26
|
+
T2: The tests should be deterministic (no timing, randomness, or ordering; nothing that could change across multiple runs or across different machines).\r
|
|
27
|
+
T3: Strong tests \u{1F4AA}. The tests shouldn't be permissive enough to let inaccurate agent solutions pass.\r
|
|
28
|
+
T4: Extensive coverage. The tests should cover the requested behavior and all the obvious edge cases.\r
|
|
29
|
+
T5: DO NOT check for unspecified or undiscoverable behavior \u2014 this will be unfair to the agents to expect them to implement something not in the description or discoverable from the repo \u{1F61E}.\r
|
|
30
|
+
T6: Don't over-pin the output \u2014 don't assert on exact output (error text, messages, wording, formatting) unless the description says so or it's obvious from the repo's existing patterns. Otherwise it's unfair to an agent that gets the behavior right but words it differently; checking the behavior holds is enough.\r
|
|
31
|
+
\r
|
|
32
|
+
## The solution\r
|
|
33
|
+
That's the golden solution \u2014 the proof that your task is solvable and that we can pass the tests. The solution should follow these requirements:\r
|
|
34
|
+
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
|
|
35
|
+
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
|
|
36
|
+
S3: No irrelevant changes to the code \u2014 if something is unrelated to your task, keep it as it is.\r
|
|
37
|
+
S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,ZI=`# Agent Evaluation Guidelines\r
|
|
38
|
+
\r
|
|
39
|
+
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
|
|
40
|
+
\r
|
|
41
|
+
## Core Principle\r
|
|
42
|
+
\r
|
|
43
|
+
The prompt, solution, and tests should form a consistent triangle:\r
|
|
44
|
+
\r
|
|
45
|
+
- **Prompt**: defines required behavior and public contracts.\r
|
|
46
|
+
- **Solution**: demonstrates one valid implementation.\r
|
|
47
|
+
- **Tests**: verify the prompt requirements, not incidental choices from the solution.\r
|
|
48
|
+
\r
|
|
49
|
+
A test is fair only when it checks behavior required by the prompt, strongly implied by existing code, or exposed through a public API named in the prompt.\r
|
|
50
|
+
\r
|
|
51
|
+
A useful mental model is: **test what the user, caller, or public contract can observe; avoid testing how the implementation got there unless that mechanism is itself part of the contract.**\r
|
|
52
|
+
\r
|
|
53
|
+
---\r
|
|
54
|
+
\r
|
|
55
|
+
## Prompt Rules\r
|
|
56
|
+
\r
|
|
57
|
+
The task prompt should be written in paragraphs, not bullet points or numbered lists, should be valid UTF-8. Keep it concise with a soft maximum of about 300 words, unless the task truly requires more detail to be fair.\r
|
|
58
|
+
\r
|
|
59
|
+
Do not restate the same requirement in multiple ways. Do not include long explanations for why a requirement exists. State the required behavior, public API, data shape, selector, or side effect clearly and move on.\r
|
|
60
|
+
\r
|
|
61
|
+
Include implementation details only when tests or compatibility require them. If a selector, translation key, exported function name, file path, data attribute, timing guarantee, option ID, or confirmation message is required by tests, name it explicitly in the prompt. If multiple implementations should be valid, describe the required outcome rather than one mechanism.\r
|
|
62
|
+
\r
|
|
63
|
+
# 1. Early Stage: No Agent Evaluations Yet\r
|
|
64
|
+
\r
|
|
65
|
+
Use this section while creating or refining the problem before agent runs exist.\r
|
|
66
|
+
\r
|
|
67
|
+
## 1.1 Prompt-to-Test Mapping\r
|
|
68
|
+
\r
|
|
69
|
+
For every test, identify the prompt sentence that justifies it.\r
|
|
70
|
+
\r
|
|
71
|
+
If no prompt sentence exists, either:\r
|
|
72
|
+
\r
|
|
73
|
+
- add the requirement to the prompt, or\r
|
|
74
|
+
- remove/relax the test.\r
|
|
75
|
+
\r
|
|
76
|
+
Tests may also rely on existing public repo behavior, but avoid relying on private internals unless the task is explicitly about those internals.\r
|
|
77
|
+
\r
|
|
78
|
+
## 1.2 Solution Is Not the Spec\r
|
|
79
|
+
\r
|
|
80
|
+
The reference solution is only one valid implementation. Do not copy its incidental choices into tests unless the prompt requires them.\r
|
|
81
|
+
\r
|
|
82
|
+
Avoid testing:\r
|
|
83
|
+
\r
|
|
84
|
+
- exact local helper names\r
|
|
85
|
+
- exact component file paths\r
|
|
86
|
+
- exact DOM nesting\r
|
|
87
|
+
- exact CSS classes\r
|
|
88
|
+
- exact call order\r
|
|
89
|
+
- exact framework implementation style\r
|
|
90
|
+
- exact module boundaries when multiple placements are valid\r
|
|
91
|
+
- exact translation key names when only visible text matters\r
|
|
92
|
+
- exact callback return shape when only the eventual effect matters\r
|
|
93
|
+
- exact registry keys, menu IDs, or config entry names when only the visible action matters\r
|
|
94
|
+
- one specific state source when multiple repo-valid sources expose the same data\r
|
|
95
|
+
- one specific internal call path when another repo-valid path produces the same public effect\r
|
|
96
|
+
\r
|
|
97
|
+
Prefer testing:\r
|
|
98
|
+
\r
|
|
99
|
+
- public exports\r
|
|
100
|
+
- rendered behavior\r
|
|
101
|
+
- visible labels/text\r
|
|
102
|
+
- required data attributes\r
|
|
103
|
+
- state changes\r
|
|
104
|
+
- side effects\r
|
|
105
|
+
- user-triggered actions\r
|
|
106
|
+
\r
|
|
107
|
+
## 1.3 Public Interface Rules\r
|
|
108
|
+
\r
|
|
109
|
+
A test may assert an API name if:\r
|
|
110
|
+
\r
|
|
111
|
+
- the prompt names it, or\r
|
|
112
|
+
- it already exists as a public API and the task says to use it.\r
|
|
113
|
+
\r
|
|
114
|
+
A test should not assert private helper names introduced only by the reference solution.\r
|
|
115
|
+
\r
|
|
116
|
+
If a new exported API is required, name it in the prompt.\r
|
|
117
|
+
\r
|
|
118
|
+
## 1.4 Selector and UI Rules\r
|
|
119
|
+
\r
|
|
120
|
+
If tests need a selector or DOM hook, mention it in the prompt.\r
|
|
121
|
+
\r
|
|
122
|
+
Fair required hooks only user visible text include:\r
|
|
123
|
+
\r
|
|
124
|
+
- exact visible labels\r
|
|
125
|
+
- exact \`title\`\r
|
|
126
|
+
- repo covention common class\r
|
|
127
|
+
\r
|
|
128
|
+
Unfair unless specified:\r
|
|
129
|
+
\r
|
|
130
|
+
- requiring test or data attributes\r
|
|
131
|
+
- requiring \`<button>\` instead of clickable elements\r
|
|
132
|
+
- requiring \`.btn\`, \`.ctrl\`, \`.popup-btn\`, etc, unless repo convention.\r
|
|
133
|
+
- requiring a row class like \`.item\`, \`.tab\`, \`.entry\`\r
|
|
134
|
+
- requiring specific DOM nesting\r
|
|
135
|
+
\r
|
|
136
|
+
When testing controls, find them by required user-facing contract, not style-only class names. If broad discovery is necessary, keep the final assertion strict: exact label/key plus correct behavior.\r
|
|
137
|
+
\r
|
|
138
|
+
## 1.5 Async and Refresh Rules\r
|
|
139
|
+
\r
|
|
140
|
+
If the prompt says something refreshes or updates after an operation, allow reasonable async timing unless synchronous behavior is explicitly required.\r
|
|
141
|
+
\r
|
|
142
|
+
Use polling helpers or fake timers as appropriate. Do not fail valid debounced or event-driven implementations unless the prompt requires immediate state.\r
|
|
143
|
+
\r
|
|
144
|
+
Avoid requiring refresh to happen inside a specific wrapper if it could fairly happen through a delegated operation, event handler, or shared service.\r
|
|
145
|
+
\r
|
|
146
|
+
Do not assume that an event handler or callback must return a promise unless the prompt or existing public API requires that contract. If the required behavior is eventual, trigger the callback and then flush or poll for the resulting effect.\r
|
|
147
|
+
\r
|
|
148
|
+
## 1.6 Fixture and Mock Rules\r
|
|
149
|
+
\r
|
|
150
|
+
Mocks should preserve real code invariants.\r
|
|
151
|
+
\r
|
|
152
|
+
If real code uses both a list and an ID map, populate both. If real code uses both native and reactive fields, set both when relevant.\r
|
|
153
|
+
\r
|
|
154
|
+
Prefer partial mocks over full replacement when the implementation may reasonably use additional existing exports from the same module. Full mocks are appropriate only when the hidden test truly intends to forbid every other interaction with that module.\r
|
|
155
|
+
\r
|
|
156
|
+
When a mocked module exports mutable state, prefer mutating existing arrays and objects in place rather than reassigning them. Reassignment can break valid implementations that hold live references to the original exported values.\r
|
|
157
|
+
\r
|
|
158
|
+
Mocks should not remove valid implementation paths. For example:\r
|
|
159
|
+
\r
|
|
160
|
+
- do not mock away a delegated helper and then require the delegated side effect\r
|
|
161
|
+
- do not stub the child component if testing behavior rendered by the child\r
|
|
162
|
+
- include framework probe fields in module mocks when templates need them\r
|
|
163
|
+
- do not replace a service module so narrowly that a valid implementation fails only because it uses another existing export from that module\r
|
|
164
|
+
- do not observe only one internal call path when the same user-visible effect can happen through another repo-valid path\r
|
|
165
|
+
- do not make one mocked function call the only accepted proof that an effect happened if the same effect can be observed through another repo-valid mechanism\r
|
|
166
|
+
\r
|
|
167
|
+
When testing text, prefer real dictionaries or neutral translation stubs that resolve the visible strings. Do not make tests pass or fail based on arbitrary translation key naming unless the prompt explicitly names the key.\r
|
|
168
|
+
\r
|
|
169
|
+
## 1.7 Early-Stage Checklist\r
|
|
170
|
+
\r
|
|
171
|
+
Before running agents, verify:\r
|
|
172
|
+
\r
|
|
173
|
+
- every test maps to prompt text or existing public behavior\r
|
|
174
|
+
- every required selector/key/attribute is named in the prompt\r
|
|
175
|
+
- tests accept valid alternative implementations\r
|
|
176
|
+
- tests avoid private internals\r
|
|
177
|
+
- async behavior is waited for fairly\r
|
|
178
|
+
- fixtures match real runtime invariants\r
|
|
179
|
+
- solution-specific structure is not treated as mandatory\r
|
|
180
|
+
- Keep the prompt behavioral and public-facing; avoid internal API coupling.\r
|
|
181
|
+
- Fairness matters: tests should avoid implementation details and brittle DOM assumptions.\r
|
|
182
|
+
- Prefer existing repo patterns/components (TextInput, ToggleInput, SetupPage.registerEl, debounced saves).\r
|
|
183
|
+
- Preserve baseline behavior; new tests must fail before the feature and pass after.\r
|
|
184
|
+
- Sandbox should be limited/approved, not broad live-app access.\r
|
|
185
|
+
- If tests assert specific visible text, that text must be named in the prompt.\r
|
|
186
|
+
- Avoid DOM class selectors or custom attributes unless explicitly stated in the prompt.\r
|
|
187
|
+
\r
|
|
188
|
+
---\r
|
|
189
|
+
\r
|
|
190
|
+
# 2. After Agent Evaluations Exist\r
|
|
191
|
+
\r
|
|
192
|
+
Use this section when agent runs, solution patches, or failure reports are available.\r
|
|
193
|
+
\r
|
|
194
|
+
## 2.1 Analyze Before Changing Tests\r
|
|
195
|
+
\r
|
|
196
|
+
For each failed agent:\r
|
|
197
|
+
\r
|
|
198
|
+
1. List failed tests.\r
|
|
199
|
+
2. Inspect the agent's solution patch.\r
|
|
200
|
+
3. Compare the implementation to the prompt, not just the reference solution.\r
|
|
201
|
+
4. Decide whether the failure is agent fault, prompt ambiguity, or test flaw.\r
|
|
202
|
+
\r
|
|
203
|
+
Do not loosen tests merely to make agents pass. Relax tests only when the failed implementation is genuinely valid under the prompt.\r
|
|
204
|
+
\r
|
|
205
|
+
## 2.2 Agent Fault\r
|
|
206
|
+
\r
|
|
207
|
+
Keep the test unchanged when the agent missed a clear requirement.\r
|
|
208
|
+
\r
|
|
209
|
+
Agent fault examples:\r
|
|
210
|
+
\r
|
|
211
|
+
- prompt names a required public API and it is missing\r
|
|
212
|
+
- prompt requires loading data and the implementation does not load it\r
|
|
213
|
+
- prompt requires confirmation and implementation skips it\r
|
|
214
|
+
- prompt requires refresh after an operation and implementation never refreshes\r
|
|
215
|
+
- prompt requires a visible/data attribute and it is absent\r
|
|
216
|
+
- prompt requires a user action to work and it does not work\r
|
|
217
|
+
\r
|
|
218
|
+
Repeated failures are not automatically test flaws. If several agents miss the same explicit requirement, the task may simply be challenging.\r
|
|
219
|
+
\r
|
|
220
|
+
## 2.3 Prompt Ambiguity\r
|
|
221
|
+
\r
|
|
222
|
+
Change the prompt or tests when multiple reasonable interpretations exist.\r
|
|
223
|
+
\r
|
|
224
|
+
Ambiguity examples:\r
|
|
225
|
+
\r
|
|
226
|
+
- tests require logic to live in a specific layer, but prompt only requires outcome\r
|
|
227
|
+
- tests require synchronous behavior, but prompt allows debounced/async behavior\r
|
|
228
|
+
- tests require direct platform calls, but a public helper is equally valid\r
|
|
229
|
+
- tests require a specific control class, but prompt only requires a visible action\r
|
|
230
|
+
- tests assert exact call shape, but prompt only requires the effect\r
|
|
231
|
+
- tests assume a callback is awaitable, but the visible contract only requires eventual behavior\r
|
|
232
|
+
- tests assume one service or module boundary, but the repo allows multiple equivalent integration points\r
|
|
233
|
+
- tests assume one translation key pattern, but the prompt only requires visible text\r
|
|
234
|
+
- tests assume one exact exported mutable object identity, but a valid implementation reads the same public state through a preserved reference\r
|
|
235
|
+
- tests treat one mocked call as the only accepted proof of behavior, but the same visible effect can be observed another way\r
|
|
236
|
+
\r
|
|
237
|
+
Fix ambiguity by either:\r
|
|
238
|
+
\r
|
|
239
|
+
- clarifying the prompt, if the detail is truly required, or\r
|
|
240
|
+
- relaxing the test, if multiple implementations should be accepted.\r
|
|
241
|
+
\r
|
|
242
|
+
## 2.4 Test Flaw\r
|
|
243
|
+
\r
|
|
244
|
+
Fix the test when it enforces an undocumented implementation detail.\r
|
|
245
|
+
\r
|
|
246
|
+
Test flaw examples:\r
|
|
247
|
+
\r
|
|
248
|
+
- exact CSS class names not in the prompt\r
|
|
249
|
+
- exact DOM hierarchy not in the prompt\r
|
|
250
|
+
- importing private files not named in the task\r
|
|
251
|
+
- mocks inconsistent with real app state\r
|
|
252
|
+
- mocked helpers hide valid delegated behavior\r
|
|
253
|
+
- tests pass only because the reference solution used a specific structure\r
|
|
254
|
+
- translation stubs that only recognize reference-solution key names\r
|
|
255
|
+
- full module mocks that omit repo-valid exports a reasonable solution may use\r
|
|
256
|
+
- reassigning mocked exported state in a way that breaks valid consumers of the original exported references\r
|
|
257
|
+
- asserting one mocked internal function was called when the same visible effect could be produced through another public or repo-valid path\r
|
|
258
|
+
- awaiting a callback and treating resolution timing as a requirement when the contract only promises the eventual side effect\r
|
|
259
|
+
- requiring one exact config entry name, option ID, or registry key when the prompt only requires the visible capability\r
|
|
260
|
+
\r
|
|
261
|
+
## 2.6 Evaluation Checklist\r
|
|
262
|
+
\r
|
|
263
|
+
For every failure cluster, answer:\r
|
|
264
|
+
\r
|
|
265
|
+
- Is this behavior named in the prompt?\r
|
|
266
|
+
- Is the tested interface public?\r
|
|
267
|
+
- Is the test checking outcome or implementation?\r
|
|
268
|
+
- Could another reasonable implementation satisfy the prompt but fail this test?\r
|
|
269
|
+
- Did mocks/fixtures remove a valid path?\r
|
|
270
|
+
- Is the reference solution being treated as the only solution?\r
|
|
271
|
+
\r
|
|
272
|
+
---\r
|
|
273
|
+
\r
|
|
274
|
+
# 3. Fair vs Unfair Examples\r
|
|
275
|
+
\r
|
|
276
|
+
## Fair\r
|
|
277
|
+
\r
|
|
278
|
+
- Required exported function exists.\r
|
|
279
|
+
- Required state includes specified fields.\r
|
|
280
|
+
- Required UI appears only under specified conditions.\r
|
|
281
|
+
- Required data attribute is present.\r
|
|
282
|
+
- Required control label/key appears and triggers the required action.\r
|
|
283
|
+
- Required confirmation appears before destructive action.\r
|
|
284
|
+
- Required state refresh eventually occurs after operation.\r
|
|
285
|
+
- A callback or user action eventually produces the required side effect, regardless of whether the implementation returns a promise.\r
|
|
286
|
+
- A translated visible string appears, regardless of which internal translation key produced it.\r
|
|
287
|
+
- A feature works through any repo-valid integration point that satisfies the prompt.\r
|
|
288
|
+
- A mock preserves enough of the real module shape that reasonable uses of existing exports still work.\r
|
|
289
|
+
\r
|
|
290
|
+
## Unfair\r
|
|
291
|
+
\r
|
|
292
|
+
- Requires a private helper name.\r
|
|
293
|
+
- Requires a particular component file path not specified.\r
|
|
294
|
+
- Requires direct browser/platform API call when helper delegation is valid.\r
|
|
295
|
+
- Requires exact class names used by the reference solution only.\r
|
|
296
|
+
- Requires immediate update when debounced update is valid.\r
|
|
297
|
+
- Requires exact function call arity when only message/effect matters.\r
|
|
298
|
+
- Uses incomplete fixtures that break valid code paths.\r
|
|
299
|
+
- Requires exact translation key names when the prompt only names the visible text.\r
|
|
300
|
+
- Requires one mocked service export to be called when another repo-valid path produces the same effect.\r
|
|
301
|
+
- Requires a callback to be awaitable or fully settled on return when the visible contract does not say so.\r
|
|
302
|
+
- Requires one exact option ID or registry key when the prompt only requires the user-visible action.\r
|
|
303
|
+
- Reassigns mocked exported state and then blames the implementation for not following the new object identity.\r
|
|
304
|
+
- Treats one internal observation point as mandatory even though the same required outcome can be observed through another public or repo-valid path.\r
|
|
305
|
+
\r
|
|
306
|
+
---\r
|
|
307
|
+
\r
|
|
308
|
+
# 4. Patch Hygiene\r
|
|
309
|
+
\r
|
|
310
|
+
Keep changes separated when possible:\r
|
|
311
|
+
\r
|
|
312
|
+
- **Test patch**: tests, test setup, test runner/config.\r
|
|
313
|
+
- **Solution patch**: implementation, styles, locales, app config.\r
|
|
314
|
+
- Avoid unrelated dependency or lockfile changes.\r
|
|
315
|
+
- Regenerate patches after every prompt/test/solution change.\r
|
|
316
|
+
\r
|
|
317
|
+
---`;function xd(){let e=fd.split(/\r?\n(?=## )/g),t={};for(let n of tt){let r=e.find(a=>n.rubricHeading.test(a.trim()));t[n.key]=(r??fd).trim()}return t}function gd(){return ZI.trim()}var ia=!1,tn;function sa(){return ia}function yd(){return ia=!0,tn=new AbortController,tn}function hd(){ia=!1,tn=void 0}function Id(){return!ia||!tn||tn.signal.aborted?!1:(tn.abort(),!0)}var ob="Ctrl+Shift+X",To=[{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 2-step behavioral test-gap finder + strict filter agents"},{value:"--config",label:"--config",description:"Set the reviewer model and thinking level"}];function ib(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=To.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 sb(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=sd();if(t.length===0){e.ui.notify("No enabledModels configured in settings.json.","error");return}let n=bo(),r=e.modelRegistry.getAll(),a=t.map(f=>{let q=md(f);if(!q)return null;let j=r.find(Te=>Te.provider===q.provider&&Te.id===q.modelId),ie=n?.provider===q.provider&&n?.modelId===q.modelId,le=j?`${j.name} (${f})`:f;return{ref:f,parsed:q,display:ie?`${le} [current]`:le,found:j,isCurrent:ie}}).filter(f=>f!==null);if(a.length===0){e.ui.notify("Could not resolve any enabledModels entries.","error");return}let s=[...a].sort((f,q)=>f.isCurrent===q.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=od(c.found);if(I.length>1){let f=c.isCurrent?n?.thinkingLevel:void 0,q=[...I].sort((le,Te)=>le===f==(Te===f)?0:le===f?-1:1),j=le=>le===f?`${le} [current]`:le,ie=await e.ui.select("Select thinking level for reviewer agents",q.map(j));if(!ie)return;l=q.find(le=>j(le)===ie)??ie}id({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 bd(e){e.registerCommand("checks",{description:"Strict review of agent_prompt.md/test.patch/solution.patch. Requires an option \u2014 see /checks.",getArgumentCompletions:ib,handler:async(t,n)=>{let r=t.trim();if(r===""){n.ui.notify(To.map(D=>`${D.value} \u2014 ${D.description}`).join(`
|
|
318
|
+
`),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],s=new Set(To.map(D=>D.value)),m=a.filter(D=>!s.has(D));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 sb(n);return}let c=new Set;if(a.includes("--all")||a.includes("--review"))for(let D of tt)c.add(D.key);for(let D of tt)a.includes(`--${D.key}`)&&c.add(D.key);let l=a.includes("--all")||a.includes("--gap-finder"),I=tt.filter(D=>c.has(D.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 q=a.join(" ");if(sa()){n.ui.notify("A checks run is already in progress.","warning");return}let j=bo();if(!j){n.ui.notify("No reviewer model configured. Run /checks --config first.","error");return}let ie=n.modelRegistry.find(j.provider,j.modelId);if(!ie){n.ui.notify(`Configured model ${j.provider}/${j.modelId} not found. Run /checks --config again.`,"error");return}if(!n.modelRegistry.hasConfiguredAuth(ie)){n.ui.notify(`No auth configured for ${j.provider}/${j.modelId}.`,"error");return}let le=$o.filter(D=>!eb(Wn(n.cwd,D)));if(le.length>0){n.ui.notify(`Missing required file(s) in project root: ${le.join(", ")}`,"error");return}let Te=yd(),Ce=(f?I.length:0)+(l?2:0);n.ui.setWidget(Me,et("preparing clean snapshot",0,Ce)),n.ui.notify(`checks (${q}) started. Press ${ob} to cancel.`,"info");let nn;try{let D=Wn(ab(),`checks-${XI()}`);tb(D,{recursive:!0}),nn=D;let Vn=await ud(e,n.cwd,D);if(Vn.status==="error"){n.ui.notify(`checks: ${Vn.error}`,"error");return}for(let xt of $o)QI(Wn(n.cwd,xt),Wn(D,xt));let rn=xd(),an=gd(),Ae=0,on=[];if(f&&(n.ui.setWidget(Me,et("reviewing",Ae,Ce)),on=await Promise.all(I.map(xt=>ed({pi:e,role:xt,tempDir:D,model:ie,thinkingLevel:j.thinkingLevel,rubric:rn[xt.key],fairnessRules:an,cancelSignal:Te.signal}).then(Hn=>(Ae+=1,n.ui.setWidget(Me,et("reviewing",Ae,Ce)),Hn)))),Te.signal.aborted)){n.ui.notify("checks: cancelled.","warning");return}let nt={status:"ok",gaps:[]},Mt={status:"ok",gaps:[]};if(l){if(n.ui.setWidget(Me,et("finding test gaps",Ae,Ce)),nt=await td({tempDir:D,model:ie,thinkingLevel:j.thinkingLevel,testRubric:rn.tests,fairnessRules:an,cancelSignal:Te.signal}),Ae+=1,n.ui.setWidget(Me,et("finding test gaps",Ae,Ce)),Te.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}if(nt.status==="ok"&&nt.gaps.length>0&&(n.ui.setWidget(Me,et("validating test gaps",Ae,Ce)),Mt=await nd({tempDir:D,model:ie,thinkingLevel:j.thinkingLevel,testRubric:rn.tests,fairnessRules:an,candidates:nt.gaps,cancelSignal:Te.signal})),Ae+=1,n.ui.setWidget(Me,et("validating test gaps",Ae,Ce)),Te.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}n.ui.setWidget(Me,et("finalizing report",Ce,Ce));let sn={};I.forEach((xt,Hn)=>{on[Hn]&&(sn[xt.key]=on[Hn])});let Td=Mt.gaps,vd=l&&(nt.status!=="ok"||Mt.status!=="ok"),ma=Wn(n.cwd,"shipd_report.json"),kd=cd(ma),vo=ld({existingReport:kd,config:j,runReviewers:f,byRole:sn,runGapStages:l,testGaps:Td,gapAnalysisIncomplete:vd,gapFinderStatus:nt.status,gapFilterStatus:Mt.status}),ko=dd({merged:vo,runReviewers:f,activeRoles:I,byRole:sn,runGapStages:l});e.sendMessage({customType:"shipd_checks_report",content:ko.content,display:!0,details:ko.details}),rb(ma,JSON.stringify(vo,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${ma}`,"info")}catch(D){n.ui.notify(`checks failed: ${D instanceof Error?D.message:String(D)}`,"error")}finally{if(n.ui.setWidget(Me,void 0),nn)try{nb(nn,{recursive:!0,force:!0})}catch{}hd()}}})}var $d=mb.ctrlShift("x");function ub(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 pb(`${r.bold("Checks: ")}${c}`,0,0)}),e.registerShortcut($d,{description:"Cancel an in-progress /checks run",handler:t=>{sa()&&Id()&&(t.ui.setWidget(Me,[`checks: cancelling (${$d})...`]),t.ui.notify("checks: cancelling...","warning"))}}),bd(e)}export{ub as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sreetej510/pi-shipd-checks",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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",
|
|
@@ -14,24 +14,24 @@
|
|
|
14
14
|
"shipd"
|
|
15
15
|
],
|
|
16
16
|
"files": [
|
|
17
|
-
"
|
|
17
|
+
"dist",
|
|
18
18
|
"README.md",
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
21
21
|
"pi": {
|
|
22
22
|
"extensions": [
|
|
23
|
-
"./
|
|
23
|
+
"./dist/index.js"
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
+
"build": "node ../../scripts/build-extension.mjs",
|
|
28
|
+
"prepublishOnly": "npm run build",
|
|
27
29
|
"check": "biome check . && npm run typecheck",
|
|
28
30
|
"format": "biome check --write .",
|
|
29
31
|
"typecheck": "tsc --noEmit"
|
|
30
32
|
},
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"typebox": "^1.3.3"
|
|
33
|
-
},
|
|
34
33
|
"devDependencies": {
|
|
34
|
+
"typebox": "^1.3.3",
|
|
35
35
|
"@biomejs/biome": "^2.5.3",
|
|
36
36
|
"@earendil-works/pi-coding-agent": "^0.80.3",
|
|
37
37
|
"@earendil-works/pi-tui": "^0.80.3",
|