sliccy 6.26.0 → 6.27.0
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/ui/assets/account-store-BFRRUhy7.js +101 -0
- package/dist/ui/assets/{account-store-DD9Lm9YR.js → account-store-foz0G5br.js} +1 -1
- package/dist/ui/assets/{adobe-B8faM0X0.js → adobe-CIwaIBqR.js} +1 -1
- package/dist/ui/assets/{adobe-Dmwc0xVk.js → adobe-D9cEKMmT.js} +1 -1
- package/dist/ui/assets/{agent-message-to-chat-CuDaZRuR.js → agent-message-to-chat-ri8Fr4Sv.js} +1 -1
- package/dist/ui/assets/{apply-layout-BU1W8Ntd.js → apply-layout-wSCV8r_6.js} +1 -1
- package/dist/ui/assets/{apps-CDzLxhpd.js → apps-CgyTd8AN.js} +1 -1
- package/dist/ui/assets/{azure-openai-C86DxjsX.js → azure-openai-Bmz55YHK.js} +1 -1
- package/dist/ui/assets/{azure-openai-Dp3VbXUG.js → azure-openai-DTY8yWxi.js} +1 -1
- package/dist/ui/assets/{bsh-watchdog-DTKmVPld.js → bsh-watchdog-BTqRxbnH.js} +1 -1
- package/dist/ui/assets/{cerebras-2DsZoQg-.js → cerebras-TOMBhFTF.js} +1 -1
- package/dist/ui/assets/{cerebras-Bqu2WJgd.js → cerebras-uSqY0iy8.js} +1 -1
- package/dist/ui/assets/{connect-surface-Bsbaun5q.js → connect-surface-9zMud26y.js} +1 -1
- package/dist/ui/assets/{ensure-speech-assets-CzwTkGxm.js → ensure-speech-assets-DNIhbHym.js} +1 -1
- package/dist/ui/assets/{esbuild-wasm-Bnp5hszJ.js → esbuild-wasm-CUz5LFrh.js} +1 -1
- package/dist/ui/assets/feature-flags-Cf-Bv5AK.js +1 -0
- package/dist/ui/assets/{fs-CXaHL1tX.js → fs-CIaJPTFG.js} +1 -1
- package/dist/ui/assets/{fs-BPPahbV4.js → fs-D5DDeJ40.js} +2 -2
- package/dist/ui/assets/{github-nngAeAEj.js → github-6IgS5BCx.js} +1 -1
- package/dist/ui/assets/{github-C5cSfvYu.js → github-aeeIR73Y.js} +2 -2
- package/dist/ui/assets/{github-copilot-ZcusliLR.js → github-copilot-DPg7Q7Dl.js} +1 -1
- package/dist/ui/assets/{github-copilot-C901clE0.js → github-copilot-oot0wyZb.js} +1 -1
- package/dist/ui/assets/{hear-eesTGUNb.js → hear-Sb2Ceuh0.js} +1 -1
- package/dist/ui/assets/{installer-kDSMsl2T.js → installer-DuGbDCC9.js} +1 -1
- package/dist/ui/assets/{kernel-worker-BapJwEQP.js → kernel-worker-C8bbnMB9.js} +654 -610
- package/dist/ui/assets/{kokoro-engine-BNfHBl2r.js → kokoro-engine-DKoaJW2G.js} +1 -1
- package/dist/ui/assets/{local-llm-KByLfTE5.js → local-llm-BQA5N10r.js} +1 -1
- package/dist/ui/assets/{local-llm-BHVv5-PS.js → local-llm-Bt8JAi9d.js} +1 -1
- package/dist/ui/assets/{magick-wasm-CTgpng4k.js → magick-wasm-f6c6OoOu.js} +1 -1
- package/dist/ui/assets/{main-DrMc-vO5.js → main-C_BNzXQ9.js} +3 -3
- package/dist/ui/assets/{mount-DqfutsVm.js → mount-D5JmQSHP.js} +2 -2
- package/dist/ui/assets/{mount-recovery-DvwCpZI4.js → mount-recovery-C7S2ZSST.js} +1 -1
- package/dist/ui/assets/{mount-CRCj2mBY.js → mount-z-hUj9ip.js} +1 -1
- package/dist/ui/assets/new-session-CbKboZw1.js +2 -0
- package/dist/ui/assets/{oauth-bootstrap-CMUtsYiS.js → oauth-bootstrap-B8XgPixA.js} +2 -2
- package/dist/ui/assets/{openai-codex-Ch99oDpq.js → openai-codex-BfX-KHdi.js} +1 -1
- package/dist/ui/assets/{openai-codex-TKoND3xz.js → openai-codex-CI0ZHV6e.js} +1 -1
- package/dist/ui/assets/{openrouter-DcDWM4EI.js → openrouter-BQd8_4D3.js} +1 -1
- package/dist/ui/assets/{openrouter-DqK2AtMN.js → openrouter-Bpdw4CU7.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-R1KVKI43.js → openrouter-oauth-BbRB8TYn.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-BoRdIbX5.js → openrouter-oauth-DqrBrwBl.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-GtAA-fGo.js → panel-rpc-handlers-DKMneMde.js} +2 -2
- package/dist/ui/assets/{provider-CCfuViiH.js → provider-DWmRRHJ2.js} +2 -2
- package/dist/ui/assets/{provider-CkuMATn2.js → provider-DprVAMKw.js} +1 -1
- package/dist/ui/assets/{provider-settings-1ecS2pWl.js → provider-settings-BHQDvyER.js} +1 -1
- package/dist/ui/assets/{provider-settings-mpYNzEGH.js → provider-settings-Df1iUjUV.js} +1 -1
- package/dist/ui/assets/{provider-store-access-CrgfxDeO.js → provider-store-access-CeKK_4cf.js} +2 -2
- package/dist/ui/assets/provider-store-access-CrUUW9Vb.js +1 -0
- package/dist/ui/assets/{providers-YwT6GVHx.js → providers-DWjdo_Zn.js} +2 -2
- package/dist/ui/assets/{providers-COCo973d.js → providers-DeRrvfUn.js} +1 -1
- package/dist/ui/assets/{quick-llm-DciVCRXg.js → quick-llm-BqLmelbL.js} +1 -1
- package/dist/ui/assets/redirect-uri-DOGGnPYG.js +1 -0
- package/dist/ui/assets/session-freezer-DM-Hg5H7.js +69 -0
- package/dist/ui/assets/{setup-feature-flags-remote-L37wnONH.js → setup-feature-flags-remote-yoPTgNpR.js} +1 -1
- package/dist/ui/assets/{setup-standalone-prelude-xwbkl5hV.js → setup-standalone-prelude-BREQdxMn.js} +1 -1
- package/dist/ui/assets/{setup-sudo-CsI0_-eR.js → setup-sudo-nmtM5m8F.js} +2 -2
- package/dist/ui/assets/{shared-pjIf7b3g.js → shared-SS_FwfdN.js} +2 -2
- package/dist/ui/assets/{skills-BQ9CXiyy.js → skills-DiKoMS1e.js} +3 -3
- package/dist/ui/assets/{speak-FgPyHiBQ.js → speak-CrTN7B3e.js} +1 -1
- package/dist/ui/assets/{store-Btjqu79j.js → store-BcZIdMJu.js} +1 -1
- package/dist/ui/assets/{sudo-CAu51jWR.js → sudo-BaUaef2n.js} +1 -1
- package/dist/ui/assets/{tool-result-images-AGln5sut.js → tool-result-images-DlFhKgpw.js} +1 -1
- package/dist/ui/assets/{transcript-limits-HrXqL2T0.js → transcript-limits-B8212Rg9.js} +1 -1
- package/dist/ui/assets/{transformers-env-fPn9uCat.js → transformers-env-jJU-CdDZ.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-C_WQiuty.js → upgrade-detection-C_IOtZ1H.js} +1 -1
- package/dist/ui/assets/{wc-extension-Bpz27hEu.js → wc-extension-DBYq78B7.js} +2 -2
- package/dist/ui/assets/{wc-follower-g3I1dWxU.js → wc-follower-B89SOqCP.js} +3 -3
- package/dist/ui/assets/wc-live-DEhbSa8n.js +8 -0
- package/dist/ui/assets/{wc-nav-CqginuhN.js → wc-nav-emiWjtk3.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-DqOpIEF5.js → wc-onboarding-CHGvcsH0.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-CdExRwHj.js → wc-placeholder-BBMjRwcN.js} +2 -2
- package/dist/ui/assets/{wc-settings-D5xpKHuM.js → wc-settings-B8aChhlp.js} +3 -3
- package/dist/ui/assets/{wc-shell-XLpbKn2Q.js → wc-shell-uf2_nCN7.js} +2 -2
- package/dist/ui/assets/{wc-sprinkles-BdopWF-Y.js → wc-sprinkles-BKHV5mdE.js} +2 -2
- package/dist/ui/assets/{wc-tray-DfxrWpHZ.js → wc-tray-CQu_CEZD.js} +2 -2
- package/dist/ui/assets/{whisper-engine-Bddvms5V.js → whisper-engine-COt17pKd.js} +1 -1
- package/dist/ui/assets/{xai-grok-CJHnmlcy.js → xai-grok-C9C2_zRc.js} +1 -1
- package/dist/ui/assets/{xai-grok-CnFbk_Ys.js → xai-grok-bSG9AdQZ.js} +1 -1
- package/dist/ui/index.html +7 -7
- package/dist/ui/packages/webapp/index.html +7 -7
- package/package.json +1 -1
- package/dist/ui/assets/account-store-Bu6Opk8I.js +0 -101
- package/dist/ui/assets/feature-flags-CAZ3YsY7.js +0 -1
- package/dist/ui/assets/new-session-BVMB10RR.js +0 -2
- package/dist/ui/assets/provider-store-access-D5o81tG5.js +0 -1
- package/dist/ui/assets/redirect-uri-C0xNu-Lx.js +0 -1
- package/dist/ui/assets/session-freezer-Djcsshfh.js +0 -23
- package/dist/ui/assets/wc-live-B-RROa9f.js +0 -8
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>slicc</title>
|
|
7
7
|
<link rel="icon" type="image/png" href="/logos/sliccy-color-1scoops-32x32.png" />
|
|
8
|
-
<script type="module" crossorigin src="/assets/main-
|
|
8
|
+
<script type="module" crossorigin src="/assets/main-C_BNzXQ9.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-Dezn_h7o.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
|
|
@@ -27,24 +27,24 @@
|
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/secrets-bridge-client-CUeSRcdV.js">
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/tool-ui-DfXu6quJ.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/tool-result-images-DwRGZUe_.js">
|
|
30
|
-
<link rel="modulepreload" crossorigin href="/assets/providers-
|
|
30
|
+
<link rel="modulepreload" crossorigin href="/assets/providers-DWjdo_Zn.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/panel-rpc-DmJSNs0I.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/assets/transform-messages-DgR3h-Ck.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/bedrock-camp-CVX95quY.js">
|
|
34
|
-
<link rel="modulepreload" crossorigin href="/assets/account-store-
|
|
34
|
+
<link rel="modulepreload" crossorigin href="/assets/account-store-foz0G5br.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/electron-overlay-route-CjT6k9Df.js">
|
|
36
36
|
<link rel="modulepreload" crossorigin href="/assets/bridge-launch-params-BUV5qlt9.js">
|
|
37
|
-
<link rel="modulepreload" crossorigin href="/assets/feature-flags-
|
|
37
|
+
<link rel="modulepreload" crossorigin href="/assets/feature-flags-Cf-Bv5AK.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/assets/messages-BD4p8GuF.js">
|
|
39
39
|
<link rel="modulepreload" crossorigin href="/assets/tray-runtime-config-BxjVzwAJ.js">
|
|
40
40
|
<link rel="modulepreload" crossorigin href="/assets/runtime-mode-B91km6KC.js">
|
|
41
|
-
<link rel="modulepreload" crossorigin href="/assets/setup-sudo-
|
|
42
|
-
<link rel="modulepreload" crossorigin href="/assets/setup-standalone-prelude-
|
|
41
|
+
<link rel="modulepreload" crossorigin href="/assets/setup-sudo-nmtM5m8F.js">
|
|
42
|
+
<link rel="modulepreload" crossorigin href="/assets/setup-standalone-prelude-BREQdxMn.js">
|
|
43
43
|
<link rel="modulepreload" crossorigin href="/assets/telemetry-DqIqVG5n.js">
|
|
44
44
|
<link rel="modulepreload" crossorigin href="/assets/tray-follower-status-5SqDRLX8.js">
|
|
45
45
|
<link rel="modulepreload" crossorigin href="/assets/clipboard-DuHpK59o.js">
|
|
46
46
|
<link rel="modulepreload" crossorigin href="/assets/tray-join-url-BIvzbiFR.js">
|
|
47
|
-
<link rel="modulepreload" crossorigin href="/assets/provider-settings-
|
|
47
|
+
<link rel="modulepreload" crossorigin href="/assets/provider-settings-BHQDvyER.js">
|
|
48
48
|
</head>
|
|
49
49
|
<body>
|
|
50
50
|
<div id="app"></div>
|
package/package.json
CHANGED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{t as n}from"./logger-LESFN7Hj.js";import{n as r,r as i}from"./panel-rpc-CjFVE0nK.js";import{n as a,o,t as s}from"./providers-COCo973d.js";import"./src-BcePBv4G.js";import{r as c,s as l,t as u}from"./proxied-fetch-GabK83LB.js";import{t as d}from"./runtime-env-byAg9ij-.js";import{i as f,r as p}from"./tool-ui-t6ocn6AG.js";import{t as m}from"./port-bridge-client-DXYvHFiB.js";import{n as h,r as g,t as ee}from"./tool-result-images-AGln5sut.js";import{c as _,d as v,f as te,l as ne,r as re,t as ie,u as ae}from"./bedrock-camp-CHi38ceE.js";const oe=`slicc_oauth_extra_domains`;function se(e){try{let t=e.getItem(oe);if(!t)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n)){if(typeof e!=`string`||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&e.length>0);n.length>0&&(r[e]=n)}return r}catch{return{}}}function ce(e,t){try{e.setItem(oe,JSON.stringify(t))}catch(e){throw Error(`Failed to persist OAuth extras (localStorage quota exceeded?): ${e instanceof Error?e.message:String(e)}`)}}function le(){return d()?`extension-direct`:c()?`extension-delegate`:globalThis.__slicc_connect_mode?`connect`:`node-rest`}function ue(){return le()===`node-rest`}const y={assign:0,create:0,clone:0,discard:0,update:0};function b(e,t){return y.assign+=1,{...e,...t}}function de(e,t,n){return e>=t&&e<=n}function fe(e){return e===8205}function pe(e){return de(e,55296,56319)}function me(e){return de(e,127462,127487)}function he(e){return de(e,65024,65039)}function ge(e){return de(e,768,879)||de(e,6832,6911)||de(e,7616,7679)||de(e,65056,65071)}function _e(e){return e>65535?2:1}function ve(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(ge(n)||he(n))t+=_e(n);else break}return t}function ye(e,t){let n=e.codePointAt(t),r=t+_e(n);for(r=ve(e,r);r<e.length-1&&e[r]===``;){let t=e.codePointAt(r+1);r+=1+_e(t),r=ve(e,r)}return me(n)&&r<e.length&&me(e.codePointAt(r))&&(r+=_e(e.codePointAt(r))),r}function be(e){return pe(e)||ge(e)||he(e)||fe(e)}function xe(e){let t=0,n=0;for(;n<e.length;)n=ye(e,n),t++;return t}function Se(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=ye(e,r),n++,n>=t)return!0;return!1}function Ce(e,t){let n=0,r=0;for(;r<e.length;)if(r=ye(e,r),n++,n>t)return!1;return!0}function we(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(be(e.charCodeAt(n)))return Se(e,t);if(n++,n>=t)return!0}return!1}function Te(e,t){let n=0;for(;n<e.length;){if(be(e.charCodeAt(n)))return Ce(e,t);if(n++,n>t)return!1}return!0}var Ee=e({Entries:()=>$e,EntriesRegExp:()=>Qe,Every:()=>Ye,EveryAll:()=>Xe,GraphemeCount:()=>Ke,HasPropertyKey:()=>w,IsArray:()=>De,IsBigInt:()=>Oe,IsBoolean:()=>ke,IsClassInstance:()=>We,IsConstructor:()=>Ae,IsDeepEqual:()=>it,IsEqual:()=>S,IsFunction:()=>je,IsGreaterEqualThan:()=>He,IsGreaterThan:()=>ze,IsInteger:()=>Me,IsLessEqualThan:()=>Ve,IsLessThan:()=>Be,IsMaxLength:()=>qe,IsMinLength:()=>Je,IsMultipleOf:()=>Ue,IsNull:()=>Ne,IsNumber:()=>Pe,IsObject:()=>x,IsObjectNotArray:()=>Fe,IsString:()=>Ie,IsSymbol:()=>Le,IsUndefined:()=>Re,IsUnsafePropertyKey:()=>Ze,IsValueLike:()=>Ge,Keys:()=>T,ShiftLeft:()=>C,Symbols:()=>et,Values:()=>tt});function De(e){return Array.isArray(e)}function Oe(e){return S(typeof e,`bigint`)}function ke(e){return S(typeof e,`boolean`)}function Ae(e){if(Re(e)||!je(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function je(e){return S(typeof e,`function`)}function Me(e){return Number.isInteger(e)}function Ne(e){return S(e,null)}function Pe(e){return Number.isFinite(e)}function Fe(e){return x(e)&&!De(e)}function x(e){return S(typeof e,`object`)&&!Ne(e)}function Ie(e){return S(typeof e,`string`)}function Le(e){return S(typeof e,`symbol`)}function Re(e){return S(e,void 0)}function S(e,t){return e===t}function ze(e,t){return e>t}function Be(e,t){return e<t}function Ve(e,t){return e<=t}function He(e,t){return e>=t}function Ue(e,t){if(Oe(e)||Oe(t))return BigInt(e)%BigInt(t)===0n;if(!Pe(e)||Me(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))<1e-10}function We(e){if(!x(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!Ne(t)&&S(typeof t.constructor,`function`)&&!(S(t.constructor,globalThis.Object)||S(t.constructor.name,`Object`))}function Ge(e){return Oe(e)||ke(e)||Ne(e)||Pe(e)||Ie(e)||Re(e)}function Ke(e){return xe(e)}function qe(e,t){return Te(e,t)}function Je(e,t){return we(e,t)}function Ye(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Xe(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function C(e,t,n){return S(e.length,0)?n():t(e[0],e.slice(1))}function Ze(e){return S(e,`__proto__`)||S(e,`constructor`)||S(e,`prototype`)}function w(e,t){return Ze(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Qe(e){return T(e).map(t=>[RegExp(`^${t}$`),e[t]])}function $e(e){return Object.entries(e)}function T(e){return Object.getOwnPropertyNames(e)}function et(e){return Object.getOwnPropertySymbols(e)}function tt(e){return Object.values(e)}function nt(e,t){if(!x(t))return!1;let n=T(e);return S(n.length,T(t).length)&&n.every(n=>it(e[n],t[n]))}function rt(e,t){return De(t)&&S(e.length,t.length)&&e.every((n,r)=>it(e[r],t[r]))}function it(e,t){return De(e)?rt(e,t):x(e)?nt(e,t):S(e,t)}function at(e){return e instanceof Boolean}function ot(e){return e instanceof Number}function st(e){return e instanceof String}function ct(e){return globalThis.ArrayBuffer.isView(e)}function lt(e){return e instanceof globalThis.RegExp}function ut(e){return e instanceof globalThis.Date}function dt(e){return e instanceof globalThis.Set}function ft(e){return e instanceof globalThis.Map}function pt(e){return e}function mt(e){return w(e,`~kind`)||w(e,`~unsafe`)}function ht(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(Ze(e))continue;let r=n[e];w(r,`value`)&&Object.defineProperty(t,e,{...r,value:Ct(r.value)})}return t}function gt(e){let t={};for(let n of T(e))Ze(n)||(t[n]=Ct(e[n]));for(let n of et(e))t[n]=Ct(e[n]);return t}function _t(e){return We(e)?pt(e):mt(e)?ht(e):gt(e)}function vt(e){return e.map(e=>Ct(e))}function yt(e){return e.slice()}function bt(e){return new RegExp(e.source,e.flags)}function xt(e){return new Map(Ct([...e.entries()]))}function St(e){return new Set(Ct([...e.values()]))}function Ct(e){return ct(e)?yt(e):lt(e)?bt(e):ft(e)?xt(e):dt(e)?St(e):De(e)?vt(e):x(e)?_t(e):e}function wt(e){return y.clone+=1,Ct(e)}const Tt={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Et(){return Tt}function Dt(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Ot(e,t){return{...e,...t}}function E(e,t,n={}){y.create+=1;let r=Et(),i=Ot(t,n),a=r.enumerableKind?Ot(i,e):Dt(i,e);return r.immutableTypes?Object.freeze(a):a}function kt(e,t){y.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(wt(e)),i=new Set(t);for(let e of Object.keys(r))i.has(e)||Object.defineProperty(n,e,r[e]);return n}function D(e,t,n){y.update+=1;let r=Et(),i=wt(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function O(e,t){return x(e)&&w(e,`~kind`)&&S(e[`~kind`],t)}function At(e){return x(e)}function k(e,t,n){return E({"~kind":`Deferred`},{type:`deferred`,action:e,parameters:t,options:n},{})}function jt(e){return O(e,`Deferred`)}function Mt(e){return D(e,{"~readonly":!0},{})}function Nt(e,t){return D(Mt(e),{},t)}function Pt(e,t,n,r){return Nt(q(e,t,n),r)}function Ft(e){return D(e,{"~optional":!0},{})}function It(e,t){return D(Ft(e),{},t)}function Lt(e,t,n,r){return It(q(e,t,n),r)}function Rt(e,t){return E({"~kind":`Array`},{type:`array`,items:e},t)}function zt(e){return O(e,`Array`)}function Bt(e){return kt(e,[`~kind`,`type`,`items`])}function Vt(e,t,n={}){return E({"~kind":`Constructor`},{type:`constructor`,parameters:e,instanceType:t},n)}function Ht(e){return O(e,`Constructor`)}function Ut(e){return kt(e,[`~kind`,`type`,`parameters`,`instanceType`])}function Wt(e,t,n={}){return E({"~kind":`Function`},{type:`function`,parameters:e,returnType:t},n)}function Gt(e){return O(e,`Function`)}function Kt(e){return kt(e,[`~kind`,`type`,`parameters`,`returnType`])}function qt(e,t){return E({"~kind":`Ref`},{$ref:e},t)}function Jt(e){return O(e,`Ref`)}function Yt(e,t){return E({"~kind":`Generic`},{type:`generic`,parameters:e,expression:t})}function Xt(e){return O(e,`Generic`)}function Zt(e){return E({"~kind":`Any`},{},e)}function Qt(e){return O(e,`Any`)}function $t(e){return E({"~kind":`Never`},{not:{}},e)}function en(e){return O(e,`Never`)}function tn(e,t={}){return It(e,t)}function nn(e){return tn(e)}function rn(e){return At(e)&&w(e,`~optional`)}function an(e){return T(e).filter(t=>!rn(e[t]))}function on(e){return T(e)}function sn(e){return tt(e)}function A(e,t={}){let n=an(e);return E({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function j(e){return O(e,`Object`)}function cn(e){return kt(e,[`~kind`,`type`,`properties`,`required`])}function ln(e){return E({"~kind":`Unknown`},{},e)}function un(e){return O(e,`Unknown`)}function dn(e,t,n){return E({"~kind":`Cyclic`},{$defs:T(e).reduce((t,n)=>({...t,[n]:D(e[n],{},{$id:n})}),{}),$ref:t},n)}function fn(e){return O(e,`Cyclic`)}function pn(e){return Fe(e)&&w(e,`~unsafe`)&&Ne(e[`~unsafe`])}function mn(e){return O(e,`Infer`)}function hn(e,t,n,r={}){return E({"~kind":`Dependent`},{if:e,then:t,else:n},r)}function gn(e){return O(e,`Dependent`)}function _n(e){return kt(e,[`~kind`,`if`,`then`,`else`])}function vn(e){return O(e,`Enum`)}function yn(e,t={}){return E({"~kind":`Intersect`},{allOf:e},t)}function M(e){return O(e,`Intersect`)}function bn(e){return kt(e,[`~kind`,`allOf`])}function xn(){throw Error(`Unreachable`)}var Sn=e({Hash:()=>Yn,HashCode:()=>Jn});function Cn(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let e of Reflect.ownKeys(n))e!==`constructor`&&typeof e!=`symbol`&&t.add(e);n=Object.getPrototypeOf(n)}return[...t]}function wn(e){return typeof e==`number`}var N;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(N||={});let Tn=BigInt(`14695981039346656037`);const[En,Dn]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],On=Array.from({length:256}).map((e,t)=>BigInt(t)),kn=new Float64Array(1),An=new DataView(kn.buffer),jn=new Uint8Array(kn.buffer);function P(e){Tn^=On[e],Tn=Tn*En%Dn}function Mn(e){P(N.Array);for(let t of e)qn(t)}function Nn(e){P(N.BigInt),An.setBigInt64(0,e);for(let e of jn)P(e)}function Pn(e){P(N.Boolean),P(+!!e)}function Fn(e){P(N.Constructor),qn(e.toString())}function In(e){P(N.Date),qn(e.getTime())}function Ln(e){P(N.Function),qn(e.toString())}function Rn(e){P(N.Null)}function zn(e){P(N.Number),An.setFloat64(0,e,!0);for(let e of jn)P(e)}function Bn(e){P(N.Object);for(let t of Cn(e).sort())qn(t),qn(e[t])}function Vn(e){P(N.RegExp),Un(e.toString())}const Hn=new TextEncoder;function Un(e){P(N.String);for(let t of Hn.encode(e))P(t)}function Wn(e){P(N.Symbol),qn(e.toString())}function Gn(e){P(N.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)P(t[e])}function Kn(e){return P(N.Undefined)}function qn(e){return ct(e)?Gn(e):ut(e)?In(e):lt(e)?Vn(e):at(e)?Pn(e.valueOf()):st(e)?Un(e.valueOf()):ot(e)?zn(e.valueOf()):wn(e)?zn(e):De(e)?Mn(e):ke(e)?Pn(e):Oe(e)?Nn(e):Ae(e)?Fn(e):Ne(e)?Rn(e):x(e)?Bn(e):Ie(e)?Un(e):Le(e)?Wn(e):Re(e)?Kn(e):je(e)?Ln(e):xn()}function Jn(e){return Tn=BigInt(`14695981039346656037`),qn(e),Tn}function Yn(e){return Jn(e).toString(16).padStart(16,`0`)}function Xn(e){return At(e)&&w(e,`~codec`)&&x(e[`~codec`])&&w(e[`~codec`],`encode`)&&w(e[`~codec`],`decode`)}function Zn(e){return At(e)&&w(e,`~immutable`)}function Qn(e,t={}){return Nt(e,t)}function $n(e){return At(e)&&w(e,`~readonly`)}function er(e){return E({"~kind":`BigInt`},{type:`bigint`},e)}function tr(e){return O(e,`BigInt`)}function nr(e){return O(e,`Boolean`)}const rr=`-?(?:0|[1-9][0-9]*)`;function ir(e){return E({"~kind":`Integer`},{type:`integer`},e)}function ar(e){return O(e,`Integer`)}var or=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function sr(e){return Oe(e)?`bigint`:ke(e)?`boolean`:Pe(e)?`number`:Ie(e)?`string`:(()=>{throw new or(e)})()}function F(e,t){return E({"~kind":`Literal`},{type:sr(e),const:e},t)}function cr(e){return Oe(e)||ke(e)||Pe(e)||Ie(e)}function lr(e){return I(e)&&Oe(e.const)}function ur(e){return I(e)&&ke(e.const)}function dr(e){return I(e)&&Pe(e.const)}function fr(e){return I(e)&&Ie(e.const)}function I(e){return O(e,`Literal`)}function pr(e){return E({"~kind":`Null`},{type:`null`},e)}function mr(e){return O(e,`Null`)}const hr=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function gr(e){return E({"~kind":`Number`},{type:`number`},e)}function _r(e){return O(e,`Number`)}function vr(e){return E({"~kind":`Symbol`},{type:`symbol`},e)}function yr(e){return O(e,`Symbol`)}function br(e){return E({"~kind":`String`},{type:`string`},e)}function xr(e){return O(e,`String`)}function L(e,t={}){return E({"~kind":`Union`},{anyOf:e},t)}function R(e){return O(e,`Union`)}function Sr(e){return kt(e,[`~kind`,`anyOf`])}function Cr(e){let t=Ka(e);return S(t.length,2)?t[0]:[]}function wr(e){return!0}function Tr(e){return C(e,(e,t)=>Dr(e)?Tr(t):!1,()=>!0)}function Er(e){return!S(e.length,0)&&Tr(e)}function Dr(e){return R(e)?Er(e.anyOf):I(e)?wr(e.const):!1}function Or(e){return Er(e)}function kr(e){return E({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function Ar(e,t,n=[]){return C(e,(e,r)=>Ar(r,t,[...n,`${e}${t}`]),()=>n)}function jr(e,t){return S(e.length,0)?[`${t}`]:Ar(e,t)}function Mr(e,t,n=[]){return C(t,(t,r)=>Mr(e,r,[...n,...Nr(e,t)]),()=>n)}function Nr(e,t){return R(t)?Mr(e,t.anyOf):I(t)?jr(e,t.const):xn()}function Pr(e,t){return C(t,(t,n)=>Pr(Nr(e,t),n),()=>e)}function Fr(e){return e.map(e=>F(e))}function Ir(e){return L(Fr(Pr([],e)))}function Lr(e){return S(e.length,0)?xn():S(e.length,1)&&I(e[0])?e[0]:Ir(e)}function Rr(e){let t=Cr(e);return S(t.length,0)?br():Or(t)?Lr(t):kr(e)}function zr(e){let t=Rr(e);return mo(t)?br():t}function Br(e,t){return E({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function Vr(e){return Br(Wi,e)}function Hr(e){return A({true:e,false:e})}function Ur(e,t={}){let[n,r,i]=[e,e.length,!1];return E({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function z(e){return O(e,`Tuple`)}function Wr(e){return kt(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function Gr(e){return kt(e,[`~readonly`])}function Kr(e,t){return D(Gr(e),{},t)}function qr(e,t,n,r){return Kr(q(e,t,n),r)}function Jr(e,t={}){return Kr(e,t)}function Yr(e){return kt(e,[`~optional`])}function Xr(e,t){return D(Yr(e),{},t)}function Zr(e,t,n,r){return Xr(q(e,t,n),r)}function Qr(e,t={}){return Xr(e,t)}function $r(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function ei(e){return A($r(e.items))}function ti(e,t){return $n(e)?!!$n(t):!1}function ni(e,t){return rn(e)?!!rn(t):!1}function ri(e,t){let n=ti(e,t),r=ni(e,t),i=Jr(Qr(bi([e,t])));return n&&r?Qn(tn(i)):n&&!r?Qn(i):!n&&r?tn(i):i}function ii(e,t,n){return n in e?n in t?ri(e[n],t[n]):e[n]:n in t?t[n]:$t()}function ai(e,t){return[...new Set([...T(t),...T(e)])].reduce((n,r)=>({...n,[r]:ii(e,t,r)}),{})}function oi(e){return j(e)?e.properties:z(e)?$r(e.items):xn()}function si(e,t){return A(ai(oi(e),oi(t)))}function ci(e,t){let n=pc(e,t);return S(n,`left-inside`)?e:S(n,`right-inside`)||S(n,`equal`)?t:$t()}function li(e){return j(e)||z(e)}function ui(e,t){let n=R(e),r=R(t);return n||r}function di(e,t){let n=Ci(e),r=Ci(t),i=ui(n,r),a=li(n),o=li(r);return i?bi([n,r]):a&&o?si(n,r):a&&!o?n:!a&&o?r:ci(n,r)}function fi(e,t,n=[]){return C(t,(t,r)=>fi(e,r,[...n,di(e,t)]),()=>S(n.length,0)?[e]:n)}function pi(e,t,n=[]){return C(e,(e,r)=>pi(r,t,[...n,...mi([e],t)]),()=>n)}function mi(e,t=[]){return C(e,(e,n)=>R(e)?mi(n,pi(e.anyOf,t)):mi(n,fi(e,t)),()=>t)}function hi(e,t){return yo(fc({},e,t))?[]:[e]}function gi(e,t){return e.reduce((e,n)=>[...e,...hi(n,t)],[])}function _i(e,t){let n=Ci(e);return Si(gi(R(n)?n.anyOf:[n],t))}function vi(e,t,n){return Si([yn([e,t]),_i(n,e)])}function yi(e){return Si(e.map(e=>F(e)))}function bi(e){return wi(vc(mi(e)))}function xi(e){return Ci(zr(e))}function Si(e){return wi(vc(e))}function Ci(e){return gn(e)?vi(e.if,e.then,e.else):vn(e)?yi(e.enum):M(e)?bi(e.allOf):mo(e)?xi(e.pattern):R(e)?Si(e.anyOf):e}function wi(e){return S(e.length,1)?e[0]:S(e.length,0)?$t():L(e)}function Ti(e,t){return zi(yi(e),t)}function Ei(e,t){return Br(Hi,t)}function Di(e,t){return zi(bi(e),t)}function Oi(e,t){return Ie(e)||Pe(e)?A({[e]:t}):S(e,!1)?A({false:t}):S(e,!0)?A({true:t}):A({})}function ki(e,t){return Br(Ui,t)}function Ai(e,t){return w(e,`pattern`)&&(Ie(e.pattern)||e.pattern instanceof RegExp)?Br(e.pattern.toString(),t):Br(Wi,t)}function ji(e,t){return Or(Cr(e))?zi(xi(e),t):Br(e,t)}function Mi(e){return R(e)?Ni(e.anyOf):[e]}function Ni(e){return e.reduce((e,t)=>[...e,...Mi(t)],[])}function Pi(e){return e.some(e=>xr(e)||_r(e)||ar(e))}function Fi(e,t){return S(Pi(e),!0)?Br(Wi,t):void 0}function Ii(e,t){return e.reduce((e,n)=>I(n)&&(Ie(n.const)||Pe(n.const))?{...e,[n.const]:t}:e,{})}function Li(e,t){return A(Ii(e,t))}function Ri(e,t){let n=Ni(e),r=Fi(n,t);return At(r)?r:Li(n,t)}function zi(e,t){return Qt(e)?Vr(t):nr(e)?Hr(t):vn(e)?Ti(e.enum,t):ar(e)?Ei(e,t):M(e)?Di(e.allOf,t):I(e)?Oi(e.const,t):_r(e)?ki(e,t):R(e)?Ri(e.anyOf,t):xr(e)?Ai(e,t):mo(e)?ji(e.pattern,t):A({})}function Bi(e,t,n){return K([e])?D(zi(e,t),{},n):Gi(e,t,n)}function Vi(e,t,n,r,i){return Bi(q(e,t,n),q(e,t,r),i)}const Hi=`^${rr}$`,Ui=`^${hr}$`,Wi=`^.*$`;function Gi(e,t,n={}){return k(`Record`,[e,t],n)}function Ki(e,t,n={}){return Bi(e,t,n)}function qi(e,t){return Br(e,t)}function Ji(e){return S(e,Wi)?br():S(e,Hi)?ir():S(e,Ui)?gr():Rr(e)}function Yi(e){return T(e.patternProperties)[0]}function Xi(e){return Ji(Yi(e))}function Zi(e){return e.patternProperties[Yi(e)]}function Qi(e){return O(e,`Record`)}function $i(e){return E({"~kind":`Rest`},{type:`rest`,items:e},{})}function ea(e){return O(e,`Rest`)}function ta(e){return O(e,`This`)}function na(e){return E({"~kind":`Undefined`},{type:`undefined`},e)}function ra(e){return O(e,`Undefined`)}function ia(e){return O(e,`Void`)}function aa(e){return er()}function oa(e){return br()}function sa(e){return gr()}function ca(e){return ir()}function la(e){return $t()}function ua(e){return F(e)}function da(e){return e}function fa(e){return L(e[1])}function pa(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function ma(e){return[e[0],...e[1]]}function ha(e){return e}function ga(e){return e[1]}function _a(e){return S(e.length,2)}function va(e,t,n){return _a(e)?t(e[0],e[1]):n()}function ya(e,t){return S(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function ba(e,t){for(let n=0;n<e.length;n++){let r=ya(e[n],t);if(_a(r))return r}return[]}function xa(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}const Sa=[...xa(97,122),...xa(65,90)],Ca=[`0`,...xa(49,57)];function wa(e){let t=e.indexOf(`*/`);return S(t,-1)?``:e.slice(t+2)}function Ta(e){let t=e.indexOf(`
|
|
2
|
-
`);return S(t,-1)?``:e.slice(t)}function Ea(e){return e.replace(/^[ \t\r\f\v]+/,``)}function Da(e){let t=Ea(e);return t.startsWith(`/*`)?Da(wa(t.slice(2))):t.startsWith(`//`)?Da(Ta(t.slice(2))):t}function Oa(e){let t=e.trimStart();return t.startsWith(`/*`)?Oa(wa(t.slice(2))):t.startsWith(`//`)?Oa(Ta(t.slice(2))):t}[...Ca];function ka(e,t){return ba([e],t)}function Aa(e,t){return S(e,``)?[``,t]:e.startsWith(`
|
|
3
|
-
`)?ka(e,Da(t)):e.startsWith(` `)?ka(e,t):ka(e,Oa(t))}[...Sa,...Ca],[...Ca];function ja(e){return S(e,``)?[]:[e.slice(0,1),e.slice(1)]}function Ma(e,t){return C(e,(e,n)=>t.startsWith(e)?!0:Ma(n,t),()=>!1)}function Na(e,t,n=``){return va(ja(t),(r,i)=>Ma(e,t)?[n,t]:Na(e,i,`${n}${r}`),()=>[])}function Pa(e,t){return va(Na(e,t),(e,t)=>S(e,``)?[]:[e,t],()=>[])}const B=(e,t,n=()=>[])=>e.length===2?t(e):n(),Fa=e=>B(Aa(`-?(?:0|[1-9][0-9]*)n`,e),([e,t])=>[aa(e),t]),Ia=e=>B(Aa(`.*`,e),([e,t])=>[oa(e),t]),La=e=>B(Aa(`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,e),([e,t])=>[sa(e),t]),Ra=e=>B(Aa(`-?(?:0|[1-9][0-9]*)`,e),([e,t])=>[ca(e),t]),za=e=>B(Aa(`(?!)`,e),([e,t])=>[la(e),t]),Ba=e=>B(Pa([`-?(?:0|[1-9][0-9]*)n`,`.*`,`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,`-?(?:0|[1-9][0-9]*)`,`(?!)`,`(`,`)`,`$`,`|`],e),([e,t])=>[ua(e),t]),Va=e=>B(B(Fa(e),([e,t])=>[e,t],()=>B(Ia(e),([e,t])=>[e,t],()=>B(La(e),([e,t])=>[e,t],()=>B(Ra(e),([e,t])=>[e,t],()=>B(za(e),([e,t])=>[e,t],()=>B(Ha(e),([e,t])=>[e,t],()=>B(Ba(e),([e,t])=>[e,t],()=>[]))))))),([e,t])=>[da(e),t]),Ha=e=>B(B(Aa(`(`,e),([e,t])=>B(Ga(t),([t,n])=>B(Aa(`)`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[fa(e),t]),Ua=e=>B(B(B(Wa(e),([e,t])=>B(Aa(`|`,t),([t,n])=>B(Ua(n),([n,r])=>[[e,t,n],r]))),([e,t])=>[e,t],()=>B(B(Wa(e),([e,t])=>[[e],t]),([e,t])=>[e,t],()=>B([[],e],([e,t])=>[e,t],()=>[]))),([e,t])=>[pa(e),t]),Wa=e=>B(B(Va(e),([e,t])=>B(Ga(t),([t,n])=>[[e,t],n])),([e,t])=>[ma(e),t]),Ga=e=>B(B(Ua(e),([e,t])=>[e,t],()=>B(Wa(e),([e,t])=>[e,t],()=>[])),([e,t])=>[ha(e),t]),Ka=e=>B(B(Aa(`^`,e),([e,t])=>B(Ga(t),([t,n])=>B(Aa(`$`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[ga(e),t]);function qa(e){return e.join(`|`)}function Ja(e){return e.slice(1,e.length-1)}function Ya(e,t,n){return oo(t,`${n}${e}`)}function Xa(e,t){return oo(e,`${t}-?(?:0|[1-9][0-9]*)n`)}function Za(e,t){return oo(e,`${t}${rr}`)}function Qa(e,t){return oo(e,`${t}${hr}`)}function $a(e,t){return ao(L([F(`false`),F(`true`)]),e,t)}function eo(e,t){return oo(e,`${t}.*`)}function to(e,t,n){return oo(t,`${n}${Ja(e)}`)}function no(e,t,n){return ao(lo(e,{}),t,n)}function ro(e,t,n){return ao(yi(e),t,n)}function io(e,t,n,r=[]){return C(e,(e,i)=>io(i,t,n,[...r,ao(e,[],``)]),()=>oo(t,`${n}(${qa(r)})`))}function ao(e,t,n){return vn(e)?ro(e.enum,t,n):ar(e)?Za(t,n):I(e)?Ya(e.const,t,n):tr(e)?Xa(t,n):nr(e)?$a(t,n):_r(e)?Qa(t,n):xr(e)?eo(t,n):mo(e)?to(e.pattern,t,n):po(e)?no(e.parameters[0],t,n):R(e)?io(e.anyOf,t,n):`(?!)`}function oo(e,t){return C(e,(e,n)=>ao(e,n,t),()=>t)}function so(e){return`^${oo(e,``)}$`}function co(e){return kr(so(e))}function lo(e,t){return K(e)?D(co(e),{},t):fo(e,t)}function uo(e,t,n,r){return lo(_f(e,t,n),r)}function fo(e,t={}){return k(`TemplateLiteral`,[e],t)}function po(e){return At(e)&&w(e,`action`)&&S(e.action,`TemplateLiteral`)}function mo(e){return O(e,`TemplateLiteral`)}function ho(e){return E({"~kind":`ExtendsUnion`},{inferred:e})}function go(e){return x(e)&&w(e,`~kind`)&&w(e,`inferred`)&&S(e[`~kind`],`ExtendsUnion`)&&x(e.inferred)}function V(e){return E({"~kind":`ExtendsTrue`},{inferred:e})}function _o(e){return x(e)&&w(e,`~kind`)&&w(e,`inferred`)&&S(e[`~kind`],`ExtendsTrue`)&&x(e.inferred)}function H(){return E({"~kind":`ExtendsFalse`},{})}function vo(e){return x(e)&&w(e,`~kind`)&&S(e[`~kind`],`ExtendsFalse`)}function yo(e){return go(e)||_o(e)}function U(e,t,n){return yo(e)?t(e.inferred):n()}function bo(e,t,n,r){return U(G(e,n,r),r=>V(b(b(e,r),{[t]:n})),()=>H())}function xo(e,t){return V(e)}function So(e,t,n,r,i){return U(G(e,t,n),e=>U(G(e,t,r),e=>V(e),()=>H()),()=>U(G(e,t,i),e=>V(e),()=>H()))}function Co(e,t,n){return G(e,t,yi(n))}function wo(e,t,n){return C(n,(n,r)=>U(G(e,t,n),e=>wo(e,t,r),()=>H()),()=>V(e))}function To(e,t,n){return G(e,t,xi(n))}function Eo(e,t,n){return C(n,(n,r)=>U(G(e,t,n),e=>V(e),()=>Eo(e,t,r)),()=>H())}function W(e,t,n){return Qt(n)?xo(e,t):gn(n)?So(e,t,n.if,n.then,n.else):vn(n)?Co(e,t,n.enum):mn(n)?bo(e,n.name,t,n.extends):M(n)?wo(e,t,n.allOf):mo(n)?To(e,t,n.pattern):R(n)?Eo(e,t,n.anyOf):un(n)?V(e):H()}function Do(e,t,n){return mn(n)?W(e,t,n):Qt(n)||un(n)?V(e):ho(e)}function Oo(e,t){let n=Zn(e),r=Zn(t);return n&&r||!n&&r?!0:!(n&&!r)}function ko(e,t,n,r){return zt(r)?Oo(t,r)?G(e,n,r.items):H():W(e,t,r)}function Ao(e,t,n){return tr(n)?V(e):W(e,t,n)}function jo(e,t,n){return nr(n)?V(e):W(e,t,n)}function Mo(e,t,n,r,i){let a=mn(r)?t:r,o=mn(r)?r:t,s=rn(t),c=rn(r);return!s&&c?H():U(G(e,a,o),e=>Fo(e,n,i),()=>H())}function No(e,t,n,r){return C(r,(r,i)=>Mo(e,t,n,r,i),()=>rn(t)?V(e):H())}function Po(e,t,n){return C(t,(t,r)=>No(e,t,r,n),()=>V(e))}function Fo(e,t,n){return Po(e,t,n)}function Io(e,t,n){return ia(n)?V(e):G(e,t,n)}function Lo(e,t,n,r){return Qt(r)||un(r)?V(e):Ht(r)?U(Fo(e,t,r.parameters),e=>Io(e,n,r.instanceType),()=>H()):H()}function Ro(e,t,n,r,i){return U(G(e,t,i),()=>G(e,n,i),()=>G(e,r,i))}function zo(e,t,n){return G(e,yi(t),n)}function Bo(e,t,n,r){return Qt(r)||un(r)?V(e):Gt(r)?U(Fo(e,t,r.parameters),e=>Io(e,n,r.returnType),()=>H()):H()}function Vo(e,t,n){return ar(n)||_r(n)?V(e):W(e,t,n)}function Ho(e,t,n){return G(e,bi(t),n)}function Uo(e,t,n){return t===n?V(e):H()}function Wo(e,t,n){return I(n)?Uo(e,t,n.const):tr(n)?V(e):W(e,F(t),n)}function Go(e,t,n){return I(n)?Uo(e,t,n.const):nr(n)?V(e):W(e,F(t),n)}function Ko(e,t,n){return I(n)?Uo(e,t,n.const):_r(n)?V(e):W(e,F(t),n)}function qo(e,t,n){return I(n)?Uo(e,t,n.const):xr(n)?V(e):W(e,F(t),n)}function Jo(e,t,n){return Oe(t.const)?Wo(e,t.const,n):ke(t.const)?Go(e,t.const,n):Pe(t.const)?Ko(e,t.const,n):Ie(t.const)?qo(e,t.const,n):xn()}function Yo(e,t,n){return mn(n)?W(e,t,n):V(e)}function Xo(e,t,n){return mr(n)?V(e):W(e,t,n)}function Zo(e,t,n){return _r(n)?V(e):W(e,t,n)}function Qo(e,t,n){return rn(t)?rn(n)?V(e):H():V(e)}function $o(e,t,n){return mn(n)&&en(n.extends)?H():U(G(e,t,n),e=>Qo(e,t,n),()=>H())}function es(e,t){return e.reduce((e,n)=>n in t&&yo(t[n])?{...e,...t[n].inferred}:xn(),{})}function ts(e,t,n){let r={};for(let i of T(n))r[i]=i in t?$o({},t[i],n[i]):rn(n[i])?mn(n[i])?V(b(e,{[n[i].name]:n[i].extends})):V(e):H();let i=tt(r).every(e=>yo(e)),a=i?es(T(r),r):{};return i?V(a):H()}function ns(e,t,n){let r=ts(e,t,n);return yo(r)?V(b(e,r.inferred)):H()}function rs(e,t,n){return ns(e,t,n)}function is(e,t){return T(t).reduce((n,r)=>({...n,[r]:w(e,r)?R(n[r])?L([...n[r].anyOf,t[r]]):L([e[r],t[r]]):t[r]}),e)}function as(e,t,n,r){return C(t,(t,i)=>U(G({},e[t],n),t=>as(e,i,n,is(r,t)),()=>H()),()=>V(r))}function os(e,t,n,r){return as(t,T(t),r,e)}function ss(e,t,n){return Qi(n)?os(e,t,Yi(n),Zi(n)):j(n)?rs(e,t,n.properties):W(e,A(t),n)}function cs(e,t){return S(T(t).length,0)?V(e):H()}function ls(e,t,n,r,i){return G(e,n,i)}function us(e,t,n,r){return Qi(r)?ls(e,Ji(t),n,Ji(Yi(r)),Zi(r)):j(r)?cs(e,r.properties):Qt(r)||un(r)?V(e):H()}function ds(e,t,n){return xr(n)?V(e):W(e,t,n)}function fs(e,t,n){return yr(n)?V(e):W(e,t,n)}function ps(e,t,n){return G(e,xi(t),n)}function ms(e,t){return E({"~kind":`Inferrable`},{name:e,type:t},{})}function hs(e){return x(e)&&w(e,`~kind`)&&w(e,`name`)&&w(e,`type`)&&S(e[`~kind`],`Inferrable`)&&Ie(e.name)&&x(e.type)}function gs(e){return ea(e)?mn(e.items)?zt(e.items.extends)?ms(e.items.name,e.items.extends.items):un(e.items.extends)?ms(e.items.name,e.items.extends):void 0:xn():void 0}function _s(e){return mn(e)?ms(e.name,e.extends):void 0}function vs(e,t,n=[]){return C(e,(e,r)=>U(G({},e,t),()=>vs(r,t,[...n,e]),()=>void 0),()=>n)}function ys(e,t,n,r){let i=vs(n,r);return De(i)?V(b(e,{[t]:Ur(i)})):H()}function bs(e,t,n,r){let i=vs(n,r);return De(i)?V(b(e,{[t]:L(i)})):H()}function xs(e){return[...e].reverse()}function Ss(e,t){return t?xs(e):e}function Cs(e){let t=e.length>0?e[0]:void 0;return At(At(t)?gs(t):void 0)}function ws(e,t,n,r,i,a){return U(G(e,n,i),e=>Ds(e,t,r,a),()=>H())}function Ts(e,t,n,r,i){let a=gs(r);return hs(a)?ys(e,a.name,Ss(n,t),a.type):C(n,(n,a)=>ws(e,t,n,a,r,i),()=>H())}function Es(e,t,n,r){return C(r,(r,i)=>Ts(e,t,n,r,i),()=>S(n.length,0)?V(e):H())}function Ds(e,t,n,r){return Es(e,t,n,r)}function Os(e,t,n){let r=gf(e,mf([],[]),n),i=Cs(r);return Ds(e,i,Ss(t,i),Ss(r,i))}function ks(e,t,n){let r=_s(n);return hs(r)?bs(e,r.name,t,r.type):C(t,(t,r)=>U(G(e,t,n),e=>ks(e,r,n),()=>H()),()=>V(e))}function As(e,t,n){let r=gf(e,mf([],[]),t);return z(n)?Os(e,r,n.items):zt(n)?ks(e,r,n.items):W(e,Ur(r),n)}function js(e,t,n){return ia(n)||ra(n)?V(e):W(e,t,n)}function Ms(e,t,n){return C(n,(n,r)=>U(G(e,t,n),e=>V(e),()=>Ms(e,t,r)),()=>H())}function Ns(e,t,n){return C(t,(t,r)=>U(Ms(e,t,n),e=>Ns(e,r,n),()=>H()),()=>V(e))}function Ps(e,t,n){let r=_s(n);return hs(r)?bs(e,r.name,t,r.type):R(n)?Ns(e,t,n.anyOf):Ns(e,t,[n])}function Fs(e,t,n){return mn(n)?W(e,t,n):Qt(n)||un(n)?V(e):H()}function Is(e,t,n){return ia(n)?V(e):W(e,t,n)}function G(e,t,n){return Qt(t)?Do(e,t,n):zt(t)?ko(e,t,t.items,n):tr(t)?Ao(e,t,n):nr(t)?jo(e,t,n):Ht(t)?Lo(e,t.parameters,t.instanceType,n):gn(t)?Ro(e,t.if,t.then,t.else,n):vn(t)?zo(e,t.enum,n):Gt(t)?Bo(e,t.parameters,t.returnType,n):ar(t)?Vo(e,t,n):M(t)?Ho(e,t.allOf,n):I(t)?Jo(e,t,n):en(t)?Yo(e,t,n):mr(t)?Xo(e,t,n):_r(t)?Zo(e,t,n):j(t)?ss(e,t.properties,n):Qi(t)?us(e,Yi(t),Zi(t),n):xr(t)?ds(e,t,n):yr(t)?fs(e,t,n):mo(t)?ps(e,t.pattern,n):z(t)?As(e,t.items,n):ra(t)?js(e,t,n):R(t)?Ps(e,t.anyOf,n):un(t)?Fs(e,t,n):ia(t)?Is(e,t,n):H()}function Ls(e,t){return bi([...e,A(t)])}function Rs(e,t,n){return K(e)?D(Ls(e,t),{},n):Bs(e,t,n)}function zs(e,t,n,r,i){return Rs(_f(e,t,n),hf(e,t,r),i)}function Bs(e,t,n={}){return k(`Interface`,[e,t],n)}function Vs(e){return At(e)&&w(e,`action`)&&S(e.action,`Interface`)}function Hs(e,t,n){return e.includes(n)?!0:Gs([...e,n],t,t[n])}function Us(e,t,n){return Ws(e,t,sn(n))}function Ws(e,t,n){return C(n,(n,r)=>Gs(e,t,n)?!0:Ws(e,t,r),()=>!1)}function Gs(e,t,n){return Jt(n)?Hs(e,t,n.$ref):zt(n)?Gs(e,t,n.items):Ht(n)?Ws(e,t,[...n.parameters,n.instanceType]):Gt(n)?Ws(e,t,[...n.parameters,n.returnType]):Vs(n)?Us(e,t,n.parameters[1]):M(n)?Ws(e,t,n.allOf):j(n)?Us(e,t,n.properties):R(n)?Ws(e,t,n.anyOf):z(n)?Ws(e,t,n.items):Qi(n)?Gs(e,t,Zi(n)):!1}function Ks(e,t,n){return Gs(e,t,n)}function qs(e,t){return t.reduce((t,n)=>Ks([n],e,e[n])?[...t,n]:t,[])}function Js(e){return qs(e,on(e))}function Ys(e,t,n){return n.includes(t)?n:t in e?Qs(e,e[t],[...n,t]):xn()}function Xs(e,t,n){return Zs(e,sn(t),n)}function Zs(e,t,n){return t.reduce((t,n)=>Qs(e,n,t),n)}function Qs(e,t,n){return Jt(t)?Ys(e,t.$ref,n):zt(t)?Qs(e,t.items,n):Ht(t)?Zs(e,[...t.parameters,t.instanceType],n):Gt(t)?Zs(e,[...t.parameters,t.returnType],n):Vs(t)?Xs(e,t.parameters[1],n):M(t)?Zs(e,t.allOf,n):j(t)?Xs(e,t.properties,n):R(t)?Zs(e,t.anyOf,n):z(t)?Zs(e,t.items,n):Qi(t)?Qs(e,Zi(t),n):n}function $s(e,t,n){return Qs(e,n,[t])}function ec(e){return Zt()}function tc(e){return T(e).reduce((t,n)=>({...t,[n]:rc(e[n])}),{})}function nc(e){return e.reduce((e,t)=>[...e,rc(t)],[])}function rc(e){return Jt(e)?ec(e.$ref):zt(e)?Rt(rc(e.items),Bt(e)):Ht(e)?Vt(nc(e.parameters),rc(e.instanceType)):Gt(e)?Wt(nc(e.parameters),rc(e.returnType)):M(e)?yn(nc(e.allOf)):j(e)?A(tc(e.properties)):Qi(e)?Ki(Xi(e),rc(Zi(e))):R(e)?L(nc(e.anyOf)):z(e)?Ur(nc(e.items)):e}function ic(e,t){return t in e?rc(e[t]):ln()}function ac(e){return ic(e.$defs,e.$ref)}function oc(e,t,n){let r=_f(e,mf([],[]),t),i=hf({},mf([],[]),n);return bi([...r,A(i)])}function sc(e,t){return T(e).filter(e=>t.includes(e)).reduce((t,n)=>{let r=e[n],i=Vs(r)?oc(e,r.parameters[0],r.parameters[1]):r;return{...t,[n]:i}},{})}function cc(e,t,n){return dn(sc(e,$s(e,t,n)),t)}function lc(e,t){return t in e?Jt(e[t])?lc(e,e[t].$ref):e[t]:$t()}function uc(e,t){return lc(e,t)}function dc(e){return fn(e)?ac(e):pn(e)?ln():e}function fc(e,t,n){return G(e,dc(t),dc(n))}function pc(e,t){let n=[un(e)?H():fc({},e,t),un(e)?V({}):fc({},t,e)];return yo(n[0])&&yo(n[1])?`equal`:yo(n[0])&&vo(n[1])?`left-inside`:vo(n[0])&&yo(n[1])?`right-inside`:`disjoint`}function mc(e,t){return t.filter(t=>pc(e,t)!==`right-inside`)}function hc(e,t){return S(t.some(t=>{let n=pc(e,t);return S(n,`left-inside`)||S(n,`equal`)}),!1)}function gc(e,t){let n=Ci(e);return Qt(n)?[n]:hc(n,t)?[...mc(n,t),n]:t}function _c(e){return e.reduce((e,t)=>j(t)?[...e,t]:en(t)?e:gc(t,e),[])}function vc(e){return Ni(_c(e))}function yc(e,t){return D(Ci(e),{},t)}function bc(e,t,n,r){return yc(q(e,t,n),r)}function xc(e,t=[]){return jt(e)&&S(e.action,`Conditional`)?Jt(e.parameters[0])?xc(e.parameters[2],xc(e.parameters[3],[...t,e.parameters[0].$ref])):xc(e.parameters[2],xc(e.parameters[3],t)):jt(e)&&S(e.action,`Mapped`)&&jt(e.parameters[1])&&S(e.parameters[1].action,`KeyOf`)&&Jt(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function Sc(e,t){return e.reduce((e,n)=>[...e,t.includes(n.name)],[])}function Cc(e,t,n=[]){return C(e,(e,r)=>C(t,(t,i)=>Cc(r,i,[...n,[t,e]]),()=>n),()=>n)}function wc(e){return R(e)?[...e.anyOf]:[e]}function Tc(e,t){return e.reduce((e,n)=>[...e,[...n,t]],[])}function Ec(e,t){return t.reduce((t,n)=>[...t,...Tc(e,n)],[])}function Dc(e){return e.reduce((e,t)=>S(t[0],!0)?Ec(e,wc(t[1])):Ec(e,[t[1]]),[[]])}function Oc(e,t,n){let r=Cc(t,Sc(e,xc(n)));return jt(n)&&S(n.action,`Conditional`)||jt(n)&&S(n.action,`Mapped`)?Dc(r):[t]}function kc(){return[`(not-resolvable)`,$t()]}function Ac(){return[`(not-generic)`,$t()]}function jc(e,t,n){return[e,Yt(t,n)]}function Mc(e,t,n){return t in e?Nc(e,t,e[t],n):kc()}function Nc(e,t,n,r){return Xt(n)?jc(t,n.parameters,n.expression):Jt(n)?Mc(e,n.$ref,r):Ac()}function Pc(e,t,n){return Nc(e,`(anonymous)`,t,n)}function Fc(e,t,n){if(mn(t)||qc(t)||yo(fc({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function Ic(e,t,n,r,i){let a=q(e,t,i);return Fc(n,a,r),b(e,{[n]:a})}function Lc(e,t,n,r,i){let a=q(e,t,n.extends),o=q(e,t,n.equals);return C(i,(i,o)=>Rc(Ic(e,t,n.name,a,i),t,r,o),()=>Rc(Ic(e,t,n.name,a,o),t,r,[]))}function Rc(e,t,n,r){return C(n,(n,i)=>Lc(e,t,n,i,r),()=>e)}function zc(e,t,n,r){return Rc(e,t,n,r)}function Bc(e){return ze(e.callstack.length,0)?e.callstack[e.callstack.length-1]:``}function Vc(e,t){return S(Bc(e),t)}function Hc(e,t,n,r,i,a){let o=zc(e,t,r,a),s=q(o,mf([...t.callstack,n.$ref],t.visited),i);return q(o,mf([],[]),s)}function Uc(e,t,n,r,i,a){return a.reduce((a,o)=>[...a,Hc(e,t,n,r,i,o)],[])}function Wc(e,t,n,r,i,a){let o=Uc(e,t,n,r,i,Oc(r,a,i));return S(o.length,1)?o[0]:Si(o)}function Gc(e,t,n,r){let i=_f(e,t,r),a=Pc(e,n,r),o=a[0],s=a[1];return Xt(s)?Vc(t,o)?Kc(qt(o),i):Wc(e,t,qt(o),s.parameters,s.expression,i):Kc(n,i)}function Kc(e,t){return E({"~kind":`Call`},{type:`call`,target:e,arguments:t},{})}function qc(e){return O(e,`Call`)}function Jc(e){return kt(e,[`~immutable`])}function Yc(e,t){return D(Jc(e),{},t)}function Xc(e,t,n,r){return Yc(q(e,t,n),r)}function Zc(e,t){return e(t)}function Qc(e,t){return Ie(t)?F(Zc(e,t)):F(t)}function $c(e,t){return tl(e,xi(t))}function el(e,t){return L(t.map(t=>tl(e,t)))}function tl(e,t){return I(t)?Qc(e,t.const):mo(t)?$c(e,t.pattern):R(t)?el(e,t.anyOf):t}function nl(e,t={}){return k(`Capitalize`,[e],t)}function rl(e,t={}){return k(`Lowercase`,[e],t)}function il(e,t={}){return k(`Uncapitalize`,[e],t)}function al(e,t={}){return k(`Uppercase`,[e],t)}const ol=e=>e[0].toUpperCase()+e.slice(1),sl=e=>e.toLowerCase(),cl=e=>e[0].toLowerCase()+e.slice(1),ll=e=>e.toUpperCase();function ul(e,t){return K([e])?D(tl(ol,e),{},t):nl(e,t)}function dl(e,t){return K([e])?D(tl(sl,e),{},t):rl(e,t)}function fl(e,t){return K([e])?D(tl(cl,e),{},t):il(e,t)}function pl(e,t){return K([e])?D(tl(ll,e),{},t):al(e,t)}function ml(e,t,n,r){return ul(q(e,t,n),r)}function hl(e,t,n,r){return dl(q(e,t,n),r)}function gl(e,t,n,r){return fl(q(e,t,n),r)}function _l(e,t,n,r){return pl(q(e,t,n),r)}function vl(e,t,n,r,i={}){return k(`Conditional`,[e,t,n,r],i)}function yl(e,t,n,r,i,a){let o=fc(e,n,r);return go(o)?L([q(o.inferred,t,i),q(e,t,a)]):_o(o)?q(o.inferred,t,i):q(e,t,a)}function bl(e,t,n,r,i,a,o){return K([n,r])?D(yl(e,t,n,r,i,a),{},o):vl(n,r,i,a,o)}function xl(e,t,n,r,i,a,o){return bl(e,t,q(e,t,n),q(e,t,r),i,a,o)}function Sl(e,t={}){return k(`ConstructorParameters`,[e],t)}function Cl(e){let t=Ht(e)?e.parameters:[];return Ur(gf({},mf([],[]),t))}function wl(e,t){return K([e])?D(Cl(e),{},t):Sl(e,t)}function Tl(e,t,n,r){return wl(q(e,t,n),r)}function El(e,t,n={}){return k(`Exclude`,[e,t],n)}function Dl(e,t,n){return K([e,t])?D(_i(e,t),{},n):El(e,t,n)}function Ol(e,t,n,r,i){return Dl(q(e,t,n),q(e,t,r),i)}function kl(e,t,n={}){return k(`Extract`,[e,t],n)}function Al(e,t){return yo(fc({},e,t))?[e]:[]}function jl(e,t){return e.reduce((e,n)=>[...e,...Al(n,t)],[])}function Ml(e,t){let n=Ci(e);return Si(jl(R(n)?n.anyOf:[n],t))}function Nl(e,t,n){return K([e,t])?D(Ml(e,t),{},n):kl(e,t,n)}function Pl(e,t,n,r,i){return Nl(q(e,t,n),q(e,t,r),i)}function Fl(e,t,n={}){return k(`Index`,[e,t],n)}function Il(e,t){return Gl(uc(e,t))}function Ll(e,t,n){return Gl(vi(e,t,n))}function Rl(e,t){let n=T(e).filter(e=>!w(t,e)),r=T(t).filter(t=>!w(e,t)),i=T(e).filter(e=>w(t,e)),a=n.reduce((t,n)=>({...t,[n]:e[n]}),{}),o=r.reduce((e,n)=>({...e,[n]:t[n]}),{}),s=i.reduce((n,r)=>({...n,[r]:bi([e[r],t[r]])}),{});return b(b(a,o),s)}function zl(e){return e.reduce((e,t)=>Rl(e,Gl(t)),{})}function Bl(e){return e}function Vl(e){return Gl(ei(Ur(e)))}function Hl(e,t){return T(e).filter(e=>e in t).reduce((n,r)=>({...n,[r]:Si([e[r],t[r]])}),{})}function Ul(e,t){return C(e,(e,n)=>Ul(n,Hl(t,Gl(e))),()=>t)}function Wl(e){return C(e,(e,t)=>Ul(t,Gl(e)),()=>xn())}function Gl(e){return fn(e)?Il(e.$defs,e.$ref):gn(e)?Ll(e.if,e.then,e.else):M(e)?zl(e.allOf):R(e)?Wl(e.anyOf):z(e)?Vl(e.items):j(e)?Bl(e.properties):{}}function Kl(e){return A(Gl(e))}const ql=RegExp(`^(?:0|[1-9][0-9]*)$`);function Jl(e){let t=`${e}`;return ql.test(t)?parseInt(t):e}function Yl(e){return F(Jl(e))}function Xl(e){return e.map(e=>Zl(e))}function Zl(e){return M(e)?yn(Xl(e.allOf)):R(e)?L(Xl(e.anyOf)):I(e)?Yl(e.const):e}function Ql(e,t){return yo(fc({},Zl(t),gr()))?e:I(t)&&S(t.const,`length`)?gr():$t()}function $l(e,t){return ou(uc(e,t))}function eu(e,t,n){return ou(vi(e,t,n))}function tu(e){return ou(yi(e))}function nu(e){return ou(bi(e))}function ru(e){return[`${e}`]}function iu(e){return ou(xi(e))}function au(e){return e.reduce((e,t)=>[...e,...ou(t)],[])}function ou(e){return fn(e)?$l(e.$defs,e.$ref):gn(e)?eu(e.if,e.then,e.else):vn(e)?tu(e.enum):M(e)?nu(e.allOf):I(e)?ru(e.const):mo(e)?iu(e.pattern):R(e)?au(e.anyOf):[]}function su(e){return ou(e)}function cu(e,t){return t.map(t=>lu(e,t))}function lu(e,t){return zt(t)?Rt(lu(e,t.items)):Ht(t)?Vt(cu(e,t.parameters),lu(e,t.instanceType)):Gt(t)?Wt(cu(e,t.parameters),lu(e,t.returnType)):z(t)?Ur(cu(e,t.items)):R(t)?L(cu(e,t.anyOf)):M(t)?yn(cu(e,t.allOf)):ta(t)?A(e):t}function uu(e,t){return lu(e,t)}function du(e,t){return uu(e,t in e?e[t]:$t())}function fu(e,t){return t.reduce((t,n)=>[...t,du(e,n)],[])}function pu(e,t){return Si(fu(e,su(t)))}const mu=new RegExp(Hi);function hu(e){return e.filter(e=>mu.test(e))}function gu(e){return Si(fu(e,hu(on(e))))}function _u(e,t){return _r(t)?gu(e):pu(e,t)}function vu(e){return F(Jl(e))}function yu(e){return e.map(e=>bu(e))}function bu(e){return M(e)?yn(yu(e.allOf)):R(e)?L(yu(e.anyOf)):I(e)?vu(e.const):e}function xu(e,t){return e.reduceRight((e,n,r)=>yo(fc({},F(r),t))?[n,...e]:e,[])}function Su(e,t){return wi(xu(e,bu(t)))}function Cu(e){return wi(e)}function wu(e,t){return I(t)&&S(t.const,`length`)?F(e.length):_r(t)||ar(t)?Cu(e):Su(e,t)}function Tu(e,t){return zt(e)?Ql(e.items,t):j(e)?_u(e.properties,t):z(e)?wu(e.items,t):$t()}function Eu(e){return fn(e)||gn(e)||M(e)||R(e)?Kl(e):e}function Du(e,t,n){return K([e,t])?D(Tu(Eu(e),t),{},n):Fl(e,t,n)}function Ou(e,t,n,r,i){return Du(q(e,t,n),q(e,t,r),i)}function ku(e,t={}){return k(`InstanceType`,[e],t)}function Au(e){return Ht(e)?e.instanceType:$t()}function ju(e,t){return K([e])?D(Au(e),{},t):ku(e,t)}function Mu(e,t,n,r={}){return ju(q(e,t,n),r)}function Nu(e,t={}){return k(`KeyOf`,[e],t)}function Pu(){return L([gr(),br(),vr()])}function Fu(e){return gr()}function Iu(e){return e.reduce((e,t)=>cr(t)?[...e,F(Jl(t))]:xn(),[])}function Lu(e){return wi(Iu(T(e)))}function Ru(e){return Xi(e)}function zu(e){return wi(e.map((e,t)=>F(t)))}function Bu(e){return Qt(e)?Pu():zt(e)?Fu(e.items):j(e)?Lu(e.properties):Qi(e)?Ru(e):z(e)?zu(e.items):$t()}function Vu(e){return fn(e)||gn(e)||M(e)||R(e)?Kl(e):e}function Hu(e,t){return K([e])?D(Bu(Vu(e)),{},t):Nu(e,t)}function Uu(e,t,n,r){return Hu(q(e,t,n),r)}function Wu(e,t,n,r,i={}){return k(`Mapped`,[e,t,n,r],i)}function Gu(e){return Yu(xi(e))}function Ku(e){return e.reduce((e,t)=>[...e,...Yu(t)],[])}function qu(e){return Yu(yi(e))}function Ju(e){return Pe(e)?[F(`${e}`)]:[F(e)]}function Yu(e){return vn(e)?qu(e.enum):I(e)?Ju(e.const):mo(e)?Gu(e.pattern):R(e)?Ku(e.anyOf):[e]}function Xu(e){return Yu(e)}function Zu(e){return mo(e)?xi(e.pattern):e}function Qu(e,t,n,r,i,a){let o=b(e,{[n.name]:r}),s=Zu(q(o,t,i)),c=q(o,t,a);return dr(s)||fr(s)?{[s.const]:c}:{}}function $u(e,t,n,r,i,a){return r.reduce((r,o)=>[...r,Qu(e,t,n,o,i,a)],[])}function ed(e){return e.reduce((e,t)=>[...e,A(t)],[])}function td(e,t,n,r,i,a){return bi(ed($u(e,t,n,Xu(r),i,a)))}function nd(e,t,n,r,i,a,o){return K([r])?D(td(e,t,n,r,i,a),{},o):Wu(n,r,i,a,o)}function rd(e,t,n,r,i,a,o){return nd(e,t,n,q(e,t,r),i,a,o)}function id(e,t,n){let r=b(e,t);return T(t).filter(e=>n.includes(e)).reduce((e,n)=>({...e,[n]:cc(r,n,t[n])}),{})}function ad(e,t,n){let r=b(e,t);return T(t).filter(e=>!n.includes(e)).reduce((e,n)=>({...e,[n]:q(r,mf([],[]),t[n])}),{})}function od(e,t,n){let r=Js(t),i=id(e,t,r),a=ad(e,t,r);return D({...i,...a},{},n)}function sd(e,t,n,r){return od(e,n,r)}function cd(e,t={}){return k(`NonNullable`,[e],t)}function ld(e){return Dl(e,L([pr(),na()]),{})}function ud(e,t){return K([e])?D(ld(e),{},t):cd(e,t)}function dd(e,t,n,r){return ud(q(e,t,n),r)}function fd(e,t,n={}){return k(`Omit`,[e,t],n)}function pd(e){let t=Kl(e);return j(t)?t.properties:xn()}function md(e,t){return T(e).reduce((n,r)=>t.includes(r)?n:{...n,[r]:e[r]},{})}function hd(e,t){return A(md(pd(e),su(t)))}function gd(e,t,n){return K([e,t])?D(hd(e,t),{},n):fd(e,t,n)}function _d(e,t,n,r,i){return gd(q(e,t,n),q(e,t,r),i)}function vd(e,t={}){return k(`Parameters`,[e],t)}function yd(e){let t=Gt(e)?e.parameters:[];return Ur(gf({},mf([],[]),t))}function bd(e,t){return K([e])?D(yd(e),{},t):vd(e,t)}function xd(e,t,n,r){return bd(q(e,t,n),r)}function Sd(e,t={}){return k(`Partial`,[e],t)}function Cd(e,t){let n=Od(uc(e,t));return dn(b(e,{[t]:n}),t)}function wd(e,t,n){return Od(vi(e,t,n))}function Td(e){return Od(bi(e))}function Ed(e){return L(e.map(e=>Od(e)))}function Dd(e){return A(T(e).reduce((t,n)=>({...t,[n]:tn(e[n])}),{}))}function Od(e){return fn(e)?Cd(e.$defs,e.$ref):gn(e)?wd(e.if,e.then,e.else):M(e)?Td(e.allOf):R(e)?Ed(e.anyOf):j(e)?Dd(e.properties):A({})}function kd(e,t){return K([e])?D(Od(e),{},t):Sd(e,t)}function Ad(e,t,n,r){return kd(q(e,t,n),r)}function jd(e,t,n={}){return k(`Pick`,[e,t],n)}function Md(e,t){return T(e).reduce((n,r)=>t.includes(r)?b(n,{[r]:e[r]}):n,{})}function Nd(e,t){return A(Md(pd(e),su(t)))}function Pd(e,t,n){return K([e,t])?D(Nd(e,t),{},n):jd(e,t,n)}function Fd(e,t,n,r,i){return Pd(q(e,t,n),q(e,t,r),i)}function Id(e,t={}){return k(`ReadonlyObject`,[e],t)}function Ld(e){return Tf(Rt(e))}function Rd(e,t){let n=Wd(uc(e,t));return dn(b(e,{[t]:n}),t)}function zd(e,t,n){return Wd(vi(e,t,n))}function Bd(e){return Wd(bi(e))}function Vd(e){return A(T(e).reduce((t,n)=>({...t,[n]:Qn(e[n])}),{}))}function Hd(e){return Tf(Ur(e))}function Ud(e){return L(e.map(e=>Wd(e)))}function Wd(e){return zt(e)?Ld(e.items):fn(e)?Rd(e.$defs,e.$ref):gn(e)?zd(e.if,e.then,e.else):M(e)?Bd(e.allOf):j(e)?Vd(e.properties):z(e)?Hd(e.items):R(e)?Ud(e.anyOf):e}function Gd(e,t){return K([e])?D(Wd(e),{},t):Id(e)}function Kd(e,t,n,r){return Gd(q(e,t,n),r)}function qd(e,t,n,r){return t.visited.includes(r)?n:r in e?q(e,mf(t.callstack,[...t.visited,r]),e[r]):n}function Jd(e,t){let n=$d(uc(e,t));return dn(b(e,{[t]:n}),t)}function Yd(e,t,n){return $d(vi(e,t,n))}function Xd(e){return $d(bi(e))}function Zd(e){return L(e.map(e=>$d(e)))}function Qd(e){return A(T(e).reduce((t,n)=>({...t,[n]:Qr(e[n])}),{}))}function $d(e){return fn(e)?Jd(e.$defs,e.$ref):gn(e)?Yd(e.if,e.then,e.else):M(e)?Xd(e.allOf):R(e)?Zd(e.anyOf):j(e)?Qd(e.properties):A({})}function ef(e,t={}){return k(`Required`,[e],t)}function tf(e,t){return K([e])?D($d(e),{},t):ef(e,t)}function nf(e,t,n,r){return tf(q(e,t,n),r)}function rf(e,t={}){return k(`ReturnType`,[e],t)}function af(e){return Gt(e)?e.returnType:$t()}function of(e,t){return K([e])?D(af(e),{},t):rf(e,t)}function sf(e,t,n,r={}){return of(q(e,t,n),r)}function cf(e,t){return k(`With`,[e,t],{})}function lf(e,t){return uf(e,t)}function uf(e,t){return K([e])?D(e,{},t):cf(e,t)}function df(e,t,n,r){return uf(q(e,t,n),r)}function ff(e){return ea(e)?z(e.items)?pf(e.items.items):mn(e.items)||Jt(e.items)?[e]:[$t()]:[e]}function pf(e){return e.reduce((e,t)=>[...e,...ff(t)],[])}function mf(e,t){return{callstack:e,visited:t}}function K(e){return C(e,(e,t)=>!Jt(e)&&K(t),()=>!0)}function hf(e,t,n){return T(n).reduce((r,i)=>({...r,[i]:q(e,t,n[i])}),{})}function gf(e,t,n){return pf(_f(e,t,n))}function _f(e,t,n){return n.map(n=>q(e,t,n))}function vf(e,t){let n=rn(e)?It(t,{}):t,r=$n(e)?Nt(n,{}):n;return Zn(e)?Cf(r,{}):r}function yf(e,t,n,r,i){return S(n,`AddImmutable`)?wf(e,t,r[0],i):S(n,`RemoveImmutable`)?Xc(e,t,r[0],i):S(n,`AddReadonly`)?Pt(e,t,r[0],i):S(n,`RemoveReadonly`)?qr(e,t,r[0],i):S(n,`AddOptional`)?Lt(e,t,r[0],i):S(n,`RemoveOptional`)?Zr(e,t,r[0],i):S(n,`Capitalize`)?ml(e,t,r[0],i):S(n,`Conditional`)?xl(e,t,r[0],r[1],r[2],r[3],i):S(n,`ConstructorParameters`)?Tl(e,t,r[0],i):S(n,`Evaluate`)?bc(e,t,r[0],i):S(n,`Exclude`)?Ol(e,t,r[0],r[1],i):S(n,`Extract`)?Pl(e,t,r[0],r[1],i):S(n,`Index`)?Ou(e,t,r[0],r[1],i):S(n,`InstanceType`)?Mu(e,t,r[0],i):S(n,`Interface`)?zs(e,t,r[0],r[1],i):S(n,`KeyOf`)?Uu(e,t,r[0],i):S(n,`Lowercase`)?hl(e,t,r[0],i):S(n,`Mapped`)?rd(e,t,r[0],r[1],r[2],r[3],i):S(n,`Module`)?sd(e,t,r[0],i):S(n,`NonNullable`)?dd(e,t,r[0],i):S(n,`Pick`)?Fd(e,t,r[0],r[1],i):S(n,`Parameters`)?xd(e,t,r[0],i):S(n,`Partial`)?Ad(e,t,r[0],i):S(n,`Omit`)?_d(e,t,r[0],r[1],i):S(n,`ReadonlyObject`)?Kd(e,t,r[0],i):S(n,`Record`)?Vi(e,t,r[0],r[1],i):S(n,`Required`)?nf(e,t,r[0],i):S(n,`ReturnType`)?sf(e,t,r[0],i):S(n,`TemplateLiteral`)?uo(e,t,r[0],i):S(n,`Uncapitalize`)?gl(e,t,r[0],i):S(n,`Uppercase`)?_l(e,t,r[0],i):S(n,`With`)?df(e,t,r[0],r[1]):k(n,r,i)}function bf(e,t,n){return vf(n,Jt(n)?qd(e,t,n,n.$ref):zt(n)?Rt(q(e,t,n.items),Bt(n)):qc(n)?Gc(e,t,n.target,n.arguments):Ht(n)?Vt(_f(e,t,n.parameters),q(e,t,n.instanceType),Ut(n)):Gt(n)?Wt(_f(e,t,n.parameters),q(e,t,n.returnType),Kt(n)):gn(n)?hn(q(e,t,n.if),q(e,t,n.then),q(e,t,n.else),_n(n)):M(n)?yn(_f(e,t,n.allOf),bn(n)):j(n)?A(hf(e,t,n.properties),cn(n)):Qi(n)?qi(Yi(n),q(e,t,Zi(n))):ea(n)?$i(q(e,t,n.items)):z(n)?Ur(gf(e,t,n.items),Wr(n)):R(n)?L(_f(e,t,n.anyOf),Sr(n)):n)}function q(e,t,n){return jt(n)?yf(e,t,n.action,n.parameters,n.options):bf(e,t,n)}function xf(e,t){return q(e,mf([],[]),t)}function Sf(e){return D(e,{"~immutable":!0},{})}function Cf(e,t){return D(Sf(e),{},t)}function wf(e,t,n,r){return Cf(q(e,t,n),r)}function Tf(e,t={}){return Cf(e,t)}function Ef(e,t={}){return yc(e,t)}function Df(e,t){let n=pc(e,t);return S(n,`right-inside`)?1:+!!S(n,`disjoint`)}function Of(e,t,n=[]){return C(t,(r,i)=>S(Df(e,r),1)?Of(e,i,[...n,r]):[...n,e,...t],()=>[...n,e])}function kf(e,t=[]){return C(e,(e,n)=>kf(n,Of(e,t)),()=>t)}function Af(e){return kf(e)}const jf=Symbol.for(`yaml.alias`),Mf=Symbol.for(`yaml.document`),Nf=Symbol.for(`yaml.map`),Pf=Symbol.for(`yaml.pair`),Ff=Symbol.for(`yaml.scalar`),If=Symbol.for(`yaml.seq`),Lf=Symbol.for(`yaml.node.type`),Rf=e=>!!e&&typeof e==`object`&&e[Lf]===jf,zf=e=>!!e&&typeof e==`object`&&e[Lf]===Mf,Bf=e=>!!e&&typeof e==`object`&&e[Lf]===Nf,J=e=>!!e&&typeof e==`object`&&e[Lf]===Pf,Y=e=>!!e&&typeof e==`object`&&e[Lf]===Ff,Vf=e=>!!e&&typeof e==`object`&&e[Lf]===If;function Hf(e){if(e&&typeof e==`object`)switch(e[Lf]){case Nf:case If:return!0}return!1}function X(e){if(e&&typeof e==`object`)switch(e[Lf]){case jf:case Nf:case Ff:case If:return!0}return!1}const Uf=e=>(Y(e)||Hf(e))&&!!e.anchor,Wf=Symbol(`break visit`),Gf=Symbol(`skip children`),Kf=Symbol(`remove node`);function qf(e,t){let n=Zf(t);zf(e)?Jf(null,e.contents,n,Object.freeze([e]))===Kf&&(e.contents=null):Jf(null,e,n,Object.freeze([]))}qf.BREAK=Wf,qf.SKIP=Gf,qf.REMOVE=Kf;function Jf(e,t,n,r){let i=Qf(e,t,n,r);if(X(i)||J(i))return $f(e,r,i),Jf(e,i,n,r);if(typeof i!=`symbol`){if(Hf(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Jf(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Wf)return Wf;else i===Kf&&(t.items.splice(e,1),--e)}}else if(J(t)){r=Object.freeze(r.concat(t));let e=Jf(`key`,t.key,n,r);if(e===Wf)return Wf;e===Kf&&(t.key=null);let i=Jf(`value`,t.value,n,r);if(i===Wf)return Wf;i===Kf&&(t.value=null)}}return i}async function Yf(e,t){let n=Zf(t);zf(e)?await Xf(null,e.contents,n,Object.freeze([e]))===Kf&&(e.contents=null):await Xf(null,e,n,Object.freeze([]))}Yf.BREAK=Wf,Yf.SKIP=Gf,Yf.REMOVE=Kf;async function Xf(e,t,n,r){let i=await Qf(e,t,n,r);if(X(i)||J(i))return $f(e,r,i),Xf(e,i,n,r);if(typeof i!=`symbol`){if(Hf(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await Xf(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Wf)return Wf;else i===Kf&&(t.items.splice(e,1),--e)}}else if(J(t)){r=Object.freeze(r.concat(t));let e=await Xf(`key`,t.key,n,r);if(e===Wf)return Wf;e===Kf&&(t.key=null);let i=await Xf(`value`,t.value,n,r);if(i===Wf)return Wf;i===Kf&&(t.value=null)}}return i}function Zf(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Qf(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Bf(t))return n.Map?.(e,t,r);if(Vf(t))return n.Seq?.(e,t,r);if(J(t))return n.Pair?.(e,t,r);if(Y(t))return n.Scalar?.(e,t,r);if(Rf(t))return n.Alias?.(e,t,r)}function $f(e,t,n){let r=t[t.length-1];if(Hf(r))r.items[e]=n;else if(J(r))e===`key`?r.key=n:r.value=n;else if(zf(r))r.contents=n;else{let e=Rf(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}const ep={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},tp=e=>e.replace(/[!,[\]{}]/g,e=>ep[e]);var np=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+tp(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&X(e.contents)){let t={};qf(e.contents,(e,n)=>{X(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
4
|
-
`)}};np.defaultYaml={explicit:!1,version:`1.2`},np.defaultTags={"!!":`tag:yaml.org,2002:`};function rp(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function ip(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=ip(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=ip(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=ip(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=ip(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function ap(e,t,n){if(Array.isArray(e))return e.map((e,t)=>ap(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Uf(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var op=class{constructor(e){Object.defineProperty(this,Lf,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!zf(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=ap(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?ip(i,{"":o},``,o):o}},sp=class extends op{constructor(e){super(jf),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],qf(e,{Node:(e,t)=>{(Rf(t)||Uf(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(ap(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=cp(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(rp(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function cp(e,t,n){if(Rf(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Hf(t)){let r=0;for(let i of t.items){let t=cp(e,i,n);t>r&&(r=t)}return r}else if(J(t)){let r=cp(e,t.key,n),i=cp(e,t.value,n);return Math.max(r,i)}return 1}const lp=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Z=class extends op{constructor(e){super(Ff),this.value=e}toJSON(e,t){return t?.keep?this.value:ap(this.value,e,t)}toString(){return String(this.value)}};Z.BLOCK_FOLDED=`BLOCK_FOLDED`,Z.BLOCK_LITERAL=`BLOCK_LITERAL`,Z.PLAIN=`PLAIN`,Z.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Z.QUOTE_SINGLE=`QUOTE_SINGLE`;function up(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function dp(e,t,n){if(zf(e)&&(e=e.contents),X(e))return e;if(J(e)){let t=n.schema[Nf].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new sp(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=up(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new Z(e);return c&&(c.node=t),t}l=e instanceof Map?o[Nf]:Symbol.iterator in Object(e)?o[If]:o[Nf]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new Z(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function fp(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return dp(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}const pp=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var mp=class extends op{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>X(t)||J(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(pp(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Hf(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,fp(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Hf(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&Y(i)?i.value:i:Hf(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!J(t))return!1;let n=t.value;return n==null||e&&Y(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Hf(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Hf(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,fp(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};const hp=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function gp(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const _p=(e,t,n)=>e.endsWith(`
|
|
5
|
-
`)?gp(n,t):n.includes(`
|
|
6
|
-
`)?`
|
|
7
|
-
`+gp(n,t):(e.endsWith(` `)?``:` `)+n,vp=`flow`;function yp(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,ee=-1;n===`block`&&(h=bp(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}ee=h}if(r===`
|
|
8
|
-
`)n===`block`&&(h=bp(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
9
|
-
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
10
|
-
`&&t!==` `&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>ee+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let _=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?_=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(_+=`${e[i]}\\`),_+=`\n${t}${e.slice(i+1,a)}`)}return _}function bp(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
11
|
-
`);r=t,i=t+1,a=e[i]}return r}const xp=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Sp=e=>/^(%|---|\.\.\.)/m.test(e);function Cp(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
12
|
-
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function wp(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Sp(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
13
|
-
|
|
14
|
-
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
15
|
-
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:yp(o,a,`quoted`,xp(t,!1))}function Tp(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
16
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return wp(e,t);let n=t.indent||(Sp(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:yp(r,n,vp,xp(t,!1))}function Ep(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=wp;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Tp:i&&!t?wp:n?Tp:wp}return r(e,t)}let Dp;try{Dp=RegExp(`(^|(?<!
|
|
17
|
-
))
|
|
18
|
-
+(?!
|
|
19
|
-
|$)`,`g`)}catch{Dp=/\n+(?!\n|$)/g}function Op({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return Ep(n,r);let l=r.indent||(r.forceBlockIndent||Sp(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===Z.BLOCK_FOLDED?!1:t===Z.BLOCK_LITERAL||!Cp(n,c,l.length);if(!n)return u?`|
|
|
20
|
-
`:`>
|
|
21
|
-
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
22
|
-
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
23
|
-
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
24
|
-
`&&(p=p.slice(0,-1)),p.replace(Dp,`$&${l}`));let h=!1,g,ee=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
25
|
-
`)ee=g;else break}let _=n.substring(0,ee<g?ee+1:g);_&&=(n=n.substring(_.length),_.replace(/\n+/g,`$&${l}`));let v=(h?l?`2`:`1`:``)+d;if(e&&(v+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
26
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=xp(r,!0);o!==`folded`&&t!==Z.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=yp(`${_}${e}${p}`,l,`block`,a);if(!i)return`>${v}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${v}\n${l}${_}${n}${p}`}function kp(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
27
|
-
`)||u&&/[[\]{},]/.test(a))return Ep(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
28
|
-
`)?Ep(a,t):Op(e,t,n,r);if(!s&&!u&&i!==Z.PLAIN&&a.includes(`
|
|
29
|
-
`))return Op(e,t,n,r);if(Sp(a)){if(c===``)return t.forceBlockIndent=!0,Op(e,t,n,r);if(s&&c===l)return Ep(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return Ep(a,t)}return s?d:yp(d,c,vp,xp(t,!1))}function Ap(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==Z.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=Z.QUOTE_DOUBLE);let c=e=>{switch(e){case Z.BLOCK_FOLDED:case Z.BLOCK_LITERAL:return i||a?Ep(o.value,t):Op(o,t,n,r);case Z.QUOTE_DOUBLE:return wp(o.value,t);case Z.QUOTE_SINGLE:return Tp(o.value,t);case Z.PLAIN:return kp(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function jp(e,t){let n=Object.assign({blockQuote:!0,commentString:hp,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Mp(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(Y(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Np(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Y(e)||Hf(e))&&e.anchor;a&&rp(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Pp(e,t,n,r){if(J(e))return e.toString(t,n,r);if(Rf(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=X(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Mp(t.doc.schema.tags,a);let o=Np(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):Y(a)?Ap(a,t,n,r):a.toString(t,n,r);return o?Y(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Fp({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=X(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Hf(e)||!X(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Hf(e)||(Y(e)?e.type===Z.BLOCK_FOLDED||e.type===Z.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Pp(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=_p(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=_p(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=_p(g,n.indent,l(f))));let ee,_,v;X(t)?(ee=!!t.spaceBefore,_=t.commentBefore,v=t.comment):(ee=!1,_=null,v=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&Y(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Vf(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let te=!1,ne=Pp(t,n,()=>te=!0,()=>h=!0),re=` `;if(f||ee||_){if(re=ee?`
|
|
30
|
-
`:``,_){let e=l(_);re+=`\n${gp(e,n.indent)}`}ne===``&&!n.inFlow?re===`
|
|
31
|
-
`&&v&&(re=`
|
|
32
|
-
|
|
33
|
-
`):re+=`\n${n.indent}`}else if(!p&&Hf(t)){let e=ne[0],r=ne.indexOf(`
|
|
34
|
-
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=ne.indexOf(` `);e===`&`&&n!==-1&&n<r&&ne[n+1]===`!`&&(n=ne.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(re=`\n${n.indent}`)}}else(ne===``||ne[0]===`
|
|
35
|
-
`)&&(re=``);return g+=re+ne,n.inFlow?te&&r&&r():v&&!te?g+=_p(g,n.indent,l(v)):h&&i&&i(),g}function Ip(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}const Lp={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new Z(Symbol(`<<`)),{addToJSMap:zp}),stringify:()=>`<<`},Rp=(e,t)=>(Lp.identify(t)||Y(t)&&(!t.type||t.type===Z.PLAIN)&&Lp.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Lp.tag&&e.default);function zp(e,t,n){let r=Vp(e,n);if(Vf(r))for(let n of r.items)Bp(e,t,n);else if(Array.isArray(r))for(let n of r)Bp(e,t,n);else Bp(e,t,r)}function Bp(e,t,n){let r=Vp(e,n);if(!Bf(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Vp(e,t){return e&&Rf(t)?t.resolve(e.doc,e):t}function Hp(e,t,{key:n,value:r}){if(X(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Rp(e,n))zp(e,t,r);else{let i=ap(n,``,e);if(t instanceof Map)t.set(i,ap(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Up(n,i,e),o=ap(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Up(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(X(e)&&n?.doc){let t=jp(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Ip(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Wp(e,t,n){return new Gp(dp(e,void 0,n),dp(t,void 0,n))}var Gp=class e{constructor(e,t=null){Object.defineProperty(this,Lf,{value:Pf}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return X(n)&&(n=n.clone(t)),X(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Hp(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Fp(this,e,t,n):JSON.stringify(this)}};function Kp(e,t,n){return(t.inFlow??e.flow?Jp:qp)(e,t,n)}function qp({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(X(i))!d&&i.spaceBefore&&f.push(``),Yp(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(J(i)){let e=X(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Yp(n,f,e.commentBefore,d))}d=!1;let s=Pp(i,u,()=>o=null,()=>d=!0);o&&(s+=_p(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
36
|
-
`}}return e?(p+=`
|
|
37
|
-
`+gp(l(e),c),s&&s()):d&&o&&o(),p}function Jp({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(X(i))i.spaceBefore&&d.push(``),Yp(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(J(i)){let e=X(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Yp(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=X(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Pp(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
38
|
-
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=_p(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
39
|
-
`;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function Yp({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=gp(t(r),e);n.push(i.trimStart())}}function Xp(e,t){let n=Y(t)?t.value:t;for(let r of e)if(J(r)&&(r.key===t||r.key===n||Y(r.key)&&r.key.value===n))return r}var Zp=class extends mp{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Nf,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Wp(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=J(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Gp(e,e?.value):new Gp(e.key,e.value);let r=Xp(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Y(r.value)&&lp(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=Xp(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Xp(this.items,e)?.value;return(!t&&Y(n)?n.value:n)??void 0}has(e){return!!Xp(this.items,e)}set(e,t){this.add(new Gp(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Hp(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!J(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Kp(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}};const Qp={collection:`map`,default:!0,nodeClass:Zp,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Bf(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Zp.from(e,t,n)};var $p=class extends mp{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(If,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=em(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=em(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Y(r)?r.value:r}has(e){let t=em(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=em(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Y(r)&&lp(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(ap(e,String(r++),t));return n}toString(e,t,n){return e?Kp(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(dp(a,void 0,n))}}return i}};function em(e){let t=Y(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}const tm={collection:`seq`,default:!0,nodeClass:$p,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Vf(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>$p.from(e,t,n)};function nm(e){return typeof e==`bigint`||Number.isInteger(e)}const rm=({value:e})=>JSON.stringify(e),im=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:rm},{identify:e=>e==null,createNode:()=>new Z(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:rm},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:rm},{identify:nm,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>nm(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:rm}];[Qp,tm].concat(im,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function am(e,t,n){let{replacer:r}=n,i=new $p(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Wp(o,s,n))}return i}var om=class e extends $p{constructor(){super(),this.add=Zp.prototype.add.bind(this),this.delete=Zp.prototype.delete.bind(this),this.get=Zp.prototype.get.bind(this),this.has=Zp.prototype.has.bind(this),this.set=Zp.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(J(e)?(r=ap(e.key,``,t),i=ap(e.value,r,t)):r=ap(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=am(e,t,n),i=new this;return i.items=r.items,i}};om.tag=`tag:yaml.org,2002:omap`;var sm=class e extends Zp{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=J(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Gp(e.key,null):new Gp(e,null),Xp(this.items,t.key)||this.items.push(t)}get(e,t){let n=Xp(this.items,e);return!t&&J(n)?Y(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Xp(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Gp(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Wp(e,null,n));return i}};sm.tag=`tag:yaml.org,2002:set`;const cm=Symbol(`break visit`),lm=Symbol(`skip children`),um=Symbol(`remove item`);function dm(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),fm(Object.freeze([]),e,t)}dm.BREAK=cm,dm.SKIP=lm,dm.REMOVE=um,dm.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},dm.parentCollection=(e,t)=>{let n=dm.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function fm(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=fm(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===cm)return cm;else r===um&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.{0,2}\/|^\.{1,2}$/,l=/\/$/,u=`node-ignore`;typeof Symbol<`u`&&(u=Symbol.for(`node-ignore`));let d=u,f=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),p=/([0-z])-([0-z])/g,m=()=>!1,h=e=>e.replace(p,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),g=e=>{let{length:t}=e;return e.slice(0,t-t%2)},ee=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${g(r)}${i}`:i===`]`&&r.length%2==0?`[${h(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],_=/(^|\\\/)?\\\*$/,v=`regex`,te=`checkRegex`,ne={[v](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[te](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},re=e=>ee.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),ie=e=>typeof e==`string`,ae=e=>e&&ie(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,oe=e=>e.split(s).filter(Boolean);var se=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,f(this,`body`,n),f(this,`ignoreCase`,r),f(this,`regexPrefix`,a)}get regex(){let e=`_regex`;return this[e]?this[e]:this._make(v,e)}get checkRegex(){let e=`_checkRegex`;return this[e]?this[e]:this._make(te,e)}_make(e,t){let n=this.regexPrefix.replace(_,ne[e]),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return f(this,t,r)}};let ce=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(a,`!`).replace(o,`#`);let s=re(i);return new se(e,t,i,n,r,s)};var le=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[d]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(ie(e)&&(e={pattern:e}),ae(e.pattern)){let t=ce(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(ie(e)?oe(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a;this._rules.forEach(o=>{let{negative:s}=o;i===s&&r!==i||s&&!r&&!i&&!t||o[n].test(e)&&(r=!s,i=s,a=s?void 0:o)});let o={ignored:r,unignored:i};return a&&(o.rule=a),o}};let ue=(e,t)=>{throw new t(e)},y=(e,t,n)=>ie(e)?e?!y.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),b=e=>c.test(e);y.isNotRelative=b,y.convert=e=>e;var de=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){f(this,d,!0),this._rules=new le(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n,r){let i=e&&y.convert(e);return y(i,e,this._strictPathCheck?ue:m),this._t(i,t,n,r)}checkIgnore(e){if(!l.test(e))return this.test(e);let t=e.split(`/`).filter(Boolean);if(t.pop(),t.length){let e=this._t(t.join(`/`)+`/`,this._testCache,!0,t);if(e.ignored)return e}return this._rules.test(e,!1,te)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`).filter(Boolean),r.pop(),!r.length)return t[e]=this._rules.test(e,n,v);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._rules.test(e,n,v)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let fe=e=>new de(e),pe=e=>y(e&&y.convert(e),e,m),me=()=>{y.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;y.isNotRelative=t=>e.test(t)||b(t)};typeof process<`u`&&process.platform===`win32`&&me(),t.exports=fe,fe.default=fe,t.exports.isPathValid=pe,f(t.exports,Symbol.for(`setupWindows`),me)}))(),globalThis.Buffer,A({command:br({description:`Bash command to execute`}),timeout:nn(gr({description:`Timeout in seconds (optional, no default timeout)`}))});var pm=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends pm{};function mm(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function hm(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function gm(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function _m(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function vm(e,t){return gm(e,t,``)}function ym(e,t){return _m(e,t,``)}function bm(e,t){return t.slice(0,xm(e,t))}function xm(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Sm(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Cm(e,t){if(t)return Tm(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function wm(e,t){if(t)return Tm(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Tm(e,t){if(!t)return[wm(e),Cm(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Sm(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}const Em=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Dm=RegExp(`[${Em}]+|\\s+|[^${Em}]`,`ug`);new class extends pm{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Sm(e,r)}else n=e.match(Dm)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Om(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Om(n,i,r,null,t.intlSegmenter),e}};function Om(e,t,n,r,i){if(t&&n){let[a,o]=Tm(t.value,i),[s,c]=Tm(n.value,i);if(e){let r=mm(a,s);e.value=_m(e.value,s,r),t.value=vm(t.value,r),n.value=vm(n.value,r)}if(r){let e=hm(o,c);r.value=gm(r.value,c,e),t.value=ym(t.value,e),n.value=ym(n.value,e)}}else if(n){if(e){let e=wm(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=wm(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=wm(r.value,i),[a,o]=Tm(t.value,i),s=mm(n,a);t.value=vm(t.value,s);let c=hm(vm(n,s),o);t.value=ym(t.value,c),r.value=gm(r.value,n,c),e.value=_m(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=wm(r.value,i),n=bm(Cm(t.value,i),e);t.value=ym(t.value,n)}else if(e){let n=bm(Cm(e.value,i),wm(t.value,i));t.value=vm(t.value,n)}}new class extends pm{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Em}]+|[^\\S\\n\\r]+|[^${Em}]`,`ug`);return e.match(t)||[]}},new class extends pm{constructor(){super(...arguments),this.tokenize=km}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
40
|
-
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
41
|
-
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
42
|
-
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
43
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function km(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
44
|
-
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Am(e){return e==`.`||e==`!`||e==`?`}new class extends pm{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Am(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends pm{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends pm{constructor(){super(...arguments),this.tokenize=km}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(jm(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function jm(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=jm(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=jm(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends pm{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};const Mm=A({oldText:br({description:`Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call.`}),newText:br({description:`Replacement text for this targeted edit.`})},{});A({path:br({description:`Path to the file to edit (relative or absolute)`}),edits:Rt(Mm,{description:`One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead.`})},{}),A({path:br({description:`Path to the file to read (relative or absolute)`}),offset:nn(gr({description:`Line number to start reading from (1-indexed)`})),limit:nn(gr({description:`Maximum number of lines to read`}))}),A({path:br({description:`Path to the file to write (relative or absolute)`}),content:br({description:`Content to write to the file`})});const Nm={enabled:!0,reserveTokens:16384,keepRecentTokens:2e4};function Pm(e,t,n){return n.enabled?e>t-n.reserveTokens:!1}function Fm(e){if(typeof e==`string`)return e.length;let t=0;for(let n of e)n.type===`text`&&n.text?t+=n.text.length:n.type===`image`&&(t+=4800);return t}function Im(e){let t=0;switch(e.role){case`user`:return t=Fm(e.content),Math.ceil(t/4);case`assistant`:{let n=e;for(let e of n.content)e.type===`text`?t+=e.text.length:e.type===`thinking`?t+=e.thinking.length:e.type===`toolCall`&&(t+=e.name.length+JSON.stringify(e.arguments).length);return Math.ceil(t/4)}case`custom`:case`toolResult`:return t=Fm(e.content),Math.ceil(t/4);case`bashExecution`:return t=e.command.length+e.output.length,Math.ceil(t/4);case`branchSummary`:case`compactionSummary`:return t=e.summary.length,Math.ceil(t/4)}return 0}const Lm=n(`context-compaction`);function Rm(e,t){return e.role===t}function zm(e){let t=0;for(;t<e.length&&Rm(e[t],`toolResult`);){let n=e[t];Lm.warn(`Dropping orphaned toolResult (no preceding assistant message)`,{toolCallId:n.toolCallId}),t++}return t>0?e.slice(t):e}function Bm(e){let t=[];for(let n of e){let e=n;switch(e.role){case`user`:t.push(`<user>\n${Vm(e.content)}\n</user>`);break;case`assistant`:t.push(`<assistant>\n${Vm(e.content)}\n</assistant>`);break;case`toolResult`:{let n=e.toolName??`tool`;t.push(`<tool-result name="${n}">\n${Vm(e.content)}\n</tool-result>`);break}case`bashExecution`:t.push(`<bash>\n$ ${e.command??``}\n${e.output??``}\n</bash>`);break;case`branchSummary`:case`compactionSummary`:t.push(`<prior-summary>\n${e.summary??``}\n</prior-summary>`);break;default:t.push(`<${e.role}>\n${Vm(e.content)}\n</${e.role}>`)}}return t.join(`
|
|
45
|
-
|
|
46
|
-
`)}function Vm(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return``;let t=[];for(let n of e){let e=n;e.type===`text`&&e.text?t.push(e.text):e.type===`thinking`&&e.thinking?t.push(`[thinking] ${e.thinking}`):e.type===`toolCall`?t.push(`[tool-call ${e.name??`?`}] ${JSON.stringify(e.arguments??{})}`):e.type===`image`&&t.push(`[image]`)}return t.join(`
|
|
47
|
-
`)}function Hm(e){return`You are a context compaction assistant. You are shown the prefix of a conversation between a user and an AI coding assistant, and asked to produce either a structured summary, durable memory bullets, or a short title — depending on the user's instruction.
|
|
48
|
-
|
|
49
|
-
Do NOT continue the conversation. Do NOT answer questions inside the conversation. Output ONLY what the user asks for in the format specified.
|
|
50
|
-
|
|
51
|
-
<conversation>
|
|
52
|
-
${e}
|
|
53
|
-
</conversation>`}async function Um(e,t,n,r,i,a,o){let s=await ne(e,{systemPrompt:n,messages:[{role:`user`,content:[{type:`text`,text:r}],timestamp:Date.now()}]},{maxTokens:i,apiKey:t,headers:a,signal:o});if(s.stopReason===`error`)throw Error(`Compaction call failed: ${s.errorMessage||`Unknown error`}`);return s.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
54
|
-
`).trim()}function Wm(e){if(typeof e==`string`)return e.length;if(!Array.isArray(e))return 0;let t=0;for(let n of e){let e=n;if(e.type===`text`&&e.text)t+=e.text.length;else if(e.type===`thinking`&&e.thinking)t+=e.thinking.length;else if(e.type===`toolCall`&&e.arguments!==void 0)try{t+=JSON.stringify(e.arguments).length}catch{}else e.type===`image`&&e.source?.data&&(t+=e.source.data.length)}return t}function Gm(e,t){let n=Math.max(1,Math.round(e/1024));return`[${t===`assistant`?`Assistant message elided`:`Tool result elided`}: ${n} KB, exceeds half the context window. Re-run with smaller arguments — e.g. open --view --size low.]`}function Km(e){let t=e.role,n=e.content,r=Wm(n);if(t===`toolResult`)return{...e,content:[{type:`text`,text:Gm(r,t)}]};let i=(Array.isArray(n)?n.filter(e=>e.type===`toolCall`):[]).map(e=>{let t=0;if(e.arguments!==void 0)try{t=JSON.stringify(e.arguments).length}catch{}return{type:e.type,id:e.id,name:e.name,arguments:{elided:!0,originalBytes:t}}});return{...e,content:[{type:`text`,text:Gm(r,t)},...i]}}function qm(e,t,n){let r=(t-n)/2,i=0,a=0;return{messages:e.map(e=>{if(Im(e)<=r)return e;let t=e.role;if(t!==`toolResult`&&t!==`assistant`)return e;let n=e,o=Wm(n.content);return t===`toolResult`?(i++,a+=o,Km(e)):(Array.isArray(n.content)?n.content:[]).filter(e=>e.type===`toolCall`).length===0?e:(i++,a+=o,Km(e))}),elidedCount:i,elidedBytes:a}}function Jm(e){let t=0;for(let n of e)t+=Im(n);return t}function Ym(e,t){return e.length!==t.length||e.some((e,n)=>e!==t[n])}function Xm(e,t){try{e.onCompactionStateChange?.(t)}catch(e){Lm.warn(`onCompactionStateChange listener threw`,{error:e instanceof Error?e.message:String(e)})}}function Zm(e,t,n,r,i,a){if(t<=n*i)return{messages:e,isHopeless:!1,earlyReturn:null};let o=qm(e,n,r),s=o.messages;return Lm.warn(`Compaction hopeless branch`,{totalTokens:t,contextWindow:n,multiplier:i,elidedCount:o.elidedCount,elidedBytes:o.elidedBytes}),{messages:s,isHopeless:!0,earlyReturn:Pm(Jm(s),n,a)?null:s}}function Qm(e,t){let n=0,r=e.length;for(let i=e.length-1;i>=0;i--){let a=Im(e[i]);if(n+a>t&&r<e.length)break;n+=a,r=i}for(;r>0&&Rm(e[r],`toolResult`);)r--;return r<=0||r>=e.length?(Lm.warn(`Cannot find valid cut point for compaction`),null):{messagesToSummarize:e.slice(0,r),messagesToKeep:zm(e.slice(r))}}async function $m(e,t,n,r){if(e.onMemoryUpdates)try{Xm(e,`extracting-memory`);let i=await Um(e.model,t,n,`From the conversation above, extract durable memories worth persisting to a global memory file shared across future sessions.
|
|
55
|
-
|
|
56
|
-
Focus on:
|
|
57
|
-
- User preferences, working style, opinions stated explicitly.
|
|
58
|
-
- Stable project facts (architecture decisions, conventions, constraints).
|
|
59
|
-
- Validated approaches the user accepted ("yes, exactly", "perfect"), not just corrections.
|
|
60
|
-
- External resources/links the user named.
|
|
61
|
-
|
|
62
|
-
DO NOT include:
|
|
63
|
-
- Ephemeral state (current task, in-progress work).
|
|
64
|
-
- Information already obvious from the codebase (file paths, function names, framework conventions).
|
|
65
|
-
- Generic restatements of what the conversation was about.
|
|
66
|
-
|
|
67
|
-
If nothing in the conversation is worth persisting, return exactly the single line:
|
|
68
|
-
NONE
|
|
69
|
-
|
|
70
|
-
Otherwise, output ONLY a markdown bullet list (one bullet per memory), no headers, no preamble, no follow-up. Each bullet is one line. Be specific. Prefer one fact per bullet over multi-clause sentences.`,2048,e.headers,r);if(i?.trim()&&i.trim()!==`NONE`)try{await e.onMemoryUpdates(i.trim()),Lm.info(`Memory extraction applied`,{bulletsLength:i.length})}catch(e){Lm.warn(`onMemoryUpdates callback threw`,{error:e instanceof Error?e.message:String(e)})}else Lm.info(`Memory extraction returned no durable memories`)}catch(e){Lm.warn(`Memory extraction call failed (compaction still applied)`,{error:e instanceof Error?e.message:String(e)})}}async function eh(e,t,n,r,i,a,o){try{let s=Hm(Bm(n)),c=Math.floor(.8*i);Xm(e,`summarizing`);let l=await Um(e.model,t,s,`Produce a structured context checkpoint summary of the conversation above that another LLM can use to continue the work.
|
|
71
|
-
|
|
72
|
-
Use this EXACT format:
|
|
73
|
-
|
|
74
|
-
## Goal
|
|
75
|
-
[What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
|
|
76
|
-
|
|
77
|
-
## Constraints & Preferences
|
|
78
|
-
- [Any constraints, preferences, or requirements mentioned by user]
|
|
79
|
-
- [Or "(none)" if none were mentioned]
|
|
80
|
-
|
|
81
|
-
## Progress
|
|
82
|
-
### Done
|
|
83
|
-
- [x] [Completed tasks/changes]
|
|
84
|
-
|
|
85
|
-
### In Progress
|
|
86
|
-
- [ ] [Current work]
|
|
87
|
-
|
|
88
|
-
### Blocked
|
|
89
|
-
- [Issues preventing progress, if any]
|
|
90
|
-
|
|
91
|
-
## Key Decisions
|
|
92
|
-
- **[Decision]**: [Brief rationale]
|
|
93
|
-
|
|
94
|
-
## Next Steps
|
|
95
|
-
1. [Ordered list of what should happen next]
|
|
96
|
-
|
|
97
|
-
## Critical Context
|
|
98
|
-
- [Any data, examples, or references needed to continue]
|
|
99
|
-
- [Or "(none)" if not applicable]
|
|
100
|
-
|
|
101
|
-
Keep each section concise. Preserve exact file paths, function names, and error messages. Output ONLY the summary, with no preamble or follow-up.`,c,e.headers,o),u={role:`user`,content:[{type:`text`,text:`<context-summary>\n${l}\n</context-summary>`}],timestamp:Date.now()};return Lm.info(`LLM summarization successful`,{originalMessages:a,compactedMessages:1+r.length,summaryLength:l.length}),await $m(e,t,s,o),Xm(e,`idle`),[u,...r]}catch(e){return Lm.warn(`LLM summarization failed, falling back to naive drop`,{error:e instanceof Error?e.message:String(e)}),null}}function th(e){let t=e.contextWindow??2e5,n=e.reserveTokens??Nm.reserveTokens,r=e.keepRecentTokens??Nm.keepRecentTokens,i=e.hopelessMultiplier??4,a={enabled:!0,reserveTokens:n,keepRecentTokens:r};return async(o,s,c)=>{if(o.length===0)return o;let l=Jm(o);if(!c?.force&&!Pm(l,t,a))return o;let u=Zm(o,l,t,n,i,a);if(u.earlyReturn)return u.earlyReturn;let d=u.messages,f=u.isHopeless;Lm.info(`Context compaction triggered`,{totalTokens:l,contextWindow:t,threshold:t-n,messageCount:d.length});let p=Qm(d,r);if(!p)return d;let{messagesToSummarize:m,messagesToKeep:h}=p;Lm.info(`Compaction cut point`,{summarizing:m.length,keeping:h.length});let g=f?void 0:e.getApiKey();if(g){let t=await eh(e,g,m,h,n,o.length,s);if(t)return t}else f||Lm.warn(`No API key available for LLM summarization, falling back to naive drop`);Xm(e,`idle`);let ee={role:`user`,content:[{type:`text`,text:`[Earlier conversation messages were compacted to save context space]`}],timestamp:Date.now()};return Lm.info(`Naive compaction applied`,{originalMessages:o.length,compactedMessages:1+h.length}),[ee,...h]}}const nh=m({portName:`secrets.crud`,panelRpcOp:`secrets-bridge`,timeoutMs:1e4,onUnavailable:`resolve-undefined`,makeError:e=>Error(e),logNamespace:`secrets-bridge`,toPortMessage:({type:e,payload:t})=>({type:e,...t}),toPanelRpcPayload:({type:e,payload:t})=>({type:e,payload:t})});function rh(e,t){return nh({type:e,payload:t})}const ih=n(`secret-scrub`),ah=async e=>e;function oh(){let e=le();return e===`extension-direct`?async e=>{if(!e)return e;try{let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.scrub-tool-result`,text:e},e=>t(e??{}))});return t.error?(ih.debug(`SW scrub-tool-result returned error`,{error:t.error}),e):typeof t.text==`string`?t.text:e}catch(t){return ih.debug(`SW scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}:e===`extension-delegate`?async e=>{if(!e)return e;try{let t=await rh(`secrets.scrub-tool-result`,{text:e});return t?.error?(ih.debug(`Bridge scrub-tool-result returned error`,{error:t.error}),e):typeof t?.text==`string`?t.text:e}catch(t){return ih.debug(`Bridge scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}:e===`connect`?ah:async e=>{if(!e)return e;try{let t=await fetch(l(`/api/secrets/scrub`),{method:`POST`,headers:u({"content-type":`application/json`}),body:JSON.stringify({text:e})});if(!t.ok)return ih.debug(`Server scrub-tool-result returned non-ok`,{status:t.status}),e;let n=await t.json();return typeof n.text==`string`?n.text:e}catch(t){return ih.debug(`Server scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}}const sh=n(`tool-adapter`);function ch(e){let t=[],n=0;for(let r of e.matchAll(ee())){let i=h(r[0]);if(!i)continue;let a=e.slice(n,r.index);a.trim()&&t.push({type:`text`,text:a.trimEnd()}),t.push({type:`image`,mimeType:i.mimeType,data:i.data}),n=r.index+r[0].length}let r=e.slice(n);return(r.trim()||t.length===0)&&t.push({type:`text`,text:r||e}),t}async function lh(e){let t=ch(e),n=[];for(let e of t)e.type===`image`?n.push(await g(e)):n.push(e);return n}function uh(e,t,n,r){if(!r)return{tracked:null,effectiveSignal:n};let i=r.processManager.spawn({kind:`tool`,argv:[e.name,...gh(t)],owner:r.owner,ppid:r.getParentPid?.()});n?.aborted?r.processManager.signal(i.pid,`SIGINT`):n&&n.addEventListener(`abort`,()=>r.processManager.signal(i.pid,`SIGINT`),{once:!0});let a=r.processManager.onSignal((e,t)=>{e.pid!==i.pid||t!==`SIGKILL`||r.processManager.exit(i.pid,null)});return{tracked:{record:i,manager:r.processManager,unsubscribeKill:a},effectiveSignal:i.abort.signal}}function dh(e,t){e&&e.manager.exit(e.record.pid,t)}async function fh(e,t,n){if(!n||typeof e!=`string`||e.length===0)return e;try{return await n.scrubToolResult(e)}catch(n){return sh.warn(`Tool-result scrub failed, falling back to unscrubbed content`,{tool:t,error:n instanceof Error?n.message:String(n)}),e}}async function ph(e,t){try{return await lh(e)}catch(n){return sh.warn(`Image processing failed, falling back to raw content`,{tool:t,error:n instanceof Error?n.message:String(n)}),ch(e)}}function mh(e,t,n){return{name:e.name,label:e.name,description:e.description,parameters:e.inputSchema,async execute(r,i,a,o){let s;o&&(s=f({onUpdate:o,toolName:e.name,toolCallId:r}));let c=uh(e,i,a,t);try{let t=await e.execute(i??{},c.effectiveSignal),r=await ph(await fh(t.content,e.name,n),e.name);return dh(c.tracked,+!!t.isError),{content:r,details:{isError:t.isError}}}catch(e){throw dh(c.tracked,c.tracked?.record.abort.signal.aborted?null:1),e}finally{s&&p(s),c.tracked?.unsubscribeKill()}}}}function hh(e,t,n){return e.map(e=>mh(e,t,n))}function gh(e){if(typeof e!=`object`||!e)return[];let t=e;for(let e of[`command`,`file_path`,`path`,`pattern`,`url`,`key`,`name`,`query`,`message`]){let n=t[e];if(typeof n==`string`&&n.length>0)return[n]}for(let e of Object.values(t))if(typeof e==`string`&&e.length>0)return[e];return[]}function _h(e,t){let n={input:0,output:0,cacheRead:0,cacheWrite:0},r=_(e);if(!r)return n;let i;for(let e of t.values()){let t=_(e.id);!t||t.family!==r.family||(!i||t.major>i.major||t.major===i.major&&t.minor>i.minor)&&(i={major:t.major,minor:t.minor,cost:e.cost})}return i?.cost??n}var vh=e({ACCOUNTS_KEY:()=>xh,__test__:()=>Ah,addAccount:()=>Xh,applyProviderDefaults:()=>zh,clearAllSettings:()=>Sg,clearApiKey:()=>_g,clearBaseUrl:()=>bg,clearSelectedProvider:()=>mg,exportProviders:()=>xg,getAccounts:()=>$,getAllAvailableModels:()=>Uh,getAllExtraOAuthDomains:()=>qh,getApiKey:()=>hg,getApiKeyForProvider:()=>ag,getApiVersionForProvider:()=>cg,getAvailableProviders:()=>jh,getBaseUrl:()=>vg,getBaseUrlForProvider:()=>og,getDeploymentForProvider:()=>sg,getExtraOAuthDomains:()=>Wh,getOAuthAccountInfo:()=>Lh,getProviderConfig:()=>Ph,getProviderModels:()=>Ih,getRawApiKeyForProvider:()=>ig,getSelectedModelId:()=>lg,getSelectedProvider:()=>fg,isModelHiddenFromPicker:()=>Vh,logoutOAuthAccount:()=>$h,maskOAuthTokenWithRetry:()=>eg,migrateLegacyAuthOnlySelection:()=>Oh,persistOAuthMaskViaServiceWorker:()=>tg,providerOffersLlmModels:()=>Mh,removeAccount:()=>Qh,resolveCurrentModel:()=>Dg,resolveModelById:()=>Eg,resolveModelByShorthand:()=>Og,resolveModelIdForScoop:()=>Ag,saveOAuthAccount:()=>rg,setApiKey:()=>gg,setBaseUrl:()=>yg,setExtraOAuthDomains:()=>Gh,setExtraOAuthDomainsAsync:()=>Kh,setSelectedModelId:()=>ug,setSelectedProvider:()=>pg});const yh=ae,bh=v,xh=`slicc_accounts`,Sh=`selected-model`,Ch=[`slicc_provider`,`slicc_api_key`,`slicc_base_url`,`anthropic_api_key`,`api_provider`,`azure_resource`,`bedrock_region`],wh=new Set([`github`]);function Th(e){let t;try{t=te()}catch{return!1}return t.includes(e)&&!o(e)}let Eh=!1;function Dh(){if(!Eh){Eh=!0;for(let e of Ch)try{localStorage.removeItem(e)}catch{}Oh()}}function Oh(){try{let e=localStorage.getItem(Sh);if(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t);(wh.has(n)||Th(n))&&localStorage.removeItem(Sh)}}}catch{}try{let e=localStorage.getItem(xh);if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t))return;let n=t.filter(e=>!(typeof e==`object`&&e&&typeof e.providerId==`string`&&Th(e.providerId)));n.length!==t.length&&localStorage.setItem(xh,JSON.stringify(n))}catch{}}function kh(){Eh=!1}const Ah={_resetLegacyCleanup:kh};function jh(){let e=te().filter(o),t=a();return[...new Set([...e,...t])].filter(e=>!s(e)?.hidden)}function Mh(e){try{if(Ih(e).length>0)return!0}catch{}try{if(v(e).length>0)return!0}catch{}let t=s(e);return!!(t?.modelOverrides&&Object.keys(t.modelOverrides).length>0)}function Nh(e,t){try{if(Ih(e).some(e=>e.id===t))return!0}catch{}try{if(v(e).some(e=>e.id===t))return!0}catch{}let n=s(e);return!!(n?.modelOverrides&&Object.hasOwn(n.modelOverrides,t))}function Ph(e){return s(e)||{id:e,name:e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),description:`${e} provider`,requiresApiKey:!0,requiresBaseUrl:!1}}function Fh(e,t){t.context_window!==void 0&&(e.contextWindow=t.context_window),t.max_tokens!==void 0&&(e.maxTokens=t.max_tokens),t.reasoning!==void 0&&(e.reasoning=t.reasoning),t.input!==void 0&&(e.input=t.input),t.cost!==void 0&&(e.cost=t.cost,e.inputCost=t.cost.input,e.outputCost=t.cost.output,e.cacheReadCost=t.cost.cacheRead,e.cacheWriteCost=t.cost.cacheWrite),t.compat!==void 0&&(e.compat={...e.compat??{},...t.compat}),t.thinkingLevelMap!==void 0&&(e.thinkingLevelMap={...e.thinkingLevelMap??{},...t.thinkingLevelMap})}function Ih(e){try{if(e===`bedrock-camp`){let e=ie(og(`bedrock-camp`));return bh(`amazon-bedrock`).filter(t=>re(t,e)).map(e=>({...e,api:`bedrock-camp-converse`,provider:`bedrock-camp`}))}let t=Ph(e);if(t.getModelIds){let n;try{n=t.getModelIds()}catch(t){return Q.error(`Provider getModelIds callback failed`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}let r=new Map;for(let e of te())try{for(let t of bh(e))r.set(t.id,t)}catch{}return n.map(n=>{let i=n.api===`openai`?`openai`:`anthropic`,a=`${e}-${i}`,o=r.get(n.id),s;if(o)s={...o,api:a,provider:e};else if(s=wg(e,n.id,``,a),n.name&&(s.name=n.name),i===`anthropic`){let e=_h(n.id,r);s.cost=e,s.inputCost=e.input,s.outputCost=e.output,s.cacheReadCost=e.cacheRead,s.cacheWriteCost=e.cacheWrite}let c=t.modelOverrides?.[n.id];return c&&Fh(s,c),Fh(s,n),s})}if(t.isOAuth){let n=bh(`anthropic`),r=`${e}-anthropic`;return n.map(n=>{let i={...n,api:r,provider:e},a=t.modelOverrides?.[n.id];return a&&Fh(i,a),i})}return bh(e===`azure-ai-foundry`?`anthropic`:e)}catch(t){return Q.error(`Failed to load models`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}}function Lh(e){let t=$().find(t=>t.providerId===e);if(!t?.accessToken)return null;let n=!!t.tokenExpiresAt&&Date.now()>t.tokenExpiresAt-6e4;return{token:t.accessToken,maskedValue:t.maskedValue,expiresAt:t.tokenExpiresAt,userName:t.userName,userAvatar:t.userAvatar,scopes:t.scopes,expired:n}}const Rh=Object.assign({})[`/packages/webapp/providers.json`]??[],Q=n(`provider-settings`);function zh(e=Rh){if(e.length===0||$().length>0)return;let t=new Set(jh());for(let n of e)if(!(!n.providerId||!n.apiKey)){if(!t.has(n.providerId)){Q.warn(`Unknown provider "${n.providerId}" in providers.json — skipping`);continue}Xh(n.providerId,n.apiKey,n.baseUrl)}let n=e.find(e=>e.providerId&&e.apiKey&&t.has(e.providerId));n?.model&&!localStorage.getItem(Sh)&&localStorage.setItem(Sh,`${n.providerId}:${n.model}`)}const Bh=[/haiku/i];function Vh(e){return Bh.some(t=>t.test(e))}function Hh(e){return e.filter(e=>!Vh(e.id))}function Uh(){let e=$();if(e.length===0)return[];let t=new Map;for(let n of e){if(t.has(n.providerId))continue;let e=Ph(n.providerId);if(e.hidden||Th(n.providerId))continue;let r=Hh(Ih(n.providerId));if(r.length===0)continue;let i={providerId:n.providerId,providerName:e.name,models:r};t.set(n.providerId,i)}return[...t.values()]}function $(){Dh();let e=localStorage.getItem(xh);if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.providerId==`string`&&typeof e.apiKey==`string`):[]}catch{return[]}}function Wh(e){return se(localStorage)[e]??[]}function Gh(e,t){let n=se(localStorage),r=t.map(e=>e.trim()).filter(e=>e.length>0);r.length===0?delete n[e]:n[e]=r,ce(localStorage,n)}async function Kh(e,t){if(i()){Gh(e,t);return}let n=r();if(!n)throw Error(`setExtraOAuthDomainsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let{storeAfter:a}=await n.call(`oauth-extras-set`,{providerId:e,domains:t});try{ce(localStorage,a)}catch(t){Q.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{providerId:e,error:t instanceof Error?t.message:String(t)})}}function qh(){return se(localStorage)}function Jh(e){localStorage.setItem(xh,JSON.stringify(e))}async function Yh(e){if(i()){Jh(e);return}let t=r();if(!t)throw Error(`saveAccountsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let n=JSON.stringify(e),{storedJson:a}=await t.call(`save-oauth-accounts`,{accountsJson:n});try{localStorage.setItem(xh,a)}catch(e){Q.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{error:e instanceof Error?e.message:String(e)})}}function Xh(e,t,n,r,i){let a=$().filter(t=>t.providerId!==e),o={providerId:e,apiKey:t};n&&(o.baseUrl=n),r&&(o.deployment=r),i&&(o.apiVersion=i),a.push(o),Jh(a)}async function Zh(e){let t=le();try{if(t===`extension-direct`){let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.delete`,name:`oauth.${e}.token`},n=>{chrome.runtime.lastError&&Q.error(`SW secrets.delete transport failed`,{providerId:e,error:chrome.runtime.lastError.message}),t(n??{})})});t.error&&Q.error(`SW secrets.delete returned error`,{providerId:e,error:t.error})}else if(t===`extension-delegate`){let t=await rh(`secrets.delete`,{name:`oauth.${e}.token`});t?.error&&Q.error(`Bridge secrets.delete returned error`,{providerId:e,error:t.error})}else if(t!==`connect`){let t=await fetch(l(`/api/secrets/oauth/${e}`),{method:`DELETE`,headers:u()});!t.ok&&t.status!==404&&Q.warn(`OAuth replica DELETE non-ok`,{providerId:e,status:t.status})}}catch(n){Q.error(`OAuth replica removal failed`,{providerId:e,topology:t,error:n instanceof Error?n.message:String(n)})}}async function Qh(e){let t=$().find(t=>t.providerId===e),n=Ph(e);t&&n?.isOAuth&&await $h(e),await Zh(e),await Yh($().filter(t=>t.providerId!==e));let r=localStorage.getItem(Sh)??``,i=r.indexOf(`:`);i>0&&r.slice(0,i)===e&&localStorage.removeItem(Sh)}async function $h(e){let t=$().find(t=>t.providerId===e);if(!t)return;let n=Ph(e);if(n?.isOAuth){if(n.onOAuthLogout)try{await n.onOAuthLogout()}catch(t){Q.warn(`onOAuthLogout failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})}if(n.getOAuthLogoutUrl){let r=n.getOAuthLogoutUrl(t);if(r){let{openIdpLogoutUrl:t}=await import(`./oauth-service-bKcyWLK0.js`);await t(r).catch(t=>{Q.warn(`IdP logout popup failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})})}}await Yh($().map(t=>t.providerId===e?{providerId:t.providerId,apiKey:``,baseUrl:t.baseUrl,userName:t.userName,userAvatar:t.userAvatar,loggedOut:!0}:t)),await Zh(e)}}async function eg(e,t={}){let n=Math.max(1,t.attempts??3),r=t.delayMs??150,i=t.sleep??(e=>new Promise(t=>setTimeout(t,e))),a;for(let t=0;t<n;t++){let o=await e();if(o.maskedValue)return{maskedValue:o.maskedValue};o.error&&(a=o.error),t<n-1&&await i(r)}return{lastError:a}}async function tg(e,t,n){let r={providerId:e.providerId,accessToken:e.accessToken,domains:e.domains.join(`,`)},{maskedValue:i,lastError:a}=await eg(()=>t.sendMaskRequest(r),n);if(!i){Q.error(`OAuth mask give-up: no masked value after retries`,{providerId:e.providerId,reason:a??`no error reported (cold SW or empty reply)`});return}let o=t.getAccounts(),s=o.find(t=>t.providerId===e.providerId);s&&(s.maskedValue=i,await t.saveAccounts(o))}function ng(e,t){if(e.accessToken)return`scopes`in e?e.scopes:t?.scopes}async function rg(e){let t=$().find(t=>t.providerId===e.providerId),n=$().filter(t=>t.providerId!==e.providerId);n.push({providerId:e.providerId,apiKey:``,accessToken:e.accessToken,refreshToken:e.refreshToken,tokenExpiresAt:e.tokenExpiresAt,userName:e.userName,userAvatar:e.userAvatar,baseUrl:e.baseUrl??t?.baseUrl,scopes:ng(e,t)}),await Yh(n);let r=Ph(e.providerId)?.oauthTokenDomains??[],i=Wh(e.providerId),a=new Set,o=[];for(let e of[...r,...i]){let t=e.toLowerCase();a.has(t)||(a.add(t),o.push(e))}if(o.length===0)return;let s=le();try{if(s===`extension-direct`)await tg({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>new Promise(n=>{chrome.runtime.sendMessage({type:`secrets.mask-oauth-token`,...t},t=>{chrome.runtime.lastError&&Q.error(`SW mask-oauth-token transport failed`,{providerId:e.providerId,error:chrome.runtime.lastError.message});let r=typeof t==`object`&&t?t:void 0;r?.error&&Q.warn(`SW mask-oauth-token returned error`,{providerId:e.providerId,error:r.error}),n(r??{})})}),getAccounts:$,saveAccounts:Yh});else if(s===`extension-delegate`)await tg({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>rh(`secrets.mask-oauth-token`,t).then(t=>(t?.error&&Q.warn(`Bridge mask-oauth-token returned error`,{providerId:e.providerId,error:t.error}),t??{})).catch(t=>(Q.error(`Bridge mask-oauth-token transport failed`,{providerId:e.providerId,error:t instanceof Error?t.message:String(t)}),{})),getAccounts:$,saveAccounts:Yh});else if(s!==`connect`){let t=await fetch(l(`/api/secrets/oauth-update`),{method:`POST`,headers:u({"Content-Type":`application/json`}),body:JSON.stringify({providerId:e.providerId,accessToken:e.accessToken,domains:o})});if(t.ok){let n=await t.json();if(typeof n.maskedValue==`string`){let t=$(),r=t.find(t=>t.providerId===e.providerId);r&&(r.maskedValue=n.maskedValue,await Yh(t))}else Q.warn(`OAuth replica POST ok but missing maskedValue`,{providerId:e.providerId})}else Q.warn(`OAuth replica POST non-ok`,{providerId:e.providerId,status:t.status})}}catch(t){Q.error(`OAuth replica sync failed`,{providerId:e.providerId,topology:s,error:t instanceof Error?t.message:String(t)})}}function ig(e){let t=$().find(t=>t.providerId===e);return t&&(t.accessToken||t.apiKey)||null}function ag(e){let t=$().find(t=>t.providerId===e);return t?t.accessToken||t.apiKey||(Ph(e).optionalApiKey?`local`:null):null}function og(e){return $().find(t=>t.providerId===e)?.baseUrl??null}function sg(e){return $().find(t=>t.providerId===e)?.deployment??null}function cg(e){return $().find(t=>t.providerId===e)?.apiVersion??null}function lg(){let e=localStorage.getItem(Sh)||``,t=e.indexOf(`:`);return t>=0?e.slice(t+1):e}function ug(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t),r=new Set([...a(),...jh()]),i=n.includes(`.`);if(r.has(n)||!i){localStorage.setItem(Sh,e);return}}let n=fg();localStorage.setItem(Sh,`${n}:${e}`)}function dg(){return localStorage.getItem(Sh)||``}function fg(){let e=dg(),t=e.indexOf(`:`);if(t>0)return e.slice(0,t);let n=$(),r=lg();if(r){let e=n.find(e=>Mh(e.providerId)&&Nh(e.providerId,r));if(e)return e.providerId}let i=n.find(e=>Mh(e.providerId));return i?i.providerId:n.length>0?n[0].providerId:`anthropic`}function pg(e){let t=lg();localStorage.setItem(Sh,`${e}:${t}`)}function mg(){let e=lg();localStorage.setItem(Sh,e)}function hg(){return ag(fg())}function gg(e){let t=fg();Xh(t,e,og(t)??void 0)}async function _g(){await Qh(fg())}function vg(){return og(fg())}function yg(e){let t=fg(),n=ig(t);n&&Xh(t,n,e||void 0)}function bg(){let e=fg(),t=ig(e);t&&Xh(e,t)}function xg(){let e=$(),t=fg(),n=lg();return e.map(e=>{let r={providerId:e.providerId,apiKey:e.apiKey};return e.baseUrl&&(r.baseUrl=e.baseUrl),e.providerId===t&&n&&(r.model=n),r})}async function Sg(){let e=$();await Promise.allSettled(e.map(e=>Qh(e.providerId))),localStorage.removeItem(xh),localStorage.removeItem(Sh);for(let e of Ch)localStorage.removeItem(e)}function Cg(e){return/^(?:gpt[-.]?|o[0-9]|chatgpt)/i.test(e)?`openai`:`anthropic`}function wg(e,t,n,r){return{id:t,name:t,provider:e,api:r??`${e}-${Cg(t)}`,baseUrl:n??``,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!0}}function Tg(e,t){return t.isOAuth||e===`azure-ai-foundry`?`anthropic`:e===`bedrock-camp`?`amazon-bedrock`:e}function Eg(e){if(!e)return Dg();let t=fg(),n=og(t),r=Ph(t);try{let i=Tg(t,r),a=yh(i,e);if(!a?.id)throw Error(`Model ${e} not found`);let o=a;return r.isOAuth?o=Ih(t).find(t=>t.id===e)||{...o,api:`${t}-anthropic`,provider:t}:t===`bedrock-camp`&&(o={...o,api:`bedrock-camp-converse`,provider:`bedrock-camp`}),n&&(o={...o,baseUrl:n}),o}catch(i){if(Q.debug(`resolveModelById: pi-ai lookup miss, using provider fallback`,{providerId:t,modelId:e,error:i instanceof Error?i.message:String(i)}),r.isOAuth){let r=Ih(t).find(t=>t.id===e);return r?n?{...r,baseUrl:n}:r:wg(t,e,n)}return Dg()}}function Dg(){let e=fg(),t=lg(),n=og(e),r=Ih(e),i=Ph(e),a=i.defaultModelId?r.find(e=>e.id.toLowerCase().includes(i.defaultModelId.toLowerCase()))?.id:void 0,o=t||a||r[0]?.id||`claude-sonnet-4-6`;try{let t=Tg(e,i),a=yh(t,o);if(!a?.id)throw Error(`Model ${o} not found in ${t} registry`);let s=a;return i.isOAuth?s=r.find(e=>e.id===o)||{...s,api:`${e}-anthropic`,provider:e}:e===`bedrock-camp`&&(s={...s,api:`bedrock-camp-converse`,provider:`bedrock-camp`}),n&&(s={...s,baseUrl:n}),s}catch(t){Q.debug(`resolveCurrentModel: pi-ai lookup miss, using provider fallback`,{providerId:e,effectiveModelId:o,error:t instanceof Error?t.message:String(t)});let a=r.find(e=>e.id===o);return a?n?{...a,baseUrl:n}:a:i.isOAuth?wg(e,o,n):yh(`anthropic`,`claude-sonnet-4-0`)}}function Og(e){let t=e.toLowerCase();if(!t)return null;let n=null;try{n=fg()}catch{}if(n!==null){let e=kg(t,[n]);if(e!==null)return e}return kg(t,$().map(e=>e.providerId))}function kg(e,t){let n=null,r=-1;for(let i of t)for(let t of Ih(i)){let i=t.id.toLowerCase(),a=(t.name??``).toLowerCase();if(!i.includes(e)&&!a.includes(e))continue;let o=t.contextWindow??0;(o>r||o===r&&jg(t.id,n??``)>0)&&(r=o,n=t.id)}return n}function Ag(e){if(!e)return null;let t=[e],n=Og(e);n!==null&&n!==e&&t.push(n);let r=[];try{r=Ih(fg())}catch{}for(let n of t)if(!(r.length>0&&!r.some(e=>e.id===n)))try{if(Eg(n).id===n)return n}catch(t){Q.debug(`resolveModelIdForScoop: candidate did not resolve`,{input:e,candidate:n,error:t instanceof Error?t.message:String(t)})}return null}function jg(e,t){let n=e.match(/\d+/g)?.map(Number)??[],r=t.match(/\d+/g)?.map(Number)??[],i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t}return 0}export{Af as $,$e as $t,eg as A,ue as An,Xn as At,gg as B,A as Bt,Ph as C,Ie as Cn,ur as Ct,fg as D,Ge as Dn,ar as Dt,lg as E,Ze as En,F as Et,Dg as F,M as Ft,pg as G,Gt,Gh as H,en as Ht,Eg as I,vn as It,oh as J,zt as Jt,_h as K,Ht as Kt,Og as L,fn as Lt,tg as M,Sn as Mt,Mh as N,xn as Nt,Vh as O,T as On,nr as Ot,Qh as P,yn as Pt,zm as Q,wt as Qt,Ag as R,ln as Rt,Lh as S,Fe as Sn,lr as St,ig as T,Re as Tn,fr as Tt,Kh as U,Jt as Ut,yg as V,rn as Vt,ug as W,qt as Wt,th as X,At as Xt,rh as Y,Rt as Yt,Ym as Z,Et as Zt,jh as _,Je as _n,br as _t,zh as a,Oe as an,ra as at,sg as b,Pe as bn,mr as bt,bg as c,it as cn,Xi as ct,$ as d,He as dn,z as dt,Qe as en,Ef as et,Uh as f,ze as fn,Ur as ft,cg as g,qe as gn,xr as gt,ag as h,Be as hn,L as ht,Xh as i,De as in,ia as it,Oh as j,le as jn,Yn as jt,$h as k,Ee as kn,tr as kt,mg as l,S as ln,Yi as lt,hg as m,Ve as mn,R as mt,Ah as n,Xe as nn,lf as nt,Sg as o,ke as on,Qi as ot,qh as p,Me as pn,zr as pt,hh as q,Bt as qt,vh as r,w as rn,mo as rt,_g as s,Ae as sn,Ki as st,xh as t,Ye as tn,xf as tt,xg as u,je as un,Zi as ut,vg as v,Ue as vn,yr as vt,Ih as w,Le as wn,dr as wt,Wh as x,x as xn,I as xt,og as y,Ne as yn,_r as yt,rg as z,j as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`slicc_feature_flags`,t=Object.freeze([Object.freeze({id:`experimental-settings`,label:`Experimental settings`,description:`Show controls for experimental features.`,defaultValue:`on`,floatDefaults:Object.freeze({cherry:`off`}),userToggleable:!1}),Object.freeze({id:`panel-layouts`,label:`Panel layouts`,description:`Arrange the UI as movable, resizable panels instead of the fixed workbench.`,defaultValue:`off`,userToggleable:!0})]),n=new Map(t.map(e=>[e.id,e])),r=new Set([`1`,`on`,`true`]),i=`standalone`,a={},o={};function s(){return t}function c(e,n={},r=l()){let i={};for(let a of t){let t=r[a.id];if(typeof t==`string`&&v(a,e)){i[a.id]=t;continue}let s=o[a.id];if(typeof s==`string`&&v(a,e)){i[a.id]=s;continue}let c=n[a.id];i[a.id]=typeof c==`string`?c:_(a,e)}return i}function l(){try{let t=b()?.getItem(e);return t?y(JSON.parse(t)):{}}catch{return{}}}function u(t){try{b()?.setItem(e,JSON.stringify(y(t)))}catch{}}function d(e,t){let r=n.get(e);if(!r||!v(r,i))return;let a=l();typeof t==`string`?a[e]=t:delete a[e],u(a)}function f(e,t={}){i=e,a=y(t),o={}}function p(e){let t={};for(let[r,a]of Object.entries(e)){let e=n.get(r);!e||typeof a!=`string`||!v(e,i)||(t[e.id]=a)}return o={...o,...t},t}function m(e){return c(i,a)[e]}function h(e){return typeof e==`string`&&r.has(e.trim().toLowerCase())}function g(e){return h(m(e))}function _(e,t){return e.floatDefaults?.[t]??e.defaultValue}function v(e,t){return e.userToggleable&&(e.overridableFloats===void 0||e.overridableFloats.includes(t))}function y(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n=e,r={};for(let e of t){let t=n[e.id];typeof t==`string`&&(r[e.id]=t)}return r}function b(){try{let e=globalThis.localStorage;return typeof e?.getItem!=`function`||typeof e.setItem!=`function`?void 0:e}catch{return}}export{d as a,s as i,f as n,g as r,p as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/quick-llm-DciVCRXg.js","assets/rolldown-runtime-aKtaBQYM.js","assets/account-store-DD9Lm9YR.js","assets/preload-helper-Czpn1I53.js","assets/compat-BhgG-Qr-.js","assets/models-DmWu8BeM.js","assets/diagnostics-DN_idNHx.js","assets/provider-env-D37PhSJu.js","assets/__vite-browser-external-SwrSgYTf.js","assets/openrouter.models-C8HitxAG.js","assets/context-compaction-gzCxn8vG.js","assets/logger-DDBAeTLF.js","assets/src-BStYtmHq.js","assets/proxied-fetch-A48etSCh.js","assets/base64-DpPqYZJF.js","assets/runtime-env-DH4NDw4t.js","assets/fetch-body-D2PwksUW.js","assets/secret-topology-CKyE_tTD.js","assets/secrets-bridge-client-CUeSRcdV.js","assets/port-bridge-client-B64OCgRQ.js","assets/tool-ui-DfXu6quJ.js","assets/tool-result-images-DwRGZUe_.js","assets/providers-YwT6GVHx.js","assets/panel-rpc-DmJSNs0I.js","assets/bedrock-camp-CVX95quY.js","assets/transform-messages-DgR3h-Ck.js","assets/llm-session-id-bZQs6gBN.js","assets/icons-CXqRAmcw.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{F as e,m as t}from"./account-store-DD9Lm9YR.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{t as r}from"./logger-DDBAeTLF.js";import"./provider-settings-1ecS2pWl.js";import{t as i}from"./llm-session-id-bZQs6gBN.js";import{t as a}from"./chat-session-store-DQztDoVa.js";import{n as o,r as s,t as c}from"./session-freezer-Djcsshfh.js";var l=r(`new-session`),u=`ui-new-session`,d=2e4,f=250;async function p(e,t,n,r){for(let i of n){let n=`${t}/${i.name}`;r.has(n)||i.type===`directory`&&(await p(e,n,await e.readDir(n),r),[...r].some(e=>e.startsWith(`${n}/`)))||await e.rm(n)}}async function m(e){let t=new Set((await e.listMountPoints()).map(({path:e})=>e).filter(e=>e===`/tmp`||e.startsWith(`/tmp/`)));if(t.has(`/tmp`))return;let n;try{n=await e.readDir(`/tmp`)}catch(t){if(t?.code!==`ENOENT`)throw t;await e.mkdir(`/tmp`,{recursive:!0});return}await p(e,`/tmp`,n,t),await e.mkdir(`/tmp`,{recursive:!0})}async function h(r){let f=r.enrichmentRaceMs??d,p=t()??void 0,m;try{m=e()}catch(e){l.info(`No active model — freezing without LLM enrichment`,{error:e instanceof Error?e.message:String(e)})}let h=m?.provider===`adobe`?{"X-Session-Id":i(u)}:void 0,_=new a;try{await _.init()}catch(e){return l.warn(`SessionStore init failed — cannot freeze`,{error:e instanceof Error?e.message:String(e)}),null}let v=await o({sessionStore:_,vfs:r.vfs,mode:`quick`});if(!v)return null;if(r.captureCompleteSnapshot)try{await r.captureCompleteSnapshot(v)}catch(e){let t=e?.code??`unknown`;l.warn(`captureCompleteSnapshot failed`,{code:t}),v.completeSnapshotUnavailable=!0;try{await s(r.vfs,v.filename)}catch{}}if(!p||!m)return l.info(`Frozen without enrichment (no LLM credentials) — left pending`,{filename:v.filename}),v;let y=m,b=c(r.vfs,v,{model:y,apiKey:p,headers:h,pickIcon:e=>n(async()=>{let{pickLucideIcon:e}=await import(`./quick-llm-DciVCRXg.js`).then(e=>e.n);return{pickLucideIcon:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])).then(({pickLucideIcon:t})=>t(e))}).catch(e=>(l.warn(`Single-click enrichment threw (entry stays pending)`,{filename:v.filename,error:e instanceof Error?e.message:String(e)}),null)),x=await g(b,f,r.onProgress);return x.kind===`llm`?x.updated?{...x.updated,archive:v.archive}:v:(b.then(e=>{l.info(`Background enrichment resolved after race window`,{filename:v.filename,enriched:e?.filename??null}),r.onBackgroundEnriched?.(e)}),v)}async function g(e,t,n){let r=Date.now(),i,a;n?.(0),n&&(i=setInterval(()=>{n(Math.min(1,(Date.now()-r)/t))},f));let o=new Promise(e=>{a=setTimeout(()=>e({kind:`timer`}),t)}),s=e.then(e=>({kind:`llm`,updated:e}));try{return await Promise.race([s,o])}finally{i&&clearInterval(i),a&&clearTimeout(a),n?.(null)}}async function _(e){let t=new a;try{await t.init()}catch(e){return l.warn(`SessionStore init failed — cannot quick-freeze`,{error:e instanceof Error?e.message:String(e)}),null}let n=await o({sessionStore:t,vfs:e.vfs,mode:`quick`});if(n&&e.captureCompleteSnapshot)try{await e.captureCompleteSnapshot(n)}catch(t){let r=t?.code??`unknown`;l.warn(`captureCompleteSnapshot failed (quick-freeze)`,{code:r}),n.completeSnapshotUnavailable=!0;try{await s(e.vfs,n.filename)}catch{}}return n}export{m as resetNewSessionTmp,h as runNewSessionFreeze,_ as runNewSessionFreezeQuick};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./store-Btjqu79j.js";export{e as readMcpAuthEntries};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jn as e}from"./account-store-Bu6Opk8I.js";async function t(){let t=e();if(t===`extension-direct`){let e=chrome;return e.identity?.getRedirectURL?.(`mcp-callback`)??`https://${e.runtime?.id??``}.chromiumapp.org/mcp-callback`}if(t===`node-rest`){let{getLocalApiBaseUrl:e}=await import(`./proxied-fetch-GabK83LB.js`).then(e=>e.o),t=e();if(t)return`${t}/auth/callback`}let{getOAuthPageOrigin:n}=await import(`./oauth-service-bKcyWLK0.js`),{origin:r}=await n();return`${r}${t===`extension-delegate`?`/auth/mcp-callback`:`/auth/callback`}`}export{t};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/quick-llm-DciVCRXg.js","assets/rolldown-runtime-aKtaBQYM.js","assets/account-store-DD9Lm9YR.js","assets/preload-helper-Czpn1I53.js","assets/compat-BhgG-Qr-.js","assets/models-DmWu8BeM.js","assets/diagnostics-DN_idNHx.js","assets/provider-env-D37PhSJu.js","assets/__vite-browser-external-SwrSgYTf.js","assets/openrouter.models-C8HitxAG.js","assets/context-compaction-gzCxn8vG.js","assets/logger-DDBAeTLF.js","assets/src-BStYtmHq.js","assets/proxied-fetch-A48etSCh.js","assets/base64-DpPqYZJF.js","assets/runtime-env-DH4NDw4t.js","assets/fetch-body-D2PwksUW.js","assets/secret-topology-CKyE_tTD.js","assets/secrets-bridge-client-CUeSRcdV.js","assets/port-bridge-client-B64OCgRQ.js","assets/tool-ui-DfXu6quJ.js","assets/tool-result-images-DwRGZUe_.js","assets/providers-YwT6GVHx.js","assets/panel-rpc-DmJSNs0I.js","assets/bedrock-camp-CVX95quY.js","assets/transform-messages-DgR3h-Ck.js","assets/llm-session-id-bZQs6gBN.js","assets/icons-CXqRAmcw.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./preload-helper-Czpn1I53.js";import{t as n}from"./compat-BhgG-Qr-.js";import{t as r}from"./attachments-CByeG2Ru.js";import{n as i,r as a,t as o}from"./context-compaction-gzCxn8vG.js";import{t as s}from"./logger-DDBAeTLF.js";import{t as c}from"./types-idfTVsM8.js";import{t as l}from"./icons-CXqRAmcw.js";import{a as u}from"./dictation-priming-DGpw1lUV.js";var d=s(`cone-memory-budget`),ee=4e3,f=2e3,p=1.25,m=`/workspace/CLAUDE.md`,te=`/sessions/index.json`,ne=4096,re=/^## Auto-extracted/m,ie=`Consolidate the auto-extracted memory bullets below into a single tighter set of durable memories.
|
|
3
|
-
|
|
4
|
-
Rules:
|
|
5
|
-
- Output ONLY a single \`## Auto-extracted (consolidated)\` heading followed by markdown bullets.
|
|
6
|
-
- One fact per bullet. Drop duplicates and superseded facts. Keep the most recent / specific phrasing.
|
|
7
|
-
- Preserve concrete identifiers (file paths, URLs, IDs, names) verbatim.
|
|
8
|
-
- Be terse. Aim well under the original size.
|
|
9
|
-
- Do NOT add preamble, commentary, or any heading other than the single consolidated one.`;function ae(e){return Math.round(ee+f*Math.log2((Number.isFinite(e)&&e>=0?e:0)+2))}function oe(e){let t=re.exec(e);if(!t)return{header:e,autoExtracted:``};let n=t.index;return{header:e.slice(0,n),autoExtracted:e.slice(n)}}async function h(e){try{let t=await e.readFile(te,{encoding:`utf-8`}),n=typeof t==`string`?t:new TextDecoder().decode(t),r=JSON.parse(n);return Array.isArray(r)?r.length:0}catch{return 0}}async function g(e){let{header:t,autoExtracted:r}=oe(e.currentContent);if(!r.trim())return e.currentContent;let i=`You are a memory consolidation assistant. You are given a markdown file's "auto-extracted" section — a list of memory bullets accumulated across sessions of an AI coding assistant. Your job is to rewrite that section as a tighter, deduplicated set of durable memories that fits well within ${e.budget} characters.
|
|
10
|
-
|
|
11
|
-
<auto-extracted>
|
|
12
|
-
${r}
|
|
13
|
-
</auto-extracted>`,a={role:`user`,content:[{type:`text`,text:ie}],timestamp:Date.now()},o=await n(e.model,{systemPrompt:i,messages:[a]},{apiKey:e.apiKey,maxTokens:ne,headers:e.headers,signal:e.signal});if(o.stopReason===`error`)throw Error(`Restructure call failed: ${o.errorMessage||`Unknown error`}`);let s=o.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
14
|
-
`).trim();if(!s)throw Error(`Restructure call returned empty content`);return`${t}${t.length===0||t.endsWith(`
|
|
15
|
-
`)?``:`
|
|
16
|
-
`}${s}\n`}async function _(e){if(!e.model||!e.apiKey)return{restructured:!1,reason:`no-llm`};let t=``;try{let n=await e.vfs.readFile(m,{encoding:`utf-8`});t=typeof n==`string`?n:new TextDecoder().decode(n)}catch{return{restructured:!1,reason:`missing-file`}}let n=await h(e.vfs),r=ae(n),i=r*p;if(t.length<=i)return{restructured:!1,reason:`under-threshold`};d.info(`Cone memory over threshold — restructuring`,{size:t.length,budget:r,threshold:i,sessionCount:n});try{let n=await g({currentContent:t,budget:r,model:e.model,apiKey:e.apiKey,headers:e.headers,signal:e.signal});return await e.vfs.writeFile(m,n),d.info(`Cone memory restructured`,{before:t.length,after:n.length}),{restructured:!0}}catch(e){return d.warn(`Cone memory restructure failed — leaving appended content in place`,{error:e instanceof Error?e.message:String(e)}),{restructured:!1,reason:`error`}}}var v=`/sessions`,y=`/sessions/index.json`;async function b(e){try{let t=await e.readFile(y,{encoding:`utf-8`}),n=typeof t==`string`?t:new TextDecoder().decode(t),r=JSON.parse(n);return Array.isArray(r)?r:[]}catch{return[]}}function x(e){return`${v}/${e.filename}`}function S(e){let t=e,n=`Untitled`,r={},i=t.match(/^---\n([\s\S]*?)\n---\n+/);if(i){t=t.slice(i[0].length);let e=C(i[1],`cost`),a=C(i[1],`models`);e&&(r.cost=e),a&&(r.models=a);let o=i[1].match(/^title:\s*(.+?)\s*$/m);if(o){let e=o[1].trim();if(e.startsWith(`"`))try{let t=JSON.parse(e);typeof t==`string`&&(n=t)}catch{n=e.replace(/^"|"$/g,``)}else n=e}}let a=t.match(/<!-- slicc:session-data\n([\s\S]*?)\n-->\n*/);if(a){try{let e=a[1].replace(/-- >/g,`-->`),t=JSON.parse(e);if(Array.isArray(t))return{title:n,messages:t,...r}}catch{}t=t.replace(/<!-- slicc:session-data\n[\s\S]*?\n-->\n*/,``)}return t=t.replace(/^#\s+[^\n]*\n+/,``),{title:n,messages:se(t),...r}}function C(e,t){let n=RegExp(`^${t}:\\s*(.+?)\\s*$`,`m`).exec(e)?.[1];if(n)try{return JSON.parse(n)}catch{return}}function se(e){let t=[],n=/^## (User|Assistant)\s*\n/gm,r=[],i;for(;(i=n.exec(e))!==null;)r.push({role:i[1]===`User`?`user`:`assistant`,start:i.index,bodyStart:i.index+i[0].length});for(let n=0;n<r.length;n++){let i=n+1<r.length?r[n+1].start:e.length,a=e.slice(r[n].bodyStart,i).trim();t.push({id:`frozen-${n}`,role:r[n].role,content:a,timestamp:0})}return t}function w(e){let t=``;for(let n of e){let e=n.role===`user`?`User`:`Assistant`,i=n.role===`user`?u(n.content):n.content;if(t+=`## ${e}\n${i}\n\n`,n.attachments?.length&&(t+=`Attachments:\n${n.attachments.map(e=>`- ${r(e)}`).join(`
|
|
17
|
-
`)}\n\n`),n.toolCalls)for(let e of n.toolCalls)t+=`### Tool: ${e.name}\nInput: ${JSON.stringify(e.input,null,2)}\nResult: ${e.result??``}\n\n`}return t}var ce=e({SESSIONS_INDEX_PATH:()=>y,enrichPendingSession:()=>X,freezeConeSession:()=>k,markSnapshotUnavailable:()=>$,readSessionsIndex:()=>b}),T=s(`session-freezer`),le=4,E=2048,D=40,O=`${v}/attachments`;async function k(e){let t=await W(e.sessionStore);if(!t||t.messages.length<le)return T.info(`Skipping freeze: session below threshold or missing`,{messageCount:t?.messages.length??0}),null;let n=G(t.messages),r=e.mode??`full`,i=r===`full`&&!!(e.apiKey&&e.model);await M(e,n,i);let a=await N(e,n,i)||me(t.messages);return await P(e,t,a,r,i?await A(e,a):void 0)}async function A(e,n){try{return j(await(e.pickIcon??(await t(async()=>{let{pickLucideIcon:e}=await import(`./quick-llm-DciVCRXg.js`).then(e=>e.n);return{pickLucideIcon:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]))).pickLucideIcon)({subject:`"${n}" — an archived chat session`})??void 0)}catch(e){T.warn(`Icon pick failed (freeze still proceeds)`,{error:e instanceof Error?e.message:String(e)});return}}function j(e){if(e)return l(e)?e:void 0}async function M(e,t,n){if(!n){T.info(`LLM unavailable — skipping memory extraction; freezing anyway`);return}let r=``;try{r=await a({messages:t,instruction:o,model:e.model,apiKey:e.apiKey,maxTokens:E,headers:e.headers})}catch(e){T.warn(`Memory extraction call failed (freeze still proceeds)`,{error:e instanceof Error?e.message:String(e)});return}if(!r.trim()||r.trim()===`NONE`){T.info(`Memory extraction returned no durable memories`);return}try{await Y(e.vfs,r.trim(),`new-session`,{model:e.model,apiKey:e.apiKey,headers:e.headers}),T.info(`Memory extracted and appended on new-session`)}catch(e){T.warn(`Memory append failed`,{error:e instanceof Error?e.message:String(e)})}}async function N(e,t,n){if(!n)return``;try{return K(await a({messages:t,instruction:i,model:e.model,apiKey:e.apiKey,maxTokens:D,headers:e.headers}))}catch(e){return T.warn(`Title generation call failed (using heuristic)`,{error:e instanceof Error?e.message:String(e)}),``}}async function P(e,t,n,r,i){let a=new Date().toISOString(),o=crypto.randomUUID(),s=r===`quick`?`pending-${he()}.md`:`${a.replace(/[:.]/g,`-`)}-${q(n)}.md`,c=F(t.messages),l={filename:s,sessionId:o,title:n,frozenAt:a,messageCount:t.messages.length,...c??{},...i?{icon:i}:{},...r===`quick`?{pendingEnrichment:!0}:{}};try{await J(e.vfs,v);let r=await R(e.vfs,t.messages,s.replace(/\.md$/,``)),i={id:t.id,title:n,frozenAt:a,createdAt:t.createdAt,updatedAt:t.updatedAt,messageCount:t.messages.length,messages:r,...c??{}},o=pe(i);return await e.vfs.writeFile(`${v}/${s}`,o),await ge(e.vfs,l),await e.vfs.flush(),T.info(`Cone session frozen`,{filename:s,title:n,messageCount:t.messages.length}),{...l,archive:i}}catch(e){return T.warn(`Failed to write frozen session to VFS`,{error:e instanceof Error?e.message:String(e)}),null}}function F(e){let t={total:0,input:0,output:0,cacheRead:0,cacheWrite:0},n=new Map,r=!1;for(let i of e){if(i.role!==`assistant`)continue;let{model:e,usage:a}=i;if(!e||!a||!L(a))return null;let o=a.cost;r=!0,t.total+=o.total,t.input+=o.input,t.output+=o.output,t.cacheRead+=o.cacheRead,t.cacheWrite+=o.cacheWrite;let s=n.get(e)??{model:e,cost:0,turns:0,tokens:0};s.cost+=o.total,s.turns+=1,s.tokens+=a.input+a.output+a.cacheRead+a.cacheWrite,n.set(e,s)}return r?{cost:t,models:[...n.values()].sort((e,t)=>t.cost-e.cost)}:null}function I(e){return typeof e==`number`&&Number.isFinite(e)}function L(e){let{cost:t}=e;return[e.input,e.output,e.cacheRead,e.cacheWrite].every(I)&&[t.input,t.output,t.cacheRead,t.cacheWrite,t.total].every(I)}async function R(e,t,n){let r={vfs:e,archiveDir:`${O}/${n}`,copiedPaths:new Map,fileIndex:0},i=[];for(let e of t){if(!e.attachments?.some(V)){i.push(e);continue}let t=[];for(let n of e.attachments)t.push(await z(r,n));i.push({...e,attachments:t})}return i}async function z(e,t){if(!V(t))return t;let n=e.copiedPaths.get(t.path);if(n)return{...t,path:n};let r=await B(e.vfs,t.path);if(!r)return U(t);let i=t.name.replace(/[^A-Za-z0-9._-]+/g,`_`)||`attachment`,a=`${e.archiveDir}/${e.fileIndex++}-${i}`;return await J(e.vfs,e.archiveDir),await e.vfs.writeFile(a,r),e.copiedPaths.set(t.path,a),{...t,path:a}}async function B(e,t){try{if(!await H(e,t))return null;let n=await e.readFile(t,{encoding:`binary`});if(!(n instanceof Uint8Array))throw Error(`Expected binary attachment content at ${t}`);return n}catch{return null}}function V(e){return typeof e.path==`string`&&e.path.startsWith(`/tmp/`)&&e.data===void 0&&e.text===void 0}async function H(e,t){let n=t.split(`/`).slice(1);if(n.length<2||n[0]!==`tmp`||n.some(e=>!e||e===`.`||e===`..`))return!1;let r=`/`;for(let t=0;t<n.length;t+=1){let i=(await e.readDir(r)).find(e=>e.name===n[t]);if(!i)return!1;if(t===n.length-1)return i.type===`file`;if(i.type!==`directory`)return!1;r=r===`/`?`/${n[t]}`:`${r}/${n[t]}`}return!1}function U(e){let{path:t,...n}=e;return{...n,error:e.error??`Archived attachment file is missing or unsafe to preserve.`}}async function W(e){try{return await e.load(`session-cone`)}catch(e){return T.warn(`Failed to load session-cone`,{error:e instanceof Error?e.message:String(e)}),null}}function G(e){return e.map(e=>({role:e.role,content:[{type:`text`,text:e.content}],timestamp:e.timestamp}))}var ue=`<!-- slicc:session-data
|
|
18
|
-
`,de=`
|
|
19
|
-
-->`;function fe(e){return e.map(e=>{let t={id:e.id,role:e.role,content:e.content,timestamp:e.timestamp};return e.attachments?.length&&(t.attachments=e.attachments),e.toolCalls?.length&&(t.toolCalls=e.toolCalls.map(e=>({id:e.id,name:e.name,input:e.input,...e.result===void 0?{}:{result:e.result},...e.isError?{isError:e.isError}:{}}))),e.source&&(t.source=e.source),e.channel&&(t.channel=e.channel),t})}function pe(e){let t=(e.cost?`cost: ${JSON.stringify(e.cost)}\n`:``)+(e.models?`models: ${JSON.stringify(e.models)}\n`:``),n=`---\nid: ${e.id}\ntitle: ${JSON.stringify(e.title)}\nfrozenAt: ${e.frozenAt}\ncreatedAt: ${e.createdAt}\nupdatedAt: ${e.updatedAt}\nmessageCount: ${e.messageCount}\n`+t+`---
|
|
20
|
-
|
|
21
|
-
`,r=`${ue}${JSON.stringify(fe(e.messages)).replace(/-->/g,`-- >`)}${de}\n\n`,i=`# ${e.title}\n\n`;return n+r+i+w(e.messages)}function K(e){let t=e.trim();return t=t.replace(/^["'`]+|["'`]+$/g,``).trim(),t=t.replace(/\s+/g,` `),t.length>80&&(t=t.slice(0,80).trimEnd()),t}function me(e){let t=e.find(e=>e.role===`user`);if(!t?.content)return`untitled-session`;let n=t.content.trim().replace(/\s+/g,` `);return n.length>60?`${n.slice(0,60)}…`:n||`untitled-session`}function q(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)||`session`}function he(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`}async function J(e,t){try{await e.mkdir(t,{recursive:!0})}catch{}}async function Y(e,t,n,r){let i=`/workspace/CLAUDE.md`,a=``;try{let t=await e.readFile(i,{encoding:`utf-8`});a=typeof t==`string`?t:new TextDecoder().decode(t)}catch(t){if(!(t instanceof c)||t.code!==`ENOENT`)throw t;await J(e,`/workspace`)}let o=`## Auto-extracted (${new Date().toISOString().slice(0,10)}, ${n})`,s=`${a.length===0||a.endsWith(`
|
|
22
|
-
`)?``:`
|
|
23
|
-
`}\n${o}\n\n${t}\n`;await e.writeFile(i,a+s);try{await _({vfs:e,model:r?.model,apiKey:r?.apiKey,headers:r?.headers,signal:r?.signal})}catch(e){T.warn(`Cone memory budget step threw (append already committed)`,{error:e instanceof Error?e.message:String(e)})}}async function ge(e,t){let n=[];try{let t=await e.readFile(y,{encoding:`utf-8`}),r=typeof t==`string`?t:new TextDecoder().decode(t),i=JSON.parse(r);Array.isArray(i)&&(n=i)}catch{}let r=[t,...n.filter(e=>e.filename!==t.filename)];await e.writeFile(y,JSON.stringify(r,null,2))}async function X(e,t,n){if(!t.pendingEnrichment)return null;let r=await ve(e,t);if(r===null)return null;let i=Z(t,r);if(i===null)return null;let a=await ye(t,i,n);if(a===null)return null;let o=await _e(n,a.newTitle);return await be(e,t,a.bullets,n),await xe(e,t,r,a.newTitle,o)}async function _e(e,t){if(e.pickIcon)try{return await j(await e.pickIcon({subject:`"${t}" — an archived chat session`})??void 0)}catch(e){T.warn(`Enrichment icon pick failed (continuing without icon)`,{error:e instanceof Error?e.message:String(e)});return}}async function ve(e,t){try{let n=await e.readFile(x(t),{encoding:`utf-8`});return typeof n==`string`?n:new TextDecoder().decode(n)}catch(e){return e?.code===`ENOENT`?T.info(`Pending archive missing — treating as already enriched`,{filename:t.filename}):T.warn(`Failed to read pending archive (entry stays pending)`,{filename:t.filename,error:e instanceof Error?e.message:String(e)}),null}}function Z(e,t){let n;try{n=S(t).messages}catch(t){return T.warn(`Failed to parse pending archive — leaving entry intact`,{filename:e.filename,error:t instanceof Error?t.message:String(t)}),null}return n.length===0?(T.info(`Pending archive has no messages — skipping enrichment`,{filename:e.filename}),null):G(n)}async function ye(e,t,n){let r=``;try{r=await a({messages:t,instruction:o,model:n.model,apiKey:n.apiKey,maxTokens:E,headers:n.headers})}catch(t){return T.warn(`Enrichment memory call failed (entry stays pending)`,{filename:e.filename,error:t instanceof Error?t.message:String(t)}),null}let s=``;try{s=K(await a({messages:t,instruction:i,model:n.model,apiKey:n.apiKey,maxTokens:D,headers:n.headers}))}catch(t){return T.warn(`Enrichment title call failed (entry stays pending)`,{filename:e.filename,error:t instanceof Error?t.message:String(t)}),null}return s?{bullets:r,newTitle:s}:(T.info(`Enrichment title call returned empty — entry stays pending`,{filename:e.filename}),null)}async function be(e,t,n,r){let i=n.trim();if(!(!i||i===`NONE`))try{await Y(e,i,`pending-enrichment`,{model:r.model,apiKey:r.apiKey,headers:r.headers})}catch(e){T.warn(`Enrichment memory append failed (continuing with title rewrite)`,{filename:t.filename,error:e instanceof Error?e.message:String(e)})}}async function xe(e,t,n,r,i){let a=x(t),o=Se(n,r),s=`${t.frozenAt.replace(/[:.]/g,`-`)}-${q(r)}.md`,c=`${v}/${s}`;try{await J(e,v),await e.writeFile(c,o)}catch(e){return T.warn(`Enrichment write failed (entry stays pending)`,{filename:t.filename,error:e instanceof Error?e.message:String(e)}),null}let l=i??t.icon,u={filename:s,title:r,frozenAt:t.frozenAt,messageCount:t.messageCount,...t.cost?{cost:t.cost}:{},...t.models?{models:t.models}:{},...t.sessionId?{sessionId:t.sessionId}:{},...l?{icon:l}:{}};try{await Ce(e,t.filename,u)}catch(e){return T.warn(`Enrichment index update failed (entry may stay pending)`,{filename:t.filename,error:e instanceof Error?e.message:String(e)}),null}if(c!==a)try{await e.rm(a)}catch(e){T.info(`Stale pending archive cleanup failed (harmless)`,{oldPath:a,error:e instanceof Error?e.message:String(e)})}try{await e.flush()}catch{}return T.info(`Pending session enriched`,{oldFilename:t.filename,newFilename:s,title:r}),u}function Se(e,t){let n=e.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!n)return e;let r=n[1].replace(/^title:\s*.+$/m,`title: ${JSON.stringify(t)}`),i=n[2];return i=i.replace(/^#\s+[^\n]*$/m,`# ${t}`),`---\n${r}\n---\n${i}`}var Q=Promise.resolve();async function Ce(e,t,n){let r=async()=>{let r=[];try{let t=await e.readFile(y,{encoding:`utf-8`}),n=typeof t==`string`?t:new TextDecoder().decode(t),i=JSON.parse(n);Array.isArray(i)&&(r=i)}catch{}let i=r.findIndex(e=>e.filename===t),a;i===-1?a=[n,...r.filter(e=>e.filename!==n.filename)]:(a=r.slice(),a[i]=n,a=a.filter((e,t)=>t===i||e.filename!==n.filename)),await e.writeFile(y,JSON.stringify(a,null,2))},i=Q.then(r,r);return Q=i.then(()=>void 0,()=>void 0),i}async function $(e,t){let n=async()=>{let n=[];try{let t=await e.readFile(y,{encoding:`utf-8`}),r=typeof t==`string`?t:new TextDecoder().decode(t),i=JSON.parse(r);Array.isArray(i)&&(n=i)}catch{return}if(!n.find(e=>e.filename===t))return;let r=n.map(e=>e.filename===t?{...e,completeSnapshotUnavailable:!0}:e);await e.writeFile(y,JSON.stringify(r,null,2))},r=Q.then(n,n);return Q=r.then(()=>void 0,()=>void 0),r}export{w as a,S as c,ce as i,b as l,k as n,y as o,$ as r,x as s,X as t};
|