howtofixcli 0.7.8 → 0.7.9
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/chunk-27TRKD65.js +2 -0
- package/dist/chunk-3FYCFLNK.js +1 -0
- package/dist/chunk-56SEAGAQ.js +1 -0
- package/dist/chunk-63ZCQDXH.js +6 -0
- package/dist/chunk-6FUWMLWO.js +1 -0
- package/dist/chunk-7CHDNTH6.js +1 -0
- package/dist/chunk-ACOMNDUL.js +185 -0
- package/dist/chunk-AEVPET7X.js +2 -0
- package/dist/chunk-AGGIYXN7.js +2 -0
- package/dist/chunk-BHVBO4SC.js +1 -0
- package/dist/chunk-FPXVDP32.js +8 -0
- package/dist/chunk-GIUYIKH3.js +109 -0
- package/dist/chunk-GQCAJ56I.js +5 -0
- package/dist/chunk-GXB7RZHH.js +1 -0
- package/dist/chunk-IGEY3AWF.js +1 -0
- package/dist/chunk-ILDDDLRC.js +1 -0
- package/dist/chunk-JFYVRWJI.js +2 -0
- package/dist/chunk-MVLCGU3G.js +1 -0
- package/dist/chunk-N345KWWK.js +1 -0
- package/dist/chunk-NBQFPCRT.js +1 -0
- package/dist/chunk-OIPSLIZE.js +5 -0
- package/dist/chunk-ORJ2QZBG.js +3 -0
- package/dist/chunk-PCALBZOO.js +2 -0
- package/dist/chunk-PDNBGUYP.js +2 -0
- package/dist/chunk-S656RE4A.js +1 -0
- package/dist/chunk-TSEKPGK4.js +1 -0
- package/dist/chunk-U6CI6KXN.js +34 -0
- package/dist/chunk-UTYFLLSM.js +1 -0
- package/dist/chunk-V3R4FYTJ.js +1 -0
- package/dist/chunk-V656XVXV.js +8 -0
- package/dist/chunk-WKUJ7CFO.js +1 -0
- package/dist/chunk-WOT6VMZA.js +1 -0
- package/dist/chunk-WUPU6LTD.js +4 -0
- package/dist/chunk-WX3V5P7U.js +5 -0
- package/dist/chunk-ZKZ6WCI3.js +2 -0
- package/dist/main.js +94 -536
- package/package.json +15 -62
- package/dist/account-credential.js +0 -136
- package/dist/account-credential.test.js +0 -38
- package/dist/activity.js +0 -124
- package/dist/agent-defs.js +0 -237
- package/dist/agent-limiter.js +0 -68
- package/dist/agents.js +0 -554
- package/dist/anim.js +0 -361
- package/dist/args.js +0 -228
- package/dist/at-file.js +0 -28
- package/dist/brand-extension.js +0 -87
- package/dist/brand.js +0 -76
- package/dist/browser.js +0 -58
- package/dist/cache-report.js +0 -139
- package/dist/checkpoint.js +0 -437
- package/dist/claims.js +0 -167
- package/dist/cli-auth.js +0 -142
- package/dist/cli-checkin.js +0 -120
- package/dist/cli-credentials.js +0 -254
- package/dist/clipboard.js +0 -149
- package/dist/collapse.js +0 -129
- package/dist/commands.js +0 -301
- package/dist/compaction-guard.js +0 -81
- package/dist/context-extension.js +0 -17
- package/dist/dcp/commands.js +0 -172
- package/dist/dcp/compress-state.js +0 -139
- package/dist/dcp/compress.js +0 -329
- package/dist/dcp/dcp-extension.js +0 -288
- package/dist/dcp/dedup.js +0 -93
- package/dist/dcp/ids.js +0 -189
- package/dist/dcp/index.js +0 -25
- package/dist/dcp/prompts.js +0 -68
- package/dist/dcp/protected-content.js +0 -221
- package/dist/dcp/protected.js +0 -161
- package/dist/dcp/prune.js +0 -418
- package/dist/dcp/state.js +0 -176
- package/dist/device-id.js +0 -90
- package/dist/device-id.test.js +0 -23
- package/dist/errors.js +0 -63
- package/dist/extensions.js +0 -48
- package/dist/fatal.js +0 -35
- package/dist/feed.js +0 -498
- package/dist/fs-atomic.js +0 -54
- package/dist/gateway-errors.js +0 -90
- package/dist/git.js +0 -230
- package/dist/goal-extension.js +0 -88
- package/dist/goal.js +0 -222
- package/dist/hooks-extension.js +0 -176
- package/dist/hooks.js +0 -443
- package/dist/howtofix-account.js +0 -715
- package/dist/hud-line.js +0 -153
- package/dist/hwid.js +0 -130
- package/dist/interrupt.js +0 -60
- package/dist/json-events.js +0 -50
- package/dist/level-style.js +0 -112
- package/dist/loop-guard.js +0 -95
- package/dist/lsp-tools.js +0 -32
- package/dist/lsp.js +0 -347
- package/dist/mcp-config.js +0 -85
- package/dist/mcp-lifecycle.js +0 -147
- package/dist/model-catalog.js +0 -217
- package/dist/model-resolve.js +0 -65
- package/dist/notes.js +0 -78
- package/dist/oauth-login.js +0 -568
- package/dist/paths.js +0 -61
- package/dist/permissions.js +0 -298
- package/dist/plan-mode.js +0 -363
- package/dist/preset-command.js +0 -227
- package/dist/preset-extension.js +0 -35
- package/dist/preset-mcp.js +0 -292
- package/dist/presets.js +0 -727
- package/dist/prompt-files.js +0 -103
- package/dist/prompt-text.js +0 -41
- package/dist/proxy.js +0 -137
- package/dist/quality/ast.js +0 -196
- package/dist/quality/cognitive.js +0 -83
- package/dist/quality/cyclomatic.js +0 -30
- package/dist/quality/halstead.js +0 -83
- package/dist/quality/index.js +0 -18
- package/dist/quality/length.js +0 -3
- package/dist/quality/maintainability.js +0 -15
- package/dist/quality/nesting.js +0 -57
- package/dist/quality/report.js +0 -803
- package/dist/quality/smells.js +0 -67
- package/dist/quality-tool.js +0 -63
- package/dist/read-only-commands.js +0 -597
- package/dist/repo-map.js +0 -292
- package/dist/rtk.js +0 -193
- package/dist/sandbox.js +0 -105
- package/dist/schema.js +0 -214
- package/dist/session-lifecycle.js +0 -19
- package/dist/session-retention.js +0 -111
- package/dist/session.js +0 -446
- package/dist/sessions.js +0 -100
- package/dist/settings.js +0 -148
- package/dist/skills.js +0 -35
- package/dist/slop-tool.js +0 -96
- package/dist/spend-cap.js +0 -43
- package/dist/subagent.js +0 -171
- package/dist/tar.js +0 -146
- package/dist/theme.js +0 -79
- package/dist/thinking.js +0 -45
- package/dist/todo.js +0 -114
- package/dist/tool-loadout.js +0 -97
- package/dist/tool-render.js +0 -769
- package/dist/tools.js +0 -176
- package/dist/ui.js +0 -4757
- package/dist/update.js +0 -533
- package/dist/usage-segment.js +0 -69
- package/dist/web-tools.js +0 -46
- package/dist/web.js +0 -265
- package/dist/welcome.js +0 -179
- package/dist/workflow-engine.js +0 -246
- package/dist/workflow-progress.js +0 -446
- package/dist/workflow-view.js +0 -195
- package/dist/workflow.js +0 -349
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import{r as Bp}from"./chunk-JFYVRWJI.js";import{b as Hp}from"./chunk-27TRKD65.js";import{D as It,G as Kp,H as Dn,a as Li}from"./chunk-V656XVXV.js";import{a as tr}from"./chunk-UTYFLLSM.js";import{a as At}from"./chunk-WOT6VMZA.js";import{spawn as _v}from"node:child_process";import{existsSync as Dv,readFileSync as Nv}from"node:fs";import{join as jv}from"node:path";var G={};At(G,{Match:()=>uw});function uw(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}var Me={};At(Me,{Get:()=>oR,Reset:()=>rR,Set:()=>nR});var s={};At(s,{Counted:()=>Cw,Entries:()=>Ow,EntriesRegExp:()=>Aw,Every:()=>kw,EveryAll:()=>Tw,GraphemeCount:()=>Ew,HasPropertyKey:()=>Pw,IsArray:()=>Co,IsBigInt:()=>Ro,IsBoolean:()=>tf,IsClassInstance:()=>bw,IsConstructor:()=>lw,IsDeepEqual:()=>Sm,IsEqual:()=>J,IsFunction:()=>rf,IsGreaterEqualThan:()=>of,IsGreaterThan:()=>Iw,IsInteger:()=>bm,IsLessEqualThan:()=>nf,IsLessThan:()=>hw,IsMaxLength:()=>Sw,IsMinLength:()=>$w,IsMultipleOf:()=>yw,IsNull:()=>Ni,IsNumber:()=>ji,IsObject:()=>Po,IsObjectNotArray:()=>gw,IsString:()=>Ui,IsSymbol:()=>xw,IsUndefined:()=>Em,IsUnsafePropertyKey:()=>af,IsValueLike:()=>sf,Keys:()=>Di,ShiftLeft:()=>qi,Some:()=>ww,SomeAll:()=>Rw,Symbols:()=>Mw,Values:()=>Fw});function cn(e,t,r){return e>=t&&e<=r}function Vp(e){return e===8205}function cw(e){return cn(e,55296,56319)}function zp(e){return cn(e,127462,127487)}function Jp(e){return cn(e,65024,65039)}function Xp(e){return cn(e,768,879)||cn(e,6832,6911)||cn(e,7616,7679)||cn(e,65056,65071)}function _i(e){return e>65535?2:1}function Wp(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(Xp(r)||Jp(r))t+=_i(r);else break}return t}function ym(e,t){let r=e.codePointAt(t),n=t+_i(r);for(n=Wp(e,n);n<e.length-1&&Vp(e.codePointAt(n));){let o=e.codePointAt(n+1);n+=1+_i(o),n=Wp(e,n)}return zp(r)&&n<e.length&&zp(e.codePointAt(n))&&(n+=_i(e.codePointAt(n))),n}function Qp(e){return e>=768&&(cw(e)||Xp(e)||Jp(e)||Vp(e))}function Yp(e){let t=0,r=0;for(;r<e.length;)r=ym(e,r),t++;return t}function pw(e,t){let r=0,n=0;for(;n<e.length;)if(n=ym(e,n),++r>=t)return!0;return!1}function fw(e,t){let r=0,n=0;for(;n<e.length;)if(n=ym(e,n),++r>t)return!1;return!0}function Zp(e,t){if(t===0)return!0;if(e.length<t)return!1;let r=0;for(;;){if(Qp(e.charCodeAt(r)))return pw(e,t);if(++r>=t)return!0}}function ef(e,t){if(e.length<=t)return!0;let r=0;for(;;){if(Qp(e.charCodeAt(r)))return fw(e,t);if(++r>t)return!1}}function Co(e){return Array.isArray(e)}function Ro(e){return J(typeof e,"bigint")}function tf(e){return J(typeof e,"boolean")}function lw(e){if(Em(e)||!rf(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function rf(e){return J(typeof e,"function")}function bm(e){return Number.isInteger(e)}function Ni(e){return J(e,null)}function ji(e){return Number.isFinite(e)}function gw(e){return Po(e)&&!Co(e)}function Po(e){return J(typeof e,"object")&&!Ni(e)}function Ui(e){return J(typeof e,"string")}function xw(e){return J(typeof e,"symbol")}function Em(e){return J(e,void 0)}function J(e,t){return e===t}function Iw(e,t){return e>t}function hw(e,t){return e<t}function nf(e,t){return e<=t}function of(e,t){return e>=t}function yw(e,t){if(Ro(e)||Ro(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!ji(e)||bm(e)&&1/t%1===0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<r}function bw(e){if(!Po(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Ni(t)?!1:J(typeof t.constructor,"function")&&!(J(t.constructor,globalThis.Object)||J(t.constructor.name,"Object"))}function sf(e){return Ro(e)||tf(e)||Ni(e)||ji(e)||Ui(e)||Em(e)}function Ew(e){return Yp(e)}function Sw(e,t){return ef(e,t)}function $w(e,t){return Zp(e,t)}function kw(e,t,r){return e.every((n,o)=>o<t||r(n,o))}function Tw(e,t,r){let n=!0;return e.forEach((o,i)=>{i>=t&&!r(o,i)&&(n=!1)}),n}function ww(e,t){return e.some((r,n)=>t(r,n))}function Rw(e,t){let r=!1;return e.forEach((n,o)=>{t(n,o)&&(r=!0)}),r}function Cw(e,t){return e.reduce((r,n,o)=>t(n,o)?++r:r,0)}function qi(e,t,r){return J(e.length,0)?r():t(e[0],e.slice(1))}function af(e){return J(e,"__proto__")||J(e,"constructor")||J(e,"prototype")}function Pw(e,t){return af(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Aw(e){return Di(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function Ow(e){return Object.entries(e)}function Di(e){return Object.getOwnPropertyNames(e)}function Mw(e){return Object.getOwnPropertySymbols(e)}function Fw(e){return Object.values(e)}function vw(e,t){if(!Po(t))return!1;let r=Di(e);return J(r.length,Di(t).length)&&r.every(n=>Sm(e[n],t[n]))}function Lw(e,t){return Co(t)&&J(e.length,t.length)&&e.every((r,n)=>Sm(e[n],t[n]))}function Sm(e,t){return Co(e)?Lw(e,t):Po(e)?vw(e,t):J(e,t)}var Le={};At(Le,{IsBigInt64Array:()=>Jw,IsBigUint64Array:()=>Xw,IsBoolean:()=>_w,IsDate:()=>Yw,IsFloat32Array:()=>Ww,IsFloat64Array:()=>Vw,IsInt16Array:()=>Kw,IsInt32Array:()=>Hw,IsInt8Array:()=>Uw,IsMap:()=>eR,IsNumber:()=>Dw,IsRegExp:()=>Qw,IsSet:()=>Zw,IsString:()=>Nw,IsTypeArray:()=>jw,IsUint16Array:()=>Bw,IsUint32Array:()=>zw,IsUint8Array:()=>qw,IsUint8ClampedArray:()=>Gw});function _w(e){return e instanceof Boolean}function Dw(e){return e instanceof Number}function Nw(e){return e instanceof String}function jw(e){return globalThis.ArrayBuffer.isView(e)}function Uw(e){return e instanceof globalThis.Int8Array}function qw(e){return e instanceof globalThis.Uint8Array}function Gw(e){return e instanceof globalThis.Uint8ClampedArray}function Kw(e){return e instanceof globalThis.Int16Array}function Bw(e){return e instanceof globalThis.Uint16Array}function Hw(e){return e instanceof globalThis.Int32Array}function zw(e){return e instanceof globalThis.Uint32Array}function Ww(e){return e instanceof globalThis.Float32Array}function Vw(e){return e instanceof globalThis.Float64Array}function Jw(e){return e instanceof globalThis.BigInt64Array}function Xw(e){return e instanceof globalThis.BigUint64Array}function Qw(e){return e instanceof globalThis.RegExp}function Yw(e){return e instanceof globalThis.Date}function Zw(e){return e instanceof globalThis.Set}function eR(e){return e instanceof globalThis.Map}var Gi=s;var rr={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function rR(){rr.immutableTypes=!1,rr.maxErrors=8,rr.maxInstantiationCount=128,rr.useAcceleration=!0,rr.exactOptionalPropertyTypes=!1,rr.enumerableKind=!1,rr.correctiveParse=!1,rr.unionPrioritySort=!0}function nR(e){for(let t of s.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(rr,t,{value:r})}}function oR(){return rr}function Ki(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>s.IsObject(t)&&s.HasPropertyKey(t,"check")&&s.HasPropertyKey(t,"error")&&s.IsFunction(t.check)&&s.IsFunction(t.error))}function ct(e){return s.IsObject(e)&&!s.IsArray(e)}function Lr(e){return s.IsBoolean(e)}function F(e){return ct(e)||Lr(e)}function Bi(e){return s.HasPropertyKey(e,"additionalItems")&&F(e.additionalItems)}function Ut(e){return s.HasPropertyKey(e,"additionalProperties")&&F(e.additionalProperties)}function Hi(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(t=>F(t))}function Ao(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function zi(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>F(t))}function $m(e){return s.HasPropertyKey(e,"const")}function _r(e){return s.HasPropertyKey(e,"contains")&&F(e.contains)}function St(e){return s.HasPropertyKey(e,"default")}function km(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(t=>F(t)||s.IsArray(t)&&t.every(r=>s.IsString(r)))}function Tm(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>s.IsArray(t)&&t.every(r=>s.IsString(r)))}function Wi(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>F(t))}function hr(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function Vi(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function Ji(e){return s.HasPropertyKey(e,"else")&&F(e.else)}function wm(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function Rm(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function yr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Oo(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Ot(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function Xi(e){return s.HasPropertyKey(e,"if")&&F(e.if)}function pn(e){return s.HasPropertyKey(e,"items")&&(F(e.items)||s.IsArray(e.items)&&e.items.every(t=>F(t)))}function Qi(e){return pn(e)&&s.IsArray(e.items)}function Cm(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function Pm(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function Mo(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Am(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function Om(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function br(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function fn(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function dn(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function Fo(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function vo(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function Mm(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function Yi(e){return s.HasPropertyKey(e,"not")&&F(e.not)}function Zi(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>F(t))}function Lo(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function Nn(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>F(t))}function ln(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>F(t))}function jn(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>F(t))}function es(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||F(e.propertyNames))}function iR(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function _o(e){return iR(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function ts(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function rs(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function gn(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function ns(e){return s.HasPropertyKey(e,"then")&&F(e.then)}function Fm(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function Dr(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Do(e){return s.HasPropertyKey(e,"unevaluatedItems")&&F(e.unevaluatedItems)}function No(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&F(e.unevaluatedProperties)}var pt=class{constructor(){let t=new Set,r=new Set;this.stack=[{indices:t,keys:r}]}Push(){let t=new Set,r=new Set;return this.stack.push({indices:t,keys:r}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(let r of t)r.GetIndices().forEach(n=>this.GetIndices().add(n)),r.GetKeys().forEach(n=>this.GetKeys().add(n));return!0}},et=class extends pt{constructor(){super(),this.errors=[]}AtCapacity(){return this.errors.length>=Me.Get().maxErrors}AddError(t){return this.AtCapacity()||this.errors.push(t),!1}GetErrors(){return this.errors}};function mf(e,t,r,n){return s.Every(r["~refine"],0,(o,i)=>o.check(n))}function uf(e,t,r,n,o,i){return s.EveryAll(o["~refine"],0,(a,m)=>a.check(i)||t.AddError({keyword:"~refine",schemaPath:r,instancePath:n,params:{index:m,message:a.error(i)}}))}function cf(e){return pn(e)&&s.IsArray(e.items)}function pf(e,t,r,n){return cf(r)?s.Every(n,0,(i,a)=>s.IsLessThan(a,r.items.length)||Mt(e,t,r.additionalItems,i)&&t.AddIndex(a)):!0}function ff(e,t,r,n,o,i){return cf(o)?s.Every(i,0,(m,c)=>{let p=`${r}/additionalItems`,f=`${n}/${c}`;return s.IsLessThan(c,o.items.length)||Ft(e,t,p,f,o.additionalItems,m)&&t.AddIndex(c)}):!0}function Nr(e){return new RegExp(e,"u")}function sR(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function df(e){let t=[];return Nn(e)&&t.push(...s.Keys(e.patternProperties)),jn(e)&&t.push(...s.Keys(e.properties).map(sR)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function lf(e,t,r,n){let o=Nr(df(r));return s.Every(s.Keys(n),0,(a,m)=>o.test(a)||Mt(e,t,r.additionalProperties,n[a])&&t.AddKey(a))}function gf(e,t,r,n,o,i){let a=Nr(df(o)),m=[];return s.EveryAll(s.Keys(i),0,(p,f)=>{let d=`${r}/additionalProperties`,g=`${n}/${p}`,I=a.test(p)||Ft(e,t,d,g,o.additionalProperties,i[p])&&t.AddKey(p);return I||m.push(p),I})||t.AddError({keyword:"additionalProperties",schemaPath:r,instancePath:n,params:{additionalProperties:m}})}function xf(e,t,r,n){let o=r.allOf.reduce((i,a)=>{let m=new pt;return X(e,m,a,n)?[...i,m]:i},[]);return s.IsEqual(o.length,r.allOf.length)&&t.Merge(o)}function If(e,t,r,n,o,i){let a=[],m=o.allOf.reduce((p,f,d)=>{let g=`${r}/allOf/${d}`,I=new et,h=ae(e,I,g,n,f,i);return h||a.push(I),h?[...p,I]:p},[]),c=s.IsEqual(m.length,o.allOf.length)&&t.Merge(m);return c||a.forEach(p=>p.GetErrors().forEach(f=>t.AddError(f))),c}function hf(e,t,r,n){let o=r.anyOf.reduce((i,a)=>{let m=new pt;return X(e,m,a,n)?[...i,m]:i},[]);return s.IsGreaterThan(o.length,0)&&t.Merge(o)}function yf(e,t,r,n,o,i){let a=[],m=o.anyOf.reduce((p,f,d)=>{let g=new et,I=`${r}/anyOf/${d}`,h=ae(e,g,I,n,f,i);return h||a.push(g),h?[...p,g]:p},[]),c=s.IsGreaterThan(m.length,0)&&t.Merge(m);return c||a.forEach(p=>p.GetErrors().forEach(f=>t.AddError(f))),c||t.AddError({keyword:"anyOf",schemaPath:r,instancePath:n,params:{}})}function Lm(e,t,r,n){return r}function bf(e,t,r,n,o,i){return Lm(e,t,o,i)||t.AddError({keyword:"boolean",schemaPath:r,instancePath:n,params:{}})}function _m(e,t,r,n){return s.IsValueLike(r.const)?s.IsEqual(n,r.const):s.IsDeepEqual(n,r.const)}function Ef(e,t,r,n,o,i){return _m(e,t,o,i)||t.AddError({keyword:"const",schemaPath:r,instancePath:n,params:{allowedValue:o.const}})}function aR(e){return!(fn(e)&&s.IsEqual(e.minContains,0))}function Dm(e,t,r,n){return aR(r)?!s.IsEqual(n.length,0)&&s.SomeAll(n,(o,i)=>X(e,t,r.contains,o)&&t.AddIndex(i)):!0}function Sf(e,t,r,n,o,i){return Dm(e,t,o,i)||t.AddError({keyword:"contains",schemaPath:r,instancePath:n,params:{minContains:1}})}function $f(e,t,r,n){let o=s.IsEqual(s.Keys(n).length,0),i=s.Every(s.Entries(r.dependencies),0,([a,m])=>!s.HasPropertyKey(n,a)||(s.IsArray(m)?m.every(c=>s.HasPropertyKey(n,c)):X(e,t,m,n)));return o||i}function kf(e,t,r,n,o,i){let a=s.IsEqual(s.Keys(i).length,0),m=s.EveryAll(s.Entries(o.dependencies),0,([c,p])=>{let f=`${r}/dependencies/${c}`;return!s.HasPropertyKey(i,c)||(s.IsArray(p)?p.every(d=>s.HasPropertyKey(i,d)||t.AddError({keyword:"dependencies",schemaPath:r,instancePath:n,params:{property:c,dependencies:p}})):ae(e,t,f,n,p,i))});return a||m}function Tf(e,t,r,n){let o=s.IsEqual(s.Keys(n).length,0),i=s.Every(s.Entries(r.dependentRequired),0,([a,m])=>!s.HasPropertyKey(n,a)||m.every(c=>s.HasPropertyKey(n,c)));return o||i}function wf(e,t,r,n,o,i){let a=s.IsEqual(s.Keys(i).length,0),m=s.EveryAll(s.Entries(o.dependentRequired),0,([c,p])=>!s.HasPropertyKey(i,c)||s.EveryAll(p,0,f=>s.HasPropertyKey(i,f)||t.AddError({keyword:"dependentRequired",schemaPath:r,instancePath:n,params:{property:c,dependencies:p}})));return a||m}function Rf(e,t,r,n){let o=s.IsEqual(s.Keys(n).length,0),i=s.Every(s.Entries(r.dependentSchemas),0,([a,m])=>!s.HasPropertyKey(n,a)||X(e,t,m,n));return o||i}function Cf(e,t,r,n,o,i){let a=s.IsEqual(s.Keys(i).length,0),m=s.EveryAll(s.Entries(o.dependentSchemas),0,([c,p])=>{let f=`${r}/dependentSchemas/${c}`;return!s.HasPropertyKey(i,c)||ae(e,t,f,n,p,i)});return a||m}function Pf(e,t,r,n){let o=e.DynamicRef(r)??!1;return F(o)&&X(e,t,o,n)}function Af(e,t,r,n,o,i){let a=e.DynamicRef(o)??!1;return F(a)&&ae(e,t,"#",n,a,i)}function Um(e,t,r,n){return s.Some(r.enum,o=>s.IsValueLike(o)?s.IsEqual(n,o):s.IsDeepEqual(n,o))}function Of(e,t,r,n,o,i){return Um(e,t,o,i)||t.AddError({keyword:"enum",schemaPath:r,instancePath:n,params:{allowedValues:o.enum}})}function qm(e,t,r,n){return s.IsLessThan(n,r.exclusiveMaximum)}function Mf(e,t,r,n,o,i){return qm(e,t,o,i)||t.AddError({keyword:"exclusiveMaximum",schemaPath:r,instancePath:n,params:{comparison:"<",limit:o.exclusiveMaximum}})}function Gm(e,t,r,n){return s.IsGreaterThan(n,r.exclusiveMinimum)}function Ff(e,t,r,n,o,i){return Gm(e,t,o,i)||t.AddError({keyword:"exclusiveMinimum",schemaPath:r,instancePath:n,params:{comparison:">",limit:o.exclusiveMinimum}})}var Bn={};At(Bn,{Clear:()=>sd,Entries:()=>QR,Get:()=>eC,Has:()=>ZR,IsDate:()=>qn,IsDateTime:()=>os,IsDuration:()=>is,IsEmail:()=>ss,IsHostname:()=>ls,IsIPv4:()=>Is,IsIPv6:()=>hs,IsIdnEmail:()=>gs,IsIdnHostname:()=>xs,IsIri:()=>bs,IsIriReference:()=>ys,IsJsonPointer:()=>Ss,IsJsonPointerUriFragment:()=>Es,IsRegex:()=>$s,IsRelativeJsonPointer:()=>ks,IsTime:()=>Gn,IsUri:()=>Rs,IsUriReference:()=>Ts,IsUriTemplate:()=>ws,IsUrl:()=>Cs,IsUuid:()=>Ps,Reset:()=>ad,Set:()=>YR,Test:()=>tC});var mR=[0,31,28,31,30,31,30,31,31,30,31,30,31],uR=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function cR(e){return e%4===0&&(e%100!==0||e%400===0)}function qn(e){let t=uR.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&cR(r)?29:mR[n])}var pR=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;function Gn(e,t=!0){let r=pR.exec(e);if(!r||t&&!r[4]&&!r[5])return!1;let n=+r[1],o=+r[2],i=+r[3];if(n>23||o>59||i>60)return!1;if(r[5]){let f=+r[6],d=+r[7];if(f>23||d>59)return!1}if(i<60)return!0;let a=r[5]==="-"?-1:1,m=+(r[6]||0),c=+(r[7]||0);return((n*60+o-a*(m*60+c))%1440+1440)%1440===1439}function os(e){let t=e.split(/T/i);return t.length===2&&qn(t[0])&&Gn(t[1])}var fR=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function is(e){return fR.test(e)}var dR=/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\[\x20-\x7e])*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;function ss(e){return dR.test(e)}var vf=/^(?!-).*(?<!-)$/,Lf=/^(?!..--)/,_f=/^[a-zA-Z0-9-]*$/,IG=new RegExp("^\\p{ASCII}*$","u"),Kn=/[^\p{ASCII}]/u;var lR=/[0-9]/,Df=/[\u{0660}-\u{0669}]/u,gR=/[\u{06f0}-\u{06f9}]/u,xR=/[\u{002e}\u{002c}\u{003a}\u{002f}]/u,IR=/[\u{002d}\u{002b}]/u,Km=new RegExp("\\p{Mn}","u"),hR=new RegExp("\\p{Mc}","u"),hG=new RegExp("\\p{Me}","u"),Nf=/[\p{Mn}\p{Mc}\p{Me}]/u,Bm=new RegExp("\\p{L}","u"),yR=new RegExp("\\p{Nd}","u"),jf=new RegExp("\\p{Script=Greek}","u"),as=new RegExp("\\p{Script=Hebrew}","u"),Uf=/[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u,qf=/[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u,Hm=/[\u{094d}\u{09cd}\u{0a4d}\u{0acd}\u{0b4d}\u{0bcd}\u{0c4d}\u{0ccd}\u{0d3b}\u{0d3c}\u{0d4d}\u{0dca}\u{1b44}\u{1baa}\u{1bab}\u{a9c0}\u{11046}\u{1107f}\u{110b9}\u{11133}\u{11134}\u{111c0}\u{11235}\u{1134d}\u{11442}\u{114c2}\u{115bf}\u{1163f}\u{116b6}\u{11c3f}\u{11d44}\u{11d45}]/u,Gf=/[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u,bR=/[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u,ER=/[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u,Kf=new RegExp([lR,gR].map(e=>e.source).join("|"),"u"),Bf=new RegExp([Bm,IR,xR,yR,Km,hR,bR,ER].map(e=>e.source).join("|"),"u");function Hf(e){return vf.test(e)&&Lf.test(e)&&_f.test(e)}var zt=36,Go=1,Ko=26,$R=38,kR=700,Wf=72,Vf=128;function zm(){throw null}function ms(e){return e.toLowerCase().startsWith("xn--")}function Jf(e,t,r){e=r?Math.floor(e/kR):e>>1,e+=Math.floor(e/t);let n=0;for(;e>(zt-Go)*Ko>>1;)e=Math.floor(e/(zt-Go)),n+=zt;return n+Math.floor((zt-Go+1)*e/(e+$R))}function us(e){let t=[],r=Vf,n=0,o=Wf,i=e.lastIndexOf("-");if(i>0)for(let m=0;m<i;m++){let c=e.charCodeAt(m);c>=128&&zm(),t.push(c)}let a=i<0?0:i+1;for(;a<e.length;){let m=n,c=1,p=zt;for(;;){a>=e.length&&zm();let d=e.charCodeAt(a++),g;d>=97&&d<=122?g=d-97:d>=48&&d<=57?g=d-48+26:zm(),n+=g*c;let I=p<=o?Go:p>=o+Ko?Ko:p-o;if(g<I)break;c*=zt-I,p+=zt}let f=t.length+1;o=Jf(n-m,f,m===0),r+=Math.floor(n/f),n%=f,t.splice(n,0,r),n++}return String.fromCodePoint(...t)}function zf(e){return e<26?String.fromCharCode(e+97):String.fromCharCode(e-26+48)}var TR=new RegExp(Kn.source,"gu");function Xf(e){let t=e.replace(TR,""),r=t.length,n=r>0?[t,"-"]:[],o=Array.from(e,p=>p.codePointAt(0)),i=Vf,a=0,m=Wf,c=r;for(;c<o.length;){let p=1/0;for(let f of o)f>=i&&f<p&&(p=f);a+=(p-i)*(c+1),i=p;for(let f of o)if(f<i&&a++,f===i){let d=a;for(let g=zt;;g+=zt){let I=g<=m?Go:g>=m+Ko?Ko:g-m;if(d<I)break;let h=I+(d-I)%(zt-I);n.push(zf(h)),d=Math.floor((d-I)/(zt-I))}n.push(zf(d)),m=Jf(a,c+1,c===r),a=0,c++}a++,i++}return n.join("")}var wR=/^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/,Qf=/^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/,RR=/^(?:R|AL|AN)$/;function Yf(e){if(ms(e))try{return cs(us(e.slice(4).toLowerCase()))}catch{return!1}return cs(e)}function Zf(e){let t=String.fromCodePoint(e);return Kf.test(t)?"EN":Df.test(t)?"AN":Km.test(t)?"NSM":as.test(t)?"R":qf.test(t)?"AL":Bm.test(t)?"L":"ON"}function cs(e){for(let t of e)if(RR.test(Zf(t.codePointAt(0))))return!0;return!1}function ps(e){let t=!1,r=Qf,n=!1,o=!1,i=!0;for(let a of e){let m=Zf(a.codePointAt(0));if(i){if(m!=="L"&&m!=="R"&&m!=="AL")return!1;t=m==="R"||m==="AL",r=t?wR:Qf,i=!1}if(!r.test(m))return!1;m==="EN"?n=!0:m==="AN"&&(o=!0)}return!(t&&n&&o)}function CR(e){return Kn.test(e)&&Xf(e).length+4>63}function PR(e){return e[0]==="-"||e[e.length-1]==="-"?!0:e.slice(2).join("").startsWith("--")}function fs(e){if(CR(e)||cs(e)&&!ps(e))return!1;let t=[...e],r=t.map(i=>i.codePointAt(0)),n=r.length;if(PR(t)||Nf.test(t[0]))return!1;let o=!1;for(let i=0;i<n;i++){let a=r[i],m=t[i];if(Gf.test(m)||!Bf.test(m))return!1;Uf.test(m)&&(o=!0);let c=r[i-1],p=r[i+1];switch(a){case 183:if(c!==108||p!==108)return!1;break;case 885:if(!p||!jf.test(t[i+1]))return!1;break;case 1523:case 1524:if(!c||!as.test(t[i-1]))return!1;break;case 8204:if(!c||c<128&&!Hm.test(t[i-1]))return!1;break;case 8205:if(!c||!Hm.test(t[i-1]))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o)}function ds(e){if(!ms(e))return!1;try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let r=us(t);return Kn.test(r)?fs(r):!1}catch{return!1}}function AR(e){return e.length>0&&e.length<=63}function OR(e){return AR(e)&&(ds(e)||Hf(e))}function nd(e){return e.length===0||e.length>253||e.charCodeAt(e.length-1)===46?!1:e.split(".").every(t=>OR(t))}function MR(e){return e.length>0&&e.length<=63}function FR(e){return MR(e)&&(ds(e)||fs(e))}function vR(e){return e.replace(/[\uff01-\uff5e]/g,t=>String.fromCharCode(t.charCodeAt(0)-65248)).normalize("NFC").replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu,"").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".")}function od(e){if(e.length===0||e.includes(" "))return!1;let t=vR(e);if(t.length>253)return!1;let r=t.split("."),n=r.some(o=>Yf(o));return r.every(o=>FR(o)&&(!n||ps(o)))}function ls(e){return nd(e)}var LR=/^(?:[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;function gs(e){return LR.test(e.normalize("NFC"))}function xs(e){return od(e)}var _R=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function Is(e){return _R.test(e)}var DR=/^(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:)?[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)$/i;function hs(e){return DR.test(e)}var NR=/[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/,jR=/^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;function ys(e){return!NR.test(e)&&!jR.test(e)&&URL.canParse(e,"http://example.com")}var UR=/\[[vV][0-9a-fA-F]+\.[^\]]+\]/,qR=/[\x00-\x20<>\^`{|}\\]/,GR=/%(?![0-9a-fA-F]{2})/;function KR(e){return e.length<2048?e.replace(UR,"[::1]"):e}function bs(e){return qR.test(e)||GR.test(e)?!1:URL.canParse(KR(e))}var BR=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Es(e){return BR.test(e)}var HR=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function Ss(e){return HR.test(e)}function $s(e){try{return new RegExp(e,"u"),!0}catch{return!1}}var zR=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function ks(e){return zR.test(e)}var WR=/^(?:[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Ts(e){return WR.test(e)}var VR=/^(?:(?:[^\x00-\x20"<>%\\^`{|}\x7f]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?)*\})*$/i;function ws(e){return VR.test(e)}var JR=/^[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Rs(e){return JR.test(e)}function Cs(e){return URL.canParse(e)}var XR=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Ps(e){return XR.test(e)}var pe=new Map;function sd(){pe.clear()}function QR(){return[...pe.entries()]}function YR(e,t){pe.set(e,t)}function ZR(e){return pe.has(e)}function eC(e){return pe.get(e)}function tC(e,t){return pe.get(e)?.(t)??!0}function ad(){sd(),pe.set("date-time",os),pe.set("date",qn),pe.set("duration",is),pe.set("email",ss),pe.set("hostname",ls),pe.set("idn-email",gs),pe.set("idn-hostname",xs),pe.set("ipv4",Is),pe.set("ipv6",hs),pe.set("iri-reference",ys),pe.set("iri",bs),pe.set("json-pointer-uri-fragment",Es),pe.set("json-pointer",Ss),pe.set("regex",$s),pe.set("relative-json-pointer",ks),pe.set("time",Gn),pe.set("uri-reference",Ts),pe.set("uri-template",ws),pe.set("uri",Rs),pe.set("url",Cs),pe.set("uuid",Ps)}ad();function Vm(e,t,r,n){return Bn.Test(r.format,n)}function md(e,t,r,n,o,i){return Vm(e,t,o,i)||t.AddError({keyword:"format",schemaPath:r,instancePath:n,params:{format:o.format}})}function ud(e,t,r,n){let o=ns(r)?r.then:!0,i=Ji(r)?r.else:!0;return X(e,t,r.if,n)?X(e,t,o,n):X(e,t,i,n)}function cd(e,t,r,n,o,i){let a=ns(o)?o.then:!0,m=Ji(o)?o.else:!0,c=new et,p=ae(e,c,`${r}/if`,n,o.if,i)?ae(e,c,`${r}/then`,n,a,i)||t.AddError({keyword:"if",schemaPath:r,instancePath:n,params:{failingKeyword:"then"}}):ae(e,t,`${r}/else`,n,m,i)||t.AddError({keyword:"if",schemaPath:r,instancePath:n,params:{failingKeyword:"else"}});return p&&t.Merge([c]),p}function rC(e,t,r,n){return s.Every(r.items,0,(o,i)=>s.IsLessEqualThan(n.length,i)||Mt(e,t,o,n[i])&&t.AddIndex(i))}function nC(e,t,r,n,o,i){return s.EveryAll(o.items,0,(a,m)=>{let c=`${r}/items/${m}`,p=`${n}/${m}`;return s.IsLessEqualThan(i.length,m)||Ft(e,t,c,p,a,i[m])&&t.AddIndex(m)})}function oC(e,t,r,n){let o=ln(r)?r.prefixItems.length:0;return s.Every(n,o,(i,a)=>Mt(e,t,r.items,i)&&t.AddIndex(a))}function iC(e,t,r,n,o,i){let a=ln(o)?o.prefixItems.length:0;return s.EveryAll(i,a,(m,c)=>{let p=`${r}/items`,f=`${n}/${c}`;return Ft(e,t,p,f,o.items,m)&&t.AddIndex(c)})}function pd(e,t,r,n){return Qi(r)?rC(e,t,r,n):oC(e,t,r,n)}function fd(e,t,r,n,o,i){return Qi(o)?nC(e,t,r,n,o,i):iC(e,t,r,n,o,i)}function sC(e){return _r(e)}function Jm(e,t,r,n){if(!sC(r))return!0;let o=s.Counted(n,i=>X(e,t,r.contains,i));return s.IsLessEqualThan(o,r.maxContains)}function dd(e,t,r,n,o,i){let a=fn(o)?o.minContains:1;return Jm(e,t,o,i)||t.AddError({keyword:"contains",schemaPath:r,instancePath:n,params:{minContains:a,maxContains:o.maxContains}})}function Xm(e,t,r,n){return s.IsLessEqualThan(n,r.maximum)}function ld(e,t,r,n,o,i){return Xm(e,t,o,i)||t.AddError({keyword:"maximum",schemaPath:r,instancePath:n,params:{comparison:"<=",limit:o.maximum}})}function Qm(e,t,r,n){return s.IsLessEqualThan(n.length,r.maxItems)}function gd(e,t,r,n,o,i){return Qm(e,t,o,i)||t.AddError({keyword:"maxItems",schemaPath:r,instancePath:n,params:{limit:o.maxItems}})}function Ym(e,t,r,n){return s.IsMaxLength(n,r.maxLength)}function xd(e,t,r,n,o,i){return Ym(e,t,o,i)||t.AddError({keyword:"maxLength",schemaPath:r,instancePath:n,params:{limit:o.maxLength}})}function Zm(e,t,r,n){return s.IsLessEqualThan(s.Keys(n).length,r.maxProperties)}function Id(e,t,r,n,o,i){return Zm(e,t,o,i)||t.AddError({keyword:"maxProperties",schemaPath:r,instancePath:n,params:{limit:o.maxProperties}})}function aC(e){return _r(e)}function eu(e,t,r,n){if(!aC(r))return!0;let o=s.Counted(n,(i,a)=>X(e,t,r.contains,i)&&t.AddIndex(a));return s.IsGreaterEqualThan(o,r.minContains)}function hd(e,t,r,n,o,i){return eu(e,t,o,i)||t.AddError({keyword:"contains",schemaPath:r,instancePath:n,params:{minContains:o.minContains}})}function tu(e,t,r,n){return s.IsGreaterEqualThan(n,r.minimum)}function yd(e,t,r,n,o,i){return tu(e,t,o,i)||t.AddError({keyword:"minimum",schemaPath:r,instancePath:n,params:{comparison:">=",limit:o.minimum}})}function ru(e,t,r,n){return s.IsGreaterEqualThan(n.length,r.minItems)}function bd(e,t,r,n,o,i){return ru(e,t,o,i)||t.AddError({keyword:"minItems",schemaPath:r,instancePath:n,params:{limit:o.minItems}})}function nu(e,t,r,n){return s.IsMinLength(n,r.minLength)}function Ed(e,t,r,n,o,i){return nu(e,t,o,i)||t.AddError({keyword:"minLength",schemaPath:r,instancePath:n,params:{limit:o.minLength}})}function ou(e,t,r,n){return s.IsGreaterEqualThan(s.Keys(n).length,r.minProperties)}function Sd(e,t,r,n,o,i){return ou(e,t,o,i)||t.AddError({keyword:"minProperties",schemaPath:r,instancePath:n,params:{limit:o.minProperties}})}function iu(e,t,r,n){return s.IsMultipleOf(n,r.multipleOf)}function $d(e,t,r,n,o,i){return iu(e,t,o,i)||t.AddError({keyword:"multipleOf",schemaPath:r,instancePath:n,params:{multipleOf:o.multipleOf}})}function su(e,t,r,n){let o=new pt;return!X(e,o,r.not,n)&&t.Merge([o])}function kd(e,t,r,n,o,i){return su(e,t,o,i)||t.AddError({keyword:"not",schemaPath:r,instancePath:n,params:{}})}function Td(e,t,r,n){let o=r.oneOf.reduce((i,a)=>{let m=new pt;return X(e,m,a,n)?[...i,m]:i},[]);return s.IsEqual(o.length,1)&&t.Merge(o)}function wd(e,t,r,n,o,i){let a=[],m=[],c=o.oneOf.reduce((f,d,g)=>{let I=new et,h=`${r}/oneOf/${g}`,y=ae(e,I,h,n,d,i);return y&&m.push(g),y||a.push(I),y?[...f,I]:f},[]),p=s.IsEqual(c.length,1)&&t.Merge(c);return!p&&s.IsEqual(m.length,0)&&a.forEach(f=>f.GetErrors().forEach(d=>t.AddError(d))),p||t.AddError({keyword:"oneOf",schemaPath:r,instancePath:n,params:{passingSchemas:m}})}function au(e,t,r,n){return(s.IsString(r.pattern)?Nr(r.pattern):r.pattern).test(n)}function Rd(e,t,r,n,o,i){return au(e,t,o,i)||t.AddError({keyword:"pattern",schemaPath:r,instancePath:n,params:{pattern:o.pattern}})}function Cd(e,t,r,n){return s.Every(s.Entries(r.patternProperties),0,([o,i])=>{let a=Nr(o);return s.Every(s.Entries(n),0,([m,c])=>!a.test(m)||Mt(e,t,i,c)&&t.AddKey(m))})}function Pd(e,t,r,n,o,i){return s.EveryAll(s.Entries(o.patternProperties),0,([a,m])=>{let c=`${r}/patternProperties/${a}`,p=Nr(a);return s.EveryAll(s.Entries(i),0,([f,d])=>{let g=`${n}/${f}`;return!p.test(f)||Ft(e,t,c,g,m,d)&&t.AddKey(f)})})}function Ad(e,t,r,n){return s.IsEqual(n.length,0)||s.Every(r.prefixItems,0,(o,i)=>s.IsLessEqualThan(n.length,i)||Mt(e,t,o,n[i])&&t.AddIndex(i))}function Od(e,t,r,n,o,i){return s.IsEqual(i.length,0)||s.EveryAll(o.prefixItems,0,(a,m)=>{let c=`${r}/prefixItems/${m}`,p=`${n}/${m}`;return s.IsLessEqualThan(i.length,m)||Ft(e,t,c,p,a,i[m])&&t.AddIndex(m)})}function mu(e,t){return e.includes(t)||Me.Get().exactOptionalPropertyTypes}function uu(e,t){return s.IsUndefined(e[t])}function Md(e,t,r,n){let o=gn(r)?r.required:[];return s.Every(s.Entries(r.properties),0,([a,m])=>{let c=!s.HasPropertyKey(n,a)||Mt(e,t,m,n[a])&&t.AddKey(a);return mu(o,a)?c:uu(n,a)||c})}function Fd(e,t,r,n,o,i){let a=gn(o)?o.required:[];return s.EveryAll(s.Entries(o.properties),0,([c,p])=>{let f=`${r}/properties/${c}`,d=`${n}/${c}`,g=()=>!s.HasPropertyKey(i,c)||Ft(e,t,f,d,p,i[c])&&t.AddKey(c);return mu(a,c)?g():uu(i,c)||g()})}function vd(e,t,r,n){return s.Every(s.Keys(n),0,(o,i)=>X(e,t,r.propertyNames,o))}function Ld(e,t,r,n,o,i){let a=[];return s.EveryAll(s.Keys(i),0,(c,p)=>{let f=`${n}/${c}`,d=`${r}/propertyNames`,g=ae(e,t,d,f,o.propertyNames,c);return g||a.push(c),g})||t.AddError({keyword:"propertyNames",schemaPath:r,instancePath:n,params:{propertyNames:a}})}function _d(e,t,r,n){let o=e.RecursiveRef(r)??!1;return F(o)&&X(e,t,o,n)}function Dd(e,t,r,n,o,i){let a=e.RecursiveRef(o)??!1;return F(a)&&ae(e,t,"#",n,a,i)}function Nd(e,t,r,n){let o=e.Ref(r)??!1,i=new pt,a=F(o)&&X(e,i,o,n);return a&&t.Merge([i]),a}function jd(e,t,r,n,o,i){let a=e.Ref(o)??!1,m=new et,c=F(a)&&ae(e,m,"#",n,a,i);return c&&t.Merge([m]),c||m.GetErrors().forEach(p=>t.AddError(p)),c}function Ud(e,t,r,n){return s.Every(r.required,0,o=>s.HasPropertyKey(n,o))}function qd(e,t,r,n,o,i){let a=[];return s.EveryAll(o.required,0,c=>{let p=s.HasPropertyKey(i,c);return p||a.push(c),p})||t.AddError({keyword:"required",schemaPath:r,instancePath:n,params:{requiredProperties:a}})}function cu(e,t,r,n,o){return s.IsEqual(r,"object")?s.IsObjectNotArray(o):s.IsEqual(r,"array")?s.IsArray(o):s.IsEqual(r,"boolean")?s.IsBoolean(o):s.IsEqual(r,"integer")?s.IsInteger(o):s.IsEqual(r,"number")?s.IsNumber(o):s.IsEqual(r,"null")?s.IsNull(o):s.IsEqual(r,"string")?s.IsString(o):s.IsEqual(r,"bigint")?s.IsBigInt(o):s.IsEqual(r,"constructor")?s.IsConstructor(o):s.IsEqual(r,"function")?s.IsFunction(o):s.IsEqual(r,"symbol")?s.IsSymbol(o):s.IsEqual(r,"undefined")?s.IsUndefined(o):s.IsEqual(r,"void")?s.IsUndefined(o):!0}function Gd(e,t,r,n,o){return s.Some(r,i=>cu(e,t,i,n,o))}function Kd(e,t,r,n){return s.IsArray(r.type)?Gd(e,t,r.type,r,n):cu(e,t,r.type,r,n)}function Bd(e,t,r,n,o,i){return(s.IsArray(o.type)?Gd(e,t,o.type,o,i):cu(e,t,o.type,o,i))||t.AddError({keyword:"type",schemaPath:r,instancePath:n,params:{type:o.type}})}function Hd(e,t,r,n){let o=t.GetIndices();return s.Every(n,0,(i,a)=>(o.has(a)||X(e,t,r.unevaluatedItems,i))&&t.AddIndex(a))}function zd(e,t,r,n,o,i){let a=t.GetIndices(),m=[];return s.EveryAll(i,0,(p,f)=>{let d=new et,g=(a.has(f)||ae(e,d,r,n,o.unevaluatedItems,p))&&t.AddIndex(f);return g||m.push(f),g})||t.AddError({keyword:"unevaluatedItems",schemaPath:r,instancePath:n,params:{unevaluatedItems:m}})}function Wd(e,t,r,n){let o=t.GetKeys();return s.Every(s.Entries(n),0,([i,a])=>o.has(i)||X(e,t,r.unevaluatedProperties,a)&&t.AddKey(i))}function Vd(e,t,r,n,o,i){let a=t.GetKeys(),m=[];return s.EveryAll(s.Entries(i),0,([p,f])=>{let d=new et,g=a.has(p)||ae(e,d,r,n,o.unevaluatedProperties,f)&&t.AddKey(p);return g||m.push(p),g})||t.AddError({keyword:"unevaluatedProperties",schemaPath:r,instancePath:n,params:{unevaluatedProperties:m}})}var Sr={};At(Sr,{Hash:()=>TC,HashCode:()=>el});function $e(){throw new Error("Unreachable")}function mC(e){let t=new Set,r=e;for(;r&&r!==Object.prototype;){for(let n of Reflect.ownKeys(r))n!=="constructor"&&typeof n!="symbol"&&t.add(n);r=Object.getPrototypeOf(r)}return[...t]}function uC(e){return typeof e=="number"}var ft;(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"})(ft||(ft={}));var Hn=BigInt("14695981039346656037"),[cC,pC]=[BigInt("1099511628211"),BigInt("18446744073709551616")],fC=Array.from({length:256}).map((e,t)=>BigInt(t)),Qd=new Float64Array(1),Yd=new DataView(Qd.buffer),Zd=new Uint8Array(Qd.buffer);function Je(e){Hn=Hn^fC[e],Hn=Hn*cC%pC}function dC(e){Je(ft.Array);for(let t of e)jr(t)}function lC(e){Je(ft.BigInt),Yd.setBigInt64(0,e);for(let t of Zd)Je(t)}function Jd(e){Je(ft.Boolean),Je(e?1:0)}function gC(e){Je(ft.Constructor),jr(e.toString())}function xC(e){Je(ft.Date),jr(e.getTime())}function IC(e){Je(ft.Function),jr(e.toString())}function hC(e){Je(ft.Null)}function Xd(e){Je(ft.Number),Yd.setFloat64(0,e,!0);for(let t of Zd)Je(t)}function yC(e){Je(ft.Object);for(let t of mC(e).sort())jr(t),jr(e[t])}function bC(e){Je(ft.RegExp),pu(e.toString())}var EC=new TextEncoder;function pu(e){Je(ft.String);for(let t of EC.encode(e))Je(t)}function SC(e){Je(ft.Symbol),jr(e.toString())}function $C(e){Je(ft.TypeArray);let t=new Uint8Array(e.buffer);for(let r=0;r<t.length;r++)Je(t[r])}function kC(e){return Je(ft.Undefined)}function jr(e){return Le.IsTypeArray(e)?$C(e):Le.IsDate(e)?xC(e):Le.IsRegExp(e)?bC(e):Le.IsBoolean(e)?Jd(e.valueOf()):Le.IsString(e)?pu(e.valueOf()):Le.IsNumber(e)?Xd(e.valueOf()):uC(e)?Xd(e):s.IsArray(e)?dC(e):s.IsBoolean(e)?Jd(e):s.IsBigInt(e)?lC(e):s.IsConstructor(e)?gC(e):s.IsNull(e)?hC(e):s.IsObject(e)?yC(e):s.IsString(e)?pu(e):s.IsSymbol(e)?SC(e):s.IsUndefined(e)?kC(e):s.IsFunction(e)?IC(e):$e()}function el(e){return Hn=BigInt("14695981039346656037"),jr(e),Hn}function TC(e){return el(e).toString(16).padStart(16,"0")}function tl(e){return!s.IsEqual(e.uniqueItems,!1)}function rl(e,t,r,n){if(!tl(r))return!0;let o=new Set(n.map(Sr.Hash)).size,i=n.length;return s.IsEqual(o,i)}function nl(e,t,r,n,o,i){if(!tl(o))return!0;let a=new Set,m=i.reduce((p,f,d)=>{let g=Sr.Hash(f);return a.has(g)?[...p,d]:(a.add(g),p)},[]);return s.IsEqual(m.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:r,instancePath:n,params:{duplicateItems:m}})}function Mt(e,t,r,n){return t.Push()&&X(e,t,r,n)&&t.Pop()}function X(e,t,r,n){e.Push(r);let o=Lr(r)?Lm(e,t,r,n):(!Fm(r)||Kd(e,t,r,n))&&(!(s.IsObject(n)&&!s.IsArray(n))||(!gn(r)||Ud(e,t,r,n))&&(!Ut(r)||lf(e,t,r,n))&&(!km(r)||$f(e,t,r,n))&&(!Tm(r)||Tf(e,t,r,n))&&(!Wi(r)||Rf(e,t,r,n))&&(!Nn(r)||Cd(e,t,r,n))&&(!jn(r)||Md(e,t,r,n))&&(!es(r)||vd(e,t,r,n))&&(!vo(r)||ou(e,t,r,n))&&(!Om(r)||Zm(e,t,r,n)))&&(!s.IsArray(n)||(!Bi(r)||pf(e,t,r,n))&&(!_r(r)||Dm(e,t,r,n))&&(!pn(r)||pd(e,t,r,n))&&(!Pm(r)||Jm(e,t,r,n))&&(!Mo(r)||Qm(e,t,r,n))&&(!fn(r)||eu(e,t,r,n))&&(!dn(r)||ru(e,t,r,n))&&(!ln(r)||Ad(e,t,r,n))&&(!Dr(r)||rl(e,t,r,n)))&&(!s.IsString(n)||(!Am(r)||Ym(e,t,r,n))&&(!Fo(r)||nu(e,t,r,n))&&(!Oo(r)||Vm(e,t,r,n))&&(!Lo(r)||au(e,t,r,n)))&&(!(s.IsNumber(n)||s.IsBigInt(n))||(!Rm(r)||qm(e,t,r,n))&&(!yr(r)||Gm(e,t,r,n))&&(!Cm(r)||Xm(e,t,r,n))&&(!br(r)||tu(e,t,r,n))&&(!Mm(r)||iu(e,t,r,n)))&&(!rs(r)||Nd(e,t,r,n))&&(!ts(r)||_d(e,t,r,n))&&(!Vi(r)||Pf(e,t,r,n))&&(!$m(r)||_m(e,t,r,n))&&(!wm(r)||Um(e,t,r,n))&&(!Xi(r)||ud(e,t,r,n))&&(!Yi(r)||su(e,t,r,n))&&(!Hi(r)||xf(e,t,r,n))&&(!zi(r)||hf(e,t,r,n))&&(!Zi(r)||Td(e,t,r,n))&&(!Do(r)||!s.IsArray(n)||Hd(e,t,r,n))&&(!No(r)||!s.IsObject(n)||Wd(e,t,r,n))&&(!Ki(r)||mf(e,t,r,n));return e.Pop(r),o}function Ft(e,t,r,n,o,i){return t.Push()&&ae(e,t,r,n,o,i)&&t.Pop()}function ae(e,t,r,n,o,i){if(t.AtCapacity())return!1;e.Push(o);let a=Lr(o)?bf(e,t,r,n,o,i):!!(+(!Fm(o)||Bd(e,t,r,n,o,i))&+(!(s.IsObject(i)&&!s.IsArray(i))||!!(+(!gn(o)||qd(e,t,r,n,o,i))&+(!Ut(o)||gf(e,t,r,n,o,i))&+(!km(o)||kf(e,t,r,n,o,i))&+(!Tm(o)||wf(e,t,r,n,o,i))&+(!Wi(o)||Cf(e,t,r,n,o,i))&+(!Nn(o)||Pd(e,t,r,n,o,i))&+(!jn(o)||Fd(e,t,r,n,o,i))&+(!es(o)||Ld(e,t,r,n,o,i))&+(!vo(o)||Sd(e,t,r,n,o,i))&+(!Om(o)||Id(e,t,r,n,o,i))))&+(!s.IsArray(i)||!!(+(!Bi(o)||ff(e,t,r,n,o,i))&+(!_r(o)||Sf(e,t,r,n,o,i))&+(!pn(o)||fd(e,t,r,n,o,i))&+(!Pm(o)||dd(e,t,r,n,o,i))&+(!Mo(o)||gd(e,t,r,n,o,i))&+(!fn(o)||hd(e,t,r,n,o,i))&+(!dn(o)||bd(e,t,r,n,o,i))&+(!ln(o)||Od(e,t,r,n,o,i))&+(!Dr(o)||nl(e,t,r,n,o,i))))&+(!s.IsString(i)||!!(+(!Am(o)||xd(e,t,r,n,o,i))&+(!Fo(o)||Ed(e,t,r,n,o,i))&+(!Oo(o)||md(e,t,r,n,o,i))&+(!Lo(o)||Rd(e,t,r,n,o,i))))&+(!(s.IsNumber(i)||s.IsBigInt(i))||!!(+(!Rm(o)||Mf(e,t,r,n,o,i))&+(!yr(o)||Ff(e,t,r,n,o,i))&+(!Cm(o)||ld(e,t,r,n,o,i))&+(!br(o)||yd(e,t,r,n,o,i))&+(!Mm(o)||$d(e,t,r,n,o,i))))&+(!rs(o)||jd(e,t,r,n,o,i))&+(!ts(o)||Dd(e,t,r,n,o,i))&+(!Vi(o)||Af(e,t,r,n,o,i))&+(!$m(o)||Ef(e,t,r,n,o,i))&+(!wm(o)||Of(e,t,r,n,o,i))&+(!Xi(o)||cd(e,t,r,n,o,i))&+(!Yi(o)||kd(e,t,r,n,o,i))&+(!Hi(o)||If(e,t,r,n,o,i))&+(!zi(o)||yf(e,t,r,n,o,i))&+(!Zi(o)||wd(e,t,r,n,o,i))&+(!Do(o)||!s.IsArray(i)||zd(e,t,r,n,o,i))&+(!No(o)||!s.IsObject(i)||Vd(e,t,r,n,o,i)))&&(!Ki(o)||uf(e,t,r,n,o,i));return e.Pop(o),a}var Ur={};At(Ur,{Base:()=>pl,DefaultBase:()=>As,DynamicRef:()=>dl,Ref:()=>Ho,ResolveDynamicRef:()=>XC,ResolveRecursiveRef:()=>JC,ResolveRef:()=>VC,Resource:()=>fl});var nr={};At(nr,{Delete:()=>FC,Get:()=>OC,Has:()=>AC,Indices:()=>Bo,Set:()=>MC});function ol(e){if(e.length===0)throw Error("Cannot set root")}function il(e){if(!s.IsObject(e))throw Error("Cannot set value")}function wC(e){if(s.IsUnsafePropertyKey(e))throw Error("Pointer contains unsafe property key")}function sl(e){for(let t of e)wC(t)}function RC(e){return/^(0|[1-9]\d*)$/.test(e)}function al(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function CC(e,t){return s.IsObject(t)&&s.HasPropertyKey(t,e)}function PC(e,t){return s.IsObject(t)&&!s.IsUnsafePropertyKey(e)?t[e]:void 0}function fu(e,t){return e.reduce((r,n)=>PC(n,r),t)}function Bo(e){if(s.IsEqual(e.length,0))return[];let t=e.split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));return t.length>0&&t[0]===""?t.slice(1):t}function AC(e,t){let r=e;return Bo(t).every(n=>CC(n,r)?(r=r[n],!0):!1)}function OC(e,t){let r=Bo(t);return fu(r,e)}function MC(e,t,r){let n=Bo(t);ol(n),sl(n);let[o,i]=al(n),a=fu(o,e);return il(a),a[i]=r,e}function FC(e,t){let r=Bo(t);ol(r),sl(r);let[n,o]=al(r),i=fu(n,e);return il(i),s.IsArray(i)&&RC(o)?i.splice(+o,1):delete i[o],e}var As="https://json-schema.org";function ul(e,t){if(s.IsObject(e)&&hr(e)&&s.IsEqual(e.$dynamicAnchor,t))return e;if(s.IsObject(e))for(let r of s.Keys(e)){let n=ul(e[r],t);if(n)return n}}function du(e,t,r){if(s.IsEqual(e,r))return t.href;let n=ct(e)&&Ot(e)?new URL(e.$id,t.href):t;if(s.IsArray(e))for(let o of e){let i=du(o,n,r);if(!s.IsUndefined(i))return i}else if(s.IsObject(e))for(let o of s.Keys(e)){let i=du(e[o],n,r);if(!s.IsUndefined(i))return i}}function vC(e,t,r){if(s.IsEqual(e.$id,r.hash))return e;let n=new URL(r.href,t.href);if(s.IsEqual(t.pathname,n.pathname))return r.hash.startsWith("#")?cl(e,r):e}function LC(e,t,r){let n=new URL(`#${e.$anchor}`,t.href),o=new URL(r.href,t.href);return s.IsEqual(n.href,o.href)?e:void 0}function _C(e,t,r){let n=new URL(`#${e.$dynamicAnchor}`,t.href),o=new URL(r.href,t.href);return s.IsEqual(n.href,o.href)?e:void 0}function cl(e,t){if(t.href.endsWith("#"))return e;if(!t.hash.startsWith("#"))return;let r=decodeURIComponent(t.hash.slice(1));return r.startsWith("/")?nr.Get(e,r):void 0}function DC(e,t,r){if(Ot(e)){let n=vC(e,t,r);if(!s.IsUndefined(n))return n}if(Ao(e)){let n=LC(e,t,r);if(!s.IsUndefined(n))return n}if(hr(e)){let n=_C(e,t,r);if(!s.IsUndefined(n))return n}return cl(e,r)}function NC(e,t,r){return e.reduce((n,o)=>{let i=Os(o,t,r);return s.IsUndefined(i)?n:i},void 0)}function jC(e){return s.IsEqual(e,"const")||s.IsEqual(e,"enum")}function UC(e,t,r){return s.Keys(e).reduce((n,o)=>{if(jC(o))return n;let i=Os(e[o],t,r);return s.IsUndefined(i)?n:i},void 0)}function Os(e,t,r){let n=ct(e)&&Ot(e)?new URL(e.$id,t.href):t;if(ct(e)){let o=DC(e,n,r);if(!s.IsUndefined(o))return o}if(s.IsArray(e))return NC(e,n,r);if(s.IsObject(e))return UC(e,n,r)}function pl(e,t,r){return du(e,new URL(t||".",As),r)}function fl(e,t,r,n){let o=Ho(e,t,r,n,!1);return ct(o)&&Ot(o)?o:void 0}function ml(e){return e.href.split("#")[0]}function qC(e,t){return s.HasPropertyKey(e,t)?e[t]:void 0}function GC(e,t,r){return Os(e,t,r)}function KC(e,t,r){let n=ml(r);if(s.IsEqual(n,ml(t))||!s.HasPropertyKey(e,n))return;let o=e[n],i=ct(o)&&Ot(o)?new URL(o.$id,n):new URL(n);return s.IsEqual(r.hash,"")?o:Os(o,i,r)}function BC(e,t,r,n,o){if(!n.$ref.startsWith("#")||s.HasPropertyKey(e,"$schema"))return;let i=pl(t,r,o);if(!(s.IsUndefined(i)||s.IsEqual(i,r)))return{target:o,base:i,root:t}}function HC(e,t,r){let n=e[t];if(ct(n))return{target:r,base:t,root:n}}function zC(e,t,r,n,o){let i=o?HC(e.context,n,r):void 0;return s.IsUndefined(i)?BC(e.root,e.lexicalSchema,e.referenceBase,t,r):i}function WC(e,t,r,n,o,i){if(Ot(o))return;let a=fl(e,t,r,n);if(!(!a||i.includes(a)))return{target:o,resource:a}}function Ho(e,t,r,n,o=!0){let i=new URL(r||".",As),a=o&&Ot(t)?new URL(t.$id,i):i,m=new URL(n,a.href);return qC(e,n)??GC(t,a,m)??KC(e,a,m)}function dl(e,t,r,n,o,i){let a=new URL(r||".",As),m=o.$dynamicRef.startsWith("#")?n:t,c=Ho(e,m,r,o.$dynamicRef,!1);if(s.IsUndefined(c)){let d=new URL(o.$dynamicRef,a).hash;if(!d.startsWith("#/")&&d.startsWith("#")){let g=decodeURIComponent(d.slice(1));return i.find(h=>s.IsEqual(h.$dynamicAnchor,g))??ul(t,g)}return}return!ct(c)||!hr(c)||new URL(o.$dynamicRef,a).hash.startsWith("#/")?c:i.find(d=>s.IsEqual(d.$dynamicAnchor,c.$dynamicAnchor))??c}function VC(e,t){let r=e.inRetrievedFrame?e.lexicalSchema:e.root,n=t.$ref.startsWith("#")?e.lexicalSchema:r,o=Ho(e.context,n,e.referenceBase,t.$ref,!1);if(!o||!ct(o))return{schema:o};let i=new URL(t.$ref,e.referenceBase).href.split("#")[0],a=!s.IsEqual(i,e.resourceBase),m=zC(e,t,o,i,a),c=a?WC(e.context,e.root,e.referenceBase,i,o,e.ids):void 0;return{schema:o,retrievedResource:m,resolvedResource:c}}function JC(e,t){let r=_o(e.lexicalSchema)?e.recursiveAnchors[0]:e.lexicalSchema;return Ho(e.context,r,e.lexicalBase,t.$recursiveRef,!1)}function XC(e,t){return dl(e.context,e.root,e.lexicalBase,e.lexicalSchema,t,e.dynamicAnchors)}var ye=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},fe,Fs,yl,xu,Ms,ll,gl,xl,Il,lu,gu,Iu,hu,hl,bl,xn=class{constructor(t,r){fe.add(this),this.context=t,this.schema=r,this.ids=[],this.resourceIds=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[],this.retrievedResources=new Map,this.retrievedFrames=[],this.resolvedResources=new Map,this.pendingResource=!0}LexicalBaseURL(){return ye(this,fe,"m",xu).call(this,this.ids)}Push(t){if(!ct(t))return;Ot(t)&&ye(this,fe,"m",Iu).call(this,t),Ao(t)&&this.anchors.push(t),_o(t)&&this.recursiveAnchors.push(t),hr(t)&&this.dynamicAnchors.push(t);let r=this.retrievedResources.get(t);r&&this.retrievedFrames.push({schema:r.root,base:r.base,idDepth:this.ids.length,resourceDepth:this.resourceIds.length})}Pop(t){ct(t)&&(Ot(t)&&ye(this,fe,"m",hu).call(this,t),Ao(t)&&this.anchors.pop(),_o(t)&&this.recursiveAnchors.pop(),hr(t)&&this.dynamicAnchors.pop(),this.retrievedResources.has(t)&&this.retrievedFrames.pop(),ye(this,fe,"m",bl).call(this,t))}Ref(t){let r=Ur.ResolveRef(ye(this,fe,"m",Fs).call(this),t);return ye(this,fe,"m",yl).call(this,r),r.schema}RecursiveRef(t){let r=Ur.ResolveRecursiveRef(ye(this,fe,"m",Fs).call(this),t);return r&&(this.pendingResource=!0),r}DynamicRef(t){let r=Ur.ResolveDynamicRef(ye(this,fe,"m",Fs).call(this),t);return r&&(this.pendingResource=!0),r}};fe=new WeakSet,Fs=function(){return{context:this.context,root:this.schema,ids:this.ids,lexicalSchema:ye(this,fe,"m",gl).call(this),lexicalBase:this.LexicalBaseURL(),referenceBase:ye(this,fe,"m",ll).call(this),resourceBase:ye(this,fe,"m",Ms).call(this),recursiveAnchors:this.recursiveAnchors,dynamicAnchors:this.dynamicAnchors,inRetrievedFrame:this.retrievedFrames.length>0}},yl=function(t){s.IsUndefined(t.schema)||(this.pendingResource=!0),s.IsUndefined(t.resolvedResource)||ye(this,fe,"m",hl).call(this,t.resolvedResource.target,t.resolvedResource.resource),s.IsUndefined(t.retrievedResource)||this.retrievedResources.set(t.retrievedResource.target,{base:t.retrievedResource.base,root:t.retrievedResource.root})},xu=function(t){let r=this.retrievedFrames[this.retrievedFrames.length-1],n=r?new URL(r.base):new URL(Ur.DefaultBase);return(r?t.slice(r.idDepth):t).reduce((i,a)=>new URL(a.$id,i),n).href},Ms=function(){let t=this.retrievedFrames[this.retrievedFrames.length-1];return t?this.resourceIds.slice(t.resourceDepth).reduce((r,n)=>new URL(n.$id,r),new URL(t.base)).href:ye(this,fe,"m",xu).call(this,this.resourceIds)},ll=function(){if(this.retrievedFrames.length>0)return ye(this,fe,"m",Ms).call(this);let t=this.ids[this.ids.length-1];return t&&!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t.$id)?this.LexicalBaseURL():ye(this,fe,"m",Ms).call(this)},gl=function(){let t=this.retrievedFrames[this.retrievedFrames.length-1];return t?this.ids.length>t.idDepth?this.ids[this.ids.length-1]:t.schema:this.ids.length>0?this.ids[this.ids.length-1]:this.schema},xl=function(t){t.forEach(r=>ye(this,fe,"m",lu).call(this,r,!1))},Il=function(t){t.forEach(r=>ye(this,fe,"m",gu).call(this,r,!1))},lu=function e(t,r=!0){if(Lr(t))return;if(s.IsArray(t))return ye(this,fe,"m",xl).call(this,t);if(!ct(t))return;let n=t;if(!(!r&&Ot(n))){!r&&hr(n)&&this.dynamicAnchors.push(n);for(let o of s.Keys(n))ye(this,fe,"m",e).call(this,n[o],!1)}},gu=function e(t,r=!0){if(Lr(t))return;if(s.IsArray(t))return ye(this,fe,"m",Il).call(this,t);if(!ct(t))return;let n=t;if(!(!r&&Ot(n))){!r&&hr(n)&&this.dynamicAnchors.pop();for(let o of s.Keys(n))ye(this,fe,"m",e).call(this,n[o],!1)}},Iu=function(t){this.ids.push(t);let r=this.pendingResource;this.pendingResource=!1,r&&this.resourceIds.push(t),ye(this,fe,"m",lu).call(this,t,!0)},hu=function(t){this.ids.pop(),this.resourceIds.length>0&&s.IsEqual(this.resourceIds[this.resourceIds.length-1],t)&&this.resourceIds.pop(),ye(this,fe,"m",gu).call(this,t,!0)},hl=function(t,r){ye(this,fe,"m",Iu).call(this,r),this.resolvedResources.set(t,r)},bl=function(t){if(!this.resolvedResources.has(t))return;let r=this.resolvedResources.get(t);ye(this,fe,"m",hu).call(this,r),this.resolvedResources.delete(t)};function Sl(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var QC=Sl;function $l(){return QC}var l={};At(l,{Assign:()=>ZC,Clone:()=>hn,Create:()=>cP,Discard:()=>pP,Metrics:()=>Wt,Update:()=>fP});var Wt={assign:0,create:0,clone:0,discard:0,update:0};function qr(e){return Me.Get().immutableTypes?Object.freeze(e):e}function ZC(e,t){return Wt.assign+=1,qr({...e,...t})}function eP(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function tP(e){let t={};for(let r of s.Keys(e)){if(s.IsUnsafePropertyKey(r))continue;let n=Object.getOwnPropertyDescriptor(e,r);n.value=In(n.value),s.IsEqual(n.enumerable,!0)?t[r]=n.value:Object.defineProperty(t,r,n)}return t}function rP(e){let t={};for(let r of s.Keys(e))s.IsUnsafePropertyKey(r)||(t[r]=In(e[r]));for(let r of s.Symbols(e))t[r]=In(e[r]);return t}function nP(e){return s.IsClassInstance(e)?e:eP(e)?tP(e):rP(e)}function oP(e){return e.map(t=>In(t))}function iP(e){return e.slice()}function sP(e){return new RegExp(e.source,e.flags)}function aP(e){return new Map(In([...e.entries()]))}function mP(e){return new Set(In([...e.values()]))}function In(e){return Le.IsTypeArray(e)?iP(e):Le.IsRegExp(e)?sP(e):Le.IsMap(e)?aP(e):Le.IsSet(e)?mP(e):s.IsArray(e)?oP(e):s.IsObject(e)?nP(e):e}function hn(e){return Wt.clone+=1,In(e)}function uP(e,t){for(let r of Object.keys(t))Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:!1,value:t[r]});return e}function kl(e,t){return{...e,...t}}function cP(e,t,r={}){Wt.create+=1;let n=kl(t,r),o=Me.Get().enumerableKind?kl(n,e):uP(n,e);return qr(o)}function pP(e,t){Wt.discard+=1;let r={};for(let n of s.Keys(e)){if(t.includes(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=hn(o.value),Object.defineProperty(r,n,o)}return qr(r)}function fP(e,t,r){Wt.update+=1;let n=Me.Get(),o=hn(e);for(let i of Object.keys(t))Object.defineProperty(o,i,{configurable:!0,writable:!0,enumerable:n.enumerableKind,value:t[i]});for(let i of Object.keys(r))Object.defineProperty(o,i,{configurable:!0,enumerable:!0,writable:!0,value:r[i]});return qr(o)}function vs(...e){let[t,r,n]=G.Match(e,{3:(f,d,g)=>[f,d,g],2:(f,d)=>[{},f,d]}),o=new xn(t,r),i=new et,a=ae(o,i,"#","",r,n),m=i.GetErrors(),c=$l(),p=m.map(f=>({...f,message:c(f)}));return[a,p]}function bu(...e){let[t,r,n]=G.Match(e,{3:(a,m,c)=>[a,m,c],2:(a,m)=>[{},a,m]}),o=new xn(t,r),i=new pt;return X(o,i,r,n)}function K(...e){let[t,r,n]=G.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return bu(t,r,n)}function Vt(...e){let[t,r,n]=G.Match(e,{3:(a,m,c)=>[a,m,c],2:(a,m)=>[{},a,m]}),[o,i]=vs(t,r,n);return i}var $r=class extends Error{constructor(t,r,n){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:n,value:r},writable:!1,configurable:!1,enumerable:!1})}};function Ls(...e){let[t,r,n]=G.Match(e,{3:(i,a,m)=>[i,a,m],2:(i,a)=>[{},i,a]});if(!K(t,r,n))throw new $r("Assert",n,Vt(t,r,n))}function k(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function be(e){return s.IsObject(e)}function T(e,t,r){return l.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function Gr(e){return k(e,"Deferred")}function gP(e){return l.Update(e,{"~readonly":!0},{})}function zo(e,t){return l.Update(gP(e),{},t)}function wl(e,t,r,n){let o=E(e,t,r);return zo(o,n)}function xP(e){return l.Update(e,{"~optional":!0},{})}function Wo(e,t){return l.Update(xP(e),{},t)}function Rl(e,t,r,n){let o=E(e,t,r);return Wo(o,n)}function ht(e,t){return l.Create({"~kind":"Array"},{type:"array",items:e},t)}function H(e){return k(e,"Array")}function zn(e){return l.Discard(e,["~kind","type","items"])}function or(e,t,r={}){return l.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function ke(e){return k(e,"Constructor")}function Cl(e){return l.Discard(e,["~kind","type","parameters","instanceType"])}function ir(e,t,r={}){return l.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function Te(e){return k(e,"Function")}function Pl(e){return l.Discard(e,["~kind","type","parameters","returnType"])}function Ue(e,t){return l.Create({"~kind":"Ref"},{$ref:e},t)}function Z(e){return k(e,"Ref")}function Kr(e,t){return l.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Wn(e){return k(e,"Generic")}function Vn(e){return l.Create({"~kind":"Any"},{},e)}function Ee(e){return k(e,"Any")}var Al="(?!)";function re(e){return l.Create({"~kind":"Never"},{not:{}},e)}function yt(e){return k(e,"Never")}function sr(e,t={}){return T("AddOptional",[e],t)}function yn(e,t={}){return Wo(e,t)}function Ol(e){return yn(e)}function qe(e){return be(e)&&s.HasPropertyKey(e,"~optional")}function Ml(e){return s.Keys(e).filter(t=>!qe(e[t]))}function _s(e){return s.Keys(e)}function Ds(e){return s.Values(e)}function P(e,t={}){let r=Ml(e),n=r.length>0?{required:r}:{};return l.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function A(e){return k(e,"Object")}function Fl(e){return l.Discard(e,["~kind","type","properties","required"])}function _e(e){return l.Create({"~kind":"Unknown"},{},e)}function Fe(e){return k(e,"Unknown")}function ar(e,t,r){let n=s.Keys(e).reduce((o,i)=>({...o,[i]:l.Update(e[i],{},{$id:i})}),{});return l.Create({"~kind":"Cyclic"},{$defs:n,$ref:t},r)}function ie(e){return k(e,"Cyclic")}function vl(e){return l.Update(e,{"~unsafe":null},{})}function Ns(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}function Vo(...e){let[t,r]=G.Match(e,{2:(n,o)=>[n,o,o],1:n=>[n,_e(),_e()]});return l.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function ve(e){return k(e,"Infer")}function bn(e,t,r,n={}){return l.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function we(e){return k(e,"Dependent")}function Ll(e){return l.Discard(e,["~kind","if","then","else"])}function _l(e){return s.IsObjectNotArray(e)}function Dl(e){return s.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function Nl(e){return s.IsString(e)||s.IsNumber(e)}function jl(e,t){let r=_l(e)?Dl(e):e;return l.Create({"~kind":"Enum"},{enum:r},t)}function Re(e){return k(e,"Enum")}function ot(e,t={}){return l.Create({"~kind":"Intersect"},{allOf:e},t)}function C(e){return k(e,"Intersect")}function Ul(e){return l.Discard(e,["~kind","allOf"])}var Jo=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=dt(r)?a=>this.decode(r["~codec"].decode(a)):this.decode,o=dt(r)?a=>r["~codec"].encode(t(a)):t,i={decode:n,encode:o};return l.Update(this.type,{"~codec":i},{})}},Xo=class{constructor(t){this.type=t}Decode(t){return new Jo(this.type,t)}};function js(e){return new Xo(e)}function ql(e,t){return js(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Gl(e,t){return js(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function dt(e){return be(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function Kl(e){return Jn(e)}function En(e){return be(e)&&s.HasPropertyKey(e,"~immutable")}function mr(e,t={}){return T("AddReadonly",[e],t)}function Sn(e,t={}){return zo(e,t)}function Bl(e){return Sn(e)}function $n(e){return be(e)&&s.HasPropertyKey(e,"~readonly")}function IP(e,t){let r=Qo(e)?[...e["~refine"],t]:[t];return l.Update(e,{"~refine":r},{})}function Hl(...e){let[t,r,n]=G.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[o,i,()=>"Refine Error"]});return IP(t,{check:r,error:n})}function hP(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function Qo(e){return be(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>hP(t))}var zl="-?(?:0|[1-9][0-9]*)n";function Yo(e){return l.Create({"~kind":"BigInt"},{type:"bigint"},e)}function kt(e){return k(e,"BigInt")}function Us(e){return l.Create({"~kind":"Boolean"},{type:"boolean"},e)}function lt(e){return k(e,"Boolean")}function Zo(e){return l.Create({"~kind":"Identifier"},{name:e})}function Wl(e){return k(e,"Identifier")}var qs="-?(?:0|[1-9][0-9]*)";function kn(e){return l.Create({"~kind":"Integer"},{type:"integer"},e)}function Ke(e){return k(e,"Integer")}var Eu=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function yP(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new Eu(e)})()}function U(e,t){return l.Create({"~kind":"Literal"},{type:yP(e),const:e},t)}function Gs(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function Vl(e){return B(e)&&s.IsBigInt(e.const)}function Jl(e){return B(e)&&s.IsBoolean(e.const)}function Ks(e){return B(e)&&s.IsNumber(e.const)}function Bs(e){return B(e)&&s.IsString(e.const)}function B(e){return k(e,"Literal")}function Xn(e){return l.Create({"~kind":"Null"},{type:"null"},e)}function ur(e){return k(e,"Null")}var Hs="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Tt(e){return l.Create({"~kind":"Number"},{type:"number"},e)}function ge(e){return k(e,"Number")}function Qn(e){return l.Create({"~kind":"Symbol"},{type:"symbol"},e)}function cr(e){return k(e,"Symbol")}function Tn(...e){let[t,r,n]=G.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[o,i,i],1:o=>[o,_e(),_e()]});return l.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function Xl(e){return k(e,"Parameter")}var zs=".*";function gt(e){return l.Create({"~kind":"String"},{type:"string"},e)}function De(e){return k(e,"String")}function v(e,t={}){return l.Create({"~kind":"Union"},{anyOf:e},t)}function S(e){return k(e,"Union")}function Ql(e){return l.Discard(e,["~kind","anyOf"])}function ei(e){let t=Yl(e);return s.IsEqual(t.length,2)?t[0]:[]}function bP(e){return!0}function Zl(e){return s.ShiftLeft(e,(t,r)=>EP(t)?Zl(r):!1,()=>!0)}function eg(e){return s.IsEqual(e.length,0)?!1:Zl(e)}function EP(e){return S(e)?eg(e.anyOf):B(e)?bP(e.const):!1}function Ws(e){return eg(e)}function Vs(e){return l.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function tg(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>tg(o,t,[...r,`${n}${t}`]),()=>r)}function SP(e,t){return s.IsEqual(e.length,0)?[`${t}`]:tg(e,t)}function rg(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>rg(e,o,[...r,...ng(e,n)]),()=>r)}function ng(e,t){return S(t)?rg(e,t.anyOf):B(t)?SP(e,t.const):$e()}function og(e,t){return s.ShiftLeft(t,(r,n)=>og(ng(e,r),n),()=>e)}function $P(e){return e.map(t=>U(t))}function kP(e){let t=og([],e),r=$P(t);return v(r)}function TP(e){return s.IsEqual(e.length,0)?$e():s.IsEqual(e.length,1)&&B(e[0])?e[0]:kP(e)}function Su(e){let t=ei(e);return s.IsEqual(t.length,0)?gt():Ws(t)?TP(t):Vs(e)}function Yn(e){let t=Su(e);return se(t)?gt():t}function bt(e,t){let r="object",n={[e]:t};return l.Create({"~kind":"Record"},{type:r,patternProperties:n})}function ig(e){return bt(Jt,e)}function sg(e){return P({true:e,false:e})}function Ce(e,t={}){let[r,n,o]=[e,e.length,!1];return l.Create({"~kind":"Tuple"},{type:"array",additionalItems:o,items:r,minItems:n},t)}function j(e){return k(e,"Tuple")}function ag(e){return l.Discard(e,["~kind","type","items","minItems","additionalItems"])}function wP(e){return l.Discard(e,["~readonly"])}function $u(e,t){return l.Update(wP(e),{},t)}function mg(e,t,r,n){let o=E(e,t,r);return $u(o,n)}function ug(e,t={}){return T("RemoveReadonly",[e],t)}function cg(e,t={}){return $u(e,t)}function RP(e){return l.Discard(e,["~optional"])}function ku(e,t){return l.Update(RP(e),{},t)}function pg(e,t,r,n){let o=E(e,t,r);return ku(o,n)}function fg(e,t={}){return T("RemoveOptional",[e],t)}function Js(e,t={}){return ku(e,t)}function Tu(e){return e.reduceRight((r,n,o)=>({[o]:n,...r}),{})}function dg(e){let t=Tu(e.items);return P(t)}function wu(e){return A(e)||j(e)}function CP(e,t){return $n(e)?!!$n(t):!1}function PP(e,t){return qe(e)?!!qe(t):!1}function AP(e,t){let r=CP(e,t),n=PP(e,t),o=xe([e,t]),i=cg(Js(o));return r&&n?Sn(yn(i)):r&&!n?Sn(i):!r&&n?yn(i):i}function OP(e,t,r){return r in e?r in t?AP(e[r],t[r]):e[r]:r in t?t[r]:re()}function MP(e,t){return[...new Set([...s.Keys(e),...s.Keys(t)])].reduce((o,i)=>({...o,[i]:OP(e,t,i)}),{})}function lg(e){return A(e)?e.properties:j(e)?Tu(e.items):{}}function gg(e,t){let r=lg(e),n=lg(t),o=MP(r,n);return P(o)}function FP(e,t){let r=Zn(e,t);return s.IsEqual(r,ri)?e:s.IsEqual(r,ni)||s.IsEqual(r,ti)?t:re()}function vP(e,t){let r=wu(e),n=wu(t);return r&&n?gg(e,t):r&&!n?e:!r&&n?t:FP(e,t)}function xg(e,t){return yt(e)||Ee(e)?e:Fe(e)||yt(t)||Ee(t)?t:Fe(t)?e:vP(e,t)}function LP(e,t){return S(e)||S(t)}function _P(e,t){let r=qt(e),n=qt(t);return LP(r,n)?xe([r,n]):xg(r,n)}function Ig(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>Ig(e,o,[...r,_P(n,e)]),()=>s.IsEqual(r.length,0)?[e]:r)}function hg(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>hg(o,t,[...r,...oi([n],t)]),()=>r)}function oi(e,t=[]){return s.ShiftLeft(e,(r,n)=>S(r)?oi(n,hg(r.anyOf,t)):oi(n,Ig(r,t)),()=>t)}function DP(e,t){let r=tt({},e,t);return M.IsExtendsTrueLike(r)?[]:[e]}function yg(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>yg(o,t,[...r,...DP(n,t)]),()=>r)}function Xs(e,t){let r=qt(e),n=S(r)?r.anyOf:[r],o=yg(n,t);return Et(o)}function Xt(e,t,r){let n=xe([e,t]),o=Xs(r,e);return Et([n,o])}function xt(e,t=[]){return s.ShiftLeft(e,(r,n)=>xt(n,[...t,U(r)]),()=>Et(t))}function xe(e){let t=oi(e),r=Ru(t);return Et(r)}function it(e){let t=Yn(e);return qt(t)}function Et(e){let t=Ru(e);return Br(t)}function qt(e){return we(e)?Xt(e.if,e.then,e.else):Re(e)?xt(e.enum):C(e)?xe(e.allOf):se(e)?it(e.pattern):S(e)?Et(e.anyOf):e}function Br(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?re():v(e)}function bg(e,t){let r=xt(e);return Hr(r,t)}function Eg(e,t){return bt(zr,t)}function Sg(e,t){let r=xe(e);return Hr(r,t)}function $g(e,t){return s.IsString(e)||s.IsNumber(e)?P({[e]:t}):s.IsEqual(e,!1)?P({false:t}):s.IsEqual(e,!0)?P({true:t}):P({})}function kg(e,t){return bt(eo,t)}function Tg(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?bt(e.pattern.toString(),t):bt(Jt,t)}function wg(e,t){let r=ei(e);return Ws(r)?Hr(it(e),t):bt(e,t)}function NP(e){return S(e)?Wr(e.anyOf):[e]}function Wr(e,t=[]){return s.ShiftLeft(e,(r,n)=>Wr(n,[...t,...NP(r)]),()=>t)}function jP(e){return e.some(t=>De(t)||ge(t)||Ke(t))}function UP(e,t){return s.IsEqual(jP(e),!0)?bt(Jt,t):void 0}function qP(e,t){return e.reduce((r,n)=>B(n)&&(s.IsString(n.const)||s.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function GP(e,t){let r=qP(e,t);return P(r)}function Rg(e,t){let r=Wr(e),n=UP(r,t);return be(n)?n:GP(r,t)}function Hr(e,t){return Ee(e)?ig(t):lt(e)?sg(t):Re(e)?bg(e.enum,t):Ke(e)?Eg(e,t):C(e)?Sg(e.allOf,t):B(e)?$g(e.const,t):ge(e)?kg(e,t):S(e)?Rg(e.anyOf,t):De(e)?Tg(e,t):se(e)?wg(e.pattern,t):P({})}function Cu(e,t,r){return N([e])?l.Update(Hr(e,t),{},r):Qs(e,t,r)}function Cg(e,t,r,n,o){let i=E(e,t,r),a=E(e,t,n);return Cu(i,a,o)}var zr=`^${qs}$`,eo=`^${Hs}$`,Jt=`^${zs}$`;function Qs(e,t,r={}){return T("Record",[e,t],r)}function to(e,t,r={}){return Cu(e,t,r)}function Pg(e,t){return bt(e,t)}function Ys(e){return s.IsEqual(e,Jt)?gt():s.IsEqual(e,zr)?kn():s.IsEqual(e,eo)?Tt():Su(e)}function Ge(e){return s.Keys(e.patternProperties)[0]}function Vr(e){let t=Ge(e);return Ys(t)}function me(e){return e.patternProperties[Ge(e)]}function te(e){return k(e,"Record")}function wn(e){return l.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function Jr(e){return k(e,"Rest")}function Zs(e){return l.Create({"~kind":"This"},{$ref:"#"},e)}function ea(e){return k(e,"This")}function ro(e){return l.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Gt(e){return k(e,"Undefined")}function ta(e){return l.Create({"~kind":"Void"},{type:"void"},e)}function wt(e){return k(e,"Void")}function BP(e,t){return s.IsEqual(e,"Array")?ht(t[0]):s.IsEqual(e,"Capitalize")?na(t[0]):s.IsEqual(e,"ConstructorParameters")?ma(t[0]):s.IsEqual(e,"Evaluate")?AI(t[0]):s.IsEqual(e,"Exclude")?ua(t[0],t[1]):s.IsEqual(e,"Extract")?ca(t[0],t[1]):s.IsEqual(e,"Index")?mi(t[0],t[1]):s.IsEqual(e,"InstanceType")?pa(t[0]):s.IsEqual(e,"Lowercase")?oa(t[0]):s.IsEqual(e,"NonNullable")?fa(t[0]):s.IsEqual(e,"Omit")?da(t[0],t[1]):s.IsEqual(e,"Parameters")?la(t[0]):s.IsEqual(e,"Partial")?ga(t[0]):s.IsEqual(e,"Pick")?xa(t[0],t[1]):s.IsEqual(e,"Readonly")?Ia(t[0]):s.IsEqual(e,"KeyOf")?ui(t[0]):s.IsEqual(e,"Record")?Qs(t[0],t[1]):s.IsEqual(e,"Required")?ha(t[0]):s.IsEqual(e,"ReturnType")?ya(t[0]):s.IsEqual(e,"Uncapitalize")?ia(t[0]):s.IsEqual(e,"Uppercase")?sa(t[0]):ai(Ue(e),t)}function Rn(){throw Error("Unreachable")}function vg(e,t=[]){return s.ShiftLeft(e,(r,n)=>vg(n,[...t,r[1]]),()=>t)}function kr(e){return s.IsEqual(e.length,3)?[e[0],...vg(e[1])]:[]}function Lg(e){return Tn(e[0],e[2],e[4])}function _g(e){return Tn(e[0],e[2],e[2])}function Dg(e){return Tn(e[0],_e(),e[2])}function Ng(e){return Tn(e,_e(),_e())}function jg(e){return kr(e)}function Ug(e){return e[1]}function qg(e){return kr(e)}function Gg(e){return e[1]}function Kg(e){return BP(e[0],e[1])}function Bg(e){return null}function Hg(e){return gt()}function zg(e){return Tt()}function Wg(e){return Us()}function Vg(e){return ro()}function Jg(e){return Xn()}function Xg(e){return kn()}function Qg(e){return Yo()}function Yg(e){return _e()}function Zg(e){return Vn()}function ex(e){return P({})}function tx(e){return re()}function rx(e){return Qn()}function nx(e){return ta()}function ox(e){return Zs()}function ix(e){return U(BigInt(e))}function sx(e){return U(s.IsEqual(e,"true"))}function ax(e){return U(parseFloat(e))}function mx(e){return U(e)}function ux(e){return e[1]}function cx(e){return U(e)}function px(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function fx(e){return e[1]}function dx(e){return ra(e)}function lx(e){return s.IsEqual(e.length,6)?bn(e[1],e[3],e[5]):bn(e[1],e[3],_e())}function gx(e){return e.length>0}function xx(e){return e.reduce((t,r)=>s.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function Ix(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function hx(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function yx(e){return s.IsEqual(e.length,2)?e[1]:[]}function Ag(e,t){return t.reduce((r,n)=>{let o=n;return s.IsEqual(o.length,1)?mi(r,o[0]):s.IsEqual(o.length,0)?ht(r):Rn()},e)}function Og(e,t){return s.IsEqual(t.length,3)?aa(e,t[0],t[1],t[2]):e}function HP(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:ba(e,t)}function bx(e){let[t,r,n,o,i]=e;return HP(Og(t?ui(Ag(r,n)):Ag(r,n),o),i)}function Pu(e,t){return s.IsEqual(t.length,3)?(()=>{let[r,n,o]=t,i=Pu(n,o);if(s.IsEqual(r,"&"))return C(i)?ot([e,...i.allOf]):ot([e,i]);if(s.IsEqual(r,"|"))return S(i)?v([e,...i.anyOf]):v([e,i]);Rn()})():e}function Ex(e){let[t,r]=e;return Pu(t,r)}function Sx(e){let[t,r]=e;return Pu(t,r)}function $x(e){return PI(e[1])}function kx(e){return e[1]}function Tx(e){return Kr(e[0],e[2])}function wx(e){return s.IsEqual(e.length,4)?Vo(e[1],e[3]):s.IsEqual(e.length,2)?Vo(e[1],_e()):Rn()}function Rx(e){return`${e}`}function Cx(e){return Ke(e[3])?zr:ge(e[3])?eo:cr(e[3])?Jt:De(e[3])?Jt:Rn()}function Px(e){return e.length>0}function Ax(e){return e.length>0}function Ox(e){let[t,r,n,o,i]=e;return{[r]:t&&n?mr(sr(i)):t&&!n?mr(i):!t&&n?sr(i):i}}function Mx(e){return kr(e)}function Fx(e){return e.reduce((t,r)=>s.HasPropertyKey(r,zr)||s.HasPropertyKey(r,eo)||s.HasPropertyKey(r,Jt)?[t[0],l.Assign(t[1],r)]:[l.Assign(t[0],r),t[1]],[{},{}])}function vx(e){return Fx(e[1])}function Lx(e){let[t,r]=e,n=s.IsEqual(s.Keys(r).length,0)?{}:{patternProperties:r};return P(t,n)}function _x(e){return s.IsEqual(e.length,5)?mr(sr(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?mr(e[3]):sr(e[3]):Rn()}function Dx(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[t,r,n]=e;return t&&n?mr(sr(r)):t&&!n?mr(r):!t&&n?sr(r):r}function Nx(e){return s.IsEqual(e.length,2)?wn(e[1]):s.IsEqual(e.length,1)?e[0]:Rn()}function jx(e){return kr(e)}function Ux(e){return Ce(e[1])}function qx(e){return mr(sr(e[4]))}function Gx(e){return mr(e[3])}function Kx(e){return sr(e[3])}function Bx(e){return e[2]}function Hx(e){return s.IsEqual(e.length,2)?wn(e[1]):s.IsEqual(e.length,1)?e[0]:Rn()}function zx(e){return kr(e)}function Wx(e){return ir(e[1],e[4])}function Vx(e){return or(e[2],e[5])}function Mg(e,t){return s.IsEqual(e,"remove")?ug(t):s.IsEqual(e,"add")?mr(t):t}function Jx(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function Fg(e,t){return s.IsEqual(e,"remove")?fg(t):s.IsEqual(e,"add")?sr(t):t}function Xx(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function Qx(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function Yx(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?ii(Zo(e[3]),e[5],e[6][0],Mg(e[1],Fg(e[8],e[10]))):ii(Zo(e[3]),e[5],Ue(e[3]),Mg(e[1],Fg(e[8],e[10])))}function Zx(e){return Ue(e)}function eI(e){return BigInt(e)}function tI(e){return parseFloat(e)}function rI(e){return s.IsEqual(e,"true")}function nI(e){return null}function oI(e){return{[e[0]]:e[2]}}function iI(e){return kr(e)}function zP(e){return e.reduce((t,r)=>l.Assign(t,r),{})}function sI(e){return zP(e[1])}function aI(e){return kr(e)}function mI(e){return e[1]}function uI(e){return Yo()}function cI(e){return gt()}function pI(e){return Tt()}function fI(e){return kn()}function dI(e){return re()}function lI(e){return U(e)}function gI(e){return v(e[1])}function xI(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function II(e){return[e[0],...e[1]]}function hI(e){return e[1]}function yI(e){return kr(e)}function bI(e){return s.IsEqual(e.length,2)?e[1]:[]}function EI(e){let t=e[2],r=e[3],[n,o]=e[4],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Kr(t,si(r,n,i))}}function SI(e){let t=e[2],[r,n]=e[3],o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:si(t,r,o)}}function $I(e){return{[e[1]]:Kr(e[2],e[4])}}function kI(e){return{[e[1]]:e[3]}}function TI(e){return null}function wI(e){return kr(e)}function RI(e){return e[1]}function CI(e){let[t,r]=[e[0],e[1]];return OI(l.Assign(t,Fx(r)[0]))}function ci(e){return J(e.length,2)}function z(e,t,r){return ci(e)?t(e[0],e[1]):r()}function JP(e,t){return J(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Se(e,t){for(let r=0;r<e.length;r++){let n=JP(e[r],t);if(ci(n))return n}return[]}function Au(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var MI=[...Au(97,122),...Au(65,90)],Ou="0",Mu=Au(49,57),no=[Ou,...Mu],FI=" ",oo=`
|
|
2
|
+
`;var Xr="_",Ea=".",vI="$",Sa="-";var LI="//",_I="/*",QP="*/";function DI(e){let t=e.indexOf(QP);return J(t,-1)?"":e.slice(t+2)}function NI(e){let t=e.indexOf(oo);return J(t,-1)?"":e.slice(t)}function YP(e){return e.replace(/^[ \t\r\f\v]+/,"")}function $a(e){let t=YP(e);return t.startsWith(_I)?$a(DI(t.slice(2))):t.startsWith(LI)?$a(NI(t.slice(2))):t}function Xe(e){let t=e.trimStart();return t.startsWith(_I)?Xe(DI(t.slice(2))):t.startsWith(LI)?Xe(NI(t.slice(2))):t}function ka(e,t){return z(Se([e],t),(r,n)=>[r,n],()=>["",t])}function ZP(e,t){return e.includes(t)}function io(e,t,r,n=""){return z(Se(e,r),(o,i)=>ZP(t,o)?io(e,t,i,n):io(e,t,i,`${n}${o}`),()=>[n,r])}function e0(e){return Se(Mu,e)}var t0=[...no,Xr];function r0(e){return io(t0,[Xr],e)}function n0(e){return z(Se([Ou],e),(t,r)=>[t,r],()=>z(e0(e),(t,r)=>z(r0(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[]))}function Ta(e){return n0(Xe(e))}function o0(e){return ka(Sa,e)}function i0(e){return z(o0(e),(t,r)=>z(Ta(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function jI(e){return i0(Xe(e))}function s0(e){return z(jI(e),(t,r)=>z(Se(["n"],r),(n,o)=>[`${t}`,o],()=>[]),()=>[])}function Fu(e){return s0(e)}function vu(e,t){return Se([e],t)}function x(e,t){return J(e,"")?["",t]:e.startsWith(oo)?vu(e,$a(t)):e.startsWith(FI)?vu(e,t):vu(e,Xe(t))}var UI=[...MI,Xr,vI];function a0(e){return Se(UI,e)}var m0=[...UI,...no];function qI(e,t=""){return z(Se(m0,e),(r,n)=>qI(n,`${t}${r}`),()=>[t,e])}function u0(e){return z(a0(e),(t,r)=>z(qI(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function Pe(e){return u0(Xe(e))}var c0=[...no,Xr];function p0(e){return ci(Se([Ea],e))}function GI(e){return z(io(c0,[Xr],e),(t,r)=>J(t,"")?[]:[t,r],()=>[])}function f0(e){return z(Se([Ea],e),(t,r)=>z(GI(r),(n,o)=>[`0${t}${n}`,o],()=>[]),()=>[])}function d0(e){return z(Ta(e),(t,r)=>z(Se([Ea],r),(n,o)=>z(GI(o),(i,a)=>[`${t}${n}${i}`,a],()=>[`${t}`,o]),()=>[`${t}`,r]),()=>[])}function l0(e){return p0(e)?f0(e):d0(e)}function KI(e){return l0(Xe(e))}function g0(e){return ka(Sa,e)}function x0(e){return z(g0(e),(t,r)=>z(KI(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function wa(e){return x0(Xe(e))}function I0(e){return J(e,"")?[]:[e.slice(0,1),e.slice(1)]}function BI(e,t){return qi(e,(r,n)=>t.startsWith(r)?!0:BI(n,t),()=>!1)}function Qr(e,t,r=""){return z(I0(t),(n,o)=>BI(e,t)?[r,t]:Qr(e,o,`${r}${n}`),()=>[])}function h0(e,t,r){return z(Se([e],r),(n,o)=>z(Qr([t],o),(i,a)=>z(Se([t],a),(m,c)=>[`${i}`,c],()=>[]),()=>[]),()=>[])}function y0(e,t,r){return z(Se([e],r),(n,o)=>z(Qr([oo,t],o),(i,a)=>z(Se([t],a),(m,c)=>[`${i}`,c],()=>[]),()=>[]),()=>[])}function HI(e,t,r,n){return r?h0(e,t,Xe(n)):y0(e,t,Xe(n))}function b0(e,t){return Se(e,t)}function E0(e,t){return HI(e,e,!1,t)}function S0(e,t){return z(b0(e,t),(r,n)=>E0(r,`${r}${n}`),()=>[])}function Ra(e,t){return S0(e,Xe(t))}function zI(e,t){return z(Qr(e,t),(r,n)=>J(r,"")?[]:[r,n],()=>[])}var u=(e,t,r=()=>[])=>e.length===2?t(e):r(),k0=e=>u(u(Pe(e),([t,r])=>u(x("extends",r),([n,o])=>u(Q(o),([i,a])=>u(x("=",a),([m,c])=>u(Q(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[Lg(t),r]),T0=e=>u(u(Pe(e),([t,r])=>u(x("extends",r),([n,o])=>u(Q(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[_g(t),r]),w0=e=>u(u(Pe(e),([t,r])=>u(x("=",r),([n,o])=>u(Q(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Dg(t),r]),R0=e=>u(Pe(e),([t,r])=>[Ng(t),r]),JI=e=>u(u(k0(e),([t,r])=>[t,r],()=>u(T0(e),([t,r])=>[t,r],()=>u(w0(e),([t,r])=>[t,r],()=>u(R0(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),XI=(e,t=[])=>u(u(x(",",e),([r,n])=>u(JI(n),([o,i])=>[[r,o],i])),([r,n])=>XI(n,[...t,r]),()=>[t,e]),C0=e=>u(u(u(JI(e),([t,r])=>u(XI(r),([n,o])=>u(u(x(",",o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[jg(t),r]),Du=e=>u(u(x("<",e),([t,r])=>u(C0(r),([n,o])=>u(x(">",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Ug(t),r]),QI=(e,t=[])=>u(u(x(",",e),([r,n])=>u(Q(n),([o,i])=>[[r,o],i])),([r,n])=>QI(n,[...t,r]),()=>[t,e]),P0=e=>u(u(u(Q(e),([t,r])=>u(QI(r),([n,o])=>u(u(x(",",o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[qg(t),r]),A0=e=>u(u(x("<",e),([t,r])=>u(P0(r),([n,o])=>u(x(">",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Gg(t),r]),O0=e=>u(u(Pe(e),([t,r])=>u(A0(r),([n,o])=>[[t,n],o])),([t,r])=>[Kg(t),r]),YI=e=>u(u(u(x(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Bg(t),r]),ZI=e=>u(x("string",e),([t,r])=>[Hg(t),r]),eh=e=>u(x("number",e),([t,r])=>[zg(t),r]),M0=e=>u(x("boolean",e),([t,r])=>[Wg(t),r]),F0=e=>u(x("undefined",e),([t,r])=>[Vg(t),r]),v0=e=>u(x("null",e),([t,r])=>[Jg(t),r]),th=e=>u(x("integer",e),([t,r])=>[Xg(t),r]),L0=e=>u(x("bigint",e),([t,r])=>[Qg(t),r]),_0=e=>u(x("unknown",e),([t,r])=>[Yg(t),r]),D0=e=>u(x("any",e),([t,r])=>[Zg(t),r]),N0=e=>u(x("object",e),([t,r])=>[ex(t),r]),j0=e=>u(x("never",e),([t,r])=>[tx(t),r]),rh=e=>u(x("symbol",e),([t,r])=>[rx(t),r]),U0=e=>u(x("void",e),([t,r])=>[nx(t),r]),q0=e=>u(x("this",e),([t,r])=>[ox(t),r]),G0=e=>u(u(x("${",e),([t,r])=>u(Q(r),([n,o])=>u(x("}",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[ux(t),r]),Lu=e=>u(Qr(["${","`"],e),([t,r])=>[cx(t),r]),nh=e=>u(u(u(Lu(e),([t,r])=>u(G0(r),([n,o])=>u(nh(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u(u(Lu(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u(u(Lu(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[px(t),r]),Nu=e=>u(u(x("`",e),([t,r])=>u(nh(r),([n,o])=>u(x("`",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[fx(t),r]),K0=e=>u(Nu(e),([t,r])=>[dx(t),r]),B0=e=>u(u(u(x("if",e),([t,r])=>u(Q(r),([n,o])=>u(x("then",o),([i,a])=>u(Q(a),([m,c])=>u(x("else",c),([p,f])=>u(Q(f),([d,g])=>[[t,n,i,m,p,d],g])))))),([t,r])=>[t,r],()=>u(u(x("if",e),([t,r])=>u(Q(r),([n,o])=>u(x("then",o),([i,a])=>u(Q(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[t,r],()=>[])),([t,r])=>[lx(t),r]),H0=e=>u(Fu(e),([t,r])=>[ix(t),r]),z0=e=>u(u(x("true",e),([t,r])=>[t,r],()=>u(x("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[sx(t),r]),W0=e=>u(wa(e),([t,r])=>[ax(t),r]),V0=e=>u(Ra(["'",'"'],e),([t,r])=>[mx(t),r]),J0=e=>u(u(u(x("keyof",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[gx(t),r]),oh=(e,t=[])=>u(u(u(x("[",e),([r,n])=>u(Q(n),([o,i])=>u(x("]",i),([a,m])=>[[r,o,a],m]))),([r,n])=>[r,n],()=>u(u(x("[",e),([r,n])=>u(x("]",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>[])),([r,n])=>oh(n,[...t,r]),()=>[t,e]),X0=e=>u(oh(e),([t,r])=>[xx(t),r]),Q0=e=>u(u(u(x("extends",e),([t,r])=>u(Q(r),([n,o])=>u(x("?",o),([i,a])=>u(Q(a),([m,c])=>u(x(":",c),([p,f])=>u(Q(f),([d,g])=>[[t,n,i,m,p,d],g])))))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Ix(t),r]),Y0=e=>u(u(u(x("(",e),([t,r])=>u(Q(r),([n,o])=>u(x(")",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u(ZI(e),([t,r])=>[t,r],()=>u(eh(e),([t,r])=>[t,r],()=>u(M0(e),([t,r])=>[t,r],()=>u(F0(e),([t,r])=>[t,r],()=>u(v0(e),([t,r])=>[t,r],()=>u(th(e),([t,r])=>[t,r],()=>u(L0(e),([t,r])=>[t,r],()=>u(_0(e),([t,r])=>[t,r],()=>u(D0(e),([t,r])=>[t,r],()=>u(N0(e),([t,r])=>[t,r],()=>u(j0(e),([t,r])=>[t,r],()=>u(rh(e),([t,r])=>[t,r],()=>u(U0(e),([t,r])=>[t,r],()=>u(q0(e),([t,r])=>[t,r],()=>u(H0(e),([t,r])=>[t,r],()=>u(z0(e),([t,r])=>[t,r],()=>u(W0(e),([t,r])=>[t,r],()=>u(V0(e),([t,r])=>[t,r],()=>u(K0(e),([t,r])=>[t,r],()=>u(B0(e),([t,r])=>[t,r],()=>u(uA(e),([t,r])=>[t,r],()=>u(fA(e),([t,r])=>[t,r],()=>u(hA(e),([t,r])=>[t,r],()=>u(IA(e),([t,r])=>[t,r],()=>u(SA(e),([t,r])=>[t,r],()=>u(O0(e),([t,r])=>[t,r],()=>u($A(e),([t,r])=>[t,r],()=>[])))))))))))))))))))))))))))),([t,r])=>[hx(t),r]),Z0=e=>u(u(u(x("with",e),([t,r])=>u(Eh(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[yx(t),r]),ih=e=>u(u(J0(e),([t,r])=>u(Y0(r),([n,o])=>u(X0(o),([i,a])=>u(Q0(a),([m,c])=>u(Z0(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[bx(t),r]),sh=e=>u(u(u(x("&",e),([t,r])=>u(ih(r),([n,o])=>u(sh(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),ah=e=>u(u(ih(e),([t,r])=>u(sh(r),([n,o])=>[[t,n],o])),([t,r])=>[Ex(t),r]),mh=e=>u(u(u(x("|",e),([t,r])=>u(ah(r),([n,o])=>u(mh(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Ca=e=>u(u(ah(e),([t,r])=>u(mh(r),([n,o])=>[[t,n],o])),([t,r])=>[Sx(t),r]),eA=e=>u(u(x("readonly",e),([t,r])=>u(Ca(r),([n,o])=>[[t,n],o])),([t,r])=>[$x(t),r]),tA=e=>u(u(x("|",e),([t,r])=>u(Ca(r),([n,o])=>[[t,n],o])),([t,r])=>[kx(t),r]),rA=e=>u(u(Du(e),([t,r])=>u(x("=",r),([n,o])=>u(Q(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Tx(t),r]),nA=e=>u(u(u(x("infer",e),([t,r])=>u(Pe(r),([n,o])=>u(x("extends",o),([i,a])=>u(Ca(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[t,r],()=>u(u(x("infer",e),([t,r])=>u(Pe(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>[])),([t,r])=>[wx(t),r]),Q=e=>u(u(nA(e),([t,r])=>[t,r],()=>u(tA(e),([t,r])=>[t,r],()=>u(eA(e),([t,r])=>[t,r],()=>u(Ca(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),oA=e=>u(wa(e),([t,r])=>[Rx(t),r]),iA=e=>u(Pe(e),([t,r])=>[t,r]),sA=e=>u(Ra(["'",'"'],e),([t,r])=>[t,r]),aA=e=>u(u(x("[",e),([t,r])=>u(Pe(r),([n,o])=>u(x(":",o),([i,a])=>u(u(th(a),([m,c])=>[m,c],()=>u(eh(a),([m,c])=>[m,c],()=>u(ZI(a),([m,c])=>[m,c],()=>u(rh(a),([m,c])=>[m,c],()=>[])))),([m,c])=>u(x("]",c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[Cx(t),r]),uh=e=>u(u(oA(e),([t,r])=>[t,r],()=>u(iA(e),([t,r])=>[t,r],()=>u(sA(e),([t,r])=>[t,r],()=>u(aA(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),ch=e=>u(u(u(x("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Px(t),r]),ph=e=>u(u(u(x("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Ax(t),r]),fh=e=>u(u(ch(e),([t,r])=>u(uh(r),([n,o])=>u(ph(o),([i,a])=>u(x(":",a),([m,c])=>u(Q(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[Ox(t),r]),Pa=e=>u(u(u(x(",",e),([t,r])=>u(x(`
|
|
3
|
+
`,r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(x(";",e),([t,r])=>u(x(`
|
|
4
|
+
`,r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(x(",",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u(u(x(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u(u(x(`
|
|
5
|
+
`,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),dh=(e,t=[])=>u(u(Pa(e),([r,n])=>u(fh(n),([o,i])=>[[r,o],i])),([r,n])=>dh(n,[...t,r]),()=>[t,e]),mA=e=>u(u(u(fh(e),([t,r])=>u(dh(r),([n,o])=>u(u(Pa(o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Mx(t),r]),ju=e=>u(u(x("{",e),([t,r])=>u(mA(r),([n,o])=>u(x("}",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[vx(t),r]),uA=e=>u(ju(e),([t,r])=>[Lx(t),r]),cA=e=>u(u(u(Pe(e),([t,r])=>u(x("?",r),([n,o])=>u(x(":",o),([i,a])=>u(x("readonly",a),([m,c])=>u(Q(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[t,r],()=>u(u(Pe(e),([t,r])=>u(x(":",r),([n,o])=>u(x("readonly",o),([i,a])=>u(Q(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[t,r],()=>u(u(Pe(e),([t,r])=>u(x("?",r),([n,o])=>u(x(":",o),([i,a])=>u(Q(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[t,r],()=>u(u(Pe(e),([t,r])=>u(x(":",r),([n,o])=>u(Q(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>[])))),([t,r])=>[_x(t),r]),WI=e=>u(u(cA(e),([t,r])=>[t,r],()=>u(u(ch(e),([t,r])=>u(Q(r),([n,o])=>u(ph(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>[])),([t,r])=>[Dx(t),r]),lh=e=>u(u(u(x("...",e),([t,r])=>u(WI(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(WI(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[Nx(t),r]),gh=(e,t=[])=>u(u(x(",",e),([r,n])=>u(lh(n),([o,i])=>[[r,o],i])),([r,n])=>gh(n,[...t,r]),()=>[t,e]),pA=e=>u(u(u(lh(e),([t,r])=>u(gh(r),([n,o])=>u(u(x(",",o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[jx(t),r]),fA=e=>u(u(x("[",e),([t,r])=>u(pA(r),([n,o])=>u(x("]",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Ux(t),r]),dA=e=>u(u(Pe(e),([t,r])=>u(x("?",r),([n,o])=>u(x(":",o),([i,a])=>u(x("readonly",a),([m,c])=>u(Q(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[qx(t),r]),lA=e=>u(u(Pe(e),([t,r])=>u(x(":",r),([n,o])=>u(x("readonly",o),([i,a])=>u(Q(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[Gx(t),r]),gA=e=>u(u(Pe(e),([t,r])=>u(x("?",r),([n,o])=>u(x(":",o),([i,a])=>u(Q(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[Kx(t),r]),xA=e=>u(u(Pe(e),([t,r])=>u(x(":",r),([n,o])=>u(Q(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Bx(t),r]),VI=e=>u(u(dA(e),([t,r])=>[t,r],()=>u(lA(e),([t,r])=>[t,r],()=>u(gA(e),([t,r])=>[t,r],()=>u(xA(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),xh=e=>u(u(u(x("...",e),([t,r])=>u(VI(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(VI(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[Hx(t),r]),Ih=(e,t=[])=>u(u(x(",",e),([r,n])=>u(xh(n),([o,i])=>[[r,o],i])),([r,n])=>Ih(n,[...t,r]),()=>[t,e]),hh=e=>u(u(u(xh(e),([t,r])=>u(Ih(r),([n,o])=>u(u(x(",",o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[zx(t),r]),IA=e=>u(u(x("(",e),([t,r])=>u(hh(r),([n,o])=>u(x(")",o),([i,a])=>u(x("=>",a),([m,c])=>u(Q(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[Wx(t),r]),hA=e=>u(u(x("new",e),([t,r])=>u(x("(",r),([n,o])=>u(hh(o),([i,a])=>u(x(")",a),([m,c])=>u(x("=>",c),([p,f])=>u(Q(f),([d,g])=>[[t,n,i,m,p,d],g])))))),([t,r])=>[Vx(t),r]),yA=e=>u(u(u(x("+",e),([t,r])=>u(x("readonly",r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(x("-",e),([t,r])=>u(x("readonly",r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(x("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[Jx(t),r]),bA=e=>u(u(u(x("+",e),([t,r])=>u(x("?",r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(x("-",e),([t,r])=>u(x("?",r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(x("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[Xx(t),r]),EA=e=>u(u(u(x("as",e),([t,r])=>u(Q(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Qx(t),r]),SA=e=>u(u(x("{",e),([t,r])=>u(yA(r),([n,o])=>u(x("[",o),([i,a])=>u(Pe(a),([m,c])=>u(x("in",c),([p,f])=>u(Q(f),([d,g])=>u(EA(g),([I,h])=>u(x("]",h),([y,b])=>u(bA(b),([R,L])=>u(x(":",L),([q,ut])=>u(Q(ut),([Ze,he])=>u(YI(he),([V,Fr])=>u(x("}",Fr),([rt,Ir])=>[[t,n,i,m,p,d,I,y,R,q,Ze,V,rt],Ir]))))))))))))),([t,r])=>[Yx(t),r]),$A=e=>u(Pe(e),([t,r])=>[Zx(t),r]),kA=e=>u(Fu(e),([t,r])=>[eI(t),r]),TA=e=>u(wa(e),([t,r])=>[tI(t),r]),wA=e=>u(u(x("true",e),([t,r])=>[t,r],()=>u(x("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[rI(t),r]),RA=e=>u(Ra(['"',"'"],e),([t,r])=>[t,r]),CA=e=>u(x("null",e),([t,r])=>[nI(t),r]),PA=e=>u(x("undefined",e),([t,r])=>[void 0,r]),yh=e=>u(u(uh(e),([t,r])=>u(x(":",r),([n,o])=>u(Uu(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[oI(t),r]),bh=(e,t=[])=>u(u(Pa(e),([r,n])=>u(yh(n),([o,i])=>[[r,o],i])),([r,n])=>bh(n,[...t,r]),()=>[t,e]),AA=e=>u(u(u(yh(e),([t,r])=>u(bh(r),([n,o])=>u(u(Pa(o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[iI(t),r]),Eh=e=>u(u(x("{",e),([t,r])=>u(AA(r),([n,o])=>u(x("}",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[sI(t),r]),Sh=(e,t=[])=>u(u(x(",",e),([r,n])=>u(Uu(n),([o,i])=>[[r,o],i])),([r,n])=>Sh(n,[...t,r]),()=>[t,e]),OA=e=>u(u(u(Uu(e),([t,r])=>u(Sh(r),([n,o])=>u(u(x(",",o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[aI(t),r]),MA=e=>u(u(x("[",e),([t,r])=>u(OA(r),([n,o])=>u(x("]",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[mI(t),r]),Uu=e=>u(u(kA(e),([t,r])=>[t,r],()=>u(TA(e),([t,r])=>[t,r],()=>u(wA(e),([t,r])=>[t,r],()=>u(RA(e),([t,r])=>[t,r],()=>u(CA(e),([t,r])=>[t,r],()=>u(PA(e),([t,r])=>[t,r],()=>u(Eh(e),([t,r])=>[t,r],()=>u(MA(e),([t,r])=>[t,r],()=>[])))))))),([t,r])=>[t,r]),FA=e=>u(x("-?(?:0|[1-9][0-9]*)n",e),([t,r])=>[uI(t),r]),vA=e=>u(x(".*",e),([t,r])=>[cI(t),r]),LA=e=>u(x("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,r])=>[pI(t),r]),_A=e=>u(x("-?(?:0|[1-9][0-9]*)",e),([t,r])=>[fI(t),r]),DA=e=>u(x("(?!)",e),([t,r])=>[dI(t),r]),NA=e=>u(zI(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,r])=>[lI(t),r]),jA=e=>u(u(FA(e),([t,r])=>[t,r],()=>u(vA(e),([t,r])=>[t,r],()=>u(LA(e),([t,r])=>[t,r],()=>u(_A(e),([t,r])=>[t,r],()=>u(DA(e),([t,r])=>[t,r],()=>u(UA(e),([t,r])=>[t,r],()=>u(NA(e),([t,r])=>[t,r],()=>[]))))))),([t,r])=>[t,r]),UA=e=>u(u(x("(",e),([t,r])=>u(qu(r),([n,o])=>u(x(")",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[gI(t),r]),$h=e=>u(u(u(_u(e),([t,r])=>u(x("|",r),([n,o])=>u($h(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u(u(_u(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[]))),([t,r])=>[xI(t),r]),_u=e=>u(u(jA(e),([t,r])=>u(qu(r),([n,o])=>[[t,n],o])),([t,r])=>[II(t),r]),qu=e=>u(u($h(e),([t,r])=>[t,r],()=>u(_u(e),([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Yl=e=>u(u(x("^",e),([t,r])=>u(qu(r),([n,o])=>u(x("$",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[hI(t),r]),kh=(e,t=[])=>u(u(x(",",e),([r,n])=>u(Q(n),([o,i])=>[[r,o],i])),([r,n])=>kh(n,[...t,r]),()=>[t,e]),qA=e=>u(u(u(Q(e),([t,r])=>u(kh(r),([n,o])=>u(u(x(",",o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[yI(t),r]),Th=e=>u(u(u(x("extends",e),([t,r])=>u(qA(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[bI(t),r]),GA=e=>u(u(x("interface",e),([t,r])=>u(Pe(r),([n,o])=>u(Du(o),([i,a])=>u(Th(a),([m,c])=>u(ju(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[EI(t),r]),KA=e=>u(u(x("interface",e),([t,r])=>u(Pe(r),([n,o])=>u(Th(o),([i,a])=>u(ju(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[SI(t),r]),BA=e=>u(u(x("type",e),([t,r])=>u(Pe(r),([n,o])=>u(Du(o),([i,a])=>u(x("=",a),([m,c])=>u(Q(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[$I(t),r]),HA=e=>u(u(x("type",e),([t,r])=>u(Pe(r),([n,o])=>u(x("=",o),([i,a])=>u(Q(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[kI(t),r]),zA=e=>u(u(u(x("export",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[TI(t),r]),wh=e=>u(u(u(x(";",e),([t,r])=>u(x(`
|
|
6
|
+
`,r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(x(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u(u(x(`
|
|
7
|
+
`,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]),Rh=(e,t=[])=>u(u(wh(e),([r,n])=>u(Gu(n),([o,i])=>[[r,o],i])),([r,n])=>Rh(n,[...t,r]),()=>[t,e]),WA=e=>u(u(u(Gu(e),([t,r])=>u(Rh(r),([n,o])=>u(u(wh(o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[wI(t),r]),Gu=e=>u(u(zA(e),([t,r])=>u(u(GA(r),([n,o])=>[n,o],()=>u(KA(r),([n,o])=>[n,o],()=>u(BA(r),([n,o])=>[n,o],()=>u(HA(r),([n,o])=>[n,o],()=>[])))),([n,o])=>u(YI(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[RI(t),r]),VA=e=>u(u(Gu(e),([t,r])=>u(WA(r),([n,o])=>[[t,n],o])),([t,r])=>[CI(t),r]),Ch=e=>u(u(VA(e),([t,r])=>[t,r],()=>u(rA(e),([t,r])=>[t,r],()=>u(Q(e),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]);function Ph(e){let t=Nu(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:$e()}function XA(e){return e.join("|")}function QA(e){return e.slice(1,e.length-1)}function YA(e,t,r){return Yr(t,`${r}${e}`)}function ZA(e,t){return Yr(e,`${t}${zl}`)}function eO(e,t){return Yr(e,`${t}${qs}`)}function tO(e,t){return Yr(e,`${t}${Hs}`)}function rO(e,t){return pi(v([U("false"),U("true")]),e,t)}function nO(e,t){return Yr(e,`${t}${zs}`)}function oO(e,t,r){return Yr(t,`${r}${QA(e)}`)}function iO(e,t,r){let n=fi(e,{});return pi(n,t,r)}function sO(e,t,r){let n=xt(e);return pi(n,t,r)}function Ah(e,t,r,n=[]){return s.ShiftLeft(e,(o,i)=>Ah(i,t,r,[...n,pi(o,[],"")]),()=>Yr(t,`${r}(${XA(n)})`))}function pi(e,t,r){return Re(e)?sO(e.enum,t,r):Ke(e)?eO(t,r):B(e)?YA(e.const,t,r):kt(e)?ZA(t,r):lt(e)?rO(t,r):ge(e)?tO(t,r):De(e)?nO(t,r):se(e)?oO(e.pattern,t,r):Mh(e)?iO(e.parameters[0],t,r):S(e)?Ah(e.anyOf,t,r):Al}function Yr(e,t){return s.ShiftLeft(e,(r,n)=>pi(r,n,t),()=>t)}function aO(e){return`^${Yr(e,"")}$`}function Oh(e){let t=aO(e);return Vs(t)}function fi(e,t){return N(e)?l.Update(Oh(e),{},t):ra(e,t)}function Fh(e,t,r,n){let o=vt(e,t,r);return fi(o,n)}function ra(e,t={}){return T("TemplateLiteral",[e],t)}function Mh(e){return be(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function vh(e){return fi(e,{})}function mO(e){let t=Ph(e);return vh(t)}function Lh(e,t={}){let r=s.IsString(e)?mO(e):vh(e);return l.Update(r,{},t)}function se(e){return k(e,"TemplateLiteral")}var M={};At(M,{ExtendsFalse:()=>_,ExtendsTrue:()=>$,ExtendsUnion:()=>Ku,IsExtendsFalse:()=>uO,IsExtendsTrue:()=>Dh,IsExtendsTrueLike:()=>so,IsExtendsUnion:()=>_h,Match:()=>de});function Ku(e){return l.Create({"~kind":"ExtendsUnion"},{inferred:e})}function _h(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function $(e){return l.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Dh(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function _(){return l.Create({"~kind":"ExtendsFalse"},{})}function uO(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function so(e){return _h(e)||Dh(e)}function de(e,t,r){return so(e)?t(e.inferred):r()}function cO(e,t,r,n){return de(W(e,r,n),o=>$(l.Assign(l.Assign(e,o),{[t]:r})),()=>_())}function pO(e,t){return $(e)}function fO(e,t,r,n,o){return de(W(e,t,r),i=>de(W(i,t,n),a=>$(a),()=>_()),()=>de(W(e,t,o),i=>$(i),()=>_()))}function dO(e,t,r){let n=xt(r);return W(e,t,n)}function Nh(e,t,r){return s.ShiftLeft(r,(n,o)=>de(W(e,t,n),i=>Nh(i,t,o),()=>_()),()=>$(e))}function lO(e,t,r){let n=it(r);return W(e,t,n)}function jh(e,t,r){return s.ShiftLeft(r,(n,o)=>de(W(e,t,n),i=>$(i),()=>jh(e,t,o)),()=>_())}function ee(e,t,r){return Ee(r)?pO(e,t):we(r)?fO(e,t,r.if,r.then,r.else):Re(r)?dO(e,t,r.enum):ve(r)?cO(e,r.name,t,r.extends):C(r)?Nh(e,t,r.allOf):se(r)?lO(e,t,r.pattern):S(r)?jh(e,t,r.anyOf):Fe(r)?$(e):_()}function Uh(e,t,r){return ve(r)?ee(e,t,r):Ee(r)?$(e):Fe(r)?$(e):Ku(e)}function gO(e,t){let r=En(e),n=En(t);return r&&n||!r&&n?!0:!(r&&!n)}function qh(e,t,r,n){return H(n)?gO(t,n)?W(e,r,n.items):_():ee(e,t,n)}function Gh(e,t,r){return kt(r)?$(e):ee(e,t,r)}function Kh(e,t,r){return lt(r)?$(e):ee(e,t,r)}function xO(e,t,r,n,o){let i=ve(n)?t:n,a=ve(n)?n:t,m=qe(t),c=qe(n);return!m&&c?_():de(W(e,i,a),p=>di(p,r,o),()=>_())}function IO(e,t,r,n){return s.ShiftLeft(n,(o,i)=>xO(e,t,r,o,i),()=>qe(t)?$(e):_())}function hO(e,t,r){return s.ShiftLeft(t,(n,o)=>IO(e,n,o,r),()=>$(e))}function di(e,t,r){return hO(e,t,r)}function Aa(e,t,r){return wt(r)?$(e):W(e,t,r)}function Bh(e,t,r,n){return Ee(n)?$(e):Fe(n)?$(e):ke(n)?de(di(e,t,n.parameters),o=>Aa(o,r,n.instanceType),()=>_()):_()}function Hh(e,t,r,n,o){return de(W(e,t,o),()=>W(e,r,o),()=>W(e,n,o))}function zh(e,t,r){let n=xt(t);return W(e,n,r)}function Wh(e,t,r,n){return Ee(n)?$(e):Fe(n)?$(e):Te(n)?de(di(e,t,n.parameters),o=>Aa(o,r,n.returnType),()=>_()):_()}function Vh(e,t,r){return Ke(r)?$(e):ge(r)?$(e):ee(e,t,r)}function Jh(e,t,r){let n=xe(t);return W(e,n,r)}function Oa(e,t,r){return t===r?$(e):_()}function yO(e,t,r){return B(r)?Oa(e,t,r.const):kt(r)?$(e):ee(e,U(t),r)}function bO(e,t,r){return B(r)?Oa(e,t,r.const):lt(r)?$(e):ee(e,U(t),r)}function EO(e,t,r){return B(r)?Oa(e,t,r.const):ge(r)?$(e):ee(e,U(t),r)}function SO(e,t,r){return B(r)?Oa(e,t,r.const):De(r)?$(e):ee(e,U(t),r)}function Xh(e,t,r){return s.IsBigInt(t.const)?yO(e,t.const,r):s.IsBoolean(t.const)?bO(e,t.const,r):s.IsNumber(t.const)?EO(e,t.const,r):s.IsString(t.const)?SO(e,t.const,r):$e()}function Qh(e,t,r){return ve(r)?ee(e,t,r):$(e)}function Yh(e,t,r){return ur(r)?$(e):ee(e,t,r)}function Zh(e,t,r){return ge(r)?$(e):ee(e,t,r)}function $O(e,t,r){return qe(t)?qe(r)?$(e):_():$(e)}function kO(e,t,r){return ve(r)&&yt(r.extends)?_():de(W(e,t,r),n=>$O(n,t,r),()=>_())}function TO(e,t){return e.reduce((r,n)=>n in t?so(t[n])?{...r,...t[n].inferred}:$e():$e(),{})}function wO(e,t,r){let n={};for(let a of s.Keys(r))n[a]=a in t?kO({},t[a],r[a]):qe(r[a])?ve(r[a])?$(l.Assign(e,{[r[a].name]:r[a].extends})):$(e):_();let o=s.Values(n).every(a=>so(a)),i=o?TO(s.Keys(n),n):{};return o?$(i):_()}function RO(e,t,r){let n=wO(e,t,r);return so(n)?$(l.Assign(e,n.inferred)):_()}function CO(e,t,r){return RO(e,t,r)}function PO(e,t){return s.Keys(t).reduce((r,n)=>({...r,[n]:s.HasPropertyKey(e,n)?S(r[n])?v([...r[n].anyOf,t[n]]):v([e[n],t[n]]):t[n]}),e)}function ey(e,t,r,n){return s.ShiftLeft(t,(o,i)=>de(W({},e[o],r),a=>ey(e,i,r,PO(n,a)),()=>_()),()=>$(n))}function AO(e,t,r,n){let o=s.Keys(t);return ey(t,o,n,e)}function ty(e,t,r){return te(r)?AO(e,t,Ge(r),me(r)):A(r)?CO(e,t,r.properties):ee(e,P(t),r)}function OO(e,t){return s.IsEqual(s.Keys(t).length,0)?$(e):_()}function MO(e,t,r,n,o){return W(e,r,o)}function ry(e,t,r,n){return te(n)?MO(e,Ys(t),r,Ys(Ge(n)),me(n)):A(n)?OO(e,n.properties):Ee(n)?$(e):Fe(n)?$(e):_()}function ny(e,t,r){return De(r)?$(e):ee(e,t,r)}function oy(e,t,r){return cr(r)?$(e):ee(e,t,r)}function iy(e,t,r){let n=it(t);return W(e,n,r)}function Bu(e,t){return l.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function li(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"name")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"Inferrable")&&s.IsString(e.name)&&s.IsObject(e.type)}function Hu(e){return Jr(e)?ve(e.items)?H(e.items.extends)?Bu(e.items.name,e.items.extends.items):Fe(e.items.extends)?Bu(e.items.name,e.items.extends):void 0:$e():void 0}function Ma(e){return ve(e)?Bu(e.name,e.extends):void 0}function zu(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>de(W({},n,t),()=>zu(o,t,[...r,n]),()=>{}),()=>r)}function sy(e,t,r,n){let o=zu(r,n);return s.IsArray(o)?$(l.Assign(e,{[t]:Ce(o)})):_()}function Fa(e,t,r,n){let o=zu(r,n);return s.IsArray(o)?$(l.Assign(e,{[t]:v(o)})):_()}function FO(e){return[...e].reverse()}function Wu(e,t){return t?FO(e):e}function vO(e){let t=e.length>0?e[0]:void 0,r=be(t)?Hu(t):void 0;return be(r)}function LO(e,t,r,n,o,i){return de(W(e,r,o),a=>ay(a,t,n,i),()=>_())}function _O(e,t,r,n,o){let i=Hu(n);return li(i)?sy(e,i.name,Wu(r,t),i.type):s.ShiftLeft(r,(a,m)=>LO(e,t,a,m,n,o),()=>_())}function DO(e,t,r,n){return s.ShiftLeft(n,(o,i)=>_O(e,t,r,o,i),()=>s.IsEqual(r.length,0)?$(e):_())}function ay(e,t,r,n){return DO(e,t,r,n)}function NO(e,t,r){let n=Zr(e,ce([],[]),r),o=vO(n);return ay(e,o,Wu(t,o),Wu(n,o))}function my(e,t,r){let n=Ma(r);return li(n)?Fa(e,n.name,t,n.type):s.ShiftLeft(t,(o,i)=>de(W(e,o,r),a=>my(a,i,r),()=>_()),()=>$(e))}function uy(e,t,r){let n=Zr(e,ce([],[]),t);return j(r)?NO(e,n,r.items):H(r)?my(e,n,r.items):ee(e,Ce(n),r)}function cy(e,t,r){return wt(r)?$(e):Gt(r)?$(e):ee(e,t,r)}function py(e,t,r){return s.ShiftLeft(r,(n,o)=>de(W(e,t,n),i=>$(i),()=>py(e,t,o)),()=>_())}function Vu(e,t,r){return s.ShiftLeft(t,(n,o)=>de(py(e,n,r),i=>Vu(i,o,r),()=>_()),()=>$(e))}function fy(e,t,r){let n=Ma(r);return li(n)?Fa(e,n.name,t,n.type):S(r)?Vu(e,t,r.anyOf):Vu(e,t,[r])}function dy(e,t,r){return ve(r)?ee(e,t,r):Ee(r)?$(e):Fe(r)?$(e):_()}function ly(e,t,r){return wt(r)?$(e):ee(e,t,r)}function W(e,t,r){return Ee(t)?Uh(e,t,r):H(t)?qh(e,t,t.items,r):kt(t)?Gh(e,t,r):lt(t)?Kh(e,t,r):ke(t)?Bh(e,t.parameters,t.instanceType,r):we(t)?Hh(e,t.if,t.then,t.else,r):Re(t)?zh(e,t.enum,r):Te(t)?Wh(e,t.parameters,t.returnType,r):Ke(t)?Vh(e,t,r):C(t)?Jh(e,t.allOf,r):B(t)?Xh(e,t,r):yt(t)?Qh(e,t,r):ur(t)?Yh(e,t,r):ge(t)?Zh(e,t,r):A(t)?ty(e,t.properties,r):te(t)?ry(e,Ge(t),me(t),r):De(t)?ny(e,t,r):cr(t)?oy(e,t,r):se(t)?iy(e,t.pattern,r):j(t)?uy(e,t.items,r):Gt(t)?cy(e,t,r):S(t)?fy(e,t.anyOf,r):Fe(t)?dy(e,t,r):wt(t)?ly(e,t,r):_()}function jO(e,t){return xe([...e,P(t)])}function Ju(e,t,r){return N(e)?l.Update(jO(e,t),{},r):si(e,t,r)}function gy(e,t,r,n,o){let i=vt(e,t,r),a=gi(e,t,n);return Ju(i,a,o)}function si(e,t,r={}){return T("Interface",[e,t],r)}function ao(e){return be(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function xy(e,t,r={}){return Ju(e,t,r)}function UO(e,t,r){return e.includes(r)?!0:xi([...e,r],t,t[r])}function Iy(e,t,r){let n=Ds(r);return Cn(e,t,n)}function Cn(e,t,r){return s.ShiftLeft(r,(n,o)=>xi(e,t,n)?!0:Cn(e,t,o),()=>!1)}function xi(e,t,r){return Z(r)?UO(e,t,r.$ref):H(r)?xi(e,t,r.items):ke(r)?Cn(e,t,[...r.parameters,r.instanceType]):Te(r)?Cn(e,t,[...r.parameters,r.returnType]):ao(r)?Iy(e,t,r.parameters[1]):C(r)?Cn(e,t,r.allOf):A(r)?Iy(e,t,r.properties):S(r)?Cn(e,t,r.anyOf):j(r)?Cn(e,t,r.items):te(r)?xi(e,t,me(r)):!1}function hy(e,t,r){return xi(e,t,r)}function qO(e,t){return t.reduce((r,n)=>hy([n],e,e[n])?[...r,n]:r,[])}function yy(e){let t=_s(e);return qO(e,t)}function GO(e,t,r){return r.includes(t)?r:t in e?Ii(e,e[t],[...r,t]):$e()}function by(e,t,r){let n=Ds(t);return mo(e,n,r)}function mo(e,t,r){return t.reduce((n,o)=>Ii(e,o,n),r)}function Ii(e,t,r){return Z(t)?GO(e,t.$ref,r):H(t)?Ii(e,t.items,r):ke(t)?mo(e,[...t.parameters,t.instanceType],r):Te(t)?mo(e,[...t.parameters,t.returnType],r):ao(t)?by(e,t.parameters[1],r):C(t)?mo(e,t.allOf,r):A(t)?by(e,t.properties,r):S(t)?mo(e,t.anyOf,r):j(t)?mo(e,t.items,r):te(t)?Ii(e,me(t),r):r}function Ey(e,t,r){return Ii(e,r,[t])}function KO(e){return Vn()}function BO(e){return s.Keys(e).reduce((t,r)=>({...t,[r]:Pn(e[r])}),{})}function hi(e){return e.reduce((t,r)=>[...t,Pn(r)],[])}function Pn(e){return Z(e)?KO(e.$ref):H(e)?ht(Pn(e.items),zn(e)):ke(e)?or(hi(e.parameters),Pn(e.instanceType)):Te(e)?ir(hi(e.parameters),Pn(e.returnType)):C(e)?ot(hi(e.allOf)):A(e)?P(BO(e.properties)):te(e)?to(Vr(e),Pn(me(e))):S(e)?v(hi(e.anyOf)):j(e)?Ce(hi(e.items)):e}function HO(e,t){return t in e?Pn(e[t]):_e()}function Sy(e){return HO(e.$defs,e.$ref)}function zO(e,t,r){let n=vt(e,ce([],[]),t),o=gi({},ce([],[]),r);return xe([...n,P(o)])}function WO(e,t){return s.Keys(e).filter(n=>t.includes(n)).reduce((n,o)=>{let i=e[o],a=ao(i)?zO(e,i.parameters[0],i.parameters[1]):i;return{...n,[o]:a}},{})}function $y(e,t,r){let n=Ey(e,t,r),o=WO(e,n);return ar(o,t)}function ky(e,t){return t in e?Z(e[t])?ky(e,e[t].$ref):e[t]:re()}function pr(e,t){return ky(e,t)}function Ty(e){return ie(e)?Sy(e):Ns(e)?_e():e}function tt(e,t,r){let n=Ty(t),o=Ty(r);return W(e,n,o)}var ti=0,yi=1,ri=2,ni=3;function Zn(e,t){let r=[tt({},e,t),tt({},t,e)];return M.IsExtendsTrueLike(r[0])&&M.IsExtendsTrueLike(r[1])?ti:M.IsExtendsTrueLike(r[0])&&M.IsExtendsFalse(r[1])?ri:M.IsExtendsFalse(r[0])&&M.IsExtendsTrueLike(r[1])?ni:yi}function Xu(e,t,r=[],n=t){return s.ShiftLeft(t,(o,i)=>{let a=Zn(e,o);return s.IsEqual(a,ri)||s.IsEqual(a,ti)?n:s.IsEqual(a,yi)?Xu(e,i,[...r,o],n):Xu(e,i,r,n)},()=>[...r,e])}function VO(e,t,r){let n=qt(e);return Ee(n)?[n]:Fe(n)?[n]:yt(n)?va(t,r):A(n)?va(t,[...r,n]):va(t,Xu(n,r))}function va(e,t=[]){return s.ShiftLeft(e,(r,n)=>VO(r,n,t),()=>t)}function Ru(e){let t=va(e);return Wr(t)}function Qu(e,t){return l.Update(qt(e),{},t)}function wy(e,t,r,n){let o=E(e,t,r);return Qu(o,n)}function bi(e,t=[]){return Gr(e)&&s.IsEqual(e.action,"Conditional")?Z(e.parameters[0])?bi(e.parameters[2],bi(e.parameters[3],[...t,e.parameters[0].$ref])):bi(e.parameters[2],bi(e.parameters[3],t)):Gr(e)&&s.IsEqual(e.action,"Mapped")&&Gr(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&Z(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function JO(e,t){return e.reduce((r,n)=>[...r,t.includes(n.name)],[])}function Py(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>s.ShiftLeft(t,(i,a)=>Py(o,a,[...r,[i,n]]),()=>r),()=>r)}function XO(e){return se(e)?it(e.pattern):Re(e)?xt(e.enum):e}function QO(e){let t=XO(e);return S(t)?[...t.anyOf]:[t]}function YO(e,t){return e.reduce((r,n)=>[...r,[...n,t]],[])}function Ry(e,t){return t.reduce((r,n)=>[...r,...YO(e,n)],[])}function Cy(e){return e.reduce((t,r)=>s.IsEqual(r[0],!0)?Ry(t,QO(r[1])):Ry(t,[r[1]]),[[]])}function Ay(e,t,r){let n=bi(r),o=JO(e,n),i=Py(t,o);return Gr(r)&&s.IsEqual(r.action,"Conditional")||Gr(r)&&s.IsEqual(r.action,"Mapped")?Cy(i):[t]}function ZO(){return["(not-resolvable)",re()]}function eM(){return["(not-generic)",re()]}function tM(e,t,r){return[e,Kr(t,r)]}function rM(e,t,r){return t in e?Oy(e,t,e[t],r):ZO()}function Oy(e,t,r,n){return Wn(r)?tM(t,r.parameters,r.expression):Z(r)?rM(e,r.$ref,n):eM()}function My(e,t,r){return Oy(e,"(anonymous)",t,r)}function nM(e,t,r){if(ve(t)||uo(t)||M.IsExtendsTrueLike(tt({},t,r)))return;let n={parameter:e,expect:r,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:n})}function Fy(e,t,r,n,o){let i=E(e,t,o);return nM(r,i,n),l.Assign(e,{[r]:i})}function oM(e,t,r,n,o){let i=E(e,t,r.extends),a=E(e,t,r.equals);return s.ShiftLeft(o,(m,c)=>Yu(Fy(e,t,r.name,i,m),t,n,c),()=>Yu(Fy(e,t,r.name,i,a),t,n,[]))}function Yu(e,t,r,n){return s.ShiftLeft(r,(o,i)=>oM(e,t,o,i,n),()=>e)}function vy(e,t,r,n){return Yu(e,t,r,n)}var Zu=0,ec=0;function iM(){if(!s.IsLessThan(ec,Me.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function sM(){iM(),ec++,Zu++}function aM(){Zu--,s.IsEqual(Zu,0)&&(ec=0)}function mM(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function uM(e,t){return s.IsEqual(mM(e),t)}function cM(e,t,r,n,o,i){sM();try{let a=vy(e,t,n,i),m=E(a,ce([...t.callstack,r.$ref],t.visited),o);return E(a,ce([],[]),m)}finally{aM()}}function pM(e,t,r,n,o,i){return i.reduce((a,m)=>{let c=cM(e,t,r,n,o,m);return[...a,c]},[])}function fM(e,t,r,n,o,i){let a=Ay(n,i,o),m=pM(e,t,r,n,o,a);return s.IsEqual(m.length,1)?m[0]:Et(m)}function La(e,t,r,n){let o=vt(e,t,n),i=My(e,r,n),a=i[0],m=i[1];return Wn(m)?uM(t,a)?ai(Ue(a),o):fM(e,t,Ue(a),m.parameters,m.expression,o):ai(r,o)}function ai(e,t){return l.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Ly(e,t){return La({},ce([],[]),e,t)}function uo(e){return k(e,"Call")}function dM(e){return l.Discard(e,["~immutable"])}function _y(e,t){return l.Update(dM(e),{},t)}function Dy(e,t,r,n){let o=E(e,t,r);return _y(o,n)}function Ny(e,t){return e(t)}function jy(e,t){return s.IsString(t)?U(Ny(e,t)):U(t)}function Uy(e,t){let r=it(t);return Tr(e,r)}function qy(e,t){let r=t.map(n=>Tr(e,n));return v(r)}function Tr(e,t){return B(t)?jy(e,t.const):se(t)?Uy(e,t.pattern):S(t)?qy(e,t.anyOf):t}function na(e,t={}){return T("Capitalize",[e],t)}function Gy(e,t={}){return tc(e,t)}function oa(e,t={}){return T("Lowercase",[e],t)}function Ky(e,t={}){return rc(e,t)}function ia(e,t={}){return T("Uncapitalize",[e],t)}function By(e,t={}){return nc(e,t)}function sa(e,t={}){return T("Uppercase",[e],t)}function Hy(e,t={}){return oc(e,t)}var lM=e=>e[0].toUpperCase()+e.slice(1),gM=e=>e.toLowerCase(),xM=e=>e[0].toLowerCase()+e.slice(1),IM=e=>e.toUpperCase();function tc(e,t){return N([e])?l.Update(Tr(lM,e),{},t):na(e,t)}function rc(e,t){return N([e])?l.Update(Tr(gM,e),{},t):oa(e,t)}function nc(e,t){return N([e])?l.Update(Tr(xM,e),{},t):ia(e,t)}function oc(e,t){return N([e])?l.Update(Tr(IM,e),{},t):sa(e,t)}function zy(e,t,r,n){let o=E(e,t,r);return tc(o,n)}function Wy(e,t,r,n){let o=E(e,t,r);return rc(o,n)}function Vy(e,t,r,n){let o=E(e,t,r);return nc(o,n)}function Jy(e,t,r,n){let o=E(e,t,r);return oc(o,n)}function aa(e,t,r,n,o={}){return T("Conditional",[e,t,r,n],o)}function Xy(e,t,r,n,o={}){return ic({},ce([],[]),e,t,r,n,o)}function hM(e,t,r,n,o,i){let a=tt(e,r,n);return M.IsExtendsUnion(a)?v([E(a.inferred,t,o),E(e,t,i)]):M.IsExtendsTrue(a)?E(a.inferred,t,o):E(e,t,i)}function ic(e,t,r,n,o,i,a){return N([r,n])?l.Update(hM(e,t,r,n,o,i),{},a):aa(r,n,o,i,a)}function Qy(e,t,r,n,o,i,a){let m=E(e,t,r),c=E(e,t,n);return ic(e,t,m,c,o,i,a)}function ma(e,t={}){return T("ConstructorParameters",[e],t)}function Yy(e,t={}){return sc(e,t)}function yM(e){let t=ke(e)?e.parameters:[],r=Zr({},ce([],[]),t);return Ce(r)}function sc(e,t){return N([e])?l.Update(yM(e),{},t):ma(e,t)}function Zy(e,t,r,n){let o=E(e,t,r);return sc(o,n)}function ua(e,t,r={}){return T("Exclude",[e,t],r)}function eb(e,t,r={}){return Ei(e,t,r)}function Ei(e,t,r){return N([e,t])?l.Update(Xs(e,t),{},r):ua(e,t,r)}function tb(e,t,r,n,o){let i=E(e,t,r),a=E(e,t,n);return Ei(i,a,o)}function ca(e,t,r={}){return T("Extract",[e,t],r)}function rb(e,t,r={}){return ac(e,t,r)}function bM(e,t){let r=tt({},e,t);return M.IsExtendsTrueLike(r)?[e]:[]}function nb(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>nb(o,t,[...r,...bM(n,t)]),()=>r)}function ob(e,t){let r=qt(e),n=S(r)?r.anyOf:[r],o=nb(n,t);return Et(o)}function ac(e,t,r){return N([e,t])?l.Update(ob(e,t),{},r):ca(e,t,r)}function ib(e,t,r,n,o){let i=E(e,t,r),a=E(e,t,n);return ac(i,a,o)}function EM(e){return e.reduce((t,r)=>Gs(r)?[...t,U(r)]:t,[])}function co(e){let t=EM(e);return v(t)}function mi(e,t,r={}){return T("Index",[e,t],r)}function sb(e,t,r={}){let n=s.IsArray(t)?co(t):t;return mc(e,n,r)}function ab(e,t){let r=pr(e,t);return Lt(r)}function mb(e,t,r){let n=Xt(e,t,r);return Lt(n)}function SM(e,t){let r=s.Keys(e).filter(f=>!s.HasPropertyKey(t,f)),n=s.Keys(t).filter(f=>!s.HasPropertyKey(e,f)),o=s.Keys(e).filter(f=>s.HasPropertyKey(t,f)),i=r.reduce((f,d)=>({...f,[d]:e[d]}),{}),a=n.reduce((f,d)=>({...f,[d]:t[d]}),{}),m=o.reduce((f,d)=>({...f,[d]:xe([e[d],t[d]])}),{}),c=l.Assign(i,a);return l.Assign(c,m)}function ub(e){return e.reduce((t,r)=>SM(t,Lt(r)),{})}function cb(e){let t=dg(Ce(e));return Lt(t)}function $M(e,t){return s.Keys(e).filter(o=>o in t).reduce((o,i)=>({...o,[i]:Et([e[i],t[i]])}),{})}function pb(e,t){return s.ShiftLeft(e,(r,n)=>pb(n,$M(t,Lt(r))),()=>t)}function fb(e){return s.ShiftLeft(e,(t,r)=>pb(r,Lt(t)),()=>$e())}function Lt(e){return ie(e)?ab(e.$defs,e.$ref):we(e)?mb(e.if,e.then,e.else):C(e)?ub(e.allOf):S(e)?fb(e.anyOf):j(e)?cb(e.items):A(e)?e.properties:{}}function po(e){let t=Lt(e);return P(t)}var kM=new RegExp("^(?:0|[1-9][0-9]*)$");function fo(e){let t=`${e}`;return kM.test(t)?parseInt(t):e}function TM(e){return U(fo(e))}function db(e){return e.map(t=>lb(t))}function lb(e){return C(e)?ot(db(e.allOf)):S(e)?v(db(e.anyOf)):B(e)?TM(e.const):e}function gb(e,t){let r=lb(t),n=tt({},r,Tt());return M.IsExtendsTrueLike(n)?e:B(t)&&s.IsEqual(t.const,"length")?Tt():re()}function xb(e,t){let r=pr(e,t);return Rt(r)}function Ib(e,t,r){let n=Xt(e,t,r);return Rt(n)}function hb(e){let t=xt(e);return Rt(t)}function yb(e){let t=xe(e);return Rt(t)}function bb(e){return[`${e}`]}function Eb(e){let t=it(e);return Rt(t)}function Sb(e){return e.reduce((t,r)=>[...t,...Rt(r)],[])}function Rt(e){return ie(e)?xb(e.$defs,e.$ref):we(e)?Ib(e.if,e.then,e.else):Re(e)?hb(e.enum):C(e)?yb(e.allOf):B(e)?bb(e.const):se(e)?Eb(e.pattern):S(e)?Sb(e.anyOf):[]}function lo(e){return Rt(e)}function Si(e,t){return t.map(r=>$i(e,r))}function $i(e,t){return H(t)?ht($i(e,t.items)):ke(t)?or(Si(e,t.parameters),$i(e,t.instanceType)):Te(t)?ir(Si(e,t.parameters),$i(e,t.returnType)):j(t)?Ce(Si(e,t.items)):S(t)?v(Si(e,t.anyOf)):C(t)?ot(Si(e,t.allOf)):ea(t)?P(e):t}function $b(e,t){return $i(e,t)}function wM(e,t){let r=t in e?e[t]:re();return $b(e,r)}function kb(e,t){return t.reduce((r,n)=>[...r,wM(e,n)],[])}function RM(e,t){let r=lo(t),n=kb(e,r);return Et(n)}var CM=new RegExp(zr);function PM(e){return e.filter(r=>CM.test(r))}function AM(e){let t=_s(e),r=PM(t),n=kb(e,r);return Et(n)}function Tb(e,t){return ge(t)?AM(e):RM(e,t)}function OM(e){return U(fo(e))}function wb(e){return e.map(t=>uc(t))}function uc(e){return C(e)?ot(wb(e.allOf)):S(e)?v(wb(e.anyOf)):B(e)?OM(e.const):e}function MM(e,t){return e.reduceRight((r,n,o)=>{let i=tt({},U(o),t);return M.IsExtendsTrueLike(i)?[n,...r]:r},[])}function FM(e,t){let r=uc(t),n=MM(e,r);return Br(n)}function vM(e){return Br(e)}function Rb(e,t){return B(t)&&s.IsEqual(t.const,"length")?U(e.length):ge(t)||Ke(t)?vM(e):FM(e,t)}function Cb(e,t){return H(e)?gb(e.items,t):A(e)?Tb(e.properties,t):j(e)?Rb(e.items,t):re()}function LM(e){return ie(e)||we(e)||C(e)||S(e)?po(e):e}function mc(e,t,r){return N([e,t])?l.Update(Cb(LM(e),t),{},r):mi(e,t,r)}function Pb(e,t,r,n,o){let i=E(e,t,r),a=E(e,t,n);return mc(i,a,o)}function pa(e,t={}){return T("InstanceType",[e],t)}function Ab(e,t={}){return cc(e,t)}function _M(e){return ke(e)?e.instanceType:re()}function cc(e,t){return N([e])?l.Update(_M(e),{},t):pa(e,t)}function Ob(e,t,r,n={}){let o=E(e,t,r);return cc(o,n)}function ui(e,t={}){return T("KeyOf",[e],t)}function Mb(e,t={}){return pc(e,t)}function Fb(){return v([Tt(),gt(),Qn()])}function vb(e){return Tt()}function DM(e){return e.reduce((r,n)=>Gs(n)?[...r,U(fo(n))]:$e(),[])}function Lb(e){let t=s.Keys(e),r=DM(t);return Br(r)}function _b(e){return Vr(e)}function Db(e){let t=e.map((r,n)=>U(n));return Br(t)}function Nb(e){return Ee(e)?Fb():H(e)?vb(e.items):A(e)?Lb(e.properties):te(e)?_b(e):j(e)?Db(e.items):re()}function NM(e){return ie(e)||we(e)||C(e)||S(e)?po(e):e}function pc(e,t){return N([e])?l.Update(Nb(NM(e)),{},t):ui(e,t)}function jb(e,t,r,n){let o=E(e,t,r);return pc(o,n)}function ii(e,t,r,n,o={}){return T("Mapped",[e,t,r,n],o)}function Ub(e,t,r,n,o={}){return fc({},ce([],[]),e,t,r,n,o)}function jM(e){let t=it(e);return _a(t)}function UM(e){return e.reduce((t,r)=>[...t,..._a(r)],[])}function qM(e){let t=xt(e);return _a(t)}function GM(e){return s.IsNumber(e)?[U(`${e}`)]:[U(e)]}function _a(e){return Re(e)?qM(e.enum):B(e)?GM(e.const):se(e)?jM(e.pattern):S(e)?UM(e.anyOf):[e]}function qb(e){return _a(e)}function KM(e){return se(e)?it(e.pattern):e}function BM(e,t,r,n,o,i){let a=l.Assign(e,{[r.name]:n}),m=E(a,t,o),c=KM(m),p=E(a,t,i);return Ks(c)||Bs(c)?{[c.const]:p}:{}}function HM(e,t,r,n,o,i){return n.reduce((a,m)=>[...a,BM(e,t,r,m,o,i)],[])}function zM(e){return e.reduce((t,r)=>[...t,P(r)],[])}function Gb(e,t,r,n,o,i){let a=qb(n),m=HM(e,t,r,a,o,i),c=zM(m);return xe(c)}function fc(e,t,r,n,o,i,a){return N([n])?l.Update(Gb(e,t,r,n,o,i),{},a):ii(r,n,o,i,a)}function Kb(e,t,r,n,o,i,a){let m=E(e,t,n);return fc(e,t,r,m,o,i,a)}function WM(e,t,r){let n=l.Assign(e,t);return s.Keys(t).filter(i=>r.includes(i)).reduce((i,a)=>({...i,[a]:$y(n,a,t[a])}),{})}function VM(e,t,r){let n=l.Assign(e,t);return s.Keys(t).filter(i=>!r.includes(i)).reduce((i,a)=>({...i,[a]:E(n,ce([],[]),t[a])}),{})}function JM(e,t,r){let n=yy(t),o=WM(e,t,n),i=VM(e,t,n),a={...o,...i};return l.Update(a,{},r)}function Da(e,t,r,n){return JM(e,r,n)}function fa(e,t={}){return T("NonNullable",[e],t)}function Bb(e,t={}){return dc(e,t)}function XM(e){let t=v([Xn(),ro()]);return Ei(e,t,{})}function dc(e,t){return N([e])?l.Update(XM(e),{},t):fa(e,t)}function Hb(e,t,r,n){let o=E(e,t,r);return dc(o,n)}function da(e,t,r={}){return T("Omit",[e,t],r)}function zb(e,t,r={}){let n=s.IsArray(t)?co(t):t;return lc(e,n,r)}function Na(e){let t=po(e);return A(t)?t.properties:$e()}function QM(e,t){return s.Keys(e).reduce((n,o)=>t.includes(o)?n:{...n,[o]:e[o]},{})}function Wb(e,t){let r=Na(e),n=lo(t),o=QM(r,n);return P(o)}function lc(e,t,r){return N([e,t])?l.Update(Wb(e,t),{},r):da(e,t,r)}function Vb(e,t,r,n,o){let i=E(e,t,r),a=E(e,t,n);return lc(i,a,o)}function la(e,t={}){return T("Parameters",[e],t)}function Jb(e,t={}){return gc(e,t)}function YM(e){let t=Te(e)?e.parameters:[],r=Zr({},ce([],[]),t);return Ce(r)}function gc(e,t){return N([e])?l.Update(YM(e),{},t):la(e,t)}function Xb(e,t,r,n){let o=E(e,t,r);return gc(o,n)}function ga(e,t={}){return T("Partial",[e],t)}function Qb(e,t={}){return xc(e,t)}function Yb(e,t){let r=pr(e,t),n=fr(r);return ar(l.Assign(e,{[t]:n}),t)}function Zb(e,t,r){let n=Xt(e,t,r);return fr(n)}function eE(e){let t=xe(e);return fr(t)}function tE(e){let t=e.map(r=>fr(r));return v(t)}function rE(e){let t=s.Keys(e).reduce((n,o)=>({...n,[o]:yn(e[o])}),{});return P(t)}function fr(e){return ie(e)?Yb(e.$defs,e.$ref):we(e)?Zb(e.if,e.then,e.else):C(e)?eE(e.allOf):S(e)?tE(e.anyOf):A(e)?rE(e.properties):P({})}function xc(e,t){return N([e])?l.Update(fr(e),{},t):ga(e,t)}function nE(e,t,r,n){let o=E(e,t,r);return xc(o,n)}function xa(e,t,r={}){return T("Pick",[e,t],r)}function oE(e,t,r={}){let n=s.IsArray(t)?co(t):t;return Ic(e,n,r)}function ZM(e,t){return s.Keys(e).reduce((n,o)=>t.includes(o)?l.Assign(n,{[o]:e[o]}):n,{})}function iE(e,t){let r=Na(e),n=lo(t),o=ZM(r,n);return P(o)}function Ic(e,t,r){return N([e,t])?l.Update(iE(e,t),{},r):xa(e,t,r)}function sE(e,t,r,n,o){let i=E(e,t,r),a=E(e,t,n);return Ic(i,a,o)}function Ia(e,t={}){return T("ReadonlyObject",[e],t)}function hc(e,t={}){return yc(e,t)}var aE=hc;function mE(e){return Jn(ht(e))}function uE(e,t){let r=pr(e,t),n=dr(r);return ar(l.Assign(e,{[t]:n}),t)}function cE(e,t,r){let n=Xt(e,t,r);return dr(n)}function pE(e){let t=xe(e);return dr(t)}function fE(e){let t=s.Keys(e).reduce((n,o)=>({...n,[o]:Sn(e[o])}),{});return P(t)}function dE(e){return Jn(Ce(e))}function lE(e){let t=e.map(r=>dr(r));return v(t)}function dr(e){return H(e)?mE(e.items):ie(e)?uE(e.$defs,e.$ref):we(e)?cE(e.if,e.then,e.else):C(e)?pE(e.allOf):A(e)?fE(e.properties):j(e)?dE(e.items):S(e)?lE(e.anyOf):e}function yc(e,t){return N([e])?l.Update(dr(e),{},t):Ia(e)}function gE(e,t,r,n){let o=E(e,t,r);return yc(o,n)}function xE(e,t,r,n){return t.visited.includes(n)?r:n in e?E(e,ce(t.callstack,[...t.visited,n]),e[n]):r}function IE(e,t){let r=pr(e,t),n=lr(r);return ar(l.Assign(e,{[t]:n}),t)}function hE(e,t,r){let n=Xt(e,t,r);return lr(n)}function yE(e){let t=xe(e);return lr(t)}function bE(e){let t=e.map(r=>lr(r));return v(t)}function EE(e){let t=s.Keys(e).reduce((n,o)=>({...n,[o]:Js(e[o])}),{});return P(t)}function lr(e){return ie(e)?IE(e.$defs,e.$ref):we(e)?hE(e.if,e.then,e.else):C(e)?yE(e.allOf):S(e)?bE(e.anyOf):A(e)?EE(e.properties):P({})}function ha(e,t={}){return T("Required",[e],t)}function SE(e,t={}){return bc(e,t)}function bc(e,t){return N([e])?l.Update(lr(e),{},t):ha(e,t)}function $E(e,t,r,n){let o=E(e,t,r);return bc(o,n)}function ya(e,t={}){return T("ReturnType",[e],t)}function kE(e,t={}){return Ec(e,t)}function eF(e){return Te(e)?e.returnType:re()}function Ec(e,t){return N([e])?l.Update(eF(e),{},t):ya(e,t)}function TE(e,t,r,n={}){let o=E(e,t,r);return Ec(o,n)}function ba(e,t){return T("With",[e,t],{})}function ja(e,t){return Sc(e,t)}function Sc(e,t){return N([e])?l.Update(e,{},t):ba(e,t)}function wE(e,t,r,n){let o=E(e,t,r);return Sc(o,n)}function tF(e){return Jr(e)?j(e.items)?$c(e.items.items):ve(e.items)?[e]:Z(e.items)?[e]:[re()]:[e]}function $c(e){return e.reduce((r,n)=>[...r,...tF(n)],[])}function ce(e,t){return{callstack:e,visited:t}}function N(e){return s.ShiftLeft(e,(t,r)=>Z(t)?!1:N(r),()=>!0)}function gi(e,t,r){return s.Keys(r).reduce((n,o)=>({...n,[o]:E(e,t,r[o])}),{})}function Zr(e,t,r){let n=vt(e,t,r);return $c(n)}function vt(e,t,r){return r.map(n=>E(e,t,n))}function rF(e,t){let r=qe(e)?Wo(t,{}):t,n=$n(e)?zo(r,{}):r;return En(e)?ki(n,{}):n}function nF(e,t,r,n,o){return s.IsEqual(r,"AddImmutable")?RE(e,t,n[0],o):s.IsEqual(r,"RemoveImmutable")?Dy(e,t,n[0],o):s.IsEqual(r,"AddReadonly")?wl(e,t,n[0],o):s.IsEqual(r,"RemoveReadonly")?mg(e,t,n[0],o):s.IsEqual(r,"AddOptional")?Rl(e,t,n[0],o):s.IsEqual(r,"RemoveOptional")?pg(e,t,n[0],o):s.IsEqual(r,"Capitalize")?zy(e,t,n[0],o):s.IsEqual(r,"Conditional")?Qy(e,t,n[0],n[1],n[2],n[3],o):s.IsEqual(r,"ConstructorParameters")?Zy(e,t,n[0],o):s.IsEqual(r,"Evaluate")?wy(e,t,n[0],o):s.IsEqual(r,"Exclude")?tb(e,t,n[0],n[1],o):s.IsEqual(r,"Extract")?ib(e,t,n[0],n[1],o):s.IsEqual(r,"Index")?Pb(e,t,n[0],n[1],o):s.IsEqual(r,"InstanceType")?Ob(e,t,n[0],o):s.IsEqual(r,"Interface")?gy(e,t,n[0],n[1],o):s.IsEqual(r,"KeyOf")?jb(e,t,n[0],o):s.IsEqual(r,"Lowercase")?Wy(e,t,n[0],o):s.IsEqual(r,"Mapped")?Kb(e,t,n[0],n[1],n[2],n[3],o):s.IsEqual(r,"Module")?Da(e,t,n[0],o):s.IsEqual(r,"NonNullable")?Hb(e,t,n[0],o):s.IsEqual(r,"Pick")?sE(e,t,n[0],n[1],o):s.IsEqual(r,"Parameters")?Xb(e,t,n[0],o):s.IsEqual(r,"Partial")?nE(e,t,n[0],o):s.IsEqual(r,"Omit")?Vb(e,t,n[0],n[1],o):s.IsEqual(r,"ReadonlyObject")?gE(e,t,n[0],o):s.IsEqual(r,"Record")?Cg(e,t,n[0],n[1],o):s.IsEqual(r,"Required")?$E(e,t,n[0],o):s.IsEqual(r,"ReturnType")?TE(e,t,n[0],o):s.IsEqual(r,"TemplateLiteral")?Fh(e,t,n[0],o):s.IsEqual(r,"Uncapitalize")?Vy(e,t,n[0],o):s.IsEqual(r,"Uppercase")?Jy(e,t,n[0],o):s.IsEqual(r,"With")?wE(e,t,n[0],n[1]):T(r,n,o)}function oF(e,t,r){let n=Z(r)?xE(e,t,r,r.$ref):H(r)?ht(E(e,t,r.items),zn(r)):uo(r)?La(e,t,r.target,r.arguments):ke(r)?or(vt(e,t,r.parameters),E(e,t,r.instanceType),Cl(r)):Te(r)?ir(vt(e,t,r.parameters),E(e,t,r.returnType),Pl(r)):we(r)?bn(E(e,t,r.if),E(e,t,r.then),E(e,t,r.else),Ll(r)):C(r)?ot(vt(e,t,r.allOf),Ul(r)):A(r)?P(gi(e,t,r.properties),Fl(r)):te(r)?Pg(Ge(r),E(e,t,me(r))):Jr(r)?wn(E(e,t,r.items)):j(r)?Ce(Zr(e,t,r.items),ag(r)):S(r)?v(vt(e,t,r.anyOf),Ql(r)):r;return rF(r,n)}function E(e,t,r){return Gr(r)?nF(e,t,r.action,r.parameters,r.options):oF(e,t,r)}function _t(e,t){return E(e,ce([],[]),t)}function iF(e){return l.Update(e,{"~immutable":!0},{})}function ki(e,t){return l.Update(iF(e),{},t)}function RE(e,t,r,n){let o=E(e,t,r);return ki(o,n)}function PI(e,t={}){return T("AddImmutable",[e],t)}function Jn(e,t={}){return ki(e,t)}function AI(e,t={}){return T("Evaluate",[e],t)}function Be(e,t={}){return Qu(e,t)}function OI(e,t={}){return T("Module",[e],t)}function CE(e,t={}){return Da({},ce([],[]),e,t)}function sF(e,t){let r=Zn(e,t);return s.IsEqual(r,ni)||s.IsEqual(r,yi)?1:0}function PE(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>s.IsEqual(sF(e,n),1)?PE(e,o,[...r,n]):[...r,e,...t],()=>[...r,e])}function AE(e,t=[]){return s.ShiftLeft(e,(r,n)=>AE(n,PE(r,t)),()=>t)}function OE(e){return AE(e)}function ME(...e){let[t,r,n]=G.Match(e,{2:(a,m)=>s.IsString(a)?[{},a,m]:[a,m,{}],3:(a,m,c)=>[a,m,c],1:a=>[{},a,{}]}),o=Ch(r),i=s.IsArray(o)&&s.IsEqual(o.length,2)?E(t,ce([],[]),o[0]):re();return l.Update(i,{},n)}function FE(e,t,r){return s.IsArray(r)?r.map(n=>He(e,t.items,n)):r}function vE(e,t,r){return He({...e,...t.$defs},Ue(t.$ref),r)}function aF(e,t){let r=s.HasPropertyKey(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},n=_t(e,t),o=Be(n);return A(o)?ja(o,r):o}function LE(e,t,r){let n=aF(e,t);return He(e,n,r)}function Ua(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function _E(e,t,r){if(!s.IsObject(r)||s.IsArray(r))return r;let n=Ua(t);for(let o of s.Keys(r)){if(s.HasPropertyKey(t.properties,o)){r[o]=He(e,t.properties[o],r[o]);continue}if(s.IsBoolean(n)&&s.IsEqual(n,!0)||be(n)&&K(e,n,r[o])){r[o]=He(e,n,r[o]);continue}delete r[o]}return r}function DE(e,t,r){if(!s.IsObject(r))return r;let n=Ua(t),[o,i]=[new RegExp(Ge(t)),me(t)];for(let a of s.Keys(r)){if(o.test(a)){r[a]=He(e,i,r[a]);continue}if(s.IsBoolean(n)&&s.IsEqual(n,!0)||be(n)&&K(e,n,r[a])){r[a]=He(e,n,r[a]);continue}delete r[a]}return r}function NE(e,t,r){return s.HasPropertyKey(e,t.$ref)?He(e,e[t.$ref],r):r}function jE(e,t,r){if(!s.IsArray(r))return r;let n=Math.min(r.length,t.items.length);for(let o=0;o<n;o++)r[o]=He(e,t.items[o],r[o]);return s.IsGreaterThan(r.length,n)?r.slice(0,n):r}function ue(e){return hn(e)}function UE(e,t,r){for(let n of t.anyOf){let o=He(e,n,ue(r));if(K(e,n,o))return o}return r}function He(e,t,r){return H(t)?FE(e,t,r):ie(t)?vE(e,t,r):C(t)?LE(e,t,r):A(t)?_E(e,t,r):te(t)?DE(e,t,r):Z(t)?NE(e,t,r):j(t)?jE(e,t,r):S(t)?UE(e,t,r):r}function mF(e,t){for(let r of Gi.Keys(e))Gi.HasPropertyKey(t,r)||(t[r]=e[r]);return t}function uF(e){let t={};for(let r of Gi.Keys(e))t[r]=Ti(e[r]);return t}function cF(e){return kc(OE(e))}function kc(e){return e.map(t=>Ti(t))}function Ti(e){let t=H(e)?ht(Ti(e.items),zn(e)):C(e)?ot(kc(e.allOf)):S(e)?v(cF(e.anyOf)):A(e)?P(uF(e.properties)):te(e)?to(Vr(e),Ti(me(e))):j(e)?Ce(kc(e.items)):e;return mF(e,t)}function go(e){return Ti(e)}function Qt(...e){let[t,r,n]=G.Match(e,{3:(i,a,m)=>[i,a,m],2:(i,a)=>[{},i,a]}),o=Me.Get().unionPrioritySort?go(r):r;return He(t,o,n)}var Y={};At(Y,{Fail:()=>On,IsOk:()=>Tc,Ok:()=>w,TryArray:()=>pF,TryBigInt:()=>wc,TryBoolean:()=>$F,TryNull:()=>CF,TryNumber:()=>MF,TryString:()=>FF,TryUndefined:()=>NF});function Tc(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function w(e){return{value:e}}function On(){}function pF(e){return s.IsArray(e)?w(e):w([e])}function fF(e){return s.IsEqual(e,!0)?w(BigInt(1)):w(BigInt(0))}var dF=/^-?(0|[1-9]\d*)n$/,lF=/^-?(0|[1-9]\d*)\.\d+$/,gF=/^-?(0|[1-9]\d*)$/;function xF(e){return dF.test(e)}function IF(e){return lF.test(e)}function hF(e){return gF.test(e)}function yF(e){let t=e.toLowerCase();return xF(e)?w(BigInt(e.slice(0,e.length-1))):IF(e)?w(BigInt(e.split(".")[0])):hF(e)?w(BigInt(e)):s.IsEqual(t,"false")?w(BigInt(0)):s.IsEqual(t,"true")?w(BigInt(1)):void 0}function wc(e){return s.IsBigInt(e)?w(e):s.IsBoolean(e)?fF(e):s.IsNumber(e)?w(BigInt(Math.trunc(e))):s.IsNull(e)?w(BigInt(0)):s.IsString(e)?yF(e):s.IsUndefined(e)?w(BigInt(0)):void 0}function bF(e){return s.IsEqual(e,BigInt(0))?w(!1):s.IsEqual(e,BigInt(1))?w(!0):void 0}function EF(e){return s.IsEqual(e,0)?w(!1):s.IsEqual(e,1)?w(!0):void 0}function SF(e){return s.IsEqual(e.toLowerCase(),"false")?w(!1):s.IsEqual(e.toLowerCase(),"true")?w(!0):s.IsEqual(e,"0")?w(!1):s.IsEqual(e,"1")?w(!0):void 0}function $F(e){return s.IsBigInt(e)?bF(e):s.IsBoolean(e)?w(e):s.IsNumber(e)?EF(e):s.IsNull(e)?w(!1):s.IsString(e)?SF(e):s.IsUndefined(e)?w(!1):void 0}function kF(e){return s.IsEqual(e,BigInt(0))?w(null):void 0}function TF(e){return s.IsEqual(e,!1)?w(null):void 0}function wF(e){return s.IsEqual(e,0)?w(null):void 0}function RF(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?w(null):void 0}function CF(e){return s.IsBigInt(e)?kF(e):s.IsBoolean(e)?TF(e):s.IsNumber(e)?wF(e):s.IsNull(e)?w(null):s.IsString(e)?RF(e):s.IsUndefined(e)?w(null):void 0}var qE=BigInt(Number.MAX_SAFE_INTEGER),GE=BigInt(Number.MIN_SAFE_INTEGER);function PF(e){return e<=qE&&e>=GE?w(Number(e)):void 0}function AF(e){return w(e?1:0)}function OF(e){let t=+e;if(s.IsNumber(t))return w(t);let r=e.toLowerCase();if(s.IsEqual(r,"false"))return w(0);if(s.IsEqual(r,"true"))return w(1);let n=wc(e);return Tc(n)?n.value<=qE&&n.value>=GE?w(Number(n.value)):void 0:void 0}function MF(e){return s.IsBigInt(e)?PF(e):s.IsBoolean(e)?AF(e):s.IsNumber(e)?w(e):s.IsNull(e)?w(0):s.IsString(e)?OF(e):s.IsUndefined(e)?w(0):void 0}function FF(e){return s.IsBigInt(e)?w(e.toString()):s.IsBoolean(e)?w(e.toString()):s.IsNumber(e)?w(e.toString()):s.IsNull(e)?w("null"):s.IsString(e)?w(e):s.IsUndefined(e)?w(""):void 0}function vF(e){return s.IsEqual(e,BigInt(0))?w(void 0):void 0}function LF(e){return s.IsEqual(e,!1)?w(void 0):void 0}function _F(e){return s.IsEqual(e,0)?w(void 0):void 0}function DF(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?w(void 0):void 0}function NF(e){return s.IsBigInt(e)?vF(e):s.IsBoolean(e)?LF(e):s.IsNumber(e)?_F(e):s.IsNull(e)?w(void 0):s.IsString(e)?DF(e):s.IsUndefined(e)?w(e):void 0}function KE(e,t,r){return Y.TryArray(r).value.map(o=>Ae(e,t.items,o))}function BE(e,t,r){let n=Y.TryBigInt(r);return Y.IsOk(n)?n.value:r}function HE(e,t,r){let n=Y.TryBoolean(r);return Y.IsOk(n)?n.value:r}function zE(e,t,r){return Ae({...e,...t.$defs},Ue(t.$ref),r)}function WE(e,t,r){return Ae(e,Be(t),r)}function VE(e,t,r){let n=Y.TryNumber(r);return Y.IsOk(n)?Math.trunc(n.value):r}function JE(e,t,r){let n=_t(e,t),o=Be(n);return Ae(e,o,r)}function jF(e,t,r){let n=Y.TryBigInt(r);return Y.IsOk(n)&&s.IsEqual(t.const,n.value)?n.value:r}function UF(e,t,r){let n=Y.TryBoolean(r);return Y.IsOk(n)&&s.IsEqual(t.const,n.value)?n.value:r}function qF(e,t,r){let n=Y.TryNumber(r);return Y.IsOk(n)&&s.IsEqual(t.const,n.value)?n.value:r}function GF(e,t,r){let n=Y.TryString(r);return Y.IsOk(n)&&s.IsEqual(t.const,n.value)?n.value:r}function XE(e,t,r){return s.IsEqual(t.const,r)?r:Vl(t)?jF(e,t,r):Jl(t)?UF(e,t,r):Ks(t)?qF(e,t,r):Bs(t)?GF(e,t,r):$e()}function QE(e,t,r){let n=Y.TryNull(r);return Y.IsOk(n)?n.value:r}function YE(e,t,r){let n=Y.TryNumber(r);return Y.IsOk(n)?n.value:r}function qa(e,t,r,n){let o=s.Keys(n);for(let[i,a]of t)for(let m of o)i.test(m)||(n[m]=Ae(e,r,n[m]));return n}function wi(e,t,r){return qe(e)&&s.IsUndefined(r[t])}function KF(e,t,r){let n=s.EntriesRegExp(t.properties),o=s.Keys(r);for(let[i,a]of n)for(let m of o)!i.test(m)||wi(a,m,r)||(r[m]=Ae(e,a,r[m]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?qa(e,n,t.additionalProperties,r):r}function ZE(e,t,r){return s.IsObjectNotArray(r)?KF(e,t,r):r}function BF(e,t,r){let n=s.EntriesRegExp(t.patternProperties),o=s.Keys(r);for(let[i,a]of n)for(let m of o)i.test(m)&&(r[m]=Ae(e,a,r[m]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?qa(e,n,t.additionalProperties,r):r}function eS(e,t,r){return s.IsObjectNotArray(r)?BF(e,t,r):r}function tS(e,t,r){return s.HasPropertyKey(e,t.$ref)?Ae(e,e[t.$ref],r):r}function rS(e,t,r){let n=Y.TryString(r);return Y.IsOk(n)?n.value:r}function nS(e,t,r){return Ae(e,Be(t),r)}function oS(e,t,r){if(!s.IsArray(r))return r;for(let n=0;n<Math.min(t.items.length,r.length);n++)r[n]=Ae(e,t.items[n],r[n]);return r}function iS(e,t,r){let n=Y.TryUndefined(r);return Y.IsOk(n)?n.value:r}function sS(e,t,r){if(t.anyOf.some(a=>K(e,a,r)))return r;let i=t.anyOf.map(a=>Ae(e,a,ue(r))).find(a=>K(e,t,a));return s.IsUndefined(i)?r:i}function aS(e,t,r){let n=Y.TryUndefined(r);return Y.IsOk(n)?void 0:r}function Ae(e,t,r){return H(t)?KE(e,t,r):kt(t)?BE(e,t,r):lt(t)?HE(e,t,r):ie(t)?zE(e,t,r):Re(t)?WE(e,t,r):Ke(t)?VE(e,t,r):C(t)?JE(e,t,r):B(t)?XE(e,t,r):ur(t)?QE(e,t,r):ge(t)?YE(e,t,r):A(t)?ZE(e,t,r):te(t)?eS(e,t,r):Z(t)?tS(e,t,r):De(t)?rS(e,t,r):se(t)?nS(e,t,r):j(t)?oS(e,t,r):Gt(t)?iS(e,t,r):S(t)?sS(e,t,r):wt(t)?aS(e,t,r):r}function gr(...e){let[t,r,n]=G.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return Ae(t,r,n)}function mS(e,t,r){if(!s.IsArray(r))return r;for(let n=0;n<r.length;n++)r[n]=ze(e,t.items,r[n]);return r}function uS(e,t,r){return ze({...e,...t.$defs},Ue(t.$ref),r)}function cS(e,t){return s.IsUndefined(t)?s.IsFunction(e.default)?e.default():ue(e.default):t}function pS(e,t,r){let n=_t(e,t),o=Be(n);return ze(e,o,r)}function fS(e,t,r){if(!s.IsObject(r))return r;let n=s.Keys(t.properties);for(let o of n){let i=ze(e,t.properties[o],r[o]);s.IsUndefined(i)&&(qe(t.properties[o])||!s.HasPropertyKey(t.properties[o],"default"))||(r[o]=i)}if(!Ut(t)||s.IsBoolean(t.additionalProperties))return r;for(let o of s.Keys(r))n.includes(o)||(r[o]=ze(e,t.additionalProperties,r[o]));return r}function dS(e,t,r){if(!s.IsObject(r))return r;let[n,o]=[new RegExp(Ge(t)),me(t)];for(let i of s.Keys(r))n.test(i)&&St(o)&&(r[i]=ze(e,o,r[i]));if(!Ut(t))return r;for(let i of s.Keys(r))n.test(i)||(r[i]=ze(e,t.additionalProperties,r[i]));return r}function lS(e,t,r){return s.HasPropertyKey(e,t.$ref)?ze(e,e[t.$ref],r):r}function gS(e,t,r){if(!s.IsArray(r))return r;let[n,o]=[t.items,Math.max(t.items.length,r.length)];for(let i=0;i<o;i++)i<n.length&&(r[i]=ze(e,n[i],r[i]));return r}function xS(e,t,r){for(let n of t.anyOf){let o=ze(e,n,ue(r));if(K(e,n,o))return o}return r}function ze(e,t,r){let n=St(t)?cS(t,r):r;return H(t)?mS(e,t,n):ie(t)?uS(e,t,n):C(t)?pS(e,t,n):A(t)?fS(e,t,n):te(t)?dS(e,t,n):Z(t)?lS(e,t,n):j(t)?gS(e,t,n):S(t)?xS(e,t,n):n}function en(...e){let[t,r,n]=G.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return ze(t,r,n)}function xo(e){return(...t)=>{let[r,n,o]=G.Match(t,{3:(i,a,m)=>[i,a,m],2:(i,a)=>[{},i,a]});return e.reduce((i,a)=>a(r,n,i),o)}}function HF(e,t,r){return t["~codec"].decode(r)}function zF(e,t,r){return t["~codec"].encode(r)}function le(e,t,r,n){return dt(r)?s.IsEqual(e,"Decode")?HF(t,r,n):zF(t,r,n):n}function WF(e,t,r,n){if(!s.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=Ie(e,t,r.items,n[o]);return le(e,t,r,n)}function VF(e,t,r,n){let o=le(e,t,r,n);if(!s.IsArray(o))return o;for(let i=0;i<o.length;i++)o[i]=Ie(e,t,r.items,o[i]);return o}function IS(e,t,r,n){return s.IsEqual(e,"Decode")?WF(e,t,r,n):VF(e,t,r,n)}function hS(e,t,r,n){return n=Ie(e,{...t,...r.$defs},Ue(r.$ref),n),le(e,t,r,n)}function yS(e){return e.reduce((t,r)=>({...t,...r}),{})}function bS(e,t){for(let r of t)if(!s.IsDeepEqual(e,r))return r;return e}function JF(e,t,r,n){if(s.IsEqual(r.allOf.length,0))return le(e,t,r,n);let o=r.allOf.map(m=>Ie(e,t,m,Qt(m,ue(n)))),a=o.every(m=>s.IsObject(m))?yS(o):bS(n,o);return le(e,t,r,a)}function XF(e,t,r,n){if(s.IsEqual(r.allOf.length,0))return le(e,t,r,n);let o=le(e,t,r,n),i=r.allOf.map(m=>Ie(e,t,m,Qt(m,ue(o))));return i.every(m=>s.IsObject(m))?yS(i):bS(o,i)}function ES(e,t,r,n){return s.IsEqual(e,"Decode")?JF(e,t,r,n):XF(e,t,r,n)}function QF(e,t,r,n){if(!s.IsObjectNotArray(n))return n;for(let o of s.Keys(r.properties))!s.HasPropertyKey(n,o)||wi(r.properties[o],o,n)||(n[o]=Ie(e,t,r.properties[o],n[o]));return le(e,t,r,n)}function YF(e,t,r,n){let o=le(e,t,r,n);if(!s.IsObjectNotArray(o))return o;for(let i of s.Keys(r.properties))!s.HasPropertyKey(o,i)||wi(r.properties[i],i,o)||(o[i]=Ie(e,t,r.properties[i],o[i]));return o}function SS(e,t,r,n){return s.IsEqual(e,"Decode")?QF(e,t,r,n):YF(e,t,r,n)}function ZF(e,t,r,n){if(!s.IsObjectNotArray(n))return n;let o=new RegExp(Ge(r));for(let i of s.Keys(n))o.test(i)&&(n[i]=Ie(e,t,me(r),n[i]));return le(e,t,r,n)}function ev(e,t,r,n){let o=le(e,t,r,n);if(!s.IsObjectNotArray(o))return o;let i=new RegExp(Ge(r));for(let a of s.Keys(o))i.test(a)&&(o[a]=Ie(e,t,me(r),o[a]));return o}function $S(e,t,r,n){return s.IsEqual(e,"Decode")?ZF(e,t,r,n):ev(e,t,r,n)}function kS(e,t,r,n){return s.HasPropertyKey(t,r.$ref)?Ie(e,t,t[r.$ref],n):n}function TS(e,t,r,n){return s.IsEqual(e,"Decode")?le(e,t,r,kS(e,t,r,n)):kS(e,t,r,le(e,t,r,n))}function tv(e,t,r,n){if(!s.IsArray(n))return n;for(let o=0;o<Math.min(r.items.length,n.length);o++)n[o]=Ie(e,t,r.items[o],n[o]);return le(e,t,r,n)}function rv(e,t,r,n){let o=le(e,t,r,n);if(!s.IsArray(o))return n;for(let i=0;i<Math.min(r.items.length,o.length);i++)o[i]=Ie(e,t,r.items[i],o[i]);return o}function wS(e,t,r,n){return s.IsEqual(e,"Decode")?tv(e,t,r,n):rv(e,t,r,n)}function nv(e,t,r,n){for(let o of r.anyOf){if(!K(t,o,n))continue;let i=Ie(e,t,o,n);return le(e,t,r,i)}return n}function ov(e,t,r,n){let o=le(e,t,r,n);for(let i of r.anyOf){let a=Ie(e,t,i,ue(o));if(K(t,i,a))return a}return o}function RS(e,t,r,n){return s.IsEqual(e,"Decode")?nv(e,t,r,n):ov(e,t,r,n)}function Ie(e,t,r,n){return H(r)?IS(e,t,r,n):ie(r)?hS(e,t,r,n):C(r)?ES(e,t,r,n):A(r)?SS(e,t,r,n):te(r)?$S(e,t,r,n):Z(r)?TS(e,t,r,n):j(r)?wS(e,t,r,n):S(r)?RS(e,t,r,n):le(e,t,r,n)}var Rc=class extends $r{constructor(t,r){super("Decode",t,r)}};function iv(e,t,r){if(!K(e,t,r))throw new Rc(r,Vt(e,t,r));return r}function sv(e,t,r){let n=Me.Get().unionPrioritySort?go(t):t;return Ie("Decode",e,n,r)}var av=xo([(e,t,r)=>ue(r),(e,t,r)=>en(e,t,r),(e,t,r)=>gr(e,t,r),(e,t,r)=>Qt(e,t,r),(e,t,r)=>iv(e,t,r),(e,t,r)=>sv(e,t,r)]);function CS(...e){let[t,r,n]=G.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return av(t,r,n)}var Cc=class extends $r{constructor(t,r){super("Encode",t,r)}};function mv(e,t,r){if(!K(e,t,r))throw new Cc(r,Vt(e,t,r));return r}function uv(e,t,r){let n=Me.Get().unionPrioritySort?go(t):t;return Ie("Encode",e,n,r)}var cv=xo([(e,t,r)=>ue(r),(e,t,r)=>uv(e,t,r),(e,t,r)=>en(e,t,r),(e,t,r)=>gr(e,t,r),(e,t,r)=>Qt(e,t,r),(e,t,r)=>mv(e,t,r)]);function PS(...e){let[t,r,n]=G.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return cv(t,r,n)}function pv(e,t){return dt(t)||tn(e,t.items)}function fv(e,t){return dt(t)||AS({...e,...t.$defs},Ue(t.$ref))}function dv(e,t){return dt(t)||t.allOf.some(r=>tn(e,r))}function lv(e,t){return dt(t)||s.Keys(t.properties).some(r=>tn(e,t.properties[r]))}function gv(e,t){return dt(t)||tn(e,me(t))}function AS(e,t){return Pc.has(t.$ref)?!1:(Pc.add(t.$ref),dt(t)||s.HasPropertyKey(e,t.$ref)&&tn(e,e[t.$ref]))}function xv(e,t){return dt(t)||t.items.some(r=>tn(e,r))}function Iv(e,t){return dt(t)||t.anyOf.some(r=>tn(e,r))}function tn(e,t){return H(t)?pv(e,t):ie(t)?fv(e,t):C(t)?dv(e,t):A(t)?lv(e,t):te(t)?gv(e,t):Z(t)?AS(e,t):j(t)?xv(e,t):S(t)?Iv(e,t):dt(t)}var Pc=new Set;function OS(...e){let[t,r]=G.Match(e,{2:(n,o)=>[n,o],1:n=>[{},n]});return Pc.clear(),tn(t,r)}var Kt=class extends Error{constructor(t,r){super(r),this.type=t}};function MS(e,t){return s.IsFunction(t.default)?t.default(t):s.IsObject(t.default)?ue(t.default):t.default}function FS(e,t){if(Dr(t)&&!St(t))throw new Kt(t,"Arrays with uniqueItems constraints must specify a default annotation");let r=dn(t)?t.minItems:0;return Array.from({length:r},()=>Oe(e,t.items))}function vS(e,t){return yr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):br(t)?BigInt(t.minimum):BigInt(0)}function LS(e,t){return!1}function _S(e,t){let r=Oe(e,t.instanceType);return class{constructor(){Object.assign(this,r)}}}function DS(e,t){return Oe({...e,...t.$defs},Ue(t.$ref))}function NS(e,t){return Oe(e,Be(t))}function jS(e,t){let r=Oe(e,t.returnType);return()=>r}function US(e,t){return yr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:br(t)?t.minimum:0}function qS(e,t){let r=_t(e,t),n=Be(r);return Oe(e,n)}function GS(e,t){return t.const}function KS(e,t){throw new Kt(t,"Cannot create TNever types")}function BS(e,t){return null}function HS(e,t){return yr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:br(t)?t.minimum:0}function zS(e,t){return(s.IsUndefined(t.required)?[]:t.required).reduce((n,o)=>({...n,[o]:Oe(e,t.properties[o])}),{})}function WS(e,t){if(vo(t)&&!St(t))throw new Kt(t,"Record with the minProperties constraint must have a default annotation");return{}}function VS(e,t){return s.HasPropertyKey(e,t.$ref)?Oe(e,e[t.$ref]):(()=>{throw new Kt(t,"Unable to deref Ref")})()}function JS(e,t){if((Lo(t)||Oo(t))&&!St(t))throw Error("Strings with format or pattern constraints must specify default");let n=Fo(t)?t.minLength:0;return"".padEnd(n)}function XS(e,t){return Symbol()}function QS(e,t){let r=Yn(t.pattern);if(De(r))throw new Kt(t,"Unable to create TemplateLiteral due to infinite type expansion");return Oe(e,r)}function YS(e,t){return Array.from({length:t.minItems},(r,n)=>Oe(e,t.items[n]))}function ZS(e,t){if(s.IsEqual(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return Oe(e,t.anyOf[0])}function Oe(e,t){return St(t)?MS(e,t):H(t)?FS(e,t):kt(t)?vS(e,t):lt(t)?LS(e,t):ke(t)?_S(e,t):ie(t)?DS(e,t):Re(t)?NS(e,t):Te(t)?jS(e,t):Ke(t)?US(e,t):C(t)?qS(e,t):B(t)?GS(e,t):yt(t)?KS(e,t):ur(t)?BS(e,t):ge(t)?HS(e,t):A(t)?zS(e,t):te(t)?WS(e,t):Z(t)?VS(e,t):De(t)?JS(e,t):cr(t)?XS(e,t):se(t)?QS(e,t):j(t)?YS(e,t):Gt(t)?void 0:S(t)?ZS(e,t):wt(t)?void 0:void 0}function Qe(...e){let[t,r]=G.Match(e,{2:(n,o)=>[n,o],1:n=>[{},n]});return Oe(t,r)}function Ga(e,t){return s.IsDeepEqual(e,t)}function Ka(e){return Sr.Hash(e)}var Ba=class extends $r{constructor(t,r){super("Parse",t,r)}};function hv(e,t,r){if(!K(e,t,r))throw new Ba(r,Vt(e,t,r));return r}var yv=xo([(e,t,r)=>ue(r),(e,t,r)=>en(e,t,r),(e,t,r)=>gr(e,t,r),(e,t,r)=>Qt(e,t,r),(e,t,r)=>hv(e,t,r)]);function e$(...e){let[t,r,n]=G.Match(e,{3:(i,a,m)=>[i,a,m],2:(i,a)=>[{},i,a]});if(K(t,r,n))return n;if(Me.Get().correctiveParse)return yv(t,r,n);throw new Ba(n,Vt(t,r,n))}function Ha(e,t){return{type:"update",path:e,value:t}}function r$(e,t){return{type:"insert",path:e,value:t}}function n$(e){return{type:"delete",path:e}}function t$(e){if(!(s.IsObject(e)&&s.IsEqual(s.Symbols(e).length,0)))throw new Error("Cannot create diffs for objects with symbols keys")}function*bv(e,t,r){if(!s.IsObject(r)||s.IsArray(r))return yield Ha(e,r);t$(t),t$(r);let n=s.Keys(t),o=s.Keys(r);for(let i of o)s.HasPropertyKey(t,i)||s.IsUnsafePropertyKey(i)||(yield r$(`${e}/${i}`,r[i]));for(let i of n)s.HasPropertyKey(r,i)&&(s.IsUnsafePropertyKey(i)||Ga(t,r)||(yield*za(`${e}/${i}`,t[i],r[i])));for(let i of n)s.HasPropertyKey(r,i)||s.IsUnsafePropertyKey(i)||(yield n$(`${e}/${i}`))}function*Ev(e,t,r){if(!s.IsArray(r))return yield Ha(e,r);for(let n=0;n<Math.min(t.length,r.length);n++)yield*za(`${e}/${n}`,t[n],r[n]);for(let n=0;n<r.length;n++)n<t.length||(yield r$(`${e}/${n}`,r[n]));for(let n=t.length-1;n>=0;n--)n<r.length||(yield n$(`${e}/${n}`))}function*Sv(e,t,r){let n=globalThis.Object.getPrototypeOf(t).constructor.name,o=globalThis.Object.getPrototypeOf(r).constructor.name;if(Le.IsTypeArray(r)&&s.IsEqual(t.length,r.length)&&s.IsEqual(n,o))for(let a=0;a<Math.min(t.length,r.length);a++)yield*za(`${e}/${a}`,t[a],r[a]);else return yield Ha(e,r)}function*$v(e,t,r){t!==r&&(yield Ha(e,r))}function*za(e,t,r){return Le.IsTypeArray(t)?yield*Sv(e,t,r):s.IsArray(t)?yield*Ev(e,t,r):s.IsObject(t)?yield*bv(e,t,r):yield*$v(e,t,r)}function o$(e,t){return[...za("",e,t)]}var kv=P({type:U("insert"),path:gt(),value:_e()}),Tv=Object({type:U("update"),path:gt(),value:_e()}),wv=P({type:U("delete"),path:gt()}),zwe=v([kv,Tv,wv]);function Rv(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function Cv(e){return e.length===0}function i$(e,t){if(Rv(t))return ue(t[0].value);if(Cv(t))return ue(e);let r=ue(e);for(let n of t)switch(n.type){case"insert":{nr.Set(r,n.path,n.value);break}case"update":{nr.Set(r,n.path,n.value);break}case"delete":{nr.Delete(r,n.path);break}}return r}var wr=class extends Error{constructor(t,r,n,o){super(o),this.context=t,this.type=r,this.value=n}};function Pv(e){let[t,r]=[new Set,[]];for(let n of e){let o=Ka(n);t.has(o)||(t.add(o),r.push(n))}return r}function s$(e,t,r){if(K(e,t,r))return r;let n=s.IsArray(r)?r:Qe(e,t),o=dn(t)&&n.length<t.minItems?[...n,...Array.from({length:t.minItems-n.length},()=>Qe(e,t))]:n,a=(Mo(t)&&o.length>t.maxItems?o.slice(0,t.maxItems):o).map(c=>Ne(e,t.items,c));if(!Dr(t)||Dr(t)&&!s.IsEqual(t.uniqueItems,!0))return a;let m=Pv(a);if(!K(e,t,m))throw new wr(e,t,r,"Failed to repair Array due to uniqueItems constraint");return m}function a$(e,t,r){return Ne(e,Be(t),r)}function m$(e,t,r){let n=_t(e,t),o=Be(n);return Ne(e,o,r)}function u$(e,t,r){if(K(e,t,r))return r;if(!s.IsObjectNotArray(r))return Qe(e,t);let n=new Set(s.IsUndefined(t.required)?[]:t.required),o={};for(let[a,m]of s.Entries(t.properties))!n.has(a)&&s.IsUndefined(r[a])||(o[a]=a in r?Ne(e,m,r[a]):Qe(e,m));let i=s.Keys(t.properties);if(Ut(t)&&s.IsObject(t.additionalProperties))for(let a of s.Keys(r))i.includes(a)||(o[a]=Ne(e,t.additionalProperties,r[a]));return o}function c$(e,t,r){if(K(e,t,r))return r;if(s.IsNull(r)||!s.IsObject(r)||s.IsArray(r))return Qe(e,t);let n=new RegExp(Ge(t)),o=me(t),i=new Set,a={};for(let[m,c]of s.Entries(r))n.test(m)&&(a[m]=Ne(e,o,c),i.add(m));if(Ut(t))for(let m of s.Keys(r))i.has(m)||(a[m]=Ne(e,t.additionalProperties,r[m]));return a}function p$(e,t,r){return s.HasPropertyKey(e,t.$ref)?Ne(e,e[t.$ref],r):(()=>{throw new wr(e,t,r,"Unable to de-reference target type")})()}function f$(e,t,r){let n=Yn(t.pattern);return Ne(e,n,r)}function d$(e,t,r){return K(e,t,r)?r:s.IsArray(r)?t.items.map((n,o)=>Ne(e,n,r[o])):Qe(e,t)}function l$(e,t,r){return Z(t)?s.HasPropertyKey(e,t.$ref)?l$(e,e[t.$ref],r):(()=>{throw new Error("Unable to Deref target")})():t}function Av(e,t,r){if(!(A(t)&&s.IsObject(r)))return 0;let n=s.Keys(r);return s.Entries(t.properties).reduce((i,[a,m])=>{let c=B(m)&&s.IsEqual(m.const,r[a])?100:0,p=K(e,m,r[a])?10:0,f=n.includes(a)?1:0;return i+(c+p+f)},0)}function g$(e,t,r){let n=t.anyOf.map(a=>l$(e,a,r)),[o,i]=[n[0],0];for(let a of n){let m=Av(e,a,r);m>i&&(o=a,i=m)}return o}function Ov(e,t,r){let n=v(Wr(t.anyOf)),o=g$(e,n,r);return Ne(e,o,r)}function x$(e,t,r){return K(e,t,r)?ue(r):St(t)?Qe(e,t):Ov(e,t,r)}function I$(e,t,r){if(K(e,t,r))return r;let n=gr(e,t,r);return K(e,t,n)?n:Qe(e,t)}function Mv(e,t,r){if(Le.IsDate(r)||Le.IsMap(r)||Le.IsSet(r)||Le.IsTypeArray(r)||s.IsConstructor(r)||s.IsFunction(r))throw new wr(e,t,r,"Value is not repairable")}function Fv(e,t,r){if(ke(t)||Te(t)||yt(t))throw new wr(e,t,r,"Type is not repairable")}function vv(e,t,r){return s.IsUndefined(r)&&!Gt(t)?Qe(e,t):r}function Lv(e,t,r){return Qo(t)?K(e,t,r)?r:Qe(e,t):r}function Ne(e,t,r){Mv(e,t,r),Fv(e,t,r);let n=vv(e,t,r),o=H(t)?s$(e,t,n):Re(t)?a$(e,t,n):C(t)?m$(e,t,n):A(t)?u$(e,t,n):te(t)?c$(e,t,n):Z(t)?p$(e,t,n):se(t)?f$(e,t,n):j(t)?d$(e,t,n):S(t)?x$(e,t,n):I$(e,t,n);return Lv(e,t,o)}function h$(...e){let[t,r,n]=G.Match(e,{3:(i,a,m)=>[i,a,m],2:(i,a)=>[{},i,a]}),o=Ne(t,r,n);return Ls(t,r,o),o}var Io={};At(Io,{Assert:()=>Ls,Check:()=>K,Clean:()=>Qt,Clone:()=>ue,Convert:()=>gr,Create:()=>Qe,Decode:()=>CS,Default:()=>en,Diff:()=>o$,Encode:()=>PS,Equal:()=>Ga,Errors:()=>Vt,HasCodec:()=>OS,Hash:()=>Ka,Parse:()=>e$,Patch:()=>i$,Pointer:()=>nr,Repair:()=>h$});var Uv=jv(It,"hooks.json"),y$=64*1024,S$=30,b$=["PreToolUse","PostToolUse","UserPromptSubmit","SessionStart","Stop","PreCompact","SessionEnd"];function gPe(e,t){if(t===null||typeof t!="object"||Array.isArray(t))return"the rewrite is not a JSON object";if(!(e===null||typeof e!="object"))try{if(Io.Check(e,t))return;let r=[...Io.Errors(e,t)][0];if(!r)return"the rewrite does not match the tool's schema";let n="instancePath"in r?String(r.instancePath):"";return`the rewrite does not match the tool's schema${n&&n!=="/"?` at \`${n}\``:""}: ${r.message}`}catch(r){return`the tool's schema could not be checked: ${r instanceof Error?r.message:String(r)}`}}function xPe(e=Uv){let t=[],r={hooks:{}};try{if(!Dv(e))return{config:r,diagnostics:t};let n=Nv(e,"utf8");if(Buffer.byteLength(n,"utf8")>y$)return t.push({source:e,message:`skipped: larger than ${y$} bytes`}),{config:r,diagnostics:t};let o=JSON.parse(n),i=qv(o);for(let a of i.diagnostics)t.push({source:e,message:a});return{config:i.config,diagnostics:t}}catch(n){return t.push({source:e,message:`unreadable: ${n instanceof Error?n.message:String(n)}`}),{config:r,diagnostics:t}}}function qv(e){let t=[],r={hooks:{}};if(e===null||typeof e!="object"||Array.isArray(e))return{config:r,diagnostics:["expected a JSON object with a `hooks` key"]};let n=e.hooks;if(n===void 0)return{config:r,diagnostics:["no `hooks` key"]};if(n===null||typeof n!="object"||Array.isArray(n))return{config:r,diagnostics:["`hooks` must be an object keyed by event name"]};for(let[o,i]of Object.entries(n)){if(!b$.includes(o)){t.push(`unknown event \`${o}\` \u2014 supported: ${b$.join(", ")}`);continue}if(!Array.isArray(i)){t.push(`\`${o}\` must be an array of matchers`);continue}let a=[];for(let m of i){let c=Gv(m,o,t);c&&a.push(c)}a.length&&(r.hooks[o]=a)}return{config:r,diagnostics:t}}function Gv(e,t,r){if(e===null||typeof e!="object"||Array.isArray(e)){r.push(`\`${t}\`: a matcher must be an object`);return}let n=e,o=Array.isArray(n.hooks)?n.hooks:void 0;if(!o){r.push(`\`${t}\`: a matcher needs a \`hooks\` array`);return}let i=[];for(let m of o){if(m===null||typeof m!="object")continue;let c=m,p=typeof c.type=="string"?c.type:"command";if(p!=="command"){r.push(`\`${t}\`: only \`type: "command"\` is supported, got \`${p}\``);continue}if(typeof c.command!="string"||!c.command.trim()){r.push(`\`${t}\`: a hook needs a non-empty \`command\``);continue}let f=typeof c.timeout=="number"&&Number.isFinite(c.timeout)&&c.timeout>0?c.timeout:void 0;i.push({type:"command",command:c.command,timeout:f,...c.async===!0?{async:!0}:{},...c.once===!0?{once:!0}:{}})}return i.length?{matcher:typeof n.matcher=="string"?n.matcher:void 0,hooks:i}:void 0}function Kv(e,t,r){let n=e.hooks[t];return n?n.filter(o=>{let i=o.matcher?.trim();if(!i||i==="*")return!0;if(r===void 0)return!1;let a=r.toLowerCase();return i.split("|").map(m=>m.trim().toLowerCase()).filter(Boolean).includes(a)}):[]}function E$(e,t,r={cwd:process.cwd()}){let n=r.timeoutS??S$;return new Promise(o=>{let i="",a="",m=!1,c=!1,p=_v(e,{cwd:r.cwd,shell:!0,stdio:["pipe","pipe","pipe"]});p.stdin?.on("error",()=>{}),p.stdout?.on("error",()=>{}),p.stderr?.on("error",()=>{});let f=setTimeout(()=>{m=!0,p.kill("SIGKILL")},n*1e3);p.stdout?.on("data",g=>{i+=g.toString("utf8")}),p.stderr?.on("data",g=>{a+=g.toString("utf8")});let d=g=>{c||(c=!0,clearTimeout(f),o({code:g,stdout:i,stderr:a,timedOut:m}))};p.on("error",g=>{a+=g.message,d(null)}),p.on("close",g=>d(g));try{p.stdin?.end(JSON.stringify(t))}catch{}})}function Bv(e){let{code:t,stdout:r,stderr:n,timedOut:o}=e,i=n.trim();if(o)return{block:!1,error:`timed out after ${S$}s and was killed`};let a=Hv(r),m=a?.hookSpecificOutput,c=typeof m?.additionalContext=="string"?m.additionalContext:typeof a?.additionalContext=="string"?a.additionalContext:void 0,p=typeof m?.permissionDecision=="string"?m.permissionDecision:void 0,f=typeof m?.permissionDecisionReason=="string"?m.permissionDecisionReason:void 0,d=m?.updatedInput,g=d!==null&&typeof d=="object"&&!Array.isArray(d)?d:void 0;return p==="deny"||p==="block"?{block:!0,reason:f||i||"denied by a hook",context:c}:p==="allow"?{block:!1,context:c,updatedInput:g}:t===2?{block:!0,reason:i||"blocked by a hook",context:c}:t!==0?{block:!1,context:c,updatedInput:g,error:`exited ${t===null?"without a status":t}${i?`: ${i}`:""}`}:!a&&r.trim()?{block:!1,context:r.trim()}:{block:!1,context:c,updatedInput:g}}function Hv(e){let t=e.trim();if(t.startsWith("{"))try{let r=JSON.parse(t);return r&&typeof r=="object"&&!Array.isArray(r)?r:void 0}catch{return}}var Ac=new Set;function IPe(){Ac.clear()}async function hPe(e,t,r,n){let o=Kv(e,t,r.tool_name);if(!o.length)return{outcome:{block:!1},ran:0};let i=[],a=0,m,c,p;for(let f of o)for(let d of f.hooks){if(d.once){let h=`${t}\0${d.command}`;if(Ac.has(h))continue;Ac.add(h)}if(a+=1,d.async){E$(d.command,r,{cwd:n.cwd,timeoutS:d.timeout}).catch(()=>{});continue}let g=await E$(d.command,r,{cwd:n.cwd,timeoutS:d.timeout}),I=Bv(g);I.context&&i.push(I.context),I.error&&(c=I.error),I.updatedInput&&(p=I.updatedInput),I.block&&!m&&(m=I)}return m?{outcome:{block:!0,reason:m.reason,context:i.join(`
|
|
8
|
+
|
|
9
|
+
`)||void 0},ran:a}:{outcome:{block:!1,context:i.join(`
|
|
10
|
+
|
|
11
|
+
`)||void 0,error:c,updatedInput:p},ran:a}}import{existsSync as $$,readFileSync as zv}from"node:fs";function Wv(e){return`${e}/.howtofix/mcp.json`}function Oc(e,t){if(!$$(e))return{};try{let n=JSON.parse(zv(e,"utf8"))?.mcpServers;return!n||typeof n!="object"||Array.isArray(n)?{}:n}catch(r){return t.push(`${e}: ${r instanceof Error?r.message:String(r)}`),{}}}function $Pe(e){let t=[];return Oc(Li(e??It),t)}function kPe(e){let t=[],r=Oc(Li(e.agentDir??It),t),n=Wv(e.cwd),o=e.projectTrusted&&$$(n)?n:void 0,i=o?Oc(o,t):{},a=Li(e.agentDir??It),m=new Map;for(let[c,p]of Object.entries(r))m.set(c,{name:c,config:p,source:a,scope:"global"});for(let[c,p]of Object.entries(i))m.set(c,{name:c,config:p,source:o,scope:"project"});return{servers:[...m.values()],errors:t,projectConfig:o}}import{mkdirSync as Vv,readdirSync as Jv,readFileSync as Xv,renameSync as Qv,unlinkSync as Yv,writeFileSync as Zv}from"node:fs";import{join as k$}from"node:path";var eL=180*1e3,CPe="presence";function T$(e,t){return k$(e.dir,`${t.replace(/[^A-Za-z0-9._-]/g,"_")}.json`)}function tL(e,t=Date.now()){let r;try{r=Jv(e.dir)}catch{return[]}let n=[];for(let o of r)if(o.endsWith(".json"))try{let i=JSON.parse(Xv(k$(e.dir,o),"utf8"));if(typeof i?.id!="string"||typeof i?.cwd!="string"||typeof i?.at!="number"||t-i.at>=eL)continue;n.push({id:i.id,cwd:i.cwd,host:typeof i.host=="string"?i.host:"",pid:typeof i.pid=="number"?i.pid:0,at:i.at,...typeof i.activity=="string"&&i.activity?{activity:i.activity}:{}})}catch{}return n.sort((o,i)=>i.at-o.at)}function PPe(e,t){Vv(e.dir,{recursive:!0});let r=T$(e,t.id),n=`${r}.${process.pid}.tmp`;Zv(n,JSON.stringify(t,null,2)),Qv(n,r)}function APe(e,t){try{Yv(T$(e,t))}catch{}}function w$(e,t,r,n=Date.now()){return tL(e,n).filter(o=>o.cwd===t&&o.id!==r)}import{Type as Ye}from"@netrodev/hxf-ai";import{defineTool as Wa}from"@netrodev/hxf-coding-agent";import{relative as pL,join as fL}from"node:path";import{mkdirSync as dL,writeFileSync as lL}from"node:fs";import{existsSync as FPe,mkdirSync as rL,readFileSync as nL,renameSync as oL,writeFileSync as iL}from"node:fs";import{dirname as sL,isAbsolute as aL,join as P$,relative as mL,resolve as R$,sep as C$}from"node:path";var uL=1800*1e3,cL=P$(".howtofix","claims.json");function A$(e){return P$(e,cL)}function Fc(e,t){try{let r=nL(A$(e),"utf8"),n=JSON.parse(r);return(Array.isArray(n.claims)?[...n.claims]:[]).filter(i=>typeof i?.path=="string"&&typeof i?.holder=="string"&&typeof i?.at=="number"&&t-i.at<uL)}catch{return[]}}function O$(e,t){let r=A$(e);rL(sL(r),{recursive:!0});let n=`${r}.${process.pid}.tmp`;iL(n,JSON.stringify({version:1,claims:[...t]},null,2)),oL(n,r)}function M$(e,t){return aL(t)?R$(t):R$(e,t)}function F$(e,t){if(e===t)return!0;let r=n=>n.endsWith(C$)?n:n+C$;return e.startsWith(r(t))||t.startsWith(r(e))}function v$(e){let t=e.now??Date.now(),r=Fc(e.root,t),n=[],o=[],i=[];for(let a of e.paths){if(!a.trim())continue;let m=M$(e.root,a.trim()),c=r.find(p=>p.holder!==e.holder&&F$(p.path,m));if(c){o.push({path:Mc(e.root,m),by:c.holder,reason:c.reason||"no reason given"});continue}n.push(Mc(e.root,m)),i.push({path:m,holder:e.holder,reason:e.reason,at:t})}if(i.length>0){let a=r.filter(m=>m.holder!==e.holder||!i.some(c=>c.path===m.path));O$(e.root,[...a,...i])}return{granted:n,conflicts:o}}function L$(e,t,r){let n=Date.now(),o=Fc(e,n),i=r?.length?r.map(c=>M$(e,c.trim())).filter(Boolean):void 0,a=[],m=[];for(let c of o){let p=c.holder===t,f=i===void 0||i.some(d=>F$(c.path,d));p&&f?m.push(Mc(e,c.path)):a.push(c)}return O$(e,a),m}function vc(e,t=Date.now()){return Fc(e,t)}function Mc(e,t){let r=mL(e,t);return r&&!r.startsWith("..")?r:t}var Lc;function KPe(e){Lc=e}var BPe=Wa({name:"think",label:"think",description:"Private scratchpad. The text is not shown to the user. Use it before a non-obvious step.",promptSnippet:"think: private notes, not shown to the user",parameters:Ye.Object({thoughts:Ye.String({description:"Private notes"})}),async execute(){return{content:[{type:"text",text:"noted"}],details:{recorded:!0}}}}),HPe=Wa({name:"ask",label:"ask",description:"Ask the user one question and wait for a selected answer. Use this instead of guessing when a choice blocks the task.",promptSnippet:"ask: ask the user to pick one option",parameters:Ye.Object({question:Ye.String(),options:Ye.Array(Ye.String(),{minItems:2})}),async execute(e,t){if(!Lc)return{content:[{type:"text",text:"cancelled"}],details:{answer:"cancelled"}};let r=await Lc(t.question,t.options);return{content:[{type:"text",text:r}],details:{answer:r}}}}),Ri;function zPe(e){Ri=e}var WPe=Wa({name:"sessions",label:"sessions",description:"See the other HowToFix sessions working in this workspace, what they hold, and what they are doing. Use it to find who is blocking a claim, or to tell another session to release a file. Send a message with message + to.",promptSnippet:"sessions: other CLI sessions, and who holds what",parameters:Ye.Object({message:Ye.Optional(Ye.String({description:"Message text to leave for another session."})),to:Ye.Optional(Ye.String({description:"Session id to send the message to. Use `all` for every other session."}))}),async execute(e,t){let r=Ri,n=r?.presenceDir?.();if(!r||!n)return{content:[{type:"text",text:"the session registry is unavailable here"}],details:{}};let o=r.selfId?.()??"",i=r.root(),a=w$({dir:n},i);if(t.message&&t.message.trim()){let c=t.to?.trim()||"all",p=a.filter(f=>f.id!==o&&(c==="all"||f.id===c));if(p.length===0)return{content:[{type:"text",text:"no other session in this workspace to message"}],details:{sent:0}};for(let f of p){let d=fL(n,`${f.id.replace(/[^A-Za-z0-9._-]/g,"_")}.inbox`);try{dL(n,{recursive:!0}),lL(d,`${JSON.stringify({from:o,at:Date.now(),text:t.message.trim()})}
|
|
12
|
+
`,{flag:"a"})}catch{}}return{content:[{type:"text",text:`left a message for ${p.map(f=>f.id).join(", ")}`}],details:{sent:p.length}}}if(a.length===0)return{content:[{type:"text",text:"no other session in this workspace"}],details:{sessions:[]}};let m=a.map(c=>{let p=c.id===o?"this session":c.id,f=vc(i).filter(I=>I.holder===`session:${c.id}`),d=c.activity?` \u2014 ${c.activity}`:"",g=f.length>0?`
|
|
13
|
+
holds:
|
|
14
|
+
${f.map(I=>` ${D$(i,I.path)} \u2014 ${I.reason}`).join(`
|
|
15
|
+
`)}`:"";return` ${p} (pid ${c.pid}${c.id===o?"":`, seen ${Math.round((Date.now()-c.at)/1e3)}s ago`})${d}${g}`});return{content:[{type:"text",text:`sessions in ${i}:
|
|
16
|
+
${m.join(`
|
|
17
|
+
`)}`}],details:{sessions:a}}}});function gL(e){let t=[];if(e.granted.length>0&&t.push(`claimed: ${e.granted.join(", ")}`),e.conflicts.length>0){t.push(""),t.push("refused \u2014 another agent is working on these:");for(let r of e.conflicts)t.push(` ${r.path} \u2014 held by ${r.by}: ${r.reason}`);t.push(""),t.push("Wait for the holder to release it, or work on something else. Do not edit a refused path.")}return t.length===0&&t.push("nothing to claim"),{text:t.join(`
|
|
18
|
+
`),isError:e.conflicts.length>0}}var _$=Wa({name:"claim",label:"claim",description:"Claim files or directories before editing them, so a parallel agent cannot overwrite your work. Refused paths are held by someone else \u2014 do not edit them. Pass no paths to list every claim in this workspace.",promptSnippet:"claim: reserve files before editing",parameters:Ye.Object({paths:Ye.Optional(Ye.Array(Ye.String(),{description:"Files or directories to claim. Omit to list the current claims."})),reason:Ye.Optional(Ye.String({description:"Why you are taking them, shown to a refused agent."})),release:Ye.Optional(Ye.Boolean({description:"Release these paths instead of claiming them. Omit paths to release everything you hold."}))}),async execute(e,t){if(!Ri)return{content:[{type:"text",text:"claims are unavailable in this session"}],details:{},isError:!0};let r=Ri.root(),n=Ri.holder();if(t.release){let m=L$(r,n,t.paths);return{content:[{type:"text",text:m.length>0?`released: ${m.join(", ")}`:"you held nothing matching that"}],details:{released:m}}}if(!t.paths||t.paths.length===0){let m=vc(r);return m.length===0?{content:[{type:"text",text:"no active claims in this workspace"}],details:{claims:[]}}:{content:[{type:"text",text:m.map(p=>`${p.holder===n?"(you) ":""}${D$(r,p.path)} \u2014 ${p.reason}`).join(`
|
|
19
|
+
`)}],details:{claims:m}}}let o=v$({root:r,holder:n,reason:t.reason??"no reason given",paths:t.paths}),{text:i,isError:a}=gL(o);return{content:[{type:"text",text:i}],isError:a,details:o}}});function D$(e,t){let r=pL(e,t);return r&&!r.startsWith("..")?r:t}import{StringEnum as xL}from"@netrodev/hxf-ai";import{defineTool as IL}from"@netrodev/hxf-coding-agent";var O={};At(O,{Any:()=>Vn,Array:()=>ht,BigInt:()=>Yo,Boolean:()=>Us,Call:()=>Ly,Capitalize:()=>Gy,Codec:()=>js,Conditional:()=>Xy,Constructor:()=>or,ConstructorParameters:()=>Yy,Cyclic:()=>ar,Decode:()=>ql,DecodeBuilder:()=>Xo,Dependent:()=>bn,Encode:()=>Gl,EncodeBuilder:()=>Jo,Enum:()=>jl,Evaluate:()=>Be,Exclude:()=>eb,Extends:()=>tt,ExtendsResult:()=>M,Extract:()=>rb,Function:()=>ir,Generic:()=>Kr,Identifier:()=>Zo,Immutable:()=>Kl,Index:()=>sb,Infer:()=>Vo,InstanceType:()=>Ab,Instantiate:()=>_t,Integer:()=>kn,Interface:()=>xy,Intersect:()=>ot,IsAny:()=>Ee,IsArray:()=>H,IsBigInt:()=>kt,IsBoolean:()=>lt,IsCall:()=>uo,IsCodec:()=>dt,IsConstructor:()=>ke,IsCyclic:()=>ie,IsDependent:()=>we,IsEnum:()=>Re,IsEnumValue:()=>Nl,IsFunction:()=>Te,IsGeneric:()=>Wn,IsIdentifier:()=>Wl,IsImmutable:()=>En,IsInfer:()=>ve,IsInteger:()=>Ke,IsIntersect:()=>C,IsKind:()=>k,IsLiteral:()=>B,IsNever:()=>yt,IsNull:()=>ur,IsNumber:()=>ge,IsObject:()=>A,IsOptional:()=>qe,IsParameter:()=>Xl,IsReadonly:()=>$n,IsRecord:()=>te,IsRef:()=>Z,IsRefine:()=>Qo,IsRest:()=>Jr,IsSchema:()=>be,IsString:()=>De,IsSymbol:()=>cr,IsTemplateLiteral:()=>se,IsThis:()=>ea,IsTuple:()=>j,IsUndefined:()=>Gt,IsUnion:()=>S,IsUnknown:()=>Fe,IsUnsafe:()=>Ns,IsVoid:()=>wt,KeyOf:()=>Mb,Literal:()=>U,Lowercase:()=>Ky,Mapped:()=>Ub,Module:()=>CE,Never:()=>re,NonNullable:()=>Bb,Null:()=>Xn,Number:()=>Tt,Object:()=>P,Omit:()=>zb,Optional:()=>Ol,Parameter:()=>Tn,Parameters:()=>Jb,Partial:()=>Qb,Pick:()=>oE,Readonly:()=>Bl,ReadonlyObject:()=>hc,ReadonlyType:()=>aE,Record:()=>to,RecordKey:()=>Vr,RecordPattern:()=>Ge,RecordValue:()=>me,Ref:()=>Ue,Refine:()=>Hl,Required:()=>SE,Rest:()=>wn,ReturnType:()=>kE,Script:()=>ME,String:()=>gt,Symbol:()=>Qn,TemplateLiteral:()=>Lh,This:()=>Zs,Tuple:()=>Ce,Uncapitalize:()=>By,Undefined:()=>ro,Union:()=>v,Unknown:()=>_e,Unsafe:()=>vl,Uppercase:()=>Hy,Void:()=>ta,With:()=>ja});var hL={pending:"[ ]",in_progress:"[>]",completed:"[x]",dropped:"[-]"},yL=O.Object({op:xL(["init","start","done","drop","view"],{description:"init replaces the list; start/done/drop move one task; view reads it"}),items:O.Optional(O.Array(O.String(),{description:"Task labels for init. 5-10 words each, specific enough to execute without re-planning"})),task:O.Optional(O.String({description:"Exact label of the task to start, complete or drop"}))});function N$(e){if(e.length===0)return"Todo list is empty.";let t=e.filter(o=>o.status==="completed").length,r=e.map(o=>`${hL[o.status]} ${o.content}`),n=e.filter(o=>o.status==="pending"||o.status==="in_progress").length;return[`${t}/${e.length} done, ${n} open`,...r].join(`
|
|
20
|
+
`)}function bL(e,t,r,n){let o=e.map(i=>({...i}));switch(t){case"init":return!r||r.length===0?{todos:o,error:"init needs a non-empty items array"}:{todos:r.map(i=>({content:i,status:"pending"}))};case"view":return{todos:o};case"start":case"done":case"drop":{if(!n)return{todos:o,error:`${t} needs task`};let i=o.find(a=>a.content===n);if(!i)return{todos:o,error:`no task matches ${JSON.stringify(n)}`};if(t==="start"){for(let a of o)a.status==="in_progress"&&(a.status="pending");i.status="in_progress"}else i.status=t==="done"?"completed":"dropped";return{todos:o}}default:return{todos:o,error:`unknown op ${JSON.stringify(t)}`}}}function EL(e){let t=[];for(let r of e.sessionManager.getBranch()){if(r.type!=="message")continue;let n=r.message;if(n.role!=="toolResult"||n.toolName!=="todo")continue;let o=n.details;o?.todos&&(t=o.todos)}return t}var j$=IL({name:"todo",label:"todo",description:"Track the plan for this task. Use `init` once with the whole plan (investigation through verification), then `start`/`done` as you go. Keep the list current so progress stays visible; do not re-init unless the plan materially changes.",promptSnippet:"todo: record and advance the plan for the current task",parameters:yL,async execute(e,t,r,n,o){let i=EL(o),{todos:a,error:m}=bL(i,t.op,t.items,t.task),c={op:t.op,todos:a,...m?{error:m}:{}};return{content:[{type:"text",text:m?`Error: ${m}
|
|
21
|
+
${N$(a)}`:N$(a)}],details:c,...m?{isError:!0}:{}}}});import{StringEnum as SL}from"@netrodev/hxf-ai";import{defineTool as $L}from"@netrodev/hxf-coding-agent";var Rr=new Map,U$=2e3,q$=80;function G$(){return Rr.size===0?"":["<shared-notes>","Working notes recorded with the `context` tool. They survive compaction and are visible to every agent on this task.",...[...Rr].map(([t,r])=>`- ${t}: ${r}`),"</shared-notes>"].join(`
|
|
22
|
+
`)}function kL(e,t,r){if(e==="list")return Rr.size===0?{text:"No notes."}:{text:[...Rr].map(([n,o])=>`${n} = ${o}`).join(`
|
|
23
|
+
`)};if(!t)return{text:"Error: key is required",error:"key required"};if(t.length>q$)return{text:`Error: key longer than ${q$} characters`,error:"key too long"};if(e==="forget")return{text:Rr.delete(t)?`Removed ${t}`:`No note named ${t}`};if(e==="set"){if(!r)return{text:"Error: value is required for set",error:"value required"};let n=r.length>U$?`${r.slice(0,U$)}\u2026`:r;return Rr.set(t,n),{text:`Recorded ${t} (${Rr.size} note${Rr.size===1?"":"s"} held)`}}return{text:`Error: unknown op ${JSON.stringify(e)}`,error:"unknown op"}}var K$=$L({name:"context",label:"context",description:"Record a durable working note (a decision, a file's role, a fact you would otherwise re-derive). Notes survive context compaction and are visible to every agent on this task, including subagents. Use `set` to write, `list` to read, `forget` to remove.",promptSnippet:"context: durable notes shared with every agent on this task",parameters:O.Object({op:SL(["set","list","forget"],{description:"set writes a note, list reads all, forget removes one"}),key:O.Optional(O.String({description:"Short lookup key, e.g. 'auth-entrypoint'"})),value:O.Optional(O.String({description:"The fact to keep (for set)"}))}),async execute(e,t){let{text:r,error:n}=kL(t.op,t.key,t.value);return{content:[{type:"text",text:r}],details:{op:t.op,notes:Object.fromEntries(Rr)},...n?{isError:!0}:{}}}});import{StringEnum as TL}from"@netrodev/hxf-ai";import{defineTool as wL}from"@netrodev/hxf-coding-agent";var B$="howtofix.goal",TAe="howtofix.goal.continue",H$=400,Va=25,z$={active:"\u25CF",paused:"\u2016",done:"\u2713",cleared:"\u25CB"};function RL(e){if(!e||e.status==="cleared")return"No goal set.";let t=e.budget??Va,r=[`${z$[e.status]} ${e.status}`,`${e.used}/${t} continuations`];return e.note&&r.push(e.note),`${r.join(" \xB7 ")}
|
|
24
|
+
${e.text}`}function wAe(e){if(!e||e.status==="cleared"||e.status==="done")return"";let t=e.budget??Va,r=e.text.length>48?`${e.text.slice(0,47)}\u2026`:e.text;return`goal ${z$[e.status]} ${e.used}/${t} \xB7 ${r}`}function RAe(e){let t=["<goal>",e.text,`Status: ${e.status}.`];return e.status==="active"&&t.push("Work toward this goal until it is genuinely met. When it is, call the `goal` tool with",'op="complete" and a note naming the evidence; a command you ran or a file you checked.',"If you are blocked and cannot proceed, say so plainly instead of repeating an attempt."),t.push("</goal>"),t.join(`
|
|
25
|
+
`)}function CAe(e){return["[goal] The goal is still open and you stopped without closing it:",` ${e.text}`,"","Continue from where you left off. Do not repeat work you already did. If the goal is met,",'call the `goal` tool with op="complete" and a note naming the evidence. Do not call it',"complete to escape a hard problem: if you cannot make progress, state what is blocking you.",`Continuations used: ${e.used}/${e.budget??Va}.`].join(`
|
|
26
|
+
`)}var W$;function PAe(){return W$}function CL(e){W$=e}function AAe(e){if(!e)return{action:"stop",reason:"no goal",close:!1};if(e.status==="done")return{action:"stop",reason:"goal complete",close:!1};if(e.status==="cleared")return{action:"stop",reason:"goal cleared",close:!1};if(e.status==="paused")return{action:"stop",reason:"goal paused",close:!1};let t=e.budget??Va;return e.used>=t?{action:"stop",reason:`budget exhausted (${t} continuations)`,close:!0}:{action:"continue"}}function PL(e,t,r,n,o){switch(t){case"view":return{goal:e};case"set":return r?.trim()?r.length>H$?{goal:e,error:`text longer than ${H$} characters`}:n!==void 0&&(!Number.isInteger(n)||n<1)?{goal:e,error:"budget must be a positive integer"}:{goal:{text:r.trim(),status:"active",used:0,...n===void 0?{}:{budget:n}}}:{goal:e,error:"set needs text"};case"pause":case"resume":case"complete":case"clear":return!e||e.status==="cleared"?{goal:e,error:"no goal to change"}:t==="resume"?e.status==="done"?{goal:e,error:"goal is complete; set a new one instead"}:{goal:{...e,status:"active",note:void 0}}:t==="pause"?{goal:{...e,status:"paused"}}:t==="clear"?{goal:{...e,status:"cleared"}}:o?.trim()?{goal:{...e,status:"done",note:o.trim()}}:{goal:e,error:"complete needs a note naming the evidence (a command you ran or a file you checked)"};default:return{goal:e,error:`unknown op ${JSON.stringify(t)}`}}}function AL(e){let t;for(let r of e.sessionManager.getBranch()){if(r.type==="custom"&&r.customType===B$){t=r.data;continue}if(r.type==="custom_message"&&r.customType===B$){t=r.details??t;continue}if(r.type!=="message")continue;let n=r.message;if(n.role!=="toolResult"||n.toolName!=="goal")continue;let o=n.details;o?.goal&&(t=o.goal)}return t}var OL=O.Object({op:TL(["set","view","pause","resume","complete","clear"],{description:"set starts a goal; complete closes it with evidence; pause/resume/clear manage it; view reads it"}),text:O.Optional(O.String({description:"The goal, in one sentence, as the user would state it (for set)"})),budget:O.Optional(O.Number({description:"Optional cap on automatic continuations before the run stops"})),note:O.Optional(O.String({description:"Evidence that the goal is met (required for complete)"}))}),OAe=wL({name:"goal",label:"goal",description:"Track the goal for this session. The goal is already shown in your context every request, so you rarely need `view`. Call `complete` only when the goal is genuinely met, and pass a note naming the evidence. When a goal is active the harness continues the run if you stop without closing it, so closing it is how you stop.",promptSnippet:"goal: the session's objective, and how to close it",parameters:OL,async execute(e,t,r,n,o){let i=AL(o),{goal:a,error:m}=PL(i,t.op,t.text,t.budget,t.note);CL(a);let c=RL(a);return{content:[{type:"text",text:m?`Error: ${m}
|
|
27
|
+
${c}`:c}],details:{op:t.op,goal:a},...m?{isError:!0}:{}}}});import{existsSync as Nc,mkdirSync as V$,readFileSync as J$}from"node:fs";import{dirname as X$,join as Q$}from"node:path";import{defineTool as Y$}from"@netrodev/hxf-coding-agent";function Ja(){return{state:"inactive",wasActive:!1}}function ML(e){return e?e.state==="pending"?{...e,state:"inactive"}:{...e}:Ja()}function NAe(e){return e.state!=="inactive"?e:{...e,state:"pending"}}function FL(e){return e.state!=="pending"?e:{state:"active",wasActive:!0}}function vL(e){return e.state!=="inactive"?e:{state:"active",wasActive:!0}}function LL(e){return e.state!=="active"?e:{...e,state:"inactive"}}function jAe(e){return e.state==="inactive"?e:{...e,state:"inactive"}}function Xa(e){return e.state==="active"}function _L(e,t){return e===t}function DL(e,t){return["<plan-mode>","Plan mode is active. Do not make any edits or writes to the system.",t?`A plan file exists at ${e}. Read it and refine it with the \`edit\` tool.`:`No plan is written yet. Write yours to ${e} with the \`write\` tool.`,"That file is the only path you may edit.","Explore first: read, search, and run read-only commands until the approach is clear.","End your turn with either `ask` to clarify a requirement, or `exit_plan_mode` to present","the plan for approval. Do not start implementing before the plan is approved.","</plan-mode>"].join(`
|
|
28
|
+
`)}function NL(e){return`Rejected: file edits are not allowed in plan mode. The only editable file is the plan file (${e}). Present the plan with exit_plan_mode first.`}var st,at=Ja(),Dc;function UAe(){return at}function qAe(){return st}function GAe(){return Xa(at)}function Z$(){if(!(!st||!Nc(st)))try{let e=J$(st,"utf8");return e.trim()?e:void 0}catch{return}}function ek(){return Z$()!==void 0}function KAe(){return at.state==="inactive"?"":at.state==="pending"?"plan pending":ek()?"plan \u25CF ready":"plan \u25CF planning"}function tk(){return Dc?Q$(Dc,"plan_mode.json"):void 0}function jL(){let e=tk();if(e)try{V$(X$(e),{recursive:!0}),tr(e,JSON.stringify(at))}catch{}}function UL(){let e=tk();if(!e||!Nc(e))return Ja();try{return ML(JSON.parse(J$(e,"utf8")))}catch{return Ja()}}function qL(e){Dc=e,st=Q$(e,"plan.md"),at=UL()}function jc(e){return at=e,jL(),at}function BAe(){return e=>{e.on("tool_call",async t=>{if(!Xa(at)||t.toolName!=="edit"&&t.toolName!=="write")return;let r=t.input?.path;if(typeof r=="string"&&!(!st||_L(r,st)))return{block:!0,reason:NL(st)}})}}function HAe(){return e=>{e.on("session_start",async(t,r)=>{qL(r.sessionManager.getSessionDir())}),e.on("before_agent_start",async()=>{at.state==="pending"&&jc(FL(at))}),e.on("context_with_system",async t=>{if(!Xa(at)||!st)return;let r=t.messages[0];if(!r||r.role!=="system")return;let n=DL(st,ek()),o=`${typeof r.content=="string"?r.content:""}
|
|
29
|
+
|
|
30
|
+
${n}`;return{messages:t.messages.map(a=>a===r?{...r,content:o}:a)}})}}var _c=2e4;function GL(){if(st){try{V$(X$(st),{recursive:!0}),Nc(st)||tr(st,"")}catch{return}return st}}var zAe=Y$({name:"enter_plan_mode",label:"enter_plan_mode",description:"Enter plan mode to design an approach before writing code. Use it when a task has genuine ambiguity; several reasonable designs, or a restructuring where the wrong approach wastes significant effort. Do not use it for a clear fix, a rename, or a task that follows existing conventions. The user must approve entering.",promptSnippet:"enter_plan_mode: design first when the approach is genuinely ambiguous",parameters:O.Object({}),async execute(e,t,r,n,o){if(at.state!=="inactive")return{content:[{type:"text",text:`Plan mode is already ${at.state}.`}],details:{}};if(!o.hasUI)return{content:[{type:"text",text:"Plan mode needs an interactive session: there is no one to approve the plan. Proceed normally."}],details:{},isError:!0};if(!await o.ui.confirm("Enter plan mode?","The agent will explore and design an approach before editing anything."))return{content:[{type:"text",text:"The user declined plan mode. Proceed normally."}],details:{}};jc(vL(at));let a=GL();return{content:[{type:"text",text:["Plan mode is active. Edits are blocked except for the plan file.",a?`Write your plan to ${a}.`:"Write your plan to the session plan file."].join(`
|
|
31
|
+
`)}],details:{planFile:a}}}}),WAe=Y$({name:"exit_plan_mode",label:"exit_plan_mode",description:"Present your plan for approval when you have finished planning. The plan is read from the plan file on disk, so write the file first. If the user asks for changes, stay in plan mode and revise it.",promptSnippet:"exit_plan_mode: present the written plan for approval",parameters:O.Object({}),executionMode:"sequential",async execute(e,t,r,n,o){if(!Xa(at))return{content:[{type:"text",text:"Plan mode is not active."}],details:{},isError:!0};let i=Z$();if(!i)return{content:[{type:"text",text:`No plan has been written yet. Write it to ${st??"the plan file"} before exiting plan mode.`}],details:{},isError:!0};if(!o.hasUI)return{content:[{type:"text",text:"Plan approval needs an interactive session."}],details:{},isError:!0};let a=i.length>_c?`${i.slice(0,_c)}
|
|
32
|
+
\u2026 (${i.length-_c} more characters)`:i;return await o.ui.confirm("Approve this plan?",a)?(jc(LL(at)),{content:[{type:"text",text:"Plan approved. You may now implement it."}],details:{approved:!0,planFile:st}}):{content:[{type:"text",text:"The user did not approve the plan. Stay in plan mode, revise the plan file with the feedback, and present it again."}],details:{approved:!1}}}});function ho(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{let r=t;return r.type==="text"&&typeof r.text=="string"?r.text:""}).join(`
|
|
33
|
+
`):e==null?"":String(e)}function Qa(e,t){if(Array.isArray(e)){let r=e.map(o=>({...o})),n=r.filter(o=>o.type==="text");if(n.length>0){n[0].text=t;for(let o of n.slice(1))o.text="";return r}return[...r,{type:"text",text:t}]}return t}function rk(){return e=>{e.on("context_with_system",async t=>{let r=G$();if(!r)return;let n=t.messages[0];if(!n||n.role!=="system")return;let o=`${ho(n.content)}
|
|
34
|
+
|
|
35
|
+
${r}`;return{messages:t.messages.map(a=>a===n?{...n,content:Qa(n.content,o)}:a)}})}}var KL=/^m(\d{4})$/,BL=/^b([1-9]\d*)$/,HL=/^@([1-9]\d*)@$/,zL=/^@b([1-9]\d*)@$/,nk="dcp-message-id";function Uc(){return{nextRef:1,keyToRef:{},refToKey:{}}}function rn(e,t="xml"){let r=t==="compact"?Number.MAX_SAFE_INTEGER:9999;if(!Number.isSafeInteger(e)||e<1||e>r)throw new Error(`Message ID index out of bounds: ${e}. Supported range is 1-${r}.`);return t==="compact"?`@${e}@`:`m${e.toString().padStart(4,"0")}`}function Mn(e,t="xml"){if(!Number.isInteger(e)||e<1)throw new Error(`Invalid block ID: ${e}`);return t==="compact"?`@b${e}@`:`b${e}`}function ok(e,t="xml"){let n=e.trim().toLowerCase().match(t==="compact"?HL:KL);if(!n)return null;let o=Number.parseInt(n[1],10);if(!Number.isSafeInteger(o))return null;let i=t==="compact"?Number.MAX_SAFE_INTEGER:9999;return o<1||o>i?null:o}function ik(e,t="xml"){let n=e.trim().toLowerCase().match(t==="compact"?zL:BL);if(!n)return null;let o=Number.parseInt(n[1],10);return Number.isSafeInteger(o)?o:null}function qc(e,t="xml"){let r=e.trim().toLowerCase(),n=ok(r,t);if(n!==null)return{kind:"message",ref:rn(n,t),index:n};let o=ik(r,t);return o!==null?{kind:"compressed-block",ref:Mn(o,t),blockId:o}:null}function sk(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Gc(e){return!e.includes("<dcp-message-id")&&!e.includes("</dcp-message-id")?e:e.replace(/<dcp-message-id(?:\s[^>]*)?>[\s\S]*?<\/dcp-message-id>/gi,"").replace(/<dcp-message-id(?:\s[^>]*)?>[mb]?\d{0,6}/gi,"").replace(/<\/?dcp-message-id(?:\s[^>]*)?>?/gi,"")}function Ci(e,t,r="xml"){if(r==="compact"){if(e==="BLOCKED")return`
|
|
36
|
+
@blocked@`;let o=t?.priority;return`
|
|
37
|
+
${e}${o?` [${o}]`:""}`}let n=Object.entries(t||{}).sort(([o],[i])=>o.localeCompare(i)).map(([o,i])=>o.trim().length===0||typeof i!="string"||i.length===0?"":` ${o}="${sk(i)}"`).join("");return`
|
|
38
|
+
<${nk}${n}>${e}</${nk}>`}function WL(e){return e.role==="user"||e.role==="assistant"||e.role==="toolResult"}function ak(e){let t=new Map;return e.map(r=>{if(!WL(r))return null;let n=r.role==="toolResult"?`toolResult:${r.toolCallId}`:`${r.role}:${r.timestamp}`,o=t.get(n)??0;return t.set(n,o+1),r.role==="toolResult"?n:`${n}#${o}`})}function Kc(e,t){let r=0;for(let n of ak(t)){if(n===null||e.keyToRef[n]!==void 0)continue;let o=VL(e);e.keyToRef[n]=o,e.refToKey[String(o)]=n,r++}return r}function VL(e){let t=Number.isInteger(e.nextRef)?Math.max(1,e.nextRef):1;for(;t<=9999;){if(e.refToKey[String(t)]===void 0)return e.nextRef=t+1,t;t++}throw new Error(`Message ID alias capacity exceeded. Cannot allocate more than ${rn(9999)} aliases in this session.`)}function nn(e,t){return ak(t).map(r=>r===null?null:e.keyToRef[r]??null)}import{Type as Fn}from"@netrodev/hxf-ai";import{defineTool as JL}from"@netrodev/hxf-coding-agent";var yo="[Compressed conversation section]";function Pi(e){return Math.round(e.length/4)}function Bc(e){let t=e.prune.messages.nextBlockId;return!Number.isInteger(t)||t<1?(e.prune.messages.nextBlockId=2,1):(e.prune.messages.nextBlockId=t+1,t)}function Hc(e){let t=e.prune.messages.nextRunId;return!Number.isInteger(t)||t<1?(e.prune.messages.nextRunId=2,1):(e.prune.messages.nextRunId=t+1,t)}function zc(e,t,r="xml"){let n=Ci(Mn(e,r),void 0,r),o=t.trim();return o.length===0?`${yo}
|
|
39
|
+
${n}`:`${yo}
|
|
40
|
+
${o}
|
|
41
|
+
|
|
42
|
+
${n}`}function Cr(e){return e.prune.messages.blocks.filter(t=>t.active).map(t=>({blockId:t.blockId,anchorIndex:t.anchorIndex,coveredIndices:t.coveredIndices,summary:t.summary}))}function Wc(e,t,r,n,o,i,a){let m=e.prune.messages,c=[...new Set(a.filter(b=>Number.isInteger(b)&&b>0))],p=new Set;for(let b of m.blocks)if(b.active)for(let R of b.coveredIndices)p.add(R);let f=new Set(r.indices);for(let b of c){let R=m.blocks.find(L=>L.blockId===b);if(R)for(let L of R.coveredIndices)f.add(L)}let d=[...f].sort((b,R)=>b-R),g=d.filter(b=>!p.has(b)),I=0;for(let b of g)I+=r.tokenByIndex.get(b)??0;let h={blockId:o,runId:t.runId,active:!0,deactivatedByUser:!1,mode:t.mode,topic:t.topic,startId:t.startId,endId:t.endId,anchorIndex:n,compressedTokens:I,summaryTokens:Pi(i),coveredIndices:d,consumedBlockIds:c,parentBlockIds:[],createdAt:Date.now(),summary:i};m.blocks.push(h);let y=Date.now();for(let b of c){let R=m.blocks.find(L=>L.blockId===b);!R||!R.active||(R.active=!1,R.deactivatedAt=y,R.deactivatedByBlockId=o,R.parentBlockIds.includes(o)||R.parentBlockIds.push(o))}return e.stats.totalCompressTokens+=I,{compressedTokens:I,coveredIndices:d,newlyCoveredIndices:g}}function uk(e,t="xml"){let r=[],n=t==="compact"?/@b([1-9]\d*)@/gi:/\(b(\d+)\)/gi,o;for(;(o=n.exec(e))!==null;){let i=Number.parseInt(o[1],10);Number.isInteger(i)&&r.push({raw:o[0],blockId:i,startIndex:o.index,endIndex:o.index+o[0].length})}return r}function ck(e){if(typeof e.topic!="string"||e.topic.trim().length===0)throw new Error("topic is required and must be a non-empty string");if(!Array.isArray(e.content)||e.content.length===0)throw new Error("content is required and must be a non-empty array");for(let t=0;t<e.content.length;t++){let r=e.content[t],n=`content[${t}]`;if(typeof r?.startId!="string"||r.startId.trim().length===0)throw new Error(`${n}.startId is required and must be a non-empty string`);if(typeof r?.endId!="string"||r.endId.trim().length===0)throw new Error(`${n}.endId is required and must be a non-empty string`);if(typeof r?.summary!="string"||r.summary.trim().length===0)throw new Error(`${n}.summary is required and must be a non-empty string`)}}function Vc(e,t,r,n){let o=new Set,i=new Map;for(let d of r)o.add(d.index),i.set(d.index,d.tokenCount??0);let a=mk(e,o,t.startId,"startId",n),m=mk(e,o,t.endId,"endId",n);if(a.index>m.index)throw new Error(`startId ${a.ref} appears after endId ${m.ref} in the conversation. Start must come before end.`);let c=[];for(let d of r)d.index>=a.index&&d.index<=m.index&&c.push(d.index);let p=new Set(c),f=e.prune.messages.blocks.filter(d=>d.active&&p.has(d.anchorIndex)).map(d=>d.blockId);return{startIdx:a.index,endIdx:m.index,indices:c,requiredBlockIds:f,tokenByIndex:i}}function mk(e,t,r,n,o){let i=qc(r,o);if(i===null){let m=o==="compact"?"@4@":"mNNNN",c=o==="compact"?"@b1@":"bN";throw new Error(`${n} is invalid. Use an injected message ID (${m}) or block ID (${c}).`)}let a;if(i.kind==="message")a=i.index;else{let m=e.prune.messages.blocks.find(c=>c.blockId===i.blockId&&c.active);a=m?m.anchorIndex:-1}if(a<0||!t.has(a))throw new Error(`${n} ${i.ref} is not available in the current conversation context. Choose an injected ID visible in context.`);return{ref:i.ref,index:a}}function pk(e,t,r,n="xml"){let i=[...e.map((m,c)=>{let p={startId:m.startId.trim(),endId:m.endId.trim(),summary:m.summary};return{index:c,entry:p,selection:Vc(t,p,r,n)}})].sort((m,c)=>m.selection.startIdx-c.selection.startIdx||m.selection.endIdx-c.selection.endIdx||m.index-c.index),a=[];for(let m=1;m<i.length;m++){let c=i[m-1],p=i[m];!c||!p||p.selection.startIdx>c.selection.endIdx||a.push(`content[${c.index}] (${c.entry.startId}..${c.entry.endId}) overlaps content[${p.index}] (${p.entry.startId}..${p.entry.endId}). Overlapping ranges cannot be compressed in the same batch.`)}if(a.length>0)throw new Error(a.length===1?a[0]:a.map(m=>`- ${m}`).join(`
|
|
43
|
+
`))}function fk(e,t,r,n="xml"){let o=new Set(t.prune.messages.blocks.filter(i=>i.active).map(i=>i.blockId));return e.map((i,a)=>{let m={startId:i.startId.trim(),endId:i.endId.trim(),summary:i.summary},c=Vc(t,m,r,n),p=new Set(c.requiredBlockIds),f=uk(m.summary,n),d=new Set,g=`content[${a}]`;for(let I of f){if(d.has(I.blockId))throw new Error(`${g}.summary duplicates placeholder ${I.raw}`);if(d.add(I.blockId),!p.has(I.blockId))throw new Error(o.has(I.blockId)?`${g}.summary references ${I.raw}, which is outside the selected range`:`${g}.summary references ${I.raw}, which is not an active compressed block`)}for(let I of c.requiredBlockIds)if(!d.has(I)){let h=n==="compact"?`@b${I}@`:`(b${I})`;throw new Error(`${g}.summary is missing the required placeholder ${h}`)}return f})}function dk(e,t,r,n="xml"){return e.map((o,i)=>{let a={startId:o.startId.trim(),endId:o.endId.trim(),summary:o.summary},m=Vc(t,a,r,n);return{index:i,entry:a,selection:m,anchorIndex:m.startIdx}})}function XL(e){let t=e.match(/^\s*\[Compressed conversation(?: section)?(?: b\d+)?\]/i);return t?e.slice(t[0].length).replace(/^(?:\r?\n)+/,"").replace(/(?:\r?\n)*<dcp-message-id>b\d+<\/dcp-message-id>\s*$/i,"").replace(/(?:\r?\n)*@b[1-9]\d*@\s*$/i,"").replace(/(?:\r?\n)+$/,""):e}function QL(e,t,r){if(t.length===0)return{expanded:e,consumedBlockIds:[]};let n="",o=0,i=[];for(let a of t){let m=r.prune.messages.blocks.find(c=>c.blockId===a.blockId&&c.active);if(!m)throw new Error(`Compressed block not found: ${a.raw}`);n+=e.slice(o,a.startIndex),n+=XL(m.summary),o=a.endIndex,i.push(a.blockId)}return n+=e.slice(o),{expanded:n,consumedBlockIds:i}}function lk(e,t,r,n="xml"){ck(e),pk(e.content,t,r,n);let o=fk(e.content,t,r,n),i=dk(e.content,t,r,n),a=Hc(t),m=[];for(let[c,p]of i.entries()){let f=o[c]??[],{expanded:d,consumedBlockIds:g}=QL(p.entry.summary,f,t),I=Bc(t),h=zc(I,d,n),y=Wc(t,{topic:e.topic,startId:p.entry.startId,endId:p.entry.endId,mode:"range",runId:a},p.selection,p.anchorIndex,I,h,g);m.push({blockId:I,runId:a,coveredCount:y.coveredIndices.length,compressedTokens:y.compressedTokens,summaryTokens:Pi(h),expandedSummary:d})}return m}function YL(e){let t=e.format??"xml",r=rn(1,t),n=Mn(2,t);return JL({name:"compress",label:"compress",description:`Collapse conversation ranges into stored compressed summaries, each marked with "${yo}". Copy startId and endId from the injected IDs in context (message IDs like ${r}, block IDs like ${n}); startId must come before endId. Ranges in one call must not overlap, and each summary must reference every required block placeholder exactly once.`,promptSnippet:"compress: replace a conversation range with a stored summary",parameters:Fn.Object({topic:Fn.String({description:"Short label (3-5 words) for display - e.g., 'Auth System Exploration'"}),content:Fn.Array(Fn.Object({startId:Fn.String({description:`Message or block ID marking the beginning of range (e.g. ${r}, ${n})`}),endId:Fn.String({description:`Message or block ID marking the end of range (e.g. ${rn(12,t)}, ${Mn(5,t)})`}),summary:Fn.String({description:"Complete technical summary replacing all content in range"})}),{description:"One or more ranges to compress, each with start/end boundaries and a summary"})}),async execute(o,i){try{let a=lk(i,e.state(),e.messages(),t),m=a.map(g=>g.blockId),c=a.reduce((g,I)=>g+I.coveredCount,0),p=a.reduce((g,I)=>g+I.compressedTokens,0),f=a.reduce((g,I)=>g+I.summaryTokens,0),d=Math.max(0,p-f);return{content:[{type:"text",text:`Compressed ${c} messages into ${yo}`+(p>0?` - ${p} tokens replaced by ${f}, saving ${d}.`:".")}],details:{blockIds:m,runId:a[0]?.runId,messages:c,compressedTokens:p,summaryTokens:f}}}catch(a){let m=a instanceof Error?a.message:String(a);return{content:[{type:"text",text:m}],details:{error:m},isError:!0}}}})}import{existsSync as gk,mkdirSync as ZL,readFileSync as xk,unlinkSync as e1}from"node:fs";import{dirname as t1,join as Ik}from"node:path";function Jc(e){try{let t=Ik(e,".howtofix","dcp.json");if(!gk(t))return;let r=JSON.parse(xk(t,"utf8"));if(typeof r!="object"||r===null)return;let n=r.enabled;return typeof n=="boolean"?n:void 0}catch{return}}function Xc(e){if(e.env!==void 0){let t=e.env.trim().toLowerCase();return{enabled:t!=="0"&&t!=="false",source:"env"}}return e.config!==void 0?{enabled:e.config,source:"config"}:e.runtime!==void 0?{enabled:e.runtime,source:"session"}:{enabled:!0,source:"default"}}function hk(){return{messageIds:Uc(),prune:{tools:{},messages:{blocks:[],nextBlockId:1,nextRunId:1}},stats:{totalPruneTokens:0,totalCompressTokens:0}}}function Za(e){let t=e.replace(/[^A-Za-z0-9._-]/g,"_")||"session";return Ik(It,"dcp",`${t}.json`)}function r1(e){if(typeof e!="object"||e===null)return!1;let t=e,r=t.prune?.messages,n=t.messageIds;return typeof t.prune=="object"&&t.prune!==null&&typeof t.prune.tools=="object"&&t.prune.tools!==null&&typeof r=="object"&&r!==null&&Array.isArray(r.blocks)&&Number.isInteger(r.nextBlockId)&&Number.isInteger(r.nextRunId)&&typeof n=="object"&&n!==null&&Number.isInteger(n.nextRef)&&typeof n.keyToRef=="object"&&n.keyToRef!==null&&typeof n.refToKey=="object"&&n.refToKey!==null&&typeof t.stats=="object"&&t.stats!==null&&Number.isFinite(t.stats.totalPruneTokens)&&Number.isFinite(t.stats.totalCompressTokens)}var Ya=new Map;function Ai(e){let t=Ya.get(e);if(t)return t;let r;try{let o=Za(e);if(gk(o)){let i=JSON.parse(xk(o,"utf8"));r1(i)&&(r=i)}}catch{r=void 0}let n=r??hk();return Ya.set(e,n),n}function on(e){let t=Ya.get(e);if(!t)return;let r=Za(e);ZL(t1(r),{recursive:!0}),tr(r,JSON.stringify(t))}function n1(e){Ya.delete(e);try{e1(Za(e))}catch{}}function Yt(e){return e.replaceAll("\\","/")}function o1(e){return/[\\.^$+{}()|\[\]]/.test(e)?`\\${e}`:e}function Qc(e,t){if(!t)return!1;let r=Yt(e),n=Yt(t),o="^";for(let i=0;i<n.length;i++){let a=n[i];if(a==="*"){if(n[i+1]==="*"){if(n[i+2]==="/"){o+="(?:.*/)?",i+=2;continue}o+=".*",i++;continue}o+="[^/]*";continue}if(a==="?"){o+="[^/]";continue}if(a==="/"){o+="/";continue}o+=o1(a)}return o+="$",new RegExp(o).test(r)}function em(e,t){if(typeof t!="object"||t===null)return[];let r=[],n=t;if((e==="apply_patch"||e==="patch")&&typeof n.patchText=="string"){let o=/\*\*\* (?:Add|Delete|Update) File: ([^\n\r]+)/g,i;for(;(i=o.exec(n.patchText))!==null;)r.push(i[1].trim())}if(e==="multiedit"&&(typeof n.filePath=="string"&&r.push(n.filePath),Array.isArray(n.edits)))for(let o of n.edits)o&&typeof o=="object"&&typeof o.filePath=="string"&&r.push(o.filePath);return typeof n.filePath=="string"&&r.push(n.filePath),["read","write","edit"].includes(e)&&typeof n.path=="string"&&r.push(n.path),[...new Set(r)].filter(o=>o.length>0)}function yk(e,t){return e.length===0||t.length===0?!1:e.some(r=>t.some(n=>Qc(r,n)))}var i1=/[*?]/,vn=["todo","goal","context","task"];function bk(e,t){if(!e||t.length===0)return!1;let r=new Set,n=[];for(let o of t)i1.test(o)?n.push(o):r.add(o);return r.has(e)?!0:n.some(o=>Qc(e,o))}function tm(e,t,r,n,o){let i=[{tool:e,input:t}];if(e==="execute"&&Array.isArray(o?.toolCalls))for(let a of o.toolCalls)a&&typeof a=="object"&&typeof a.tool=="string"&&i.push({tool:a.tool,input:a.input});return i.some(a=>bk(a.tool,r)||yk(em(a.tool,a.input),n))}function Zc(e,t){return t==null?e:`${e}::${JSON.stringify(Yc(s1(t)))}`}function s1(e){if(typeof e!="object"||e===null||Array.isArray(e))return e;let t={};for(let[r,n]of Object.entries(e))n!=null&&(t[r]=n);return t}function Yc(e){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return e.map(Yc);let t={};for(let r of Object.keys(e).sort())t[r]=Yc(e[r]);return t}var bo="[Output removed to save context - information superseded or no longer needed]",ep="[input removed due to failed tool call]",Sk="[questions removed - see output for user's answers]",$k=2e3,rm=["ask","question"],Ek=["read","grep","ls"],a1=["edit","write","multiedit","apply_patch","patch"];function m1(e){return e.filter(t=>t.type==="text").map(t=>t.text).join("")}function u1(e){if(!e)return{total:0,count:0};let t=0,r=0;for(let n of Object.values(e))typeof n=="string"&&(t+=n.length,r++);return{total:t,count:r}}function c1(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tp(e,t,r){let n=r?.bigOutputChars??$k,o=new Map,i=[];for(let y=0;y<e.length;y++){let b=e[y];if(b.role==="assistant")for(let R of b.content)R.type==="toolCall"&&o.set(R.id,{name:R.name,args:R.arguments,callIndex:y});else if(b.role==="toolResult"){let R=o.get(b.toolCallId),L=b.toolName;i.push({index:y,callId:b.toolCallId,tool:L,isError:b.isError,text:m1(b.content),paths:R?em(L,R.args):[],signature:Zc(L,R?.args),callIndex:R?.callIndex??-1})}}let a=t.planFile?Yt(t.planFile):void 0,m=y=>y.index===0||vn.includes(y.tool)||a!==void 0&&y.paths.some(b=>Yt(b)===a),c=y=>y.callIndex<0||y.callIndex===0||vn.includes(y.tool)||a!==void 0&&y.paths.some(b=>Yt(b)===a),p=[],f=new Set,d=y=>{let b=`${y.kind}:${y.callId}`;f.has(b)||(f.add(b),p.push(y))},g=new Map;for(let y of i)if(!(y.isError||!Ek.includes(y.tool)&&!a1.includes(y.tool)))for(let b of y.paths){let R=Yt(b),L=g.get(R);(L===void 0||y.index>L)&&g.set(R,y.index)}for(let y of i){if(y.isError||!Ek.includes(y.tool)||m(y)||y.text===bo)continue;y.paths.some(R=>(g.get(Yt(R))??-1)>y.index)&&d({kind:"output",reason:"superseded-read",callId:y.callId,messageIndex:y.index,savedChars:Math.max(0,y.text.length-bo.length)})}let I=new Map;for(let y of i){if(y.isError)continue;let b=I.get(y.signature);(b===void 0||y.index>b)&&I.set(y.signature,y.index)}for(let y of i){if(!y.isError||m(y))continue;let b=I.get(y.signature);if(!(b===void 0||b<=y.index)&&(d({kind:"output",reason:"error-then-success",callId:y.callId,messageIndex:y.index,savedChars:Math.max(0,y.text.length-bo.length)}),!c(y))){let R=o.get(y.callId)?.args,{total:L,count:q}=u1(R);q>0&&d({kind:"failed-input",reason:"error-then-success",callId:y.callId,messageIndex:y.callIndex,savedChars:Math.max(0,L-q*ep.length)})}}if(t.files.length>0||t.identifiers.length>0){let y=[...t.files.map(Yt),...a?[a]:[]],b=y.map(q=>q.split("/").pop()??"").filter(q=>q.length>0),R=t.identifiers.map(q=>new RegExp(`(?<![\\w.-])${c1(q)}(?![\\w.-])`)),L=q=>{let ut=Yt(q);return y.some(Ze=>ut.includes(Ze))||b.some(Ze=>q.includes(Ze))?!0:R.some(Ze=>Ze.test(q))};for(let q of i)m(q)||rm.includes(q.tool)||q.text.length<=n||L(q.text)||d({kind:"output",reason:"unrelated-big-output",callId:q.callId,messageIndex:q.index,savedChars:Math.max(0,q.text.length-bo.length)})}let h=0;for(let y of p)h+=y.savedChars;return{ops:p,savedChars:h}}function rp(e,t){let r=new Set,n=new Set,o=new Set;for(let i of t)i.kind==="output"?r.add(i.callId):i.kind==="question-input"?n.add(i.callId):o.add(i.callId);return wk(Tk(kk(e,r),n),o)}function kk(e,t){return t.size===0?[...e]:e.map((r,n)=>n===0||r.role!=="toolResult"||!t.has(r.toolCallId)||rm.includes(r.toolName)?r:{...r,content:[{type:"text",text:bo}]})}function Tk(e,t){if(t.size===0)return[...e];let r=new Set;for(let n of e)n.role==="toolResult"&&!n.isError&&t.has(n.toolCallId)&&r.add(n.toolCallId);return r.size===0?[...e]:e.map((n,o)=>{if(o===0||n.role!=="assistant")return n;let i=!1,a=n.content.map(m=>{if(m.type!=="toolCall"||!r.has(m.id)||!rm.includes(m.name))return m;let c={...m.arguments},p=!1;for(let f of["question","questions","options"])f in c&&(c[f]=Sk,p=!0);return p?(i=!0,{...m,arguments:c}):m});return i?{...n,content:a}:n})}function wk(e,t){if(t.size===0)return[...e];let r=new Set;for(let n of e)n.role==="toolResult"&&n.isError&&t.has(n.toolCallId)&&r.add(n.toolCallId);return r.size===0?[...e]:e.map((n,o)=>{if(o===0||n.role!=="assistant")return n;let i=!1,a=n.content.map(m=>{if(m.type!=="toolCall"||!r.has(m.id))return m;let c={},p=!1;for(let[f,d]of Object.entries(m.arguments))typeof d=="string"?(c[f]=ep,p=!0):c[f]=d;return p?(i=!0,{...m,arguments:c}):m});return i?{...n,content:a}:n})}function np(e,t,r){if(t.length===0)return[...e];let n=nn(r,e),o=new Map;for(let d=0;d<n.length;d++){let g=n[d];g!==null&&o.set(g,d)}let i=new Set,a=new Map;for(let d of t){let g=[];for(let h of d.coveredIndices){let y=o.get(h);y!==void 0&&(i.add(y),g.push(y))}let I=o.get(d.anchorIndex)??(g.length>0?Math.min(...g):void 0);if(d.summary&&I!==void 0){let h=a.get(I);h?h.push(d.summary):a.set(I,[d.summary])}}let m=new Map,c=new Map;for(let d=0;d<e.length;d++){let g=e[d];if(g)if(g.role==="assistant"&&Array.isArray(g.content))for(let I of g.content)I.type==="toolCall"&&m.set(d,I.id);else g.role==="toolResult"&&c.set(g.toolCallId,d)}let p=[...i];for(;p.length>0;){let d=p.pop(),g=m.get(d);if(g!==void 0){let h=c.get(g);h!==void 0&&!i.has(h)&&(i.add(h),p.push(h))}let I=e[d];if(I?.role==="toolResult")for(let[h,y]of m)y===I.toolCallId&&!i.has(h)&&(i.add(h),p.push(h))}let f=[];for(let d=0;d<e.length;d++){let g=a.get(d);if(g){let I=e[d];for(let h of g){let y={role:"user",content:h,timestamp:I.timestamp};f.push(y)}}i.has(d)||f.push(e[d])}return f}function op(e="xml"){let t=e==="compact",r=t?"@4@":"mNNNN",n=t?"@b1@":"bN",o=t?"@b1@":"(bN)";return`COMPRESSING A RANGE OF THIS CONVERSATION
|
|
44
|
+
|
|
45
|
+
This is what the \`compress\` tool is for, and how a range must be summarised when it is used. Reach for it when the conversation has grown long enough that its older turns cost more than they are worth - never as a way to answer the user, and never on a range they did not ask about. Nothing here is a standing instruction to summarise: it is the contract the tool's output is held to.
|
|
46
|
+
|
|
47
|
+
THE SUMMARY
|
|
48
|
+
Your summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings... EVERYTHING that maintains context integrity. This is not a brief note - it is an authoritative record so faithful that the original conversation adds no value.
|
|
49
|
+
|
|
50
|
+
USER INTENT FIDELITY
|
|
51
|
+
When the compressed range includes user messages, preserve the user's intent with extra care. Do not change scope, constraints, priorities, acceptance criteria, or requested outcomes.
|
|
52
|
+
Directly quote user messages when they are short enough to include safely. Direct quotes are preferred when they best preserve exact meaning.
|
|
53
|
+
|
|
54
|
+
Yet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool outputs, back-and-forth exploration. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.
|
|
55
|
+
|
|
56
|
+
COMPRESSED BLOCK PLACEHOLDERS
|
|
57
|
+
When the selected range includes previously compressed blocks, use this exact placeholder format when referencing one:
|
|
58
|
+
|
|
59
|
+
- \`${o}\`
|
|
60
|
+
|
|
61
|
+
Compressed block sections in context are clearly marked with a header:
|
|
62
|
+
|
|
63
|
+
- \`[Compressed conversation section]\`
|
|
64
|
+
|
|
65
|
+
${t?"Compressed block IDs look like `@b1@`, distinct from raw message IDs like `@4@`.":"Compressed block IDs always use the `bN` form (never `mNNNN`) and are represented in the same XML metadata tag format."}
|
|
66
|
+
|
|
67
|
+
Rules:
|
|
68
|
+
|
|
69
|
+
- Include every required block placeholder exactly once.
|
|
70
|
+
- Do not invent placeholders for blocks outside the selected range.
|
|
71
|
+
- Treat \`${o}\` placeholders as RESERVED TOKENS. Do not emit \`${o}\` text anywhere except intentional placeholders.
|
|
72
|
+
- If you need to mention a block in prose, use plain text like \`compressed ${t?"block 1":"bN"}\` (not as a placeholder).
|
|
73
|
+
- Preflight check before finalizing: the set of \`${o}\` placeholders in your summary must exactly match the required set, with no duplicates.
|
|
74
|
+
|
|
75
|
+
These placeholders are semantic references. They will be replaced with the full stored compressed block content when the tool processes your output.
|
|
76
|
+
|
|
77
|
+
FLOW PRESERVATION WITH PLACEHOLDERS
|
|
78
|
+
When you use compressed block placeholders, write the surrounding summary text so it still reads correctly AFTER placeholder expansion.
|
|
79
|
+
|
|
80
|
+
- Treat each placeholder as a stand-in for a full conversation segment, not a short label.
|
|
81
|
+
- Ensure transitions before and after each placeholder preserve chronology and causality.
|
|
82
|
+
- Do not write text that depends on the placeholder staying literal (for example, "as noted in \`${t?"@b2@":"(b2)"}\`").
|
|
83
|
+
- Your final meaning must be coherent once each placeholder is replaced with its full compressed block content.
|
|
84
|
+
|
|
85
|
+
BOUNDARY IDS
|
|
86
|
+
You specify boundaries by ID using the injected IDs visible in the conversation:
|
|
87
|
+
|
|
88
|
+
- \`${r}\` IDs identify raw messages
|
|
89
|
+
- \`${n}\` IDs identify previously compressed blocks
|
|
90
|
+
|
|
91
|
+
${t?"Each message has an ID like `@4@`. Copy the whole marker, including both `@` characters, into `startId` and `endId`.":"Each message has an ID inside XML metadata tags like `<dcp-message-id>...</dcp-message-id>`."}
|
|
92
|
+
The same ID tag appears in every tool output of the message it belongs to \u2014 each unique ID identifies one complete message.
|
|
93
|
+
Treat these tags as boundary metadata only, not as tool result content.
|
|
94
|
+
|
|
95
|
+
Rules:
|
|
96
|
+
|
|
97
|
+
- Pick \`startId\` and \`endId\` directly from injected IDs in context.
|
|
98
|
+
- IDs must exist in the current visible context.
|
|
99
|
+
- \`startId\` must appear before \`endId\`.
|
|
100
|
+
- Do not invent IDs. Use only IDs that are present in context.
|
|
101
|
+
|
|
102
|
+
BATCHING
|
|
103
|
+
When multiple independent ranges are ready and their boundaries do not overlap, include all of them as separate entries in the \`content\` array of a single tool call. Each entry should have its own \`startId\`, \`endId\`, and \`summary\`.
|
|
104
|
+
`}function ip(e,t,r,n){let o=new Map;if(t.idState){let m=nn(t.idState,t.messages);for(let c=0;c<m.length;c++){let p=m[c];p!==null&&o.set(p,c)}}let i=new Set;for(let m of Cr(r))if(!(n!==void 0&&m.blockId===n))for(let c of m.coveredIndices)i.add(c);let a=[];if(t.idState)for(let m of e.indices){if(i.has(m))continue;let c=o.get(m);c!==void 0&&a.push(c)}return a}function Rk(e){if(typeof e.content=="string")return e.content.trim()?[e.content]:[];let t=[];for(let r of e.content)r.type==="text"&&r.text.trim()&&t.push(r.text);return t}function Ck(e,t,r,n,o,i){if(!o)return e;let a=[];for(let p of ip(t,r,n,i)){let f=r.messages[p];if(!f||f.role!=="user")continue;let d=Rk(f)[0];d!==void 0&&a.push(d)}if(a.length===0)return e;let m=`
|
|
105
|
+
|
|
106
|
+
The following user messages were sent in this conversation verbatim:`,c=a.map(p=>`
|
|
107
|
+
${p}`).join("");return e+m+c}function Pk(e,t,r,n,o,i){if(!o)return e;let a=[];for(let p of ip(t,r,n,i)){let f=r.messages[p];if(!(!f||f.role!=="user"))for(let d of Rk(f))a.push(...Ak(d))}if(a.length===0)return e;let m=`
|
|
108
|
+
|
|
109
|
+
The following protected prompt information was included in this conversation verbatim:`,c=a.map(p=>`
|
|
110
|
+
${p}`).join("");return e+m+c}function Ak(e){let t=[],r=/<protect>([\s\S]*?)<\/protect>/gi;for(let n of e.matchAll(r)){let o=n[1]?.trim();o&&t.push(o)}return t}function Ok(e,t,r,n,o=[],i=[],a){let m=new Map,c=[];for(let I of ip(t,r,n,a)){let h=r.messages[I];if(h){if(h.role==="assistant"){for(let y of h.content)y.type==="toolCall"&&m.set(y.id,y.arguments);continue}if(h.role==="toolResult"){if(h.isError)continue;let y=h.content.filter(b=>b.type==="text").map(b=>b.text).join("");y.trim()&&c.push({toolCallId:h.toolCallId,toolName:h.toolName,text:y})}}}if(c.length===0)return e;let p=[...new Set([...vn,...o])],f=[...i],d=[];for(let I of c){let h=m.get(I.toolCallId);tm(I.toolName,h,p,f)&&d.push(`
|
|
111
|
+
### Tool: ${I.toolName}
|
|
112
|
+
${I.text}`)}return d.length===0?e:e+`
|
|
113
|
+
|
|
114
|
+
The following protected tools were used in this conversation as well:`+d.join("")}function Mk(e,t,r){if(t.protectedEnriched)return;let n=t.coveredIndices;if(n.length>0){let o={startIdx:Math.min(...n),endIdx:Math.max(...n),indices:[...n],requiredBlockIds:[],tokenByIndex:new Map},i={messages:r,idState:e.messageIds},a=Ok(Pk(Ck(t.summary,o,i,e,!0,t.blockId),o,i,e,!0,t.blockId),o,i,e,[],[],t.blockId);t.summary=a,t.summaryTokens=Pi(a)}t.protectedEnriched=!0}function Fk(e,t){let r=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o===null)continue;let i=t[n],a=i&&"content"in i?ho(i.content):"";r.push({index:o,tokenCount:Math.round(a.length/4)})}return r}var p1="COMPRESSED BLOCK PLACEHOLDERS",sp=new Map;function f1(e){return sp.get(e)??[]}function d1(e){sp.delete(e)}var vk;function l1(){return vk}function g1(e={}){return t=>{t.on("context_with_system",async(r,n)=>{let o=n?.sessionManager?.getSessionId()??"dcp-sessionless",i=Ai(o);if(i.enabled===!1)return;let a=r.messages,m=a[0];if(!m||m.role!=="system")return;Kc(i.messageIds,a);let c=nn(i.messageIds,a);sp.set(o,Fk(c,a)),vk=o;let p=x1(a),f=np(p,Cr(i),i.messageIds),d=e.keepSet?.()??{files:[],identifiers:[]},g=tp(f,d);if(g.ops.length>0){f=rp(f,g.ops);for(let h of g.ops)i.prune.tools[h.callId]=(i.prune.tools[h.callId]??0)+h.savedChars;i.stats.totalPruneTokens=Object.values(i.prune.tools).reduce((h,y)=>h+y,0)}for(let h of i.prune.messages.blocks)h.active&&!h.protectedEnriched&&Mk(i,h,a);on(o);let I=f.map((h,y)=>{if(y!==0||!("content"in h))return h;let b=ho(h.content);return b.includes(p1)?h:{...h,content:Qa(h.content,`${b}
|
|
115
|
+
|
|
116
|
+
${op()}`)}});return{messages:h1(I,i.messageIds)}})}}function x1(e){return e.map(t=>{if(t.role!=="assistant"||!("content"in t))return t;let r=I1(t.content);return r===t.content?t:{...t,content:r}})}function I1(e){if(typeof e=="string")return Gc(e);if(!Array.isArray(e))return e;let t=!1,r=e.map(n=>{if(!n||typeof n!="object"||!("type"in n)||n.type!=="text")return n;let o="text"in n&&typeof n.text=="string"?n.text:"",i=Gc(o);return i===o?n:(t=!0,{...n,text:i})});return t?r:e}function h1(e,t){let r=nn(t,e);return e.map((n,o)=>{let i=r[o];if(i==null||!("content"in n))return n;let a=Ci(rn(i));return ho(n.content).includes(a)?n:{...n,content:y1(n.content,a)}})}function y1(e,t){if(typeof e=="string")return e+t;if(!Array.isArray(e))return e;let r=!1,n=e.map(o=>{if(!o||typeof o!="object"||!("type"in o)||o.type!=="text")return o;r=!0;let i="text"in o&&typeof o.text=="string"?o.text:"";return{...o,text:i+t}});return r?n:[...n,{type:"text",text:t.trimStart()}]}var Lk={on:"turn the transform on for this session",off:"turn it off; the full transcript is sent unchanged",status:"the switch, the block count, and the tokens saved",blocks:"list the active compressed blocks",stats:"prune and compress totals for this session",context:"what the next request will carry, and what was saved",decompress:"reopen one block by id, e.g. /dcp decompress b2",sweep:"drop blocks no longer referenced by the ref state"};function ap(e){return e<1e3?`${e}`:`${(e/1e3).toFixed(1)}k`}function b1(e,t,r){let[n]=e.trim().split(/\s+/),o=n===void 0||n===""?"status":n,i=Ai(r);switch(o){case"on":return i.enabled=!0,on(r),"dcp: on";case"off":return i.enabled=!1,on(r),"dcp: off; the full transcript is sent unchanged";case"blocks":{let a=Cr(i);return a.length===0?"dcp: no active blocks":a.map(m=>{let c=String(m.anchorIndex).padStart(4,"0");return`b${m.blockId} covers ${m.coveredIndices.length} message(s), anchored at m${c}`}).join(`
|
|
117
|
+
`)}case"status":{let a=Xc({runtime:i.enabled,config:Jc(t)}),m=Cr(i),c=Object.values(i.prune.tools).reduce((p,f)=>p+f,0);return[`dcp: ${a.enabled?"on":"off"} (source: ${a.source})`,`messages tracked: ${Object.keys(i.messageIds.keyToRef).length}`,`active blocks: ${m.length}`,`pruned tool calls: ${Object.keys(i.prune.tools).length} (${ap(c)} chars)`,`compressed tokens total: ${i.stats.totalCompressTokens}`].join(`
|
|
118
|
+
`)}case"stats":{let a=i.prune.messages.blocks,m=a.filter(p=>p.active).length,c=Object.values(i.prune.tools).reduce((p,f)=>p+f,0);return[`blocks: ${m} active of ${a.length} total`,`compressed tokens: ${i.stats.totalCompressTokens}`,`pruned tool calls: ${Object.keys(i.prune.tools).length} (${ap(c)} chars)`,`messages tracked: ${Object.keys(i.messageIds.keyToRef).length}`,`refs allocated: ${i.messageIds.nextRef-1}`].join(`
|
|
119
|
+
`)}case"context":{let a=Cr(i),m=new Set;for(let f of a)for(let d of f.coveredIndices)m.add(d);let c=Object.keys(i.messageIds.keyToRef).length,p=Object.values(i.prune.tools).reduce((f,d)=>f+d,0);return[`messages tracked: ${c}`,`messages replaced by a block: ${m.size}`,`messages sent: ${Math.max(0,c-m.size)}`,`active blocks: ${a.length}`,`compressed tokens total: ${i.stats.totalCompressTokens}`,`pruned tool calls: ${Object.keys(i.prune.tools).length} (${ap(p)} chars)`].join(`
|
|
120
|
+
`)}case"decompress":{let a=e.trim().split(/\s+/)[1],m=a===void 0?null:/^b?(\d+)$/i.exec(a);if(!m)return"dcp: give a block id, e.g. /dcp decompress b2";let c=Number(m[1]),p=i.prune.messages.blocks,f=p.find(g=>g.blockId===c);if(!f)return`dcp: no block b${c}`;let d=p.filter(g=>g.active&&g.consumedBlockIds.includes(c));if(d.length>0){let g=d.map(I=>`b${I.blockId}`).join(", ");return`dcp: b${c} was consumed by ${g}; decompress that one first`}if(!f.active)return`dcp: b${c} is already open`;f.active=!1,f.deactivatedByUser=!0,f.deactivatedAt=Date.now();for(let g of f.parentBlockIds){let I=p.find(h=>h.blockId===g);I&&(I.consumedBlockIds=I.consumedBlockIds.filter(h=>h!==c))}return on(r),`dcp: b${c} reopened; ${f.coveredIndices.length} message(s) are back`}case"sweep":{let a=new Set(Object.keys(i.messageIds.refToKey).map(Number)),m=i.prune.messages.blocks,c=m.length,p=m.filter(d=>d.active&&!d.coveredIndices.some(g=>a.has(g)));for(let d of p)d.active=!1,d.deactivatedAt=Date.now();i.prune.messages.blocks=m.filter(d=>d.active||d.deactivatedByUser);let f=c-i.prune.messages.blocks.length;return on(r),p.length===0?"dcp: nothing to sweep":`dcp: ${p.length} orphaned block(s) closed, ${f} dropped from state`}default:return`dcp: unknown subcommand '${o}'. try: ${Object.keys(Lk).join(", ")}`}}import{Type as om}from"@netrodev/hxf-ai";import{defineTool as Gk}from"@netrodev/hxf-coding-agent";import{promises as E1}from"node:dns";var S1=/^(127\.|10\.|192\.168\.|169\.254\.|0\.|221\.|222\.|223\.)/;function mp(e){if(S1.test(e))return!0;let t=/^172\.(\d+)\./.exec(e);if(!t)return!1;let r=Number(t[1]);return r>=16&&r<=31}function up(e){let t=/^100\.(\d+)\.(\d+)\.(\d+)$/.exec(e);if(t){let n=Number(t[1]);return n>=64&&n<=127}let r=/^198\.(\d+)\./.exec(e);return r!==null&&(Number(r[1])===18||Number(r[1])===19)}function Dk(e){let t=e.toLowerCase().replace(/^\[|\]$/g,"").split("%")[0];if(t==="localhost"||t.endsWith(".localhost"))return!0;let r=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/.exec(t);if(r){let o=r[1];return mp(o)||up(o)||o==="0.0.0.0"}let n=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/.exec(t);if(n){let o=Number.parseInt(n[1],16),i=Number.parseInt(n[2],16),a=`${o>>8&255}.${o&255}.${i>>8&255}.${i&255}`;return mp(a)||up(a)||a==="0.0.0.0"}return t.includes(":")?!!(t==="::1"||t==="::"||/^f[cd][0-9a-f]{2}:/.test(t)||/^fe[89ab][0-9a-f]:/.test(t)):t==="0.0.0.0"?!0:mp(t)||up(t)}var cp=8e4,pp=8;function nm(e){let t;try{t=new URL(e)}catch{return{ok:!1,reason:"not a URL"}}if(t.protocol!=="http:"&&t.protocol!=="https:")return{ok:!1,reason:`refused protocol ${t.protocol}`};let r=t.hostname.toLowerCase();return r==="localhost"||r.endsWith(".localhost")||r==="::1"||r==="[::1]"?{ok:!1,reason:"refused loopback host"}:Dk(r)?{ok:!1,reason:"refused private address"}:{ok:!0,url:t}}function Nk(e){let t=e.replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<noscript[\s\S]*?<\/noscript>/gi," ").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim();return t.length>cp?t.slice(0,cp):t}function $1(e){let t=[],r=/class="result__a"[^>]*href="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi,n;for(;(n=r.exec(e))&&t.length<pp;){let o=n[1]??"",i=Nk(n[2]??""),a=o,m=/[?&]uddg=([^&]+)/.exec(o);if(m)try{a=decodeURIComponent(m[1])}catch{a=o}else o.startsWith("//")&&(a=`https:${o}`);let c=nm(a);!c.ok||!i||t.push({title:i,url:c.url.toString(),snippet:""})}return t}var jk="HowToFix (https://howtofix.id)";async function Uk(e,t={}){let r=e.trim();if(!r)return{ok:!1,error:"empty query"};let n=t.fetchFn??fetch,o=t.timeoutMs??15e3,i={"user-agent":t.userAgent??jk,accept:"text/html, application/json"};try{if(t.braveKey){let p=`https://api.search.brave.com/res/v1/web/search?q=${encodeURIComponent(r)}&count=${pp}`,f=await n(p,{headers:{...i,accept:"application/json","x-subscription-token":t.braveKey},signal:AbortSignal.timeout(o)});return f.ok?{ok:!0,hits:k1(await f.json()),provider:"brave"}:{ok:!1,error:`brave ${f.status}`}}let a=`https://html.duckduckgo.com/html/?q=${encodeURIComponent(r)}`,m=await n(a,{headers:i,signal:AbortSignal.timeout(o)});return m.ok?{ok:!0,hits:$1(await m.text()),provider:"ddg"}:{ok:!1,error:`search ${m.status}`}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}function k1(e){let t=[];if(e&&typeof e=="object"&&"web"in e){let n=e.web;n&&typeof n=="object"&&"results"in n&&Array.isArray(n.results)&&(t=n.results)}let r=[];for(let n of t){if(!n||typeof n!="object"||!("url"in n)||!("title"in n))continue;let o=n.url,i=n.title;if(typeof o!="string"||typeof i!="string")continue;let a=nm(o);if(!a.ok)continue;let m="description"in n?n.description:void 0;if(r.push({title:i,url:a.url.toString(),snippet:typeof m=="string"?m:""}),r.length>=pp)break}return r}var _k=5,T1=new Set([301,302,303,307,308]);async function w1(e,t){let r=e.toLowerCase().replace(/^\[|\]$/g,"");if(r.includes(":")||/^[\d.]+$/.test(r))return{ok:!0};let n;try{n=await t(r)}catch(i){return{ok:!1,error:`could not resolve ${e}: ${i instanceof Error?i.message:String(i)}`}}if(n.length===0)return{ok:!1,error:`could not resolve ${e}`};let o=n.find(i=>Dk(i));return o!==void 0?{ok:!1,error:`refused ${e}: resolves to private address ${o}`}:{ok:!0}}async function qk(e,t={}){let r=nm(e);if(!r.ok)return{ok:!1,error:r.reason};let n=t.fetchFn??fetch,o=t.lookup??(m=>E1.lookup(m,{all:!0}).then(c=>c.map(p=>p.address))),i=AbortSignal.timeout(t.timeoutMs??2e4),a={"user-agent":t.userAgent??jk,accept:"text/html, text/plain, application/json"};try{let m=r.url;for(let c=0;c<=_k;c++){let p=nm(m.toString());if(!p.ok)return{ok:!1,error:`redirect refused: ${p.reason}`};let f=await w1(p.url.hostname,o);if(!f.ok)return{ok:!1,error:f.error};let d=await n(p.url,{headers:a,signal:i,redirect:"manual"});if(T1.has(d.status)){let y=d.headers.get("location");if(!y)return{ok:!1,error:`HTTP ${d.status} without a location`};try{m=new URL(y,p.url)}catch{return{ok:!1,error:"redirect location is not a URL"}}continue}if(!d.ok)return{ok:!1,error:`HTTP ${d.status}`};let g=d.headers.get("content-type")??"",I=await d.text(),h=/html/i.test(g)?Nk(I):I.slice(0,cp);return{ok:!0,url:m.toString(),contentType:g,text:h}}return{ok:!1,error:`too many redirects (max ${_k})`}}catch(m){return{ok:!1,error:m instanceof Error?m.message:String(m)}}}function R1(e){return e.length===0?"no results":e.map((t,r)=>`${r+1}. ${t.title}
|
|
121
|
+
${t.url}${t.snippet?`
|
|
122
|
+
${t.snippet}`:""}`).join(`
|
|
123
|
+
`)}var Kk=Gk({name:"web_search",label:"web_search",description:"Search the public web. Use for current docs, changelogs, error messages, and anything not in this repo. Returns titles, URLs, and snippets. Follow a URL with web_fetch.",promptSnippet:"web_search: search the public web",parameters:om.Object({query:om.String({description:"Search query"})}),async execute(e,t){let r=await Uk(t.query,{braveKey:process.env.BRAVE_API_KEY});return r.ok?{content:[{type:"text",text:R1(r.hits)}],details:{count:r.hits.length,provider:r.provider}}:{content:[{type:"text",text:r.error}],details:{error:r.error},isError:!0}}}),Bk=Gk({name:"web_fetch",label:"web_fetch",description:"Fetch a public http(s) URL and return its text. HTML is stripped to visible text. Local, loopback, and private addresses are refused.",promptSnippet:"web_fetch: read a public URL as text",parameters:om.Object({url:om.String({description:"http(s) URL"})}),async execute(e,t){let r=await qk(t.url);return r.ok?{content:[{type:"text",text:r.text}],details:{url:r.url,contentType:r.contentType,chars:r.text.length}}:{content:[{type:"text",text:r.error}],details:{error:r.error},isError:!0}}});import{spawn as C1}from"node:child_process";import{existsSync as Hk,readFileSync as P1}from"node:fs";import{delimiter as A1,isAbsolute as O1,join as zk}from"node:path";import{fileURLToPath as M1,pathToFileURL as Ln}from"node:url";function Wk(e){let t=JSON.stringify(e);return`Content-Length: ${Buffer.byteLength(t,"utf8")}\r
|
|
124
|
+
\r
|
|
125
|
+
${t}`}var F1=32*1024*1024;function v1(e){let t=[],r=0;for(;r<e.length;){let n=e.indexOf(`\r
|
|
126
|
+
\r
|
|
127
|
+
`,r);if(n===-1)break;let o=e.subarray(r,n).toString("utf8"),i=/Content-Length:\s*(\d+)/i.exec(o);if(!i)break;let a=Number(i[1]);if(!Number.isSafeInteger(a)||a<0||a>F1)throw new Error(`lsp frame of ${i[1]} bytes refused`);let m=n+4,c=m+a;if(c>e.length)break;let p=e.subarray(m,c).toString("utf8");try{let f=JSON.parse(p);f&&typeof f=="object"&&t.push(f)}catch{}r=c}return{messages:t,rest:e.subarray(r)}}var fp=class{constructor(t){this.io=t;t.stdout.on("data",r=>{if(this.broken)return;this.buffer=Buffer.concat([this.buffer,r]);let n;try{n=v1(this.buffer)}catch(o){this.buffer=Buffer.alloc(0),this.fail(o instanceof Error?o:new Error(String(o)));return}this.buffer=n.rest;for(let o of n.messages)this.dispatch(o)}),t.stdin.on("error",r=>{this.fail(r instanceof Error?r:new Error(String(r)))})}io;nextId=1;pending=new Map;buffer=Buffer.alloc(0);broken=null;opened=new Set;diagnosticsByUri=new Map;diagnosticsWaiters=new Map;fail(t){if(!this.broken){this.broken=t;for(let[r,n]of this.pending)this.pending.delete(r),n.reject(t)}}dispatch(t){if(t.method==="textDocument/publishDiagnostics"){let n=t.params;if(n?.uri){let o=Array.isArray(n.diagnostics)?n.diagnostics:[];this.diagnosticsByUri.set(n.uri,o);let i=this.diagnosticsWaiters.get(n.uri);if(i){this.diagnosticsWaiters.delete(n.uri);for(let a of i)a(o)}}return}if(t.id===void 0)return;let r=this.pending.get(Number(t.id));r&&(this.pending.delete(Number(t.id)),t.error?r.reject(new Error(t.error.message)):r.resolve(t.result))}request(t,r,n=1e4){if(this.broken)return Promise.reject(this.broken);let o=this.nextId++,i=Wk({jsonrpc:"2.0",id:o,method:t,params:r}),{promise:a,resolve:m,reject:c}=Promise.withResolvers(),p=setTimeout(()=>{this.pending.delete(o),c(new Error(`lsp ${t} timed out`))},n);this.pending.set(o,{resolve:f=>{clearTimeout(p),m(f)},reject:f=>{clearTimeout(p),c(f)}});try{this.io.stdin.write(i)}catch(f){let d=f instanceof Error?f:new Error(String(f));this.pending.delete(o),clearTimeout(p),c(d),this.fail(d)}return a}notify(t,r){if(!this.broken)try{this.io.stdin.write(Wk({jsonrpc:"2.0",method:t,params:r}))}catch(n){this.fail(n instanceof Error?n:new Error(String(n)))}}async initialize(){await this.request("initialize",{processId:null,rootUri:Ln(this.io.root).toString(),capabilities:{textDocument:{hover:{},definition:{},references:{},documentSymbol:{},publishDiagnostics:{}}}}),this.notify("initialized",{})}async hover(t,r,n){return(await this.request("textDocument/hover",{textDocument:{uri:Ln(t).toString()},position:{line:r,character:n}}))?.contents?.value}async definition(t,r,n){let o=await this.request("textDocument/definition",{textDocument:{uri:Ln(t).toString()},position:{line:r,character:n}});return Array.isArray(o)?o[0]:o??void 0}async references(t,r,n){let o=await this.request("textDocument/references",{textDocument:{uri:Ln(t).toString()},position:{line:r,character:n},context:{includeDeclaration:!0}});return Array.isArray(o)?o:[]}async documentSymbols(t){let r=await this.request("textDocument/documentSymbol",{textDocument:{uri:Ln(t).toString()}});return Array.isArray(r)?r:[]}diagnostics(t,r=2e3){let n=Ln(t).toString(),o=this.diagnosticsByUri.get(n);if(o)return Promise.resolve(o);let{promise:i,resolve:a}=Promise.withResolvers(),m=setTimeout(()=>{let p=this.diagnosticsWaiters.get(n);if(p){this.diagnosticsWaiters.delete(n);for(let f of p)f(this.diagnosticsByUri.get(n)??[])}},r),c=this.diagnosticsWaiters.get(n)??[];return c.push(p=>{clearTimeout(m),a(p)}),this.diagnosticsWaiters.set(n,c),i}async ensureOpen(t,r,n){let o=Ln(t).toString();this.opened.has(o)||(this.notify("textDocument/didOpen",{textDocument:{uri:o,languageId:n,version:1,text:r}}),this.opened.add(o))}dispose(){for(let[t,r]of this.pending)r.reject(new Error("lsp client disposed")),this.pending.delete(t);for(let[t,r]of this.diagnosticsWaiters){let n=this.diagnosticsByUri.get(t)??[];this.diagnosticsWaiters.delete(t);for(let o of r)o(n)}}},L1=[{command:"typescript-language-server",args:["--stdio"],languageId:"typescript",match:e=>/\.(ts|tsx|js|jsx|mts|cts)$/.test(e)},{command:"rust-analyzer",args:[],languageId:"rust",match:e=>e.endsWith(".rs")},{command:"gopls",args:[],languageId:"go",match:e=>e.endsWith(".go")},{command:"pylsp",args:[],languageId:"python",match:e=>e.endsWith(".py")}];function _1(e){return L1.find(t=>t.match(e))}var Pr=new Map;async function D1(e,t){let r=Pr.get(e.command);if(r)return await r.ready,r.client;let n=C1(e.command,e.args,{cwd:t,stdio:["pipe","pipe","ignore"]}),o=n.stdin,i=n.stdout;if(!o||!i)throw n.kill(),new Error(`${e.command}: stdio pipes unavailable`);let a=new fp({stdin:o,stdout:i,root:t});n.on("error",()=>{let c=Pr.get(e.command);c?.child===n&&Pr.delete(e.command),c?.client.dispose()}),n.on("exit",()=>{Pr.get(e.command)?.child===n&&Pr.delete(e.command),a.dispose()});let m=a.initialize().catch(c=>{throw Pr.delete(e.command),n.kill(),c});return Pr.set(e.command,{client:a,child:n,ready:m}),await m,a}function N1(){for(let[e,t]of Pr)Pr.delete(e),t.client.dispose(),t.child.kill()}process.on("exit",N1);var j1={1:"error",2:"warning",3:"info",4:"hint"};function Vk(e){let t=e.uri;try{t=M1(e.uri)}catch{}let r=e.range?.start;return r?`${t}:${r.line+1}:${r.character+1}`:t}function Jk(e,t=0){let r=[];for(let n of e){let o=(n.selectionRange??n.range)?.start.line;r.push(`${" ".repeat(t)}${n.name}${o===void 0?"":` :${o+1}`}`),n.children&&r.push(...Jk(n.children,t+1))}return r}async function Xk(e){try{let t=_1(e.file);if(!t)return{ok:!1,error:`no language server configured for ${e.file}`};if((e.action==="definition"||e.action==="references"||e.action==="hover")&&(e.line===void 0||!Number.isInteger(e.line)||e.line<1))return{ok:!1,error:`line required (1-based) for ${e.action}`};if(!(t.command.includes("/")?Hk(t.command):(process.env.PATH??"").split(A1).some(p=>Hk(zk(p,t.command)))))return{ok:!1,error:`${t.command} is not on PATH. Install it to use lsp on ${e.file}.`};let o=O1(e.file)?e.file:zk(e.root,e.file),i=P1(o,"utf8"),a=await D1(t,e.root);await a.ensureOpen(o,i,t.languageId);let m=(e.line??1)-1,c=0;if(e.symbol){let p=(i.split(`
|
|
128
|
+
`)[m]??"").indexOf(e.symbol);p>=0&&(c=p)}switch(e.action){case"definition":{let p=await a.definition(o,m,c);return p?{ok:!0,text:Vk(p),count:1}:{ok:!0,text:"no definition found",count:0}}case"references":{let f=(await a.references(o,m,c)).map(Vk);return{ok:!0,text:f.length>0?f.join(`
|
|
129
|
+
`):"no references found",count:f.length}}case"hover":{let p=(await a.hover(o,m,c))?.trim();return{ok:!0,text:p||"no hover at that position"}}case"symbols":{let p=Jk(await a.documentSymbols(o));return{ok:!0,text:p.length>0?p.join(`
|
|
130
|
+
`):"no symbols in this file",count:p.length}}case"diagnostics":{let f=(await a.diagnostics(o)).map(d=>`${d.range.start.line+1}:${d.range.start.character+1} ${j1[d.severity??3]??"info"} ${d.message}`);return{ok:!0,text:f.length>0?f.join(`
|
|
131
|
+
`):"no diagnostics",count:f.length}}}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}}import{StringEnum as U1}from"@netrodev/hxf-ai";import{defineTool as q1}from"@netrodev/hxf-coding-agent";var Qk=q1({name:"lsp",label:"lsp",description:"Language-server query: definition, references, hover, symbols, or diagnostics for a file. Line is 1-based. Does not edit. If the server binary is missing the result says so; do not pretend grep is a substitute without telling the user.",promptSnippet:"lsp: definition, references, hover, symbols, diagnostics",parameters:O.Object({action:U1(["diagnostics","definition","references","hover","symbols"],{description:"Which language-server query to run"}),file:O.String({description:"File to query, relative to the project root"}),line:O.Optional(O.Number({description:"1-based line (definition, references, hover)"})),symbol:O.Optional(O.String({description:"Substring to locate on that line when column is omitted"}))}),async execute(e,t,r,n,o){let i=await Xk({action:t.action,file:t.file,line:t.line,symbol:t.symbol,root:o.cwd});return i.ok?{content:[{type:"text",text:i.text}],details:{action:t.action,count:i.count}}:{content:[{type:"text",text:i.error}],details:{error:i.error},isError:!0}}});import{defineTool as h_}from"@netrodev/hxf-coding-agent";import{API as G1}from"typescript/unstable/async";import{SyntaxKind as Dt,visitEachChild as Yk}from"typescript/unstable/ast";var Zk=new Set([Dt.FunctionDeclaration,Dt.FunctionExpression,Dt.ArrowFunction,Dt.MethodDeclaration,Dt.Constructor,Dt.GetAccessor,Dt.SetAccessor]);function So(e){return Zk.has(e)}var K1=new Set([Dt.AmpersandAmpersandToken,Dt.BarBarToken,Dt.QuestionQuestionToken]);function im(e){if(e.kind!==Dt.BinaryExpression)return!1;let t=We(e,"operatorToken");return t!==void 0&&K1.has(t.kind)}function We(e,t){let r=e[t];if(r&&typeof r=="object"&&typeof r.kind=="number")return r}function Oi(e,t){let r=e[t];return Array.isArray(r)?r:[]}function eT(e,t){return Oi(e,"modifiers").some(r=>r.kind===t)}function Eo(e){if(!e)return;let t=e.text;return typeof t=="string"?t:void 0}function B1(e,t){return e.getLineAndCharacterOfPosition(t).line+1}function dp(e,t){let r=e.getLineAndCharacterOfPosition(t.getStart(e)),n=e.getLineAndCharacterOfPosition(t.end);return{startLine:r.line+1,startColumn:r.character+1,endLine:n.line+1,endColumn:n.character+1}}function sm(e,t){t(e),Yk(e,r=>(sm(r,t),r))}function Mi(e,t){t(e),Yk(e,r=>(So(r.kind)||Mi(r,t),r))}var H1=Zk;function z1(e){let t=Eo(We(e,"name"));if(t)return t;let r=We(e,"parent");for(;r&&!H1.has(r.kind);){if(r.kind===Dt.VariableDeclaration||r.kind===Dt.PropertyAssignment){let n=Eo(We(r,"name"));if(n)return n}r=We(r,"parent")}return"<anonymous>"}function W1(e){let t=[];return sm(e,r=>{if(!So(r.kind))return;let n=dp(e,r);t.push({name:z1(r),node:r,startLine:n.startLine,endLine:n.endLine})}),t}async function tT(e){let t=new Map;if(e.length===0)return t;let r=new G1({cwd:process.cwd()});try{let n=await r.updateSnapshot({openFiles:[...e]});for(let o of e)try{let i=await n.getDefaultProjectForFile(o);if(!i){t.set(o,{ok:!1,error:"no TypeScript project contains this file"});continue}let a=await i.program.getSourceFile(o);if(!a){t.set(o,{ok:!1,error:"the compiler could not read this file"});continue}let m=await i.program.getSyntacticDiagnostics(o);if(m.length>0){let c=m[0],p=B1(a,c.pos);t.set(o,{ok:!1,error:`line ${p}: ${c.text} (TS${c.code})`});continue}t.set(o,{ok:!0,sourceFile:a,functions:W1(a)})}catch(i){t.set(o,{ok:!1,error:i instanceof Error?i.message:String(i)})}}finally{await r.close()}return t}import{SyntaxKind as xr,visitEachChild as rT}from"typescript/unstable/ast";var V1=new Set([xr.IfStatement,xr.SwitchStatement,xr.ForStatement,xr.ForInStatement,xr.ForOfStatement,xr.WhileStatement,xr.DoStatement,xr.CatchClause]);function nT(e){let t=0,r=(o,i)=>{if(!So(o.kind)){if(o.kind===xr.IfStatement){n(o,i,!1);return}if(V1.has(o.kind)){t+=1+i,rT(o,a=>(r(a,i+1),a));return}im(o)&&(t+=1),rT(o,a=>(r(a,i),a))}},n=(o,i,a)=>{a||(t+=1+i);let m=We(o,"expression");m&&r(m,i);let c=We(o,"thenStatement");c&&r(c,i+1);let p=We(o,"alternate");p&&(t+=1,p.kind===xr.IfStatement?n(p,i,!0):r(p,i+1))};return r(e,0),t}import{SyntaxKind as Ar}from"typescript/unstable/ast";var J1=new Set([Ar.IfStatement,Ar.ConditionalExpression,Ar.WhileStatement,Ar.DoStatement,Ar.ForStatement,Ar.ForInStatement,Ar.ForOfStatement,Ar.CatchClause,Ar.CaseClause]);function oT(e){let t=1;return Mi(e,r=>{(J1.has(r.kind)||im(r))&&(t+=1)}),t}import{SyntaxKind as ne}from"typescript/unstable/ast";var X1=new Set([ne.BinaryExpression,ne.PrefixUnaryExpression,ne.PostfixUnaryExpression,ne.ConditionalExpression,ne.CallExpression,ne.NewExpression,ne.PropertyAccessExpression,ne.ElementAccessExpression,ne.AwaitExpression,ne.YieldExpression,ne.SpreadElement,ne.IfStatement,ne.WhileStatement,ne.DoStatement,ne.ForStatement,ne.ForInStatement,ne.ForOfStatement,ne.SwitchStatement,ne.ReturnStatement,ne.ThrowStatement,ne.TryStatement,ne.BreakStatement,ne.ContinueStatement]),Q1=new Set([ne.StringLiteral,ne.NumericLiteral,ne.BigIntLiteral,ne.RegularExpressionLiteral,ne.NoSubstitutionTemplateLiteral]);function lp(e,t){e.set(t,(e.get(t)??0)+1)}function iT(e){let t=new Map,r=new Map;Mi(e,i=>{if(X1.has(i.kind)){let m=We(i,"operatorToken");lp(t,ne[i.kind]+(m?`:${ne[m.kind]}`:""));return}let a=Eo(i);a!==void 0&&(i.kind===ne.Identifier||i.kind===ne.PrivateIdentifier?lp(r,`id:${a}`):Q1.has(i.kind)&&lp(r,`lit:${a}`))});let n=t.size+r.size;if(n===0)return 0;let o=0;for(let i of t.values())o+=i;for(let i of r.values())o+=i;return Math.round(o*Math.log2(n)*100)/100}function sT(e){return e.endLine-e.startLine+1}function aT(e,t,r){let n=171-5.2*Math.log(Math.max(e,1))-.23*t-16.2*Math.log(Math.max(r,1));return Math.round(Math.max(0,n*100/171)*10)/10}import{SyntaxKind as Zt,visitEachChild as Y1}from"typescript/unstable/ast";var Z1=new Set([Zt.IfStatement,Zt.SwitchStatement,Zt.WhileStatement,Zt.DoStatement,Zt.ForStatement,Zt.ForInStatement,Zt.ForOfStatement,Zt.TryStatement,Zt.CatchClause]);function mT(e){let t=0,r=(n,o)=>{if(So(n.kind))return;let i=o;if(Z1.has(n.kind)&&(i=o+1,i>t&&(t=i)),n.kind===Zt.IfStatement){let a=We(n,"expression");a&&r(a,i);let m=We(n,"thenStatement");m&&r(m,i);let c=We(n,"alternate");c&&r(c,c.kind===Zt.IfStatement?o:i);return}Y1(n,a=>(r(a,i),a))};return r(e,0),t}import{spawnSync as e_}from"node:child_process";import{mkdirSync as FMe,readdirSync as t_,readFileSync as r_,statSync as n_,writeFileSync as vMe}from"node:fs";import{extname as Ip,join as gT,relative as xT,resolve as o_}from"node:path";import{SyntaxKind as am}from"typescript/unstable/ast";var uT={"god-function":"split it into smaller functions, one job each",incomprehensible:"extract helpers and simplify the flow before touching it",bloated:"long but linear; extract helpers","deeply-tangled":"nesting, not branching; flatten with early returns",fragile:"many branches; add guard clauses and tests around it"};function cT(e,t){let r=[];return t.cyclomatic>=1&&t.length>=1&&t.nesting>=1&&r.push({id:"god-function",label:"God Function",reason:`high cyclomatic complexity (${e.cyclomatic}), long body (${e.length} lines), and deep nesting (${e.nesting}) \u2014 likely doing too many things`}),t.cognitive>=1&&t.halstead>=1&&t.mi>=1&&r.push({id:"incomprehensible",label:"Incomprehensible",reason:`high cognitive complexity (${e.cognitive}) and Halstead volume (${e.halstead}) with MI ${e.mi} \u2014 very hard to understand`}),t.length>=1&&t.halstead>=1&&t.cyclomatic===0&&r.push({id:"bloated",label:"Bloated",reason:`large function (${e.length} lines) with high vocabulary (Halstead ${e.halstead}) but low branching \u2014 consider extracting helpers`}),t.nesting>=1&&t.cognitive>=1&&t.cyclomatic===0&&r.push({id:"deeply-tangled",label:"Deeply Tangled",reason:`nesting depth ${e.nesting} drives cognitive complexity ${e.cognitive} \u2014 flatten with early returns or extracted helpers`}),t.cyclomatic>=1&&t.mi>=1&&t.length===0&&r.push({id:"fragile",label:"Fragile",reason:`high cyclomatic complexity (${e.cyclomatic}) with MI ${e.mi} \u2014 many branches, hard to change safely`}),r}var i_=["ok","warn","error"],Ep=["cyclomatic","cognitive","nesting","length","halstead","mi","parameters","booleanParameters"];var Or={cyclomatic:{warn:15,error:25},cognitive:{warn:12,error:20},nesting:{warn:4,error:5},length:{warn:60,error:120},halstead:{warn:500,error:1e3},mi:{warn:65,error:20},fileLines:{warn:400,error:800},exports:{warn:20,error:30},parameters:{warn:5,error:8}};function IT(){let e={cyclomatic:{...Or.cyclomatic},cognitive:{...Or.cognitive},nesting:{...Or.nesting},length:{...Or.length},halstead:{...Or.halstead},mi:{...Or.mi},fileLines:{...Or.fileLines},exports:{...Or.exports},parameters:{...Or.parameters}};return{ignore:[],thresholds:e,ci:{failBelow:65,mode:"advisory"}}}var s_=["cyclomatic","cognitive","nesting","length","halstead","mi","fileLines","exports","parameters"];function gp(e){return typeof e=="number"&&Number.isFinite(e)}function Sp(e){let t=IT(),r;try{r=JSON.parse(r_(gT(e,".howtofix","quality.json"),"utf8"))}catch{return t}if(typeof r!="object"||r===null)return t;let n=r;if(typeof n.enabled=="boolean"&&(t.enabled=n.enabled),Array.isArray(n.ignore)&&(t.ignore=n.ignore.filter(o=>typeof o=="string")),typeof n.thresholds=="object"&&n.thresholds!==null){let o=n.thresholds;for(let i of s_){let a=o[i];if(typeof a!="object"||a===null)continue;let m=a;gp(m.warn)&&(t.thresholds[i].warn=m.warn),gp(m.error)&&(t.thresholds[i].error=m.error)}}if(typeof n.ci=="object"&&n.ci!==null){let o=n.ci;gp(o.failBelow)&&(t.ci.failBelow=o.failBelow),(o.mode==="advisory"||o.mode==="blocking")&&(t.ci.mode=o.mode)}return t}function hT(e,t){let r=process.env.HOWTOFIX_QUALITY;if(r!==void 0){let o=r.trim().toLowerCase();return o==="0"||o==="false"?{enabled:!1,source:"env"}:{enabled:!0,source:"env"}}let n=Sp(e).enabled;return n!==void 0?{enabled:n,source:"config"}:t!==void 0?{enabled:t,source:"runtime"}:{enabled:!0,source:"default"}}function sn(e,t){return e>t.error?2:e>t.warn?1:0}function yT(e,t){return e<t.error?2:e<t.warn?1:0}function a_(e){let t=[];for(let r of Oi(e.node,"parameters"))We(r,"type")?.kind===am.BooleanKeyword&&t.push(Eo(We(r,"name"))??"<pattern>");return t}function m_(e,t,r,n){let o=n.thresholds,i=We(e.node,"body")??e.node,a={cyclomatic:oT(i),cognitive:nT(i),nesting:mT(i),length:sT(e),halstead:iT(i),mi:0};a.mi=aT(a.halstead,a.cyclomatic,a.length);let m=a_(e),c=Oi(e.node,"parameters").length,p={cyclomatic:{value:a.cyclomatic,rank:sn(a.cyclomatic,o.cyclomatic)},cognitive:{value:a.cognitive,rank:sn(a.cognitive,o.cognitive)},nesting:{value:a.nesting,rank:sn(a.nesting,o.nesting)},length:{value:a.length,rank:sn(a.length,o.length)},halstead:{value:a.halstead,rank:sn(a.halstead,o.halstead)},mi:{value:a.mi,rank:yT(a.mi,o.mi)},parameters:{value:c,rank:sn(c,o.parameters)},booleanParameters:{value:m.length,rank:m.length>0?1:0}},f={cyclomatic:p.cyclomatic.rank,cognitive:p.cognitive.rank,nesting:p.nesting.rank,length:p.length.rank,halstead:p.halstead.rank,mi:p.mi.rank},d=dp(t,e.node),g=0;for(let I of Ep)p[I].rank>g&&(g=p[I].rank);return{path:r,name:e.name,startLine:d.startLine,endLine:d.endLine,startColumn:d.startColumn,endColumn:d.endColumn,metrics:p,booleanParameterNames:m,smells:cT(a,f),worstRank:g}}function u_(e){let t=0;return sm(e,r=>{if(r.kind===am.ExportDeclaration){let n=We(r,"exportClause"),o=n?Oi(n,"elements"):[];t+=o.length>0?o.length:1;return}if(r.kind===am.ExportAssignment){t+=1;return}eT(r,am.ExportKeyword)&&(t+=1)}),t}function c_(e){if(e.length===0)return 0;let t=1;for(let r=0;r<e.length;r+=1)e.charCodeAt(r)===10&&(t+=1);return e.charCodeAt(e.length-1)===10&&(t-=1),t}var pT={value:0,rank:0};function fT(e,t){return{path:e,ok:!1,error:t,lines:0,metrics:{lines:pT,exports:pT,mi:{value:100,rank:0}},functions:[]}}function xp(e,t,r,n,o,i,a){i.rank!==0&&e.push({path:t.path,metric:o,detail:o==="booleanParameters"?r?.booleanParameterNames.join(", ")??String(i.value):`${i.value} (limit ${a})`,rank:i.rank,line:n.line,endLine:n.endLine,startColumn:n.startColumn,endColumn:n.endColumn,...r?{function:r.name}:{}})}async function bT(e,t=IT()){let r=await tT(e),n=new Map,o=[],i=t.thresholds;for(let a of e){let m=r.get(a);if(!m){let b=fT(a,"internal: file missing from the parse result");n.set(a,b),o.push({path:a,metric:"parse error",detail:b.error??"",rank:2,line:1,endLine:1,startColumn:1,endColumn:1});continue}if(!m.ok){let b=fT(a,m.error);n.set(a,b),o.push({path:a,metric:"parse error",detail:m.error,rank:2,line:1,endLine:1,startColumn:1,endColumn:1});continue}let{sourceFile:c}=m,p=m.functions.map(b=>m_(b,c,a,t)),f=c_(c.text),d=u_(c),g=p.reduce((b,R)=>b+R.metrics.length.value,0),I=g===0?100:Math.round(p.reduce((b,R)=>b+R.metrics.mi.value*R.metrics.length.value,0)/g*10)/10,h={path:a,ok:!0,lines:f,metrics:{lines:{value:f,rank:sn(f,i.fileLines)},exports:{value:d,rank:sn(d,i.exports)},mi:{value:I,rank:yT(I,i.mi)}},functions:p};n.set(a,h);let y={line:1,endLine:Math.max(f,1),startColumn:1,endColumn:1};xp(o,h,void 0,y,"file lines",h.metrics.lines,i.fileLines.warn),xp(o,h,void 0,y,"exports",h.metrics.exports,i.exports.warn);for(let b of p){let R={line:b.startLine,endLine:b.endLine,startColumn:b.startColumn,endColumn:b.endColumn};for(let L of Ep)xp(o,h,b,R,L,b.metrics[L],ET(L,i));for(let L of b.smells)o.push({path:a,metric:"smell",detail:`${L.label}: ${L.reason}`,rank:1,line:b.startLine,endLine:b.endLine,startColumn:b.startColumn,endColumn:b.endColumn,function:b.name})}}return{files:n,findings:o}}function $p(e){let t=0,r=0;for(let n of e.files.values())if(n.ok)for(let o of n.functions)t+=o.metrics.length.value,r+=o.metrics.mi.value*o.metrics.length.value;return t===0?100:Math.round(r/t*10)/10}function kp(e){let t=0,r=0,n=0,o=0;for(let i of e.files.values())i.ok||(t+=1),r+=i.functions.length;for(let i of e.findings)i.rank>=2?o+=1:n+=1;return{files:e.files.size,errorFiles:t,functions:r,findings:e.findings.length,warn:n,error:o,score:$p(e)}}var p_=["ok","\u26A0","\u2717"],f_=[["cyclomatic","cyclomatic"],["cognitive","cognitive"],["nesting","nesting"],["length","length"],["halstead","halstead"],["mi","MI"],["parameters","parameters"],["booleanParameters","boolean params"]];function ET(e,t){return e==="mi"?t.mi.warn:e==="booleanParameters"?t.parameters.warn:t[e].warn}function hp(e,t,r,n){return`${e}${t.padEnd(15)} ${r.value} (limit ${n}) ${i_[r.rank]}`}function d_(e,t){let r=[` ${e.name.padEnd(30)} L${e.startLine}-${e.endLine}`];for(let[n,o]of f_){let i=e.metrics[n];if(i.rank!==0){if(n==="booleanParameters"){r.push(` ${o.padEnd(15)} ${e.booleanParameterNames.join(", ")} warn`);continue}r.push(hp(" ",o,i,ET(n,t.thresholds)))}}if(e.smells.length>0){r.push(` ${"smells".padEnd(15)} ${e.smells.map(n=>n.id).join(", ")}`);for(let n of e.smells)r.push(` \u2192 ${uT[n.id]??n.label}`)}return r}function dT(e){let t=e.smells.length;for(let r of Ep)e.metrics[r].rank>0&&(t+=1);return t}function l_(e,t){let r=[];for(let o of e.files.values())for(let i of o.functions)i.worstRank>0&&r.push(i);r.sort((o,i)=>{if(o.worstRank!==i.worstRank)return i.worstRank-o.worstRank;let a=dT(i)-dT(o);if(a!==0)return a;let m=i.metrics.cyclomatic.value-o.metrics.cyclomatic.value;return m!==0?m:`${o.path}:${o.name}`.localeCompare(`${i.path}:${i.name}`)});let n=new Map;for(let o of r.slice(0,t)){let i=n.get(o.path)??new Set;i.add(`${o.name}@${o.startLine}`),n.set(o.path,i)}return n}function ST(e,t,r={}){let n=kp(e),o=r.top&&r.top>0?l_(e,r.top):void 0,i=[...e.files.values()].filter(p=>!o||(o.get(p.path)?.size??0)>0),a=Math.max(40,...i.map(p=>p.path.length)),m=[];for(let p of i){if(!p.ok){m.push(`${p.path.padEnd(a)} parse error`),m.push(` ${p.error}`);continue}m.push(`${p.path.padEnd(a)} MI ${p.metrics.mi.value} ${p_[p.metrics.mi.rank]}`),p.metrics.lines.rank>0&&m.push(hp(" ","file lines",p.metrics.lines,t.thresholds.fileLines.warn)),p.metrics.exports.rank>0&&m.push(hp(" ","exports",p.metrics.exports,t.thresholds.exports.warn));for(let f of p.functions)o&&!o.get(p.path)?.has(`${f.name}@${f.startLine}`)||f.worstRank===0&&f.smells.length===0||m.push(...d_(f,t))}m.length>0&&m.push("");let c=n.errorFiles>0?`, ${n.errorFiles} parse error(s)`:"";return m.push(`${n.findings} findings in ${n.files} files${c} \xB7 ${n.functions} functions \xB7 score ${n.score}`),m.join(`
|
|
132
|
+
`)}var yp=new Set([".ts",".tsx",".mts",".cts"]),g_=new Set(["node_modules","dist","coverage"]);function bp(e,t,r){for(let n of t_(e,{withFileTypes:!0})){let o=gT(e,n.name);if(n.isDirectory()){if(n.name.startsWith(".")||g_.has(n.name))continue;bp(o,t,r);continue}n.isFile()&&yp.has(Ip(n.name))&&r.push(xT(t,o))}}function lT(e,t){let r=e_("git",["-C",e,...t],{encoding:"utf8"});if(r.error||r.status!==0){let n=r.error?r.error.message:r.stderr.trim()||`exit ${r.status}`;throw new Error(`git ${t.join(" ")} failed: ${n}`)}return r.stdout.split(`
|
|
133
|
+
`).filter(n=>n.trim().length>0)}function x_(e,t){let r=lT(e,["diff","--name-only","--diff-filter=ACMR",t]),n=lT(e,["ls-files","--others","--exclude-standard"]);return[...r,...n]}function I_(e,t){if(!t.includes("*")){let n=t.endsWith("/")?t:`${t}/`;return e===t||e.startsWith(n)}let r=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\0").replace(/\*/g,"[^/]*").replace(/\u0000/g,".*");return new RegExp(`^${r}$`).test(e)}function $T(e,t,r=[]){let n;if(t.changes)n=x_(e,t.base??"HEAD");else if(t.target){let i=o_(e,t.target),a=n_(i,{throwIfNoEntry:!1});if(!a)throw new Error(`no such path: ${t.target}`);if(a.isDirectory())n=[],bp(i,e,n);else{if(!yp.has(Ip(i)))throw new Error(`not a TypeScript source file: ${t.target}`);n=[xT(e,i)]}}else n=[],bp(e,e,n);let o=new Set;for(let i of n)yp.has(Ip(i))&&(r.some(a=>I_(i,a))||o.add(i));return[...o].sort()}var kT=6e3,TT=h_({name:"quality",label:"quality",description:"Measure code quality: cyclomatic and cognitive complexity, nesting depth, function length, Halstead volume, maintainability index, and compound smells like god-function and deeply-tangled. Read-only. Use it before reporting a task finished, especially on functions you just wrote or changed; it reports concrete numbers with line numbers and a suggested next step, so 'is this too complex' stops being a guess. Defaults to the changed files; pass a path to narrow it further.",promptSnippet:"quality: complexity and maintainability metrics for changed code",parameters:O.Object({path:O.Optional(O.String({description:"One file or directory, relative to the project root. Omit to scan the changed set."})),changes:O.Optional(O.Boolean({description:"Scan only files changed against the base ref. Default true when path is omitted."})),base:O.Optional(O.String({description:"Git ref for `changes`. Defaults to HEAD."})),top:O.Optional(O.Number({description:"Only report the N worst functions."}))}),async execute(e,t,r,n,o){let i=o.cwd??process.cwd(),a=hT(i);if(!a.enabled)return{content:[{type:"text",text:`quality metrics are off (source: ${a.source})`}],details:{off:!0}};let m=Sp(i),c=t.changes??t.path===void 0,p=$T(i,{changes:c,base:t.base,target:t.path},m.ignore);if(p.length===0)return{content:[{type:"text",text:c?"no changed files to measure":"no source files found"}],details:{files:0}};let f=await bT(p,m),d=kp(f),g=ST(f,m,{top:t.top});return{content:[{type:"text",text:g.length>kT?`${g.slice(0,kT)}
|
|
134
|
+
\u2026 (truncated; run the quality script for the full report)`:g}],details:{files:d.files,functions:d.functions,findings:d.findings,score:$p(f)}}}});import{availableParallelism as y_}from"node:os";var b_=4;function E_(){let e=Hp(It).agents;return e!==void 0?e:Math.max(1,Math.min(b_,y_()-2))}var Tp=0,wT=[];async function mm(){for(;Tp>=E_();)await new Promise(t=>wT.push(t));Tp+=1;let e=!1;return()=>{e||(e=!0,Tp-=1,wT.shift()?.())}}function RT(e,t){let r=e.find(o=>`${o.provider}/${o.id}`===t||o.id===t);if(r)return r;let n=t.toLowerCase();return e.find(o=>o.id.toLowerCase().includes(n)||`${o.provider}/${o.id}`.toLowerCase().includes(n))}var S_=["deepseek","qwen","claude","gpt-5","gpt-4","gemini","glm","mimo","kimi","llama"],$_=/(image|embedding|embed|whisper|tts|audio|video|rerank|moderation|dall-e|stable-diffusion|sora)/i;function k_(e){let t=r=>{if($_.test(r))return 100;let n=S_.findIndex(o=>r.toLowerCase().includes(o));return n===-1?50:n};return e.map((r,n)=>({id:r,index:n})).sort((r,n)=>t(r.id)-t(n.id)||r.index-n.index).map(r=>r.id)}function cFe(e,t=[]){if(e.length===0)return;let r=e.filter(i=>t.includes(i.provider)),n=r.length>0?r:e,o=k_(n.map(i=>i.id))[0];return n.find(i=>i.id===o)??n[0]}import{mkdirSync as T_,readdirSync as w_,readFileSync as R_,unlinkSync as C_}from"node:fs";import{join as Rp}from"node:path";import{createAgentSession as P_,DefaultResourceLoader as A_,SessionManager as O_}from"@netrodev/hxf-coding-agent";var wp=["You are one agent on a shared task; siblings may be editing the same working tree right now.","Stay inside the files your assignment names. A file another agent owns is theirs to change: report what you need changed instead of changing it yourself, and never edit a file two agents were both given.","Never run project-wide validation (full builds, whole test suites, formatters, linters) unless your assignment explicitly tells you to.","Siblings' unfinished edits will make those runs fail for reasons that are not yours. Prove your own change with a scoped test, a targeted repro, or a smoke run instead."],M_=`You are a software architect planning an implementation. Your job is to explore the codebase and return a plan, not to write code.
|
|
135
|
+
|
|
136
|
+
## Read-only, by construction
|
|
137
|
+
You have no edit tool, no write tool, and no shell. Do not attempt to modify, create, move, or delete anything \u2014 the call would fail. Your output is text.
|
|
138
|
+
|
|
139
|
+
## Your process
|
|
140
|
+
1. Understand the requirement. If it is ambiguous in a way that changes the design, say so and name the options rather than silently picking one.
|
|
141
|
+
2. Explore: read the files involved, find the existing patterns and conventions with grep/find/ls, and trace the code paths the change touches. Follow the codebase's existing approach instead of inventing a new one.
|
|
142
|
+
3. Design: state the approach you recommend, not every alternative you considered. Note the trade-off that decided it.
|
|
143
|
+
4. Sequence: give the implementation as ordered steps, naming the files and functions to change at each one, and what to verify after each.
|
|
144
|
+
|
|
145
|
+
## Required output
|
|
146
|
+
End your reply with exactly this section, listing the 3-5 files most critical to the implementation, most important first:
|
|
147
|
+
|
|
148
|
+
### Critical Files for Implementation
|
|
149
|
+
- path/to/file.ts
|
|
150
|
+
- path/to/file.ts
|
|
151
|
+
|
|
152
|
+
Keep the plan concrete enough to execute without re-deriving it: name real paths and real function names you saw while exploring. If you could not confirm something, say which part you are unsure of instead of guessing.`,an=new Map([["scout",{name:"scout",description:"read-only lookup",tools:["read","grep","find","ls","context","web_search","web_fetch","lsp"],prompt:["Inspect only what the task needs. Do not edit.",...wp].join(`
|
|
153
|
+
`),effort:"low"}],["architect",{name:"architect",description:"designs an implementation plan",tools:["read","grep","find","ls","context","web_search","web_fetch","lsp"],prompt:M_,effort:"high"}],["task",{name:"task",description:"implements the assignment",tools:["read","bash","edit","write","grep","find","ls","context","todo","web_search","web_fetch","lsp"],prompt:["Do the assignment, then report files changed.",...wp].join(`
|
|
154
|
+
`),effort:"medium"}],["reviewer",{name:"reviewer",description:"finds concrete issues",tools:["read","grep","find","ls","context","web_search","web_fetch","lsp"],prompt:["Return issues with file evidence. Do not edit.",...wp].join(`
|
|
155
|
+
`),effort:"medium"}]]),RFe=new Set(an.keys());function F_(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function v_(e){return e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${(e%6e4/1e3).toFixed(1)}s`}function CFe(e){let t=e.status==="parked"?"done":e.status==="error"?"failed":e.status,r=[];return e.model&&r.push(e.model),typeof e.toolUses=="number"&&r.push(`${e.toolUses} tool use${e.toolUses===1?"":"s"}`),typeof e.tokens=="number"&&e.tokens>0&&r.push(F_(e.tokens)),e.startedAt&&e.endedAt&&r.push(v_(e.endedAt-e.startedAt)),`## ${e.agent}#${e.id} ${t}${r.length>0?` (${r.join(" \xB7 ")})`:""}`}var Ct=[],L_=3,CT=8,PFe=6,um=12;function cm(e){T_(Dn,{recursive:!0}),tr(Rp(Dn,`${e.id}.json`),JSON.stringify({...e,session:void 0},null,1))}function Cp(){let e;try{e=w_(Dn)}catch{return}for(let t of e)if(t.endsWith(".json"))try{let r=JSON.parse(R_(Rp(Dn,t),"utf8"));if(r.status!=="parked"||Ct.some(n=>n.id===r.id))continue;Ct.push({...r,mail:r.mail??[]})}catch{}if(Ct.length>um){let t=Ct.splice(0,Ct.length-um);for(let r of t){let n=r.session;r.session=void 0,n&&n.dispose();try{C_(Rp(Dn,`${r.id}.json`))}catch{}}}}function AFe(){if(Cp(),Ct.length===0)return"no agents";let e=Ct.map(t=>`${t.id} ${t.agent} ${t.status}${t.model?` model=${t.model}`:""}${t.background?" background":""} requests=${t.requests} ${t.task}`);return $o&&e.unshift("background work in flight"),e.join(`
|
|
156
|
+
`)}function OFe(e){Cp();let t=Ct.find(r=>r.id===e);return t?`${t.agent}#${t.id} ${t.status}
|
|
157
|
+
${t.result??t.task}`:`no agent ${e}`}async function pm(e){let t=an.get(e.agent);if(!t)throw new Error(`unknown agent ${e.agent}`);let r=e.worktree||e.cwd||process.cwd(),n=new A_({cwd:r,agentDir:It,appendSystemPrompt:[t.prompt],additionalSkillPaths:Kp(r),extensionFactories:[Bp({interactive:!1}),rk()]});await n.reload();let{session:o}=await P_({cwd:r,agentDir:It,sessionManager:O_.inMemory(r),resourceLoader:n,tools:t.tools,customTools:[K$,j$,Kk,Bk,Qk,TT,_$],thinkingLevel:e.effort}),i=__(e,t);if(i){let a=await o.modelRuntime.getAvailable(),m=RT(a,i);if(!m){o.dispose();let c=e.model?"asked for by the task":t.model?`named by the ${e.agent} definition${t.source?` (${t.source})`:""}`:"inherited from the parent session";throw new Error(`unknown model '${i}' ${c}. /model lists what this account can reach.`)}await o.setModel(m)}return o}async function MFe(e,t){Cp();let r=Ct.find(o=>o.id===e);if(!r)return`no agent ${e}`;let n=r.session??await pm(r);if(r.session=n,r.status==="running"||n.isStreaming)return r.mail.push(t),cm(r),`queued for ${e}`;if(r.requests>=CT)return`${e} is out of budget (${r.requests} requests)`;r.status="running";try{await n.prompt(t),r.requests+=1,r.result=n.getLastAssistantText()?.trim()||r.result,r.status="parked"}catch(o){r.result=o instanceof Error?o.message:String(o),r.status="error"}return cm(r),`${e} ${r.status}`}function __(e,t){for(let r of[e.model,t.model,e.parentModel]){let n=r?.trim();if(n)return n}}function PT(e){if(!(!e?.provider||!e.id))return`${e.provider}/${e.id}`}async function FFe(e){let t=an.get(e.agent);if(!t)throw new Error(`unknown agent ${e.agent}. known: ${[...an.keys()].join(", ")}`);if(Ct.length>=um)throw new Error(`${um} agents is the limit (${Ct.length} live or parked). Finish with the existing ones, or clear them with /agents, before spawning more.`);let r={id:`${Date.now().toString(36)}-${Ct.length+1}`,cwd:e.cwd,agent:t.name,task:e.task.trim(),effort:e.effort||t.effort,model:(e.model||t.model)?.trim()||void 0,parentModel:e.parentModel?.trim()||void 0,background:e.background,status:"queued",requests:0,mail:[],worktree:e.worktree};return Ct.push(r),cm(r),r}async function D_(e,t){if(!an.get(e.agent))return;let n=e.session??await pm(e);e.session=n,e.startedAt=Date.now();try{let o=e.mail.splice(0).join(`
|
|
158
|
+
`);for(await n.prompt(`Task:
|
|
159
|
+
${e.task}${o?`
|
|
160
|
+
|
|
161
|
+
Messages:
|
|
162
|
+
${o}`:""}`),e.requests+=1;e.mail.length>0&&e.requests<CT;)await n.followUp(e.mail.splice(0).join(`
|
|
163
|
+
`)),e.requests+=1;if(t?.aborted)throw new Error("aborted");let i=n.getLastAssistantText()?.trim(),a=n.getSessionStats?.();if(!i&&(a?.toolCalls??0)===0)throw new Error(`agent produced no output (model ${n.model?.provider}/${n.model?.id} answered nothing; 0 tool calls). Check that the provider is reachable and the model is configured.`);e.result=i,e.status="parked"}catch(o){e.result=o instanceof Error?o.message:String(o),e.status="error"}finally{e.endedAt=Date.now();let o=n.getSessionStats?.();e.toolUses=o?.toolCalls,e.tokens=o?.tokens?.total,e.session=void 0,n.dispose(),cm(e);try{AT?.(e)}catch{}}}var AT;function vFe(e){AT=e}var $o;function LFe(){$o||($o=N_().catch(()=>{}).finally(()=>{$o=void 0}))}async function N_(e){$o&&await $o.catch(()=>{});let t=()=>Ct.find(n=>n.status==="queued"),r=async()=>{for(;;){if(e?.aborted)throw new Error("aborted");let n=t();if(!n)return;n.status="running";let o=await mm();try{await D_(n,e)}finally{o()}}};if(await Promise.all(Array.from({length:L_},r)),e?.aborted)throw new Error("aborted")}import{execFile as j_}from"node:child_process";import{cp as U_,readdir as q_,stat as OT}from"node:fs/promises";import{promisify as G_}from"node:util";import{tmpdir as K_}from"node:os";import{join as fm}from"node:path";var MT=G_(j_);async function Bt(e,t){try{let{stdout:r}=await MT("git",t,{cwd:e,encoding:"utf8",maxBuffer:8388608});return{ok:!0,output:r.trim()}}catch(r){let n=r&&typeof r=="object"&&"stderr"in r&&typeof r.stderr=="string"?r.stderr.trim():"",o=r instanceof Error?r.message:String(r);return{ok:!1,output:n||o}}}async function B_(e){return(await Bt(e,["rev-parse","--is-inside-work-tree"])).output==="true"}async function GFe(e){return(await Bt(e,["status","--porcelain"])).output.length>0}async function KFe(e,t){let r=await Bt(e,["add","-A"]);if(!r.ok)return r;let n=await Bt(e,["commit","-m",t]);return n.ok?{ok:!0,output:(await Bt(e,["log","-1","--oneline"])).output||n.output}:n}async function BFe(e){let t=await Bt(e,["reset","--soft","HEAD~1"]);return t.ok?{ok:!0,output:(await Bt(e,["log","-1","--oneline"])).output||"reset to the previous commit"}:t}async function HFe(e){let t=(await Bt(e,["diff"])).output,r=(await Bt(e,["diff","--cached"])).output;return[t,r].filter(Boolean).join(`
|
|
164
|
+
`)}function zFe(e,t=60){let r=e.split(`
|
|
165
|
+
`);if(r.length<=t)return e;let n=r.slice(0,t),o=r.length-t;return[...n,`\u2026 ${o} more line${o===1?"":"s"} not shown \u2014 /copy puts the full diff on the clipboard`].join(`
|
|
166
|
+
`)}var H_=["node_modules","vendor","target",".venv","venv","__pycache__",".pnpm-store","dist","build"],FT=1024*1024*1024;async function vT(e){let t=0,r;try{r=await q_(e,{withFileTypes:!0})}catch{return 0}for(let n of r){let o=fm(e,n.name);if(n.isDirectory())t+=await vT(o);else if(n.isFile())try{t+=(await OT(o)).size}catch{}if(t>FT)return t}return t}async function z_(e,t){let r=[];for(let n of H_){let o=fm(e,n),i=fm(t,n);try{if(!(await OT(o)).isDirectory())continue}catch{continue}if(await vT(o)>FT){r.push(n);continue}await W_(o,i)||r.push(n)}return r}async function W_(e,t){if(process.platform!=="win32")try{return await MT("cp",["-a",e,t],{maxBuffer:8*1024*1024}),!0}catch{}try{return await U_(e,t,{recursive:!0,force:!0,errorOnExist:!1,dereference:!1}),!0}catch{return!1}}async function LT(e,t){if(!await B_(e))return null;let r=t.replace(/[^A-Za-z0-9._-]/g,"-").slice(0,40)||"agent",n=fm(K_(),`howtofix-wt-${process.pid}-${Date.now()}-${r}`);if(!(await Bt(e,["worktree","add","--detach",n,"HEAD"])).ok)return null;let i=await z_(e,n);return{path:n,skipped:i,async remove(){await Bt(e,["worktree","remove","--force",n]),await Bt(e,["worktree","prune"])}}}import{detectCapabilities as V_,getTerminalColorMode as J_,parseColor as Mr,styleText as _T}from"@netrodev/hxf-tui";function X_(){let e=process.env.NO_COLOR;if(e!==void 0&&e!=="")return"256color";try{return J_(V_())}catch{return"256color"}}var DT=X_();function Q_(){let e=process.env.NO_COLOR;return e!==void 0&&e!==""}var je={text:Mr("#e6e6e6"),mute:Mr("#8b8b8b"),dim:Mr("#5c5c5c"),user:Mr("#d0d0d0"),accent:Mr("#c4b5fd"),tool:Mr("#6ee7b7"),bad:Mr("#f0a8a4"),warn:Mr("#e6b15a"),line:Mr("#3a3a3a")};function Y_(e,t){if(Q_()){let{bold:r,dim:n,italic:o,underline:i,strikethrough:a}=t;return!r&&!n&&!o&&!i&&!a?e:_T(e,{bold:r,dim:n,italic:o,underline:i,strikethrough:a},DT)}return _T(e,t,DT)}function mt(e,t,r){return Y_(e,{...r,fg:t})}var JFe={heading:e=>mt(e,je.text,{bold:!0}),link:e=>mt(e,je.accent,{underline:!0}),linkUrl:e=>mt(e,je.mute),code:e=>mt(e,je.text),codeBlock:e=>mt(e,je.text),codeBlockBorder:e=>mt(e,je.line),quote:e=>mt(e,je.mute,{italic:!0}),quoteBorder:e=>mt(e,je.line),hr:e=>mt(e,je.line),listBullet:e=>mt(e,je.mute),bold:e=>mt(e,je.text,{bold:!0}),italic:e=>mt(e,je.text,{italic:!0}),strikethrough:e=>mt(e,je.mute,{strikethrough:!0}),underline:e=>mt(e,je.text,{underline:!0})};import{truncateToWidth as vi,visibleWidth as er}from"@netrodev/hxf-tui";var NT={text:je.text,muted:je.mute,dim:je.dim,accent:je.accent,success:je.tool,error:je.bad,border:je.line},oe=(e,t,r=!1)=>r?mt(t,NT[e],{bold:!0}):mt(t,NT[e]),Z_=25,eD=15e5,UT=420;function To(e){let t=Math.max(0,Math.round(e/1e3)),r=Math.floor(t/3600),n=Math.floor(t%3600/60),o=t%60;return r>0?`${r}h${String(n).padStart(2,"0")}m`:n>0?`${n}m${String(o).padStart(2,"0")}s`:`${o}s`}function ZFe(e){let t=Math.max(0,Math.floor(e/1e3));return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:`${Math.floor(t/3600)}h`}function Op(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}var Fi=(e,t,r)=>Math.max(t,Math.min(r,e)),ko=(e,t)=>er(e)>t?vi(e,Math.max(0,t),"\u2026"):e;function dm(e,t,r="left"){if(t<=0)return"";let n=er(e);if(n>t)return vi(e,t);let o=" ".repeat(t-n);return r==="right"?o+e:e+o}function Mp(e,t,r,n=1){if(r<=0)return"";let o=er(t);if(o>=r)return vi(t,r);let i=r-o-n;if(i<=0)return dm(t,r,"right");let a=er(e)>i?vi(e,i):e,m=" ".repeat(r-er(a)-o);return a+m+t}function Pp(e,t,r){let n=ko(e,Math.max(0,r-2)),o=Math.max(1,r-1-er(n)),i=oe("border","\u250C\u2500 ")+oe("accent",n)+oe("border",` ${"\u2500".repeat(o)}\u2510`),a=oe("border",`\u2514${"\u2500".repeat(r+2)}\u2518`),m=oe("border","\u2502"),c=t.map(p=>`${m} ${dm(p,r)} ${m}`);return[i,...c,a]}function tD(e,t,r,n){let o=n?.gap??1,i=n?.leftWidth??Fi(Math.round(r*.38),28,44),a=r-i-o,m=Math.max(e.rows.length,t.rows.length),c=g=>{let I=[...g];for(;I.length<m;)I.push("");return I},p=Pp(e.title,c(e.rows),i-4),f=Pp(t.title,c(t.rows),a-4),d=" ".repeat(o);return p.map((g,I)=>g+d+(f[I]??dm("",a)))}function qT(e,t,r){switch(e){case"running":return oe(t||r?"accent":"muted","\u25CF");case"failed":return oe("error","\u2717");default:return oe("success","\u2713")}}function GT(e,t,r,n=Date.now(),o=0){return t?n-o<UT?oe("success","\u2713",!0):oe("success","\u2713"):oe(r?"accent":"dim",String(e))}var jT="Workflow";function Fp(e,t=Date.now()){let r=e.phases.map(o=>o.title),n=new Map(e.phases.map(o=>[o.title,o.detail]));for(let o of e.steps){let i=o.phase||jT;r.includes(i)||r.push(i)}return r.map((o,i)=>{let a=e.steps.filter(h=>(h.phase||jT)===o).map(h=>({...h,phaseIndex:i})),m=a.filter(h=>h.status!=="running").length,c=a.filter(h=>h.status==="failed").length,p=a.reduce((h,y)=>{let b=y.endedAt??t;return Math.max(h,b-y.startedAt)},0),f=-1;for(let h=0;h<a.length;h++){let y=a[h];y.status==="running"&&(f<0||y.startedAt>=a[f].startedAt)&&(f=h)}let d=n.get(o),g=a.length>0&&m===a.length&&c===0,I=g?a.reduce((h,y)=>Math.max(h,y.endedAt??0),0):0;return{title:o,...d?{detail:d}:{},agents:a,done:m,failed:c,outputTokens:a.reduce((h,y)=>h+y.outputTokens,0),elapsedMs:p,allDone:g,finishedAt:I,anchor:f}})}function vp(e){return e.steps.reduce((t,r)=>t+r.outputTokens,0)}function rD(e){return e.steps.reduce((t,r)=>t+(r.toolCalls??0),0)}function KT(e,t=Date.now()){return Math.max(0,(e.endedAt??t)-e.startedAt)}function nD(e){return e.steps.length>Z_||vp(e)>eD}function oD(e){if(e.length===0)return 0;let t=e.map((r,n)=>({group:r,index:n})).filter(r=>r.group.anchor>=0);if(t.length>0)return t.reduce((r,n)=>{let o=n.group.agents[n.group.anchor],i=r.group.agents[r.group.anchor];return o.startedAt>=i.startedAt?n:r}).index;for(let r=e.length-1;r>=0;r--)if(e[r].agents.length>0)return r;return e.length-1}function BT(e,t=Date.now()){let r=Fp(e,t),n=e.steps.length,o=e.steps.filter(p=>p.status!=="running").length,i=e.steps.filter(p=>p.status==="failed").length,a=[e.name],m=r.find(p=>p.anchor>=0);m?a.push(`${m.title} ${m.done}/${m.agents.length}`):r.length>0&&a.push(`${r[r.length-1].title} done`),a.push(`${o}/${n} agents`),a.push(`${Op(vp(e))} tok`),a.push(To(KT(e,t))),i>0&&a.push(`${i} failed`);let c=a.join(" \xB7 ");return nD(e)?`large workflow \xB7 ${c}`:c}var HT=16,iD=12,sD=18,aD=72,mD=24;function zT(e,t){if(e.status==="running"&&e.outputTokens===0)return[`idle ${To(t-e.startedAt)}`,"idle"];let r=Op(e.outputTokens),n=e.toolCalls??0,o=To((e.endedAt??t)-e.startedAt);return[`${r} tok \xB7 ${n} tools \xB7 ${o}`,`${r} tok \xB7 ${n} tools`,`${r} tok`]}var uD=e=>e.status==="running"&&e.outputTokens===0;function Ap(e,t,r){if(e.length<=r)return{slice:e,start:0,more:0};let n=Math.max(1,r-1),o=Fi(t-Math.floor(n/2),0,e.length-n),i=e.slice(o,o+n);return{slice:i,start:o,more:e.length-i.length}}function cD(e,t,r,n,o){let i=`${e.done}/${e.agents.length}`,a=r?oe("accent","\u276F"):" ",m=GT(t+1,e.allDone,r,o,e.finishedAt),c=Math.max(0,n-4-er(i)),p=er(e.title)>c?vi(e.title,c,"\u2026"):e.title,f=e.allDone&&o-e.finishedAt<UT,d=oe(f&&!r?"success":r?"accent":"text",p),g=`${a}${m} ${d}`,I=oe(r?"accent":"muted",i);return Mp(g,I,n,1)}function pD(e,t,r,n,o,i){let a=t?oe("accent","\u276F"):" ",m=qT(e.status,t,r),c=oe(t?"accent":"text",dm(e.label,n)),p=`${a}${m} ${c}`,f=Math.max(0,o-er(p)-1),d=zT(e,i).find(I=>er(I)<=f)??"",g=oe(t?"accent":uD(e)?"dim":"muted",d);return Mp(p,g,o,1)}function fD(e,t,r,n){let o=[];return e.forEach((i,a)=>{let c=`${GT(a+1,i.allDone,a===r,n,i.finishedAt)} ${oe(a===r?"accent":"text",i.title)} ${oe("muted",`${i.done}/${i.agents.length}`)}`;o.push(ko(c,t));let{slice:p,more:f}=Ap(i.agents,0,HT);p.forEach((d,g)=>{let I=qT(d.status,!1,g===i.anchor),h=zT(d,n)[0]??"";o.push(ko(` ${I} ${oe("text",d.label)} ${oe("muted",h)}`,t))}),f>0&&o.push(ko(` ${oe("dim",`\u2026+${f} more`)}`,t))}),o}function dD(e,t,r){let n=r?.now??Date.now(),o=Fp(e,n),i=e.steps,a=i.filter(rt=>rt.status!=="running").length,m=i.filter(rt=>rt.status==="failed").length,c=[`${a}/${i.length} agents`,`${Op(vp(e))} tok`,`${rD(e)} tools`,To(KT(e,n)),...m>0?[`${m} failed`]:[]].join(" \xB7 "),p=[Mp(oe("accent",e.name,!0),oe("muted",c),t,2),...e.description?[oe("muted",ko(e.description,t))]:[]],f=r?.footer?[oe("muted",ko(r.footerText??lD(),t))]:[];if(o.length===0)return[...p,...Pp("Phases",["(no agents yet)"],Math.max(0,t-4)),...f];let d=Fi(r?.selectedPhase??oD(o),0,Math.max(0,o.length-1)),g=Fi(Math.round(t*.38),28,44),I=t-g-1-4;if(t<aD||I<mD)return[...p,...fD(o,t,d,n),...f];let h=o[d],{slice:y,start:b,more:R}=Ap(o,d,iD),L=y.map((rt,Ir)=>cD(rt,b+Ir,b+Ir===d,g-4,n));R>0&&L.push(oe("dim",`\u2026+${R} more`));let q=r?.filter?r.filter(h.agents):h.agents,ut=q.length?Fi(Math.max(...q.map(rt=>er(rt.label))),6,sD):6,{slice:Ze,more:he}=Ap(q,0,r?.agentWindow??HT),V=Ze.map((rt,Ir)=>pD(rt,!1,Ir===h.anchor,ut,I,n));he>0&&V.push(oe("dim",`\u2026+${he} more`));let Fr=tD({title:"Phases",rows:L},{title:`${h.title} \xB7 ${q.length} agents${r?.filterLabel??""}`,rows:V},t,{leftWidth:g,gap:1});return[...p,...Fr,...f]}function eve(e,t=[],r=96,n,o){let i=dD(e,r,{now:e.endedAt??Date.now(),footer:!0,...n===void 0?{}:{selectedPhase:n},...o?.filter?{filter:o.filter}:{},...o?.footerText?{footerText:o.footerText}:{},...o?.filterLabel?{filterLabel:o.filterLabel}:{}}),a=new Set(t);if(o?.drill){let c=Fp(e,e.endedAt??Date.now()),p=c[Math.max(0,Math.min(c.length-1,n??0))];for(let f of p?.agents??[])a.add(f.label)}if(a.size===0)return i;let m=[];for(let c of e.steps)if(a.has(c.label)){for(let p of c.tasks??[]){let f=p.status==="completed"?"[x]":p.status==="in_progress"?"[>]":"[ ]";m.push(` ${oe("muted",f)} ${oe("text",p.content)}`)}c.detail&&m.push(` ${oe("dim",c.detail)}`)}return m.length===0?i:[...i.slice(0,-1),...m,i[i.length-1]]}function lD(){return"\u2191/\u2193 phase \xB7 Enter drill in \xB7 Esc back out \xB7 f filter by status \xB7 p pause \xB7 x stop \xB7 s save script"}import{readFileSync as SD}from"node:fs";import{basename as $D}from"node:path";import{StringEnum as kD}from"@netrodev/hxf-ai";import{defineTool as TD}from"@netrodev/hxf-coding-agent";var _n=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function WT(e){return e===null?"null":Array.isArray(e)?"array":Number.isInteger(e)?"integer":typeof e}function gD(e,t){let r=WT(e);return t==="number"?r==="number"||r==="integer":t==="integer"?r==="integer":r===t}function xD(e,t){if(typeof t!="string"||!t.startsWith("#/"))return;let r=e;for(let n of t.slice(2).split("/")){let o=n.replace(/~1/g,"/").replace(/~0/g,"~");if(!_n(r)&&!Array.isArray(r))return;r=r[o]}return _n(r)?r:void 0}function mn(e,t,r,n,o){if(!_n(t))return;if(t.$ref!==void 0){let a=xD(r,t.$ref);a&&mn(e,a,r,n,o);return}if(Array.isArray(t.allOf))for(let a of t.allOf)mn(e,a,r,n,o);for(let a of["anyOf","oneOf"]){let m=t[a];if(!Array.isArray(m)||m.length===0)continue;let c=m.filter(p=>{let f=[];return mn(e,p,r,n,f),f.length===0}).length;a==="anyOf"&&c===0&&o.push({path:n,message:"does not match any allowed shape"}),a==="oneOf"&&c!==1&&o.push({path:n,message:`must match exactly one shape (matched ${c})`})}let i=t.type;if(i!==void 0){let a=Array.isArray(i)?i.map(String):[String(i)];if(!a.some(m=>gD(e,m))){o.push({path:n,message:`expected ${a.join(" or ")}, got ${WT(e)}`});return}}if(Array.isArray(t.enum)&&!t.enum.some(a=>JSON.stringify(a)===JSON.stringify(e))&&o.push({path:n,message:`must be one of ${t.enum.map(a=>JSON.stringify(a)).join(", ")}`}),_n(e)){let a=_n(t.properties)?t.properties:{};if(Array.isArray(t.required))for(let m of t.required.map(String))m in e||o.push({path:n?`${n}.${m}`:m,message:"is required"});for(let[m,c]of Object.entries(a))m in e&&mn(e[m],c,r,n?`${n}.${m}`:m,o);if(t.additionalProperties===!1)for(let m of Object.keys(e))m in a||o.push({path:n?`${n}.${m}`:m,message:"is not an allowed property"});else if(_n(t.additionalProperties))for(let[m,c]of Object.entries(e))m in a||mn(c,t.additionalProperties,r,n?`${n}.${m}`:m,o)}if(Array.isArray(e)&&t.items!==void 0){let a=t.items;Array.isArray(a)?e.forEach((m,c)=>{c<a.length&&mn(m,a[c],r,`${n}[${c}]`,o)}):e.forEach((m,c)=>mn(m,a,r,`${n}[${c}]`,o))}if(typeof e=="string"&&(typeof t.minLength=="number"&&e.length<t.minLength&&o.push({path:n,message:`is shorter than ${t.minLength} characters`}),typeof t.pattern=="string"))try{new RegExp(t.pattern).test(e)||o.push({path:n,message:`does not match ${t.pattern}`})}catch{}typeof e=="number"&&(typeof t.minimum=="number"&&e<t.minimum&&o.push({path:n,message:`is below ${t.minimum}`}),typeof t.maximum=="number"&&e>t.maximum&&o.push({path:n,message:`is above ${t.maximum}`}))}function VT(e,t){if(!_n(t))return[];let r=[];return mn(e,t,t,"",r),r}function JT(e){return e.map(t=>`- ${t.path||"(root)"}: ${t.message}`).join(`
|
|
167
|
+
`)}function XT(e){let t=e.trim(),r=/```(?:json)?\s*([\s\S]*?)```/.exec(t),n=[t,r?.[1]?.trim()].filter(o=>!!o);for(let o of n){try{return JSON.parse(o)}catch{}for(let i=0;i<o.length;i++){let a=o[i];if(a!=="{"&&a!=="[")continue;let m=a==="{"?"}":"]",c=0,p=!1,f=!1;for(let d=i;d<o.length;d++){let g=o[d];if(p){f?f=!1:g==="\\"?f=!0:g==='"'&&(p=!1);continue}if(g==='"')p=!0;else if(g===a)c++;else if(g===m&&(c--,c===0))try{return JSON.parse(o.slice(i,d+1))}catch{break}}}}}var ID=1e3,hD=4096,QT=100,YT=300*1e3;async function yD(e,t=QT,r=YT){let n=Date.now()+r;for(;e.isPaused?.();){if(e.signal?.aborted||Date.now()>=n)return!1;await new Promise(o=>setTimeout(o,t))}return!0}var Ve=class extends Error{constructor(t){super(t),this.name="WorkflowError"}};function bD(e){let t=0,r=[];return async function(){t>=e&&await new Promise(i=>r.push(i)),t++;let o=!1;return()=>{o||(o=!0,t--,r.shift()?.())}}}function ZT(e){let t=e.lifetimeCap??ID,r=e.fanoutCap??hD,n=e.concurrency?bD(e.concurrency):null,o=async()=>{let b=await mm();if(!n)return b;let R=await n();return()=>{R(),b()}},i=0,a=0,m="",c=b=>e.onEvent?.(b),p=new Map,f=()=>e.onProgress?.([...p.values()]),d=async(b,R)=>{let L=R??{},q=typeof L.label=="string"?L.label:`agent-${i+1}`,ut=typeof L.phase=="string"?L.phase:m,Ze=typeof L.agentType=="string"?L.agentType:"task",he=typeof L.effort=="string"?L.effort:void 0,V=typeof L.model=="string"?L.model:void 0,Fr=typeof L.isolation=="string"?L.isolation:void 0,rt=L.schema;if(e.budgetTotal!=null&&a>=e.budgetTotal)throw new Ve(`budget exhausted: spent ${a} of ${e.budgetTotal} output tokens`);if(i>=t)throw new Ve(`lifetime cap reached: ${t} agent calls in one run`);i++;let Ir=i;if(e.isPaused?.()&&!await yD(e,QT,YT))return null;let mw=await o();try{if(e.signal?.aborted)return null;c({kind:"agent_start",label:q,phase:ut,ordinal:i}),p.set(Ir,{label:q,phase:ut,agentType:Ze,status:"running",outputTokens:0,...V?{model:V}:{},startedAt:Date.now()}),f();let wo=(un,vr,jt)=>{let Ht=p.get(Ir);Ht&&(Ht.status=un,Ht.outputTokens=vr.outputTokens,Ht.endedAt=Date.now(),vr.toolCalls!==void 0&&(Ht.toolCalls=vr.toolCalls),vr.model!==void 0&&(Ht.model=vr.model),jt&&(Ht.detail=jt)),c({kind:"agent_end",label:q,ok:un==="ok",outputTokens:vr.outputTokens}),f()},qp=rt===void 0?1:2;for(let un=0;un<qp;un++){let vr=un===0?String(b):void 0,jt=await I(vr??ED(String(b),g),{label:q,phase:ut,agentType:Ze,effort:he,model:V,isolation:Fr});if(jt===null)return wo("failed",{text:"",outputTokens:0}),null;if(a+=jt.outputTokens,rt===void 0)return wo("ok",jt,Lp(jt.text)),jt.text;let Ht=XT(jt.text),Gp=Ht===void 0?[{path:"",message:"reply was not JSON"}]:VT(Ht,rt);if(Gp.length===0)return wo("ok",jt,Lp(jt.text)),Ht;if(g=JT(Gp),un===qp-1)return wo("failed",jt,`schema: ${Lp(g)}`),null}return null}finally{mw()}},g="",I=async(b,R)=>{try{return await e.invoke({prompt:b,...R})}catch{return null}};return{agent:(b,R)=>d(b,R),parallel:async b=>{if(b.length>r)throw new Ve(`fan-out cap exceeded: ${b.length} items (max ${r})`);return await Promise.all(b.map(async L=>{try{return await L()}catch{return null}}))},pipeline:async(b,...R)=>{if(b.length>r)throw new Ve(`fan-out cap exceeded: ${b.length} items (max ${r})`);return await Promise.all(b.map(async(q,ut)=>{let Ze=q;for(let he of R)try{Ze=await he(Ze,q,ut)}catch{return null}return Ze}))},phase:b=>{m=String(b),c({kind:"phase",title:m})},log:b=>c({kind:"log",message:String(b)}),args:e.args,budget:{total:e.budgetTotal??null,spent:()=>a,remaining:()=>e.budgetTotal==null?1/0:Math.max(0,e.budgetTotal-a)}}}function ED(e,t){return`${e}
|
|
168
|
+
|
|
169
|
+
Your previous reply did not satisfy the required schema:
|
|
170
|
+
${t}
|
|
171
|
+
|
|
172
|
+
Reply with ONLY a corrected JSON value.`}function Lp(e,t=80){let r=e.split(`
|
|
173
|
+
`).map(n=>n.trim()).find(n=>n.length>0)??"";return r.length>t?`${r.slice(0,t)}\u2026`:r}var _p="workflow",ew=null;function gve(e){ew=e}var wD=600*1e3;function RD(e){let t=e.replace(/^(?:\s+|\/\/[^\n]*\n|\/\*[\s\S]*?\*\/)*/,""),r=/^export\s+const\s+meta\s*=\s*/.exec(t);if(!r)throw new Ve("a workflow script must start with `export const meta = { name, description }`");let n=e.length-t.length,o=r[0].length,i=0,a=null,m=-1;for(let I=o;I<t.length;I++){let h=t[I];if(a){h==="\\"?I++:h===a&&(a=null);continue}if(h==='"'||h==="'"||h==="`")a=h;else if(h==="{"||h==="[")i++;else if((h==="}"||h==="]")&&(i--,i===0)){m=I+1;break}}if(m===-1)throw new Ve("meta is not a closed literal object");let c=t.slice(o,m),p=e.slice(n+m).replace(/^\s*;/,"");if(/^\s*(import|export)\b/m.test(p))throw new Ve("a workflow body must not contain import or export declarations");if(/\bimport\s*\(/.test(p))throw new Ve("a workflow body must not use dynamic import()");let f;try{f=new Function(`"use strict"; return (${c});`)()}catch(I){throw new Ve(`meta must be a literal object: ${I instanceof Error?I.message:String(I)}`)}if(typeof f!="object"||f===null)throw new Ve("meta must be an object");let d=f;if(typeof d.name!="string"||!d.name.trim())throw new Ve("meta.name is required");if(typeof d.description!="string"||!d.description.trim())throw new Ve("meta.description is required");let g=Array.isArray(d.phases)?d.phases.filter(I=>typeof I=="object"&&I!==null).map(I=>({title:String(I.title??""),...typeof I.detail=="string"?{detail:I.detail}:{}})).filter(I=>I.title):void 0;return{meta:{name:d.name,description:d.description,...typeof d.whenToUse=="string"?{whenToUse:d.whenToUse}:{},...g?{phases:g}:{}},body:p}}function CD(e){let t=["agent","parallel","pipeline","phase","log","args","budget"],r=`"use strict"; return (async () => {
|
|
174
|
+
${e}
|
|
175
|
+
})();`,n;try{n=new Function(...t,r)}catch(o){throw new Ve(`workflow did not compile: ${o instanceof Error?o.message:String(o)}`)}return n}function PD(e){return e.getLastAssistantText()?.trim()??""}function AD(e){return async({prompt:t,agentType:r,effort:n,model:o,isolation:i})=>{let a=an.get(r)??an.get("task");if(!a)throw new Ve(`no agent named ${r}`);let m=i==="worktree"?await LT(process.cwd(),r):null,c=await pm({agent:a.name,effort:n??a.effort,...o?{model:o}:{},...e?{parentModel:e}:{},...m?{worktree:m.path}:{}});try{await c.prompt(`${a.prompt}
|
|
176
|
+
|
|
177
|
+
Task:
|
|
178
|
+
${t}`);let p=c.getSessionStats(),f=OD(c)??o;return{text:PD(c),outputTokens:p.tokens.output,toolCalls:p.toolCalls,...f?{model:f}:{}}}finally{c.dispose(),await m?.remove()}}}function OD(e){return e.model?.id??e.model?.name}var MD=O.Object({code:O.Optional(O.String({description:"The workflow script source"})),path:O.Optional(O.String({description:"Path to a workflow script, instead of code"})),agent:O.Optional(kD(["scout","task","reviewer"],{description:"Default agent profile for calls"})),budget:O.Optional(O.Number({description:"Output-token ceiling for the whole run"}))});function xve(e){let t=()=>e??ew;return TD({name:"workflow",label:"workflow",description:"Run a JavaScript workflow that orchestrates many agents deterministically. Provide `code` (or `path`). The script starts with `export const meta = { name, description, phases }` and then uses the injected bindings: `agent(prompt, {label, phase, schema, effort, model, agentType, isolation})`, `parallel(thunks)`, `pipeline(items, ...stages)`, `phase(title)`, `log(msg)`, `args`, `budget`. `agent()` resolves null on failure and throws only when the budget or the call cap is exhausted, so null-check every result. `parallel()` takes thunks and never rejects; `pipeline()` has no barrier between items. Use it for fan-out, for builder-verifier loops that converge on a verdict, and for anything needing many agents whose order and count must be deterministic.",promptSnippet:"workflow: orchestrate many agents from one JavaScript script",parameters:MD,executionMode:"sequential",async execute(r,n,o,i,a){let m=n.path?SD(n.path,"utf8"):n.code??"";if(!m.trim())throw new Ve("provide code or path");let{meta:c,body:p}=RD(m);if(n.path){let he=$D(n.path).replace(/\.(js|mjs|cjs|ts)$/,"");if(he!==c.name)throw new Ve(`meta.name "${c.name}" must match the script filename "${he}"`)}let f=CD(p),d=Date.now(),g=[],I=0,h=0,y=(he,V)=>({name:c.name,...c.description?{description:c.description}:{},ok:he,agents:h,outputTokens:I,startedAt:d,phases:c.phases??[],steps:g,...V?{error:V}:{}}),b=(he,V)=>{a.ui.setStatus(_p,V?void 0:BT(he)),i?.({content:[],details:y(!1)})},R=he=>{h=he.length,I=he.reduce((V,Fr)=>V+Fr.outputTokens,0),g.splice(0,g.length,...he.map(V=>({label:V.label,phase:V.phase,agent:V.agentType,status:V.status,outputTokens:V.outputTokens,startedAt:V.startedAt,...V.toolCalls!==void 0?{toolCalls:V.toolCalls}:{},...V.model?{model:V.model}:{},...V.endedAt?{endedAt:V.endedAt}:{},...V.detail?{detail:V.detail}:{},...V.tasks?{tasks:V.tasks}:{}}))),b({name:c.name,...c.description?{description:c.description}:{},phases:c.phases??[],steps:g,startedAt:d},!1)},L=AD(PT(a?.model)),q=ZT({invoke:n.agent?FD(L,n.agent):L,budgetTotal:n.budget??null,onProgress:R,...o?{signal:o}:{},...t()?.isPaused?{isPaused:t().isPaused}:{}}),ut=new AbortController,Ze=setTimeout(()=>ut.abort(),wD);o&&o.addEventListener("abort",()=>ut.abort(),{once:!0}),t()?.onStop?.(()=>ut.abort());try{let he=await Promise.race([f(q.agent,q.parallel,q.pipeline,q.phase,q.log,q.args,q.budget),new Promise((Fr,rt)=>ut.signal.addEventListener("abort",()=>rt(new Ve("workflow timed out or was aborted"))))]),V=Date.now();return a.ui.setStatus(_p,void 0),{content:[{type:"text",text:`${c.name}: ${h} agent call(s), ${I} output tokens in ${To(V-d)}
|
|
179
|
+
|
|
180
|
+
${vD(he)}`}],details:{...y(!0),endedAt:V}}}catch(he){let V=he instanceof Error?he.message:String(he);return a.ui.setStatus(_p,void 0),{content:[{type:"text",text:`${c.name} failed after ${h} agent call(s): ${V}`}],details:{...y(!1,V),endedAt:Date.now()},isError:!0}}finally{clearTimeout(Ze),t()?.onStop?.(null)}}})}function FD(e,t){return r=>e({...r,agentType:t})}function vD(e){if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}import{execFile as LD,execFileSync as _D}from"node:child_process";import{promisify as DD}from"node:util";import{createHash as nw}from"node:crypto";import{copyFileSync as ND,existsSync as lm,mkdirSync as gm,readFileSync as jp,readdirSync as jD,rmSync as UD,statSync as Dp}from"node:fs";import{dirname as ow,join as Pt,resolve as xm}from"node:path";var Np=Pt(It,"rewind"),Im="refs/howtofix",tw=100,iw=30,sw="project.json",aw="checkpoints.json",rw=!1;function qD(e){let t=xm(e);for(;;){if(lm(Pt(t,".git")))return!0;let r=ow(t);if(r===t)return!1;t=r}}var GD=DD(LD);async function Nt(e,t){let r={...process.env};for(let o of["GIT_DIR","GIT_WORK_TREE","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_NAMESPACE","GIT_COMMON_DIR"])delete r[o];r.GIT_DIR=e.gitDir,r.GIT_WORK_TREE=e.root,r.GIT_AUTHOR_NAME=r.GIT_COMMITTER_NAME="howtofix",r.GIT_AUTHOR_EMAIL=r.GIT_COMMITTER_EMAIL="howtofix@local";let{stdout:n}=await GD("git",t,{cwd:e.root,env:r,encoding:"utf8",maxBuffer:8*1024*1024});return n.trim()}function KD(e){return nw("sha1").update(e).digest("hex").slice(0,16)}function Tve(e){let t=xm(e).replace(/\/+$/,"")||"/",r=Pt(Np,KD(t)),n=Pt(r,"git"),o={root:t,gitDir:n,metaFile:Pt(r,aw),disabled:!1};return!lm(Pt(n,"HEAD"))&&!qD(t)?(o.disabled=!0,o):(gm(r,{recursive:!0}),lm(Pt(n,"HEAD"))||(gm(n,{recursive:!0}),_D("git",["init","--quiet","--initial-branch=howtofix"],{env:{...process.env,GIT_DIR:n},stdio:["ignore","ignore","pipe"]})),BD(t,n),HD(r,t),rw||(rw=!0,WD({keep:r})),o)}function BD(e,t){let r=Pt(e,".git","info","exclude");try{if(!Dp(r).isFile())return;gm(Pt(t,"info"),{recursive:!0}),ND(r,Pt(t,"info","exclude"))}catch{}}function HD(e,t){let r=Pt(e,sw),n=`${JSON.stringify({version:1,root:t})}
|
|
181
|
+
`;try{if(jp(r,"utf8")===n)return}catch{}try{tr(r,n)}catch{}}function hm(e){try{let t=JSON.parse(jp(e.metaFile,"utf8"));if(t?.version===1&&t.sessions)return t}catch{}return{version:1,sessions:{}}}function Up(e,t){gm(ow(e.metaFile),{recursive:!0}),tr(e.metaFile,`${JSON.stringify(t,null,1)}
|
|
182
|
+
`)}function zD(e,t){return e.disabled?[]:[...hm(e).sessions[t]??[]].sort((r,n)=>r.at-n.at)}async function wve(e,t,r){if(e.disabled)return null;let n;try{await Nt(e,["add","-A","--ignore-errors","--"]),n=await Nt(e,["write-tree"])}catch{return null}let i=zD(e,t).find(g=>g.tree===n),a=Date.now(),m=`${a.toString(36)}-${nw("sha1").update(`${n}:${a}`).digest("hex").slice(0,6)}`,c=i?.commit;if(!c){let g=["howtofix checkpoint",`session ${t}`,`created ${new Date(a).toISOString()}`,`prompt ${r.slice(0,200)}`].join(`
|
|
183
|
+
`);c=await Nt(e,["commit-tree",n,"-m",g]),await Nt(e,["update-ref",`${Im}/${m}`,c])}let p={id:m,tree:n,commit:c,prompt:r,at:a},f=hm(e),d=[...f.sessions[t]??[],p];for(let g of d.slice(0,Math.max(0,d.length-tw)))try{await Nt(e,["update-ref","-d",`${Im}/${g.id}`])}catch{}return f.sessions[t]=d.slice(-tw),Up(e,f),p}async function Rve(e,t){let r=[];if(e.disabled)return{ok:!1,output:"checkpoints are off: this directory is not a git repository",removed:r};try{await Nt(e,["read-tree","--reset","-u",t.tree])}catch(n){return{ok:!1,output:n instanceof Error?n.message:String(n),removed:r}}try{let n=await Nt(e,["clean","-fd"]);for(let o of n.split(`
|
|
184
|
+
`)){let i=/^Removing\s+(.+)$/.exec(o.trim());i?.[1]&&r.push(i[1])}}catch{}return{ok:!0,output:`restored ${t.prompt||"the checkpoint"}`,removed:r}}async function Cve(e,t){if(e.disabled)return[];try{await Nt(e,["add","-A","--ignore-errors","--"]);let r=await Nt(e,["write-tree"]);return r===t.tree?[]:(await Nt(e,["diff-tree","-r","--name-status","--no-commit-id",t.tree,r])).split(`
|
|
185
|
+
`).filter(Boolean).map(o=>{let[i,...a]=o.split(" ");return`${i?.[0]??"?"} ${a.at(-1)??""}`})}catch{return[]}}async function Pve(e,t={}){let r={droppedSessions:0,droppedRefs:0};if(e.disabled)return r;let n=(t.now??Date.now())-iw*24*60*60*1e3,o=hm(e),i=!1;for(let[a,m]of Object.entries(o.sessions))if(!(a===t.keep||m.reduce((p,f)=>Math.max(p,f.at),0)>=n)){delete o.sessions[a],i=!0,r.droppedSessions+=1;for(let p of m)try{await Nt(e,["update-ref","-d",`${Im}/${p.id}`]),r.droppedRefs+=1}catch{}}if(!i)return r;Up(e,o);try{await Nt(e,["gc","--quiet","--prune=now"])}catch{}return r}function WD(e={}){let t={removedDirs:0,failed:[]},r;try{r=jD(Np,{withFileTypes:!0})}catch{return t}let n=(e.now??Date.now())-iw*24*60*60*1e3,o=e.keep?xm(e.keep):void 0;for(let i of r){if(!i.isDirectory())continue;let a=Pt(Np,i.name);if(xm(a)!==o)try{(VD(a)||JD(a)<n)&&(UD(a,{recursive:!0,force:!0}),t.removedDirs+=1)}catch{t.failed.push(i.name)}}return t}function VD(e){try{let t=JSON.parse(jp(Pt(e,sw),"utf8"));return typeof t?.root!="string"||t.root.length===0?!1:!lm(t.root)}catch{return!1}}function JD(e){try{return Dp(Pt(e,aw)).mtimeMs}catch{return Dp(e).mtimeMs}}async function Ave(e,t){if(e.disabled)return;let r=hm(e);for(let n of r.sessions[t]??[])try{await Nt(e,["update-ref","-d",`${Im}/${n.id}`])}catch{}delete r.sessions[t],Up(e,r)}export{ho as a,Qa as b,Uv as c,gPe as d,xPe as e,IPe as f,hPe as g,$Pe as h,kPe as i,eL as j,CPe as k,PPe as l,APe as m,KPe as n,BPe as o,HPe as p,zPe as q,WPe as r,_$ as s,O as t,j$ as u,K$ as v,B$ as w,TAe as x,RL as y,wAe as z,RAe as A,CAe as B,PAe as C,CL as D,AAe as E,PL as F,AL as G,OAe as H,NAe as I,jAe as J,UAe as K,qAe as L,GAe as M,KAe as N,jc as O,BAe as P,HAe as Q,zAe as R,WAe as S,rk as T,Gc as U,YL as V,Ai as W,n1 as X,f1 as Y,d1 as Z,l1 as _,g1 as $,b1 as aa,Kk as ba,Bk as ca,N1 as da,Qk as ea,TT as fa,b_ as ga,E_ as ha,RT as ia,k_ as ja,cFe as ka,an as la,RFe as ma,CFe as na,Ct as oa,PFe as pa,AFe as qa,OFe as ra,MFe as sa,PT as ta,FFe as ua,vFe as va,LFe as wa,N_ as xa,B_ as ya,GFe as za,KFe as Aa,BFe as Ba,HFe as Ca,zFe as Da,LT as Ea,DT as Fa,je as Ga,mt as Ha,JFe as Ia,UT as Ja,To as Ka,ZFe as La,Fp as Ma,eve as Na,gve as Oa,xve as Pa,iw as Qa,Tve as Ra,zD as Sa,wve as Ta,Rve as Ua,Cve as Va,Pve as Wa,Ave as Xa};
|