howtocode 0.7.76 → 0.7.77
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-EMFKTIYL.js → chunk-6LVQ2C2A.js} +1 -1
- package/dist/{chunk-6MW4XQH2.js → chunk-DGLFGFQP.js} +1 -1
- package/dist/{chunk-G3RLGCT7.js → chunk-GXO5FCZF.js} +2 -2
- package/dist/{chunk-WXNRNAQ6.js → chunk-KJ6YW5NT.js} +2 -2
- package/dist/{chunk-XORAIQWU.js → chunk-L6ZXG6ZX.js} +1 -1
- package/dist/{chunk-42J3SVVD.js → chunk-NAXC5MNU.js} +1 -1
- package/dist/{chunk-MSEVYMAA.js → chunk-OFZZO2SV.js} +1 -1
- package/dist/{chunk-SBWZZCV5.js → chunk-OUVT3E6S.js} +1 -1
- package/dist/{chunk-DQZCH2E4.js → chunk-Q2GQPEUC.js} +1 -1
- package/dist/{chunk-AMYTGLTF.js → chunk-UA2AUPJX.js} +1 -1
- package/dist/{chunk-XZBFNLPM.js → chunk-UO2MJVH4.js} +1 -1
- package/dist/{chunk-NARUJ2JE.js → chunk-XQD577L4.js} +1 -1
- package/dist/cli-auth.js +1 -1
- package/dist/main-app.js +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as We,B as De,C as Ce,E as R,F as q,Fa as ot,H as U,I as Pe,Q as je,R as Ne,Ra as st,S as Me,T as Fe,Ta as Q,U as Le,V as Be,Va as rt,W as Ue,Y as Ge,_ as Y,a as M,b as F,ba as He,c as ge,ca as qe,d as he,da as ze,e as we,ea as V,f as be,fa as Ze,g as A,ga as Ke,i as ye,j as ke,ja as Xe,k as Se,l as _e,la as Ye,m as X,ma as z,na as Ve,o as Te,oa as Je,p as Ee,q as $e,qa as J,r as ve,s as Ae,t as k,u as Re,ua as Qe,va as et,w as Oe,x as H,xa as tt,y as Ie,ya as nt}from"./chunk-
|
|
1
|
+
import{$ as We,B as De,C as Ce,E as R,F as q,Fa as ot,H as U,I as Pe,Q as je,R as Ne,Ra as st,S as Me,T as Fe,Ta as Q,U as Le,V as Be,Va as rt,W as Ue,Y as Ge,_ as Y,a as M,b as F,ba as He,c as ge,ca as qe,d as he,da as ze,e as we,ea as V,f as be,fa as Ze,g as A,ga as Ke,i as ye,j as ke,ja as Xe,k as Se,l as _e,la as Ye,m as X,ma as z,na as Ve,o as Te,oa as Je,p as Ee,q as $e,qa as J,r as ve,s as Ae,t as k,u as Re,ua as Qe,va as et,w as Oe,x as H,xa as tt,y as Ie,ya as nt}from"./chunk-GXO5FCZF.js";import{t as me}from"./chunk-ZJL4OEXX.js";import{b as xe}from"./chunk-XODGJSB3.js";import"./chunk-DBPJZUIT.js";import{c as ue}from"./chunk-UO2MJVH4.js";import{h as pe,l as fe}from"./chunk-UA2AUPJX.js";import"./chunk-7LA2AMZB.js";import"./chunk-Q2GQPEUC.js";import{b as W,c as ie,d as ae}from"./chunk-OUVT3E6S.js";import{H as S,K as de,v as ce,w as le}from"./chunk-5FIFNXLT.js";import"./chunk-UTYFLLSM.js";import"./chunk-MVVEYKN6.js";import"./chunk-WOT6VMZA.js";import{join as Nt}from"node:path";import{hostname as co}from"node:os";import{createAgentSession as lo,createCodemodeExtension as uo,createMcpExtension as po,createToolSearchExtension as fo,DefaultResourceLoader as mo,ProjectTrustStore as go,SessionManager as K,SettingsManager as ho}from"@netrodev/hxf-coding-agent";import{existsSync as Lt,readFileSync as Bt}from"node:fs";import{join as Ut}from"node:path";var it=Ut(S,"APPEND_SYSTEM.md"),Gt=["<non-interactive>","This run has no user attached: it was started with --print, and there is nobody to answer a question. Anything that stops and waits for a reply \u2014 `ask`, a confirmation, a skill that resolves a mode by asking which mode to use \u2014 will simply end the run with the task unfinished.","So do not ask. Where an instruction tells you to ask the user and wait, take the default it describes and continue, and say which default you took and why in your final answer. The user reads that answer; they cannot answer mid-run.","Where a skill offers a choice of modes, prefer the one that applies the rules while you work over the one that audits afterwards: this is the mode for building something now, and the audit mode can still be run later by the same person who reads your answer.","</non-interactive>"].join(`
|
|
2
2
|
`),Wt=16*1024;function Ht(e){try{if(!Lt(e))return;let t=Bt(e,"utf8").trim();return!t||Buffer.byteLength(t,"utf8")>Wt?void 0:t}catch{return}}function at(e,t){let s=[t?e:`${e}
|
|
3
3
|
|
|
4
4
|
${Gt}`],n=Ht(it);return n&&s.push(`# Standing instructions from ${it}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A,B,C,D,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-
|
|
1
|
+
import{A,B,C,D,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-UO2MJVH4.js";import"./chunk-7LA2AMZB.js";import"./chunk-Q2GQPEUC.js";import"./chunk-OUVT3E6S.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{g as CATALOG_CACHE_TTL_MS,m as DEFAULT_CONTEXT_WINDOW,a as HOWTOCODE_BASE_URL,b as HOWTOCODE_CONSOLE_URL,l as HOWTOCODE_MODEL_COMPAT,c as HOWTOCODE_PROVIDERS,j as HTTP_IDLE_TIMEOUT_MS,r as UNLIMITED_SENTINEL,w as applyCatalog,x as applyCompat,B as checkAccount,s as checkCreditPools,t as checkUsage,d as configuredProviderIds,y as countNewModels,k as ensureGatewaySettings,C as fetchGatewayPrices,A as findLiveModels,q as isHowtoCodeProvider,h as loadCatalog,o as looksLikeToken,n as maskToken,v as mergeModels,e as newProviderEntry,p as parseModelIds,z as probeModel,D as readProviderKey,f as repairGatewayModels,i as repairModelFacts,u as syncGatewayModelsOnStart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as uf}from"./chunk-ZJL4OEXX.js";import{b as cf}from"./chunk-XODGJSB3.js";import{a as qm,b as af,d as mf}from"./chunk-DBPJZUIT.js";import{H as Ve,K as sf,L as Dn,a as Gi}from"./chunk-5FIFNXLT.js";import{a as sr}from"./chunk-UTYFLLSM.js";import{a as Lm,b as jn,c as Nn,d as Dm,e as jm,f as Oo,g as Nm,h as Br,j as Mo}from"./chunk-MVVEYKN6.js";import{a as At}from"./chunk-WOT6VMZA.js";import{spawn as x1}from"node:child_process";import{existsSync as y1,readFileSync as h1}from"node:fs";import{join as I1}from"node:path";var U={};At(U,{Match:()=>AC});function AC(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}var Ae={};At(Ae,{Get:()=>Qi,Reset:()=>Cw,Set:()=>ww});var s={};At(s,{CodePointCount:()=>HC,Counted:()=>XC,Entries:()=>tw,EntriesRegExp:()=>ew,Every:()=>VC,EveryAll:()=>JC,GraphemeCount:()=>KC,HasPropertyKey:()=>ZC,IsArray:()=>Fo,IsBigInt:()=>vo,IsBoolean:()=>xf,IsClassInstance:()=>GC,IsConstructor:()=>jC,IsDeepEqual:()=>Bm,IsEqual:()=>J,IsFunction:()=>yf,IsGreaterEqualThan:()=>If,IsGreaterThan:()=>_C,IsInteger:()=>_m,IsLessEqualThan:()=>hf,IsLessThan:()=>UC,IsMaxLength:()=>zC,IsMinLength:()=>WC,IsMultipleOf:()=>BC,IsNull:()=>Wi,IsNumber:()=>Vi,IsObject:()=>Lo,IsObjectNotArray:()=>NC,IsString:()=>Ji,IsSymbol:()=>qC,IsUndefined:()=>Um,IsUnsafePropertyKey:()=>$f,IsValueLike:()=>bf,Keys:()=>zi,ShiftLeft:()=>Yi,Some:()=>YC,SomeAll:()=>QC,Symbols:()=>rw,Values:()=>nw});function qn(e,t,r){return e>=t&&e<=r}function OC(e){return e===8205}function pf(e){return qn(e,127462,127487)}function MC(e){return qn(e,65024,65039)}function vC(e){return qn(e,768,879)||qn(e,6832,6911)||qn(e,7616,7679)||qn(e,65056,65071)}function Ki(e){return e>65535?2:1}function ff(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(vC(r)||MC(r))t+=Ki(r);else break}return t}function FC(e,t){let r=e.codePointAt(t),n=t+Ki(r);for(n=ff(e,n);n<e.length-1&&OC(e.codePointAt(n));){let o=e.codePointAt(n+1);n+=1+Ki(o),n=ff(e,n)}return pf(r)&&n<e.length&&pf(e.codePointAt(n))&&(n+=Ki(e.codePointAt(n))),n}function df(e){let t=0,r=0;for(;r<e.length;)r=FC(e,r),t++;return t}function Hi(e){let t=0,r=0,n=0;for(;r<e.length;){let o=e.charCodeAt(r++)>>10;t+=+((n<<8|o)!==13879),n=o}return t}function lf(e,t){return e.length<=t||e.length<=t<<1&&Hi(e)<=t}function gf(e,t){return e.length>=t<<1||e.length>=t&&Hi(e)>=t}function Fo(e){return Array.isArray(e)}function vo(e){return J(typeof e,"bigint")}function xf(e){return J(typeof e,"boolean")}function jC(e){if(Um(e)||!yf(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function yf(e){return J(typeof e,"function")}function _m(e){return Number.isInteger(e)}function Wi(e){return J(e,null)}function Vi(e){return Number.isFinite(e)}function NC(e){return Lo(e)&&!Fo(e)}function Lo(e){return J(typeof e,"object")&&!Wi(e)}function Ji(e){return J(typeof e,"string")}function qC(e){return J(typeof e,"symbol")}function Um(e){return J(e,void 0)}function J(e,t){return e===t}function _C(e,t){return e>t}function UC(e,t){return e<t}function hf(e,t){return e<=t}function If(e,t){return e>=t}function BC(e,t){if(vo(e)||vo(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!Vi(e)||_m(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 GC(e){if(!Lo(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Wi(t)?!1:J(typeof t.constructor,"function")&&!(J(t.constructor,globalThis.Object)||J(t.constructor.name,"Object"))}function bf(e){return vo(e)||xf(e)||Wi(e)||Vi(e)||Ji(e)||Um(e)}function KC(e){return df(e)}function HC(e){return Hi(e)}function zC(e,t){return lf(e,t)}function WC(e,t){return gf(e,t)}function VC(e,t,r){return e.every((n,o)=>o<t||r(n,o))}function JC(e,t,r){let n=!0;return e.forEach((o,i)=>{i>=t&&!r(o,i)&&(n=!1)}),n}function YC(e,t){return e.some((r,n)=>t(r,n))}function QC(e,t){let r=!1;return e.forEach((n,o)=>{t(n,o)&&(r=!0)}),r}function XC(e,t){return e.reduce((r,n,o)=>t(n,o)?++r:r,0)}function Yi(e,t,r){return J(e.length,0)?r():t(e[0],e.slice(1))}function $f(e){return J(e,"__proto__")||J(e,"constructor")||J(e,"prototype")}function ZC(e,t){return $f(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ew(e){return zi(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function tw(e){return Object.entries(e)}function zi(e){return Object.getOwnPropertyNames(e)}function rw(e){return Object.getOwnPropertySymbols(e)}function nw(e){return Object.values(e)}function ow(e,t){if(!Lo(t))return!1;let r=zi(e);return J(r.length,zi(t).length)&&r.every(n=>Bm(e[n],t[n]))}function iw(e,t){return Fo(t)&&J(e.length,t.length)&&e.every((r,n)=>Bm(e[n],t[n]))}function Bm(e,t){return Fo(e)?iw(e,t):Lo(e)?ow(e,t):J(e,t)}var Le={};At(Le,{IsBigInt64Array:()=>Iw,IsBigUint64Array:()=>bw,IsBoolean:()=>sw,IsDate:()=>Ew,IsFloat32Array:()=>yw,IsFloat64Array:()=>hw,IsInt16Array:()=>dw,IsInt32Array:()=>gw,IsInt8Array:()=>cw,IsMap:()=>kw,IsNumber:()=>aw,IsRegExp:()=>$w,IsSet:()=>Sw,IsString:()=>mw,IsTypeArray:()=>uw,IsUint16Array:()=>lw,IsUint32Array:()=>xw,IsUint8Array:()=>pw,IsUint8ClampedArray:()=>fw});function sw(e){return e instanceof Boolean}function aw(e){return e instanceof Number}function mw(e){return e instanceof String}function uw(e){return globalThis.ArrayBuffer.isView(e)}function cw(e){return e instanceof globalThis.Int8Array}function pw(e){return e instanceof globalThis.Uint8Array}function fw(e){return e instanceof globalThis.Uint8ClampedArray}function dw(e){return e instanceof globalThis.Int16Array}function lw(e){return e instanceof globalThis.Uint16Array}function gw(e){return e instanceof globalThis.Int32Array}function xw(e){return e instanceof globalThis.Uint32Array}function yw(e){return e instanceof globalThis.Float32Array}function hw(e){return e instanceof globalThis.Float64Array}function Iw(e){return e instanceof globalThis.BigInt64Array}function bw(e){return e instanceof globalThis.BigUint64Array}function $w(e){return e instanceof globalThis.RegExp}function Ew(e){return e instanceof globalThis.Date}function Sw(e){return e instanceof globalThis.Set}function kw(e){return e instanceof globalThis.Map}var Ef=s;var Wt={immutableTypes:!1,maxErrors:8,maxParseErrors:1,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Cw(){Wt.immutableTypes=!1,Wt.maxErrors=8,Wt.maxParseErrors=1,Wt.maxInstantiationCount=128,Wt.useAcceleration=!0,Wt.exactOptionalPropertyTypes=!1,Wt.enumerableKind=!1,Wt.correctiveParse=!1,Wt.unionPrioritySort=!0}function ww(e){for(let t of s.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(Wt,t,{value:r})}}function Qi(){return Wt}function Xi(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 gt(e){return s.IsObject(e)&&!s.IsArray(e)}function ln(e){return s.IsBoolean(e)}function F(e){return gt(e)||ln(e)}function Zi(e){return s.HasPropertyKey(e,"additionalItems")&&F(e.additionalItems)}function _t(e){return s.HasPropertyKey(e,"additionalProperties")&&F(e.additionalProperties)}function es(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(t=>F(t))}function Sf(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function ts(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>F(t))}function Gm(e){return s.HasPropertyKey(e,"const")}function Gr(e){return s.HasPropertyKey(e,"contains")&&F(e.contains)}function bt(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 Hm(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 rs(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>F(t))}function Kr(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function ns(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function os(e){return s.HasPropertyKey(e,"else")&&F(e.else)}function zm(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function Wm(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function Cr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Do(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function ut(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function is(e){return s.HasPropertyKey(e,"if")&&F(e.if)}function gn(e){return s.HasPropertyKey(e,"items")&&(F(e.items)||s.IsArray(e.items)&&e.items.every(t=>F(t)))}function ss(e){return gn(e)&&s.IsArray(e.items)}function Vm(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function Jm(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function jo(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Ym(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function Qm(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function wr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function xn(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function yn(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function No(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function qo(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function Xm(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function as(e){return s.HasPropertyKey(e,"not")&&F(e.not)}function ms(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>F(t))}function _o(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function _n(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>F(t))}function hn(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>F(t))}function Un(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>F(t))}function us(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||F(e.propertyNames))}function Rw(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function Uo(e){return Rw(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function cs(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function ps(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function In(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function fs(e){return s.HasPropertyKey(e,"then")&&F(e.then)}function Zm(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function Hr(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Bo(e){return s.HasPropertyKey(e,"unevaluatedItems")&&F(e.unevaluatedItems)}function Go(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&F(e.unevaluatedProperties)}var ct=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}},Ze=class extends ct{constructor(){super(),this.errors=[]}AtCapacity(){return this.errors.length>=Ae.Get().maxErrors}AddError(t,r,n,o){return this.AddErrorObject({keyword:t,schemaPath:r,instancePath:n,params:o})}AddErrors(t){return t.forEach(r=>this.AddErrorObject(r)),!1}GetErrors(){return this.errors}AddErrorObject(t){return this.AtCapacity()||this.errors.push(t),!1}};function kf(e,t,r,n){return s.Every(r["~refine"],0,(o,i)=>o.check(n))}function Tf(e,t,r,n,o,i){return s.EveryAll(o["~refine"],0,(a,m)=>a.check(i)||t.AddError("~refine",r,n,{index:m,message:a.error(i)}))}var Ko="urn:typebox:root";function Rr(e,t){return URL.canParse(e,t)?new URL(e,t):s.IsEqual(t,Ko)?new URL(`${t}:${e}`):new URL(`${t.slice(0,t.lastIndexOf(":"))}:${e}`)}function Gn(e,t){let r=gt(t)&&ut(t)?Rr(t.$id,Ko).href:Ko;return{context:e,schema:t,lexicalSchema:t,lexicalBase:r,resourceBase:r,referenceBase:r,ids:[],useResourceBaseForReference:!0,recursiveAnchor:void 0,dynamicAnchors:[],resourceEntries:new Map,pendingResource:!0,enteredResource:!1}}function eu(e,t,r=!0){if(ln(t))return e;if(Array.isArray(t))return t.reduce((o,i)=>eu(o,i,!1),e);if(!gt(t)||!r&&ut(t))return e;let n=!r&&Kr(t)?[...e,t]:e;return Object.keys(t).reduce((o,i)=>eu(o,t[i],!1),n)}function Ho(e,t){return e.resourceEntries.get(t)}function Cf(e,t){return e.enteredResource||Ho(e,t)!==void 0}function Pw(e){return!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e.$id)}function Aw(e,t){return ut(t)?[...e.ids,t]:e.ids}function Ow(e,t){return e.recursiveAnchor??(Uo(t)?t:void 0)}function Mw(e,t){let r=ut(t)?eu(e.dynamicAnchors,t):e.dynamicAnchors;return Kr(t)?[...r,t]:r}function vw(e,t){return ut(t)?!1:e.pendingResource}function wf(e,t){let r=Ho(e,t);return r?r.base:ut(t)?Rr(t.$id,e.lexicalBase).href:e.lexicalBase}function Rf(e,t){let r=Ho(e,t);return r?r.base:ut(t)&&e.pendingResource?Rr(t.$id,e.resourceBase).href:e.resourceBase}function Pf(e,t){return ut(t)?!Pw(t):e.useResourceBaseForReference}function Fw(e,t){let r=Cf(e,t),n=Pf(e,t);return r||n?Rf(e,t):wf(e,t)}function Lw(e,t){let r=Ho(e,t);return r?r.root:ut(t)?t:e.lexicalSchema}function Dw(e,t){return gt(t)&&(ut(t)||Kr(t)||s.IsUndefined(e.recursiveAnchor)&&Uo(t)||!s.IsUndefined(Ho(e,t)))}function Kn(e,t){return Dw(e,t)?{...e,ids:Aw(e,t),dynamicAnchors:Mw(e,t),recursiveAnchor:Ow(e,t),pendingResource:vw(e,t),lexicalBase:wf(e,t),resourceBase:Rf(e,t),useResourceBaseForReference:Pf(e,t),referenceBase:Fw(e,t),lexicalSchema:Lw(e,t),enteredResource:Cf(e,t)}:e}function Af(e){return gn(e)&&s.IsArray(e.items)}function Of(e,t,r,n){return Af(r)?s.Every(n,0,(i,a)=>s.IsLessThan(a,r.items.length)||Ot(e,t,r.additionalItems,i)&&t.AddIndex(a)):!0}function Mf(e,t,r,n,o,i){return Af(o)?s.Every(i,0,(m,c)=>{let p=`${r}/additionalItems`,f=`${n}/${c}`;return s.IsLessThan(c,o.items.length)||Mt(e,t,p,f,o.additionalItems,m)&&t.AddIndex(c)}):!0}function $t(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function zr(e){return new RegExp(e,"u")}function jw(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function vf(e){let t=[];return _n(e)&&t.push(...s.Keys(e.patternProperties)),Un(e)&&t.push(...s.Keys(e.properties).map(jw)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function Ff(e,t,r,n){let o=zr(vf(r));return s.Every(s.Keys(n),0,(a,m)=>o.test(a)||Ot(e,t,r.additionalProperties,n[a])&&t.AddKey(a))}function Lf(e,t,r,n,o,i){let a=zr(vf(o)),m=[];return s.EveryAll(s.Keys(i),0,(p,f)=>{let d=`${r}/additionalProperties`,g=`${n}/${$t(p)}`,x=a.test(p)||Mt(e,t,d,g,o.additionalProperties,i[p])&&t.AddKey(p);return x||m.push(p),x})||t.AddError("additionalProperties",r,n,{additionalProperties:m})}function Df(e,t,r,n){let o=r.allOf.reduce((i,a)=>{let m=new ct;return Y(e,m,a,n)?[...i,m]:i},[]);return s.IsEqual(o.length,r.allOf.length)&&t.Merge(o)}function jf(e,t,r,n,o,i){let a=[],m=o.allOf.reduce((p,f,d)=>{let g=`${r}/allOf/${d}`,x=new Ze,I=ae(e,x,g,n,f,i);return I||a.push(x),I?[...p,x]:p},[]),c=s.IsEqual(m.length,o.allOf.length)&&t.Merge(m);return c||a.forEach(p=>t.AddErrors(p.GetErrors())),c}function Nf(e,t,r,n){let o=r.anyOf.reduce((i,a)=>{let m=new ct;return Y(e,m,a,n)?[...i,m]:i},[]);return s.IsGreaterThan(o.length,0)&&t.Merge(o)}function qf(e,t,r,n,o,i){let a=[],m=o.anyOf.reduce((p,f,d)=>{let g=new Ze,x=`${r}/anyOf/${d}`,I=ae(e,g,x,n,f,i);return I||a.push(g),I?[...p,g]:p},[]),c=s.IsGreaterThan(m.length,0)&&t.Merge(m);return c||a.forEach(p=>t.AddErrors(p.GetErrors())),c||t.AddError("anyOf",r,n,{})}function nu(e,t,r,n){return r}function _f(e,t,r,n,o,i){return nu(e,t,o,i)||t.AddError("boolean",r,n,{})}function ou(e,t,r,n){return s.IsValueLike(r.const)?s.IsEqual(n,r.const):s.IsDeepEqual(n,r.const)}function Uf(e,t,r,n,o,i){return ou(e,t,o,i)||t.AddError("const",r,n,{allowedValue:o.const})}function Nw(e){return!(xn(e)&&s.IsEqual(e.minContains,0))}function iu(e,t,r,n){return Nw(r)?!s.IsEqual(n.length,0)&&s.SomeAll(n,(o,i)=>Y(e,t,r.contains,o)&&t.AddIndex(i)):!0}function Bf(e,t,r,n,o,i){return iu(e,t,o,i)||t.AddError("contains",r,n,{minContains:1})}function Gf(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)):Y(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/${$t(c)}`;return!s.HasPropertyKey(i,c)||(s.IsArray(p)?p.every(d=>s.HasPropertyKey(i,d)||t.AddError("dependencies",r,n,{property:c,dependencies:p})):ae(e,t,f,n,p,i))});return a||m}function Hf(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 zf(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("dependentRequired",r,n,{property:c,dependencies:p})));return a||m}function Wf(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)||Y(e,t,m,n));return o||i}function Vf(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/${$t(c)}`;return!s.HasPropertyKey(i,c)||ae(e,t,f,n,p,i)});return a||m}var Ut={};At(Ut,{DynamicRef:()=>gR,RecursiveRef:()=>fR,Ref:()=>cR});var mr={};At(mr,{Delete:()=>Bw,Get:()=>_w,Has:()=>qw,Indices:()=>Wo,Set:()=>Uw});function Yf(e){throw Error(e)}function Jf(){Yf("Pointer contains unsafe property key")}function su(){Yf("Cannot set value")}function Wo(e){let t=e.split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));return t[0]===""?t.slice(1):t}function qw(e,t){let r=e;for(let n of Wo(t)){if(!s.IsObject(r)||!s.HasPropertyKey(r,n))return!1;r=r[n]}return!0}function _w(e,t){let r=e;for(let n of Wo(t)){if(!s.IsObject(r)||s.IsUnsafePropertyKey(n))return;r=r[n]}return r}function Qf(e,t,r){let n=e;for(let o of t)s.IsUnsafePropertyKey(o)&&Jf(),n=s.IsObject(n)?n[o]:void 0;return s.IsUnsafePropertyKey(r)&&Jf(),s.IsObject(n)||su(),n}function Uw(e,t,r){let n=Wo(t),o=n.pop();return s.IsUndefined(o)&&su(),Qf(e,n,o)[o]=r,e}function Bw(e,t){let r=Wo(t),n=r.pop();s.IsUndefined(n)&&su();let o=Qf(e,r,n);return s.IsArray(o)&&/^(0|[1-9]\d*)$/.test(n)?o.splice(Number(n),1):delete o[n],e}function uu(e,t){return gt(e)&&ut(e)?Rr(e.$id,t.href):t}function cu(e){return Rr(e,Ko)}function au(e){return e.href.split("#")[0]}function Gw(e,t,r){return mu(e,cu(t),r)}function Kw(e,t){return t.$ref.startsWith("#")||e.enteredResource?e.lexicalSchema:e.schema}function Hw(e){return e.startsWith("#/")}function Xf(e,t){if(s.IsObject(e)&&Kr(e)&&s.IsEqual(e.$dynamicAnchor,t))return e;if(s.IsObject(e))for(let r of s.Keys(e)){let n=Xf(e[r],t);if(n)return n}}function mu(e,t,r){if(s.IsEqual(e,r))return t.href;let n=uu(e,t);if(s.IsArray(e))for(let o of e){let i=mu(o,n,r);if(!s.IsUndefined(i))return i}else if(s.IsObject(e))for(let o of s.Keys(e)){let i=mu(e[o],n,r);if(!s.IsUndefined(i))return i}}function Zf(e,t){if(t.href.endsWith("#"))return e;if(!t.hash.startsWith("#"))return;let r=decodeURIComponent(t.hash.slice(1));if(r.startsWith("/"))return mr.Get(e,r)}function zw(e,t,r){if(!ut(e))return;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("#")?Zf(e,r):e}function Ww(e,t,r){if(!Sf(e))return;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 Vw(e,t,r){if(!Kr(e))return;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 Jw(e,t,r){if(gt(e))return zw(e,t,r)??Ww(e,t,r)??Vw(e,t,r)??Zf(e,r)}function Yw(e,t,r){if(s.IsArray(e))return e.reduce((n,o)=>{let i=ds(o,t,r);return s.IsUndefined(i)?n:i},void 0)}function Qw(e,t,r){if(s.IsObject(e))return s.Keys(e).reduce((n,o)=>{if(s.IsEqual(o,"const")||s.IsEqual(o,"enum"))return n;let i=ds(e[o],t,r);return s.IsUndefined(i)?n:i},void 0)}function ds(e,t,r){let n=uu(e,t);return Jw(e,n,r)??Yw(e,n,r)??Qw(e,n,r)}function Xw(e,t,r,n){let o=ls(e,t,r,n);return gt(o)&&ut(o)?o:void 0}function Zw(e,t,r){if(!t.$ref.startsWith("#")||!gt(e.schema)||s.HasPropertyKey(e.schema,"$schema"))return;let n=Gw(e.lexicalSchema,e.referenceBase,r);if(!(s.IsUndefined(n)||s.IsEqual(n,e.referenceBase)))return{target:r,base:n,root:e.lexicalSchema}}function eR(e,t,r){let n=e.context[t];if(gt(n))return{target:r,base:t,root:n}}function tR(e,t,r,n,o){let i=o?eR(e,n,r):void 0;return s.IsUndefined(i)?Zw(e,t,r):i}function rR(e,t,r){if(ut(r))return;let n=Xw(e.context,e.schema,e.referenceBase,t);if(!(!n||e.ids.includes(n)))return{resource:n}}function nR(e,t){return s.HasPropertyKey(e,t)?e[t]:void 0}function oR(e,t,r){return ds(e,t,r)}function iR(e,t,r){let n=au(r);if(!s.HasPropertyKey(e,n)||s.IsEqual(n,au(t)))return;let o=e[n],i=uu(o,new URL(n));return s.IsEqual(r.hash,"")?o:ds(o,i,r)}function ls(e,t,r,n){let o=cu(r),i=Rr(n,o.href);return nR(e,n)??oR(t,o,i)??iR(e,o,i)}function sR(e,t){if(!t)return e;let r=new Map(e.resourceEntries);return r.set(t.target,{base:t.base,root:t.root}),{...e,resourceEntries:r}}function aR(e,t){return t?Kn(e,t.resource):e}function ed(e,t,r,n){let o=sR({...e,pendingResource:t},r);return aR(o,n)}function mR(e,t,r){let n=au(Rr(t.$ref,e.referenceBase)),o=!s.IsEqual(n,e.resourceBase),i=tR(e,t,r,n,o),a=o?rR(e,n,r):void 0;return{schema:r,stack:ed(e,!0,i,a)}}function uR(e,t){return{schema:t,stack:ed(e,!s.IsUndefined(t))}}function cR(e,t){let r=ls(e.context,Kw(e,t),e.referenceBase,t.$ref);return gt(r)?mR(e,t,r):uR(e,r)}function pR(e){return gt(e.lexicalSchema)&&Uo(e.lexicalSchema)}function fR(e,t){let r=pR(e)?e.recursiveAnchor:e.lexicalSchema;return ls(e.context,r,e.lexicalBase,t.$recursiveRef)}function td(e,t){return Rr(t.$dynamicRef,cu(e.lexicalBase).href).hash}function rd(e,t){return e.dynamicAnchors.find(r=>s.IsEqual(r.$dynamicAnchor,t))??Xf(e.schema,t)}function dR(e,t,r){if(!gt(r)||!Kr(r))return r;let n=td(e,t);return Hw(n)?r:rd(e,r.$dynamicAnchor)}function lR(e,t){let r=td(e,t);return rd(e,decodeURIComponent(r.slice(1)))}function gR(e,t){let r=t.$dynamicRef.startsWith("#")?e.lexicalSchema:e.schema,n=ls(e.context,r,e.lexicalBase,t.$dynamicRef);return s.IsUndefined(n)?lR(e,t):dR(e,t,n)}function nd(e,t,r,n){let o=Ut.DynamicRef(e,r)??!1,i=o?{...e,pendingResource:!0}:e;return F(o)&&Y(i,t,o,n)}function od(e,t,r,n,o,i){let a=Ut.DynamicRef(e,o)??!1,m=a?{...e,pendingResource:!0}:e;return F(a)&&ae(m,t,r,n,a,i)}function du(e,t,r,n){return s.Some(r.enum,o=>s.IsValueLike(o)?s.IsEqual(n,o):s.IsDeepEqual(n,o))}function id(e,t,r,n,o,i){return du(e,t,o,i)||t.AddError("enum",r,n,{allowedValues:o.enum})}function lu(e,t,r,n){return s.IsLessThan(n,r.exclusiveMaximum)}function sd(e,t,r,n,o,i){return lu(e,t,o,i)||t.AddError("exclusiveMaximum",r,n,{comparison:"<",limit:o.exclusiveMaximum})}function gu(e,t,r,n){return s.IsGreaterThan(n,r.exclusiveMinimum)}function ad(e,t,r,n,o,i){return gu(e,t,o,i)||t.AddError("exclusiveMinimum",r,n,{comparison:">",limit:o.exclusiveMinimum})}var Qo={};At(Qo,{Clear:()=>Fd,Entries:()=>o0,Get:()=>a0,Has:()=>s0,IsDate:()=>zn,IsDateTime:()=>gs,IsDuration:()=>xs,IsEmail:()=>ys,IsHostname:()=>Ts,IsIPv4:()=>Rs,IsIPv6:()=>Ps,IsIdnEmail:()=>Cs,IsIdnHostname:()=>ws,IsIri:()=>Os,IsIriReference:()=>As,IsJsonPointer:()=>vs,IsJsonPointerUriFragment:()=>Ms,IsRegex:()=>Fs,IsRelativeJsonPointer:()=>Ls,IsTime:()=>Wn,IsUri:()=>Ns,IsUriReference:()=>Ds,IsUriTemplate:()=>js,IsUrl:()=>qs,IsUuid:()=>_s,Reset:()=>Ld,Set:()=>i0,Test:()=>m0});var xR=[0,31,28,31,30,31,30,31,31,30,31,30,31],yR=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function hR(e){return e%4===0&&(e%100!==0||e%400===0)}function zn(e){let t=yR.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&&hR(r)?29:xR[n])}var IR=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;function Wn(e,t=!0){let r=IR.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}var bR=/^(?:\[!?(?:(?!\.{1,2}[/\]])[A-Za-z._][A-Za-z._0-9+-]{0,13}(?:\/(?!\.{1,2}[/\]])[A-Za-z._][A-Za-z._0-9+-]{0,13})*|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])\](?:\[!?[a-z_][a-z_0-9-]*=[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*\])*|(?:\[!?[a-z_][a-z_0-9-]*=[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*\])*)$/;function gs(e){let t=e.indexOf("["),r=t===-1?e:e.slice(0,t);if(t!==-1&&!bR.test(e.slice(t)))return!1;let n=r.split(/T/i);return n.length===2&&zn(n[0])&&Wn(n[1])}var $R=/^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 xs(e){return $R.test(e)}var ER=/^(?:[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 ys(e){return ER.test(e)}var md=/^(?!-).*(?<!-)$/,ud=/^(?!..--)/,cd=/^[a-zA-Z0-9-]*$/,GB=new RegExp("^\\p{ASCII}*$","u"),Vn=/[^\p{ASCII}]/u;var SR=/[0-9]/,pd=/[\u{0660}-\u{0669}]/u,kR=/[\u{06f0}-\u{06f9}]/u,TR=/[\u{002e}\u{002c}\u{003a}\u{002f}]/u,CR=/[\u{002d}\u{002b}]/u,xu=new RegExp("\\p{Mn}","u"),wR=new RegExp("\\p{Mc}","u"),KB=new RegExp("\\p{Me}","u"),fd=/[\p{Mn}\p{Mc}\p{Me}]/u,yu=new RegExp("\\p{L}","u"),RR=new RegExp("\\p{Nd}","u"),dd=new RegExp("\\p{Script=Greek}","u"),hs=new RegExp("\\p{Script=Hebrew}","u"),ld=/[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u,gd=/[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u,hu=/[\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,xd=/[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u,PR=/[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u,AR=/[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u,yd=new RegExp([SR,kR].map(e=>e.source).join("|"),"u"),hd=new RegExp([yu,CR,TR,RR,xu,wR,PR,AR].map(e=>e.source).join("|"),"u");function Id(e){return md.test(e)&&ud.test(e)&&cd.test(e)}var Jt=36,Jo=1,Yo=26,MR=38,vR=700,$d=72,Ed=128;function Iu(){throw null}function Is(e){return e.toLowerCase().startsWith("xn--")}function Sd(e,t,r){e=r?Math.floor(e/vR):e>>1,e+=Math.floor(e/t);let n=0;for(;e>(Jt-Jo)*Yo>>1;)e=Math.floor(e/(Jt-Jo)),n+=Jt;return n+Math.floor((Jt-Jo+1)*e/(e+MR))}function bs(e){let t=[],r=Ed,n=0,o=$d,i=e.lastIndexOf("-");if(i>0)for(let m=0;m<i;m++){let c=e.charCodeAt(m);c>=128&&Iu(),t.push(c)}let a=i<0?0:i+1;for(;a<e.length;){let m=n,c=1,p=Jt;for(;;){a>=e.length&&Iu();let d=e.charCodeAt(a++),g;d>=97&&d<=122?g=d-97:d>=48&&d<=57?g=d-48+26:Iu(),n+=g*c;let x=p<=o?Jo:p>=o+Yo?Yo:p-o;if(g<x)break;c*=Jt-x,p+=Jt}let f=t.length+1;o=Sd(n-m,f,m===0),r+=Math.floor(n/f),n%=f,t.splice(n,0,r),n++}return String.fromCodePoint(...t)}function bd(e){return e<26?String.fromCharCode(e+97):String.fromCharCode(e-26+48)}var FR=new RegExp(Vn.source,"gu");function kd(e){let t=e.replace(FR,""),r=t.length,n=r>0?[t,"-"]:[],o=Array.from(e,p=>p.codePointAt(0)),i=Ed,a=0,m=$d,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=Jt;;g+=Jt){let x=g<=m?Jo:g>=m+Yo?Yo:g-m;if(d<x)break;let I=x+(d-x)%(Jt-x);n.push(bd(I)),d=Math.floor((d-x)/(Jt-x))}n.push(bd(d)),m=Sd(a,c+1,c===r),a=0,c++}a++,i++}return n.join("")}var LR=/^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/,Td=/^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/,DR=/^(?:R|AL|AN)$/;function Cd(e){if(Is(e))try{return $s(bs(e.slice(4).toLowerCase()))}catch{return!1}return $s(e)}function wd(e){let t=String.fromCodePoint(e);return yd.test(t)?"EN":pd.test(t)?"AN":xu.test(t)?"NSM":hs.test(t)?"R":gd.test(t)?"AL":yu.test(t)?"L":"ON"}function $s(e){for(let t of e)if(DR.test(wd(t.codePointAt(0))))return!0;return!1}function Es(e){let t=!1,r=Td,n=!1,o=!1,i=!0;for(let a of e){let m=wd(a.codePointAt(0));if(i){if(m!=="L"&&m!=="R"&&m!=="AL")return!1;t=m==="R"||m==="AL",r=t?LR:Td,i=!1}if(!r.test(m))return!1;m==="EN"?n=!0:m==="AN"&&(o=!0)}return!(t&&n&&o)}function jR(e){return Vn.test(e)&&kd(e).length+4>63}function NR(e){return e[0]==="-"||e[e.length-1]==="-"?!0:e.slice(2).join("").startsWith("--")}function Ss(e){if(jR(e)||$s(e)&&!Es(e))return!1;let t=[...e],r=t.map(i=>i.codePointAt(0)),n=r.length;if(NR(t)||fd.test(t[0]))return!1;let o=!1;for(let i=0;i<n;i++){let a=r[i],m=t[i];if(xd.test(m)||!hd.test(m))return!1;ld.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||!dd.test(t[i+1]))return!1;break;case 1523:case 1524:if(!c||!hs.test(t[i-1]))return!1;break;case 8204:if(!c||c<128&&!hu.test(t[i-1]))return!1;break;case 8205:if(!c||!hu.test(t[i-1]))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o)}function ks(e){if(!Is(e))return!1;try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let r=bs(t);return Vn.test(r)?Ss(r):!1}catch{return!1}}function qR(e){return e.length>0&&e.length<=63}function _R(e){return qR(e)&&(ks(e)||Id(e))}function Od(e){return e.length===0||e.length>253||e.charCodeAt(e.length-1)===46?!1:e.split(".").every(t=>_R(t))}function UR(e){return e.length>0&&e.length<=63}function BR(e){return UR(e)&&(ks(e)||Ss(e))}function GR(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 Md(e){if(e.length===0||e.includes(" "))return!1;let t=GR(e);if(t.length>253)return!1;let r=t.split("."),n=r.some(o=>Cd(o));return r.every(o=>BR(o)&&(!n||Es(o)))}function Ts(e){return Od(e)}var KR=/^(?:[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 Cs(e){return KR.test(e.normalize("NFC"))}function ws(e){return Md(e)}var HR=/^(?:(?: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 Rs(e){return HR.test(e)}var zR=/^(?:(?:(?:[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 Ps(e){return zR.test(e)}var WR=/[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/,VR=/^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;function As(e){return!WR.test(e)&&!VR.test(e)&&URL.canParse(e,"http://example.com")}var JR=/[\x00-\x20<>\^`{|}\\]/,YR=/%(?![0-9a-fA-F]{2})/;function Os(e){return JR.test(e)||YR.test(e)?!1:URL.canParse(e)}var QR=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Ms(e){return QR.test(e)}var XR=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function vs(e){return XR.test(e)}function Fs(e){try{return new RegExp(e,"u"),!0}catch{return!1}}var ZR=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Ls(e){return ZR.test(e)}var e0=/^(?:[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 Ds(e){return e0.test(e)}var t0=/^(?:(?:[^\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 js(e){return t0.test(e)}var r0=/^[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 Ns(e){return r0.test(e)}function qs(e){return URL.canParse(e)}var n0=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function _s(e){return n0.test(e)}var fe=new Map;function Fd(){fe.clear()}function o0(){return[...fe.entries()]}function i0(e,t){fe.set(e,t)}function s0(e){return fe.has(e)}function a0(e){return fe.get(e)}function m0(e,t){return fe.get(e)?.(t)??!0}function Ld(){Fd(),fe.set("date-time",gs),fe.set("date",zn),fe.set("duration",xs),fe.set("email",ys),fe.set("hostname",Ts),fe.set("idn-email",Cs),fe.set("idn-hostname",ws),fe.set("ipv4",Rs),fe.set("ipv6",Ps),fe.set("iri-reference",As),fe.set("iri",Os),fe.set("json-pointer-uri-fragment",Ms),fe.set("json-pointer",vs),fe.set("regex",Fs),fe.set("relative-json-pointer",Ls),fe.set("time",Wn),fe.set("uri-reference",Ds),fe.set("uri-template",js),fe.set("uri",Ns),fe.set("url",qs),fe.set("uuid",_s)}Ld();function $u(e,t,r,n){return Qo.Test(r.format,n)}function Dd(e,t,r,n,o,i){return $u(e,t,o,i)||t.AddError("format",r,n,{format:o.format})}function jd(e,t,r,n){let o=fs(r)?r.then:!0,i=os(r)?r.else:!0;return Y(e,t,r.if,n)?Y(e,t,o,n):Y(e,t,i,n)}function Nd(e,t,r,n,o,i){let a=fs(o)?o.then:!0,m=os(o)?o.else:!0,c=new Ze,p=ae(e,c,`${r}/if`,n,o.if,i)?ae(e,c,`${r}/then`,n,a,i)||t.AddError("if",r,n,{failingKeyword:"then"}):ae(e,t,`${r}/else`,n,m,i)||t.AddError("if",r,n,{failingKeyword:"else"});return p&&t.Merge([c]),p}function u0(e,t,r,n){return s.Every(r.items,0,(o,i)=>s.IsLessEqualThan(n.length,i)||Ot(e,t,o,n[i])&&t.AddIndex(i))}function c0(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)||Mt(e,t,c,p,a,i[m])&&t.AddIndex(m)})}function p0(e,t,r,n){let o=hn(r)?r.prefixItems.length:0;return s.Every(n,o,(i,a)=>Ot(e,t,r.items,i)&&t.AddIndex(a))}function f0(e,t,r,n,o,i){let a=hn(o)?o.prefixItems.length:0;return s.EveryAll(i,a,(m,c)=>{let p=`${r}/items`,f=`${n}/${c}`;return Mt(e,t,p,f,o.items,m)&&t.AddIndex(c)})}function qd(e,t,r,n){return ss(r)?u0(e,t,r,n):p0(e,t,r,n)}function _d(e,t,r,n,o,i){return ss(o)?c0(e,t,r,n,o,i):f0(e,t,r,n,o,i)}function d0(e){return Gr(e)}function Eu(e,t,r,n){if(!d0(r))return!0;let o=s.Counted(n,i=>Y(e,t,r.contains,i));return s.IsLessEqualThan(o,r.maxContains)}function Ud(e,t,r,n,o,i){let a=xn(o)?o.minContains:1;return Eu(e,t,o,i)||t.AddError("contains",r,n,{minContains:a,maxContains:o.maxContains})}function Su(e,t,r,n){return s.IsLessEqualThan(n,r.maximum)}function Bd(e,t,r,n,o,i){return Su(e,t,o,i)||t.AddError("maximum",r,n,{comparison:"<=",limit:o.maximum})}function ku(e,t,r,n){return s.IsLessEqualThan(n.length,r.maxItems)}function Gd(e,t,r,n,o,i){return ku(e,t,o,i)||t.AddError("maxItems",r,n,{limit:o.maxItems})}function Tu(e,t,r,n){return s.IsMaxLength(n,r.maxLength)}function Kd(e,t,r,n,o,i){return Tu(e,t,o,i)||t.AddError("maxLength",r,n,{limit:o.maxLength})}function Cu(e,t,r,n){return s.IsLessEqualThan(s.Keys(n).length,r.maxProperties)}function Hd(e,t,r,n,o,i){return Cu(e,t,o,i)||t.AddError("maxProperties",r,n,{limit:o.maxProperties})}function l0(e){return Gr(e)}function wu(e,t,r,n){if(!l0(r))return!0;let o=s.Counted(n,(i,a)=>Y(e,t,r.contains,i)&&t.AddIndex(a));return s.IsGreaterEqualThan(o,r.minContains)}function zd(e,t,r,n,o,i){return wu(e,t,o,i)||t.AddError("contains",r,n,{minContains:o.minContains})}function Ru(e,t,r,n){return s.IsGreaterEqualThan(n,r.minimum)}function Wd(e,t,r,n,o,i){return Ru(e,t,o,i)||t.AddError("minimum",r,n,{comparison:">=",limit:o.minimum})}function Pu(e,t,r,n){return s.IsGreaterEqualThan(n.length,r.minItems)}function Vd(e,t,r,n,o,i){return Pu(e,t,o,i)||t.AddError("minItems",r,n,{limit:o.minItems})}function Au(e,t,r,n){return s.IsMinLength(n,r.minLength)}function Jd(e,t,r,n,o,i){return Au(e,t,o,i)||t.AddError("minLength",r,n,{limit:o.minLength})}function Ou(e,t,r,n){return s.IsGreaterEqualThan(s.Keys(n).length,r.minProperties)}function Yd(e,t,r,n,o,i){return Ou(e,t,o,i)||t.AddError("minProperties",r,n,{limit:o.minProperties})}function Mu(e,t,r,n){return s.IsMultipleOf(n,r.multipleOf)}function Qd(e,t,r,n,o,i){return Mu(e,t,o,i)||t.AddError("multipleOf",r,n,{multipleOf:o.multipleOf})}function vu(e,t,r,n){let o=new ct;return!Y(e,o,r.not,n)&&t.Merge([o])}function Xd(e,t,r,n,o,i){return vu(e,t,o,i)||t.AddError("not",r,n,{})}function Zd(e,t,r,n){let o=r.oneOf.reduce((i,a)=>{let m=new ct;return Y(e,m,a,n)?[...i,m]:i},[]);return s.IsEqual(o.length,1)&&t.Merge(o)}function el(e,t,r,n,o,i){let a=[],m=[],c=o.oneOf.reduce((f,d,g)=>{let x=new Ze,I=`${r}/oneOf/${g}`,h=ae(e,x,I,n,d,i);return h&&m.push(g),h||a.push(x),h?[...f,x]:f},[]),p=s.IsEqual(c.length,1)&&t.Merge(c);return!p&&s.IsEqual(m.length,0)&&a.forEach(f=>t.AddErrors(f.GetErrors())),p||t.AddError("oneOf",r,n,{passingSchemas:m})}function Fu(e,t,r,n){return(s.IsString(r.pattern)?zr(r.pattern):r.pattern).test(n)}function tl(e,t,r,n,o,i){return Fu(e,t,o,i)||t.AddError("pattern",r,n,{pattern:o.pattern})}function rl(e,t,r,n){return s.Every(s.Entries(r.patternProperties),0,([o,i])=>{let a=zr(o);return s.Every(s.Entries(n),0,([m,c])=>!a.test(m)||Ot(e,t,i,c)&&t.AddKey(m))})}function nl(e,t,r,n,o,i){return s.EveryAll(s.Entries(o.patternProperties),0,([a,m])=>{let c=`${r}/patternProperties/${$t(a)}`,p=zr(a);return s.EveryAll(s.Entries(i),0,([f,d])=>{let g=`${n}/${$t(f)}`;return!p.test(f)||Mt(e,t,c,g,m,d)&&t.AddKey(f)})})}function ol(e,t,r,n){return s.IsEqual(n.length,0)||s.Every(r.prefixItems,0,(o,i)=>s.IsLessEqualThan(n.length,i)||Ot(e,t,o,n[i])&&t.AddIndex(i))}function il(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)||Mt(e,t,c,p,a,i[m])&&t.AddIndex(m)})}function Lu(e,t){return e.includes(t)||Ae.Get().exactOptionalPropertyTypes}function Du(e,t){return s.IsUndefined(e[t])}function sl(e,t,r,n){let o=In(r)?r.required:[];return s.Every(s.Entries(r.properties),0,([a,m])=>{let c=!s.HasPropertyKey(n,a)||Ot(e,t,m,n[a])&&t.AddKey(a);return Lu(o,a)?c:Du(n,a)||c})}function al(e,t,r,n,o,i){let a=In(o)?o.required:[];return s.EveryAll(s.Entries(o.properties),0,([c,p])=>{let f=`${r}/properties/${$t(c)}`,d=`${n}/${$t(c)}`,g=()=>!s.HasPropertyKey(i,c)||Mt(e,t,f,d,p,i[c])&&t.AddKey(c);return Lu(a,c)?g():Du(i,c)||g()})}function ml(e,t,r,n){return s.Every(s.Keys(n),0,(o,i)=>Y(e,t,r.propertyNames,o))}function ul(e,t,r,n,o,i){let a=[];return s.EveryAll(s.Keys(i),0,(c,p)=>{let f=`${n}/${$t(c)}`,d=`${r}/propertyNames`,g=ae(e,t,d,f,o.propertyNames,c);return g||a.push(c),g})||t.AddError("propertyNames",r,n,{propertyNames:a})}function cl(e,t,r,n){let o=Ut.RecursiveRef(e,r)??!1,i=o?{...e,pendingResource:!0}:e;return F(o)&&Y(i,t,o,n)}function pl(e,t,r,n,o,i){let a=Ut.RecursiveRef(e,o)??!1,m=a?{...e,pendingResource:!0}:e;return F(a)&&ae(m,t,r,n,a,i)}function fl(e,t,r,n){let o=Ut.Ref(e,r),i=o.schema??!1,a=new ct,m=F(i)&&Y(o.stack,a,i,n);return m&&t.Merge([a]),m}function dl(e,t,r,n,o,i){let a=Ut.Ref(e,o),m=a.schema??!1,c=new Ze,p=F(m)&&ae(a.stack,c,r,n,m,i);return p&&t.Merge([c]),p||t.AddErrors(c.GetErrors()),p}function ll(e,t,r,n){return s.Every(r.required,0,o=>s.HasPropertyKey(n,o))}function gl(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("required",r,n,{requiredProperties:a})}function ju(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 xl(e,t,r,n,o){return s.Some(r,i=>ju(e,t,i,n,o))}function yl(e,t,r,n){return s.IsArray(r.type)?xl(e,t,r.type,r,n):ju(e,t,r.type,r,n)}function hl(e,t,r,n,o,i){return(s.IsArray(o.type)?xl(e,t,o.type,o,i):ju(e,t,o.type,o,i))||t.AddError("type",r,n,{type:o.type})}function Il(e,t,r,n){let o=t.GetIndices();return s.Every(n,0,(i,a)=>(o.has(a)||Y(e,t,r.unevaluatedItems,i))&&t.AddIndex(a))}function bl(e,t,r,n,o,i){let a=t.GetIndices(),m=[];return s.EveryAll(i,0,(p,f)=>{let d=new Ze,g=(a.has(f)||ae(e,d,r,n,o.unevaluatedItems,p))&&t.AddIndex(f);return g||m.push(f),g})||t.AddError("unevaluatedItems",r,n,{unevaluatedItems:m})}function $l(e,t,r,n){let o=t.GetKeys();return s.Every(s.Entries(n),0,([i,a])=>o.has(i)||Y(e,t,r.unevaluatedProperties,a)&&t.AddKey(i))}function El(e,t,r,n,o,i){let a=t.GetKeys(),m=[];return s.EveryAll(s.Entries(i),0,([p,f])=>{let d=new Ze,g=a.has(p)||ae(e,d,r,n,o.unevaluatedProperties,f)&&t.AddKey(p);return g||m.push(p),g})||t.AddError("unevaluatedProperties",r,n,{unevaluatedProperties:m})}var Pr={};At(Pr,{Hash:()=>Rl,HashCode:()=>P0});function Ie(){throw new Error("Unreachable")}function g0(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 x0(e){return typeof e=="number"}var St={Array:0,BigInt:1,Boolean:2,Date:3,Constructor:4,Function:5,Null:6,Number:7,Object:8,RegExp:9,String:10,Symbol:11,TypeArray:12,Undefined:13},Bs=8997,Xo=33826,Gs=40164,Ks=52210,Tl=new Float64Array(1),Cl=new DataView(Tl.buffer),wl=new Uint8Array(Tl.buffer);function Ue(e){let t=Bs^e,r=t*435,n=Xo*435+(r>>>16),o=Gs*435+(n>>>16)+(t<<8),i=Ks*435+(o>>>16)+(Xo<<8);Bs=r&65535,Xo=n&65535,Gs=o&65535,Ks=i&65535}function y0(e){Ue(St.Array);for(let t of e)Wr(t)}function h0(e){Ue(St.BigInt),Cl.setBigInt64(0,e);for(let t of wl)Ue(t)}function Sl(e){Ue(St.Boolean),Ue(e?1:0)}function I0(e){Ue(St.Constructor),Wr(e.toString())}function b0(e){Ue(St.Date),Wr(e.getTime())}function $0(e){Ue(St.Function),Wr(e.toString())}function E0(e){Ue(St.Null)}function kl(e){Ue(St.Number),Cl.setFloat64(0,e,!0);for(let t of wl)Ue(t)}function S0(e){Ue(St.Object);for(let t of g0(e).sort())Wr(t),Wr(e[t])}function k0(e){Ue(St.RegExp),Nu(e.toString())}var T0=new TextEncoder;function Nu(e){Ue(St.String);for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127){for(let n of T0.encode(e.slice(t)))Ue(n);return}Ue(r)}}function C0(e){Ue(St.Symbol),Wr(e.toString())}function w0(e){Ue(St.TypeArray);let t=new Uint8Array(e.buffer);for(let r=0;r<t.length;r++)Ue(t[r])}function R0(e){return Ue(St.Undefined)}function Wr(e){return Le.IsTypeArray(e)?w0(e):Le.IsDate(e)?b0(e):Le.IsRegExp(e)?k0(e):Le.IsBoolean(e)?Sl(e.valueOf()):Le.IsString(e)?Nu(e.valueOf()):Le.IsNumber(e)?kl(e.valueOf()):x0(e)?kl(e):s.IsArray(e)?y0(e):s.IsBoolean(e)?Sl(e):s.IsBigInt(e)?h0(e):s.IsConstructor(e)?I0(e):s.IsNull(e)?E0(e):s.IsObject(e)?S0(e):s.IsString(e)?Nu(e):s.IsSymbol(e)?C0(e):s.IsUndefined(e)?R0(e):s.IsFunction(e)?$0(e):Ie()}function Us(e){return e.toString(16).padStart(4,"0")}function P0(e){return BigInt(`0x${Rl(e)}`)}function Rl(e){return Bs=8997,Xo=33826,Gs=40164,Ks=52210,Wr(e),`${Us(Ks)}${Us(Gs)}${Us(Xo)}${Us(Bs)}`}function Pl(e){return!s.IsEqual(e.uniqueItems,!1)}function Al(e,t,r,n){if(!Pl(r))return!0;let o=new Set(n.map(Pr.Hash)).size,i=n.length;return s.IsEqual(o,i)}function Ol(e,t,r,n,o,i){if(!Pl(o))return!0;let a=new Set,m=i.reduce((p,f,d)=>{let g=Pr.Hash(f);return a.has(g)?[...p,d]:(a.add(g),p)},[]);return s.IsEqual(m.length,0)||t.AddError("uniqueItems",r,n,{duplicateItems:m})}function Ot(e,t,r,n){return t.Push()&&Y(e,t,r,n)&&t.Pop()}function Y(e,t,r,n){let o=Kn(e,r);return ln(r)?nu(o,t,r,n):(!Zm(r)||yl(o,t,r,n))&&(!(s.IsObject(n)&&!s.IsArray(n))||(!In(r)||ll(o,t,r,n))&&(!_t(r)||Ff(o,t,r,n))&&(!Km(r)||Gf(o,t,r,n))&&(!Hm(r)||Hf(o,t,r,n))&&(!rs(r)||Wf(o,t,r,n))&&(!_n(r)||rl(o,t,r,n))&&(!Un(r)||sl(o,t,r,n))&&(!us(r)||ml(o,t,r,n))&&(!qo(r)||Ou(o,t,r,n))&&(!Qm(r)||Cu(o,t,r,n)))&&(!s.IsArray(n)||(!Zi(r)||Of(o,t,r,n))&&(!Gr(r)||iu(o,t,r,n))&&(!gn(r)||qd(o,t,r,n))&&(!xn(r)||wu(o,t,r,n))&&(!Jm(r)||Eu(o,t,r,n))&&(!yn(r)||Pu(o,t,r,n))&&(!jo(r)||ku(o,t,r,n))&&(!hn(r)||ol(o,t,r,n))&&(!Hr(r)||Al(o,t,r,n)))&&(!s.IsString(n)||(!No(r)||Au(o,t,r,n))&&(!Ym(r)||Tu(o,t,r,n))&&(!Do(r)||$u(o,t,r,n))&&(!_o(r)||Fu(o,t,r,n)))&&(!(s.IsNumber(n)||s.IsBigInt(n))||(!Cr(r)||gu(o,t,r,n))&&(!Wm(r)||lu(o,t,r,n))&&(!wr(r)||Ru(o,t,r,n))&&(!Vm(r)||Su(o,t,r,n))&&(!Xm(r)||Mu(o,t,r,n)))&&(!ps(r)||fl(o,t,r,n))&&(!cs(r)||cl(o,t,r,n))&&(!ns(r)||nd(o,t,r,n))&&(!Gm(r)||ou(o,t,r,n))&&(!zm(r)||du(o,t,r,n))&&(!is(r)||jd(o,t,r,n))&&(!as(r)||vu(o,t,r,n))&&(!es(r)||Df(o,t,r,n))&&(!ts(r)||Nf(o,t,r,n))&&(!ms(r)||Zd(o,t,r,n))&&(!Bo(r)||!s.IsArray(n)||Il(o,t,r,n))&&(!Go(r)||!s.IsObject(n)||$l(o,t,r,n))&&(!Xi(r)||kf(o,t,r,n))}function Mt(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;let a=Kn(e,o);return ln(o)?_f(a,t,r,n,o,i):!!(+(!Zm(o)||hl(a,t,r,n,o,i))&+(!(s.IsObject(i)&&!s.IsArray(i))||!!(+(!In(o)||gl(a,t,r,n,o,i))&+(!_t(o)||Lf(a,t,r,n,o,i))&+(!Km(o)||Kf(a,t,r,n,o,i))&+(!Hm(o)||zf(a,t,r,n,o,i))&+(!rs(o)||Vf(a,t,r,n,o,i))&+(!_n(o)||nl(a,t,r,n,o,i))&+(!Un(o)||al(a,t,r,n,o,i))&+(!us(o)||ul(a,t,r,n,o,i))&+(!qo(o)||Yd(a,t,r,n,o,i))&+(!Qm(o)||Hd(a,t,r,n,o,i))))&+(!s.IsArray(i)||!!(+(!Zi(o)||Mf(a,t,r,n,o,i))&+(!Gr(o)||Bf(a,t,r,n,o,i))&+(!gn(o)||_d(a,t,r,n,o,i))&+(!xn(o)||zd(a,t,r,n,o,i))&+(!Jm(o)||Ud(a,t,r,n,o,i))&+(!yn(o)||Vd(a,t,r,n,o,i))&+(!jo(o)||Gd(a,t,r,n,o,i))&+(!hn(o)||il(a,t,r,n,o,i))&+(!Hr(o)||Ol(a,t,r,n,o,i))))&+(!s.IsString(i)||!!(+(!No(o)||Jd(a,t,r,n,o,i))&+(!Ym(o)||Kd(a,t,r,n,o,i))&+(!Do(o)||Dd(a,t,r,n,o,i))&+(!_o(o)||tl(a,t,r,n,o,i))))&+(!(s.IsNumber(i)||s.IsBigInt(i))||!!(+(!Cr(o)||ad(a,t,r,n,o,i))&+(!Wm(o)||sd(a,t,r,n,o,i))&+(!wr(o)||Wd(a,t,r,n,o,i))&+(!Vm(o)||Bd(a,t,r,n,o,i))&+(!Xm(o)||Qd(a,t,r,n,o,i))))&+(!ps(o)||dl(a,t,r,n,o,i))&+(!cs(o)||pl(a,t,r,n,o,i))&+(!ns(o)||od(a,t,r,n,o,i))&+(!Gm(o)||Uf(a,t,r,n,o,i))&+(!zm(o)||id(a,t,r,n,o,i))&+(!is(o)||Nd(a,t,r,n,o,i))&+(!as(o)||Xd(a,t,r,n,o,i))&+(!es(o)||jf(a,t,r,n,o,i))&+(!ts(o)||qf(a,t,r,n,o,i))&+(!ms(o)||el(a,t,r,n,o,i))&+(!Bo(o)||!s.IsArray(i)||bl(a,t,r,n,o,i))&+(!Go(o)||!s.IsObject(i)||El(a,t,r,n,o,i)))&&(!Xi(o)||Tf(a,t,r,n,o,i))}function vl(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 A0=vl;function Fl(){return A0}var l={};At(l,{Assign:()=>M0,Clone:()=>v0,Create:()=>L0,Discard:()=>D0,Metrics:()=>Yt,Update:()=>_0});var Yt={assign:0,create:0,clone:0,discard:0,update:0};function vt(e){return[...s.Keys(e),...s.Symbols(e)]}function Ll(e,t){if(!t.has(e)){t.add(e);for(let r of vt(e)){let n=Object.getOwnPropertyDescriptor(e,r);!n||!("value"in n)||s.IsObject(n.value)&&Ll(n.value,t)}Object.freeze(e)}}function Vr(e){return Ae.Get().immutableTypes&&Ll(e,new WeakSet),e}function M0(e,t){Yt.assign+=1;let r={},n=vt(t),o=vt(e);for(let i of o)n.includes(i)||Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(e,i));for(let i of n)Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i));return Vr(r)}function v0(e){Yt.clone+=1;let t={};for(let r of vt(e)){if(s.IsUnsafePropertyKey(r))continue;let n=Object.getOwnPropertyDescriptor(e,r);s.IsEqual(n.enumerable,!0)?t[r]=n.value:Object.defineProperty(t,r,n)}return t}function Dl(e,t){return{...e,...t}}function F0(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 L0(e,t,r={}){Yt.create+=1;let n=Dl(t,r),o=Ae.Get().enumerableKind?Dl(n,e):F0(n,e);return Vr(o)}function D0(e,t){Yt.discard+=1;let r={};for(let n of vt(e)){if(t.includes(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o)}return Vr(r)}function j0(e,t,r,n){for(let o of vt(e)){if(s.IsUnsafePropertyKey(o)||t.includes(o)||r.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,i)}}function N0(e,t,r){let n=Ae.Get().enumerableKind;for(let o of t)s.IsUnsafePropertyKey(o)||Object.defineProperty(r,o,{configurable:!0,writable:!0,enumerable:n,value:e[o]})}function q0(e,t,r){for(let n of t)s.IsUnsafePropertyKey(n)||Object.defineProperty(r,n,{configurable:!0,enumerable:!0,writable:!0,value:e[n]})}function _0(e,t,r){Yt.update+=1;let n={},o=vt(t),i=vt(r);return j0(e,o,i,n),N0(t,o,n),q0(r,i,n),Vr(n)}function Hs(...e){let[t,r,n]=U.Match(e,{3:(f,d,g)=>[f,d,g],2:(f,d)=>[{},f,d]}),o=Gn(t,r),i=new Ze,a=ae(o,i,"#","",r,n),m=i.GetErrors(),c=Fl(),p=m.map(f=>({...f,message:c(f)}));return[a,p]}var Nl=0;function zs(){let e=Qi();Nl=e.maxErrors,e.maxErrors=e.maxParseErrors}function Ws(){let e=Qi();e.maxErrors=Nl}function _u(...e){let[t,r,n]=U.Match(e,{3:(a,m,c)=>[a,m,c],2:(a,m)=>[{},a,m]}),o=Gn(t,r),i=new ct;return Y(o,i,r,n)}function G(...e){let[t,r,n]=U.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return _u(t,r,n)}function Qt(...e){let[t,r,n]=U.Match(e,{3:(a,m,c)=>[a,m,c],2:(a,m)=>[{},a,m]}),[o,i]=Hs(t,r,n);return i}var Ar=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 Vs(...e){let[t,r,n]=U.Match(e,{3:(i,a,m)=>[i,a,m],2:(i,a)=>[{},i,a]});if(!G(t,r,n))throw new Ar("Assert",n,Qt(t,r,n))}function T(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function le(e){return s.IsObject(e)}function C(e,t,r){return l.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function Jr(e){return T(e,"Deferred")}function ur(e,t){return l.Update(e,{"~readonly":!0},t)}function ql(e,t,r,n){let o=b(e,t,r);return ur(o,n)}function cr(e,t){return l.Update(e,{"~optional":!0},t)}function _l(e,t,r,n){let o=b(e,t,r);return cr(o,n)}function xt(e,t){return l.Create({"~kind":"Array"},{type:"array",items:e},t)}function H(e){return T(e,"Array")}function Jn(e){return l.Discard(e,["~kind","type","items"])}function pr(e,t,r={}){return l.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function be(e){return T(e,"Constructor")}function Ul(e){return l.Discard(e,["~kind","type","parameters","instanceType"])}function fr(e,t,r={}){return l.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function $e(e){return T(e,"Function")}function Bl(e){return l.Discard(e,["~kind","type","parameters","returnType"])}function _e(e,t){return l.Create({"~kind":"Ref"},{$ref:e},t)}function Z(e){return T(e,"Ref")}function Yr(e,t){return l.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Yn(e){return T(e,"Generic")}function Qn(e){return l.Create({"~kind":"Any"},{},e)}function ye(e){return T(e,"Any")}var Gl="(?!)";function re(e){return l.Create({"~kind":"Never"},{not:{}},e)}function yt(e){return T(e,"Never")}function dr(e,t={}){return C("AddOptional",[e],t)}function Js(e,t={}){return cr(e,t)}function Kl(e){return Js(e)}function Oe(e){return le(e)&&s.HasPropertyKey(e,"~optional")}function Hl(e){return s.Keys(e).filter(t=>!Oe(e[t]))}function Ys(e){return s.Keys(e)}function Qs(e){return s.Values(e)}function O(e,t={}){let r=Hl(e),n=r.length>0?{required:r}:{};return l.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function R(e){return T(e,"Object")}function zl(e){return l.Discard(e,["~kind","type","properties","required"])}function De(e){return l.Create({"~kind":"Unknown"},{},e)}function Me(e){return T(e,"Unknown")}function lr(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 T(e,"Cyclic")}function Wl(e){return l.Update(e,{"~unsafe":null},{})}function Xs(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}function Zo(...e){let[t,r]=U.Match(e,{2:(n,o)=>[n,o,o],1:n=>[n,De(),De()]});return l.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function ve(e){return T(e,"Infer")}function $n(e,t,r,n={}){return l.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function Ee(e){return T(e,"Dependent")}function Vl(e){return l.Discard(e,["~kind","if","then","else"])}function Jl(e){return s.IsObjectNotArray(e)}function Yl(e){return s.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function Ql(e){return s.IsString(e)||s.IsNumber(e)}function Xl(e,t){let r=Jl(e)?Yl(e):e;return l.Create({"~kind":"Enum"},{enum:r},t)}function Se(e){return T(e,"Enum")}function ot(e,t={}){return l.Create({"~kind":"Intersect"},{allOf:e},t)}function P(e){return T(e,"Intersect")}function Zl(e){return l.Discard(e,["~kind","allOf"])}var ei=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=pt(r)?a=>this.decode(r["~codec"].decode(a)):this.decode,o=pt(r)?a=>r["~codec"].encode(t(a)):t,i={decode:n,encode:o};return l.Update(this.type,{"~codec":i},{})}},ti=class{constructor(t){this.type=t}Decode(t){return new ei(this.type,t)}};function Zs(e){return new ti(e)}function eg(e,t){return Zs(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function tg(e,t){return Zs(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function pt(e){return le(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function rg(e){return Xn(e)}function En(e){return le(e)&&s.HasPropertyKey(e,"~immutable")}function gr(e,t={}){return C("AddReadonly",[e],t)}function ea(e,t={}){return ur(e,t)}function ng(e){return ea(e)}function Or(e){return le(e)&&s.HasPropertyKey(e,"~readonly")}function G0(e,t){let r=ri(e)?[...e["~refine"],t]:[t];return l.Update(e,{"~refine":r},{})}function og(...e){let[t,r,n]=U.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[o,i,()=>"Refine Error"]});return G0(t,{check:r,error:n})}function K0(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function ri(e){return le(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>K0(t))}var ig="-?(?:0|[1-9][0-9]*)n";function ni(e){return l.Create({"~kind":"BigInt"},{type:"bigint"},e)}function kt(e){return T(e,"BigInt")}function ta(e){return l.Create({"~kind":"Boolean"},{type:"boolean"},e)}function ft(e){return T(e,"Boolean")}function oi(e){return l.Create({"~kind":"Identifier"},{name:e})}function sg(e){return T(e,"Identifier")}var ra="-?(?:0|[1-9][0-9]*)";function Sn(e){return l.Create({"~kind":"Integer"},{type:"integer"},e)}function Be(e){return T(e,"Integer")}var Uu=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function H0(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new Uu(e)})()}function B(e,t){return l.Create({"~kind":"Literal"},{type:H0(e),const:e},t)}function na(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function ag(e){return K(e)&&s.IsBigInt(e.const)}function mg(e){return K(e)&&s.IsBoolean(e.const)}function oa(e){return K(e)&&s.IsNumber(e.const)}function ia(e){return K(e)&&s.IsString(e.const)}function K(e){return T(e,"Literal")}function Zn(e){return l.Create({"~kind":"Null"},{type:"null"},e)}function xr(e){return T(e,"Null")}var sa="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Tt(e){return l.Create({"~kind":"Number"},{type:"number"},e)}function ge(e){return T(e,"Number")}function eo(e){return l.Create({"~kind":"Symbol"},{type:"symbol"},e)}function yr(e){return T(e,"Symbol")}function kn(...e){let[t,r,n]=U.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[o,i,i],1:o=>[o,De(),De()]});return l.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function ug(e){return T(e,"Parameter")}var aa=".*";function et(e){return l.Create({"~kind":"String"},{type:"string"},e)}function je(e){return T(e,"String")}function L(e,t={}){return l.Create({"~kind":"Union"},{anyOf:e},t)}function E(e){return T(e,"Union")}function cg(e){return l.Discard(e,["~kind","anyOf"])}function ii(e){let t=pg(e);return s.IsEqual(t.length,2)?t[0]:[]}function z0(e){return!0}function fg(e){return s.ShiftLeft(e,(t,r)=>W0(t)?fg(r):!1,()=>!0)}function dg(e){return s.IsEqual(e.length,0)?!1:fg(e)}function W0(e){return E(e)?dg(e.anyOf):K(e)?z0(e.const):!1}function ma(e){return dg(e)}function ua(e){return l.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function lg(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>lg(o,t,[...r,`${n}${t}`]),()=>r)}function V0(e,t){return s.IsEqual(e.length,0)?[`${t}`]:lg(e,t)}function gg(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>gg(e,o,[...r,...xg(e,n)]),()=>r)}function xg(e,t){return E(t)?gg(e,t.anyOf):K(t)?V0(e,t.const):Ie()}function yg(e,t){return s.ShiftLeft(t,(r,n)=>yg(xg(e,r),n),()=>e)}function J0(e){return e.map(t=>B(t))}function Y0(e){let t=yg([],e),r=J0(t);return L(r)}function Q0(e){return s.IsEqual(e.length,0)?Ie():s.IsEqual(e.length,1)&&K(e[0])?e[0]:Y0(e)}function Bu(e){let t=ii(e);return s.IsEqual(t.length,0)?et():ma(t)?Q0(t):ua(e)}function to(e){let t=Bu(e);return se(t)?et():t}function ht(e,t){let r="object",n={[e]:t};return l.Create({"~kind":"Record"},{type:r,patternProperties:n})}function hg(e){return ht(Xt,e)}function Ig(e){return O({true:e,false:e})}function ke(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 N(e){return T(e,"Tuple")}function bg(e){return l.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Gu(e){return e.reduceRight((r,n,o)=>({[o]:n,...r}),{})}function $g(e){let t=Gu(e.items);return O(t)}function X0(e){return l.Discard(e,["~optional"])}function Tn(e,t){return l.Update(X0(e),{},t)}function Eg(e,t,r,n){let o=b(e,t,r);return Tn(o,n)}function Z0(e){return l.Discard(e,["~readonly"])}function ro(e,t){return l.Update(Z0(e),{},t)}function Sg(e,t,r,n){let o=b(e,t,r);return ro(o,n)}function ca(e,t){let r=Or(e)&&Or(t),n=Oe(e)&&Oe(t),o=Te([e,t]),i=ro(Tn(o,{}),{});return r&&n?ur(cr(i,{}),{}):r?ur(i,{}):n?cr(i,{}):i}function kg(e,t){let r=Or(e)||Or(t),n=Oe(e)||Oe(t),o=ro(Tn(e,{}),{}),i=ro(Tn(t,{}),{}),a=It([o,i]);return r&&n?ur(cr(a,{}),{}):r?ur(a,{}):n?cr(a,{}):a}function eP(e,t,r){return r in e?r in t?ca(e[r],t[r]):e[r]:r in t?t[r]:re()}function tP(e,t){return[...new Set([...s.Keys(e),...s.Keys(t)])].reduce((o,i)=>({...o,[i]:eP(e,t,i)}),{})}function Tg(e){return R(e)?e.properties:N(e)?Gu(e.items):{}}function Cg(e,t){let r=Tg(e),n=Tg(t),o=tP(r,n);return O(o)}function rP(e,t){let r=no(e,t);return s.IsEqual(r,ai)?e:s.IsEqual(r,mi)||s.IsEqual(r,si)?t:re()}function wg(e){return R(e)||N(e)}function nP(e,t){let r=wg(e),n=wg(t);return r&&n?Cg(e,t):r&&!n?e:!r&&n?t:rP(e,t)}function Rg(e,t){return yt(e)||ye(e)?e:Me(e)||yt(t)||ye(t)?t:Me(t)?e:nP(e,t)}function oP(e,t){return E(e)||E(t)}function iP(e,t){let r=Bt(e),n=Bt(t);return oP(r,n)?Te([r,n]):Rg(r,n)}function Pg(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>Pg(e,o,[...r,iP(n,e)]),()=>s.IsEqual(r.length,0)?[e]:r)}function Ag(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>Ag(o,t,[...r,...ui([n],t)]),()=>r)}function ui(e,t=[]){return s.ShiftLeft(e,(r,n)=>E(r)?ui(n,Ag(r.anyOf,t)):ui(n,Pg(r,t)),()=>t)}function sP(e,t){let r=tt({},e,t);return v.IsExtendsTrueLike(r)?[]:[e]}function Og(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>Og(o,t,[...r,...sP(n,t)]),()=>r)}function pa(e,t){let r=Bt(e),n=E(r)?r.anyOf:[r],o=Og(n,t);return It(o)}function Zt(e,t,r){let n=Te([e,t]),o=pa(r,e);return It([n,o])}function dt(e,t=[]){return s.ShiftLeft(e,(r,n)=>dt(n,[...t,B(r)]),()=>It(t))}function Te(e){let t=ui(e),r=Ku(t);return It(r)}function it(e){let t=to(e);return Bt(t)}function It(e){let t=Ku(e);return Qr(t)}function Bt(e){return Ee(e)?Zt(e.if,e.then,e.else):Se(e)?dt(e.enum):P(e)?Te(e.allOf):se(e)?it(e.pattern):E(e)?It(e.anyOf):e}function Qr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?re():L(e)}function Mg(e,t){let r=dt(e);return Xr(r,t)}function vg(e,t){return ht(Zr,t)}function Fg(e,t){let r=Te(e);return Xr(r,t)}function Lg(e,t){return s.IsString(e)||s.IsNumber(e)?O({[e]:t}):s.IsEqual(e,!1)?O({false:t}):s.IsEqual(e,!0)?O({true:t}):O({})}function Dg(e,t){return ht(oo,t)}function jg(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?ht(e.pattern.toString(),t):ht(Xt,t)}function Ng(e,t){let r=ii(e);return ma(r)?Xr(it(e),t):ht(e,t)}function aP(e){return E(e)?en(e.anyOf):[e]}function en(e,t=[]){return s.ShiftLeft(e,(r,n)=>en(n,[...t,...aP(r)]),()=>t)}function mP(e){return e.some(t=>je(t)||ge(t)||Be(t))}function uP(e,t){return s.IsEqual(mP(e),!0)?ht(Xt,t):void 0}function cP(e,t){return e.reduce((r,n)=>K(n)&&(s.IsString(n.const)||s.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function pP(e,t){let r=cP(e,t);return O(r)}function qg(e,t){let r=en(e),n=uP(r,t);return le(n)?n:pP(r,t)}function Xr(e,t){return ye(e)?hg(t):ft(e)?Ig(t):Se(e)?Mg(e.enum,t):Be(e)?vg(e,t):P(e)?Fg(e.allOf,t):K(e)?Lg(e.const,t):ge(e)?Dg(e,t):E(e)?qg(e.anyOf,t):je(e)?jg(e,t):se(e)?Ng(e.pattern,t):O({})}function Hu(e,t,r){return q([e])?l.Update(Xr(e,t),{},r):fa(e,t,r)}function _g(e,t,r,n,o){let i=b(e,t,r),a=b(e,t,n);return Hu(i,a,o)}var Zr=`^${ra}$`,oo=`^${sa}$`,Xt=`^${aa}$`;function fa(e,t,r={}){return C("Record",[e,t],r)}function io(e,t,r={}){return Hu(e,t,r)}function Ug(e,t){return ht(e,t)}function da(e){return s.IsEqual(e,Xt)?et():s.IsEqual(e,Zr)?Sn():s.IsEqual(e,oo)?Tt():Bu(e)}function Fe(e){return s.Keys(e.patternProperties)[0]}function so(e){let t=Fe(e);return da(t)}function me(e){return e.patternProperties[Fe(e)]}function te(e){return T(e,"Record")}function Cn(e){return l.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function tn(e){return T(e,"Rest")}function la(e){return l.Create({"~kind":"This"},{$ref:"#"},e)}function ga(e){return T(e,"This")}function ao(e){return l.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Gt(e){return T(e,"Undefined")}function xa(e){return l.Create({"~kind":"Void"},{type:"void"},e)}function Ct(e){return T(e,"Void")}function dP(e,t){return s.IsEqual(e,"Array")?xt(t[0]):s.IsEqual(e,"Capitalize")?ha(t[0]):s.IsEqual(e,"ConstructorParameters")?Sa(t[0]):s.IsEqual(e,"Evaluate")?Ky(t[0]):s.IsEqual(e,"Exclude")?ka(t[0],t[1]):s.IsEqual(e,"Extract")?Ta(t[0],t[1]):s.IsEqual(e,"Index")?di(t[0],t[1]):s.IsEqual(e,"InstanceType")?Ca(t[0]):s.IsEqual(e,"Lowercase")?Ia(t[0]):s.IsEqual(e,"NonNullable")?wa(t[0]):s.IsEqual(e,"Omit")?Ra(t[0],t[1]):s.IsEqual(e,"Parameters")?Pa(t[0]):s.IsEqual(e,"Partial")?Aa(t[0]):s.IsEqual(e,"Pick")?Oa(t[0],t[1]):s.IsEqual(e,"Readonly")?Ma(t[0]):s.IsEqual(e,"KeyOf")?li(t[0]):s.IsEqual(e,"Record")?fa(t[0],t[1]):s.IsEqual(e,"Required")?va(t[0]):s.IsEqual(e,"ReturnType")?Fa(t[0]):s.IsEqual(e,"Uncapitalize")?ba(t[0]):s.IsEqual(e,"Uppercase")?$a(t[0]):fi(_e(e),t)}function wn(){throw Error("Unreachable")}function zg(e,t=[]){return s.ShiftLeft(e,(r,n)=>zg(n,[...t,r[1]]),()=>t)}function Mr(e){return s.IsEqual(e.length,3)?[e[0],...zg(e[1])]:[]}function Wg(e){return kn(e[0],e[2],e[4])}function Vg(e){return kn(e[0],e[2],e[2])}function Jg(e){return kn(e[0],De(),e[2])}function Yg(e){return kn(e,De(),De())}function Qg(e){return Mr(e)}function Xg(e){return e[1]}function Zg(e){return Mr(e)}function ex(e){return e[1]}function tx(e){return dP(e[0],e[1])}function rx(e){return null}function nx(e){return et()}function ox(e){return Tt()}function ix(e){return ta()}function sx(e){return ao()}function ax(e){return Zn()}function mx(e){return Sn()}function ux(e){return ni()}function cx(e){return De()}function px(e){return Qn()}function fx(e){return O({})}function dx(e){return re()}function lx(e){return eo()}function gx(e){return xa()}function xx(e){return la()}function yx(e){return B(BigInt(e))}function hx(e){return B(s.IsEqual(e,"true"))}function Ix(e){return B(parseFloat(e))}function bx(e){return B(e)}function $x(e){return e[1]}function Ex(e){return B(e)}function Sx(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function kx(e){return e[1]}function Tx(e){return ya(e)}function Cx(e){return s.IsEqual(e.length,6)?$n(e[1],e[3],e[5]):$n(e[1],e[3],De())}function wx(e){return e.length>0}function Rx(e){return e.reduce((t,r)=>s.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function Px(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Ax(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function Ox(e){return s.IsEqual(e.length,2)?e[1]:[]}function Bg(e,t){return t.reduce((r,n)=>{let o=n;return s.IsEqual(o.length,1)?di(r,o[0]):s.IsEqual(o.length,0)?xt(r):wn()},e)}function Gg(e,t){return s.IsEqual(t.length,3)?Ea(e,t[0],t[1],t[2]):e}function lP(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:La(e,t)}function Mx(e){let[t,r,n,o,i]=e;return lP(Gg(t?li(Bg(r,n)):Bg(r,n),o),i)}function zu(e,t){return s.IsEqual(t.length,3)?(()=>{let[r,n,o]=t,i=zu(n,o);if(s.IsEqual(r,"&"))return P(i)?ot([e,...i.allOf]):ot([e,i]);if(s.IsEqual(r,"|"))return E(i)?L([e,...i.anyOf]):L([e,i]);wn()})():e}function vx(e){let[t,r]=e;return zu(t,r)}function Fx(e){let[t,r]=e;return zu(t,r)}function Lx(e){return By(e[1])}function Dx(e){return e[1]}function jx(e){return Yr(e[0],e[2])}function Nx(e){return s.IsEqual(e.length,4)?Zo(e[1],e[3]):s.IsEqual(e.length,2)?Zo(e[1],De()):wn()}function qx(e){return`${e}`}function _x(e){return Be(e[3])?Zr:ge(e[3])?oo:yr(e[3])?Xt:je(e[3])?Xt:wn()}function Ux(e){return e.length>0}function Bx(e){return e.length>0}function Gx(e){let[t,r,n,o,i]=e;return{[r]:t&&n?gr(dr(i)):t&&!n?gr(i):!t&&n?dr(i):i}}function Kx(e){return Mr(e)}function Hx(e){return e.reduce((t,r)=>s.HasPropertyKey(r,Zr)||s.HasPropertyKey(r,oo)||s.HasPropertyKey(r,Xt)?[t[0],l.Assign(t[1],r)]:[l.Assign(t[0],r),t[1]],[{},{}])}function zx(e){return Hx(e[1])}function Wx(e){let[t,r]=e,n=s.IsEqual(s.Keys(r).length,0)?{}:{patternProperties:r};return O(t,n)}function Vx(e){return s.IsEqual(e.length,5)?gr(dr(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?gr(e[3]):dr(e[3]):wn()}function Jx(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[t,r,n]=e;return t&&n?gr(dr(r)):t&&!n?gr(r):!t&&n?dr(r):r}function Yx(e){return s.IsEqual(e.length,2)?Cn(e[1]):s.IsEqual(e.length,1)?e[0]:wn()}function Qx(e){return Mr(e)}function Xx(e){return ke(e[1])}function Zx(e){return gr(dr(e[4]))}function ey(e){return gr(e[3])}function ty(e){return dr(e[3])}function ry(e){return e[2]}function ny(e){return s.IsEqual(e.length,2)?Cn(e[1]):s.IsEqual(e.length,1)?e[0]:wn()}function oy(e){return Mr(e)}function iy(e){return fr(e[1],e[4])}function sy(e){return pr(e[2],e[5])}function Kg(e,t){return s.IsEqual(e,"remove")?Gy(t):s.IsEqual(e,"add")?gr(t):t}function ay(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 Hg(e,t){return s.IsEqual(e,"remove")?Uy(t):s.IsEqual(e,"add")?dr(t):t}function my(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 uy(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function cy(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?ci(oi(e[3]),e[5],e[6][0],Kg(e[1],Hg(e[8],e[10]))):ci(oi(e[3]),e[5],_e(e[3]),Kg(e[1],Hg(e[8],e[10])))}function py(e){return _e(e)}function fy(e){return BigInt(e)}function dy(e){return parseFloat(e)}function ly(e){return s.IsEqual(e,"true")}function gy(e){return null}function xy(e){return{[e[0]]:e[2]}}function yy(e){return Mr(e)}function gP(e){return e.reduce((t,r)=>l.Assign(t,r),{})}function hy(e){return gP(e[1])}function Iy(e){return Mr(e)}function by(e){return e[1]}function $y(e){return ni()}function Ey(e){return et()}function Sy(e){return Tt()}function ky(e){return Sn()}function Ty(e){return re()}function Cy(e){return B(e)}function wy(e){return L(e[1])}function Ry(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Py(e){return[e[0],...e[1]]}function Ay(e){return e[1]}function Oy(e){return Mr(e)}function My(e){return s.IsEqual(e.length,2)?e[1]:[]}function vy(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]]:Yr(t,pi(r,n,i))}}function Fy(e){let t=e[2],[r,n]=e[3],o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:pi(t,r,o)}}function Ly(e){return{[e[1]]:Yr(e[2],e[4])}}function Dy(e){return{[e[1]]:e[3]}}function jy(e){return null}function Ny(e){return Mr(e)}function qy(e){return e[1]}function _y(e){let[t,r]=[e[0],e[1]];return Hy(l.Assign(t,Hx(r)[0]))}function gi(e){return J(e.length,2)}function z(e,t,r){return gi(e)?t(e[0],e[1]):r()}function hP(e,t){return J(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function he(e,t){for(let r=0;r<e.length;r++){let n=hP(e[r],t);if(gi(n))return n}return[]}function Wu(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var zy=[...Wu(97,122),...Wu(65,90)],Vu="0",Ju=Wu(49,57),mo=[Vu,...Ju],Wy=" ",uo=`
|
|
1
|
+
import{t as uf}from"./chunk-ZJL4OEXX.js";import{b as cf}from"./chunk-XODGJSB3.js";import{a as qm,b as af,d as mf}from"./chunk-DBPJZUIT.js";import{H as Ve,K as sf,L as Dn,a as Gi}from"./chunk-5FIFNXLT.js";import{a as sr}from"./chunk-UTYFLLSM.js";import{a as Lm,b as jn,c as Nn,d as Dm,e as jm,f as Oo,g as Nm,h as Br,j as Mo}from"./chunk-MVVEYKN6.js";import{a as At}from"./chunk-WOT6VMZA.js";import{spawn as x1}from"node:child_process";import{existsSync as y1,readFileSync as h1}from"node:fs";import{join as I1}from"node:path";var U={};At(U,{Match:()=>AC});function AC(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}var Ae={};At(Ae,{Get:()=>Qi,Reset:()=>Cw,Set:()=>ww});var s={};At(s,{CodePointCount:()=>HC,Counted:()=>XC,Entries:()=>tw,EntriesRegExp:()=>ew,Every:()=>VC,EveryAll:()=>JC,GraphemeCount:()=>KC,HasPropertyKey:()=>ZC,IsArray:()=>Fo,IsBigInt:()=>vo,IsBoolean:()=>xf,IsClassInstance:()=>GC,IsConstructor:()=>jC,IsDeepEqual:()=>Bm,IsEqual:()=>J,IsFunction:()=>yf,IsGreaterEqualThan:()=>If,IsGreaterThan:()=>_C,IsInteger:()=>_m,IsLessEqualThan:()=>hf,IsLessThan:()=>UC,IsMaxLength:()=>zC,IsMinLength:()=>WC,IsMultipleOf:()=>BC,IsNull:()=>Wi,IsNumber:()=>Vi,IsObject:()=>Lo,IsObjectNotArray:()=>NC,IsString:()=>Ji,IsSymbol:()=>qC,IsUndefined:()=>Um,IsUnsafePropertyKey:()=>$f,IsValueLike:()=>bf,Keys:()=>zi,ShiftLeft:()=>Yi,Some:()=>YC,SomeAll:()=>QC,Symbols:()=>rw,Values:()=>nw});function qn(e,t,r){return e>=t&&e<=r}function OC(e){return e===8205}function pf(e){return qn(e,127462,127487)}function MC(e){return qn(e,65024,65039)}function vC(e){return qn(e,768,879)||qn(e,6832,6911)||qn(e,7616,7679)||qn(e,65056,65071)}function Ki(e){return e>65535?2:1}function ff(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(vC(r)||MC(r))t+=Ki(r);else break}return t}function FC(e,t){let r=e.codePointAt(t),n=t+Ki(r);for(n=ff(e,n);n<e.length-1&&OC(e.codePointAt(n));){let o=e.codePointAt(n+1);n+=1+Ki(o),n=ff(e,n)}return pf(r)&&n<e.length&&pf(e.codePointAt(n))&&(n+=Ki(e.codePointAt(n))),n}function df(e){let t=0,r=0;for(;r<e.length;)r=FC(e,r),t++;return t}function Hi(e){let t=0,r=0,n=0;for(;r<e.length;){let o=e.charCodeAt(r++)>>10;t+=+((n<<8|o)!==13879),n=o}return t}function lf(e,t){return e.length<=t||e.length<=t<<1&&Hi(e)<=t}function gf(e,t){return e.length>=t<<1||e.length>=t&&Hi(e)>=t}function Fo(e){return Array.isArray(e)}function vo(e){return J(typeof e,"bigint")}function xf(e){return J(typeof e,"boolean")}function jC(e){if(Um(e)||!yf(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function yf(e){return J(typeof e,"function")}function _m(e){return Number.isInteger(e)}function Wi(e){return J(e,null)}function Vi(e){return Number.isFinite(e)}function NC(e){return Lo(e)&&!Fo(e)}function Lo(e){return J(typeof e,"object")&&!Wi(e)}function Ji(e){return J(typeof e,"string")}function qC(e){return J(typeof e,"symbol")}function Um(e){return J(e,void 0)}function J(e,t){return e===t}function _C(e,t){return e>t}function UC(e,t){return e<t}function hf(e,t){return e<=t}function If(e,t){return e>=t}function BC(e,t){if(vo(e)||vo(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!Vi(e)||_m(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 GC(e){if(!Lo(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Wi(t)?!1:J(typeof t.constructor,"function")&&!(J(t.constructor,globalThis.Object)||J(t.constructor.name,"Object"))}function bf(e){return vo(e)||xf(e)||Wi(e)||Vi(e)||Ji(e)||Um(e)}function KC(e){return df(e)}function HC(e){return Hi(e)}function zC(e,t){return lf(e,t)}function WC(e,t){return gf(e,t)}function VC(e,t,r){return e.every((n,o)=>o<t||r(n,o))}function JC(e,t,r){let n=!0;return e.forEach((o,i)=>{i>=t&&!r(o,i)&&(n=!1)}),n}function YC(e,t){return e.some((r,n)=>t(r,n))}function QC(e,t){let r=!1;return e.forEach((n,o)=>{t(n,o)&&(r=!0)}),r}function XC(e,t){return e.reduce((r,n,o)=>t(n,o)?++r:r,0)}function Yi(e,t,r){return J(e.length,0)?r():t(e[0],e.slice(1))}function $f(e){return J(e,"__proto__")||J(e,"constructor")||J(e,"prototype")}function ZC(e,t){return $f(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ew(e){return zi(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function tw(e){return Object.entries(e)}function zi(e){return Object.getOwnPropertyNames(e)}function rw(e){return Object.getOwnPropertySymbols(e)}function nw(e){return Object.values(e)}function ow(e,t){if(!Lo(t))return!1;let r=zi(e);return J(r.length,zi(t).length)&&r.every(n=>Bm(e[n],t[n]))}function iw(e,t){return Fo(t)&&J(e.length,t.length)&&e.every((r,n)=>Bm(e[n],t[n]))}function Bm(e,t){return Fo(e)?iw(e,t):Lo(e)?ow(e,t):J(e,t)}var Le={};At(Le,{IsBigInt64Array:()=>Iw,IsBigUint64Array:()=>bw,IsBoolean:()=>sw,IsDate:()=>Ew,IsFloat32Array:()=>yw,IsFloat64Array:()=>hw,IsInt16Array:()=>dw,IsInt32Array:()=>gw,IsInt8Array:()=>cw,IsMap:()=>kw,IsNumber:()=>aw,IsRegExp:()=>$w,IsSet:()=>Sw,IsString:()=>mw,IsTypeArray:()=>uw,IsUint16Array:()=>lw,IsUint32Array:()=>xw,IsUint8Array:()=>pw,IsUint8ClampedArray:()=>fw});function sw(e){return e instanceof Boolean}function aw(e){return e instanceof Number}function mw(e){return e instanceof String}function uw(e){return globalThis.ArrayBuffer.isView(e)}function cw(e){return e instanceof globalThis.Int8Array}function pw(e){return e instanceof globalThis.Uint8Array}function fw(e){return e instanceof globalThis.Uint8ClampedArray}function dw(e){return e instanceof globalThis.Int16Array}function lw(e){return e instanceof globalThis.Uint16Array}function gw(e){return e instanceof globalThis.Int32Array}function xw(e){return e instanceof globalThis.Uint32Array}function yw(e){return e instanceof globalThis.Float32Array}function hw(e){return e instanceof globalThis.Float64Array}function Iw(e){return e instanceof globalThis.BigInt64Array}function bw(e){return e instanceof globalThis.BigUint64Array}function $w(e){return e instanceof globalThis.RegExp}function Ew(e){return e instanceof globalThis.Date}function Sw(e){return e instanceof globalThis.Set}function kw(e){return e instanceof globalThis.Map}var Ef=s;var Wt={immutableTypes:!1,maxErrors:8,maxParseErrors:1,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Cw(){Wt.immutableTypes=!1,Wt.maxErrors=8,Wt.maxParseErrors=1,Wt.maxInstantiationCount=128,Wt.useAcceleration=!0,Wt.exactOptionalPropertyTypes=!1,Wt.enumerableKind=!1,Wt.correctiveParse=!1,Wt.unionPrioritySort=!0}function ww(e){for(let t of s.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(Wt,t,{value:r})}}function Qi(){return Wt}function Xi(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 gt(e){return s.IsObject(e)&&!s.IsArray(e)}function ln(e){return s.IsBoolean(e)}function F(e){return gt(e)||ln(e)}function Zi(e){return s.HasPropertyKey(e,"additionalItems")&&F(e.additionalItems)}function _t(e){return s.HasPropertyKey(e,"additionalProperties")&&F(e.additionalProperties)}function es(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(t=>F(t))}function Sf(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function ts(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>F(t))}function Gm(e){return s.HasPropertyKey(e,"const")}function Gr(e){return s.HasPropertyKey(e,"contains")&&F(e.contains)}function bt(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 Hm(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 rs(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>F(t))}function Kr(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function ns(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function os(e){return s.HasPropertyKey(e,"else")&&F(e.else)}function zm(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function Wm(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function Cr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Do(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function ut(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function is(e){return s.HasPropertyKey(e,"if")&&F(e.if)}function gn(e){return s.HasPropertyKey(e,"items")&&(F(e.items)||s.IsArray(e.items)&&e.items.every(t=>F(t)))}function ss(e){return gn(e)&&s.IsArray(e.items)}function Vm(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function Jm(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function jo(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Ym(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function Qm(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function wr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function xn(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function yn(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function No(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function qo(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function Xm(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function as(e){return s.HasPropertyKey(e,"not")&&F(e.not)}function ms(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>F(t))}function _o(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function _n(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>F(t))}function hn(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>F(t))}function Un(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>F(t))}function us(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||F(e.propertyNames))}function Rw(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function Uo(e){return Rw(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function cs(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function ps(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function In(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function fs(e){return s.HasPropertyKey(e,"then")&&F(e.then)}function Zm(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function Hr(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Bo(e){return s.HasPropertyKey(e,"unevaluatedItems")&&F(e.unevaluatedItems)}function Go(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&F(e.unevaluatedProperties)}var ct=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}},Ze=class extends ct{constructor(){super(),this.errors=[]}AtCapacity(){return this.errors.length>=Ae.Get().maxErrors}AddError(t,r,n,o){return this.AddErrorObject({keyword:t,schemaPath:r,instancePath:n,params:o})}AddErrors(t){return t.forEach(r=>this.AddErrorObject(r)),!1}GetErrors(){return this.errors}AddErrorObject(t){return this.AtCapacity()||this.errors.push(t),!1}};function kf(e,t,r,n){return s.Every(r["~refine"],0,(o,i)=>o.check(n))}function Tf(e,t,r,n,o,i){return s.EveryAll(o["~refine"],0,(a,m)=>a.check(i)||t.AddError("~refine",r,n,{index:m,message:a.error(i)}))}var Ko="urn:typebox:root";function Rr(e,t){return URL.canParse(e,t)?new URL(e,t):s.IsEqual(t,Ko)?new URL(`${t}:${e}`):new URL(`${t.slice(0,t.lastIndexOf(":"))}:${e}`)}function Gn(e,t){let r=gt(t)&&ut(t)?Rr(t.$id,Ko).href:Ko;return{context:e,schema:t,lexicalSchema:t,lexicalBase:r,resourceBase:r,referenceBase:r,ids:[],useResourceBaseForReference:!0,recursiveAnchor:void 0,dynamicAnchors:[],resourceEntries:new Map,pendingResource:!0,enteredResource:!1}}function eu(e,t,r=!0){if(ln(t))return e;if(Array.isArray(t))return t.reduce((o,i)=>eu(o,i,!1),e);if(!gt(t)||!r&&ut(t))return e;let n=!r&&Kr(t)?[...e,t]:e;return Object.keys(t).reduce((o,i)=>eu(o,t[i],!1),n)}function Ho(e,t){return e.resourceEntries.get(t)}function Cf(e,t){return e.enteredResource||Ho(e,t)!==void 0}function Pw(e){return!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e.$id)}function Aw(e,t){return ut(t)?[...e.ids,t]:e.ids}function Ow(e,t){return e.recursiveAnchor??(Uo(t)?t:void 0)}function Mw(e,t){let r=ut(t)?eu(e.dynamicAnchors,t):e.dynamicAnchors;return Kr(t)?[...r,t]:r}function vw(e,t){return ut(t)?!1:e.pendingResource}function wf(e,t){let r=Ho(e,t);return r?r.base:ut(t)?Rr(t.$id,e.lexicalBase).href:e.lexicalBase}function Rf(e,t){let r=Ho(e,t);return r?r.base:ut(t)&&e.pendingResource?Rr(t.$id,e.resourceBase).href:e.resourceBase}function Pf(e,t){return ut(t)?!Pw(t):e.useResourceBaseForReference}function Fw(e,t){let r=Cf(e,t),n=Pf(e,t);return r||n?Rf(e,t):wf(e,t)}function Lw(e,t){let r=Ho(e,t);return r?r.root:ut(t)?t:e.lexicalSchema}function Dw(e,t){return gt(t)&&(ut(t)||Kr(t)||s.IsUndefined(e.recursiveAnchor)&&Uo(t)||!s.IsUndefined(Ho(e,t)))}function Kn(e,t){return Dw(e,t)?{...e,ids:Aw(e,t),dynamicAnchors:Mw(e,t),recursiveAnchor:Ow(e,t),pendingResource:vw(e,t),lexicalBase:wf(e,t),resourceBase:Rf(e,t),useResourceBaseForReference:Pf(e,t),referenceBase:Fw(e,t),lexicalSchema:Lw(e,t),enteredResource:Cf(e,t)}:e}function Af(e){return gn(e)&&s.IsArray(e.items)}function Of(e,t,r,n){return Af(r)?s.Every(n,0,(i,a)=>s.IsLessThan(a,r.items.length)||Ot(e,t,r.additionalItems,i)&&t.AddIndex(a)):!0}function Mf(e,t,r,n,o,i){return Af(o)?s.Every(i,0,(m,c)=>{let p=`${r}/additionalItems`,f=`${n}/${c}`;return s.IsLessThan(c,o.items.length)||Mt(e,t,p,f,o.additionalItems,m)&&t.AddIndex(c)}):!0}function $t(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function zr(e){return new RegExp(e,"u")}function jw(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function vf(e){let t=[];return _n(e)&&t.push(...s.Keys(e.patternProperties)),Un(e)&&t.push(...s.Keys(e.properties).map(jw)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function Ff(e,t,r,n){let o=zr(vf(r));return s.Every(s.Keys(n),0,(a,m)=>o.test(a)||Ot(e,t,r.additionalProperties,n[a])&&t.AddKey(a))}function Lf(e,t,r,n,o,i){let a=zr(vf(o)),m=[];return s.EveryAll(s.Keys(i),0,(p,f)=>{let d=`${r}/additionalProperties`,g=`${n}/${$t(p)}`,x=a.test(p)||Mt(e,t,d,g,o.additionalProperties,i[p])&&t.AddKey(p);return x||m.push(p),x})||t.AddError("additionalProperties",r,n,{additionalProperties:m})}function Df(e,t,r,n){let o=r.allOf.reduce((i,a)=>{let m=new ct;return Y(e,m,a,n)?[...i,m]:i},[]);return s.IsEqual(o.length,r.allOf.length)&&t.Merge(o)}function jf(e,t,r,n,o,i){let a=[],m=o.allOf.reduce((p,f,d)=>{let g=`${r}/allOf/${d}`,x=new Ze,I=ae(e,x,g,n,f,i);return I||a.push(x),I?[...p,x]:p},[]),c=s.IsEqual(m.length,o.allOf.length)&&t.Merge(m);return c||a.forEach(p=>t.AddErrors(p.GetErrors())),c}function Nf(e,t,r,n){let o=r.anyOf.reduce((i,a)=>{let m=new ct;return Y(e,m,a,n)?[...i,m]:i},[]);return s.IsGreaterThan(o.length,0)&&t.Merge(o)}function qf(e,t,r,n,o,i){let a=[],m=o.anyOf.reduce((p,f,d)=>{let g=new Ze,x=`${r}/anyOf/${d}`,I=ae(e,g,x,n,f,i);return I||a.push(g),I?[...p,g]:p},[]),c=s.IsGreaterThan(m.length,0)&&t.Merge(m);return c||a.forEach(p=>t.AddErrors(p.GetErrors())),c||t.AddError("anyOf",r,n,{})}function nu(e,t,r,n){return r}function _f(e,t,r,n,o,i){return nu(e,t,o,i)||t.AddError("boolean",r,n,{})}function ou(e,t,r,n){return s.IsValueLike(r.const)?s.IsEqual(n,r.const):s.IsDeepEqual(n,r.const)}function Uf(e,t,r,n,o,i){return ou(e,t,o,i)||t.AddError("const",r,n,{allowedValue:o.const})}function Nw(e){return!(xn(e)&&s.IsEqual(e.minContains,0))}function iu(e,t,r,n){return Nw(r)?!s.IsEqual(n.length,0)&&s.SomeAll(n,(o,i)=>Y(e,t,r.contains,o)&&t.AddIndex(i)):!0}function Bf(e,t,r,n,o,i){return iu(e,t,o,i)||t.AddError("contains",r,n,{minContains:1})}function Gf(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)):Y(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/${$t(c)}`;return!s.HasPropertyKey(i,c)||(s.IsArray(p)?p.every(d=>s.HasPropertyKey(i,d)||t.AddError("dependencies",r,n,{property:c,dependencies:p})):ae(e,t,f,n,p,i))});return a||m}function Hf(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 zf(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("dependentRequired",r,n,{property:c,dependencies:p})));return a||m}function Wf(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)||Y(e,t,m,n));return o||i}function Vf(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/${$t(c)}`;return!s.HasPropertyKey(i,c)||ae(e,t,f,n,p,i)});return a||m}var Ut={};At(Ut,{DynamicRef:()=>g0,RecursiveRef:()=>f0,Ref:()=>c0});var mr={};At(mr,{Delete:()=>Bw,Get:()=>_w,Has:()=>qw,Indices:()=>Wo,Set:()=>Uw});function Yf(e){throw Error(e)}function Jf(){Yf("Pointer contains unsafe property key")}function su(){Yf("Cannot set value")}function Wo(e){let t=e.split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));return t[0]===""?t.slice(1):t}function qw(e,t){let r=e;for(let n of Wo(t)){if(!s.IsObject(r)||!s.HasPropertyKey(r,n))return!1;r=r[n]}return!0}function _w(e,t){let r=e;for(let n of Wo(t)){if(!s.IsObject(r)||s.IsUnsafePropertyKey(n))return;r=r[n]}return r}function Qf(e,t,r){let n=e;for(let o of t)s.IsUnsafePropertyKey(o)&&Jf(),n=s.IsObject(n)?n[o]:void 0;return s.IsUnsafePropertyKey(r)&&Jf(),s.IsObject(n)||su(),n}function Uw(e,t,r){let n=Wo(t),o=n.pop();return s.IsUndefined(o)&&su(),Qf(e,n,o)[o]=r,e}function Bw(e,t){let r=Wo(t),n=r.pop();s.IsUndefined(n)&&su();let o=Qf(e,r,n);return s.IsArray(o)&&/^(0|[1-9]\d*)$/.test(n)?o.splice(Number(n),1):delete o[n],e}function uu(e,t){return gt(e)&&ut(e)?Rr(e.$id,t.href):t}function cu(e){return Rr(e,Ko)}function au(e){return e.href.split("#")[0]}function Gw(e,t,r){return mu(e,cu(t),r)}function Kw(e,t){return t.$ref.startsWith("#")||e.enteredResource?e.lexicalSchema:e.schema}function Hw(e){return e.startsWith("#/")}function Xf(e,t){if(s.IsObject(e)&&Kr(e)&&s.IsEqual(e.$dynamicAnchor,t))return e;if(s.IsObject(e))for(let r of s.Keys(e)){let n=Xf(e[r],t);if(n)return n}}function mu(e,t,r){if(s.IsEqual(e,r))return t.href;let n=uu(e,t);if(s.IsArray(e))for(let o of e){let i=mu(o,n,r);if(!s.IsUndefined(i))return i}else if(s.IsObject(e))for(let o of s.Keys(e)){let i=mu(e[o],n,r);if(!s.IsUndefined(i))return i}}function Zf(e,t){if(t.href.endsWith("#"))return e;if(!t.hash.startsWith("#"))return;let r=decodeURIComponent(t.hash.slice(1));if(r.startsWith("/"))return mr.Get(e,r)}function zw(e,t,r){if(!ut(e))return;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("#")?Zf(e,r):e}function Ww(e,t,r){if(!Sf(e))return;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 Vw(e,t,r){if(!Kr(e))return;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 Jw(e,t,r){if(gt(e))return zw(e,t,r)??Ww(e,t,r)??Vw(e,t,r)??Zf(e,r)}function Yw(e,t,r){if(s.IsArray(e))return e.reduce((n,o)=>{let i=ds(o,t,r);return s.IsUndefined(i)?n:i},void 0)}function Qw(e,t,r){if(s.IsObject(e))return s.Keys(e).reduce((n,o)=>{if(s.IsEqual(o,"const")||s.IsEqual(o,"enum"))return n;let i=ds(e[o],t,r);return s.IsUndefined(i)?n:i},void 0)}function ds(e,t,r){let n=uu(e,t);return Jw(e,n,r)??Yw(e,n,r)??Qw(e,n,r)}function Xw(e,t,r,n){let o=ls(e,t,r,n);return gt(o)&&ut(o)?o:void 0}function Zw(e,t,r){if(!t.$ref.startsWith("#")||!gt(e.schema)||s.HasPropertyKey(e.schema,"$schema"))return;let n=Gw(e.lexicalSchema,e.referenceBase,r);if(!(s.IsUndefined(n)||s.IsEqual(n,e.referenceBase)))return{target:r,base:n,root:e.lexicalSchema}}function e0(e,t,r){let n=e.context[t];if(gt(n))return{target:r,base:t,root:n}}function t0(e,t,r,n,o){let i=o?e0(e,n,r):void 0;return s.IsUndefined(i)?Zw(e,t,r):i}function r0(e,t,r){if(ut(r))return;let n=Xw(e.context,e.schema,e.referenceBase,t);if(!(!n||e.ids.includes(n)))return{resource:n}}function n0(e,t){return s.HasPropertyKey(e,t)?e[t]:void 0}function o0(e,t,r){return ds(e,t,r)}function i0(e,t,r){let n=au(r);if(!s.HasPropertyKey(e,n)||s.IsEqual(n,au(t)))return;let o=e[n],i=uu(o,new URL(n));return s.IsEqual(r.hash,"")?o:ds(o,i,r)}function ls(e,t,r,n){let o=cu(r),i=Rr(n,o.href);return n0(e,n)??o0(t,o,i)??i0(e,o,i)}function s0(e,t){if(!t)return e;let r=new Map(e.resourceEntries);return r.set(t.target,{base:t.base,root:t.root}),{...e,resourceEntries:r}}function a0(e,t){return t?Kn(e,t.resource):e}function ed(e,t,r,n){let o=s0({...e,pendingResource:t},r);return a0(o,n)}function m0(e,t,r){let n=au(Rr(t.$ref,e.referenceBase)),o=!s.IsEqual(n,e.resourceBase),i=t0(e,t,r,n,o),a=o?r0(e,n,r):void 0;return{schema:r,stack:ed(e,!0,i,a)}}function u0(e,t){return{schema:t,stack:ed(e,!s.IsUndefined(t))}}function c0(e,t){let r=ls(e.context,Kw(e,t),e.referenceBase,t.$ref);return gt(r)?m0(e,t,r):u0(e,r)}function p0(e){return gt(e.lexicalSchema)&&Uo(e.lexicalSchema)}function f0(e,t){let r=p0(e)?e.recursiveAnchor:e.lexicalSchema;return ls(e.context,r,e.lexicalBase,t.$recursiveRef)}function td(e,t){return Rr(t.$dynamicRef,cu(e.lexicalBase).href).hash}function rd(e,t){return e.dynamicAnchors.find(r=>s.IsEqual(r.$dynamicAnchor,t))??Xf(e.schema,t)}function d0(e,t,r){if(!gt(r)||!Kr(r))return r;let n=td(e,t);return Hw(n)?r:rd(e,r.$dynamicAnchor)}function l0(e,t){let r=td(e,t);return rd(e,decodeURIComponent(r.slice(1)))}function g0(e,t){let r=t.$dynamicRef.startsWith("#")?e.lexicalSchema:e.schema,n=ls(e.context,r,e.lexicalBase,t.$dynamicRef);return s.IsUndefined(n)?l0(e,t):d0(e,t,n)}function nd(e,t,r,n){let o=Ut.DynamicRef(e,r)??!1,i=o?{...e,pendingResource:!0}:e;return F(o)&&Y(i,t,o,n)}function od(e,t,r,n,o,i){let a=Ut.DynamicRef(e,o)??!1,m=a?{...e,pendingResource:!0}:e;return F(a)&&ae(m,t,r,n,a,i)}function du(e,t,r,n){return s.Some(r.enum,o=>s.IsValueLike(o)?s.IsEqual(n,o):s.IsDeepEqual(n,o))}function id(e,t,r,n,o,i){return du(e,t,o,i)||t.AddError("enum",r,n,{allowedValues:o.enum})}function lu(e,t,r,n){return s.IsLessThan(n,r.exclusiveMaximum)}function sd(e,t,r,n,o,i){return lu(e,t,o,i)||t.AddError("exclusiveMaximum",r,n,{comparison:"<",limit:o.exclusiveMaximum})}function gu(e,t,r,n){return s.IsGreaterThan(n,r.exclusiveMinimum)}function ad(e,t,r,n,o,i){return gu(e,t,o,i)||t.AddError("exclusiveMinimum",r,n,{comparison:">",limit:o.exclusiveMinimum})}var Qo={};At(Qo,{Clear:()=>Fd,Entries:()=>oR,Get:()=>aR,Has:()=>sR,IsDate:()=>zn,IsDateTime:()=>gs,IsDuration:()=>xs,IsEmail:()=>ys,IsHostname:()=>Ts,IsIPv4:()=>Rs,IsIPv6:()=>Ps,IsIdnEmail:()=>Cs,IsIdnHostname:()=>ws,IsIri:()=>Os,IsIriReference:()=>As,IsJsonPointer:()=>vs,IsJsonPointerUriFragment:()=>Ms,IsRegex:()=>Fs,IsRelativeJsonPointer:()=>Ls,IsTime:()=>Wn,IsUri:()=>Ns,IsUriReference:()=>Ds,IsUriTemplate:()=>js,IsUrl:()=>qs,IsUuid:()=>_s,Reset:()=>Ld,Set:()=>iR,Test:()=>mR});var x0=[0,31,28,31,30,31,30,31,31,30,31,30,31],y0=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function h0(e){return e%4===0&&(e%100!==0||e%400===0)}function zn(e){let t=y0.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&&h0(r)?29:x0[n])}var I0=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;function Wn(e,t=!0){let r=I0.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}var b0=/^(?:\[!?(?:(?!\.{1,2}[/\]])[A-Za-z._][A-Za-z._0-9+-]{0,13}(?:\/(?!\.{1,2}[/\]])[A-Za-z._][A-Za-z._0-9+-]{0,13})*|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])\](?:\[!?[a-z_][a-z_0-9-]*=[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*\])*|(?:\[!?[a-z_][a-z_0-9-]*=[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*\])*)$/;function gs(e){let t=e.indexOf("["),r=t===-1?e:e.slice(0,t);if(t!==-1&&!b0.test(e.slice(t)))return!1;let n=r.split(/T/i);return n.length===2&&zn(n[0])&&Wn(n[1])}var $0=/^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 xs(e){return $0.test(e)}var E0=/^(?:[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 ys(e){return E0.test(e)}var md=/^(?!-).*(?<!-)$/,ud=/^(?!..--)/,cd=/^[a-zA-Z0-9-]*$/,GB=new RegExp("^\\p{ASCII}*$","u"),Vn=/[^\p{ASCII}]/u;var S0=/[0-9]/,pd=/[\u{0660}-\u{0669}]/u,k0=/[\u{06f0}-\u{06f9}]/u,T0=/[\u{002e}\u{002c}\u{003a}\u{002f}]/u,C0=/[\u{002d}\u{002b}]/u,xu=new RegExp("\\p{Mn}","u"),w0=new RegExp("\\p{Mc}","u"),KB=new RegExp("\\p{Me}","u"),fd=/[\p{Mn}\p{Mc}\p{Me}]/u,yu=new RegExp("\\p{L}","u"),R0=new RegExp("\\p{Nd}","u"),dd=new RegExp("\\p{Script=Greek}","u"),hs=new RegExp("\\p{Script=Hebrew}","u"),ld=/[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u,gd=/[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u,hu=/[\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,xd=/[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u,P0=/[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u,A0=/[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u,yd=new RegExp([S0,k0].map(e=>e.source).join("|"),"u"),hd=new RegExp([yu,C0,T0,R0,xu,w0,P0,A0].map(e=>e.source).join("|"),"u");function Id(e){return md.test(e)&&ud.test(e)&&cd.test(e)}var Jt=36,Jo=1,Yo=26,M0=38,v0=700,$d=72,Ed=128;function Iu(){throw null}function Is(e){return e.toLowerCase().startsWith("xn--")}function Sd(e,t,r){e=r?Math.floor(e/v0):e>>1,e+=Math.floor(e/t);let n=0;for(;e>(Jt-Jo)*Yo>>1;)e=Math.floor(e/(Jt-Jo)),n+=Jt;return n+Math.floor((Jt-Jo+1)*e/(e+M0))}function bs(e){let t=[],r=Ed,n=0,o=$d,i=e.lastIndexOf("-");if(i>0)for(let m=0;m<i;m++){let c=e.charCodeAt(m);c>=128&&Iu(),t.push(c)}let a=i<0?0:i+1;for(;a<e.length;){let m=n,c=1,p=Jt;for(;;){a>=e.length&&Iu();let d=e.charCodeAt(a++),g;d>=97&&d<=122?g=d-97:d>=48&&d<=57?g=d-48+26:Iu(),n+=g*c;let x=p<=o?Jo:p>=o+Yo?Yo:p-o;if(g<x)break;c*=Jt-x,p+=Jt}let f=t.length+1;o=Sd(n-m,f,m===0),r+=Math.floor(n/f),n%=f,t.splice(n,0,r),n++}return String.fromCodePoint(...t)}function bd(e){return e<26?String.fromCharCode(e+97):String.fromCharCode(e-26+48)}var F0=new RegExp(Vn.source,"gu");function kd(e){let t=e.replace(F0,""),r=t.length,n=r>0?[t,"-"]:[],o=Array.from(e,p=>p.codePointAt(0)),i=Ed,a=0,m=$d,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=Jt;;g+=Jt){let x=g<=m?Jo:g>=m+Yo?Yo:g-m;if(d<x)break;let I=x+(d-x)%(Jt-x);n.push(bd(I)),d=Math.floor((d-x)/(Jt-x))}n.push(bd(d)),m=Sd(a,c+1,c===r),a=0,c++}a++,i++}return n.join("")}var L0=/^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/,Td=/^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/,D0=/^(?:R|AL|AN)$/;function Cd(e){if(Is(e))try{return $s(bs(e.slice(4).toLowerCase()))}catch{return!1}return $s(e)}function wd(e){let t=String.fromCodePoint(e);return yd.test(t)?"EN":pd.test(t)?"AN":xu.test(t)?"NSM":hs.test(t)?"R":gd.test(t)?"AL":yu.test(t)?"L":"ON"}function $s(e){for(let t of e)if(D0.test(wd(t.codePointAt(0))))return!0;return!1}function Es(e){let t=!1,r=Td,n=!1,o=!1,i=!0;for(let a of e){let m=wd(a.codePointAt(0));if(i){if(m!=="L"&&m!=="R"&&m!=="AL")return!1;t=m==="R"||m==="AL",r=t?L0:Td,i=!1}if(!r.test(m))return!1;m==="EN"?n=!0:m==="AN"&&(o=!0)}return!(t&&n&&o)}function j0(e){return Vn.test(e)&&kd(e).length+4>63}function N0(e){return e[0]==="-"||e[e.length-1]==="-"?!0:e.slice(2).join("").startsWith("--")}function Ss(e){if(j0(e)||$s(e)&&!Es(e))return!1;let t=[...e],r=t.map(i=>i.codePointAt(0)),n=r.length;if(N0(t)||fd.test(t[0]))return!1;let o=!1;for(let i=0;i<n;i++){let a=r[i],m=t[i];if(xd.test(m)||!hd.test(m))return!1;ld.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||!dd.test(t[i+1]))return!1;break;case 1523:case 1524:if(!c||!hs.test(t[i-1]))return!1;break;case 8204:if(!c||c<128&&!hu.test(t[i-1]))return!1;break;case 8205:if(!c||!hu.test(t[i-1]))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o)}function ks(e){if(!Is(e))return!1;try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let r=bs(t);return Vn.test(r)?Ss(r):!1}catch{return!1}}function q0(e){return e.length>0&&e.length<=63}function _0(e){return q0(e)&&(ks(e)||Id(e))}function Od(e){return e.length===0||e.length>253||e.charCodeAt(e.length-1)===46?!1:e.split(".").every(t=>_0(t))}function U0(e){return e.length>0&&e.length<=63}function B0(e){return U0(e)&&(ks(e)||Ss(e))}function G0(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 Md(e){if(e.length===0||e.includes(" "))return!1;let t=G0(e);if(t.length>253)return!1;let r=t.split("."),n=r.some(o=>Cd(o));return r.every(o=>B0(o)&&(!n||Es(o)))}function Ts(e){return Od(e)}var K0=/^(?:[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 Cs(e){return K0.test(e.normalize("NFC"))}function ws(e){return Md(e)}var H0=/^(?:(?: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 Rs(e){return H0.test(e)}var z0=/^(?:(?:(?:[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 Ps(e){return z0.test(e)}var W0=/[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/,V0=/^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;function As(e){return!W0.test(e)&&!V0.test(e)&&URL.canParse(e,"http://example.com")}var J0=/[\x00-\x20<>\^`{|}\\]/,Y0=/%(?![0-9a-fA-F]{2})/;function Os(e){return J0.test(e)||Y0.test(e)?!1:URL.canParse(e)}var Q0=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Ms(e){return Q0.test(e)}var X0=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function vs(e){return X0.test(e)}function Fs(e){try{return new RegExp(e,"u"),!0}catch{return!1}}var Z0=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Ls(e){return Z0.test(e)}var eR=/^(?:[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 Ds(e){return eR.test(e)}var tR=/^(?:(?:[^\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 js(e){return tR.test(e)}var rR=/^[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 Ns(e){return rR.test(e)}function qs(e){return URL.canParse(e)}var nR=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function _s(e){return nR.test(e)}var fe=new Map;function Fd(){fe.clear()}function oR(){return[...fe.entries()]}function iR(e,t){fe.set(e,t)}function sR(e){return fe.has(e)}function aR(e){return fe.get(e)}function mR(e,t){return fe.get(e)?.(t)??!0}function Ld(){Fd(),fe.set("date-time",gs),fe.set("date",zn),fe.set("duration",xs),fe.set("email",ys),fe.set("hostname",Ts),fe.set("idn-email",Cs),fe.set("idn-hostname",ws),fe.set("ipv4",Rs),fe.set("ipv6",Ps),fe.set("iri-reference",As),fe.set("iri",Os),fe.set("json-pointer-uri-fragment",Ms),fe.set("json-pointer",vs),fe.set("regex",Fs),fe.set("relative-json-pointer",Ls),fe.set("time",Wn),fe.set("uri-reference",Ds),fe.set("uri-template",js),fe.set("uri",Ns),fe.set("url",qs),fe.set("uuid",_s)}Ld();function $u(e,t,r,n){return Qo.Test(r.format,n)}function Dd(e,t,r,n,o,i){return $u(e,t,o,i)||t.AddError("format",r,n,{format:o.format})}function jd(e,t,r,n){let o=fs(r)?r.then:!0,i=os(r)?r.else:!0;return Y(e,t,r.if,n)?Y(e,t,o,n):Y(e,t,i,n)}function Nd(e,t,r,n,o,i){let a=fs(o)?o.then:!0,m=os(o)?o.else:!0,c=new Ze,p=ae(e,c,`${r}/if`,n,o.if,i)?ae(e,c,`${r}/then`,n,a,i)||t.AddError("if",r,n,{failingKeyword:"then"}):ae(e,t,`${r}/else`,n,m,i)||t.AddError("if",r,n,{failingKeyword:"else"});return p&&t.Merge([c]),p}function uR(e,t,r,n){return s.Every(r.items,0,(o,i)=>s.IsLessEqualThan(n.length,i)||Ot(e,t,o,n[i])&&t.AddIndex(i))}function cR(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)||Mt(e,t,c,p,a,i[m])&&t.AddIndex(m)})}function pR(e,t,r,n){let o=hn(r)?r.prefixItems.length:0;return s.Every(n,o,(i,a)=>Ot(e,t,r.items,i)&&t.AddIndex(a))}function fR(e,t,r,n,o,i){let a=hn(o)?o.prefixItems.length:0;return s.EveryAll(i,a,(m,c)=>{let p=`${r}/items`,f=`${n}/${c}`;return Mt(e,t,p,f,o.items,m)&&t.AddIndex(c)})}function qd(e,t,r,n){return ss(r)?uR(e,t,r,n):pR(e,t,r,n)}function _d(e,t,r,n,o,i){return ss(o)?cR(e,t,r,n,o,i):fR(e,t,r,n,o,i)}function dR(e){return Gr(e)}function Eu(e,t,r,n){if(!dR(r))return!0;let o=s.Counted(n,i=>Y(e,t,r.contains,i));return s.IsLessEqualThan(o,r.maxContains)}function Ud(e,t,r,n,o,i){let a=xn(o)?o.minContains:1;return Eu(e,t,o,i)||t.AddError("contains",r,n,{minContains:a,maxContains:o.maxContains})}function Su(e,t,r,n){return s.IsLessEqualThan(n,r.maximum)}function Bd(e,t,r,n,o,i){return Su(e,t,o,i)||t.AddError("maximum",r,n,{comparison:"<=",limit:o.maximum})}function ku(e,t,r,n){return s.IsLessEqualThan(n.length,r.maxItems)}function Gd(e,t,r,n,o,i){return ku(e,t,o,i)||t.AddError("maxItems",r,n,{limit:o.maxItems})}function Tu(e,t,r,n){return s.IsMaxLength(n,r.maxLength)}function Kd(e,t,r,n,o,i){return Tu(e,t,o,i)||t.AddError("maxLength",r,n,{limit:o.maxLength})}function Cu(e,t,r,n){return s.IsLessEqualThan(s.Keys(n).length,r.maxProperties)}function Hd(e,t,r,n,o,i){return Cu(e,t,o,i)||t.AddError("maxProperties",r,n,{limit:o.maxProperties})}function lR(e){return Gr(e)}function wu(e,t,r,n){if(!lR(r))return!0;let o=s.Counted(n,(i,a)=>Y(e,t,r.contains,i)&&t.AddIndex(a));return s.IsGreaterEqualThan(o,r.minContains)}function zd(e,t,r,n,o,i){return wu(e,t,o,i)||t.AddError("contains",r,n,{minContains:o.minContains})}function Ru(e,t,r,n){return s.IsGreaterEqualThan(n,r.minimum)}function Wd(e,t,r,n,o,i){return Ru(e,t,o,i)||t.AddError("minimum",r,n,{comparison:">=",limit:o.minimum})}function Pu(e,t,r,n){return s.IsGreaterEqualThan(n.length,r.minItems)}function Vd(e,t,r,n,o,i){return Pu(e,t,o,i)||t.AddError("minItems",r,n,{limit:o.minItems})}function Au(e,t,r,n){return s.IsMinLength(n,r.minLength)}function Jd(e,t,r,n,o,i){return Au(e,t,o,i)||t.AddError("minLength",r,n,{limit:o.minLength})}function Ou(e,t,r,n){return s.IsGreaterEqualThan(s.Keys(n).length,r.minProperties)}function Yd(e,t,r,n,o,i){return Ou(e,t,o,i)||t.AddError("minProperties",r,n,{limit:o.minProperties})}function Mu(e,t,r,n){return s.IsMultipleOf(n,r.multipleOf)}function Qd(e,t,r,n,o,i){return Mu(e,t,o,i)||t.AddError("multipleOf",r,n,{multipleOf:o.multipleOf})}function vu(e,t,r,n){let o=new ct;return!Y(e,o,r.not,n)&&t.Merge([o])}function Xd(e,t,r,n,o,i){return vu(e,t,o,i)||t.AddError("not",r,n,{})}function Zd(e,t,r,n){let o=r.oneOf.reduce((i,a)=>{let m=new ct;return Y(e,m,a,n)?[...i,m]:i},[]);return s.IsEqual(o.length,1)&&t.Merge(o)}function el(e,t,r,n,o,i){let a=[],m=[],c=o.oneOf.reduce((f,d,g)=>{let x=new Ze,I=`${r}/oneOf/${g}`,h=ae(e,x,I,n,d,i);return h&&m.push(g),h||a.push(x),h?[...f,x]:f},[]),p=s.IsEqual(c.length,1)&&t.Merge(c);return!p&&s.IsEqual(m.length,0)&&a.forEach(f=>t.AddErrors(f.GetErrors())),p||t.AddError("oneOf",r,n,{passingSchemas:m})}function Fu(e,t,r,n){return(s.IsString(r.pattern)?zr(r.pattern):r.pattern).test(n)}function tl(e,t,r,n,o,i){return Fu(e,t,o,i)||t.AddError("pattern",r,n,{pattern:o.pattern})}function rl(e,t,r,n){return s.Every(s.Entries(r.patternProperties),0,([o,i])=>{let a=zr(o);return s.Every(s.Entries(n),0,([m,c])=>!a.test(m)||Ot(e,t,i,c)&&t.AddKey(m))})}function nl(e,t,r,n,o,i){return s.EveryAll(s.Entries(o.patternProperties),0,([a,m])=>{let c=`${r}/patternProperties/${$t(a)}`,p=zr(a);return s.EveryAll(s.Entries(i),0,([f,d])=>{let g=`${n}/${$t(f)}`;return!p.test(f)||Mt(e,t,c,g,m,d)&&t.AddKey(f)})})}function ol(e,t,r,n){return s.IsEqual(n.length,0)||s.Every(r.prefixItems,0,(o,i)=>s.IsLessEqualThan(n.length,i)||Ot(e,t,o,n[i])&&t.AddIndex(i))}function il(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)||Mt(e,t,c,p,a,i[m])&&t.AddIndex(m)})}function Lu(e,t){return e.includes(t)||Ae.Get().exactOptionalPropertyTypes}function Du(e,t){return s.IsUndefined(e[t])}function sl(e,t,r,n){let o=In(r)?r.required:[];return s.Every(s.Entries(r.properties),0,([a,m])=>{let c=!s.HasPropertyKey(n,a)||Ot(e,t,m,n[a])&&t.AddKey(a);return Lu(o,a)?c:Du(n,a)||c})}function al(e,t,r,n,o,i){let a=In(o)?o.required:[];return s.EveryAll(s.Entries(o.properties),0,([c,p])=>{let f=`${r}/properties/${$t(c)}`,d=`${n}/${$t(c)}`,g=()=>!s.HasPropertyKey(i,c)||Mt(e,t,f,d,p,i[c])&&t.AddKey(c);return Lu(a,c)?g():Du(i,c)||g()})}function ml(e,t,r,n){return s.Every(s.Keys(n),0,(o,i)=>Y(e,t,r.propertyNames,o))}function ul(e,t,r,n,o,i){let a=[];return s.EveryAll(s.Keys(i),0,(c,p)=>{let f=`${n}/${$t(c)}`,d=`${r}/propertyNames`,g=ae(e,t,d,f,o.propertyNames,c);return g||a.push(c),g})||t.AddError("propertyNames",r,n,{propertyNames:a})}function cl(e,t,r,n){let o=Ut.RecursiveRef(e,r)??!1,i=o?{...e,pendingResource:!0}:e;return F(o)&&Y(i,t,o,n)}function pl(e,t,r,n,o,i){let a=Ut.RecursiveRef(e,o)??!1,m=a?{...e,pendingResource:!0}:e;return F(a)&&ae(m,t,r,n,a,i)}function fl(e,t,r,n){let o=Ut.Ref(e,r),i=o.schema??!1,a=new ct,m=F(i)&&Y(o.stack,a,i,n);return m&&t.Merge([a]),m}function dl(e,t,r,n,o,i){let a=Ut.Ref(e,o),m=a.schema??!1,c=new Ze,p=F(m)&&ae(a.stack,c,r,n,m,i);return p&&t.Merge([c]),p||t.AddErrors(c.GetErrors()),p}function ll(e,t,r,n){return s.Every(r.required,0,o=>s.HasPropertyKey(n,o))}function gl(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("required",r,n,{requiredProperties:a})}function ju(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 xl(e,t,r,n,o){return s.Some(r,i=>ju(e,t,i,n,o))}function yl(e,t,r,n){return s.IsArray(r.type)?xl(e,t,r.type,r,n):ju(e,t,r.type,r,n)}function hl(e,t,r,n,o,i){return(s.IsArray(o.type)?xl(e,t,o.type,o,i):ju(e,t,o.type,o,i))||t.AddError("type",r,n,{type:o.type})}function Il(e,t,r,n){let o=t.GetIndices();return s.Every(n,0,(i,a)=>(o.has(a)||Y(e,t,r.unevaluatedItems,i))&&t.AddIndex(a))}function bl(e,t,r,n,o,i){let a=t.GetIndices(),m=[];return s.EveryAll(i,0,(p,f)=>{let d=new Ze,g=(a.has(f)||ae(e,d,r,n,o.unevaluatedItems,p))&&t.AddIndex(f);return g||m.push(f),g})||t.AddError("unevaluatedItems",r,n,{unevaluatedItems:m})}function $l(e,t,r,n){let o=t.GetKeys();return s.Every(s.Entries(n),0,([i,a])=>o.has(i)||Y(e,t,r.unevaluatedProperties,a)&&t.AddKey(i))}function El(e,t,r,n,o,i){let a=t.GetKeys(),m=[];return s.EveryAll(s.Entries(i),0,([p,f])=>{let d=new Ze,g=a.has(p)||ae(e,d,r,n,o.unevaluatedProperties,f)&&t.AddKey(p);return g||m.push(p),g})||t.AddError("unevaluatedProperties",r,n,{unevaluatedProperties:m})}var Pr={};At(Pr,{Hash:()=>Rl,HashCode:()=>PR});function Ie(){throw new Error("Unreachable")}function gR(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 xR(e){return typeof e=="number"}var St={Array:0,BigInt:1,Boolean:2,Date:3,Constructor:4,Function:5,Null:6,Number:7,Object:8,RegExp:9,String:10,Symbol:11,TypeArray:12,Undefined:13},Bs=8997,Xo=33826,Gs=40164,Ks=52210,Tl=new Float64Array(1),Cl=new DataView(Tl.buffer),wl=new Uint8Array(Tl.buffer);function Ue(e){let t=Bs^e,r=t*435,n=Xo*435+(r>>>16),o=Gs*435+(n>>>16)+(t<<8),i=Ks*435+(o>>>16)+(Xo<<8);Bs=r&65535,Xo=n&65535,Gs=o&65535,Ks=i&65535}function yR(e){Ue(St.Array);for(let t of e)Wr(t)}function hR(e){Ue(St.BigInt),Cl.setBigInt64(0,e);for(let t of wl)Ue(t)}function Sl(e){Ue(St.Boolean),Ue(e?1:0)}function IR(e){Ue(St.Constructor),Wr(e.toString())}function bR(e){Ue(St.Date),Wr(e.getTime())}function $R(e){Ue(St.Function),Wr(e.toString())}function ER(e){Ue(St.Null)}function kl(e){Ue(St.Number),Cl.setFloat64(0,e,!0);for(let t of wl)Ue(t)}function SR(e){Ue(St.Object);for(let t of gR(e).sort())Wr(t),Wr(e[t])}function kR(e){Ue(St.RegExp),Nu(e.toString())}var TR=new TextEncoder;function Nu(e){Ue(St.String);for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127){for(let n of TR.encode(e.slice(t)))Ue(n);return}Ue(r)}}function CR(e){Ue(St.Symbol),Wr(e.toString())}function wR(e){Ue(St.TypeArray);let t=new Uint8Array(e.buffer);for(let r=0;r<t.length;r++)Ue(t[r])}function RR(e){return Ue(St.Undefined)}function Wr(e){return Le.IsTypeArray(e)?wR(e):Le.IsDate(e)?bR(e):Le.IsRegExp(e)?kR(e):Le.IsBoolean(e)?Sl(e.valueOf()):Le.IsString(e)?Nu(e.valueOf()):Le.IsNumber(e)?kl(e.valueOf()):xR(e)?kl(e):s.IsArray(e)?yR(e):s.IsBoolean(e)?Sl(e):s.IsBigInt(e)?hR(e):s.IsConstructor(e)?IR(e):s.IsNull(e)?ER(e):s.IsObject(e)?SR(e):s.IsString(e)?Nu(e):s.IsSymbol(e)?CR(e):s.IsUndefined(e)?RR(e):s.IsFunction(e)?$R(e):Ie()}function Us(e){return e.toString(16).padStart(4,"0")}function PR(e){return BigInt(`0x${Rl(e)}`)}function Rl(e){return Bs=8997,Xo=33826,Gs=40164,Ks=52210,Wr(e),`${Us(Ks)}${Us(Gs)}${Us(Xo)}${Us(Bs)}`}function Pl(e){return!s.IsEqual(e.uniqueItems,!1)}function Al(e,t,r,n){if(!Pl(r))return!0;let o=new Set(n.map(Pr.Hash)).size,i=n.length;return s.IsEqual(o,i)}function Ol(e,t,r,n,o,i){if(!Pl(o))return!0;let a=new Set,m=i.reduce((p,f,d)=>{let g=Pr.Hash(f);return a.has(g)?[...p,d]:(a.add(g),p)},[]);return s.IsEqual(m.length,0)||t.AddError("uniqueItems",r,n,{duplicateItems:m})}function Ot(e,t,r,n){return t.Push()&&Y(e,t,r,n)&&t.Pop()}function Y(e,t,r,n){let o=Kn(e,r);return ln(r)?nu(o,t,r,n):(!Zm(r)||yl(o,t,r,n))&&(!(s.IsObject(n)&&!s.IsArray(n))||(!In(r)||ll(o,t,r,n))&&(!_t(r)||Ff(o,t,r,n))&&(!Km(r)||Gf(o,t,r,n))&&(!Hm(r)||Hf(o,t,r,n))&&(!rs(r)||Wf(o,t,r,n))&&(!_n(r)||rl(o,t,r,n))&&(!Un(r)||sl(o,t,r,n))&&(!us(r)||ml(o,t,r,n))&&(!qo(r)||Ou(o,t,r,n))&&(!Qm(r)||Cu(o,t,r,n)))&&(!s.IsArray(n)||(!Zi(r)||Of(o,t,r,n))&&(!Gr(r)||iu(o,t,r,n))&&(!gn(r)||qd(o,t,r,n))&&(!xn(r)||wu(o,t,r,n))&&(!Jm(r)||Eu(o,t,r,n))&&(!yn(r)||Pu(o,t,r,n))&&(!jo(r)||ku(o,t,r,n))&&(!hn(r)||ol(o,t,r,n))&&(!Hr(r)||Al(o,t,r,n)))&&(!s.IsString(n)||(!No(r)||Au(o,t,r,n))&&(!Ym(r)||Tu(o,t,r,n))&&(!Do(r)||$u(o,t,r,n))&&(!_o(r)||Fu(o,t,r,n)))&&(!(s.IsNumber(n)||s.IsBigInt(n))||(!Cr(r)||gu(o,t,r,n))&&(!Wm(r)||lu(o,t,r,n))&&(!wr(r)||Ru(o,t,r,n))&&(!Vm(r)||Su(o,t,r,n))&&(!Xm(r)||Mu(o,t,r,n)))&&(!ps(r)||fl(o,t,r,n))&&(!cs(r)||cl(o,t,r,n))&&(!ns(r)||nd(o,t,r,n))&&(!Gm(r)||ou(o,t,r,n))&&(!zm(r)||du(o,t,r,n))&&(!is(r)||jd(o,t,r,n))&&(!as(r)||vu(o,t,r,n))&&(!es(r)||Df(o,t,r,n))&&(!ts(r)||Nf(o,t,r,n))&&(!ms(r)||Zd(o,t,r,n))&&(!Bo(r)||!s.IsArray(n)||Il(o,t,r,n))&&(!Go(r)||!s.IsObject(n)||$l(o,t,r,n))&&(!Xi(r)||kf(o,t,r,n))}function Mt(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;let a=Kn(e,o);return ln(o)?_f(a,t,r,n,o,i):!!(+(!Zm(o)||hl(a,t,r,n,o,i))&+(!(s.IsObject(i)&&!s.IsArray(i))||!!(+(!In(o)||gl(a,t,r,n,o,i))&+(!_t(o)||Lf(a,t,r,n,o,i))&+(!Km(o)||Kf(a,t,r,n,o,i))&+(!Hm(o)||zf(a,t,r,n,o,i))&+(!rs(o)||Vf(a,t,r,n,o,i))&+(!_n(o)||nl(a,t,r,n,o,i))&+(!Un(o)||al(a,t,r,n,o,i))&+(!us(o)||ul(a,t,r,n,o,i))&+(!qo(o)||Yd(a,t,r,n,o,i))&+(!Qm(o)||Hd(a,t,r,n,o,i))))&+(!s.IsArray(i)||!!(+(!Zi(o)||Mf(a,t,r,n,o,i))&+(!Gr(o)||Bf(a,t,r,n,o,i))&+(!gn(o)||_d(a,t,r,n,o,i))&+(!xn(o)||zd(a,t,r,n,o,i))&+(!Jm(o)||Ud(a,t,r,n,o,i))&+(!yn(o)||Vd(a,t,r,n,o,i))&+(!jo(o)||Gd(a,t,r,n,o,i))&+(!hn(o)||il(a,t,r,n,o,i))&+(!Hr(o)||Ol(a,t,r,n,o,i))))&+(!s.IsString(i)||!!(+(!No(o)||Jd(a,t,r,n,o,i))&+(!Ym(o)||Kd(a,t,r,n,o,i))&+(!Do(o)||Dd(a,t,r,n,o,i))&+(!_o(o)||tl(a,t,r,n,o,i))))&+(!(s.IsNumber(i)||s.IsBigInt(i))||!!(+(!Cr(o)||ad(a,t,r,n,o,i))&+(!Wm(o)||sd(a,t,r,n,o,i))&+(!wr(o)||Wd(a,t,r,n,o,i))&+(!Vm(o)||Bd(a,t,r,n,o,i))&+(!Xm(o)||Qd(a,t,r,n,o,i))))&+(!ps(o)||dl(a,t,r,n,o,i))&+(!cs(o)||pl(a,t,r,n,o,i))&+(!ns(o)||od(a,t,r,n,o,i))&+(!Gm(o)||Uf(a,t,r,n,o,i))&+(!zm(o)||id(a,t,r,n,o,i))&+(!is(o)||Nd(a,t,r,n,o,i))&+(!as(o)||Xd(a,t,r,n,o,i))&+(!es(o)||jf(a,t,r,n,o,i))&+(!ts(o)||qf(a,t,r,n,o,i))&+(!ms(o)||el(a,t,r,n,o,i))&+(!Bo(o)||!s.IsArray(i)||bl(a,t,r,n,o,i))&+(!Go(o)||!s.IsObject(i)||El(a,t,r,n,o,i)))&&(!Xi(o)||Tf(a,t,r,n,o,i))}function vl(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 AR=vl;function Fl(){return AR}var l={};At(l,{Assign:()=>MR,Clone:()=>vR,Create:()=>LR,Discard:()=>DR,Metrics:()=>Yt,Update:()=>_R});var Yt={assign:0,create:0,clone:0,discard:0,update:0};function vt(e){return[...s.Keys(e),...s.Symbols(e)]}function Ll(e,t){if(!t.has(e)){t.add(e);for(let r of vt(e)){let n=Object.getOwnPropertyDescriptor(e,r);!n||!("value"in n)||s.IsObject(n.value)&&Ll(n.value,t)}Object.freeze(e)}}function Vr(e){return Ae.Get().immutableTypes&&Ll(e,new WeakSet),e}function MR(e,t){Yt.assign+=1;let r={},n=vt(t),o=vt(e);for(let i of o)n.includes(i)||Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(e,i));for(let i of n)Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i));return Vr(r)}function vR(e){Yt.clone+=1;let t={};for(let r of vt(e)){if(s.IsUnsafePropertyKey(r))continue;let n=Object.getOwnPropertyDescriptor(e,r);s.IsEqual(n.enumerable,!0)?t[r]=n.value:Object.defineProperty(t,r,n)}return t}function Dl(e,t){return{...e,...t}}function FR(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 LR(e,t,r={}){Yt.create+=1;let n=Dl(t,r),o=Ae.Get().enumerableKind?Dl(n,e):FR(n,e);return Vr(o)}function DR(e,t){Yt.discard+=1;let r={};for(let n of vt(e)){if(t.includes(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o)}return Vr(r)}function jR(e,t,r,n){for(let o of vt(e)){if(s.IsUnsafePropertyKey(o)||t.includes(o)||r.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,i)}}function NR(e,t,r){let n=Ae.Get().enumerableKind;for(let o of t)s.IsUnsafePropertyKey(o)||Object.defineProperty(r,o,{configurable:!0,writable:!0,enumerable:n,value:e[o]})}function qR(e,t,r){for(let n of t)s.IsUnsafePropertyKey(n)||Object.defineProperty(r,n,{configurable:!0,enumerable:!0,writable:!0,value:e[n]})}function _R(e,t,r){Yt.update+=1;let n={},o=vt(t),i=vt(r);return jR(e,o,i,n),NR(t,o,n),qR(r,i,n),Vr(n)}function Hs(...e){let[t,r,n]=U.Match(e,{3:(f,d,g)=>[f,d,g],2:(f,d)=>[{},f,d]}),o=Gn(t,r),i=new Ze,a=ae(o,i,"#","",r,n),m=i.GetErrors(),c=Fl(),p=m.map(f=>({...f,message:c(f)}));return[a,p]}var Nl=0;function zs(){let e=Qi();Nl=e.maxErrors,e.maxErrors=e.maxParseErrors}function Ws(){let e=Qi();e.maxErrors=Nl}function _u(...e){let[t,r,n]=U.Match(e,{3:(a,m,c)=>[a,m,c],2:(a,m)=>[{},a,m]}),o=Gn(t,r),i=new ct;return Y(o,i,r,n)}function G(...e){let[t,r,n]=U.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return _u(t,r,n)}function Qt(...e){let[t,r,n]=U.Match(e,{3:(a,m,c)=>[a,m,c],2:(a,m)=>[{},a,m]}),[o,i]=Hs(t,r,n);return i}var Ar=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 Vs(...e){let[t,r,n]=U.Match(e,{3:(i,a,m)=>[i,a,m],2:(i,a)=>[{},i,a]});if(!G(t,r,n))throw new Ar("Assert",n,Qt(t,r,n))}function T(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function le(e){return s.IsObject(e)}function C(e,t,r){return l.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function Jr(e){return T(e,"Deferred")}function ur(e,t){return l.Update(e,{"~readonly":!0},t)}function ql(e,t,r,n){let o=b(e,t,r);return ur(o,n)}function cr(e,t){return l.Update(e,{"~optional":!0},t)}function _l(e,t,r,n){let o=b(e,t,r);return cr(o,n)}function xt(e,t){return l.Create({"~kind":"Array"},{type:"array",items:e},t)}function H(e){return T(e,"Array")}function Jn(e){return l.Discard(e,["~kind","type","items"])}function pr(e,t,r={}){return l.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function be(e){return T(e,"Constructor")}function Ul(e){return l.Discard(e,["~kind","type","parameters","instanceType"])}function fr(e,t,r={}){return l.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function $e(e){return T(e,"Function")}function Bl(e){return l.Discard(e,["~kind","type","parameters","returnType"])}function _e(e,t){return l.Create({"~kind":"Ref"},{$ref:e},t)}function Z(e){return T(e,"Ref")}function Yr(e,t){return l.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Yn(e){return T(e,"Generic")}function Qn(e){return l.Create({"~kind":"Any"},{},e)}function ye(e){return T(e,"Any")}var Gl="(?!)";function re(e){return l.Create({"~kind":"Never"},{not:{}},e)}function yt(e){return T(e,"Never")}function dr(e,t={}){return C("AddOptional",[e],t)}function Js(e,t={}){return cr(e,t)}function Kl(e){return Js(e)}function Oe(e){return le(e)&&s.HasPropertyKey(e,"~optional")}function Hl(e){return s.Keys(e).filter(t=>!Oe(e[t]))}function Ys(e){return s.Keys(e)}function Qs(e){return s.Values(e)}function O(e,t={}){let r=Hl(e),n=r.length>0?{required:r}:{};return l.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function R(e){return T(e,"Object")}function zl(e){return l.Discard(e,["~kind","type","properties","required"])}function De(e){return l.Create({"~kind":"Unknown"},{},e)}function Me(e){return T(e,"Unknown")}function lr(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 T(e,"Cyclic")}function Wl(e){return l.Update(e,{"~unsafe":null},{})}function Xs(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}function Zo(...e){let[t,r]=U.Match(e,{2:(n,o)=>[n,o,o],1:n=>[n,De(),De()]});return l.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function ve(e){return T(e,"Infer")}function $n(e,t,r,n={}){return l.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function Ee(e){return T(e,"Dependent")}function Vl(e){return l.Discard(e,["~kind","if","then","else"])}function Jl(e){return s.IsObjectNotArray(e)}function Yl(e){return s.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function Ql(e){return s.IsString(e)||s.IsNumber(e)}function Xl(e,t){let r=Jl(e)?Yl(e):e;return l.Create({"~kind":"Enum"},{enum:r},t)}function Se(e){return T(e,"Enum")}function ot(e,t={}){return l.Create({"~kind":"Intersect"},{allOf:e},t)}function P(e){return T(e,"Intersect")}function Zl(e){return l.Discard(e,["~kind","allOf"])}var ei=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=pt(r)?a=>this.decode(r["~codec"].decode(a)):this.decode,o=pt(r)?a=>r["~codec"].encode(t(a)):t,i={decode:n,encode:o};return l.Update(this.type,{"~codec":i},{})}},ti=class{constructor(t){this.type=t}Decode(t){return new ei(this.type,t)}};function Zs(e){return new ti(e)}function eg(e,t){return Zs(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function tg(e,t){return Zs(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function pt(e){return le(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function rg(e){return Xn(e)}function En(e){return le(e)&&s.HasPropertyKey(e,"~immutable")}function gr(e,t={}){return C("AddReadonly",[e],t)}function ea(e,t={}){return ur(e,t)}function ng(e){return ea(e)}function Or(e){return le(e)&&s.HasPropertyKey(e,"~readonly")}function GR(e,t){let r=ri(e)?[...e["~refine"],t]:[t];return l.Update(e,{"~refine":r},{})}function og(...e){let[t,r,n]=U.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[o,i,()=>"Refine Error"]});return GR(t,{check:r,error:n})}function KR(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function ri(e){return le(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>KR(t))}var ig="-?(?:0|[1-9][0-9]*)n";function ni(e){return l.Create({"~kind":"BigInt"},{type:"bigint"},e)}function kt(e){return T(e,"BigInt")}function ta(e){return l.Create({"~kind":"Boolean"},{type:"boolean"},e)}function ft(e){return T(e,"Boolean")}function oi(e){return l.Create({"~kind":"Identifier"},{name:e})}function sg(e){return T(e,"Identifier")}var ra="-?(?:0|[1-9][0-9]*)";function Sn(e){return l.Create({"~kind":"Integer"},{type:"integer"},e)}function Be(e){return T(e,"Integer")}var Uu=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function HR(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new Uu(e)})()}function B(e,t){return l.Create({"~kind":"Literal"},{type:HR(e),const:e},t)}function na(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function ag(e){return K(e)&&s.IsBigInt(e.const)}function mg(e){return K(e)&&s.IsBoolean(e.const)}function oa(e){return K(e)&&s.IsNumber(e.const)}function ia(e){return K(e)&&s.IsString(e.const)}function K(e){return T(e,"Literal")}function Zn(e){return l.Create({"~kind":"Null"},{type:"null"},e)}function xr(e){return T(e,"Null")}var sa="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Tt(e){return l.Create({"~kind":"Number"},{type:"number"},e)}function ge(e){return T(e,"Number")}function eo(e){return l.Create({"~kind":"Symbol"},{type:"symbol"},e)}function yr(e){return T(e,"Symbol")}function kn(...e){let[t,r,n]=U.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[o,i,i],1:o=>[o,De(),De()]});return l.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function ug(e){return T(e,"Parameter")}var aa=".*";function et(e){return l.Create({"~kind":"String"},{type:"string"},e)}function je(e){return T(e,"String")}function L(e,t={}){return l.Create({"~kind":"Union"},{anyOf:e},t)}function E(e){return T(e,"Union")}function cg(e){return l.Discard(e,["~kind","anyOf"])}function ii(e){let t=pg(e);return s.IsEqual(t.length,2)?t[0]:[]}function zR(e){return!0}function fg(e){return s.ShiftLeft(e,(t,r)=>WR(t)?fg(r):!1,()=>!0)}function dg(e){return s.IsEqual(e.length,0)?!1:fg(e)}function WR(e){return E(e)?dg(e.anyOf):K(e)?zR(e.const):!1}function ma(e){return dg(e)}function ua(e){return l.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function lg(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>lg(o,t,[...r,`${n}${t}`]),()=>r)}function VR(e,t){return s.IsEqual(e.length,0)?[`${t}`]:lg(e,t)}function gg(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>gg(e,o,[...r,...xg(e,n)]),()=>r)}function xg(e,t){return E(t)?gg(e,t.anyOf):K(t)?VR(e,t.const):Ie()}function yg(e,t){return s.ShiftLeft(t,(r,n)=>yg(xg(e,r),n),()=>e)}function JR(e){return e.map(t=>B(t))}function YR(e){let t=yg([],e),r=JR(t);return L(r)}function QR(e){return s.IsEqual(e.length,0)?Ie():s.IsEqual(e.length,1)&&K(e[0])?e[0]:YR(e)}function Bu(e){let t=ii(e);return s.IsEqual(t.length,0)?et():ma(t)?QR(t):ua(e)}function to(e){let t=Bu(e);return se(t)?et():t}function ht(e,t){let r="object",n={[e]:t};return l.Create({"~kind":"Record"},{type:r,patternProperties:n})}function hg(e){return ht(Xt,e)}function Ig(e){return O({true:e,false:e})}function ke(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 N(e){return T(e,"Tuple")}function bg(e){return l.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Gu(e){return e.reduceRight((r,n,o)=>({[o]:n,...r}),{})}function $g(e){let t=Gu(e.items);return O(t)}function XR(e){return l.Discard(e,["~optional"])}function Tn(e,t){return l.Update(XR(e),{},t)}function Eg(e,t,r,n){let o=b(e,t,r);return Tn(o,n)}function ZR(e){return l.Discard(e,["~readonly"])}function ro(e,t){return l.Update(ZR(e),{},t)}function Sg(e,t,r,n){let o=b(e,t,r);return ro(o,n)}function ca(e,t){let r=Or(e)&&Or(t),n=Oe(e)&&Oe(t),o=Te([e,t]),i=ro(Tn(o,{}),{});return r&&n?ur(cr(i,{}),{}):r?ur(i,{}):n?cr(i,{}):i}function kg(e,t){let r=Or(e)||Or(t),n=Oe(e)||Oe(t),o=ro(Tn(e,{}),{}),i=ro(Tn(t,{}),{}),a=It([o,i]);return r&&n?ur(cr(a,{}),{}):r?ur(a,{}):n?cr(a,{}):a}function eP(e,t,r){return r in e?r in t?ca(e[r],t[r]):e[r]:r in t?t[r]:re()}function tP(e,t){return[...new Set([...s.Keys(e),...s.Keys(t)])].reduce((o,i)=>({...o,[i]:eP(e,t,i)}),{})}function Tg(e){return R(e)?e.properties:N(e)?Gu(e.items):{}}function Cg(e,t){let r=Tg(e),n=Tg(t),o=tP(r,n);return O(o)}function rP(e,t){let r=no(e,t);return s.IsEqual(r,ai)?e:s.IsEqual(r,mi)||s.IsEqual(r,si)?t:re()}function wg(e){return R(e)||N(e)}function nP(e,t){let r=wg(e),n=wg(t);return r&&n?Cg(e,t):r&&!n?e:!r&&n?t:rP(e,t)}function Rg(e,t){return yt(e)||ye(e)?e:Me(e)||yt(t)||ye(t)?t:Me(t)?e:nP(e,t)}function oP(e,t){return E(e)||E(t)}function iP(e,t){let r=Bt(e),n=Bt(t);return oP(r,n)?Te([r,n]):Rg(r,n)}function Pg(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>Pg(e,o,[...r,iP(n,e)]),()=>s.IsEqual(r.length,0)?[e]:r)}function Ag(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>Ag(o,t,[...r,...ui([n],t)]),()=>r)}function ui(e,t=[]){return s.ShiftLeft(e,(r,n)=>E(r)?ui(n,Ag(r.anyOf,t)):ui(n,Pg(r,t)),()=>t)}function sP(e,t){let r=tt({},e,t);return v.IsExtendsTrueLike(r)?[]:[e]}function Og(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>Og(o,t,[...r,...sP(n,t)]),()=>r)}function pa(e,t){let r=Bt(e),n=E(r)?r.anyOf:[r],o=Og(n,t);return It(o)}function Zt(e,t,r){let n=Te([e,t]),o=pa(r,e);return It([n,o])}function dt(e,t=[]){return s.ShiftLeft(e,(r,n)=>dt(n,[...t,B(r)]),()=>It(t))}function Te(e){let t=ui(e),r=Ku(t);return It(r)}function it(e){let t=to(e);return Bt(t)}function It(e){let t=Ku(e);return Qr(t)}function Bt(e){return Ee(e)?Zt(e.if,e.then,e.else):Se(e)?dt(e.enum):P(e)?Te(e.allOf):se(e)?it(e.pattern):E(e)?It(e.anyOf):e}function Qr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?re():L(e)}function Mg(e,t){let r=dt(e);return Xr(r,t)}function vg(e,t){return ht(Zr,t)}function Fg(e,t){let r=Te(e);return Xr(r,t)}function Lg(e,t){return s.IsString(e)||s.IsNumber(e)?O({[e]:t}):s.IsEqual(e,!1)?O({false:t}):s.IsEqual(e,!0)?O({true:t}):O({})}function Dg(e,t){return ht(oo,t)}function jg(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?ht(e.pattern.toString(),t):ht(Xt,t)}function Ng(e,t){let r=ii(e);return ma(r)?Xr(it(e),t):ht(e,t)}function aP(e){return E(e)?en(e.anyOf):[e]}function en(e,t=[]){return s.ShiftLeft(e,(r,n)=>en(n,[...t,...aP(r)]),()=>t)}function mP(e){return e.some(t=>je(t)||ge(t)||Be(t))}function uP(e,t){return s.IsEqual(mP(e),!0)?ht(Xt,t):void 0}function cP(e,t){return e.reduce((r,n)=>K(n)&&(s.IsString(n.const)||s.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function pP(e,t){let r=cP(e,t);return O(r)}function qg(e,t){let r=en(e),n=uP(r,t);return le(n)?n:pP(r,t)}function Xr(e,t){return ye(e)?hg(t):ft(e)?Ig(t):Se(e)?Mg(e.enum,t):Be(e)?vg(e,t):P(e)?Fg(e.allOf,t):K(e)?Lg(e.const,t):ge(e)?Dg(e,t):E(e)?qg(e.anyOf,t):je(e)?jg(e,t):se(e)?Ng(e.pattern,t):O({})}function Hu(e,t,r){return q([e])?l.Update(Xr(e,t),{},r):fa(e,t,r)}function _g(e,t,r,n,o){let i=b(e,t,r),a=b(e,t,n);return Hu(i,a,o)}var Zr=`^${ra}$`,oo=`^${sa}$`,Xt=`^${aa}$`;function fa(e,t,r={}){return C("Record",[e,t],r)}function io(e,t,r={}){return Hu(e,t,r)}function Ug(e,t){return ht(e,t)}function da(e){return s.IsEqual(e,Xt)?et():s.IsEqual(e,Zr)?Sn():s.IsEqual(e,oo)?Tt():Bu(e)}function Fe(e){return s.Keys(e.patternProperties)[0]}function so(e){let t=Fe(e);return da(t)}function me(e){return e.patternProperties[Fe(e)]}function te(e){return T(e,"Record")}function Cn(e){return l.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function tn(e){return T(e,"Rest")}function la(e){return l.Create({"~kind":"This"},{$ref:"#"},e)}function ga(e){return T(e,"This")}function ao(e){return l.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Gt(e){return T(e,"Undefined")}function xa(e){return l.Create({"~kind":"Void"},{type:"void"},e)}function Ct(e){return T(e,"Void")}function dP(e,t){return s.IsEqual(e,"Array")?xt(t[0]):s.IsEqual(e,"Capitalize")?ha(t[0]):s.IsEqual(e,"ConstructorParameters")?Sa(t[0]):s.IsEqual(e,"Evaluate")?Ky(t[0]):s.IsEqual(e,"Exclude")?ka(t[0],t[1]):s.IsEqual(e,"Extract")?Ta(t[0],t[1]):s.IsEqual(e,"Index")?di(t[0],t[1]):s.IsEqual(e,"InstanceType")?Ca(t[0]):s.IsEqual(e,"Lowercase")?Ia(t[0]):s.IsEqual(e,"NonNullable")?wa(t[0]):s.IsEqual(e,"Omit")?Ra(t[0],t[1]):s.IsEqual(e,"Parameters")?Pa(t[0]):s.IsEqual(e,"Partial")?Aa(t[0]):s.IsEqual(e,"Pick")?Oa(t[0],t[1]):s.IsEqual(e,"Readonly")?Ma(t[0]):s.IsEqual(e,"KeyOf")?li(t[0]):s.IsEqual(e,"Record")?fa(t[0],t[1]):s.IsEqual(e,"Required")?va(t[0]):s.IsEqual(e,"ReturnType")?Fa(t[0]):s.IsEqual(e,"Uncapitalize")?ba(t[0]):s.IsEqual(e,"Uppercase")?$a(t[0]):fi(_e(e),t)}function wn(){throw Error("Unreachable")}function zg(e,t=[]){return s.ShiftLeft(e,(r,n)=>zg(n,[...t,r[1]]),()=>t)}function Mr(e){return s.IsEqual(e.length,3)?[e[0],...zg(e[1])]:[]}function Wg(e){return kn(e[0],e[2],e[4])}function Vg(e){return kn(e[0],e[2],e[2])}function Jg(e){return kn(e[0],De(),e[2])}function Yg(e){return kn(e,De(),De())}function Qg(e){return Mr(e)}function Xg(e){return e[1]}function Zg(e){return Mr(e)}function ex(e){return e[1]}function tx(e){return dP(e[0],e[1])}function rx(e){return null}function nx(e){return et()}function ox(e){return Tt()}function ix(e){return ta()}function sx(e){return ao()}function ax(e){return Zn()}function mx(e){return Sn()}function ux(e){return ni()}function cx(e){return De()}function px(e){return Qn()}function fx(e){return O({})}function dx(e){return re()}function lx(e){return eo()}function gx(e){return xa()}function xx(e){return la()}function yx(e){return B(BigInt(e))}function hx(e){return B(s.IsEqual(e,"true"))}function Ix(e){return B(parseFloat(e))}function bx(e){return B(e)}function $x(e){return e[1]}function Ex(e){return B(e)}function Sx(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function kx(e){return e[1]}function Tx(e){return ya(e)}function Cx(e){return s.IsEqual(e.length,6)?$n(e[1],e[3],e[5]):$n(e[1],e[3],De())}function wx(e){return e.length>0}function Rx(e){return e.reduce((t,r)=>s.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function Px(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Ax(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function Ox(e){return s.IsEqual(e.length,2)?e[1]:[]}function Bg(e,t){return t.reduce((r,n)=>{let o=n;return s.IsEqual(o.length,1)?di(r,o[0]):s.IsEqual(o.length,0)?xt(r):wn()},e)}function Gg(e,t){return s.IsEqual(t.length,3)?Ea(e,t[0],t[1],t[2]):e}function lP(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:La(e,t)}function Mx(e){let[t,r,n,o,i]=e;return lP(Gg(t?li(Bg(r,n)):Bg(r,n),o),i)}function zu(e,t){return s.IsEqual(t.length,3)?(()=>{let[r,n,o]=t,i=zu(n,o);if(s.IsEqual(r,"&"))return P(i)?ot([e,...i.allOf]):ot([e,i]);if(s.IsEqual(r,"|"))return E(i)?L([e,...i.anyOf]):L([e,i]);wn()})():e}function vx(e){let[t,r]=e;return zu(t,r)}function Fx(e){let[t,r]=e;return zu(t,r)}function Lx(e){return By(e[1])}function Dx(e){return e[1]}function jx(e){return Yr(e[0],e[2])}function Nx(e){return s.IsEqual(e.length,4)?Zo(e[1],e[3]):s.IsEqual(e.length,2)?Zo(e[1],De()):wn()}function qx(e){return`${e}`}function _x(e){return Be(e[3])?Zr:ge(e[3])?oo:yr(e[3])?Xt:je(e[3])?Xt:wn()}function Ux(e){return e.length>0}function Bx(e){return e.length>0}function Gx(e){let[t,r,n,o,i]=e;return{[r]:t&&n?gr(dr(i)):t&&!n?gr(i):!t&&n?dr(i):i}}function Kx(e){return Mr(e)}function Hx(e){return e.reduce((t,r)=>s.HasPropertyKey(r,Zr)||s.HasPropertyKey(r,oo)||s.HasPropertyKey(r,Xt)?[t[0],l.Assign(t[1],r)]:[l.Assign(t[0],r),t[1]],[{},{}])}function zx(e){return Hx(e[1])}function Wx(e){let[t,r]=e,n=s.IsEqual(s.Keys(r).length,0)?{}:{patternProperties:r};return O(t,n)}function Vx(e){return s.IsEqual(e.length,5)?gr(dr(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?gr(e[3]):dr(e[3]):wn()}function Jx(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[t,r,n]=e;return t&&n?gr(dr(r)):t&&!n?gr(r):!t&&n?dr(r):r}function Yx(e){return s.IsEqual(e.length,2)?Cn(e[1]):s.IsEqual(e.length,1)?e[0]:wn()}function Qx(e){return Mr(e)}function Xx(e){return ke(e[1])}function Zx(e){return gr(dr(e[4]))}function ey(e){return gr(e[3])}function ty(e){return dr(e[3])}function ry(e){return e[2]}function ny(e){return s.IsEqual(e.length,2)?Cn(e[1]):s.IsEqual(e.length,1)?e[0]:wn()}function oy(e){return Mr(e)}function iy(e){return fr(e[1],e[4])}function sy(e){return pr(e[2],e[5])}function Kg(e,t){return s.IsEqual(e,"remove")?Gy(t):s.IsEqual(e,"add")?gr(t):t}function ay(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 Hg(e,t){return s.IsEqual(e,"remove")?Uy(t):s.IsEqual(e,"add")?dr(t):t}function my(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 uy(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function cy(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?ci(oi(e[3]),e[5],e[6][0],Kg(e[1],Hg(e[8],e[10]))):ci(oi(e[3]),e[5],_e(e[3]),Kg(e[1],Hg(e[8],e[10])))}function py(e){return _e(e)}function fy(e){return BigInt(e)}function dy(e){return parseFloat(e)}function ly(e){return s.IsEqual(e,"true")}function gy(e){return null}function xy(e){return{[e[0]]:e[2]}}function yy(e){return Mr(e)}function gP(e){return e.reduce((t,r)=>l.Assign(t,r),{})}function hy(e){return gP(e[1])}function Iy(e){return Mr(e)}function by(e){return e[1]}function $y(e){return ni()}function Ey(e){return et()}function Sy(e){return Tt()}function ky(e){return Sn()}function Ty(e){return re()}function Cy(e){return B(e)}function wy(e){return L(e[1])}function Ry(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Py(e){return[e[0],...e[1]]}function Ay(e){return e[1]}function Oy(e){return Mr(e)}function My(e){return s.IsEqual(e.length,2)?e[1]:[]}function vy(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]]:Yr(t,pi(r,n,i))}}function Fy(e){let t=e[2],[r,n]=e[3],o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:pi(t,r,o)}}function Ly(e){return{[e[1]]:Yr(e[2],e[4])}}function Dy(e){return{[e[1]]:e[3]}}function jy(e){return null}function Ny(e){return Mr(e)}function qy(e){return e[1]}function _y(e){let[t,r]=[e[0],e[1]];return Hy(l.Assign(t,Hx(r)[0]))}function gi(e){return J(e.length,2)}function z(e,t,r){return gi(e)?t(e[0],e[1]):r()}function hP(e,t){return J(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function he(e,t){for(let r=0;r<e.length;r++){let n=hP(e[r],t);if(gi(n))return n}return[]}function Wu(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var zy=[...Wu(97,122),...Wu(65,90)],Vu="0",Ju=Wu(49,57),mo=[Vu,...Ju],Wy=" ",uo=`
|
|
2
2
|
`;var rn="_",Da=".",Vy="$",ja="-";var Jy="//",Yy="/*",bP="*/";function Qy(e){let t=e.indexOf(bP);return J(t,-1)?"":e.slice(t+2)}function Xy(e){let t=e.indexOf(uo);return J(t,-1)?"":e.slice(t)}function $P(e){return e.replace(/^[ \t\r\f\v]+/,"")}function Na(e){let t=$P(e);return t.startsWith(Yy)?Na(Qy(t.slice(2))):t.startsWith(Jy)?Na(Xy(t.slice(2))):t}function Je(e){let t=e.trimStart();return t.startsWith(Yy)?Je(Qy(t.slice(2))):t.startsWith(Jy)?Je(Xy(t.slice(2))):t}function qa(e,t){return z(he([e],t),(r,n)=>[r,n],()=>["",t])}function EP(e,t){return e.includes(t)}function co(e,t,r,n=""){return z(he(e,r),(o,i)=>EP(t,o)?co(e,t,i,n):co(e,t,i,`${n}${o}`),()=>[n,r])}function SP(e){return he(Ju,e)}var kP=[...mo,rn];function TP(e){return co(kP,[rn],e)}function CP(e){return z(he([Vu],e),(t,r)=>[t,r],()=>z(SP(e),(t,r)=>z(TP(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[]))}function _a(e){return CP(Je(e))}function wP(e){return qa(ja,e)}function RP(e){return z(wP(e),(t,r)=>z(_a(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function Zy(e){return RP(Je(e))}function PP(e){return z(Zy(e),(t,r)=>z(he(["n"],r),(n,o)=>[`${t}`,o],()=>[]),()=>[])}function Yu(e){return PP(e)}function Qu(e,t){return he([e],t)}function y(e,t){return J(e,"")?["",t]:e.startsWith(uo)?Qu(e,Na(t)):e.startsWith(Wy)?Qu(e,t):Qu(e,Je(t))}var eh=[...zy,rn,Vy];function AP(e){return he(eh,e)}var OP=[...eh,...mo];function th(e,t=""){return z(he(OP,e),(r,n)=>th(n,`${t}${r}`),()=>[t,e])}function MP(e){return z(AP(e),(t,r)=>z(th(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function Ce(e){return MP(Je(e))}var vP=[...mo,rn];function FP(e){return gi(he([Da],e))}function rh(e){return z(co(vP,[rn],e),(t,r)=>J(t,"")?[]:[t,r],()=>[])}function LP(e){return z(he([Da],e),(t,r)=>z(rh(r),(n,o)=>[`0${t}${n}`,o],()=>[]),()=>[])}function DP(e){return z(_a(e),(t,r)=>z(he([Da],r),(n,o)=>z(rh(o),(i,a)=>[`${t}${n}${i}`,a],()=>[`${t}`,o]),()=>[`${t}`,r]),()=>[])}function jP(e){return FP(e)?LP(e):DP(e)}function nh(e){return jP(Je(e))}function NP(e){return qa(ja,e)}function qP(e){return z(NP(e),(t,r)=>z(nh(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function Ua(e){return qP(Je(e))}function _P(e){return J(e,"")?[]:[e.slice(0,1),e.slice(1)]}function oh(e,t){return Yi(e,(r,n)=>t.startsWith(r)?!0:oh(n,t),()=>!1)}function nn(e,t,r=""){return z(_P(t),(n,o)=>oh(e,t)?[r,t]:nn(e,o,`${r}${n}`),()=>[])}function UP(e,t,r){return z(he([e],r),(n,o)=>z(nn([t],o),(i,a)=>z(he([t],a),(m,c)=>[`${i}`,c],()=>[]),()=>[]),()=>[])}function BP(e,t,r){return z(he([e],r),(n,o)=>z(nn([uo,t],o),(i,a)=>z(he([t],a),(m,c)=>[`${i}`,c],()=>[]),()=>[]),()=>[])}function ih(e,t,r,n){return r?UP(e,t,Je(n)):BP(e,t,Je(n))}function GP(e,t){return he(e,t)}function KP(e,t){return ih(e,e,!1,t)}function HP(e,t){return z(GP(e,t),(r,n)=>KP(r,`${r}${n}`),()=>[])}function Ba(e,t){return HP(e,Je(t))}function sh(e,t){return z(nn(e,t),(r,n)=>J(r,"")?[]:[r,n],()=>[])}var u=(e,t,r=()=>[])=>e.length===2?t(e):r(),WP=e=>u(u(Ce(e),([t,r])=>u(y("extends",r),([n,o])=>u(Q(o),([i,a])=>u(y("=",a),([m,c])=>u(Q(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[Wg(t),r]),VP=e=>u(u(Ce(e),([t,r])=>u(y("extends",r),([n,o])=>u(Q(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Vg(t),r]),JP=e=>u(u(Ce(e),([t,r])=>u(y("=",r),([n,o])=>u(Q(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Jg(t),r]),YP=e=>u(Ce(e),([t,r])=>[Yg(t),r]),uh=e=>u(u(WP(e),([t,r])=>[t,r],()=>u(VP(e),([t,r])=>[t,r],()=>u(JP(e),([t,r])=>[t,r],()=>u(YP(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),ch=(e,t=[])=>u(u(y(",",e),([r,n])=>u(uh(n),([o,i])=>[[r,o],i])),([r,n])=>ch(n,[...t,r]),()=>[t,e]),QP=e=>u(u(u(uh(e),([t,r])=>u(ch(r),([n,o])=>u(u(y(",",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]),ec=e=>u(u(y("<",e),([t,r])=>u(QP(r),([n,o])=>u(y(">",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Xg(t),r]),ph=(e,t=[])=>u(u(y(",",e),([r,n])=>u(Q(n),([o,i])=>[[r,o],i])),([r,n])=>ph(n,[...t,r]),()=>[t,e]),XP=e=>u(u(u(Q(e),([t,r])=>u(ph(r),([n,o])=>u(u(y(",",o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Zg(t),r]),ZP=e=>u(u(y("<",e),([t,r])=>u(XP(r),([n,o])=>u(y(">",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[ex(t),r]),eA=e=>u(u(Ce(e),([t,r])=>u(ZP(r),([n,o])=>[[t,n],o])),([t,r])=>[tx(t),r]),fh=e=>u(u(u(y(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[rx(t),r]),dh=e=>u(y("string",e),([t,r])=>[nx(t),r]),lh=e=>u(y("number",e),([t,r])=>[ox(t),r]),tA=e=>u(y("boolean",e),([t,r])=>[ix(t),r]),rA=e=>u(y("undefined",e),([t,r])=>[sx(t),r]),nA=e=>u(y("null",e),([t,r])=>[ax(t),r]),gh=e=>u(y("integer",e),([t,r])=>[mx(t),r]),oA=e=>u(y("bigint",e),([t,r])=>[ux(t),r]),iA=e=>u(y("unknown",e),([t,r])=>[cx(t),r]),sA=e=>u(y("any",e),([t,r])=>[px(t),r]),aA=e=>u(y("object",e),([t,r])=>[fx(t),r]),mA=e=>u(y("never",e),([t,r])=>[dx(t),r]),xh=e=>u(y("symbol",e),([t,r])=>[lx(t),r]),uA=e=>u(y("void",e),([t,r])=>[gx(t),r]),cA=e=>u(y("this",e),([t,r])=>[xx(t),r]),pA=e=>u(u(y("${",e),([t,r])=>u(Q(r),([n,o])=>u(y("}",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[$x(t),r]),Xu=e=>u(nn(["${","`"],e),([t,r])=>[Ex(t),r]),yh=e=>u(u(u(Xu(e),([t,r])=>u(pA(r),([n,o])=>u(yh(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u(u(Xu(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u(u(Xu(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[Sx(t),r]),tc=e=>u(u(y("`",e),([t,r])=>u(yh(r),([n,o])=>u(y("`",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[kx(t),r]),fA=e=>u(tc(e),([t,r])=>[Tx(t),r]),dA=e=>u(u(u(y("if",e),([t,r])=>u(Q(r),([n,o])=>u(y("then",o),([i,a])=>u(Q(a),([m,c])=>u(y("else",c),([p,f])=>u(Q(f),([d,g])=>[[t,n,i,m,p,d],g])))))),([t,r])=>[t,r],()=>u(u(y("if",e),([t,r])=>u(Q(r),([n,o])=>u(y("then",o),([i,a])=>u(Q(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[t,r],()=>[])),([t,r])=>[Cx(t),r]),lA=e=>u(Yu(e),([t,r])=>[yx(t),r]),gA=e=>u(u(y("true",e),([t,r])=>[t,r],()=>u(y("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[hx(t),r]),xA=e=>u(Ua(e),([t,r])=>[Ix(t),r]),yA=e=>u(Ba(["'",'"'],e),([t,r])=>[bx(t),r]),hA=e=>u(u(u(y("keyof",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[wx(t),r]),hh=(e,t=[])=>u(u(u(y("[",e),([r,n])=>u(Q(n),([o,i])=>u(y("]",i),([a,m])=>[[r,o,a],m]))),([r,n])=>[r,n],()=>u(u(y("[",e),([r,n])=>u(y("]",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>[])),([r,n])=>hh(n,[...t,r]),()=>[t,e]),IA=e=>u(hh(e),([t,r])=>[Rx(t),r]),bA=e=>u(u(u(y("extends",e),([t,r])=>u(Q(r),([n,o])=>u(y("?",o),([i,a])=>u(Q(a),([m,c])=>u(y(":",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])=>[Px(t),r]),$A=e=>u(u(u(y("(",e),([t,r])=>u(Q(r),([n,o])=>u(y(")",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u(dh(e),([t,r])=>[t,r],()=>u(lh(e),([t,r])=>[t,r],()=>u(tA(e),([t,r])=>[t,r],()=>u(rA(e),([t,r])=>[t,r],()=>u(nA(e),([t,r])=>[t,r],()=>u(gh(e),([t,r])=>[t,r],()=>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],()=>u(mA(e),([t,r])=>[t,r],()=>u(xh(e),([t,r])=>[t,r],()=>u(uA(e),([t,r])=>[t,r],()=>u(cA(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],()=>u(yA(e),([t,r])=>[t,r],()=>u(fA(e),([t,r])=>[t,r],()=>u(dA(e),([t,r])=>[t,r],()=>u(MA(e),([t,r])=>[t,r],()=>u(LA(e),([t,r])=>[t,r],()=>u(UA(e),([t,r])=>[t,r],()=>u(_A(e),([t,r])=>[t,r],()=>u(HA(e),([t,r])=>[t,r],()=>u(eA(e),([t,r])=>[t,r],()=>u(zA(e),([t,r])=>[t,r],()=>[])))))))))))))))))))))))))))),([t,r])=>[Ax(t),r]),EA=e=>u(u(u(y("with",e),([t,r])=>u(Lh(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Ox(t),r]),Ih=e=>u(u(hA(e),([t,r])=>u($A(r),([n,o])=>u(IA(o),([i,a])=>u(bA(a),([m,c])=>u(EA(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[Mx(t),r]),bh=e=>u(u(u(y("&",e),([t,r])=>u(Ih(r),([n,o])=>u(bh(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),$h=e=>u(u(Ih(e),([t,r])=>u(bh(r),([n,o])=>[[t,n],o])),([t,r])=>[vx(t),r]),Eh=e=>u(u(u(y("|",e),([t,r])=>u($h(r),([n,o])=>u(Eh(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Ga=e=>u(u($h(e),([t,r])=>u(Eh(r),([n,o])=>[[t,n],o])),([t,r])=>[Fx(t),r]),SA=e=>u(u(y("readonly",e),([t,r])=>u(Ga(r),([n,o])=>[[t,n],o])),([t,r])=>[Lx(t),r]),kA=e=>u(u(y("|",e),([t,r])=>u(Ga(r),([n,o])=>[[t,n],o])),([t,r])=>[Dx(t),r]),TA=e=>u(u(ec(e),([t,r])=>u(y("=",r),([n,o])=>u(Q(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[jx(t),r]),CA=e=>u(u(u(y("infer",e),([t,r])=>u(Ce(r),([n,o])=>u(y("extends",o),([i,a])=>u(Ga(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[t,r],()=>u(u(y("infer",e),([t,r])=>u(Ce(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>[])),([t,r])=>[Nx(t),r]),Q=e=>u(u(CA(e),([t,r])=>[t,r],()=>u(kA(e),([t,r])=>[t,r],()=>u(SA(e),([t,r])=>[t,r],()=>u(Ga(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),wA=e=>u(Ua(e),([t,r])=>[qx(t),r]),RA=e=>u(Ce(e),([t,r])=>[t,r]),PA=e=>u(Ba(["'",'"'],e),([t,r])=>[t,r]),AA=e=>u(u(y("[",e),([t,r])=>u(Ce(r),([n,o])=>u(y(":",o),([i,a])=>u(u(gh(a),([m,c])=>[m,c],()=>u(lh(a),([m,c])=>[m,c],()=>u(dh(a),([m,c])=>[m,c],()=>u(xh(a),([m,c])=>[m,c],()=>[])))),([m,c])=>u(y("]",c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[_x(t),r]),Sh=e=>u(u(wA(e),([t,r])=>[t,r],()=>u(RA(e),([t,r])=>[t,r],()=>u(PA(e),([t,r])=>[t,r],()=>u(AA(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),kh=e=>u(u(u(y("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Ux(t),r]),Th=e=>u(u(u(y("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Bx(t),r]),Ch=e=>u(u(kh(e),([t,r])=>u(Sh(r),([n,o])=>u(Th(o),([i,a])=>u(y(":",a),([m,c])=>u(Q(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[Gx(t),r]),Ka=e=>u(u(u(y(",",e),([t,r])=>u(y(`
|
|
3
3
|
`,r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(y(";",e),([t,r])=>u(y(`
|
|
4
4
|
`,r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(y(",",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u(u(y(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u(u(y(`
|
|
@@ -8,7 +8,7 @@ import{t as uf}from"./chunk-ZJL4OEXX.js";import{b as cf}from"./chunk-XODGJSB3.js
|
|
|
8
8
|
|
|
9
9
|
`)||void 0},ran:a}:{outcome:{block:!1,context:i.join(`
|
|
10
10
|
|
|
11
|
-
`)||void 0,error:c,updatedInput:p},ran:a}}import{existsSync as qS,readFileSync as C1}from"node:fs";function w1(e){return`${e}/.howtocode/mcp.json`}function Wc(e,t){if(!qS(e))return{};try{let n=JSON.parse(C1(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 kPe(e){let t=[];return Wc(Gi(e??Ve),t)}function TPe(e){let t=[],r=Wc(Gi(e.agentDir??Ve),t),n=w1(e.cwd),o=e.projectTrusted&&qS(n)?n:void 0,i=o?Wc(o,t):{},a=Gi(e.agentDir??Ve),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 R1,readdirSync as P1,readFileSync as A1,renameSync as O1,unlinkSync as _S,writeFileSync as M1}from"node:fs";import{join as US}from"node:path";var v1=180*1e3,PPe="presence";function BS(e,t){return US(e.dir,`${t.replace(/[^A-Za-z0-9._-]/g,"_")}.json`)}function F1(e,t=Date.now()){let r;try{r=P1(e.dir)}catch{return[]}let n=[];for(let o of r){if(!o.endsWith(".json"))continue;let i=US(e.dir,o),a;try{a=A1(i,"utf8")}catch{continue}let m;try{m=JSON.parse(a)}catch{Vc(i);continue}if(typeof m?.id!="string"||typeof m?.cwd!="string"||typeof m?.at!="number"){Vc(i);continue}if(t-m.at>=v1){Vc(i);continue}n.push({id:m.id,cwd:m.cwd,host:typeof m.host=="string"?m.host:"",pid:typeof m.pid=="number"?m.pid:0,at:m.at,...typeof m.activity=="string"&&m.activity?{activity:m.activity}:{}})}return n.sort((o,i)=>i.at-o.at)}function APe(e,t){R1(e.dir,{recursive:!0});let r=BS(e,t.id),n=`${r}.${process.pid}.tmp`;M1(n,JSON.stringify(t,null,2)),O1(n,r)}function OPe(e,t){try{_S(BS(e,t))}catch{}}function GS(e,t,r,n=Date.now()){return F1(e,n).filter(o=>o.cwd===t&&o.id!==r)}function Vc(e){try{_S(e)}catch{}}import{Type as Qe}from"@netrodev/hxf-ai";import{defineTool as mm}from"@netrodev/hxf-coding-agent";import{relative as K1,join as H1}from"node:path";import{mkdirSync as z1,writeFileSync as W1}from"node:fs";import{existsSync as FPe,mkdirSync as L1,readFileSync as D1,renameSync as j1,writeFileSync as N1}from"node:fs";import{dirname as q1,isAbsolute as _1,join as zS,relative as U1,resolve as KS,sep as HS}from"node:path";var B1=1800*1e3,G1=zS(".howtocode","claims.json");function WS(e){return zS(e,G1)}function Yc(e,t){try{let r=D1(WS(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<B1)}catch{return[]}}function VS(e,t){let r=WS(e);L1(q1(r),{recursive:!0});let n=`${r}.${process.pid}.tmp`;N1(n,JSON.stringify({version:1,claims:[...t]},null,2)),j1(n,r)}function JS(e,t){return _1(t)?KS(t):KS(e,t)}function YS(e,t){if(e===t)return!0;let r=n=>n.endsWith(HS)?n:n+HS;return e.startsWith(r(t))||t.startsWith(r(e))}function QS(e){let t=e.now??Date.now(),r=Yc(e.root,t),n=[],o=[],i=[];for(let a of e.paths){if(!a.trim())continue;let m=JS(e.root,a.trim()),c=r.find(p=>p.holder!==e.holder&&YS(p.path,m));if(c){o.push({path:Jc(e.root,m),by:c.holder,reason:c.reason||"no reason given"});continue}n.push(Jc(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));VS(e.root,[...a,...i])}return{granted:n,conflicts:o}}function XS(e,t,r){let n=Date.now(),o=Yc(e,n),i=r?.length?r.map(c=>JS(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=>YS(c.path,d));p&&f?m.push(Jc(e,c.path)):a.push(c)}return VS(e,a),m}function Qc(e,t=Date.now()){return Yc(e,t)}function Jc(e,t){let r=U1(e,t);return r&&!r.startsWith("..")?r:t}var Xc;function GPe(e){Xc=e}var KPe=mm({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:Qe.Object({thoughts:Qe.String({description:"Private notes"})}),async execute(){return{content:[{type:"text",text:"noted"}],details:{recorded:!0}}}}),HPe=mm({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:Qe.Object({question:Qe.String(),options:Qe.Array(Qe.String(),{minItems:2})}),async execute(e,t){if(!Xc)return{content:[{type:"text",text:"cancelled"}],details:{answer:"cancelled"}};let r=await Xc(t.question,t.options);return{content:[{type:"text",text:r}],details:{answer:r}}}}),Mi;function zPe(e){Mi=e}var WPe=mm({name:"sessions",label:"sessions",description:"See the other HowToCode 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:Qe.Object({message:Qe.Optional(Qe.String({description:"Message text to leave for another session."})),to:Qe.Optional(Qe.String({description:"Session id to send the message to. Use `all` for every other session."}))}),async execute(e,t){let r=Mi,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=GS({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=H1(n,`${f.id.replace(/[^A-Za-z0-9._-]/g,"_")}.inbox`);try{z1(n,{recursive:!0}),W1(d,`${JSON.stringify({from:o,at:Date.now(),text:t.message.trim()})}
|
|
11
|
+
`)||void 0,error:c,updatedInput:p},ran:a}}import{existsSync as qS,readFileSync as C1}from"node:fs";function w1(e){return`${e}/.howtocode/mcp.json`}function Wc(e,t){if(!qS(e))return{};try{let n=JSON.parse(C1(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 kPe(e){let t=[];return Wc(Gi(e??Ve),t)}function TPe(e){let t=[],r=Wc(Gi(e.agentDir??Ve),t),n=w1(e.cwd),o=e.projectTrusted&&qS(n)?n:void 0,i=o?Wc(o,t):{},a=Gi(e.agentDir??Ve),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 R1,readdirSync as P1,readFileSync as A1,renameSync as O1,unlinkSync as _S,writeFileSync as M1}from"node:fs";import{join as US}from"node:path";var v1=180*1e3,PPe="presence";function BS(e,t){return US(e.dir,`${t.replace(/[^A-Za-z0-9._-]/g,"_")}.json`)}function F1(e,t=Date.now()){let r;try{r=P1(e.dir)}catch{return[]}let n=[];for(let o of r){if(!o.endsWith(".json"))continue;let i=US(e.dir,o),a;try{a=A1(i,"utf8")}catch{continue}let m;try{m=JSON.parse(a)}catch{Vc(i);continue}if(typeof m?.id!="string"||typeof m?.cwd!="string"||typeof m?.at!="number"){Vc(i);continue}if(t-m.at>=v1){Vc(i);continue}n.push({id:m.id,cwd:m.cwd,host:typeof m.host=="string"?m.host:"",pid:typeof m.pid=="number"?m.pid:0,at:m.at,...typeof m.activity=="string"&&m.activity?{activity:m.activity}:{}})}return n.sort((o,i)=>i.at-o.at)}function APe(e,t){R1(e.dir,{recursive:!0});let r=BS(e,t.id),n=`${r}.${process.pid}.tmp`;M1(n,JSON.stringify(t,null,2)),O1(n,r)}function OPe(e,t){try{_S(BS(e,t))}catch{}}function GS(e,t,r,n=Date.now()){return F1(e,n).filter(o=>o.cwd===t&&o.id!==r)}function Vc(e){try{_S(e)}catch{}}import{Type as Qe}from"@netrodev/hxf-ai";import{defineTool as mm}from"@netrodev/hxf-coding-agent";import{relative as K1,join as H1}from"node:path";import{mkdirSync as z1,writeFileSync as W1}from"node:fs";import{existsSync as FPe,mkdirSync as L1,readFileSync as D1,renameSync as j1,writeFileSync as N1}from"node:fs";import{dirname as q1,isAbsolute as _1,join as zS,relative as U1,resolve as KS,sep as HS}from"node:path";var B1=1800*1e3,G1=zS(".howtocode","claims.json");function WS(e){return zS(e,G1)}function Yc(e,t){try{let r=D1(WS(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<B1)}catch{return[]}}function VS(e,t){let r=WS(e);L1(q1(r),{recursive:!0});let n=`${r}.${process.pid}.tmp`;N1(n,JSON.stringify({version:1,claims:[...t]},null,2)),j1(n,r)}function JS(e,t){return _1(t)?KS(t):KS(e,t)}function YS(e,t){if(e===t)return!0;let r=n=>n.endsWith(HS)?n:n+HS;return e.startsWith(r(t))||t.startsWith(r(e))}function QS(e){let t=e.now??Date.now(),r=Yc(e.root,t),n=[],o=[],i=[];for(let a of e.paths){if(!a.trim())continue;let m=JS(e.root,a.trim()),c=r.find(p=>p.holder!==e.holder&&YS(p.path,m));if(c){o.push({path:Jc(e.root,m),by:c.holder,reason:c.reason||"no reason given"});continue}n.push(Jc(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));VS(e.root,[...a,...i])}return{granted:n,conflicts:o}}function XS(e,t,r){let n=Date.now(),o=Yc(e,n),i=r?.length?r.map(c=>JS(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=>YS(c.path,d));p&&f?m.push(Jc(e,c.path)):a.push(c)}return VS(e,a),m}function Qc(e,t=Date.now()){return Yc(e,t)}function Jc(e,t){let r=U1(e,t);return r&&!r.startsWith("..")?r:t}var Xc;function GPe(e){Xc=e}var KPe=mm({name:"think",label:"think",description:"Private scratchpad, at most 4000 characters. 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:Qe.Object({thoughts:Qe.String({maxLength:4e3,description:"Private notes, at most 4000 characters"})}),async execute(){return{content:[{type:"text",text:"noted"}],details:{recorded:!0}}}}),HPe=mm({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:Qe.Object({question:Qe.String(),options:Qe.Array(Qe.String(),{minItems:2})}),async execute(e,t){if(!Xc)return{content:[{type:"text",text:"cancelled"}],details:{answer:"cancelled"}};let r=await Xc(t.question,t.options);return{content:[{type:"text",text:r}],details:{answer:r}}}}),Mi;function zPe(e){Mi=e}var WPe=mm({name:"sessions",label:"sessions",description:"See the other HowToCode 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:Qe.Object({message:Qe.Optional(Qe.String({description:"Message text to leave for another session."})),to:Qe.Optional(Qe.String({description:"Session id to send the message to. Use `all` for every other session."}))}),async execute(e,t){let r=Mi,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=GS({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=H1(n,`${f.id.replace(/[^A-Za-z0-9._-]/g,"_")}.inbox`);try{z1(n,{recursive:!0}),W1(d,`${JSON.stringify({from:o,at:Date.now(),text:t.message.trim()})}
|
|
12
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=Qc(i).filter(x=>x.holder===`session:${c.id}`),d=c.activity?` \u2014 ${c.activity}`:"",g=f.length>0?`
|
|
13
13
|
holds:
|
|
14
14
|
${f.map(x=>` ${ek(i,x.path)} \u2014 ${x.reason}`).join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$a as gs,A as No,Aa as Xo,Ba as Zo,Ca as Qo,D as Rt,Da as es,E as Fo,Ea as ts,G as jo,Ga as de,Ha as E,Ia as X,J as Do,Ja as A,K as Wo,Ka as ns,L as It,La as rs,M as Uo,Ma as is,N as Bo,Na as os,O as Vo,Oa as Kn,P as Wn,Pa as ss,Qa as as,Sa as ls,Ua as cs,Wa as ds,X as Un,Xa as us,Ya as fs,Z as Bn,Za as ms,_a as ps,aa as Qe,ab as hs,c as To,e as Eo,g as Mo,h as Po,ha as Ko,ia as et,ka as _t,n as _o,oa as Go,pa as Ho,ra as qo,sa as zo,ta as Yo,v as Lo,wa as Jo,x as Oo,z as Dn,za as Vn}from"./chunk-
|
|
1
|
+
import{$a as gs,A as No,Aa as Xo,Ba as Zo,Ca as Qo,D as Rt,Da as es,E as Fo,Ea as ts,G as jo,Ga as de,Ha as E,Ia as X,J as Do,Ja as A,K as Wo,Ka as ns,L as It,La as rs,M as Uo,Ma as is,N as Bo,Na as os,O as Vo,Oa as Kn,P as Wn,Pa as ss,Qa as as,Sa as ls,Ua as cs,Wa as ds,X as Un,Xa as us,Ya as fs,Z as Bn,Za as ms,_a as ps,aa as Qe,ab as hs,c as To,e as Eo,g as Mo,h as Po,ha as Ko,ia as et,ka as _t,n as _o,oa as Go,pa as Ho,ra as qo,sa as zo,ta as Yo,v as Lo,wa as Jo,x as Oo,z as Dn,za as Vn}from"./chunk-GXO5FCZF.js";import{a as vo,c as Et,d as Nn,j as xo,k as So,l as Co,n as Fn,o as jn,p as Ao}from"./chunk-ZJL4OEXX.js";import{b as bs,c as ws}from"./chunk-SDU65XW4.js";import{b as Ee,c as Ze,e as Ro,f as Mt,g as Io,h as Pt}from"./chunk-XODGJSB3.js";import{c as Ji}from"./chunk-DBPJZUIT.js";import{A as ao,B as Ct,C as lo,b as In,c as ye,d as Xi,e as Zi,h as Qi,n as _n,o as eo,q as oe,s as to,t as Ie,v as no,w as ro,x as io,y as oo,z as so}from"./chunk-UO2MJVH4.js";import{a as co,b as uo,c as fo,d as mo,f as po,g as go,h as ho,i as bo,l as wo}from"./chunk-UA2AUPJX.js";import{a as At,b as Ln,c as On,d as yo,e as Tt}from"./chunk-3FYCFLNK.js";import{u as ko}from"./chunk-SDO33XPR.js";import{a as $o}from"./chunk-ORJ2QZBG.js";import{a as Pn,b as Rn,c as Vi,d as Ki}from"./chunk-EZNNALD3.js";import{b as St}from"./chunk-7LA2AMZB.js";import{h as Ci,i as Ai}from"./chunk-Q2GQPEUC.js";import{a as vn,b as wt,e as Si}from"./chunk-OUVT3E6S.js";import{A as ji,B as vt,C as xt,D as Di,E as Cn,F as An,G as Wi,H as P,M as Xe,N as Tn,O as Ui,Q as Bi,c as xn,d as yt,g as kt,i as Ti,j as Ei,k as Mi,l as Pi,m as $t,n as Ri,o as Sn,p as Ii,s as se,t as _i,u as Li,x as Oi,y as Ni,z as Fi}from"./chunk-5FIFNXLT.js";import{a as ie}from"./chunk-UTYFLLSM.js";import{j as En,k as Mn}from"./chunk-MVVEYKN6.js";import{b as Gi,c as Hi,d as qi,e as zi,f as Yi}from"./chunk-TUXY64DT.js";import"./chunk-WOT6VMZA.js";import{execFile as yd}from"node:child_process";import{promisify as kd}from"node:util";import{appendFileSync as $d,existsSync as qt,mkdirSync as $r,readFileSync as zt,rmSync as vd,statSync as tl,writeFileSync as vr}from"node:fs";import{basename as xd,dirname as Sd,join as me,resolve as Cd}from"node:path";function ys(e){if(e==="")return!0;let t=/^\x1b\[(\d+);(\d+)u$/.exec(e);if(t&&Number(t[1])===99&&(Number(t[2])&5)!==0)return!0;let n=/^\x1b\[27;(\d+);(\d+)~$/.exec(e);return!!(n&&Number(n[2])===99&&(Number(n[1])&5)!==0)}function ks(e){let t=!1;process.on("SIGINT",()=>{t||(t=!0,e())})}function Il(e){if(!e||typeof e!="object")return;let t=e;if(!(typeof t.input!="number"&&typeof t.cacheRead!="number"&&typeof t.cacheWrite!="number"))return t}function _l(e){let t=e?.input??0,n=e?.cacheRead??0,r=e?.cacheWrite??0;return{input:t,cacheRead:n,cacheWrite:r,prompt:t+n+r}}function Ll(e){if(typeof e!="string")return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Ol(e){if(!e||typeof e!="object")return;let t=e,r=(t.message&&typeof t.message=="object"?t.message:void 0)??t,o=Il(r.usage);if(!o)return;let u=typeof r.provider=="string"?r.provider:"",a=typeof r.model=="string"?r.model:"";return{usage:o,model:[u,a].filter(Boolean).join("/")}}function $s(e){let t=0,n=0,r=[],o=0,u=null;for(let g of e){let b=Ol(g);if(!b)continue;let{input:k,cacheRead:C,cacheWrite:_,prompt:O}=_l(b.usage);if(O===0)continue;t+=C,n+=k+_;let F=Ll(g.timestamp),W=u,K=W?W.at:null;if(W!==null&&C===0&&k>=1e3){let ee=F!==null&&K!==null?Math.max(0,F-K):0;r.push({missedTokens:k,idleMs:ee,modelChanged:b.model!==""&&W.model!==""&&b.model!==W.model}),o+=k}u={prompt:O,at:F??K??null,model:b.model}}let a=t+n;return{cachedTokens:t,billedTokens:n,hitRate:a>0?t/a*100:null,misses:r,missedTokens:o}}function vs(e){return e.modelChanged?"model changed, so its cache had to be built":e.idleMs>=3e5?`cache expired after ${Math.round(e.idleMs/1e3)}s idle`:e.idleMs>0?"prompt changed too early in the prefix to hit":"reason not recorded"}import{copyToClipboard as Ad,ProjectTrustStore as Td,SessionManager as Ed}from"@netrodev/hxf-coding-agent";import{CombinedAutocompleteProvider as nl,Container as Md,Editor as Pd,matchesKey as q,ProcessTerminal as Rd,ScrollView as Id,KeybindingsManager as sl,setKeybindings as al,isKeyRelease as _d,parseColor as Jt,TUI_KEYBINDINGS as ll,SelectList as Ld,TuiAltScreen as Od,truncateToWidth as We,VStack as Nd,visibleWidth as Ar,wrapTextWithAnsi as cl}from"@netrodev/hxf-tui";import{spawn as Nl}from"node:child_process";function Fl(e,t,n=2e3){return new Promise(r=>{let o=!1,u,a=k=>{o||(o=!0,u!==void 0&&clearTimeout(u),r(k))},g;try{g=Nl(e,[...t],{stdio:["ignore","pipe","ignore"]})}catch{a({ok:!1,stdout:""});return}u=setTimeout(()=>{g.kill("SIGKILL"),a({ok:!1,stdout:""})},n);let b=[];g.stdout?.on("data",k=>b.push(k)),g.on("error",()=>a({ok:!1,stdout:""})),g.on("close",k=>{a({ok:k===0,stdout:Buffer.concat(b).toString("utf8")})})})}function Gn(){return process.env.XDG_SESSION_TYPE==="wayland"||(process.env.WAYLAND_DISPLAY?.length??0)>0}async function jl(){let e=[];process.platform==="darwin"?e.push({command:"pbpaste",args:[]}):process.platform==="win32"?e.push({command:"powershell.exe",args:["-NoProfile","-Command","Get-Clipboard -Raw"]}):(Gn()&&(e.push({command:"wl-paste",args:["--no-newline","--type","text/plain;charset=utf-8"]}),e.push({command:"wl-paste",args:["--no-newline","--type","text/plain"]}),e.push({command:"wl-paste",args:["--no-newline"]})),((process.env.DISPLAY?.length??0)>0||!Gn())&&(e.push({command:"xclip",args:["-selection","clipboard","-o"]}),e.push({command:"xsel",args:["--clipboard","--output"]})),e.push({command:"termux-clipboard-get",args:[]}));for(let t of e){let n=await Fl(t.command,t.args);if(n.ok&&n.stdout.length>0)return n.stdout}}async function xs(){let e;try{let{getNativeClipboard:r}=await import("@netrodev/hxf-tui");e=r()}catch{e=void 0}if(e)try{let r=await e.getText();if(typeof r=="string"&&r.length>0)return{ok:!0,text:r}}catch{}let t=await jl();return t!==void 0?{ok:!0,text:t}:{ok:!1,reason:`no clipboard tool could read it \u2014 ${Gn()?"install wl-clipboard (wl-paste)":process.platform==="darwin"?"pbpaste should be present on macOS":process.platform==="win32"?"Get-Clipboard should be present on Windows":"install xclip or xsel, or run under a display"}`}}import{spawn as Dl}from"node:child_process";import{mkdirSync as Wl,writeFileSync as Ul}from"node:fs";import{join as Bl}from"node:path";import{getNativeClipboard as Vl}from"@netrodev/hxf-tui";async function _e(e,t,n=4e3){let{promise:r,resolve:o}=Promise.withResolvers(),u=!1,a,g=C=>{u||(u=!0,clearTimeout(a),o(C))},b;try{b=Dl(e,[...t],{stdio:["ignore","pipe","ignore"]})}catch{return g(void 0),r}a=setTimeout(()=>{b.kill("SIGKILL"),g(void 0)},n);let k=[];return b.stdout?.on("data",C=>k.push(C)),b.on("error",()=>g(void 0)),b.on("close",C=>{let _=Buffer.concat(k);g(C===0&&_.length>0?_:void 0)}),r}function Ss(){return process.env.XDG_SESSION_TYPE==="wayland"||(process.env.WAYLAND_DISPLAY?.length??0)>0}function Kl(e){return e.length>8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71}function Gl(e){return e.length>3&&e[0]===255&&e[1]===216&&e[2]===255}async function Hl(){try{let e=await Vl()?.getImage();if(e&&e.length>0)return Buffer.from(e)}catch{}if(process.platform==="darwin"){let e=await _e("pngpaste",["-"]);return e||await _e("osascript",["-e",`set d to the clipboard as \xABclass PNGf\xBB
|
|
2
2
|
return d`])}if(process.platform==="win32"){let e=["Add-Type -AssemblyName System.Windows.Forms","$img = [System.Windows.Forms.Clipboard]::GetImage()","if ($img -ne $null) {"," $ms = New-Object System.IO.MemoryStream"," $img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)"," [Console]::OpenStandardOutput().Write($ms.ToArray(), 0, $ms.Length)","}"].join("; ");return _e("powershell.exe",["-NoProfile","-Command",e])}if(Ss()){let e=await _e("wl-paste",["--type","image/png"]);if(e)return e}if((process.env.DISPLAY?.length??0)>0||!Ss()){let e=await _e("xclip",["-selection","clipboard","-t","image/png","-o"]);if(e)return e;let t=await _e("xclip",["-selection","clipboard","-t","image/jpeg","-o"]);if(t)return t}}function ql(e,t){let n=t==="image/jpeg"?"jpg":"png";return`pasted-${new Date(e).toISOString().replace(/[:.]/g,"-")}.${n}`}async function Hn(e=Bi,t=Date.now()){let n=await Hl();if(!n)return{ok:!1,reason:"the clipboard holds no image"};let r=Kl(n)?"image/png":Gl(n)?"image/jpeg":void 0;if(!r)return{ok:!1,reason:"the clipboard image is not PNG or JPEG"};try{Wl(e,{recursive:!0});let o=Bl(e,ql(t,r));return Ul(o,n,{mode:384}),{ok:!0,image:{path:o,data:n.toString("base64"),mimeType:r}}}catch(o){return{ok:!1,reason:`could not store the image: ${o instanceof Error?o.message:String(o)}`}}}import{TreeSelectorComponent as Fd,initTheme as jd}from"@netrodev/hxf-coding-agent";import{getKeybindings as rl}from"@netrodev/hxf-tui";import{mixColors as zl,parseColor as Yl,styleText as he}from"@netrodev/hxf-tui";var ue=process.env.HOWTOCODE_NO_MOTION!=="1",Jl=45,Cs=5,As=8,qn=1e4,Ts=6e4,Es=3,Ms=4,zn=e=>e<0?0:e>1?1:e;function ke(e,t,n){let r=zn(n);return r>=1?t:r<=0?e:zl(e,t,r)}var Lt=class{value;velocity=0;last=Date.now();target;constructor(t,n=t){this.value=t,this.target=n}set(t){this.target=t}get moving(){return Math.abs(this.target-this.value)>.15}snap(t){this.value=t,this.target=t,this.velocity=0,this.last=Date.now()}step(t=Date.now()){let n=Math.max(0,t-this.last),r=Math.min(250,n)/1e3;if(this.last=t,!ue)return this.value=this.target,this.velocity=0,this.value;n>250&&(this.velocity=0);let o=150,u=2*Math.sqrt(o),a=Math.max(1,Math.ceil(r/.008)),g=r/a;for(let b=0;b<a;b+=1)this.velocity+=(this.target-this.value)*o*g-this.velocity*u*g,this.value+=this.velocity*g;return this.moving||(this.value=this.target,this.velocity=0),this.value}};function Yn(e,t,n,r){return!ue||e<=qn?t:e>=Ts?r:ke(n,r,(e-qn)/(Ts-qn))}function Ps(e,t){return!ue||t<=0||e<0?1:1-(1-zn(e/t))**3}var Rs=260,Xl=45;function Is(e,t,n=Xl,r=400){return!ue||n<=0||e<0||e>=r?t:Math.min(t,Math.floor(e/n)+1)}function _s(e,t,n=Date.now(),r=1400){if(!ue||r<=0)return e;let o=n%r/r;return ke(e,t,o<.5?o*2:(1-o)*2)}function Ot(e,t,n){let r=he(e,{fg:t.rest},de);if(!ue||e.length===0)return r;let o=zn(n);if(o>=1)return r;let u=t.band??1,a=e.length+Ms*2,b=Math.min(a-1,Math.floor(o*a))-Ms,k=K=>{let ee=Math.abs(K-b);return ee>u?0:1-ee/(u+1)},C="",_=0,O=null,F=0,W=0;for(let K of e){let ee=k(W);O===null?O=ee:ee!==O&&(C+=he(e.slice(_,F),{fg:ke(t.rest,t.lit,O)},de),_=F,O=ee),F+=K.length,W+=1}return C+he(e.slice(_),{fg:ke(t.rest,t.lit,O??0)},de)}function Jn(e,t,n=Date.now(),r=90){let o=t[0]??Yl("#e6e6e6");if(t.length===0||e.length===0)return he(e,{fg:o},de);if(!ue||r<=0)return he(e,{fg:t[t.length-1]??o},de);let u=t.length*r,a=(n%u+u)%u,g="",b=0,k=null,C=0,_=0,O=F=>{let W=(a+F*r)/u%1*t.length,K=Math.floor(W)%t.length,ee=(K+1)%t.length;return ke(t[K]??o,t[ee]??o,W-Math.floor(W))};for(let F of e){let W=O(_);k===null?k=W:W!==k&&(g+=he(e.slice(b,C),{fg:k},de),b=C,k=W),C+=F.length,_+=1}return g+he(e.slice(b),{fg:k??o},de)}function Zl(e,t){let n=Math.abs(e-t);return n>=Cs?0:Math.ceil((1-n/Cs)*Es)/Es}function Ls(e,t,n=Date.now()){let r=t.charMs??Jl;if(!ue||e.length===0||r<=0)return he(e,{fg:t.base},de);let o=e.length+As*2,u=n/r%o-As,a=(O,F)=>he(O,{fg:ke(t.base,t.bright,F)},de),g="",b=0,k=null,C=0,_=0;for(let O of e){let F=Zl(_,u);k===null?k=F:F!==k&&(g+=a(e.slice(b,C),k),b=C,k=F),C+=O.length,_+=1}return g+a(e.slice(b),k??0)}import{readFileSync as Ql,statSync as ec}from"node:fs";import{homedir as tc}from"node:os";import{extname as nc}from"node:path";var Xn="\x1B[200~",Zn="\x1B[201~",rc={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp"},Os=10*1024*1024,ic=256*1024,oc=20;function Ns(e){if(!e.startsWith(Xn)||!e.endsWith(Zn))return;let t=e.slice(Xn.length,e.length-Zn.length);if(!(t.includes(Xn)||t.includes(Zn)))return t}function Fs(e){return e.trim()===""}function sc(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")||e.startsWith("/")||e==="~"||e.startsWith("~/")}function ac(e,t=tc()){let n=e.trim();return n.startsWith("file://")&&(n=decodeURIComponent(n.slice(7)),/^\/[a-zA-Z]:\//.test(n)&&(n=n.slice(1))),!/^[a-zA-Z]:[\\/]/.test(n)&&!n.startsWith("\\\\")&&(n=n.replace(/\\([ ()'&])/g,"$1")),n==="~"?t:n.startsWith("~/")?t+n.slice(1):n}function js(e,t){let n=e.trim();if(!n||n.length>8192)return;let r,o=[...n.matchAll(/"([^"]+)"|'([^']+)'/g)].map(a=>a[1]??a[2]??"");if(o.length>0&&n.replace(/"[^"]+"|'[^']+'/g,"").trim()===""?r=o:r=n.split(/\r?\n/).map(a=>a.trim()).filter(a=>a.length>0),r.length===0||r.length>oc||!r.every(a=>sc(a)||a.startsWith("file://")))return;let u=r.map(a=>ac(a));return u.every(t)?u:void 0}function Ds(e){return rc[nc(e).toLowerCase()]}function Ws(e){return`[file ${e}]`}function Qn(e){return`[image ${e}]`}function Us(e,t){return e.replace(/\[file ([^\]\n]+)\]/g,(n,r)=>{let o=t(r);return o===void 0?n:`<file name="${r}">
|
|
3
3
|
${o.trimEnd()}
|
|
4
4
|
</file>`})}function Bs(e){try{let t=ec(e);if(!t.isFile()||t.size===0||t.size>ic)return;let n=Ql(e);return n.includes(0)?void 0:n.toString("utf8")}catch{return}}import{Markdown as Tc,wrapTextWithAnsi as Ec}from"@netrodev/hxf-tui";import{homedir as lc}from"node:os";import{isAbsolute as cc,relative as dc,resolve as uc,sep as Vs}from"node:path";import{getImageDimensions as fc,imageFallback as Ks,renderImage as mc}from"@netrodev/hxf-tui";var pc="\u25CF",nr="\u2514",Ft="\u22EF",er=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function rt(e=1e3/30){let t=Math.floor(Date.now()/e)%er.length;return er[t]??er[0]}var gc="\u25B2";var hc="\u25CB",bc=["create_object","set_properties","delete_object","clone_instance","reparent_instance","set_script_source","edit_script_lines","insert_script_lines","execute_luau","generate_mesh","generate_material","generate_procedural_model"];function rr(e){return e.includes("__")?e.slice(e.lastIndexOf("__")+2):e}function zs(e){return bc.includes(rr(e))}function tt(e,t=process.cwd()){if(!e||!cc(e))return e;let n=uc(e),r=dc(t,n);if(r==="")return".";if(r&&!r.startsWith(`..${Vs}`)&&r!=="..")return r;let o=lc();return o&&(n===o||n.startsWith(o+Vs))?`~${n.slice(o.length)}`:n}function ae(e,t){let n=e.replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,Math.max(1,t-1))}\u2026`:n}function U(e,t){if(e&&typeof e=="object"){let n=e[t];if(typeof n=="string"&&n.length>0)return n;if(typeof n=="number")return String(n)}}function wc(e,t=160){if(!e||typeof e!="object")return"";try{let n=JSON.stringify(e);return n&&n!=="{}"?ae(n,t):""}catch{return""}}function yc(e,t){switch(e){case"read":{let n=tt(U(t,"path")??""),r=[U(t,"offset"),U(t,"limit")].filter(Boolean);return r.length>0?`${n} ${r.length===1?`offset=${r[0]}`:`offset=${r[0]}, limit=${r[1]}`}`:n}case"edit":case"write":return tt(U(t,"path")??"");case"bash":case"powershell":{let n=U(t,"command")??"";return t?.run_in_background===!0?`${n} [background]`:n}case"bash_output":{let n=U(t,"task_id"),r=U(t,"filter");return n?r?`${n} filter=${r}`:n:"all tasks"}case"kill_shell":return U(t,"task_id")??"";case"compress":{let n=U(t,"topic")??"",r=Array.isArray(t.content)?t.content.length:0;return r>1?`${n} (${r} ranges)`:n}case"grep":{let n=U(t,"pattern")??"",r=U(t,"path");return r?`${n} in ${tt(r)}`:n}case"find":case"glob":{let n=U(t,"pattern")??U(t,"glob")??"",r=U(t,"path");return r?`${n} in ${tt(r)}`:n}case"ls":return tt(U(t,"path")??".");case"task":return U(t,"agent")??"task";case"ask":return U(t,"question")??"";case"web_search":return U(t,"query")??"";case"web_fetch":return U(t,"url")??"";case"lsp":{let n=U(t,"action")??"lsp",r=U(t,"file")??"",o=U(t,"line");return o?`${n} ${r}:${o}`:`${n} ${r}`}case"quality":return U(t,"path")??"changed files";case"think":return"private";case"todo":{let n=U(t,"op")??"view",r=U(t,"task"),o=t?.items;return n==="init"&&Array.isArray(o)?`init ${o.length} task${o.length===1?"":"s"}`:r?`${n} ${r}`:n}case"context":{let n=U(t,"op")??"list",r=U(t,"key");return r?`${n} ${r}`:n}case"workflow":{let n=U(t,"path");if(n)return n;let r=U(t,"code")??"",o=/export\s+const\s+meta\s*=\s*\{[\s\S]*?name\s*:\s*["'`]([^"'`]+)/.exec(r)?.[1];if(o)return o;let u=r.trim().split(`
|
|
@@ -140,4 +140,4 @@ plan file: ${Uo()??"(unknown)"}`);return}if(s==="goal"){let d=l.trim();if(!d){m(
|
|
|
140
140
|
${Dn(p)}`);return}if(s==="session"){let d=$.model;m("session",d?`${d.provider}/${d.id}`:"no model");return}if(s==="skills"){m("skills",ws($.resourceLoader.getSkills().skills));return}if(s==="preset"){xi(l);return}if(s==="roblox"){let d=se(e.cwd).entries.find(x=>x.manifest.name==="rotoolbox");if(!d||d.source!=="installed"){m("roblox","RoToolbox is not installed. Run /preset and install RoToolbox first.");return}let p=Sn(d.dir),w=$.getActiveToolNames().filter(x=>/roblox[-_]studio/i.test(x)),h=w.length>0;m("roblox",p?`RoToolbox: disabled
|
|
141
141
|
Enable with /preset enable rotoolbox
|
|
142
142
|
The MCP server and manager stay stopped while disabled.`:["RoToolbox: active",`MCP server: ${h?`connected \u2014 ${w.length} tool${w.length===1?"":"s"} registered`:"not connected yet"}`,"Open Roblox Studio with a place, then use a prompt to inspect it.","Disable with /preset disable rotoolbox"].join(`
|
|
143
|
-
`));return}let f=bs(i,$.resourceLoader.getSkills().skills.map(d=>d.name));if(f){ai(f);return}let y=$.extensionRunner.getCommand(s??"");if(y){try{await y.handler(l,$.extensionRunner.createCommandContext())}catch(d){G(d instanceof Error?d.message:String(d))}return}m("command",`/${s??""} is not available in this screen yet`)};_o((i,s)=>{let{promise:c,resolve:l}=Promise.withResolvers();return j(i,s.map(f=>({value:f,label:f})),l,()=>l("cancelled")),c}),process.on("SIGTERM",Ge),ks(()=>{Ge()}),t.setTitle(`${vn} ${wt}`),Yd(),r.start(),r.requestRender(!0),gn(!0);{let{maybeShowWelcome:i}=await import("./chunk-
|
|
143
|
+
`));return}let f=bs(i,$.resourceLoader.getSkills().skills.map(d=>d.name));if(f){ai(f);return}let y=$.extensionRunner.getCommand(s??"");if(y){try{await y.handler(l,$.extensionRunner.createCommandContext())}catch(d){G(d instanceof Error?d.message:String(d))}return}m("command",`/${s??""} is not available in this screen yet`)};_o((i,s)=>{let{promise:c,resolve:l}=Promise.withResolvers();return j(i,s.map(f=>({value:f,label:f})),l,()=>l("cancelled")),c}),process.on("SIGTERM",Ge),ks(()=>{Ge()}),t.setTitle(`${vn} ${wt}`),Yd(),r.start(),r.requestRender(!0),gn(!0);{let{maybeShowWelcome:i}=await import("./chunk-L6ZXG6ZX.js");await i({cwd:e.cwd,note:e.note,signedIn:be!==void 0,runSlash:s=>{Je(s)},openExternal:s=>{Fe(s)}},j,m)}e.initialPrompt&&hn(e.initialPrompt),await new Promise(()=>{})}var Z,Jd=1e3/30,Xd=45e3;export{Pr as Dock,Er as Hud,Mr as PinnedBlock,Hd as approvalDetail,Gd as infoPanel,_t as orderModelsForDefault,Kd as pickerPanel,Im as runWorkbench,Cr as slashCommands,qd as workflowPanel,Yt as workflowPanelFromRun,Rr as workflowRunOf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as c,d as l}from"./chunk-XODGJSB3.js";import{a as i,b as r}from"./chunk-
|
|
1
|
+
import{b as c,d as l}from"./chunk-XODGJSB3.js";import{a as i,b as r}from"./chunk-OUVT3E6S.js";import{H as s}from"./chunk-5FIFNXLT.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";var d=[["/connect","sign in to howtofix.id: approve it in your browser"],["/model","choose which model answers"],["/help","list every command"],["/quit","leave"]],u=[" \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557"," \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D"," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2557 "," \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u255D "," \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u255D \u2588\u2588\u2557\u2588\u2588\u2551 "," \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D "],g=[" _ _ _____ ","| | | | __ __ | ___|","| |_| | \\ \\/ / | |_ ","| _ | > < | _| ","|_| |_| /_/\\_\\ |_| "];function m(){if(process.platform==="win32")return!1;let e=(process.env.LC_ALL||process.env.LC_CTYPE||process.env.LANG||"").toLowerCase();return e===""||e==="c"||e==="posix"||!e.includes("utf-8")&&!e.includes("utf8")?!1:!/ja|ko|zh|_kr|_jp|_cn|_tw|_hk/.test(e)}function h(){return m()?u:g}var _="https://howtofix.id/cli";function p(e){let n=process.env.HOME??"",t=n!==""&&e.startsWith(n)?`~${e.slice(n.length)}`:e,o=t.split("/").filter(Boolean);return o.length>3?`\u2026/${o.slice(-2).join("/")}`:t}function f(e){let n=e.signedIn?d.filter(([t])=>t!=="/connect"):d;return[...h(),"",`${i} ${r} \u2014 a terminal coding agent. Describe the change you want and it reads, edits and runs the code in front of you.`,"",` working in ${p(e.cwd)}`,...e.note?[` session ${e.note}`]:[],"",...e.signedIn?[" already signed in to howtofix.id",""]:[],...n.map(([t,o])=>` ${t.padEnd(11)}${o}`),"",' Or just start typing. Every message goes to the model; anything beginning with "/" stays local.'].join(`
|
|
2
2
|
`)}function v(){return[{value:"connect",label:"Sign in to howtofix.id",description:"approve the sign-in in your browser"},{value:"ready",label:"I have a key \u2014 just give me the prompt",description:"drops you at the prompt; run /connect whenever you like"},{value:"release",label:"What's in this release",description:`opens the ${r} notes in your browser`}]}async function E(e,n,t){c(s).welcomeSeen||(l(s),t(`welcome to ${i}`,f(e)),!e.signedIn&&await new Promise(o=>{n("First run \u2014 how do you want to begin?",v(),a=>{a==="connect"&&e.runSlash("/connect"),a==="release"&&e.openExternal(_),o()},()=>o())}))}export{E as maybeShowWelcome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i}from"./chunk-
|
|
1
|
+
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i}from"./chunk-UA2AUPJX.js";import"./chunk-Q2GQPEUC.js";import"./chunk-OUVT3E6S.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{b as CLI_REFRESH_SKEW_MS,c as accessTokenIsFresh,g as clearCliCredential,a as cliCredentialsPath,e as readCliCredential,h as refreshCliCredential,d as refreshTokenIsUsable,i as renewCliCredentialIfNeeded,f as writeCliCredential};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as j}from"./chunk-MCAAX33K.js";import{a as b}from"./chunk-
|
|
1
|
+
import{b as j}from"./chunk-MCAAX33K.js";import{a as b}from"./chunk-OUVT3E6S.js";import{H as m,N as A}from"./chunk-5FIFNXLT.js";import"./chunk-UTYFLLSM.js";import{j as R}from"./chunk-MVVEYKN6.js";import{b as M,d as T,f as D}from"./chunk-TUXY64DT.js";import{a as I}from"./chunk-FABEBOGV.js";import"./chunk-WOT6VMZA.js";import{spawnSync as J}from"node:child_process";import{existsSync as S,readdirSync as E,readFileSync as x,realpathSync as B,statSync as C,writeFileSync as F,unlinkSync as z}from"node:fs";import{dirname as N,join as p}from"node:path";var k=[22,19];async function W(t="https://api.howtofix.id/api/status"){let n=[],[s,e]=process.versions.node.split(".").map(Number),r=s>k[0]||s===k[0]&&e>=k[1];n.push({name:"node",ok:r,detail:`${process.versions.node} (needs >= ${k[0]}.${k[1]})`});let i=J("git",["--version"],{encoding:"utf8"});n.push({name:"git",ok:i.status===0,detail:i.status===0?i.stdout.trim():"not found on PATH"});let o=I();n.push({name:"sandbox",ok:!!o,detail:o??"no working bubblewrap (Linux) or sandbox-exec (macOS); --sandbox unavailable",optional:!0});let l=!1,c=m;try{let d=p(m,`.doctor-${process.pid}`);F(d,"ok"),z(d),l=!0}catch(d){c=`${m} is not writable: ${d instanceof Error?d.message:String(d)}`}n.push({name:"state dir",ok:l,detail:c});let a=p(m,"auth.json"),u="no auth.json \u2014 run `howtocode` and sign in",h=!1;try{let d=JSON.parse(x(a,"utf8")),f=Object.keys(d).length;h=f>0,u=h?`${f} provider credential${f===1?"":"s"}`:u}catch{}n.push({name:"auth",ok:h,detail:u,optional:!0});try{let d=Date.now(),f=await fetch(t,{signal:AbortSignal.timeout(5e3)});n.push({name:"gateway",ok:f.ok,detail:`${t} \u2192 ${f.status} in ${Date.now()-d}ms`,optional:!0})}catch(d){n.push({name:"gateway",ok:!1,detail:`${t} unreachable: ${d instanceof Error?d.message:String(d)}`,optional:!0})}return n.push(G()),n}function G(t=q()){if(t===void 0)return{name:"install",ok:!0,detail:"not an npm install; skipped",optional:!0};if(!S(t))return{name:"install",ok:!0,detail:"no bundled dependencies to check",optional:!0};let n=[],s=0;for(let e of["@netrodev"]){let r=p(t,e);if(S(r))for(let i of E(r)){let o=p(r,i,"dist");if(S(o))for(let l of _(o)){s+=1;let c=x(l,"utf8");for(let a of c.matchAll(/import\("(\.[^"]+)"\)/g)){let u=p(N(l),a[1]);S(u)||n.push(`${e}/${i}: ${u.slice(o.length+1)}`)}}}}return n.length>0?{name:"install",ok:!1,detail:`${n.length} module${n.length===1?"":"s"} missing (${n[0]}); reinstall with \`npm install -g howtocode@latest\``}:{name:"install",ok:!0,detail:`${s} lazy module${s===1?"":"s"} present`}}function q(){try{return p(N(N(B(process.argv[1]??""))),"node_modules")}catch{return}}function _(t,n=[]){let s;try{s=E(t)}catch{return n}for(let e of s){let r=p(t,e);if(e.endsWith(".lazy.js"))n.push(r);else if(!e.includes("."))try{C(r).isDirectory()&&_(r,n)}catch{}}return n}async function ie(){let t=await W(),n=Math.max(...t.map(e=>e.name.length));for(let e of t){let r=e.ok?"ok ":e.optional?"warn":"FAIL";console.log(` ${r} ${e.name.padEnd(n)} ${e.detail}`)}let s=t.filter(e=>!e.ok&&!e.optional);return s.length>0?(console.log(`
|
|
2
2
|
${s.length} problem${s.length===1?"":"s"} must be fixed before a session will work.`),1):0}function ce(t=m){let n=p(t,"models.json"),s;try{s=x(n,"utf8")}catch(a){return a.code==="ENOENT"?console.log(` no models.json at ${n} \u2014 run \`howtocode /connect\` to pull the catalogue`):j(b,"models",a),1}let e;try{e=JSON.parse(s)}catch(a){return console.error(`${b}: models: ${n} is not valid JSON (${a instanceof Error?a.message:String(a)})`),console.error(" fix the file, or delete it and run `howtocode /connect` to write a new one"),1}let r=e.providers??{},i=D(A),o=i?new Set(i.ids):void 0,l=new Set,c=0;for(let[a,u]of Object.entries(r)){let h=u.models??[],d=h.map(f=>f.id).filter(Boolean);for(let f of d)l.add(f);c+=d.length,console.log(` ${a} (${d.length})`);for(let f of h){if(!f.id)continue;let O=T(m).get(f.id),$=M(O??[]),g=$?` ${$}`:"",w=o&&!o.has(f.id)?" \u2014 not on this account":"";console.log(` ${f.id}${g}${w}`)}}if(o){let a=[...l].filter(u=>!o.has(u)).length;console.log(`
|
|
3
3
|
${[...o].filter(u=>l.has(u)).length} of ${c} listed model(s) this account can call${a>0?`; ${a} cannot (kept for other plans)`:""}`)}else console.log("\n which of these this account can call is unknown: run `howtocode` once to record it");return c===0?(console.log(" no models configured"),1):0}function v(t=15,n=m){let s=p(n,"sessions"),e;try{e=E(s)}catch{return[]}let r=[];for(let i of e){let o=p(s,i),l;try{l=E(o)}catch{continue}for(let c of l){if(!c.endsWith(".jsonl"))continue;let a=p(o,c);try{let u=C(a);r.push({file:a,project:i,modified:u.mtimeMs,bytes:u.size})}catch{}}}return r.sort((i,o)=>o.modified-i.modified).slice(0,t)}function le(t){let n=t.indexOf("--search");if(n>=0){let o=t[n+1]?.trim();if(!o)return console.error(`${b}: sessions: --search needs a word or phrase`),2;let l=K(o);if(l.length===0)return console.log(` no session mentions "${o}"`),0;for(let c of l){let a=new Date(c.row.modified).toISOString().replace("T"," ").slice(0,16),u=`${c.matches} hit${c.matches===1?"":"s"}`;console.log(` ${a} ${c.row.project} (${u})`),console.log(` ${c.row.file}`),console.log(` ${c.snippet}`)}return 0}let s=t.indexOf("--limit"),e=s>=0&&Number(t[s+1])||15,r=v(e);if(r.length===0)return console.log(` no saved sessions under ${p(m,"sessions")}`),t.includes("--export")?1:0;let i=t.indexOf("--export");if(i>=0){let o=Number(t[i+1]);if(!Number.isInteger(o)||o<1||o>r.length)return console.error(`${b}: sessions: --export needs a number from the list (1-${r.length})`),2;let l=r[o-1];try{console.log(Q(l.file))}catch(c){return j(b,"sessions",c),1}return 0}return r.forEach((o,l)=>{let c=new Date(o.modified).toISOString().replace("T"," ").slice(0,16),a=Math.round(o.bytes/1024);console.log(` ${String(l+1).padStart(2)} ${c} ${String(a).padStart(6)}k ${o.project}`),console.log(` ${o.file}`)}),0}function H(t){let n=t;try{let s=JSON.parse(t),e=s.message?.content??s.content;if(typeof e=="string"&&e.trim())n=e;else if(Array.isArray(e)){let r=e.map(i=>i&&typeof i=="object"&&"text"in i?String(i.text):"").join(" ");r.trim()&&(n=r)}}catch{}return R(X(n).replace(/\s+/g," ").trim())}function X(t){return t.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007]*\u0007|\u001b[@-Z\\-_]/g,"")}function Z(t,n,s=80){let e=t.toLowerCase().indexOf(n);if(e<0)return t.slice(0,s*2).trim();let r=Math.max(0,e-s),i=Math.min(t.length,e+n.length+s);return`${r>0?"\u2026":""}${t.slice(r,i).trim()}${i<t.length?"\u2026":""}`}function K(t,n=10,s=m){let e=t.toLowerCase(),r=new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i"),i=[];for(let o of v(Number.MAX_SAFE_INTEGER,s)){let l;try{l=x(o.file,"utf8")}catch{continue}let c=0,a=0,u=0,h=0,d=!1,f="";for(let $ of l.split(`
|
|
4
4
|
`)){let g=$.toLowerCase(),w=g.indexOf(e);if(w<0)continue;let y=0;for(;w>=0;)y++,w=g.indexOf(e,w+e.length);c+=y;let L=g.includes('"role":"user"'),P=g.includes('"role":"toolresult"')||g.includes('"role":"tool"');L?a+=y:P?h+=y:u+=y,r.test($)&&(d=!0),f||(f=Z(H($),e))}if(c===0)continue;let O=(a>0?100:0)+(u>0?10:0)+Math.min(h,5)+(d?5:0)+Math.min(c,10)/100;i.push({row:o,matches:c,score:O,snippet:f})}return i.sort((o,l)=>l.score-o.score||l.row.modified-o.row.modified).slice(0,n)}function Q(t){let n=[`# Session ${t.split(/[\\/]/).pop()??t}`,""];for(let s of x(t,"utf8").split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var a="HowToCode",o="0.7.
|
|
1
|
+
var a="HowToCode",o="0.7.77",n=["You are HowToCode, a coding agent. The user wants the fix, not a tour of the problem.",'NEVER report a check you did not run. NEVER state a version, path, result or capability you have not verified \u2014 if you did not check it, say you are unsure. "Not found" is not "impossible": a tool missing from PATH is often installed anyway, and one that is truly absent can usually be installed. Exhaust the real options before calling anything unavailable; when you do report a limit, say plainly what you tried and what you could not do. Unexercised behaviour is not evidence.',"NEVER mention the underlying harness, its vendor or its project name to the user.","Every tool is `read`, `write` or `exec`, and each approval mode auto-approves every tier up to its own: `suggest` runs `read` only, `auto-edit` adds `write`, `full-auto` adds `exec`. A read-only shell command runs in every mode, so inspecting the tree asks nothing.","NEVER aim a command at the filesystem root, a block device or a system account file, and NEVER shut down the host: those are refused in EVERY mode, `full-auto` included, so proposing one wastes the turn. This is not a list of things to avoid \u2014 it is a list of things that will not run.","Lead with the diagnosis in one or two sentences, then change the code. SHOULD prefer the smallest correct change over a rewrite. Name the file and the reason in a short line; do not narrate tool calls.","Fix the problem that was asked for. NEVER add features, refactors, validation, error handling or dependencies nobody requested.","Something reported broken: reproduce it first, confirm the fix after. Cannot reproduce it? Say so \u2014 NEVER edit code and call it fixed.","Tests describe intended behaviour. A failing test means fix the code, not the test: NEVER delete, skip or loosen an assertion to get green, and NEVER re-pin an expected value to whatever the code happens to print.","Anything you cannot settle by reading \u2014 a page, a layout, a screenshot, a CLI, a service, a failure \u2014 run it and look at the result. For a visual task, find a browser the way a real one does: `$PUPPETEER_EXECUTABLE_PATH`, `$CHROME_PATH`, then `which` for google-chrome, chromium and chromium-browser, then /usr/bin, /snap/bin and /var/lib/flatpak, then the puppeteer and playwright caches under the home directory. Still empty? `npx -y puppeteer browsers install chrome`, or `npm i puppeteer-core` against a chrome the image already ships outside PATH. Then drive the real artifact \u2014 open it, read the DOM, click the controls, measure at the widths that matter \u2014 instead of describing what you assume it does.","Done means the requested behaviour works end to end and every stated requirement is met \u2014 not a scaffold, a narrowed test or a plausible subset. Genuinely out of reach? Finish everything else, then say exactly what is missing and what you tried.","SHOULD plan multi-step work with `todo` before starting it, and mark each step done as you finish. A plan the user can see is worth more than a narration of what you are about to do.","Genuinely ambiguous design: enter plan mode, write the plan to the plan file, then present it with `exit_plan_mode`. Use it when several reasonable approaches exist or when a restructuring would be hard to undo. In plan mode `edit` and `write` are refused for every path except the plan file itself \u2014 that limit is enforced, not advisory, so plan the work rather than starting it. Plan mode needs an interactive session in which the user can approve it; when there is no UI it is unavailable, so design the approach yourself instead of calling it.","Work that is independent and would flood this conversation belongs in `task` subagents. Give each a self-contained assignment, then verify the file it wrote rather than trusting its summary. When that work has a shape you can script \u2014 many items through the same stages, or fan-out whose results must be combined \u2014 `workflow` states the orchestration in one place and runs it deterministically; `task` is for the one-off you cannot describe in advance.","MUST give each subagent a self-contained assignment: a child starts with none of this conversation, so a brief that says 'the file we discussed' reaches it as nothing. Choose the agent by what the work is \u2014 scout looks something up, architect returns a plan, reviewer reports issues with file evidence, task changes files \u2014 and NEVER send work that needs an edit to scout or reviewer, because neither can make one.","SHOULD delegate only work that is genuinely parallel: a subagent costs its own session and its own requests on the same quota as this conversation. A single lookup, a file you can read yourself, or a step whose result decides the next step stays here. MUST keep one call to at most six agents and the session to twelve live or parked ones \u2014 a larger fan-out is refused, and the refusal is a limit rather than a failure to work around.","Record a decision, a file's role, or a fact you would otherwise re-derive with `context`: notes survive compaction and are visible to the other agents on the task.","Look it up instead of recalling it: `web_search` and `web_fetch` for anything outside this repo, `lsp` for a definition, reference or diagnostic. Name the source you checked.","Before calling changed code done, run `quality` and `slop` over it and act on what they report. A metric you did not measure is a claim you cannot make.","A command runs under a two-minute default timeout. MUST pass a longer timeout for anything that legitimately takes more than that \u2014 a recursive directory walk, a package install, a build, a network fetch \u2014 and SHOULD prefer a bounded command to an unbounded one: 'du -sh' with an explicit path beats the whole profile, and on Windows/MSYS a recursive 'du' over a profile directory takes minutes rather than seconds.","When a choice blocks the task, use `ask` instead of guessing; when you need to work something out, use `think`, whose text stays out of the transcript.","Above all: NEVER claim a check you did not run, and NEVER call done on a subset."].join(`
|
|
2
2
|
`);function s(e){return e===void 0?void 0:e.replace(/Use \/login to log into a provider[^\n]*/gi,"Connect a provider with /connect or /login:").replace(/^[ \t]*\S*hxf-coding-agent[\\/]docs[\\/][^\n]*$/gim,"").replace(/\bhxf-coding-agent\b/gi,"the harness").replace(/\n{3,}/g,`
|
|
3
3
|
|
|
4
4
|
`).trim()}var i=["# Project notes","","## What this is","","## Commands","- build:","- test:","","## Conventions","-",""].join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
1
|
+
import{b as o}from"./chunk-OUVT3E6S.js";import{createPrivateKey as p,createPublicKey as f,createHash as l,randomBytes as d,sign as y}from"node:crypto";import{arch as c,cpus as m,hostname as I,platform as s}from"node:os";var a="hf-cli-1",C="MC4CAQAwBQYDK2VwBCIEIDmKoNgInS7oDpncee1d1+Mnci1R/q4aE5xxHeCKq4Dc",x="howtocode-cli-auth-v1",i;function u(){return i||(i=p({key:Buffer.from(C,"base64"),format:"der",type:"pkcs8"})),i}function g(){return f(u())}function K(t,e,n,r){return Buffer.from([x,t,e,n,r].join(`
|
|
2
2
|
`),"utf8")}function h(){return d(16).toString("hex")}var E="tQ91uspGl0sw5Y8x+soLYnFNX6a9vEzSzCuuvalzdKk=";function P(){let t=g().export({format:"der",type:"spki"});return t.subarray(t.length-32).toString("base64")===E}function N(){let t=g().export({format:"der",type:"spki"});return l("sha256").update(t).digest("hex").slice(0,16)}function $(){let e=(m()[0]?.model??"").replace(/\s+/g," ").trim(),n=I(),r=e?`${n} (${s()}/${c()}, ${e})`:`${n} (${s()}/${c()})`;return`CLI (${o}, ${r})`}var k="X-HowToCode-Client";function A(){return`CLI (${o})`}function B(t,e){let n=h(),r=y(null,K(a,t,e,n),u());return{keyId:a,nonce:n,signature:r.toString("base64")}}export{a,g as b,K as c,h as d,P as e,N as f,$ as g,k as h,A as i,B as j};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as T,j as R}from"./chunk-DQZCH2E4.js";import{a as P}from"./chunk-UTYFLLSM.js";import{existsSync as z,readFileSync as ye,rmSync as xe}from"node:fs";import{join as ve}from"node:path";import{createHash as q,randomBytes as J}from"node:crypto";import{createServer as ne}from"node:http";import{execFileSync as X}from"node:child_process";import{createHmac as Q}from"node:crypto";import{readFileSync as ee}from"node:fs";import{arch as F,cpus as M,hostname as N,platform as v,userInfo as O}from"node:os";var te="howtocode-cli-hwid-v1";function x(e){try{let t=ee(e,"utf8").trim();return t.length>0?t:void 0}catch{return}}function $(e,t){try{let r=X(e,t,{encoding:"utf8",timeout:3e3,stdio:["ignore","pipe","ignore"]});return r.trim().length>0?r.trim():void 0}catch{return}}function re(){let e=v();if(e==="linux"){let t=x("/etc/machine-id");if(t)return{value:t,source:"machine-id",strong:!0};let r=x("/var/lib/dbus/machine-id");if(r)return{value:r,source:"dbus-machine-id",strong:!0};let o=x("/sys/class/dmi/id/product_uuid");return o?{value:o,source:"dmi-product-uuid",strong:!0}:void 0}if(e==="win32"){let r=$("reg",["query","HKLM\\SOFTWARE\\Microsoft\\Cryptography","/v","MachineGuid"])?.match(/MachineGuid\s+REG_SZ\s+(\S+)/i);return r?.[1]?{value:r[1],source:"windows-machine-guid",strong:!0}:void 0}if(e==="darwin"){let r=$("ioreg",["-rd1","-c","IOPlatformExpertDevice"])?.match(/"IOPlatformUUID"\s*=\s*"([^"]+)"/);return r?.[1]?{value:r[1],source:"platform-uuid",strong:!0}:void 0}}function H(){let e=re(),t=e?.value??[N(),v(),F(),O().username].join("\0"),r=e?.source??"hostname";return{id:Q("sha256",te).update(t).digest("hex").slice(0,32),source:r,strong:e?.strong??!1}}function U(e){return[e.id,e.source,N(),v(),F(),O().username,String(M().length),M()[0]?.model??""]}var _="https://howtofix.id",se=300*1e3,G=3e3,K="/callback";function I(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function oe(){return I(J(32))}function ie(e){return I(q("sha256").update(e).digest())}function ae(){return I(J(16))}var ce="howtocode-cli-",ue="x-howtocode-client",le="cli";function L(e){let t=e??U(H());return ce+q("sha256").update(t.join("\0")).digest("hex").slice(0,32)}function de(){return{"content-type":"application/json",[ue]:le}}var fe=()=>new Promise((e,t)=>{let r=ne();r.once("error",t),r.listen(0,"127.0.0.1",()=>{let{port:o}=r.address();e({port:o,close:()=>r.close(),waitForCode:(n,s)=>new Promise((i,a)=>{let c=(l,f)=>{let h=new URL(l.url??"/","http://127.0.0.1");if(h.pathname!==K){f.writeHead(404).end("not found");return}let y=(V,Z)=>f.writeHead(200,{"content-type":"text/html; charset=utf-8"}).end(`<!doctype html><meta charset="utf-8"><h2>${V}</h2><p>${Z}</p>`),S=h.searchParams.get("error")??"",E=h.searchParams.get("code")??"",Y=h.searchParams.get("state")??"";if(S){y("Sign-in was refused","You can close this tab."),u(new Error(`the browser reported: ${S}`));return}if(!E||Y!==n){y("This callback did not belong to the login","You can close this tab."),u(new Error("the callback carried the wrong state"));return}y("Signed in","You can close this tab and go back to HowToCode."),u(void 0,E)},u=(l,f)=>{r.off("request",c),s?.removeEventListener("abort",g),l?a(l):i(f)},g=()=>u(new Error("cancelled"));s?.addEventListener("abort",g,{once:!0}),r.on("request",c)})})})});function k(e,t){e.onProgress?.(t)}async function p(e,t,r,o){let n=await e(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r),signal:o}),s={};try{s=await n.json()}catch{}let i=Number(n.headers?.get?.("retry-after"));return{status:n.status,body:s,retryAfterSeconds:Number.isFinite(i)&&i>0?i:void 0}}function d(...e){for(let t of e)if(typeof t=="string"&&t.trim()!=="")return t.trim()}function j(...e){for(let t of e)if(typeof t=="number"&&Number.isFinite(t))return t;return 0}function me(e){try{let t=new URL(e).searchParams.get("code");return t&&t.trim()!==""?t.trim():void 0}catch{return}}async function ge(e,t,r){let o=await e(t,{headers:de(),signal:r}),n={};try{n=await o.json()}catch{}let s=Number(o.headers?.get?.("retry-after"));return{status:o.status,body:n,retryAfterSeconds:Number.isFinite(s)&&s>0?s:void 0}}function A(e){let t=e.data,r=[e.token,e.api_key,e.apiKey,e.key,t?.token,t?.api_key,t?.apiKey,t?.key];for(let o of r)if(typeof o=="string"&&o.trim().startsWith("sk-"))return o.trim()}function pe(e){let t=e.data,r=d(e.token,t?.token),o=d(e.refresh_token,t?.refresh_token),n=d(e.device_id,t?.device_id);if(!r||!o||!n)return;let s=j(e.access_expires_at,t?.access_expires_at),i=j(e.refresh_expires_at,t?.refresh_expires_at);return{accessToken:r,accessExpiresAt:s,refreshToken:o,deviceId:n,refreshExpiresAt:i}}function m(e,t){let r=e.message??e.error;return typeof r=="string"&&r.trim()?r.trim():t}async function He(e){let t=e.fetchImpl??fetch,r=(e.panelUrl??_).replace(/\/+$/,""),o=e.timeoutMs??se,n={...e,panel:r,fetchImpl:t,timeoutMs:o},s=await ke(n);if(s.ok||s.terminal)return s.result;let i=await he(n);if(i.ok||i.terminal)return i.result;let a=await we(n);return a.ok?a:{ok:!1,message:`${s.result.ok?"":s.result.message}; ${i.result.ok?"":i.result.message}; ${a.message}. howtofix.id does not offer a browser login a local client can complete yet \u2014 run /connect and paste a token from ${r}/keys instead.`}}async function he(e){let t=oe(),r=ae(),o;try{o=await(e.loopback??fe)();let n=`http://127.0.0.1:${o.port}${K}`,s=await p(e.fetchImpl,`${e.panel}/api/oauth/device/start`,{redirect_uri:n,code_challenge:ie(t),code_challenge_method:"S256",state:r},e.signal);if(s.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no loopback login endpoint"}};if(s.status>=400)return{ok:!1,terminal:!1,result:{ok:!1,message:m(s.body,`the panel refused the login (${s.status})`)}};let i=typeof s.body.authorize_url=="string"?s.body.authorize_url:"";if(!i)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not say where to send the browser"}};k(e,{kind:"browser",url:i});let a=await be(o.waitForCode(r,e.signal),e.timeoutMs),c=await p(e.fetchImpl,`${e.panel}/api/oauth/device/token`,{flow_token:s.body.flow_token,code:a,code_verifier:t},e.signal);if(c.status>=400)return{ok:!1,terminal:!0,result:{ok:!1,message:m(c.body,`the panel refused the exchange (${c.status})`)}};let u=A(c.body);return u?{ok:!0,result:{ok:!0,token:u}}:{ok:!1,terminal:!0,result:{ok:!1,message:"the panel did not return an API key"}}}catch(n){let s=n instanceof Error?n.message:String(n);return{ok:!1,terminal:s==="cancelled",result:{ok:!1,message:s}}}finally{o?.close()}}async function ke(e){let t=e.fingerprintId??L(),r=e.clientInfo??T(),o=R(t,r);try{let n=await p(e.fetchImpl,`${e.panel}/api/auth/cli/code`,{fingerprintId:t,clientInfo:r,...o},e.signal);if(n.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no CLI login endpoint"}};if(n.status===401)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not recognise this build as the HowToCode CLI \u2014 update it with `npm install -g howtocode@latest`"}};if(n.status===429)return{ok:!1,terminal:!0,result:{ok:!1,message:`too many sign-in attempts from this machine right now.${n.retryAfterSeconds?` Try again in ${Math.ceil(n.retryAfterSeconds/60)} minute(s).`:""}`}};if(n.status>=400)return{ok:!1,terminal:!1,result:{ok:!1,message:m(n.body,`the panel refused the login (${n.status})`)}};let s=n.body.data??{},i=d(n.body.login_url,s.login_url),a=d(n.body.code,s.code)??(i?me(i):void 0),c=d(n.body.secret,s.secret);return!i||!a?{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not return a login URL"}}:c?(k(e,{kind:"browser",url:i}),await D(e,a,c)):(k(e,{kind:"browser",url:i}),await D(e,a,void 0))}catch(n){let s=n instanceof Error?n.message:String(n);return{ok:!1,terminal:s==="cancelled",result:{ok:!1,message:s}}}}async function D(e,t,r){let o=e.pollIntervalMs??G,n=Date.now()+e.timeoutMs;for(;Date.now()<n;){await w(o,e.signal);let s=new URLSearchParams(r?{code:t,secret:r}:{code:t});s.set("capability","device-refresh");let i=await ge(e.fetchImpl,`${e.panel}/api/auth/cli/status?${s}`,e.signal);if(i.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no CLI login status endpoint"}};if(i.status===403)return{ok:!1,terminal:!0,result:{ok:!1,message:"the panel rejected this poll \u2014 run /connect again"}};if(i.status===429){let u=Math.min(Math.max(i.retryAfterSeconds??5,1)*1e3,3e4);await w(u,e.signal);continue}let a=A(i.body);if(a)return{ok:!0,result:{ok:!0,token:a,credential:pe(i.body)}};if(d(i.body.data?.status,i.body.status)==="expired")return{ok:!1,terminal:!0,result:{ok:!1,message:"the sign-in link expired before it was approved"}};if(i.status>=400)return{ok:!1,terminal:!0,result:{ok:!1,message:m(i.body,`the panel refused the poll (${i.status})`)}}}return{ok:!1,terminal:!0,result:{ok:!1,message:"the sign-in was not approved in time"}}}async function we(e){let t=e.pollIntervalMs??G;try{let r=await p(e.fetchImpl,`${e.panel}/api/oauth/device`,{},e.signal);if(r.status===404)return{ok:!1,message:"the panel has no device-code endpoint"};if(r.status>=400)return{ok:!1,message:m(r.body,`the panel refused the request (${r.status})`)};let o=typeof r.body.device_code=="string"?r.body.device_code:"",n=typeof r.body.user_code=="string"?r.body.user_code:"",s=typeof r.body.verification_uri=="string"?r.body.verification_uri:`${e.panel}/oauth/device`;if(!o||!n)return{ok:!1,message:"the panel did not return a code to show"};k(e,{kind:"code",code:n,url:s});let i=Date.now()+e.timeoutMs;for(;Date.now()<i;){await w(t,e.signal);let a=await p(e.fetchImpl,`${e.panel}/api/oauth/device/poll`,{device_code:o},e.signal);if(a.status===404)return{ok:!1,message:"the panel has no device-code poll endpoint"};let c=typeof a.body.status=="string"?a.body.status:"";if(c==="pending")continue;if(c==="slow_down"){await w(t,e.signal);continue}if(c==="denied")return{ok:!1,message:"the sign-in was refused in the browser"};if(c==="expired")return{ok:!1,message:"the code expired; run /connect again"};let u=A(a.body);if(u)return{ok:!0,token:u};if(a.status>=400)return{ok:!1,message:m(a.body,`the panel refused the poll (${a.status})`)}}return{ok:!1,message:"the code was not approved in time"}}catch(r){return{ok:!1,message:r instanceof Error?r.message:String(r)}}}function be(e,t){return new Promise((r,o)=>{let n=setTimeout(()=>o(new Error("the sign-in was not finished in time")),t);e.then(s=>{clearTimeout(n),r(s)},s=>{clearTimeout(n),o(s)})})}function w(e,t){return new Promise((r,o)=>{let n=setTimeout(r,e);t?.addEventListener("abort",()=>{clearTimeout(n),o(new Error("cancelled"))},{once:!0})})}function b(e){return ve(e,"cli-credentials.json")}var _e=300*1e3;function Ie(e,t=Date.now()){return e.accessToken?!Number.isFinite(e.accessExpiresAt)||e.accessExpiresAt<=0?!0:e.accessExpiresAt*1e3-_e>t:!1}function Le(e,t=Date.now()){return!e.refreshToken||!e.deviceId?!1:!Number.isFinite(e.refreshExpiresAt)||e.refreshExpiresAt<=0?!0:e.refreshExpiresAt*1e3>t}function Ge(e){let t=b(e);if(!z(t))return;let r;try{r=JSON.parse(ye(t,"utf8"))}catch{return}if(!r||typeof r!="object"||Array.isArray(r))return;let o=r,n=typeof o.accessToken=="string"?o.accessToken.trim():"",s=typeof o.refreshToken=="string"?o.refreshToken.trim():"",i=typeof o.deviceId=="string"?o.deviceId.trim():"";if(!(!n||!s||!i))return{accessToken:n,accessExpiresAt:W(o.accessExpiresAt),refreshToken:s,deviceId:i,refreshExpiresAt:W(o.refreshExpiresAt)}}function Ae(e,t){try{return P(b(e),`${JSON.stringify(t,null,2)}
|
|
1
|
+
import{g as T,j as R}from"./chunk-Q2GQPEUC.js";import{a as P}from"./chunk-UTYFLLSM.js";import{existsSync as z,readFileSync as ye,rmSync as xe}from"node:fs";import{join as ve}from"node:path";import{createHash as q,randomBytes as J}from"node:crypto";import{createServer as ne}from"node:http";import{execFileSync as X}from"node:child_process";import{createHmac as Q}from"node:crypto";import{readFileSync as ee}from"node:fs";import{arch as F,cpus as M,hostname as N,platform as v,userInfo as O}from"node:os";var te="howtocode-cli-hwid-v1";function x(e){try{let t=ee(e,"utf8").trim();return t.length>0?t:void 0}catch{return}}function $(e,t){try{let r=X(e,t,{encoding:"utf8",timeout:3e3,stdio:["ignore","pipe","ignore"]});return r.trim().length>0?r.trim():void 0}catch{return}}function re(){let e=v();if(e==="linux"){let t=x("/etc/machine-id");if(t)return{value:t,source:"machine-id",strong:!0};let r=x("/var/lib/dbus/machine-id");if(r)return{value:r,source:"dbus-machine-id",strong:!0};let o=x("/sys/class/dmi/id/product_uuid");return o?{value:o,source:"dmi-product-uuid",strong:!0}:void 0}if(e==="win32"){let r=$("reg",["query","HKLM\\SOFTWARE\\Microsoft\\Cryptography","/v","MachineGuid"])?.match(/MachineGuid\s+REG_SZ\s+(\S+)/i);return r?.[1]?{value:r[1],source:"windows-machine-guid",strong:!0}:void 0}if(e==="darwin"){let r=$("ioreg",["-rd1","-c","IOPlatformExpertDevice"])?.match(/"IOPlatformUUID"\s*=\s*"([^"]+)"/);return r?.[1]?{value:r[1],source:"platform-uuid",strong:!0}:void 0}}function H(){let e=re(),t=e?.value??[N(),v(),F(),O().username].join("\0"),r=e?.source??"hostname";return{id:Q("sha256",te).update(t).digest("hex").slice(0,32),source:r,strong:e?.strong??!1}}function U(e){return[e.id,e.source,N(),v(),F(),O().username,String(M().length),M()[0]?.model??""]}var _="https://howtofix.id",se=300*1e3,G=3e3,K="/callback";function I(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function oe(){return I(J(32))}function ie(e){return I(q("sha256").update(e).digest())}function ae(){return I(J(16))}var ce="howtocode-cli-",ue="x-howtocode-client",le="cli";function L(e){let t=e??U(H());return ce+q("sha256").update(t.join("\0")).digest("hex").slice(0,32)}function de(){return{"content-type":"application/json",[ue]:le}}var fe=()=>new Promise((e,t)=>{let r=ne();r.once("error",t),r.listen(0,"127.0.0.1",()=>{let{port:o}=r.address();e({port:o,close:()=>r.close(),waitForCode:(n,s)=>new Promise((i,a)=>{let c=(l,f)=>{let h=new URL(l.url??"/","http://127.0.0.1");if(h.pathname!==K){f.writeHead(404).end("not found");return}let y=(V,Z)=>f.writeHead(200,{"content-type":"text/html; charset=utf-8"}).end(`<!doctype html><meta charset="utf-8"><h2>${V}</h2><p>${Z}</p>`),S=h.searchParams.get("error")??"",E=h.searchParams.get("code")??"",Y=h.searchParams.get("state")??"";if(S){y("Sign-in was refused","You can close this tab."),u(new Error(`the browser reported: ${S}`));return}if(!E||Y!==n){y("This callback did not belong to the login","You can close this tab."),u(new Error("the callback carried the wrong state"));return}y("Signed in","You can close this tab and go back to HowToCode."),u(void 0,E)},u=(l,f)=>{r.off("request",c),s?.removeEventListener("abort",g),l?a(l):i(f)},g=()=>u(new Error("cancelled"));s?.addEventListener("abort",g,{once:!0}),r.on("request",c)})})})});function k(e,t){e.onProgress?.(t)}async function p(e,t,r,o){let n=await e(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r),signal:o}),s={};try{s=await n.json()}catch{}let i=Number(n.headers?.get?.("retry-after"));return{status:n.status,body:s,retryAfterSeconds:Number.isFinite(i)&&i>0?i:void 0}}function d(...e){for(let t of e)if(typeof t=="string"&&t.trim()!=="")return t.trim()}function j(...e){for(let t of e)if(typeof t=="number"&&Number.isFinite(t))return t;return 0}function me(e){try{let t=new URL(e).searchParams.get("code");return t&&t.trim()!==""?t.trim():void 0}catch{return}}async function ge(e,t,r){let o=await e(t,{headers:de(),signal:r}),n={};try{n=await o.json()}catch{}let s=Number(o.headers?.get?.("retry-after"));return{status:o.status,body:n,retryAfterSeconds:Number.isFinite(s)&&s>0?s:void 0}}function A(e){let t=e.data,r=[e.token,e.api_key,e.apiKey,e.key,t?.token,t?.api_key,t?.apiKey,t?.key];for(let o of r)if(typeof o=="string"&&o.trim().startsWith("sk-"))return o.trim()}function pe(e){let t=e.data,r=d(e.token,t?.token),o=d(e.refresh_token,t?.refresh_token),n=d(e.device_id,t?.device_id);if(!r||!o||!n)return;let s=j(e.access_expires_at,t?.access_expires_at),i=j(e.refresh_expires_at,t?.refresh_expires_at);return{accessToken:r,accessExpiresAt:s,refreshToken:o,deviceId:n,refreshExpiresAt:i}}function m(e,t){let r=e.message??e.error;return typeof r=="string"&&r.trim()?r.trim():t}async function He(e){let t=e.fetchImpl??fetch,r=(e.panelUrl??_).replace(/\/+$/,""),o=e.timeoutMs??se,n={...e,panel:r,fetchImpl:t,timeoutMs:o},s=await ke(n);if(s.ok||s.terminal)return s.result;let i=await he(n);if(i.ok||i.terminal)return i.result;let a=await we(n);return a.ok?a:{ok:!1,message:`${s.result.ok?"":s.result.message}; ${i.result.ok?"":i.result.message}; ${a.message}. howtofix.id does not offer a browser login a local client can complete yet \u2014 run /connect and paste a token from ${r}/keys instead.`}}async function he(e){let t=oe(),r=ae(),o;try{o=await(e.loopback??fe)();let n=`http://127.0.0.1:${o.port}${K}`,s=await p(e.fetchImpl,`${e.panel}/api/oauth/device/start`,{redirect_uri:n,code_challenge:ie(t),code_challenge_method:"S256",state:r},e.signal);if(s.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no loopback login endpoint"}};if(s.status>=400)return{ok:!1,terminal:!1,result:{ok:!1,message:m(s.body,`the panel refused the login (${s.status})`)}};let i=typeof s.body.authorize_url=="string"?s.body.authorize_url:"";if(!i)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not say where to send the browser"}};k(e,{kind:"browser",url:i});let a=await be(o.waitForCode(r,e.signal),e.timeoutMs),c=await p(e.fetchImpl,`${e.panel}/api/oauth/device/token`,{flow_token:s.body.flow_token,code:a,code_verifier:t},e.signal);if(c.status>=400)return{ok:!1,terminal:!0,result:{ok:!1,message:m(c.body,`the panel refused the exchange (${c.status})`)}};let u=A(c.body);return u?{ok:!0,result:{ok:!0,token:u}}:{ok:!1,terminal:!0,result:{ok:!1,message:"the panel did not return an API key"}}}catch(n){let s=n instanceof Error?n.message:String(n);return{ok:!1,terminal:s==="cancelled",result:{ok:!1,message:s}}}finally{o?.close()}}async function ke(e){let t=e.fingerprintId??L(),r=e.clientInfo??T(),o=R(t,r);try{let n=await p(e.fetchImpl,`${e.panel}/api/auth/cli/code`,{fingerprintId:t,clientInfo:r,...o},e.signal);if(n.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no CLI login endpoint"}};if(n.status===401)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not recognise this build as the HowToCode CLI \u2014 update it with `npm install -g howtocode@latest`"}};if(n.status===429)return{ok:!1,terminal:!0,result:{ok:!1,message:`too many sign-in attempts from this machine right now.${n.retryAfterSeconds?` Try again in ${Math.ceil(n.retryAfterSeconds/60)} minute(s).`:""}`}};if(n.status>=400)return{ok:!1,terminal:!1,result:{ok:!1,message:m(n.body,`the panel refused the login (${n.status})`)}};let s=n.body.data??{},i=d(n.body.login_url,s.login_url),a=d(n.body.code,s.code)??(i?me(i):void 0),c=d(n.body.secret,s.secret);return!i||!a?{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not return a login URL"}}:c?(k(e,{kind:"browser",url:i}),await D(e,a,c)):(k(e,{kind:"browser",url:i}),await D(e,a,void 0))}catch(n){let s=n instanceof Error?n.message:String(n);return{ok:!1,terminal:s==="cancelled",result:{ok:!1,message:s}}}}async function D(e,t,r){let o=e.pollIntervalMs??G,n=Date.now()+e.timeoutMs;for(;Date.now()<n;){await w(o,e.signal);let s=new URLSearchParams(r?{code:t,secret:r}:{code:t});s.set("capability","device-refresh");let i=await ge(e.fetchImpl,`${e.panel}/api/auth/cli/status?${s}`,e.signal);if(i.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no CLI login status endpoint"}};if(i.status===403)return{ok:!1,terminal:!0,result:{ok:!1,message:"the panel rejected this poll \u2014 run /connect again"}};if(i.status===429){let u=Math.min(Math.max(i.retryAfterSeconds??5,1)*1e3,3e4);await w(u,e.signal);continue}let a=A(i.body);if(a)return{ok:!0,result:{ok:!0,token:a,credential:pe(i.body)}};if(d(i.body.data?.status,i.body.status)==="expired")return{ok:!1,terminal:!0,result:{ok:!1,message:"the sign-in link expired before it was approved"}};if(i.status>=400)return{ok:!1,terminal:!0,result:{ok:!1,message:m(i.body,`the panel refused the poll (${i.status})`)}}}return{ok:!1,terminal:!0,result:{ok:!1,message:"the sign-in was not approved in time"}}}async function we(e){let t=e.pollIntervalMs??G;try{let r=await p(e.fetchImpl,`${e.panel}/api/oauth/device`,{},e.signal);if(r.status===404)return{ok:!1,message:"the panel has no device-code endpoint"};if(r.status>=400)return{ok:!1,message:m(r.body,`the panel refused the request (${r.status})`)};let o=typeof r.body.device_code=="string"?r.body.device_code:"",n=typeof r.body.user_code=="string"?r.body.user_code:"",s=typeof r.body.verification_uri=="string"?r.body.verification_uri:`${e.panel}/oauth/device`;if(!o||!n)return{ok:!1,message:"the panel did not return a code to show"};k(e,{kind:"code",code:n,url:s});let i=Date.now()+e.timeoutMs;for(;Date.now()<i;){await w(t,e.signal);let a=await p(e.fetchImpl,`${e.panel}/api/oauth/device/poll`,{device_code:o},e.signal);if(a.status===404)return{ok:!1,message:"the panel has no device-code poll endpoint"};let c=typeof a.body.status=="string"?a.body.status:"";if(c==="pending")continue;if(c==="slow_down"){await w(t,e.signal);continue}if(c==="denied")return{ok:!1,message:"the sign-in was refused in the browser"};if(c==="expired")return{ok:!1,message:"the code expired; run /connect again"};let u=A(a.body);if(u)return{ok:!0,token:u};if(a.status>=400)return{ok:!1,message:m(a.body,`the panel refused the poll (${a.status})`)}}return{ok:!1,message:"the code was not approved in time"}}catch(r){return{ok:!1,message:r instanceof Error?r.message:String(r)}}}function be(e,t){return new Promise((r,o)=>{let n=setTimeout(()=>o(new Error("the sign-in was not finished in time")),t);e.then(s=>{clearTimeout(n),r(s)},s=>{clearTimeout(n),o(s)})})}function w(e,t){return new Promise((r,o)=>{let n=setTimeout(r,e);t?.addEventListener("abort",()=>{clearTimeout(n),o(new Error("cancelled"))},{once:!0})})}function b(e){return ve(e,"cli-credentials.json")}var _e=300*1e3;function Ie(e,t=Date.now()){return e.accessToken?!Number.isFinite(e.accessExpiresAt)||e.accessExpiresAt<=0?!0:e.accessExpiresAt*1e3-_e>t:!1}function Le(e,t=Date.now()){return!e.refreshToken||!e.deviceId?!1:!Number.isFinite(e.refreshExpiresAt)||e.refreshExpiresAt<=0?!0:e.refreshExpiresAt*1e3>t}function Ge(e){let t=b(e);if(!z(t))return;let r;try{r=JSON.parse(ye(t,"utf8"))}catch{return}if(!r||typeof r!="object"||Array.isArray(r))return;let o=r,n=typeof o.accessToken=="string"?o.accessToken.trim():"",s=typeof o.refreshToken=="string"?o.refreshToken.trim():"",i=typeof o.deviceId=="string"?o.deviceId.trim():"";if(!(!n||!s||!i))return{accessToken:n,accessExpiresAt:W(o.accessExpiresAt),refreshToken:s,deviceId:i,refreshExpiresAt:W(o.refreshExpiresAt)}}function Ae(e,t){try{return P(b(e),`${JSON.stringify(t,null,2)}
|
|
2
2
|
`,{mode:384}),!0}catch{return!1}}function Ce(e){try{let t=b(e);z(t)&&xe(t,{force:!0})}catch{}}function W(e){return typeof e=="number"&&Number.isFinite(e)?e:0}async function Se(e,t){let r=(t?.panelUrl??_).replace(/\/+$/,""),o=t?.fetchImpl??fetch,n=t?.timeoutMs??15e3,s=new AbortController,i=setTimeout(()=>s.abort(),n);try{let a=await o(`${r}/api/auth/cli/refresh`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({device_id:e.deviceId,refresh_token:e.refreshToken,fingerprint_id:L()}),signal:s.signal}),c=await a.json().catch(()=>({}));if(a.status===401||a.status===403)return{ok:!1,terminal:!0,message:"this sign-in is no longer valid; run /connect to sign in again"};if(!a.ok)return{ok:!1,terminal:!1,message:`the panel refused the renewal (${a.status})`};let u=c.data??{},g=C(c.token,u.token),l=C(c.refresh_token,u.refresh_token),f=C(c.device_id,u.device_id)??e.deviceId;return!g||!l?{ok:!1,terminal:!1,message:"the panel did not return a renewed credential"}:{ok:!0,terminal:!1,credential:{accessToken:g,accessExpiresAt:B(c.access_expires_at,u.access_expires_at),refreshToken:l,deviceId:f,refreshExpiresAt:B(c.refresh_expires_at,u.refresh_expires_at)}}}catch(a){return{ok:!1,terminal:!1,message:a instanceof Error&&a.name==="AbortError"?`the panel did not answer within ${Math.round(n/1e3)}s`:"could not reach the panel"}}finally{clearTimeout(i)}}function C(...e){for(let t of e)if(typeof t=="string"&&t.trim())return t.trim()}function B(...e){for(let t of e)if(typeof t=="number"&&Number.isFinite(t))return t;return 0}async function Ke(e,t,r){let o=r?.now??Date.now();if(Ie(t,o)||!Le(t,o))return{credential:t,renewed:!1,terminal:!1};let n=await Se(t,r);if(!n.ok||!n.credential)return n.terminal&&Ce(e),{credential:t,renewed:!1,terminal:n.terminal,message:n.message};let s=Ae(e,n.credential);return{credential:n.credential,renewed:!0,terminal:!1,message:s?void 0:`the renewed sign-in could not be saved to ${b(e)}`}}export{H as a,_ as b,He as c,b as d,_e as e,Ie as f,Le as g,Ge as h,Ae as i,Ce as j,Se as k,Ke as l};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as v}from"./chunk-7LA2AMZB.js";import{h as M,i as T}from"./chunk-
|
|
1
|
+
import{a as v}from"./chunk-7LA2AMZB.js";import{h as M,i as T}from"./chunk-Q2GQPEUC.js";import{a as w}from"./chunk-UTYFLLSM.js";import{existsSync as H,mkdirSync as I,readFileSync as b}from"node:fs";import{join as k}from"node:path";var J="https://models.dev/api.json";var N=["anthropic","openai","google","deepseek","zai","xai","moonshotai","minimax","alibaba","xiaomi","meta","tencent","nvidia","venice","openrouter"];function _(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"")}function S(n){let e=n.split("/");return _(e[e.length-1]??n)}function q(n){let e=new Map,s=new Map;if(!n||typeof n!="object")return e;let t=n,r=c=>{let o=N.indexOf(c);return o===-1?N.length:o};for(let c of Object.keys(t).sort()){let o=t[c]?.models;if(!(!o||typeof o!="object"))for(let a of Object.keys(o)){let i=o[a],u=Number(i?.limit?.context);if(!Number.isFinite(u)||u<=0)continue;let l=_(a),f=r(c),d=s.get(l);if(d!==void 0&&d<=f)continue;let m=Number(i?.limit?.output);e.set(l,{contextWindow:Math.floor(u),maxTokens:Number.isFinite(m)&&m>0?Math.floor(m):void 0,reasoning:i?.reasoning===!0,vision:Array.isArray(i?.modalities?.input)&&i.modalities.input.includes("image")}),s.set(l,f)}}return e}function A(n,e){let s=_(e);if(!s)return;let t=n.get(s);if(t)return t;let r=S(e);for(let[c,o]of n)if(S(c)===r)return o;for(let[c,o]of n)if(c.endsWith(s)||s.endsWith(c))return o}function R(n){return`${n}/models-dev-cache.json`}function $(n){let e={};for(let[s,t]of n)e[s]=[t.contextWindow,t.maxTokens??0,t.reasoning?1:0,t.vision?1:0];return JSON.stringify(e)}function P(n){let e=new Map,s;try{s=JSON.parse(n)}catch{return e}if(!s||typeof s!="object")return e;for(let[t,r]of Object.entries(s)){if(!Array.isArray(r)||r.length<3)continue;let c=Number(r[0]),o=Number(r[1]);!Number.isFinite(c)||c<=0||e.set(t,{contextWindow:Math.floor(c),maxTokens:Number.isFinite(o)&&o>0?Math.floor(o):void 0,reasoning:r[2]===1||r[2]===!0,vision:r[3]===1||r[3]===!0})}return e}async function U(n){let e=n?.url??J,s=n?.fetchImpl??fetch,t=n?.timeoutMs??2e4,r=new AbortController,c=setTimeout(()=>r.abort(),t);try{let o=await s(e,{signal:r.signal,headers:{Accept:"application/json"}});if(!o.ok)return{ok:!1,message:`the model catalogue answered ${o.status}`};let a=q(await o.json());return a.size===0?{ok:!1,message:"the model catalogue was empty or in an unexpected shape"}:{ok:!0,index:a}}catch(o){return{ok:!1,message:o instanceof Error&&o.name==="AbortError"?`the model catalogue did not answer within ${Math.round(t/1e3)}s`:"could not reach the model catalogue"}}finally{clearTimeout(c)}}var x="https://api.howtofix.id/v1",ce=v,C=["howtocode","howtocode-free"];function ue(n){try{let s=JSON.parse(b(k(n,"models.json"),"utf8")).providers;return!s||typeof s!="object"?new Set:new Set(Object.keys(s))}catch{return new Set}}function le(){return{baseUrl:x,api:"openai-completions",headers:{[M]:T()}}}function de(n){let e=k(n,"models.json"),s;try{s=JSON.parse(b(e,"utf8"))}catch{return 0}let t=s.providers;if(!t||typeof t!="object")return 0;let r=0;for(let c of C){let o=t[c];if(!o||!Array.isArray(o.models))continue;let a=Y(o.models),i={...o.headers??{},[M]:T()},u=o.headers?.[M]!==i[M];a.changed===0&&!u||(o.models=a.models,o.headers=i,r+=a.changed===0?1:a.changed)}if(r===0)return 0;try{w(e,`${JSON.stringify(s,null,2)}
|
|
2
2
|
`)}catch{return 0}return r}var G=10080*60*1e3;async function F(n,e){let s=R(n),t=e?.now??Date.now(),r,c=0;try{let i=JSON.parse(b(s,"utf8"));typeof i?.entries=="string"&&(r=P(i.entries),c=Number(i.at)||0)}catch{r=void 0}if(r&&r.size>0&&t-c<G&&!e?.force)return{index:r};let a=await U({fetchImpl:e?.fetchImpl});if(!a.ok)return r&&r.size>0?{index:r,message:a.message}:{index:new Map,message:a.message};try{I(n,{recursive:!0}),w(s,`${JSON.stringify({at:t,entries:$(a.index)})}
|
|
3
3
|
`)}catch{}return{index:a.index}}async function fe(n,e){let s=k(n,"models.json"),t;try{t=JSON.parse(b(s,"utf8"))}catch{return{changed:0}}let r=t.providers;if(!r||typeof r!="object")return{changed:0};let{index:c,message:o}=await F(n,e);if(c.size===0&&!e?.prices&&!e?.tiers)return{changed:0,message:o};let a=0;for(let i of C){let u=r[i];if(!u||!Array.isArray(u.models))continue;let l=Z(u.models,c,e?.prices,e?.tiers);l.changed!==0&&(u.models=l.models,a+=l.changed)}if(a>0)try{w(s,`${JSON.stringify(t,null,2)}
|
|
4
4
|
`)}catch{return{changed:0,message:"the models file could not be written"}}return{changed:a,message:o}}var B=3e5;function me(n){let e=k(n,"settings.json"),s={};try{let t=b(e,"utf8"),r=JSON.parse(t);r&&typeof r=="object"&&!Array.isArray(r)&&(s=r)}catch{if(H(e))return!1}if("httpIdleTimeoutMs"in s)return!1;s.httpIdleTimeoutMs=B;try{I(n,{recursive:!0}),w(e,`${JSON.stringify(s,null,2)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as r}from"./chunk-
|
|
1
|
+
import{b as r}from"./chunk-OUVT3E6S.js";import{j as a}from"./chunk-MVVEYKN6.js";import"./chunk-WOT6VMZA.js";function c(e){return{prompt:s=>e.session.prompt(s),abort:()=>e.session.abort(),subscribe:s=>e.session.subscribe(n=>s(n)),getLastAssistantText:()=>a(e.session.getLastAssistantText()??""),lastStopReason:()=>{let s=e.session.state.messages.at(-1);return s?.role==="assistant"?s.stopReason:void 0},dispose:()=>e.dispose()}}async function g(e,s){let{openSession:n}=await import("./chunk-6LVQ2C2A.js"),i=t=>n({cwd:t,model:s.model,thinking:s.thinking,continueSession:!1,noSession:!1,sessionPath:void 0,interactive:!1});if(e==="acp"){let{runAcp:t}=await import("./chunk-TOV557ET.js");await t({input:process.stdin,output:process.stdout,version:r,createAgent:async u=>c(await i(u))});return}let{runRpc:p}=await import("./chunk-QOYTPACU.js"),{createJsonEventEncoder:d}=await import("./chunk-MCDEIIEN.js"),o=await i(s.cwd),m=d();await p({input:process.stdin,output:process.stdout,agent:c(o),encodeEvent:t=>m.line(t),state:()=>({sessionId:o.session.sessionId,model:o.modelLabel,cwd:s.cwd})})}export{c as agentFromSession,g as serveProtocol};
|
package/dist/cli-auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-Q2GQPEUC.js";import"./chunk-OUVT3E6S.js";import"./chunk-WOT6VMZA.js";export{h as CLI_CLIENT_HEADER,a as CLI_SIGNING_KEY_ID,i as cliClientHeader,c as cliSignaturePayload,f as cliSigningKeyFingerprint,e as cliSigningKeyMatchesPanel,b as cliSigningPublicKey,d as createNonce,g as describeClient,j as signLoginRequest};
|
package/dist/main-app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as q,d as Q,e as Z}from"./chunk-EZNNALD3.js";import"./chunk-7LA2AMZB.js";import{e as J,f as K}from"./chunk-
|
|
2
|
+
import{b as q,d as Q,e as Z}from"./chunk-EZNNALD3.js";import"./chunk-7LA2AMZB.js";import{e as J,f as K}from"./chunk-Q2GQPEUC.js";import{c as z}from"./chunk-PH72JBBL.js";import{a as V,b as F}from"./chunk-MCAAX33K.js";import{a as d,b as y}from"./chunk-OUVT3E6S.js";import{H as _,P as Y}from"./chunk-5FIFNXLT.js";import"./chunk-UTYFLLSM.js";import{j as X}from"./chunk-MVVEYKN6.js";import"./chunk-WOT6VMZA.js";import{existsSync as qe,mkdirSync as Qe,readdirSync as pe,statSync as Ze,writeFileSync as et}from"node:fs";import{join as N}from"node:path";var ee={rpc:!0,acp:!0},te={off:!0,minimal:!0,low:!0,medium:!0,high:!0,xhigh:!0,max:!0},se={suggest:!0,"auto-edit":!0,"full-auto":!0},oe={text:!0,json:!0,"stream-json":!0};function Be(i){let e=Number(i);if(!Number.isFinite(e)||e<=0)throw new Error(`--max-budget-usd needs a positive number of dollars, got '${i}'`);return e}function E(i,e,t){let s=i[e];if(s?.includes("="))return s.slice(s.indexOf("=")+1);let a=i[e+1];if(!a||a.startsWith("-"))throw new Error(`${t} needs a value`);return i.splice(e+1,1),a}function ne(i){let e={print:!1,continueSession:!1,noSession:!1,help:!1,version:!1,update:!1,checkUpdate:!1,outputFormat:"text",dangerouslySkipPermissions:!1,sandbox:!1,prompt:""},t=[],s=[...i];s[0]==="resume"&&s[1]&&!s[1].startsWith("-")&&(e.resumeId=s[1],s.splice(0,2));for(let a=0;a<s.length;a++){let o=s[a]??"";if(o==="--"){t.push(...s.slice(a+1));break}if(o==="-h"||o==="--help")e.help=!0;else if(o==="-v"||o==="--version")e.version=!0;else if(o==="-p"||o==="--print")e.print=!0;else if(o==="-c"||o==="--continue")e.continueSession=!0;else if(o==="--no-session")e.noSession=!0;else if(o==="--sandbox")e.sandbox=!0;else if(o==="--update")e.update=!0;else if(o==="--check-update")e.checkUpdate=!0;else if(o==="-r"||o==="--resume")e.continueSession=!0;else if(o==="--session"||o.startsWith("--session="))e.sessionPath=E(s,a,"--session");else if(o==="-m"||o==="--model"||o.startsWith("--model="))e.model=E(s,a,"--model");else if(o==="--thinking"||o.startsWith("--thinking="))e.thinking=E(s,a,"--thinking");else if(o==="--approval"||o.startsWith("--approval="))e.approval=E(s,a,"--approval");else if(o==="--output-format"||o.startsWith("--output-format="))e.outputFormat=E(s,a,"--output-format");else if(o==="--max-budget-usd"||o.startsWith("--max-budget-usd="))e.maxBudgetUsd=Be(E(s,a,"--max-budget-usd"));else if(o==="--mode"||o.startsWith("--mode=")){let u=E(s,a,"--mode");if(!ee[u])throw new Error(`--mode must be one of: ${Object.keys(ee).join(", ")}`);e.mode=u}else if(o==="--acp")e.mode="acp";else if(o==="--dangerously-skip-permissions")e.dangerouslySkipPermissions=!0;else{if(o.startsWith("-"))throw new Error(`unknown option ${o}`);t.push(o)}}if(e.thinking&&!te[e.thinking])throw new Error(`thinking must be one of: ${Object.keys(te).join(", ")}`);if(e.approval&&!se[e.approval])throw new Error(`approval must be one of: ${Object.keys(se).join(", ")}`);if(!oe[e.outputFormat])throw new Error(`output-format must be one of: ${Object.keys(oe).join(", ")}`);if(e.outputFormat!=="text"&&!e.print)throw new Error(`--output-format ${e.outputFormat} is a machine contract; it needs --print`);if(e.dangerouslySkipPermissions&&!e.print)throw new Error("--dangerously-skip-permissions is for unattended runs; it needs --print. interactively, pick an approval mode instead (/approval, or --approval)");if(e.prompt=t.join(" ").trim(),e.update&&e.checkUpdate)throw new Error("--update installs; --check-update only looks. pick one");if((e.update||e.checkUpdate)&&(e.print||e.continueSession||e.sessionPath||e.prompt))throw new Error("--update and --check-update act on the installation, not a session; they take no prompt");if(e.continueSession&&e.noSession)throw new Error("--continue and --no-session cannot be combined");if(e.sessionPath&&e.noSession)throw new Error("--session and --no-session cannot be combined");if(e.sessionPath&&e.continueSession)throw new Error("--session and --continue cannot be combined");if(e.resumeId&&e.sessionPath)throw new Error("resume <id> and --session cannot be combined");if(e.resumeId&&e.continueSession)throw new Error("resume <id> and --continue cannot be combined");if(e.print&&(e.continueSession||e.sessionPath||e.resumeId))throw new Error("--print runs one prompt in a throwaway session; it cannot be combined with --continue, --session, or resume <id>");if(e.mode&&(e.print||e.prompt))throw new Error(`--mode ${e.mode} is a protocol server: prompts arrive over the protocol, not the command line`);if(e.mode&&(e.continueSession||e.sessionPath))throw new Error(`--mode ${e.mode} opens its own sessions; it cannot be combined with --continue or --session`);if(e.sessionPath&&!e.sessionPath.endsWith(".jsonl"))throw new Error(`--session expects a session file, got '${e.sessionPath}'`);return e}function R(){return`${d} ${y}
|
|
3
3
|
coding agent. layout is a workbench, not a chat log.
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -93,10 +93,10 @@ token; /login takes another provider's key.
|
|
|
93
93
|
`}function He(i,e=!1){let{message:t,hint:s}=V(i),a=s?`${t}
|
|
94
94
|
${s}`:t;if(!e)return a;let o=i instanceof Error?i.stack:void 0;return o&&o.includes(`
|
|
95
95
|
`)?`${a}
|
|
96
|
-
${o}`:a}function re(i,e){let t=e?.debug??process.env.HOWTOCODE_DEBUG==="1",s=e?.exit??(o=>process.exit(o)),a=o=>{console.error(`${i}: ${He(o,t)}`),s(1)};process.on("uncaughtException",a),process.on("unhandledRejection",a)}import{connect as We}from"node:net";var x={HANDSHAKE:0,FRAME:1,CLOSE:2,PING:3,PONG:4},de="1560641616753066135",Ge="https://discord.howtofix.id",ie=10,Je=1e4,ae=1e3,Ke=3e4,Ve=3e4,Ye=15e3;function le(i){let e=i.cwd.split(/[\\/]/).filter(Boolean).pop()??i.cwd,t=i.largeImage?.trim();return{details:"HowToCode",state:`${i.modelLabel} \u2022 ${e}`.slice(0,128),timestamps:{start:i.startedAt??Date.now()},buttons:[{label:"Join Discord",url:i.inviteUrl?.trim()||Ge}],...t?{assets:{large_image:t,large_text:"HowToCode"}}:{}}}function Xe(i=process.platform){if(i==="win32")return Array.from({length:ie},(s,a)=>`\\\\?\\pipe\\discord-ipc-${a}`);let e=process.env.XDG_RUNTIME_DIR??process.env.TMPDIR??process.env.TMP??"/tmp";return[e,`${e}/app/com.discordapp.Discord`,`${e}/snap.discord`,`${e}/.flatpak/dev.vencord.Vesktop`,`${e}/.flatpak/com.discordapp.Discord`].flatMap(s=>Array.from({length:ie},(a,o)=>`${s.replace(/\/+$/,"")}/discord-ipc-${o}`))}function ce(i,e){let t=Buffer.from(JSON.stringify(e??{}),"utf8"),s=Buffer.allocUnsafe(8+t.length);return s.writeUInt32LE(i,0),s.writeUInt32LE(t.length,4),t.copy(s,8),s}function ze(i){let e=[],t=i;for(;t.length>=8;){let s=t.readUInt32LE(0),a=t.readUInt32LE(4);if(t.length<8+a)break;let o=t.subarray(8,8+a).toString("utf8");t=t.subarray(8+a);let u;try{u=JSON.parse(o)}catch{u={raw:o}}e.push({op:s,payload:u})}return{frames:e,rest:t}}var M=class{clientId;activity;candidates;log;socket;buffer=Buffer.alloc(0);ready=!1;stopped=!1;reconnectTimer;pingTimer;handshakeTimer;reconnectDelay=ae;lastSent=0;applied="";constructor(e){this.clientId=e.clientId,this.activity=e.activity,this.candidates=e.candidates??Xe(),this.log=e.log??(()=>{})}start(){this.stopped||this.socket!==void 0||this.reconnectTimer!==void 0||this.clientId.trim().length!==0&&this.connectToAny(0)}update(e){this.activity=e,this.flush(!1)}stop(){if(this.stopped=!0,this.ready=!1,clearTimeout(this.reconnectTimer),clearTimeout(this.handshakeTimer),clearInterval(this.pingTimer),this.reconnectTimer=void 0,this.handshakeTimer=void 0,this.pingTimer=void 0,this.socket){try{this.socket.write(ce(x.CLOSE,{code:1e3,message:"HowToCode stopped"})),this.socket.end()}catch{}this.socket.destroy(),this.socket=void 0}}connectToAny(e){if(this.stopped)return;if(e>=this.candidates.length){this.log("Discord IPC socket not found; presence disabled"),this.scheduleReconnect();return}let t=this.candidates[e],s=We(t);s.once("connect",()=>{s.removeAllListeners("error"),this.attach(s)}),s.once("error",()=>{s.destroy(),this.connectToAny(e+1)})}attach(e){this.socket=e,this.buffer=Buffer.alloc(0),this.ready=!1,e.on("data",t=>this.onData(t)),e.on("close",()=>this.onDrop("Discord closed the socket")),e.on("error",t=>this.onDrop(t.message)),this.handshakeTimer=setTimeout(()=>this.onDrop("Discord handshake timed out"),Je),this.write(x.HANDSHAKE,{v:1,client_id:this.clientId})}onData(e){this.buffer=Buffer.concat([this.buffer,e]);let t=ze(this.buffer);this.buffer=t.rest;for(let s of t.frames)this.onFrame(s.op,s.payload)}onFrame(e,t){if(e===x.PING){this.write(x.PONG,t);return}if(e===x.CLOSE){let o=typeof t=="object"&&t!==null&&"code"in t?t.code:void 0;this.onDrop(`Discord closed the session${o===4e3?" (unknown application id)":""}`);return}if(e!==x.FRAME||typeof t!="object"||t===null)return;let s="evt"in t?t.evt:void 0,a="cmd"in t?t.cmd:void 0;if(s==="READY"){clearTimeout(this.handshakeTimer),this.handshakeTimer=void 0,this.ready=!0,this.reconnectDelay=ae,this.applied="",this.startPing(),this.flush(!0);return}a==="SET_ACTIVITY"&&this.log("presence updated")}write(e,t){let s=this.socket;if(!s||s.destroyed)return!1;try{return s.write(ce(e,t)),!0}catch(a){return this.onDrop(a instanceof Error?a.message:String(a)),!1}}startPing(){clearInterval(this.pingTimer),this.pingTimer=setInterval(()=>this.write(x.PING,{t:Date.now()}),Ve),this.pingTimer.unref?.()}flush(e){if(!this.ready||this.stopped)return;let t=Date.now();if(!e&&t-this.lastSent<Ye)return;let s=JSON.stringify(this.activity);s!==this.applied&&(this.applied=s,this.lastSent=t,this.write(x.FRAME,{cmd:"SET_ACTIVITY",args:{pid:process.pid,activity:this.activity},nonce:`howtocode-${t}`}))}onDrop(e){this.ready=!1,clearTimeout(this.handshakeTimer),clearInterval(this.pingTimer),this.handshakeTimer=void 0,this.pingTimer=void 0;let t=this.socket;this.socket=void 0,t&&(t.removeAllListeners(),t.destroy()),!this.stopped&&(this.log(`Discord presence disconnected: ${e}`),this.scheduleReconnect())}scheduleReconnect(){if(this.stopped||this.reconnectTimer!==void 0)return;let e=this.reconnectDelay;this.reconnectDelay=Math.min(this.reconnectDelay*2,Ke),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,this.connectToAny(0)},e),this.reconnectTimer.unref?.()}};function tt(){try{return{cwd:process.cwd()}}catch{return{error:"the current directory no longer exists (it was deleted while the shell stayed in it). cd to a directory that exists, or pass one on the command line."}}}function st(){process.stdout.on("error",i=>{throw i.code==="EPIPE"&&process.exit(0),i})}function ot(){let i=N(_,".welcomed");if(!qe(i)){try{Qe(_,{recursive:!0}),et(i,y)}catch{return}console.error(`${d} ${y} installed. Docs: https://howtofix.id/code`),console.error("Continue the last session here with: howtocode -c")}}async function ue(){J()||(console.error(`${d}: this build's CLI signing key (${K()}) does not match the key the panel verifies against, so sign-in will be refused.`),process.exitCode=1)}async function nt(){st(),Y();let i=performance.now(),e=tt();if("error"in e){console.error(`${d}: ${e.error}`),process.exitCode=1;return}let t=e.cwd,s=process.env.HXF_FAKE_NODE??process.versions.node,[a,o]=s.split(".").map(n=>Number.parseInt(n,10));if(!Number.isFinite(a)||a<22||a===22&&Number.isFinite(o)&&o<19){console.error(`${d}: Node ${s} is too old. Node 22.19 or newer is required (run "node --version" to check yours), because undici needs zstd, which Node added in 22.19. Upgrade Node and run this again.`),process.exitCode=1;let n=process.argv.slice(2);if(n.some(c=>c==="-h"||c==="--help")){console.log(R());return}if(n.some(c=>c==="-v"||c==="--version")){console.log(`${d} ${y}`);return}return}let u=process.argv.slice(2);if(u[0]==="doctor"||u[0]==="models"||u[0]==="sessions"){let n=u[0];try{let c=await import("./chunk-
|
|
97
|
-
${R()}`),process.exitCode=2;return}if(I.print&&!I.prompt){console.error(`${d}: --print needs a prompt`),process.exitCode=2;return}let{repairGatewayModels:he,ensureGatewaySettings:fe,repairModelFacts:ge,syncGatewayModelsOnStart:we,checkAccount:ve,fetchGatewayPrices:ye,readProviderKey:be}=await import("./chunk-
|
|
96
|
+
${o}`:a}function re(i,e){let t=e?.debug??process.env.HOWTOCODE_DEBUG==="1",s=e?.exit??(o=>process.exit(o)),a=o=>{console.error(`${i}: ${He(o,t)}`),s(1)};process.on("uncaughtException",a),process.on("unhandledRejection",a)}import{connect as We}from"node:net";var x={HANDSHAKE:0,FRAME:1,CLOSE:2,PING:3,PONG:4},de="1560641616753066135",Ge="https://discord.howtofix.id",ie=10,Je=1e4,ae=1e3,Ke=3e4,Ve=3e4,Ye=15e3;function le(i){let e=i.cwd.split(/[\\/]/).filter(Boolean).pop()??i.cwd,t=i.largeImage?.trim();return{details:"HowToCode",state:`${i.modelLabel} \u2022 ${e}`.slice(0,128),timestamps:{start:i.startedAt??Date.now()},buttons:[{label:"Join Discord",url:i.inviteUrl?.trim()||Ge}],...t?{assets:{large_image:t,large_text:"HowToCode"}}:{}}}function Xe(i=process.platform){if(i==="win32")return Array.from({length:ie},(s,a)=>`\\\\?\\pipe\\discord-ipc-${a}`);let e=process.env.XDG_RUNTIME_DIR??process.env.TMPDIR??process.env.TMP??"/tmp";return[e,`${e}/app/com.discordapp.Discord`,`${e}/snap.discord`,`${e}/.flatpak/dev.vencord.Vesktop`,`${e}/.flatpak/com.discordapp.Discord`].flatMap(s=>Array.from({length:ie},(a,o)=>`${s.replace(/\/+$/,"")}/discord-ipc-${o}`))}function ce(i,e){let t=Buffer.from(JSON.stringify(e??{}),"utf8"),s=Buffer.allocUnsafe(8+t.length);return s.writeUInt32LE(i,0),s.writeUInt32LE(t.length,4),t.copy(s,8),s}function ze(i){let e=[],t=i;for(;t.length>=8;){let s=t.readUInt32LE(0),a=t.readUInt32LE(4);if(t.length<8+a)break;let o=t.subarray(8,8+a).toString("utf8");t=t.subarray(8+a);let u;try{u=JSON.parse(o)}catch{u={raw:o}}e.push({op:s,payload:u})}return{frames:e,rest:t}}var M=class{clientId;activity;candidates;log;socket;buffer=Buffer.alloc(0);ready=!1;stopped=!1;reconnectTimer;pingTimer;handshakeTimer;reconnectDelay=ae;lastSent=0;applied="";constructor(e){this.clientId=e.clientId,this.activity=e.activity,this.candidates=e.candidates??Xe(),this.log=e.log??(()=>{})}start(){this.stopped||this.socket!==void 0||this.reconnectTimer!==void 0||this.clientId.trim().length!==0&&this.connectToAny(0)}update(e){this.activity=e,this.flush(!1)}stop(){if(this.stopped=!0,this.ready=!1,clearTimeout(this.reconnectTimer),clearTimeout(this.handshakeTimer),clearInterval(this.pingTimer),this.reconnectTimer=void 0,this.handshakeTimer=void 0,this.pingTimer=void 0,this.socket){try{this.socket.write(ce(x.CLOSE,{code:1e3,message:"HowToCode stopped"})),this.socket.end()}catch{}this.socket.destroy(),this.socket=void 0}}connectToAny(e){if(this.stopped)return;if(e>=this.candidates.length){this.log("Discord IPC socket not found; presence disabled"),this.scheduleReconnect();return}let t=this.candidates[e],s=We(t);s.once("connect",()=>{s.removeAllListeners("error"),this.attach(s)}),s.once("error",()=>{s.destroy(),this.connectToAny(e+1)})}attach(e){this.socket=e,this.buffer=Buffer.alloc(0),this.ready=!1,e.on("data",t=>this.onData(t)),e.on("close",()=>this.onDrop("Discord closed the socket")),e.on("error",t=>this.onDrop(t.message)),this.handshakeTimer=setTimeout(()=>this.onDrop("Discord handshake timed out"),Je),this.write(x.HANDSHAKE,{v:1,client_id:this.clientId})}onData(e){this.buffer=Buffer.concat([this.buffer,e]);let t=ze(this.buffer);this.buffer=t.rest;for(let s of t.frames)this.onFrame(s.op,s.payload)}onFrame(e,t){if(e===x.PING){this.write(x.PONG,t);return}if(e===x.CLOSE){let o=typeof t=="object"&&t!==null&&"code"in t?t.code:void 0;this.onDrop(`Discord closed the session${o===4e3?" (unknown application id)":""}`);return}if(e!==x.FRAME||typeof t!="object"||t===null)return;let s="evt"in t?t.evt:void 0,a="cmd"in t?t.cmd:void 0;if(s==="READY"){clearTimeout(this.handshakeTimer),this.handshakeTimer=void 0,this.ready=!0,this.reconnectDelay=ae,this.applied="",this.startPing(),this.flush(!0);return}a==="SET_ACTIVITY"&&this.log("presence updated")}write(e,t){let s=this.socket;if(!s||s.destroyed)return!1;try{return s.write(ce(e,t)),!0}catch(a){return this.onDrop(a instanceof Error?a.message:String(a)),!1}}startPing(){clearInterval(this.pingTimer),this.pingTimer=setInterval(()=>this.write(x.PING,{t:Date.now()}),Ve),this.pingTimer.unref?.()}flush(e){if(!this.ready||this.stopped)return;let t=Date.now();if(!e&&t-this.lastSent<Ye)return;let s=JSON.stringify(this.activity);s!==this.applied&&(this.applied=s,this.lastSent=t,this.write(x.FRAME,{cmd:"SET_ACTIVITY",args:{pid:process.pid,activity:this.activity},nonce:`howtocode-${t}`}))}onDrop(e){this.ready=!1,clearTimeout(this.handshakeTimer),clearInterval(this.pingTimer),this.handshakeTimer=void 0,this.pingTimer=void 0;let t=this.socket;this.socket=void 0,t&&(t.removeAllListeners(),t.destroy()),!this.stopped&&(this.log(`Discord presence disconnected: ${e}`),this.scheduleReconnect())}scheduleReconnect(){if(this.stopped||this.reconnectTimer!==void 0)return;let e=this.reconnectDelay;this.reconnectDelay=Math.min(this.reconnectDelay*2,Ke),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,this.connectToAny(0)},e),this.reconnectTimer.unref?.()}};function tt(){try{return{cwd:process.cwd()}}catch{return{error:"the current directory no longer exists (it was deleted while the shell stayed in it). cd to a directory that exists, or pass one on the command line."}}}function st(){process.stdout.on("error",i=>{throw i.code==="EPIPE"&&process.exit(0),i})}function ot(){let i=N(_,".welcomed");if(!qe(i)){try{Qe(_,{recursive:!0}),et(i,y)}catch{return}console.error(`${d} ${y} installed. Docs: https://howtofix.id/code`),console.error("Continue the last session here with: howtocode -c")}}async function ue(){J()||(console.error(`${d}: this build's CLI signing key (${K()}) does not match the key the panel verifies against, so sign-in will be refused.`),process.exitCode=1)}async function nt(){st(),Y();let i=performance.now(),e=tt();if("error"in e){console.error(`${d}: ${e.error}`),process.exitCode=1;return}let t=e.cwd,s=process.env.HXF_FAKE_NODE??process.versions.node,[a,o]=s.split(".").map(n=>Number.parseInt(n,10));if(!Number.isFinite(a)||a<22||a===22&&Number.isFinite(o)&&o<19){console.error(`${d}: Node ${s} is too old. Node 22.19 or newer is required (run "node --version" to check yours), because undici needs zstd, which Node added in 22.19. Upgrade Node and run this again.`),process.exitCode=1;let n=process.argv.slice(2);if(n.some(c=>c==="-h"||c==="--help")){console.log(R());return}if(n.some(c=>c==="-v"||c==="--version")){console.log(`${d} ${y}`);return}return}let u=process.argv.slice(2);if(u[0]==="doctor"||u[0]==="models"||u[0]==="sessions"){let n=u[0];try{let c=await import("./chunk-OFZZO2SV.js");n==="doctor"?process.exitCode=await c.runDoctor():n==="models"?process.exitCode=c.runModels():process.exitCode=c.runSessions(u.slice(1))}catch(c){F(d,n,c),process.exitCode=1}return}if(u.some(n=>n==="-v"||n==="--version")){await ue(),console.log(`${d} ${y}`);return}if(u[0]==="browser-relay"&&u[1]==="native-host"){let{runNativeHost:n}=await import("./chunk-KBZERZVM.js");await n();return}let me=u[0]==="acp"?["--acp",...u.slice(1)]:u,I;try{I=ne(me)}catch(n){let c=n instanceof Error?n.message:String(n);console.error(`${d}: ${c}
|
|
97
|
+
${R()}`),process.exitCode=2;return}if(I.print&&!I.prompt){console.error(`${d}: --print needs a prompt`),process.exitCode=2;return}let{repairGatewayModels:he,ensureGatewaySettings:fe,repairModelFacts:ge,syncGatewayModelsOnStart:we,checkAccount:ve,fetchGatewayPrices:ye,readProviderKey:be}=await import("./chunk-DGLFGFQP.js"),{tiersFrom:ke,writeReachable:xe}=await import("./chunk-XBVWQC7P.js"),{readCliCredential:Se,renewCliCredentialIfNeeded:Te}=await import("./chunk-NAXC5MNU.js"),{AGENT_DIR:f,REACHABLE_CACHE_PATH:_e}=await import("./chunk-336TZTEK.js"),{readCachedPrices:Ee,writeCachedPrices:Ce}=await import("./chunk-A3LZMZ3C.js"),L=he(f);L>0&&console.error(`${d}: repaired ${L} howtocode model(s) that the gateway would have rejected`);let C,P,D=new Map,$=Ee(f);if($){C=$.prices;for(let[n,c]of $.groups)D.set(n,c)}try{let n=Se(f),c=n?(await Te(f,n)).credential.accessToken:be(f,"howtocode");if(c){let[h,m]=await Promise.all([$?Promise.resolve(C??new Map):ye(c,{groups:D}),ve(c)]);!$&&h.size>0&&(C=h,Ce(f,h,D)),m.ok&&(P=m.models)}}catch{}let U=ke(D),A=await ge(f,{...C?{prices:C}:{},...U.size>0?{tiers:U}:{}});if(A.changed>0?console.error(`${d}: filled in the context window, reasoning flag and price for ${A.changed} model(s)`):A.message&&console.error(`${d}: model catalogue unavailable (${A.message}); context windows stay at their conservative defaults`),fe(f)&&console.error(`${d}: set httpIdleTimeoutMs in settings.json so a stalled provider recovers instead of hanging`),P){xe(_e,P);try{let n=await we(f,P,C);n.added>0&&console.error(`${d}: added ${n.added} model(s) this account can now reach`)}catch{}}let r=I;if(r.help){console.log(R());return}if(r.version){await ue(),console.log(`${d} ${y}`);return}if(r.sandbox&&!process.env.HOWTOCODE_SANDBOXED){let{detectSandbox:n,enterSandbox:c,describeSandbox:h}=await import("./chunk-GQYIIDKK.js"),m=n();if(!m){console.error(`${d}: --sandbox needs a working bubblewrap (Linux) or sandbox-exec (macOS). Neither could be used here \u2014 on Linux this usually means unprivileged user namespaces are disabled.`),process.exitCode=1;return}console.error(h(m)),process.exitCode=c(m,{cwd:t,agentDir:_,argv:[process.execPath,...process.argv.slice(1)]});return}let{installProxy:$e}=await import("./chunk-WKUJ7CFO.js");$e(_);let{retireRobloxBridge:Ie}=await import("./chunk-ULXYWUXZ.js");if(Ie(_),r.update||r.checkUpdate){let{PACKAGE_NAME:n,checkForUpdate:c,installUpdate:h,isInstalledCopy:m}=await import("./chunk-LYLJZVZ7.js"),w=await c(y);if(!w.latest){console.error(`${d}: ${w.message}`),process.exitCode=r.update?1:0;return}if(console.log(w.message),r.checkUpdate||!w.available)return;if(!m()){console.error(`${d}: this copy was not installed by npm, so npm cannot replace it. install it with: npm install -g ${n}`),process.exitCode=1;return}let S=await h({version:w.latest});console.log(S.message),S.ok||(process.exitCode=1);return}let j=process.argv.slice(2);if(j[0]==="preset"){let{runPresetCommand:n}=await import("./chunk-RJYOUCLJ.js");process.exitCode=n(j.slice(1));return}let{expandFileReferences:Pe}=await import("./chunk-TSEKPGK4.js"),{isApprovalMode:De,setApprovalMode:Ae,setDangerousBypass:Oe,isDangerousBypass:Re}=await import("./chunk-4SK7TRJW.js"),{openSession:Me}=await import("./chunk-6LVQ2C2A.js");Ae(r.approval&&De(r.approval)?r.approval:"full-auto");let{readWorkbenchSettings:B}=await import("./chunk-UDX555SX.js");if((r.dangerouslySkipPermissions||B(f).skipPermissions)&&Oe(!0),Re()&&console.error(`${d}: permission checks are OFF \u2014 critical commands (filesystem wipes, fork bombs, host shutdown) and the repeated-call guard are NOT enforced for this run. Turn it off with /settings, or by removing skipPermissions from settings.json.`),r.mode){let{serveProtocol:n}=await import("./chunk-XQD577L4.js");await n(r.mode,{cwd:t,model:r.model,thinking:r.thinking});return}let H=n=>Me({cwd:t,model:r.model,thinking:r.thinking,continueSession:n.continueSession??!1,noSession:n.noSession??!1,sessionPath:n.sessionPath,interactive:!r.print});if(r.resumeId&&!r.sessionPath){let n=N(_,"sessions"),c=[];try{for(let h of pe(n))for(let m of pe(N(n,h))){if(!m.endsWith(".jsonl")||!m.includes(r.resumeId))continue;let w=N(n,h,m);try{c.push({path:w,mtime:Ze(w).mtimeMs})}catch{}}}catch{}if(c=c.sort((h,m)=>m.mtime-h.mtime),c.length===0){console.error(`${d}: no stored session matches '${r.resumeId}'. Run 'howtocode -c' to continue the latest one in this folder.`),process.exitCode=1;return}c.length>1&&console.error(`${d}: '${r.resumeId}' matches ${c.length} sessions; using the newest (${c[0].path}).`),r.sessionPath=c[0].path}let l=await H({continueSession:r.continueSession,sessionPath:r.sessionPath,noSession:r.noSession||r.print});if(r.print&&l.note&&console.error(l.note),r.maxBudgetUsd!==void 0&&!l.priced){console.error(`${d}: ${Z(l.modelLabel,f)}`),await l.dispose(),process.exitCode=2;return}if(r.print){let n=r.prompt.trimStart();if(n.startsWith("/")){let v=n.slice(1).split(/\s+/)[0]??"",{skillInvocation:O}=await import("./chunk-E2UZLMQH.js"),T=l.session.resourceLoader.getSkills().skills.map(g=>g.name);if(!(O(n,T)!==void 0)){let{slashCommands:g}=await import("./chunk-KJ6YW5NT.js");if(g(l.session).some(p=>p.name===v)){console.error(`${d}: /${v} runs in the TUI only \u2014 --print sends prompts straight to the model. Run \`howtocode\` without --print for interactive commands.`),await l.dispose(),process.exitCode=2;return}}}let c=r.outputFormat==="stream-json",h=r.outputFormat==="json",m=c||h;if(c){let v={type:"system",subtype:"init",cwd:t,session_id:l.session.sessionId,model:l.modelLabel,output_format:r.outputFormat,max_budget_usd:r.maxBudgetUsd??null,dangerously_skip_permissions:r.dangerouslySkipPermissions,cli_version:y};process.stdout.write(`${JSON.stringify(v)}
|
|
98
98
|
`)}let w,S,je=()=>{if(r.maxBudgetUsd===void 0||S!==void 0)return;let v=l.session.getSessionStats().cost;v>r.maxBudgetUsd&&(S={spent:v},l.session.abort())};try{let v,O=z();if(w=l.session.subscribe(p=>{if(c){let k=O.line(p);k!==void 0&&process.stdout.write(k)}if(p.type==="turn_end"&&p.message?.role==="assistant"){let k=p.message;k.stopReason==="error"||k.stopReason==="aborted"||k.errorMessage?v={stopReason:k.stopReason??"error",errorMessage:k.errorMessage}:v=void 0}je()}),await l.session.prompt(Pe(r.prompt,t)),c){let p=O.finish();p!==void 0&&process.stdout.write(p)}let T=X(l.session.getLastAssistantText()??"");if(S){if(console.error(`${d}: ${Q(S.spent,r.maxBudgetUsd)}`),m){let p=l.session.getSessionStats();process.stdout.write(`${JSON.stringify({type:"result",subtype:"error_max_budget_usd",is_error:!0,result:T,session_id:l.session.sessionId,duration_ms:Math.round(performance.now()-i),num_turns:p.assistantMessages,total_cost_usd:p.cost,usage:{input_tokens:p.tokens.input,output_tokens:p.tokens.output,cache_read_input_tokens:p.tokens.cacheRead,cache_creation_input_tokens:p.tokens.cacheWrite}})}
|
|
99
99
|
`)}process.exitCode=1;return}let b=l.session.state.messages.at(-1),g=v??(b?.role==="assistant"&&(b.stopReason==="error"||b.stopReason==="aborted"||b.errorMessage)?{stopReason:b.stopReason??"error",errorMessage:b.errorMessage}:void 0);if(m){let p=l.session.getSessionStats();process.stdout.write(`${JSON.stringify({type:"result",subtype:g?g.stopReason==="aborted"?"error_aborted":"error_during_execution":"success",is_error:g!==void 0,result:T,session_id:l.session.sessionId,duration_ms:Math.round(performance.now()-i),num_turns:p.assistantMessages,total_cost_usd:p.cost,usage:{input_tokens:p.tokens.input,output_tokens:p.tokens.output,cache_read_input_tokens:p.tokens.cacheRead,cache_creation_input_tokens:p.tokens.cacheWrite},stop_reason:g?.stopReason??(b?.role==="assistant"?b.stopReason:void 0)})}
|
|
100
100
|
`)}else process.stdout.write(T.endsWith(`
|
|
101
101
|
`)?T:`${T}
|
|
102
|
-
`);if(g&&(process.exitCode=1,g.errorMessage)){console.error(`${d}: ${g.errorMessage}`);let p=q(g.errorMessage);p!==void 0&&console.error(`${d}: ${p}`)}}finally{w?.(),await l.dispose()}return}if(!process.stdin.isTTY||!process.stdout.isTTY){console.error(`${d}: interactive mode needs a terminal. use --print for pipes.`),await l.dispose(),process.exitCode=2;return}ot();let{runWorkbench:Ne}=await import("./chunk-
|
|
102
|
+
`);if(g&&(process.exitCode=1,g.errorMessage)){console.error(`${d}: ${g.errorMessage}`);let p=q(g.errorMessage);p!==void 0&&console.error(`${d}: ${p}`)}}finally{w?.(),await l.dispose()}return}if(!process.stdin.isTTY||!process.stdout.isTTY){console.error(`${d}: interactive mode needs a terminal. use --print for pipes.`),await l.dispose(),process.exitCode=2;return}ot();let{runWorkbench:Ne}=await import("./chunk-KJ6YW5NT.js"),{autoUpdateEnabled:Fe,isInstalledCopy:Le}=await import("./chunk-LYLJZVZ7.js"),Ue=Le()&&Fe(`${f}/settings.json`),W=process.env.HOWTOCODE_DISCORD_DISABLE==="1"?"":process.env.HOWTOCODE_DISCORD_CLIENT_ID?.trim()||B(f).discordClientId||de,G=W?new M({clientId:W,activity:le({modelLabel:l.modelLabel,cwd:t,largeImage:process.env.HOWTOCODE_DISCORD_LARGE_IMAGE})}):void 0;G?.start();try{await Ne({cwd:t,modelLabel:l.modelLabel,session:l.session,dispose:()=>l.dispose(),setCompressToolOutput:l.setCompressToolOutput,initialPrompt:r.prompt||void 0,note:l.note,approval:r.approval,maxBudgetUsd:r.maxBudgetUsd,update:Ue?{current:y,install:!0}:void 0,reopen:H})}finally{G?.stop()}}re(d);nt().catch(i=>{F(d,void 0,i),process.exitCode=1});
|