sliccy 6.154.2 → 6.154.4
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/README.md +1 -0
- package/dist/ui/.vite/manifest.json +175 -175
- package/dist/ui/assets/SKILL-BGww2dFz.js +1 -0
- package/dist/ui/assets/SKILL-BkCuZ1rT.js +1 -0
- package/dist/ui/assets/{SKILL-Dh6a4Qu2.js → SKILL-C9-SR5fY.js} +1 -1
- package/dist/ui/assets/SKILL-CLF3MdfR.js +1 -0
- package/dist/ui/assets/SKILL-DirmNXBw.js +1 -0
- package/dist/ui/assets/SKILL-UenQ5SPT.js +1 -0
- package/dist/ui/assets/{account-store-BZdeVW0x.js → account-store-Bxl3Ct33.js} +1 -1
- package/dist/ui/assets/account-store-PyDP25J-.js +1 -0
- package/dist/ui/assets/{adobe-BKDJ9PXB.js → adobe-CAfItDR6.js} +1 -1
- package/dist/ui/assets/{adobe-Do7ppUu_.js → adobe-CRHm3ZiT.js} +1 -1
- package/dist/ui/assets/{agent-bridge-DKIVd0zM.js → agent-bridge-BkZinL2A.js} +1 -1
- package/dist/ui/assets/{agent-panels-CERHjYbV.js → agent-panels-BareeCk8.js} +1 -1
- package/dist/ui/assets/api-endpoint-3qEcn7BY.js +1 -0
- package/dist/ui/assets/{apply-layout-cMZU1oiO.js → apply-layout-BKbutwOv.js} +1 -1
- package/dist/ui/assets/{apps-DBeGXxMQ.js → apps-DF-Rc0DX.js} +1 -1
- package/dist/ui/assets/{auto-mount-table-0jMTi9rV.js → auto-mount-table-BDyGIOIb.js} +1 -1
- package/dist/ui/assets/{azure-openai-B7F3oYWt.js → azure-openai-CzQsYMy3.js} +1 -1
- package/dist/ui/assets/{azure-openai-CYw20Rb5.js → azure-openai-DIRfsEOC.js} +1 -1
- package/dist/ui/assets/{backend-hostfs-BxfjZHzO.js → backend-hostfs-BJU2QL9q.js} +1 -1
- package/dist/ui/assets/{browser-q8slJ96R.js → browser-BxGToOGy.js} +1 -1
- package/dist/ui/assets/{budget-usage-source-nJeiDJgA.js → budget-usage-source-GIPLIi69.js} +1 -1
- package/dist/ui/assets/build-BRNa03GH.js +3 -0
- package/dist/ui/assets/{cdp-C0EXef8t.js → cdp-oh0DuXMv.js} +1 -1
- package/dist/ui/assets/{cerebras-DmWJf3th.js → cerebras-CkeSnL0b.js} +1 -1
- package/dist/ui/assets/{cerebras-B2Urbvva.js → cerebras-D5U7_320.js} +1 -1
- package/dist/ui/assets/{client-BOSdqiLb.js → client-B6iKb_ye.js} +1 -1
- package/dist/ui/assets/{composer-speech-BNHWaL3y.js → composer-speech-BolqSVFZ.js} +1 -1
- package/dist/ui/assets/{connect-surface-ig8ePsTv.js → connect-surface-BCxPzS-D.js} +1 -1
- package/dist/ui/assets/core-DP-MJcag.js +36 -0
- package/dist/ui/assets/{cost-command-B5aRQX4l.js → cost-command-BzdZ_evm.js} +1 -1
- package/dist/ui/assets/{directed-approval-B-TQlMYu.js → directed-approval-CDx8wAWY.js} +1 -1
- package/dist/ui/assets/edit-BnFODSzt.js +16 -0
- package/dist/ui/assets/{ensure-speech-assets-uGHvkmNC.js → ensure-speech-assets-DOu9EHnU.js} +1 -1
- package/dist/ui/assets/{extension-ops-B9_1VB7W.js → extension-ops-B05mAXsq.js} +1 -1
- package/dist/ui/assets/{fs-CY5pwJnY.js → fs-C6NHHf6r.js} +1 -1
- package/dist/ui/assets/{fs-D5MhOzXY.js → fs-Y1yRx901.js} +2 -2
- package/dist/ui/assets/{github-C0Ge88be.js → github-CtPwAeAW.js} +1 -1
- package/dist/ui/assets/github-auth-Dg16dadU.js +1 -0
- package/dist/ui/assets/{github-copilot-socdhqrE.js → github-copilot-0h7DYsw7.js} +1 -1
- package/dist/ui/assets/{github-copilot-CZaiYWHF.js → github-copilot-D0Qj8vbq.js} +1 -1
- package/dist/ui/assets/github-install-Cljpa_4o.js +1 -0
- package/dist/ui/assets/{github-B-Bd_nZ-.js → github-pYZHpBjH.js} +2 -2
- package/dist/ui/assets/github-zip-DUzMK_AA.js +1 -0
- package/dist/ui/assets/{guest-tool-gate-6uzbOlEb.js → guest-tool-gate-Mu-876Hm.js} +1 -1
- package/dist/ui/assets/{hear-Ghdnf7n1.js → hear-BF4j70ha.js} +1 -1
- package/dist/ui/assets/{help-hIoQhrvq.js → help-BJWRLfrH.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-DWUez8Bj.js → js-realm-worker-Ci2I4buf.js} +1 -1
- package/dist/ui/assets/{kernel-worker-DOOSpFVG.js → kernel-worker-BI_Lfm6N.js} +653 -651
- package/dist/ui/assets/{libesm-CSMdpGMF.js → libesm-CTQYxJIv.js} +4 -4
- package/dist/ui/assets/{lick-urls-HYeTtmbf.js → lick-urls-BZVq_P3x.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-DqmithfF.js → lick-ws-bridge-CDToX4F0.js} +1 -1
- package/dist/ui/assets/{local-llm-Bi5_jnDv.js → local-llm-DXfftbTE.js} +1 -1
- package/dist/ui/assets/{local-llm-DUeCZi0o.js → local-llm-l6IgHINx.js} +1 -1
- package/dist/ui/assets/{main-BBsnqT-n.js → main-BPi4KXFy.js} +3 -3
- package/dist/ui/assets/{main-cherry-Dx-6EGAA.js → main-cherry-CGGKAYM7.js} +1 -1
- package/dist/ui/assets/{memory-curation-seam-6Ye5fb1z.js → memory-curation-seam-C6YpeprH.js} +1 -1
- package/dist/ui/assets/{mount-BJWo4gr-.js → mount-DEEkB1_d.js} +3 -3
- package/dist/ui/assets/{mount-Dq_fD8nk.js → mount-UVvRQA3s.js} +1 -1
- package/dist/ui/assets/{mount-bridge-client-B5qLR9Xe.js → mount-bridge-client-DWY67yip.js} +1 -1
- package/dist/ui/assets/{mount-recovery-2IXcFTPg.js → mount-recovery-RB-9nQ6b.js} +1 -1
- package/dist/ui/assets/{new-session-yJbhj5MZ.js → new-session-DP6AUKWc.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-B1nxEXuw.js → oauth-bootstrap-CMO_7U6r.js} +2 -2
- package/dist/ui/assets/{oauth-service-BZl-9EoE.js → oauth-service-IlBYPvwr.js} +1 -1
- package/dist/ui/assets/{onboarding-orchestrator-Bzd3eyDB.js → onboarding-orchestrator-D9WExyXS.js} +1 -1
- package/dist/ui/assets/{openai-codex-Blu70lOC.js → openai-codex-BoHYzVYq.js} +1 -1
- package/dist/ui/assets/{openai-codex-CRux_5Io.js → openai-codex-BsTURzbU.js} +1 -1
- package/dist/ui/assets/{openrouter-D5FrXcZn.js → openrouter-BHZ95a-Q.js} +1 -1
- package/dist/ui/assets/{openrouter-BwyOovNP.js → openrouter-CcWbg68Z.js} +1 -1
- package/dist/ui/assets/{openrouter-free-C6PmJYd9.js → openrouter-free-DBe8IEpx.js} +1 -1
- package/dist/ui/assets/{openrouter-free-73roMQJB.js → openrouter-free-DYD76E8s.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-D6eTjtsZ.js → openrouter-oauth-Bhoj7wax.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-DWlKSVgT.js → openrouter-oauth-C6B8EJ_v.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-3YsyA58r.js → panel-rpc-handlers-DuHAIvU2.js} +2 -2
- package/dist/ui/assets/{panelize-shell-DE_uUThR.js → panelize-shell-C6YSK_sm.js} +1 -1
- package/dist/ui/assets/pi-edit-execution-B_MndPan.js +2 -0
- package/dist/ui/assets/{port-bridge-client-CzOd_VUf.js → port-bridge-client-Ds3xwapn.js} +1 -1
- package/dist/ui/assets/provenance-DdmsQ3Nr.js +1 -0
- package/dist/ui/assets/{provider-PKpn_LmL.js → provider-BYvMHe3u.js} +1 -1
- package/dist/ui/assets/{provider-kiXfL_mq.js → provider-KHicY8aQ.js} +2 -2
- package/dist/ui/assets/provider-settings-B_INKQmY.js +1 -0
- package/dist/ui/assets/provider-store-access-CpS-ZdIQ.js +1 -0
- package/dist/ui/assets/provider-store-access-Dcfs6S0T.js +1 -0
- package/dist/ui/assets/{providers-B7K9U_fm.js → providers-CA98NVBe.js} +2 -2
- package/dist/ui/assets/{providers-e1sU7s6k.js → providers-D2HM3Gid.js} +1 -1
- package/dist/ui/assets/proxied-fetch-DEK8DT-z.js +1 -0
- package/dist/ui/assets/{quick-llm-fE1NE1pP.js → quick-llm-B0DrZFep.js} +1 -1
- package/dist/ui/assets/{recovery-screen-yZ7MZWap.js → recovery-screen-D2XqB9Ro.js} +1 -1
- package/dist/ui/assets/{redirect-uri-C6BjkDE0.js → redirect-uri-CgKdq7-K.js} +1 -1
- package/dist/ui/assets/{remote-terminal-view-DJrkDTkY.js → remote-terminal-view-BXjdqm7-.js} +1 -1
- package/dist/ui/assets/rest-ops-Bps3Ay-k.js +1 -0
- package/dist/ui/assets/{run-BzyFrWme.js → run-CgQOlMuy.js} +1 -1
- package/dist/ui/assets/{run-Ce3yzmAj.js → run-DS8rwgYd.js} +1 -1
- package/dist/ui/assets/{run-WYZqOFOH.js → run-QKhssIaN.js} +3 -3
- package/dist/ui/assets/{run-C33VP7kC.js → run-XqJwbPb4.js} +1 -1
- package/dist/ui/assets/{run-CJHbh10K.js → run-uRBs2iqf.js} +1 -1
- package/dist/ui/assets/{secrets-bridge-client-DBeju3mP.js → secrets-bridge-client-ZpBL1Zhl.js} +1 -1
- package/dist/ui/assets/{session-jsonl-1Tumjx5q.js → session-jsonl-Dd3hp32C.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-Bjk9XIgB.js → setup-feature-flags-remote-C16m2kl3.js} +1 -1
- package/dist/ui/assets/sidecar-repair-Cnj7auqc.js +1 -0
- package/dist/ui/assets/{silent-renew-backoff-Djz3wKFS.js → silent-renew-backoff-CR1MteNj.js} +1 -1
- package/dist/ui/assets/{skills-CyxZ_qdB.js → skills-BV3xJ5gw.js} +1 -1
- package/dist/ui/assets/slicc-version-BTtIW1Bi.js +1 -0
- package/dist/ui/assets/{snapshot-3Qf38DNo.js → snapshot-BX3eDGyH.js} +1 -1
- package/dist/ui/assets/{snapshot-features-BPOMdL3k.js → snapshot-features-DIRCfL-7.js} +1 -1
- package/dist/ui/assets/{soundscape-B2mWrlHy.js → soundscape-xBpF7_kD.js} +1 -1
- package/dist/ui/assets/{speak-CDJ0RzHm.js → speak-DWOSewc6.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-CpaUQQdp.js → sprinkle-manager-BXdHl8Cy.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-xqSZhBNo.js → sprinkle-renderer-BV1Wttcv.js} +3 -3
- package/dist/ui/assets/{state-C-GUxpCw.js → state-CR5ZXLCN.js} +1 -1
- package/dist/ui/assets/{store-BpCQUWkE.js → store-BCiPgely.js} +1 -1
- package/dist/ui/assets/{store-DNbNsvQ5.js → store-DmFH0I9X.js} +1 -1
- package/dist/ui/assets/{style-guide-DKvWxDlM.js → style-guide-BvFX24DM.js} +1 -1
- package/dist/ui/assets/{sudo-HwABgE4V.js → sudo-B-EkcpfB.js} +1 -1
- package/dist/ui/assets/{sync-dialog-BjaW5TBb.js → sync-dialog-B2cdLL8q.js} +1 -1
- package/dist/ui/assets/{transformers-env-Xlg2tROb.js → transformers-env-IYiDhpM2.js} +1 -1
- package/dist/ui/assets/{tray-runtime-config--rtR6Gxd.js → tray-runtime-config-CRZxBChd.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-KbAtqLcw.js → tray-sidecar-8jNn5UUK.js} +1 -1
- package/dist/ui/assets/types-Dzr0qYl3.js +1 -0
- package/dist/ui/assets/{upgrade-detection-BWteE-0x.js → upgrade-detection-qgLGc4Q4.js} +1 -1
- package/dist/ui/assets/upskill-lick-skip-BHVUbSqb.js +1 -0
- package/dist/ui/assets/usb-claim-broker-C5dFP5bv.js +1 -0
- package/dist/ui/assets/usb-claim-broker-Dacw2Z3M.js +1 -0
- package/dist/ui/assets/usb-operations-v1mGAdRY.js +2 -0
- package/dist/ui/assets/{voice-reply-Bju5XMHK.js → voice-reply-QW571MYf.js} +1 -1
- package/dist/ui/assets/{wc-attach-Z0pwdH9M.js → wc-attach-CIK6FFd5.js} +2 -2
- package/dist/ui/assets/{wc-extension-_Hj1HhGf.js → wc-extension-1xyakZ_p.js} +2 -2
- package/dist/ui/assets/{wc-follower-DVUdb9Um.js → wc-follower-DCyVgxBD.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-BPx1gTgG.js → wc-follower-oauth-CzgF8pm8.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-C0ySyH9N.js → wc-gelatiere-1ERELEHg.js} +1 -1
- package/dist/ui/assets/{wc-live-DDos6Dzx.js → wc-live-jK4-HvEA.js} +5 -5
- package/dist/ui/assets/{wc-nav-B2eDg6pO.js → wc-nav-BPqbmhpu.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-DboQnPWI.js → wc-onboarding-4JLPcMO_.js} +2 -2
- package/dist/ui/assets/{wc-permissions-BEmYiApA.js → wc-permissions-brfCnfZb.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-BjUEI-Mu.js → wc-placeholder-BeeuY5K4.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-DceB-GYM.js → wc-secret-request-DzT3vuN3.js} +1 -1
- package/dist/ui/assets/{wc-settings-DSED486Z.js → wc-settings-BlIoHCrC.js} +3 -3
- package/dist/ui/assets/{wc-shell-Dukh8kBp.js → wc-shell-D5UkYz9w.js} +12 -12
- package/dist/ui/assets/{wc-shortcut-config-BVLmA_4e.js → wc-shortcut-config-CycKWNUl.js} +1 -1
- package/dist/ui/assets/{wc-shortcuts-DRoF52xJ.js → wc-shortcuts-8_tK1cDi.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-D-gTuKDK.js → wc-sprinkles-BN1_kRTR.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-NX12cq80.js → wc-transcript-export-DI6b8U4f.js} +2 -2
- package/dist/ui/assets/{wc-tray-CiypFS7u.js → wc-tray-DrDQFzF7.js} +4 -4
- package/dist/ui/assets/welcome-detection-BYGa_S8I.js +1 -0
- package/dist/ui/assets/{whisper-session-B2k89xAM.js → whisper-session-Cbuk405M.js} +2 -2
- package/dist/ui/assets/write-verification-BOaZdtyk.js +1 -0
- package/dist/ui/assets/{xai-grok-cDPFunWd.js → xai-grok-B5EMU1zd.js} +1 -1
- package/dist/ui/assets/{xai-grok-DMR1ZtnC.js → xai-grok-dl1o1zgd.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/packages/webapp/index.html +3 -3
- package/package.json +1 -1
- package/dist/ui/assets/SKILL--NWTI0kb.js +0 -1
- package/dist/ui/assets/SKILL-BPuaCaUr.js +0 -1
- package/dist/ui/assets/SKILL-CuHGVKei.js +0 -1
- package/dist/ui/assets/SKILL-S80DGuUz.js +0 -1
- package/dist/ui/assets/SKILL-cqUV8C7U.js +0 -1
- package/dist/ui/assets/account-store-BSWxmlJm.js +0 -1
- package/dist/ui/assets/api-endpoint-Lx_FU5cP.js +0 -1
- package/dist/ui/assets/core-D59qaXEb.js +0 -38
- package/dist/ui/assets/github-install-DuwYDOce.js +0 -1
- package/dist/ui/assets/github-zip-CatJM_Hn.js +0 -1
- package/dist/ui/assets/provider-settings-DQML2w6d.js +0 -1
- package/dist/ui/assets/provider-store-access-BEmFKV-n.js +0 -1
- package/dist/ui/assets/provider-store-access-Cce46clP.js +0 -1
- package/dist/ui/assets/proxied-fetch-B57RqgUb.js +0 -1
- package/dist/ui/assets/rest-ops-CB2up_K0.js +0 -1
- package/dist/ui/assets/sidecar-repair-D9Vw_sYj.js +0 -1
- package/dist/ui/assets/slicc-version-Be90TKG2.js +0 -1
- package/dist/ui/assets/usb-claim-broker-CnZXiC75.js +0 -1
- package/dist/ui/assets/usb-claim-broker-Do2ZUpNv.js +0 -1
- package/dist/ui/assets/usb-operations-B1y8RuQp.js +0 -2
- package/dist/ui/assets/welcome-detection-DS0NGHuw.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,o as t}from"./account-store-
|
|
1
|
+
import{c as e,o as t}from"./account-store-PyDP25J-.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{t as r}from"./models-4WTk3EBD.js";import{a as i}from"./compat-uEPf6-XW.js";import{r as a,t as o}from"./transform-messages-Jn8bw4-u.js";function s(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function c(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}let l=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return l=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))};function u(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}const d=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var f=class extends Error{},p=class e extends f{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new h({message:r,cause:d(n)});let a=n?.error;return t===400?new _(t,a,r,i):t===401?new v(t,a,r,i):t===403?new y(t,a,r,i):t===404?new b(t,a,r,i):t===409?new x(t,a,r,i):t===422?new ee(t,a,r,i):t===429?new te(t,a,r,i):t>=500?new ne(t,a,r,i):new e(t,a,r,i)}},m=class extends p{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},h=class extends p{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},g=class extends h{constructor({message:e}={}){super({message:e??`Request timed out.`})}},_=class extends p{},v=class extends p{},y=class extends p{},b=class extends p{},x=class extends p{},ee=class extends p{},te=class extends p{},ne=class extends p{},re=class extends f{constructor(){super(`Could not parse response content as the length limit was reached`)}},ie=class extends f{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},ae=class extends Error{constructor(e){super(e)}},oe=class extends p{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},se=class extends f{constructor(e,t,n){super(e),this.provider=t,this.cause=n}};const ce=/^[a-z][a-z0-9+.-]*:/i,le=e=>ce.test(e);let S=e=>(S=Array.isArray,S(e)),ue=S;function de(e){return typeof e==`object`?e??{}:{}}function fe(e){if(!e)return!0;for(let t in e)return!1;return!0}function pe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const me=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new f(`${e} must be an integer`);if(t<0)throw new f(`${e} must be a positive integer`);return t},he=e=>{try{return JSON.parse(e)}catch{return}},ge=e=>new Promise(t=>setTimeout(t,e));function _e(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function ve(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function ye(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return ve({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function be(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function xe(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}let Se;function w(e){let t;return(Se??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}let Ce;function we(e){let t;return(Ce??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var Te,T,E,D,O,Ee,De;const Oe=65536;var ke=class{constructor(){Te.add(this),T.set(this,void 0),E.set(this,void 0),D.set(this,void 0),O.set(this,void 0),Ee.set(this,void 0),s(this,T,new Uint8Array,`f`),s(this,E,0,`f`),s(this,D,0,`f`),s(this,O,0,`f`),s(this,Ee,!1,`f`)}decode(e){if(e==null)return[];let t;if(t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?w(e):e,t.length===0||c(this,Ee,`f`)&&(s(this,Ee,!1,`f`),t[0]===10&&(t=t.subarray(1)),t.length===0))return[];c(this,Te,`m`,De).call(this,t);let n=[],r;for(;(r=Ae(c(this,T,`f`),c(this,O,`f`),c(this,D,`f`)))!=null;){let e=we(c(this,T,`f`).subarray(c(this,E,`f`),r.preceding));n.push(e),s(this,E,r.index,`f`),r.carriage&&(c(this,E,`f`)<c(this,D,`f`)&&c(this,T,`f`)[c(this,E,`f`)]===10?s(this,E,c(this,E,`f`)+1,`f`):c(this,E,`f`)===c(this,D,`f`)&&s(this,Ee,!0,`f`)),s(this,O,c(this,E,`f`),`f`)}if(s(this,O,c(this,D,`f`),`f`),c(this,E,`f`)===c(this,D,`f`))s(this,E,0,`f`),s(this,D,0,`f`),s(this,O,0,`f`),c(this,T,`f`).length>Oe&&s(this,T,new Uint8Array,`f`);else if(n.length>0&&c(this,T,`f`).length>Oe){let e=c(this,D,`f`)-c(this,E,`f`);if(e<=Oe||c(this,T,`f`).length>e*4){let t=e<=Oe?Math.min(Math.max(e*2,256),Oe):e*2,n=new Uint8Array(t);n.set(c(this,T,`f`).subarray(c(this,E,`f`),c(this,D,`f`))),s(this,T,n,`f`),s(this,E,0,`f`),s(this,D,e,`f`),s(this,O,e,`f`)}}return n}flush(){return s(this,Ee,!1,`f`),c(this,E,`f`)===c(this,D,`f`)?[]:this.decode(`
|
|
2
2
|
`)}};T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakMap,Ee=new WeakMap,Te=new WeakSet,De=function(e){if(c(this,D,`f`)+e.length>c(this,T,`f`).length){let t=c(this,D,`f`)-c(this,E,`f`);if(c(this,E,`f`)>=c(this,T,`f`).length/2&&t+e.length<=c(this,T,`f`).length)c(this,T,`f`).copyWithin(0,c(this,E,`f`),c(this,D,`f`));else{let n=Math.max(c(this,T,`f`).length*2,t+e.length,256),r=new Uint8Array(n);r.set(c(this,T,`f`).subarray(c(this,E,`f`),c(this,D,`f`))),s(this,T,r,`f`)}s(this,O,c(this,O,`f`)-c(this,E,`f`),`f`),s(this,D,t,`f`),s(this,E,0,`f`)}c(this,T,`f`).set(e,c(this,D,`f`)),s(this,D,c(this,D,`f`)+e.length,`f`)},ke.NEWLINE_CHARS=new Set([`
|
|
3
3
|
`,`\r`]),ke.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ae(e,t,n){for(let r=t;r<n;r++){if(e[r]===10)return{preceding:r,index:r+1,carriage:!1};if(e[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}function je(e){for(let t=0;t<e.length-1;t++){let n=Me(e,t);if(n>0){let r=t+n,i=Me(e,r);if(i>0)return r+i}}return-1}function Me(e,t){return e[t]===10?1:e[t]===13?e[t+1]===10?2:1:0}const Ne={off:0,error:200,warn:300,info:400,debug:500},Pe=(e,t,n)=>{if(e){if(pe(Ne,e))return e;k(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Ne))}`)}};function Fe(){}function Ie(e,t,n){return!t||Ne[e]>Ne[n]?Fe:t[e].bind(t)}const Le={error:Fe,warn:Fe,info:Fe,debug:Fe};let Re=new WeakMap;function k(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Le;let r=Re.get(t);if(r&&r[0]===n)return r[1];let i={error:Ie(`error`,t,n),warn:Ie(`warn`,t,n),info:Ie(`info`,t,n),debug:Ie(`debug`,t,n)};return Re.set(t,[n,i]),i}const ze=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`x-amz-security-token`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);var Be,Ve=class e{constructor(e,t,n){Be.set(this,void 0),this.iterator=e,this.controller=t,s(this,Be,n,`f`)}static fromSSEResponse(t,n,r,i){let a=!1,o=r?k(r):console;async function*s(){if(a)throw new f("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1,r=!1;try{for await(let e of He(t,n)){if(e.data.startsWith(`[DONE]`)){r=!0;break}if(e.event===null||!e.event.startsWith(`thread.`)){let n;try{n=JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(n&&n.error)throw new p(void 0,n.error,void 0,t.headers);yield i?{event:e.event,data:n}:n}else{let t;try{t=JSON.parse(e.data)}catch(t){throw console.error(`Could not parse message into JSON:`,e.data),console.error(`From chunk:`,e.raw),t}if(e.event===`error`)throw new p(void 0,t.error,t.message,void 0);yield{event:e.event,data:t}}}e=!0}catch(e){if(r||u(e)||n.signal.aborted&&e===n.signal.reason)return;throw e}finally{e||n.abort()}}return new e(s,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new ke,r=t.getReader(),i=!1,a,o=()=>{a??=r.cancel(),a.catch(()=>void 0)};n.signal.addEventListener(`abort`,o,{once:!0});try{if(n.signal.aborted){o();return}for(;;){let{value:t,done:a}=await r.read();if(a){i=!0;break}if(n.signal.aborted)return;for(let r of e.decode(t)){if(n.signal.aborted)return;yield r}}if(n.signal.aborted)return;for(let t of e.flush()){if(n.signal.aborted)return;yield t}}finally{n.signal.removeEventListener(`abort`,o),i||o(),r.releaseLock()}}async function*o(){if(i)throw new f("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(n.signal.aborted||u(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Be=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,c(this,Be,`f`)),new e(()=>i(n),this.controller,c(this,Be,`f`))]}toReadableStream(){let e;return ve({start:async()=>{e=this[Symbol.asyncIterator]()},async pull(t){try{let{value:n,done:r}=await e.next();if(r)return t.close();let i=w(JSON.stringify(n)+`
|
|
4
4
|
`);t.enqueue(i)}catch(e){t.error(e)}},async cancel(){await e.return?.()}})}};async function*He(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new f(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new f(`Attempted to iterate over a response with no body`);let n=new We,r=new ke,i=be(e.body);for await(let e of Ue(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Ue(e){let t=new Uint8Array,n=0,r=0,i=0;for await(let a of e){if(a==null)continue;let e;if(e=a instanceof ArrayBuffer?new Uint8Array(a):typeof a==`string`?w(a):a,r+e.length>t.length){let a=r-n;if(n>=t.length/2&&a+e.length<=t.length)t.copyWithin(0,n,r);else{let i=new Uint8Array(Math.max(t.length*2,a+e.length));i.set(t.subarray(n,r)),t=i}i-=n,n=0,r=a}t.set(e,r),r+=e.length;let o;for(;(o=je(t.subarray(i,r)))!==-1;)o+=i,yield t.slice(n,o),n=o,i=n;i=Math.max(n,r-3)}r>n&&(yield t.slice(n,r))}var We=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.slice(0,-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{S as e,v as t}from"./account-store-
|
|
1
|
+
import{S as e,v as t}from"./account-store-Bxl3Ct33.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{t as r}from"./models-BSkXF4T6.js";import{d as i}from"./claude-model-version-CSATLzrT.js";import{r as a,t as o}from"./transform-messages-BsQjTIEJ.js";function s(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function c(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var l=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return l=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))};function u(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var d=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},f=class extends Error{},p=class e extends f{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new h({message:r,cause:d(n)});let a=n?.error;return t===400?new _(t,a,r,i):t===401?new v(t,a,r,i):t===403?new y(t,a,r,i):t===404?new b(t,a,r,i):t===409?new x(t,a,r,i):t===422?new ee(t,a,r,i):t===429?new te(t,a,r,i):t>=500?new ne(t,a,r,i):new e(t,a,r,i)}},m=class extends p{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},h=class extends p{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},g=class extends h{constructor({message:e}={}){super({message:e??`Request timed out.`})}},_=class extends p{},v=class extends p{},y=class extends p{},b=class extends p{},x=class extends p{},ee=class extends p{},te=class extends p{},ne=class extends p{},re=class extends f{constructor(){super(`Could not parse response content as the length limit was reached`)}},ie=class extends f{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},ae=class extends Error{constructor(e){super(e)}},oe=class extends p{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},se=class extends f{constructor(e,t,n){super(e),this.provider=t,this.cause=n}},ce=/^[a-z][a-z0-9+.-]*:/i,le=e=>ce.test(e),S=e=>(S=Array.isArray,S(e)),ue=S;function de(e){return typeof e==`object`?e??{}:{}}function fe(e){if(!e)return!0;for(let t in e)return!1;return!0}function pe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var me=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new f(`${e} must be an integer`);if(t<0)throw new f(`${e} must be a positive integer`);return t},he=e=>{try{return JSON.parse(e)}catch{return}},ge=e=>new Promise(t=>setTimeout(t,e));function _e(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function ve(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function ye(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return ve({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function be(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function xe(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var Se;function w(e){let t;return(Se??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}var Ce;function we(e){let t;return(Ce??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var Te,T,E,D,O,Ee,De,Oe=65536,ke=class{constructor(){Te.add(this),T.set(this,void 0),E.set(this,void 0),D.set(this,void 0),O.set(this,void 0),Ee.set(this,void 0),s(this,T,new Uint8Array,`f`),s(this,E,0,`f`),s(this,D,0,`f`),s(this,O,0,`f`),s(this,Ee,!1,`f`)}decode(e){if(e==null)return[];let t;if(t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?w(e):e,t.length===0||c(this,Ee,`f`)&&(s(this,Ee,!1,`f`),t[0]===10&&(t=t.subarray(1)),t.length===0))return[];c(this,Te,`m`,De).call(this,t);let n=[],r;for(;(r=Ae(c(this,T,`f`),c(this,O,`f`),c(this,D,`f`)))!=null;){let e=we(c(this,T,`f`).subarray(c(this,E,`f`),r.preceding));n.push(e),s(this,E,r.index,`f`),r.carriage&&(c(this,E,`f`)<c(this,D,`f`)&&c(this,T,`f`)[c(this,E,`f`)]===10?s(this,E,c(this,E,`f`)+1,`f`):c(this,E,`f`)===c(this,D,`f`)&&s(this,Ee,!0,`f`)),s(this,O,c(this,E,`f`),`f`)}if(s(this,O,c(this,D,`f`),`f`),c(this,E,`f`)===c(this,D,`f`))s(this,E,0,`f`),s(this,D,0,`f`),s(this,O,0,`f`),c(this,T,`f`).length>Oe&&s(this,T,new Uint8Array,`f`);else if(n.length>0&&c(this,T,`f`).length>Oe){let e=c(this,D,`f`)-c(this,E,`f`);if(e<=Oe||c(this,T,`f`).length>e*4){let t=e<=Oe?Math.min(Math.max(e*2,256),Oe):e*2,n=new Uint8Array(t);n.set(c(this,T,`f`).subarray(c(this,E,`f`),c(this,D,`f`))),s(this,T,n,`f`),s(this,E,0,`f`),s(this,D,e,`f`),s(this,O,e,`f`)}}return n}flush(){return s(this,Ee,!1,`f`),c(this,E,`f`)===c(this,D,`f`)?[]:this.decode(`
|
|
2
2
|
`)}};T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakMap,Ee=new WeakMap,Te=new WeakSet,De=function(e){if(c(this,D,`f`)+e.length>c(this,T,`f`).length){let t=c(this,D,`f`)-c(this,E,`f`);if(c(this,E,`f`)>=c(this,T,`f`).length/2&&t+e.length<=c(this,T,`f`).length)c(this,T,`f`).copyWithin(0,c(this,E,`f`),c(this,D,`f`));else{let n=Math.max(c(this,T,`f`).length*2,t+e.length,256),r=new Uint8Array(n);r.set(c(this,T,`f`).subarray(c(this,E,`f`),c(this,D,`f`))),s(this,T,r,`f`)}s(this,O,c(this,O,`f`)-c(this,E,`f`),`f`),s(this,D,t,`f`),s(this,E,0,`f`)}c(this,T,`f`).set(e,c(this,D,`f`)),s(this,D,c(this,D,`f`)+e.length,`f`)},ke.NEWLINE_CHARS=new Set([`
|
|
3
3
|
`,`\r`]),ke.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ae(e,t,n){for(let r=t;r<n;r++){if(e[r]===10)return{preceding:r,index:r+1,carriage:!1};if(e[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}function je(e){for(let t=0;t<e.length-1;t++){let n=Me(e,t);if(n>0){let r=t+n,i=Me(e,r);if(i>0)return r+i}}return-1}function Me(e,t){return e[t]===10?1:e[t]===13?e[t+1]===10?2:1:0}var Ne={off:0,error:200,warn:300,info:400,debug:500},Pe=(e,t,n)=>{if(e){if(pe(Ne,e))return e;k(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Ne))}`)}};function Fe(){}function Ie(e,t,n){return!t||Ne[e]>Ne[n]?Fe:t[e].bind(t)}var Le={error:Fe,warn:Fe,info:Fe,debug:Fe},Re=new WeakMap;function k(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Le;let r=Re.get(t);if(r&&r[0]===n)return r[1];let i={error:Ie(`error`,t,n),warn:Ie(`warn`,t,n),info:Ie(`info`,t,n),debug:Ie(`debug`,t,n)};return Re.set(t,[n,i]),i}var ze=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`x-amz-security-token`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),Be,Ve=class e{constructor(e,t,n){Be.set(this,void 0),this.iterator=e,this.controller=t,s(this,Be,n,`f`)}static fromSSEResponse(t,n,r,i){let a=!1,o=r?k(r):console;async function*s(){if(a)throw new f("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1,r=!1;try{for await(let e of He(t,n)){if(e.data.startsWith(`[DONE]`)){r=!0;break}if(e.event===null||!e.event.startsWith(`thread.`)){let n;try{n=JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(n&&n.error)throw new p(void 0,n.error,void 0,t.headers);yield i?{event:e.event,data:n}:n}else{let t;try{t=JSON.parse(e.data)}catch(t){throw console.error(`Could not parse message into JSON:`,e.data),console.error(`From chunk:`,e.raw),t}if(e.event===`error`)throw new p(void 0,t.error,t.message,void 0);yield{event:e.event,data:t}}}e=!0}catch(e){if(r||u(e)||n.signal.aborted&&e===n.signal.reason)return;throw e}finally{e||n.abort()}}return new e(s,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new ke,r=t.getReader(),i=!1,a,o=()=>{a??=r.cancel(),a.catch(()=>void 0)};n.signal.addEventListener(`abort`,o,{once:!0});try{if(n.signal.aborted){o();return}for(;;){let{value:t,done:a}=await r.read();if(a){i=!0;break}if(n.signal.aborted)return;for(let r of e.decode(t)){if(n.signal.aborted)return;yield r}}if(n.signal.aborted)return;for(let t of e.flush()){if(n.signal.aborted)return;yield t}}finally{n.signal.removeEventListener(`abort`,o),i||o(),r.releaseLock()}}async function*o(){if(i)throw new f("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(n.signal.aborted||u(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Be=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,c(this,Be,`f`)),new e(()=>i(n),this.controller,c(this,Be,`f`))]}toReadableStream(){let e;return ve({start:async()=>{e=this[Symbol.asyncIterator]()},async pull(t){try{let{value:n,done:r}=await e.next();if(r)return t.close();let i=w(JSON.stringify(n)+`
|
|
4
4
|
`);t.enqueue(i)}catch(e){t.error(e)}},async cancel(){await e.return?.()}})}};async function*He(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new f(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new f(`Attempted to iterate over a response with no body`);let n=new Ge,r=new ke,i=be(e.body);for await(let e of We(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}var Ue=3;async function*We(e){let t=new Uint8Array,n=0,r=0,i=0;for await(let a of e){if(a==null)continue;let e;if(e=a instanceof ArrayBuffer?new Uint8Array(a):typeof a==`string`?w(a):a,r+e.length>t.length){let a=r-n;if(n>=t.length/2&&a+e.length<=t.length)t.copyWithin(0,n,r);else{let i=new Uint8Array(Math.max(t.length*2,a+e.length));i.set(t.subarray(n,r)),t=i}i-=n,n=0,r=a}t.set(e,r),r+=e.length;let o;for(;(o=je(t.subarray(i,r)))!==-1;)o+=i,yield t.slice(n,o),n=o,i=n;i=Math.max(n,r-Ue)}r>n&&(yield t.slice(n,r))}var Ge=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.slice(0,-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{o as e,t}from"./api-endpoint-3qEcn7BY.js";import{t as n}from"./types-Dgm4REV3.js";import{t as r}from"./remote-cache-BE5T1-53.js";function i(e){if(!Number.isFinite(e))return{run:e=>e(),get active(){return 0}};let t=Math.max(1,Math.floor(e)),n=[],r=0,i=()=>{let e=n.shift();if(e){e();return}--r};return{async run(e){r>=t?await new Promise(e=>n.push(e)):r+=1;try{return await e()}finally{i()}},get active(){return r}}}const a=104857600,o=new Set([`list`,`stat`,`mkdir`,`rename`,`remove`]),s=new Set([`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`EIO`]),c=new Set([`list`,`stat`,`read`,`mkdir`]),l=`no-store`;function u(e,t){return`hostfs:${encodeURIComponent(e)}:${encodeURIComponent(t)}`}const d=e=>e.json(),f=async e=>({partial:e.status===206,body:await e.arrayBuffer()}),p=async e=>{await e.arrayBuffer()},m=e=>e>0?new Promise(t=>setTimeout(t,e)):Promise.resolve();function h(e,t,r,i,a){let o=r instanceof Error?r.message:String(r),s=a?` after ${i} attempt${i===1?``:`s`}`:` (not retried: non-idempotent op)`;return new n(`EIO`,`hostfs ${e} failed${s}: transient bridge error: ${o}`,t)}function g(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function _(e){let t={},n=g(e.ctime);n!==void 0&&(t.ctime=n);let r=g(e.ino);r!==void 0&&(t.ino=r);let i=g(e.uid);i!==void 0&&(t.uid=i);let a=g(e.gid);a!==void 0&&(t.gid=a);let o=g(e.mode);return o!==void 0&&(t.mode=o),t}var v=class{kind=`hostfs`;listingStatsMatchStat=!0;source;mountId;targetPath;hostPath;fetchImpl;limiter;maxAttempts;retryDelayMs;cache;maxCachedBodyBytes;cacheGeneration=0;closed=!1;stableEndpoint=!0;constructor(e){this.targetPath=e.targetPath,this.hostPath=e.hostPath,this.source=`hostfs://${e.hostPath}`,this.mountId=e.mountId??u(e.targetPath,e.hostPath),this.fetchImpl=e.fetchImpl??fetch,this.limiter=i(e.maxInflight??24),this.maxAttempts=Math.max(1,e.maxAttempts??3),this.retryDelayMs=e.retryDelayMs??25,this.maxCachedBodyBytes=Math.max(0,e.maxCachedBodyBytes??4194304),this.cache=e.cache??new r({mountId:this.mountId,ttlMs:e.cacheTtlMs??3e4})}assertOpen(e){if(this.closed)throw new n(`EBADF`,`mount closed`,e)}bodyKey(e){return e.replace(/^\/+/,``)}async invalidateCachePrefixes(e){this.cacheGeneration+=1,await this.cache.invalidatePrefixes(e)}async cacheBodyIfCurrent(e,t,n,r){e!==this.cacheGeneration||n.byteLength>this.maxCachedBodyBytes||(await this.cache.putBody(t,n,r),e!==this.cacheGeneration&&await this.cache.invalidateBody(t))}async applyHostInvalidation(e){if(e.length===0){await this.invalidateCachePrefixes([]);return}let t=e.map(e=>e.replace(/^\/+/,``));if(t.some(e=>e.length===0||e===`.`)){await this.invalidateCachePrefixes([]);return}await this.invalidateCachePrefixes(t)}getCache(){return this.cache}url(t,n,r){let i=new URLSearchParams({mount:this.targetPath,path:n.replace(/^\/+/,``)});for(let[e,t]of Object.entries(r??{}))i.set(e,t);return e(`/api/hostfs/${t}?${i.toString()}`)}buildRequest(n,r,i){let a=t(i?.headers);if(this.stableEndpoint&&o.has(n))return{url:e(`/api/hostfs`),init:{method:`POST`,headers:{...a,"Content-Type":`application/json`},body:JSON.stringify({op:n,mount:this.targetPath,path:r.replace(/^\/+/,``),...i?.extra??{}})}};let{extra:s,...c}=i??{};return{url:this.url(n,r,i?.extra),init:{...c,headers:a}}}async request(e,t,n,r){return this.assertOpen(t),this.limiter.run(()=>this.attemptRequest(e,t,n,r))}async attemptRequest(e,t,r,i){let a=c.has(e)?this.maxAttempts:1,o=0,s;for(;o<a;){o+=1;try{return await this.routeAndConsume(e,t,r,i)}catch(e){if(e instanceof n)throw e;if(s=e,this.closed)break;o<a&&await m(this.retryDelayMs*o)}}throw h(e,t,s,o,a>1)}async routeAndConsume(e,t,n,r){let i=this.stableEndpoint&&o.has(e),a=this.buildRequest(e,t,r),s=await this.fetchImpl(a.url,a.init);if(s.ok||s.status===304)return await n(s);let{error:c,rawCode:l}=await this.errorFromResponse(e,t,s);if(i&&l===null&&(s.status===404||s.status===405))return this.stableEndpoint=!1,await this.routeAndConsume(e,t,n,r);throw c}async errorFromResponse(e,t,r){let i=`EIO`,a=null,o=`hostfs ${e} failed with HTTP ${r.status}`;try{let e=await r.json();typeof e.code==`string`&&(a=e.code,s.has(e.code)&&(i=e.code)),typeof e.message==`string`&&(o=e.message)}catch{}return{error:new n(i,o,t),rawCode:a}}async readDir(e){let t=await this.request(`list`,e,d);if(!Array.isArray(t.entries))return[];let n=[];for(let e of t.entries){let t=e;typeof t.name!=`string`||t.kind!==`file`&&t.kind!==`directory`||n.push({name:t.name,kind:t.kind,...typeof t.size==`number`?{size:t.size}:{},...typeof t.lastModified==`number`?{lastModified:t.lastModified}:{},..._(t)})}return n}async readFile(e){this.assertOpen(e);let t=this.cacheGeneration,r=this.bodyKey(e),i=await this.cache.getBody(r);if(i&&!this.cache.isStale(i.cachedAt))return i.body;let o={};i?.etag&&(o[`If-None-Match`]=i.etag);let s=await this.request(`read`,e,async e=>e.status===304?{kind:`not-modified`}:{kind:`body`,bytes:new Uint8Array(await e.arrayBuffer()),etag:e.headers.get(`etag`)??``},{cache:l,headers:o});if(s.kind===`not-modified`){if(!i)throw new n(`EIO`,`hostfs read got 304 without a cached body`,e);return await this.cacheBodyIfCurrent(t,r,i.body,i.etag),i.body}if(s.bytes.byteLength>a)throw new n(`EFBIG`,`file exceeds the hostfs body cap`,e);return await this.cacheBodyIfCurrent(t,r,s.bytes,s.etag),s.bytes}async readFileRange(e,t,r){if(!Number.isInteger(t)||!Number.isInteger(r)||t<0||r<t)throw new n(`EINVAL`,`invalid byte range ${t}-${r}`,e);if(r===t)return new Uint8Array;if(r-t>a)throw new n(`EFBIG`,`byte range exceeds the hostfs body cap`,e);let{partial:i,body:o}=await this.request(`read`,e,f,{cache:l,headers:{Range:`bytes=${t}-${r-1}`}});return i?new Uint8Array(o):new Uint8Array(o).slice(t,r)}async writeFile(e,t){if(t.byteLength>a)throw new n(`EFBIG`,`body exceeds the hostfs body cap`,e);await this.request(`write`,e,p,{method:`PUT`,headers:{"Content-Type":`application/octet-stream`},body:new Uint8Array(t)});let r=this.bodyKey(e),i=++this.cacheGeneration;t.byteLength<=this.maxCachedBodyBytes?await this.cacheBodyIfCurrent(i,r,new Uint8Array(t),``):await this.cache.invalidateBody(r)}async stat(e){let t=await this.request(`stat`,e,d);return{kind:t.kind===`directory`?`directory`:`file`,size:typeof t.size==`number`?t.size:0,mtime:typeof t.mtime==`number`?t.mtime:0,..._(t)}}async mkdir(e){await this.request(`mkdir`,e,p,{method:`POST`})}async rename(e,t){await this.request(`rename`,e,p,{method:`POST`,extra:{to:t.replace(/^\/+/,``)}});let n=this.bodyKey(e),r=this.bodyKey(t);await this.invalidateCachePrefixes([n,r])}async remove(e,t){await this.request(`remove`,e,p,{method:`DELETE`,extra:t?.recursive?{recursive:`1`}:void 0});let n=this.bodyKey(e);t?.recursive?await this.invalidateCachePrefixes([n]):(this.cacheGeneration+=1,await this.cache.invalidateBody(n))}async refresh(e){return this.assertOpen(this.targetPath),await this.invalidateCachePrefixes([]),{added:[],removed:[],changed:e?.bodies?[`*`]:[],unchanged:0,errors:[]}}describe(){return{displayName:this.hostPath.split(`/`).filter(Boolean).at(-1)??this.hostPath,source:this.source,extra:`configured via mount table (auto-mounted, live host view)`}}async close(){this.closed=!0}getHostPath(){return this.hostPath}getTargetPath(){return this.targetPath}};export{v as HostFsMountBackend};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./libesm-CSMdpGMF.js";var r=t((e=>{(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function n(e){return i(o(e),arguments)}function r(e,t){return n.apply(null,[e].concat(t||[]))}function i(e,r){var i=1,a=e.length,o,s=``,c,l,u,d,f,p,m,h;for(c=0;c<a;c++)if(typeof e[c]==`string`)s+=e[c];else if(typeof e[c]==`object`){if(u=e[c],u.keys)for(o=r[i],l=0;l<u.keys.length;l++){if(o==null)throw Error(n(`[sprintf] Cannot access property "%s" of undefined value "%s"`,u.keys[l],u.keys[l-1]));o=o[u.keys[l]]}else o=u.param_no?r[u.param_no]:r[i++];if(t.not_type.test(u.type)&&t.not_primitive.test(u.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(u.type)&&typeof o!=`number`&&isNaN(o))throw TypeError(n(`[sprintf] expecting number but found %T`,o));switch(t.number.test(u.type)&&(m=o>=0),u.type){case`b`:o=parseInt(o,10).toString(2);break;case`c`:o=String.fromCharCode(parseInt(o,10));break;case`d`:case`i`:o=parseInt(o,10);break;case`j`:o=JSON.stringify(o,null,u.width?parseInt(u.width):0);break;case`e`:o=u.precision?parseFloat(o).toExponential(u.precision):parseFloat(o).toExponential();break;case`f`:o=u.precision?parseFloat(o).toFixed(u.precision):parseFloat(o);break;case`g`:o=u.precision?String(Number(o.toPrecision(u.precision))):parseFloat(o);break;case`o`:o=(parseInt(o,10)>>>0).toString(8);break;case`s`:o=String(o),o=u.precision?o.substring(0,u.precision):o;break;case`t`:o=String(!!o),o=u.precision?o.substring(0,u.precision):o;break;case`T`:o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=u.precision?o.substring(0,u.precision):o;break;case`u`:o=parseInt(o,10)>>>0;break;case`v`:o=o.valueOf(),o=u.precision?o.substring(0,u.precision):o;break;case`x`:o=(parseInt(o,10)>>>0).toString(16);break;case`X`:o=(parseInt(o,10)>>>0).toString(16).toUpperCase()}t.json.test(u.type)?s+=o:(t.number.test(u.type)&&(!m||u.sign)?(h=m?`+`:`-`,o=o.toString().replace(t.sign,``)):h=``,f=u.pad_char?u.pad_char===`0`?`0`:u.pad_char.charAt(1):` `,p=u.width-(h+o).length,d=u.width&&p>0?f.repeat(p):``,s+=u.align?h+o+d:f===`0`?h+d+o:d+h+o)}return s}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var n=e,r,i=[],o=0;n;){if((r=t.text.exec(n))!==null)i.push(r[0]);else if((r=t.modulo.exec(n))!==null)i.push(`%`);else if((r=t.placeholder.exec(n))!==null){if(r[2]){o|=1;var s=[],c=r[2],l=[];if((l=t.key.exec(c))!==null)for(s.push(l[1]);(c=c.substring(l[0].length))!==``;)if((l=t.key_access.exec(c))!==null)s.push(l[1]);else if((l=t.index_access.exec(c))!==null)s.push(l[1]);else throw SyntaxError(`[sprintf] failed to parse named argument key`);else throw SyntaxError(`[sprintf] failed to parse named argument key`);r[2]=s}else o|=2;if(o===3)throw Error(`[sprintf] mixing positional and named placeholders is not (yet) supported`);i.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}else throw SyntaxError(`[sprintf] unexpected placeholder`);n=n.substring(r[0].length)}return a[e]=i}e!==void 0&&(e.sprintf=n,e.vsprintf=r),typeof window<`u`&&(window.sprintf=n,window.vsprintf=r,typeof define==`function`&&define.amd&&define(function(){return{sprintf:n,vsprintf:r}}))})()}))();const i=(e,t,n)=>{let r=e instanceof RegExp?a(e,n):e,i=t instanceof RegExp?a(t,n):t,s=r!==null&&i!=null&&o(r,i,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+i.length)}},a=(e,t)=>{let n=t.match(e);return n?n[0]:null},o=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},s=`\0SLASH`+Math.random()+`\0`,c=`\0OPEN`+Math.random()+`\0`,l=`\0CLOSE`+Math.random()+`\0`,u=`\0COMMA`+Math.random()+`\0`,d=`\0PERIOD`+Math.random()+`\0`,f=new RegExp(s,`g`),p=new RegExp(c,`g`),m=new RegExp(l,`g`),h=new RegExp(u,`g`),g=new RegExp(d,`g`),_=/\\\\/g,v=/\\{/g,y=/\\}/g,b=/\\,/g,x=/\\\./g;function S(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function ee(e){return e.replace(_,s).replace(v,c).replace(y,l).replace(b,u).replace(x,d)}function C(e){return e.replace(f,`\\`).replace(p,`{`).replace(m,`}`).replace(h,`,`).replace(g,`.`)}function te(e){if(!e)return[``];let t=[],n=i(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:a,post:o}=n,s=r.split(`,`);s[s.length-1]+=`{`+a+`}`;let c=te(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function ne(e,t={}){if(!e)return[];let{max:n=1e5,maxLength:r=4e6}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),ce(ee(e),n,r,!0).map(C)}function w(e){return`{`+e+`}`}function re(e){return/^-?0\d/.test(e)}function ie(e,t){return e<=t}function ae(e,t){return e>=t}function oe(e,t,n,r,i,a){let o=[],s=0;for(let c=0;c<e.length;c++)for(let l=0;l<n.length;l++){if(o.length>=r)return o;let u=e[c]+t+n[l];if(!(a&&!u)){if(s+u.length>i)return o;o.push(u),s+=u.length}}return o}function se(e,t,n,r){let i=e.split(/\.\./),a=[];if(i[0]===void 0||i[1]===void 0)return a;let o=S(i[0]),s=S(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(S(i[2])),1):1,u=ie;s<o&&(l*=-1,u=ae);let d=i.some(re),f=0;for(let e=o;u(e,s)&&a.length<n;e+=l){let n;if(t)n=String.fromCharCode(e),n===`\\`&&(n=``);else if(n=String(e),d){let t=c-n.length;if(t>0){let r=Array(t+1).join(`0`);n=e<0?`-`+r+n.slice(1):r+n}}if(f+n.length>r)break;a.push(n),f+=n.length}return a}function ce(e,t,n,r){let a=[``],o=!1,s=!0;for(;;){let c=i(`{`,`}`,e);if(!c)return oe(a,e,[``],t,n,o);let u=c.pre;if(/\$$/.test(u)){if(a=oe(a,u+`{`+c.body+`}`,[``],t,n,o&&!c.post.length),s=!1,!c.post.length)break;e=c.post;continue}let d=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(c.body),f=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(c.body),p=d||f,m=c.body.indexOf(`,`)>=0;if(!p&&!m){if(c.post.match(/,(?!,).*\}/)){e=c.pre+`{`+c.body+l+c.post,r=!0;continue}return oe(a,u+`{`+c.body+`}`+c.post,[``],t,n,o)}s&&=(o=r&&!p,!1);let h;if(p)h=se(c.body,f,t,n);else{let r=te(c.body);if(r.length===1&&r[0]!==void 0&&(r=ce(r[0],t,n,!1).map(w),r.length===1)){if(a=oe(a,u+r[0],[``],t,n,o&&!c.post.length),!c.post.length)break;e=c.post;continue}let i=o&&!c.post.length&&!u;for(let e=0;i&&e<a.length;e++)a[e]&&(i=!1);h=[];let s=0;outer:for(let e=0;e<r.length;e++){let a=ce(r[e],t,n,!1);for(let e=0;e<a.length;e++){let r=a[e];if(!(i&&!r)){if(h.length>=t||s+r.length>n)break outer;h.push(r),s+=r.length}}}}if(a=oe(a,u,h,t,n,o&&!c.post.length),!c.post.length)break;e=c.post}return a}const le=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},ue={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},de=e=>e.replace(/[[\]\\-]/g,`\\$&`),fe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),pe=e=>e.join(``),me=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(ue))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(de(d)+`-`+de(t)):t===d&&r.push(de(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(de(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(de(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let e=r[0].length===2?r[0].slice(-1):r[0];return[fe(e),!1,u-n,!1]}let f=`[`+(l?`^`:``)+pe(r)+`]`,p=`[`+(l?``:`^`)+pe(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},he=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):t?e.replace(/\[([^/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`);var ge;const _e=new Set([`!`,`?`,`+`,`*`,`@`]),ve=e=>_e.has(e),ye=e=>ve(e.type),be=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),xe=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),Se=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),Ce=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),we=`(?!\\.)`,Te=new Set([`[`,`.`]),Ee=new Set([`..`,`.`]),De=new Set(`().*{}+?[]^$\\!`),Oe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),ke=`[^/]+?`;let Ae=0;var je=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Ae;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.#l=this.type?this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof ge&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof ge&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new ge(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&ve(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new ge(n,t);u=ge.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new ge(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&ve(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new ge(n,d);d.push(o),u=ge.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new ge(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,xe)}#m(e,t=be){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=Se){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new ge(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!Ce.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=Ce.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new ge(null,void 0,t);return ge.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!ye(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?ge.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Ee.has(this.#r[0]))){let n=Te,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?`(?!(?:^|/)\\.\\.?(?:$|/))`:o?we:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,he(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,he(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?we:``)+ke;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?we:``)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,he(i),this.#t=!!this.#t,this.#n]}#x(){if(ye(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(De.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?ke:`[^/]*?`,t=!0;continue}if(o=!1,c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=me(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=`[^/]`,t=!0;continue}i+=Oe(c)}return[i,he(e),!!t,a]}};ge=je;const Me=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),Ne=(e,t,n={})=>(le(t),!n.nocomment&&t.charAt(0)===`#`?!1:new st(t,n).match(e)),Pe=/^\*+([^+@!?*[(]*)$/,Fe=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Ie=e=>t=>t.endsWith(e),Le=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Re=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),ze=/^\*+\.\*+$/,Be=e=>!e.startsWith(`.`)&&e.includes(`.`),Ve=e=>e!==`.`&&e!==`..`&&e.includes(`.`),He=/^\.\*+$/,Ue=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),We=/^\*+$/,Ge=e=>e.length!==0&&!e.startsWith(`.`),Ke=e=>e.length!==0&&e!==`.`&&e!==`..`,qe=/^\?+([^+@!?*[(]*)?$/,Je=([e,t=``])=>{let n=Qe([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Ye=([e,t=``])=>{let n=$e([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Xe=([e,t=``])=>{let n=$e([e]);return t?e=>n(e)&&e.endsWith(t):n},Ze=([e,t=``])=>{let n=Qe([e]);return t?e=>n(e)&&e.endsWith(t):n},Qe=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},$e=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},et=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,tt={win32:{sep:`\\`},posix:{sep:`/`}};Ne.sep=et===`win32`?tt.win32.sep:tt.posix.sep;const nt=Symbol(`globstar **`);Ne.GLOBSTAR=nt,Ne.filter=(e,t={})=>n=>Ne(n,e,t);const rt=(e,t={})=>Object.assign({},e,t);Ne.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return Ne;let t=Ne;return Object.assign((n,r,i={})=>t(n,r,rt(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,rt(e,n))}static defaults(n){return t.defaults(rt(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,rt(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,rt(e,r))}},unescape:(n,r={})=>t.unescape(n,rt(e,r)),escape:(n,r={})=>t.escape(n,rt(e,r)),filter:(n,r={})=>t.filter(n,rt(e,r)),defaults:n=>t.defaults(rt(e,n)),makeRe:(n,r={})=>t.makeRe(n,rt(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,rt(e,r)),match:(n,r,i={})=>t.match(n,r,rt(e,i)),sep:t.sep,GLOBSTAR:nt})};const it=(e,t={})=>(le(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ne(e,{max:t.braceExpandMax}));Ne.braceExpand=it,Ne.makeRe=(e,t={})=>new st(e,t).makeRe(),Ne.match=(e,t,n={})=>{let r=new st(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};const at=/[?*]|[+@!]\(.*?\)|\[|\]/,ot=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var st=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){le(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||et,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!at.test(e[2]))&&!at.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t of e)for(let e=0;e<t.length;e++)t[e]===`**`&&(t[e]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];(n!==1||r!==``||e[0]!==``)&&(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];(e!==1||r!==``||n[0]!==``)&&(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(nt)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(nt,i),o=t.lastIndexOf(nt),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===nt?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===nt)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return it(this.pattern,this.options)}parse(e){le(e);let t=this.options;if(e===`**`)return nt;if(e===``)return``;let n,r=null;(n=e.match(We))?r=t.dot?Ke:Ge:(n=e.match(Pe))?r=(t.nocase?t.dot?Re:Le:t.dot?Ie:Fe)(n[1]):(n=e.match(qe))?r=(t.nocase?t.dot?Ye:Je:t.dot?Xe:Ze)(n):(n=e.match(ze))?r=t.dot?Ve:Be:(n=e.match(He))&&(r=Ue);let i=je.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?`[^/]*?`:t.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?ot(e):e===nt?nt:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e===nt&&a!==nt&&(a===void 0?i!==void 0&&i!==nt?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==nt&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=nt))});let i=t.filter(e=>e!==nt);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e of i){let i=r;if(n.matchBase&&e.length===1&&(i=[a]),this.matchOne(i,e,t))return n.flipNegate?!0:!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return Ne.defaults(e).Minimatch}};Ne.AST=je,Ne.Minimatch=st,Ne.escape=Me,Ne.unescape=he;const ct={};function lt(){throw Error(`gunzipSync is not available in the browser`)}function ut(){throw Error(`gzipSync is not available in the browser`)}function dt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}function ft(e,t){return Array(t+1).join(e)}function pt(e){return e.replace(/^\n*/,``)}function mt(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
1
|
+
import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{n}from"./libesm-CTQYxJIv.js";var r=t((e=>{(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function n(e){return i(o(e),arguments)}function r(e,t){return n.apply(null,[e].concat(t||[]))}function i(e,r){var i=1,a=e.length,o,s=``,c,l,u,d,f,p,m,h;for(c=0;c<a;c++)if(typeof e[c]==`string`)s+=e[c];else if(typeof e[c]==`object`){if(u=e[c],u.keys)for(o=r[i],l=0;l<u.keys.length;l++){if(o==null)throw Error(n(`[sprintf] Cannot access property "%s" of undefined value "%s"`,u.keys[l],u.keys[l-1]));o=o[u.keys[l]]}else o=u.param_no?r[u.param_no]:r[i++];if(t.not_type.test(u.type)&&t.not_primitive.test(u.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(u.type)&&typeof o!=`number`&&isNaN(o))throw TypeError(n(`[sprintf] expecting number but found %T`,o));switch(t.number.test(u.type)&&(m=o>=0),u.type){case`b`:o=parseInt(o,10).toString(2);break;case`c`:o=String.fromCharCode(parseInt(o,10));break;case`d`:case`i`:o=parseInt(o,10);break;case`j`:o=JSON.stringify(o,null,u.width?parseInt(u.width):0);break;case`e`:o=u.precision?parseFloat(o).toExponential(u.precision):parseFloat(o).toExponential();break;case`f`:o=u.precision?parseFloat(o).toFixed(u.precision):parseFloat(o);break;case`g`:o=u.precision?String(Number(o.toPrecision(u.precision))):parseFloat(o);break;case`o`:o=(parseInt(o,10)>>>0).toString(8);break;case`s`:o=String(o),o=u.precision?o.substring(0,u.precision):o;break;case`t`:o=String(!!o),o=u.precision?o.substring(0,u.precision):o;break;case`T`:o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=u.precision?o.substring(0,u.precision):o;break;case`u`:o=parseInt(o,10)>>>0;break;case`v`:o=o.valueOf(),o=u.precision?o.substring(0,u.precision):o;break;case`x`:o=(parseInt(o,10)>>>0).toString(16);break;case`X`:o=(parseInt(o,10)>>>0).toString(16).toUpperCase()}t.json.test(u.type)?s+=o:(t.number.test(u.type)&&(!m||u.sign)?(h=m?`+`:`-`,o=o.toString().replace(t.sign,``)):h=``,f=u.pad_char?u.pad_char===`0`?`0`:u.pad_char.charAt(1):` `,p=u.width-(h+o).length,d=u.width&&p>0?f.repeat(p):``,s+=u.align?h+o+d:f===`0`?h+d+o:d+h+o)}return s}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var n=e,r,i=[],o=0;n;){if((r=t.text.exec(n))!==null)i.push(r[0]);else if((r=t.modulo.exec(n))!==null)i.push(`%`);else if((r=t.placeholder.exec(n))!==null){if(r[2]){o|=1;var s=[],c=r[2],l=[];if((l=t.key.exec(c))!==null)for(s.push(l[1]);(c=c.substring(l[0].length))!==``;)if((l=t.key_access.exec(c))!==null)s.push(l[1]);else if((l=t.index_access.exec(c))!==null)s.push(l[1]);else throw SyntaxError(`[sprintf] failed to parse named argument key`);else throw SyntaxError(`[sprintf] failed to parse named argument key`);r[2]=s}else o|=2;if(o===3)throw Error(`[sprintf] mixing positional and named placeholders is not (yet) supported`);i.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}else throw SyntaxError(`[sprintf] unexpected placeholder`);n=n.substring(r[0].length)}return a[e]=i}e!==void 0&&(e.sprintf=n,e.vsprintf=r),typeof window<`u`&&(window.sprintf=n,window.vsprintf=r,typeof define==`function`&&define.amd&&define(function(){return{sprintf:n,vsprintf:r}}))})()}))();const i=(e,t,n)=>{let r=e instanceof RegExp?a(e,n):e,i=t instanceof RegExp?a(t,n):t,s=r!==null&&i!=null&&o(r,i,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+i.length)}},a=(e,t)=>{let n=t.match(e);return n?n[0]:null},o=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},s=`\0SLASH`+Math.random()+`\0`,c=`\0OPEN`+Math.random()+`\0`,l=`\0CLOSE`+Math.random()+`\0`,u=`\0COMMA`+Math.random()+`\0`,d=`\0PERIOD`+Math.random()+`\0`,f=new RegExp(s,`g`),p=new RegExp(c,`g`),m=new RegExp(l,`g`),h=new RegExp(u,`g`),g=new RegExp(d,`g`),_=/\\\\/g,v=/\\{/g,y=/\\}/g,b=/\\,/g,x=/\\\./g;function S(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function ee(e){return e.replace(_,s).replace(v,c).replace(y,l).replace(b,u).replace(x,d)}function C(e){return e.replace(f,`\\`).replace(p,`{`).replace(m,`}`).replace(h,`,`).replace(g,`.`)}function te(e){if(!e)return[``];let t=[],n=i(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:a,post:o}=n,s=r.split(`,`);s[s.length-1]+=`{`+a+`}`;let c=te(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function ne(e,t={}){if(!e)return[];let{max:n=1e5,maxLength:r=4e6}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),ce(ee(e),n,r,!0).map(C)}function w(e){return`{`+e+`}`}function re(e){return/^-?0\d/.test(e)}function ie(e,t){return e<=t}function ae(e,t){return e>=t}function oe(e,t,n,r,i,a){let o=[],s=0;for(let c=0;c<e.length;c++)for(let l=0;l<n.length;l++){if(o.length>=r)return o;let u=e[c]+t+n[l];if(!(a&&!u)){if(s+u.length>i)return o;o.push(u),s+=u.length}}return o}function se(e,t,n,r){let i=e.split(/\.\./),a=[];if(i[0]===void 0||i[1]===void 0)return a;let o=S(i[0]),s=S(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(S(i[2])),1):1,u=ie;s<o&&(l*=-1,u=ae);let d=i.some(re),f=0;for(let e=o;u(e,s)&&a.length<n;e+=l){let n;if(t)n=String.fromCharCode(e),n===`\\`&&(n=``);else if(n=String(e),d){let t=c-n.length;if(t>0){let r=Array(t+1).join(`0`);n=e<0?`-`+r+n.slice(1):r+n}}if(f+n.length>r)break;a.push(n),f+=n.length}return a}function ce(e,t,n,r){let a=[``],o=!1,s=!0;for(;;){let c=i(`{`,`}`,e);if(!c)return oe(a,e,[``],t,n,o);let u=c.pre;if(/\$$/.test(u)){if(a=oe(a,u+`{`+c.body+`}`,[``],t,n,o&&!c.post.length),s=!1,!c.post.length)break;e=c.post;continue}let d=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(c.body),f=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(c.body),p=d||f,m=c.body.indexOf(`,`)>=0;if(!p&&!m){if(c.post.match(/,(?!,).*\}/)){e=c.pre+`{`+c.body+l+c.post,r=!0;continue}return oe(a,u+`{`+c.body+`}`+c.post,[``],t,n,o)}s&&=(o=r&&!p,!1);let h;if(p)h=se(c.body,f,t,n);else{let r=te(c.body);if(r.length===1&&r[0]!==void 0&&(r=ce(r[0],t,n,!1).map(w),r.length===1)){if(a=oe(a,u+r[0],[``],t,n,o&&!c.post.length),!c.post.length)break;e=c.post;continue}let i=o&&!c.post.length&&!u;for(let e=0;i&&e<a.length;e++)a[e]&&(i=!1);h=[];let s=0;outer:for(let e=0;e<r.length;e++){let a=ce(r[e],t,n,!1);for(let e=0;e<a.length;e++){let r=a[e];if(!(i&&!r)){if(h.length>=t||s+r.length>n)break outer;h.push(r),s+=r.length}}}}if(a=oe(a,u,h,t,n,o&&!c.post.length),!c.post.length)break;e=c.post}return a}const le=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},ue={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},de=e=>e.replace(/[[\]\\-]/g,`\\$&`),fe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),pe=e=>e.join(``),me=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(ue))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(de(d)+`-`+de(t)):t===d&&r.push(de(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(de(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(de(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let e=r[0].length===2?r[0].slice(-1):r[0];return[fe(e),!1,u-n,!1]}let f=`[`+(l?`^`:``)+pe(r)+`]`,p=`[`+(l?``:`^`)+pe(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},he=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):t?e.replace(/\[([^/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`);var ge;const _e=new Set([`!`,`?`,`+`,`*`,`@`]),ve=e=>_e.has(e),ye=e=>ve(e.type),be=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),xe=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),Se=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),Ce=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),we=`(?!\\.)`,Te=new Set([`[`,`.`]),Ee=new Set([`..`,`.`]),De=new Set(`().*{}+?[]^$\\!`),Oe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),ke=`[^/]+?`;let Ae=0;var je=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Ae;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.#l=this.type?this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof ge&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof ge&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new ge(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&ve(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new ge(n,t);u=ge.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new ge(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&ve(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new ge(n,d);d.push(o),u=ge.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new ge(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,xe)}#m(e,t=be){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=Se){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new ge(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!Ce.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=Ce.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new ge(null,void 0,t);return ge.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!ye(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?ge.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Ee.has(this.#r[0]))){let n=Te,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?`(?!(?:^|/)\\.\\.?(?:$|/))`:o?we:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,he(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,he(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?we:``)+ke;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?we:``)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,he(i),this.#t=!!this.#t,this.#n]}#x(){if(ye(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(De.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?ke:`[^/]*?`,t=!0;continue}if(o=!1,c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=me(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=`[^/]`,t=!0;continue}i+=Oe(c)}return[i,he(e),!!t,a]}};ge=je;const Me=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),Ne=(e,t,n={})=>(le(t),!n.nocomment&&t.charAt(0)===`#`?!1:new st(t,n).match(e)),Pe=/^\*+([^+@!?*[(]*)$/,Fe=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Ie=e=>t=>t.endsWith(e),Le=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Re=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),ze=/^\*+\.\*+$/,Be=e=>!e.startsWith(`.`)&&e.includes(`.`),Ve=e=>e!==`.`&&e!==`..`&&e.includes(`.`),He=/^\.\*+$/,Ue=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),We=/^\*+$/,Ge=e=>e.length!==0&&!e.startsWith(`.`),Ke=e=>e.length!==0&&e!==`.`&&e!==`..`,qe=/^\?+([^+@!?*[(]*)?$/,Je=([e,t=``])=>{let n=Qe([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Ye=([e,t=``])=>{let n=$e([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Xe=([e,t=``])=>{let n=$e([e]);return t?e=>n(e)&&e.endsWith(t):n},Ze=([e,t=``])=>{let n=Qe([e]);return t?e=>n(e)&&e.endsWith(t):n},Qe=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},$e=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},et=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,tt={win32:{sep:`\\`},posix:{sep:`/`}};Ne.sep=et===`win32`?tt.win32.sep:tt.posix.sep;const nt=Symbol(`globstar **`);Ne.GLOBSTAR=nt,Ne.filter=(e,t={})=>n=>Ne(n,e,t);const rt=(e,t={})=>Object.assign({},e,t);Ne.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return Ne;let t=Ne;return Object.assign((n,r,i={})=>t(n,r,rt(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,rt(e,n))}static defaults(n){return t.defaults(rt(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,rt(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,rt(e,r))}},unescape:(n,r={})=>t.unescape(n,rt(e,r)),escape:(n,r={})=>t.escape(n,rt(e,r)),filter:(n,r={})=>t.filter(n,rt(e,r)),defaults:n=>t.defaults(rt(e,n)),makeRe:(n,r={})=>t.makeRe(n,rt(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,rt(e,r)),match:(n,r,i={})=>t.match(n,r,rt(e,i)),sep:t.sep,GLOBSTAR:nt})};const it=(e,t={})=>(le(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ne(e,{max:t.braceExpandMax}));Ne.braceExpand=it,Ne.makeRe=(e,t={})=>new st(e,t).makeRe(),Ne.match=(e,t,n={})=>{let r=new st(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};const at=/[?*]|[+@!]\(.*?\)|\[|\]/,ot=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var st=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){le(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||et,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!at.test(e[2]))&&!at.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t of e)for(let e=0;e<t.length;e++)t[e]===`**`&&(t[e]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];(n!==1||r!==``||e[0]!==``)&&(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];(e!==1||r!==``||n[0]!==``)&&(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(nt)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(nt,i),o=t.lastIndexOf(nt),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===nt?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===nt)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return it(this.pattern,this.options)}parse(e){le(e);let t=this.options;if(e===`**`)return nt;if(e===``)return``;let n,r=null;(n=e.match(We))?r=t.dot?Ke:Ge:(n=e.match(Pe))?r=(t.nocase?t.dot?Re:Le:t.dot?Ie:Fe)(n[1]):(n=e.match(qe))?r=(t.nocase?t.dot?Ye:Je:t.dot?Xe:Ze)(n):(n=e.match(ze))?r=t.dot?Ve:Be:(n=e.match(He))&&(r=Ue);let i=je.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?`[^/]*?`:t.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?ot(e):e===nt?nt:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e===nt&&a!==nt&&(a===void 0?i!==void 0&&i!==nt?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==nt&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=nt))});let i=t.filter(e=>e!==nt);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e of i){let i=r;if(n.matchBase&&e.length===1&&(i=[a]),this.matchOne(i,e,t))return n.flipNegate?!0:!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return Ne.defaults(e).Minimatch}};Ne.AST=je,Ne.Minimatch=st,Ne.escape=Me,Ne.unescape=he;const ct={};function lt(){throw Error(`gunzipSync is not available in the browser`)}function ut(){throw Error(`gzipSync is not available in the browser`)}function dt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}function ft(e,t){return Array(t+1).join(e)}function pt(e){return e.replace(/^\n*/,``)}function mt(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
2
2
|
`;)t--;return e.substring(0,t)}function ht(e){return mt(pt(e))}var gt=`ADDRESS.ARTICLE.ASIDE.AUDIO.BLOCKQUOTE.BODY.CANVAS.CENTER.DD.DIR.DIV.DL.DT.FIELDSET.FIGCAPTION.FIGURE.FOOTER.FORM.FRAMESET.H1.H2.H3.H4.H5.H6.HEADER.HGROUP.HR.HTML.ISINDEX.LI.MAIN.MENU.NAV.NOFRAMES.NOSCRIPT.OL.OUTPUT.P.PRE.SECTION.TABLE.TBODY.TD.TFOOT.TH.THEAD.TR.UL`.split(`.`);function _t(e){return wt(e,gt)}var vt=[`AREA`,`BASE`,`BR`,`COL`,`COMMAND`,`EMBED`,`HR`,`IMG`,`INPUT`,`KEYGEN`,`LINK`,`META`,`PARAM`,`SOURCE`,`TRACK`,`WBR`];function yt(e){return wt(e,vt)}function bt(e){return Tt(e,vt)}var xt=[`A`,`TABLE`,`THEAD`,`TBODY`,`TFOOT`,`TH`,`TD`,`IFRAME`,`SCRIPT`,`AUDIO`,`VIDEO`];function St(e){return wt(e,xt)}function Ct(e){return Tt(e,xt)}function wt(e,t){return t.indexOf(e.nodeName)>=0}function Tt(e,t){return e.getElementsByTagName&&t.some(function(t){return e.getElementsByTagName(t).length})}var Et=[[/\\/g,`\\\\`],[/\*/g,`\\*`],[/^-/g,`\\-`],[/^\+ /g,`\\+ `],[/^(=+)/g,`\\$1`],[/^(#{1,6}) /g,`\\$1 `],[/`/g,"\\`"],[/^~~~/g,`\\~~~`],[/\[/g,`\\[`],[/\]/g,`\\]`],[/^>/g,`\\>`],[/_/g,`\\_`],[/^(\d+)\. /g,`$1\\. `]];function Dt(e){return Et.reduce(function(e,t){return e.replace(t[0],t[1])},e)}var Ot={};Ot.paragraph={filter:`p`,replacement:function(e){return`
|
|
3
3
|
|
|
4
4
|
`+e+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./providers-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./providers-D2HM3Gid.js";import{f as n}from"./account-store-PyDP25J-.js";var r=class{resolve;providerId;now;#e=null;#t=null;#n=null;#r=null;constructor(e,t,n=Date.now){this.resolve=e,this.providerId=t,this.now=n}#i(e){return e===`ok`?6e4:e===`unsupported`?18e5:3e5}isStale(){let e=this.#e;return!e||this.#t!==this.providerId()||this.now()-e.at>=this.#i(e.outcome)}snapshot(){return this.#t===this.providerId()?this.#e?.window??null:null}async refresh(e={}){if(!e.force&&!this.isStale())return this.snapshot();let t=this.providerId();return this.#n!==null&&this.#r===t?this.#n:(this.#n=this.resolve().then(e=>{let n=e?{...e,at:this.now()}:null;return this.#a(t,n?`ok`:`unsupported`,n),n}).catch(()=>{let e=this.snapshot();return this.#a(t,`failed`,e),e}).finally(()=>{this.#r===t&&(this.#n=null,this.#r=null)}),this.#r=t,this.#n)}#a(e,t,n){e===this.providerId()&&(this.#t=e,this.#e={outcome:t,window:n,at:this.now()})}clear(){this.#e=null,this.#t=null}},i=e({clearBudgetWindowCache:()=>u,getBudgetWindowSnapshot:()=>c,refreshBudgetWindow:()=>l});async function a(){let e=n();if(!e)return null;let r=t(e);if(!r?.getBudgetUsage)return null;let i=await r.getBudgetUsage();return i?{...i,providerId:e}:null}function o(){try{return n()}catch{return``}}const s=new r(a,o);function c(){return s.snapshot()}function l(e){return s.refresh(e)}function u(){s.clear()}export{l as i,u as n,c as r,i as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";const t={assign:0,create:0,clone:0,discard:0,update:0};function n(e,n){return t.assign+=1,{...e,...n}}function r(e,t,n){return e>=t&&e<=n}function i(e){return e===8205}function a(e){return r(e,55296,56319)}function o(e){return r(e,127462,127487)}function ee(e){return r(e,65024,65039)}function te(e){return r(e,768,879)||r(e,6832,6911)||r(e,7616,7679)||r(e,65056,65071)}function ne(e){return e>65535?2:1}function re(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(te(n)||ee(n))t+=ne(n);else break}return t}function ie(e,t){let n=e.codePointAt(t),r=t+ne(n);for(r=re(e,r);r<e.length-1&&e[r]===``;){let t=e.codePointAt(r+1);r+=1+ne(t),r=re(e,r)}return o(n)&&r<e.length&&o(e.codePointAt(r))&&(r+=ne(e.codePointAt(r))),r}function ae(e){return a(e)||te(e)||ee(e)||i(e)}function oe(e){let t=0,n=0;for(;n<e.length;)n=ie(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=ie(e,r),n++,n>=t)return!0;return!1}function ce(e,t){let n=0,r=0;for(;r<e.length;)if(r=ie(e,r),n++,n>t)return!1;return!0}function le(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(ae(e.charCodeAt(n)))return se(e,t);if(n++,n>=t)return!0}return!1}function ue(e,t){let n=0;for(;n<e.length;){if(ae(e.charCodeAt(n)))return ce(e,t);if(n++,n>t)return!1}return!0}var de=e({Entries:()=>Fe,EntriesRegExp:()=>Pe,Every:()=>je,EveryAll:()=>Me,GraphemeCount:()=>Oe,HasPropertyKey:()=>p,IsArray:()=>fe,IsBigInt:()=>s,IsBoolean:()=>pe,IsClassInstance:()=>Ee,IsConstructor:()=>me,IsDeepEqual:()=>Be,IsEqual:()=>d,IsFunction:()=>he,IsGreaterEqualThan:()=>we,IsGreaterThan:()=>xe,IsInteger:()=>ge,IsLessEqualThan:()=>Ce,IsLessThan:()=>Se,IsMaxLength:()=>ke,IsMinLength:()=>Ae,IsMultipleOf:()=>Te,IsNull:()=>_e,IsNumber:()=>c,IsObject:()=>l,IsObjectNotArray:()=>ve,IsString:()=>u,IsSymbol:()=>ye,IsUndefined:()=>be,IsUnsafePropertyKey:()=>Ne,IsValueLike:()=>De,Keys:()=>m,ShiftLeft:()=>f,Symbols:()=>Ie,Values:()=>Le});function fe(e){return Array.isArray(e)}function s(e){return d(typeof e,`bigint`)}function pe(e){return d(typeof e,`boolean`)}function me(e){if(be(e)||!he(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function he(e){return d(typeof e,`function`)}function ge(e){return Number.isInteger(e)}function _e(e){return d(e,null)}function c(e){return Number.isFinite(e)}function ve(e){return l(e)&&!fe(e)}function l(e){return d(typeof e,`object`)&&!_e(e)}function u(e){return d(typeof e,`string`)}function ye(e){return d(typeof e,`symbol`)}function be(e){return d(e,void 0)}function d(e,t){return e===t}function xe(e,t){return e>t}function Se(e,t){return e<t}function Ce(e,t){return e<=t}function we(e,t){return e>=t}function Te(e,t){if(s(e)||s(t))return BigInt(e)%BigInt(t)===0n;if(!c(e)||ge(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 Ee(e){if(!l(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!_e(t)&&d(typeof t.constructor,`function`)&&!(d(t.constructor,globalThis.Object)||d(t.constructor.name,`Object`))}function De(e){return s(e)||pe(e)||_e(e)||c(e)||u(e)||be(e)}function Oe(e){return oe(e)}function ke(e,t){return ue(e,t)}function Ae(e,t){return le(e,t)}function je(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Me(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function f(e,t,n){return d(e.length,0)?n():t(e[0],e.slice(1))}function Ne(e){return d(e,`__proto__`)||d(e,`constructor`)||d(e,`prototype`)}function p(e,t){return Ne(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Pe(e){return m(e).map(t=>[RegExp(`^${t}$`),e[t]])}function Fe(e){return Object.entries(e)}function m(e){return Object.getOwnPropertyNames(e)}function Ie(e){return Object.getOwnPropertySymbols(e)}function Le(e){return Object.values(e)}function Re(e,t){if(!l(t))return!1;let n=m(e);return d(n.length,m(t).length)&&n.every(n=>Be(e[n],t[n]))}function ze(e,t){return fe(t)&&d(e.length,t.length)&&e.every((n,r)=>Be(e[r],t[r]))}function Be(e,t){return fe(e)?ze(e,t):l(e)?Re(e,t):d(e,t)}function Ve(e){return e instanceof Boolean}function He(e){return e instanceof Number}function Ue(e){return e instanceof String}function We(e){return globalThis.ArrayBuffer.isView(e)}function Ge(e){return e instanceof globalThis.RegExp}function Ke(e){return e instanceof globalThis.Date}function qe(e){return e instanceof globalThis.Set}function Je(e){return e instanceof globalThis.Map}function Ye(e){return e}function Xe(e){return p(e,`~kind`)||p(e,`~unsafe`)}function Ze(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(Ne(e))continue;let r=n[e];p(r,`value`)&&Object.defineProperty(t,e,{...r,value:at(r.value)})}return t}function Qe(e){let t={};for(let n of m(e))Ne(n)||(t[n]=at(e[n]));for(let n of Ie(e))t[n]=at(e[n]);return t}function $e(e){return Ee(e)?Ye(e):Xe(e)?Ze(e):Qe(e)}function et(e){return e.map(e=>at(e))}function tt(e){return e.slice()}function nt(e){return new RegExp(e.source,e.flags)}function rt(e){return new Map(at([...e.entries()]))}function it(e){return new Set(at([...e.values()]))}function at(e){return We(e)?tt(e):Ge(e)?nt(e):Je(e)?rt(e):qe(e)?it(e):fe(e)?et(e):l(e)?$e(e):e}function ot(e){return t.clone+=1,at(e)}const st={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function ct(){return st}function lt(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 ut(e,t){return{...e,...t}}function h(e,n,r={}){t.create+=1;let i=ct(),a=ut(n,r),o=i.enumerableKind?ut(a,e):lt(a,e);return i.immutableTypes?Object.freeze(o):o}function g(e,n){t.discard+=1;let r={},i=Object.getOwnPropertyDescriptors(ot(e)),a=new Set(n);for(let e of Object.keys(i))a.has(e)||Object.defineProperty(r,e,i[e]);return r}function _(e,n,r){t.update+=1;let i=ct(),a=ot(e);for(let e of Object.keys(n))Object.defineProperty(a,e,{configurable:!0,writable:!0,enumerable:i.enumerableKind,value:n[e]});for(let e of Object.keys(r))Object.defineProperty(a,e,{configurable:!0,enumerable:!0,writable:!0,value:r[e]});return a}function v(e,t){return l(e)&&p(e,`~kind`)&&d(e[`~kind`],t)}function y(e){return l(e)}function b(e,t,n){return h({"~kind":`Deferred`},{type:`deferred`,action:e,parameters:t,options:n},{})}function dt(e){return v(e,`Deferred`)}function ft(e){return _(e,{"~readonly":!0},{})}function pt(e,t){return _(ft(e),{},t)}function mt(e,t,n,r){return pt($(e,t,n),r)}function ht(e){return _(e,{"~optional":!0},{})}function gt(e,t){return _(ht(e),{},t)}function _t(e,t,n,r){return gt($(e,t,n),r)}function vt(e,t){return h({"~kind":`Array`},{type:`array`,items:e},t)}function x(e){return v(e,`Array`)}function yt(e){return g(e,[`~kind`,`type`,`items`])}function bt(e,t,n={}){return h({"~kind":`Constructor`},{type:`constructor`,parameters:e,instanceType:t},n)}function xt(e){return v(e,`Constructor`)}function St(e){return g(e,[`~kind`,`type`,`parameters`,`instanceType`])}function Ct(e,t,n={}){return h({"~kind":`Function`},{type:`function`,parameters:e,returnType:t},n)}function wt(e){return v(e,`Function`)}function Tt(e){return g(e,[`~kind`,`type`,`parameters`,`returnType`])}function Et(e,t){return h({"~kind":`Ref`},{$ref:e},t)}function S(e){return v(e,`Ref`)}function Dt(e,t){return h({"~kind":`Generic`},{type:`generic`,parameters:e,expression:t})}function Ot(e){return v(e,`Generic`)}function kt(e){return h({"~kind":`Any`},{},e)}function At(e){return v(e,`Any`)}function C(e){return h({"~kind":`Never`},{not:{}},e)}function jt(e){return v(e,`Never`)}function Mt(e,t={}){return gt(e,t)}function Nt(e){return Mt(e)}function w(e){return y(e)&&p(e,`~optional`)}function Pt(e){return m(e).filter(t=>!w(e[t]))}function Ft(e){return m(e)}function It(e){return Le(e)}function T(e,t={}){let n=Pt(e);return h({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function E(e){return v(e,`Object`)}function Lt(e){return g(e,[`~kind`,`type`,`properties`,`required`])}function Rt(e){return h({"~kind":`Unknown`},{},e)}function D(e){return v(e,`Unknown`)}function zt(e,t,n){return h({"~kind":`Cyclic`},{$defs:m(e).reduce((t,n)=>({...t,[n]:_(e[n],{},{$id:n})}),{}),$ref:t},n)}function Bt(e){return v(e,`Cyclic`)}function Vt(e){return ve(e)&&p(e,`~unsafe`)&&_e(e[`~unsafe`])}function O(e){return v(e,`Infer`)}function Ht(e,t,n,r={}){return h({"~kind":`Dependent`},{if:e,then:t,else:n},r)}function k(e){return v(e,`Dependent`)}function Ut(e){return g(e,[`~kind`,`if`,`then`,`else`])}function Wt(e){return v(e,`Enum`)}function Gt(e,t={}){return h({"~kind":`Intersect`},{allOf:e},t)}function A(e){return v(e,`Intersect`)}function Kt(e){return g(e,[`~kind`,`allOf`])}function j(){throw Error(`Unreachable`)}var qt=e({Hash:()=>xn,HashCode:()=>bn});function Jt(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 Yt(e){return typeof e==`number`}var M;(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`})(M||={});let Xt=BigInt(`14695981039346656037`);const[Zt,Qt]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],$t=Array.from({length:256}).map((e,t)=>BigInt(t)),en=new Float64Array(1),tn=new DataView(en.buffer),nn=new Uint8Array(en.buffer);function N(e){Xt^=$t[e],Xt=Xt*Zt%Qt}function rn(e){N(M.Array);for(let t of e)yn(t)}function an(e){N(M.BigInt),tn.setBigInt64(0,e);for(let e of nn)N(e)}function on(e){N(M.Boolean),N(+!!e)}function sn(e){N(M.Constructor),yn(e.toString())}function cn(e){N(M.Date),yn(e.getTime())}function ln(e){N(M.Function),yn(e.toString())}function un(e){N(M.Null)}function dn(e){N(M.Number),tn.setFloat64(0,e,!0);for(let e of nn)N(e)}function fn(e){N(M.Object);for(let t of Jt(e).sort())yn(t),yn(e[t])}function pn(e){N(M.RegExp),hn(e.toString())}const mn=new TextEncoder;function hn(e){N(M.String);for(let t of mn.encode(e))N(t)}function gn(e){N(M.Symbol),yn(e.toString())}function _n(e){N(M.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)N(t[e])}function vn(e){return N(M.Undefined)}function yn(e){return We(e)?_n(e):Ke(e)?cn(e):Ge(e)?pn(e):Ve(e)?on(e.valueOf()):Ue(e)?hn(e.valueOf()):He(e)?dn(e.valueOf()):Yt(e)?dn(e):fe(e)?rn(e):pe(e)?on(e):s(e)?an(e):me(e)?sn(e):_e(e)?un(e):l(e)?fn(e):u(e)?hn(e):ye(e)?gn(e):be(e)?vn(e):he(e)?ln(e):j()}function bn(e){return Xt=BigInt(`14695981039346656037`),yn(e),Xt}function xn(e){return bn(e).toString(16).padStart(16,`0`)}function Sn(e){return y(e)&&p(e,`~codec`)&&l(e[`~codec`])&&p(e[`~codec`],`encode`)&&p(e[`~codec`],`decode`)}function Cn(e){return y(e)&&p(e,`~immutable`)}function wn(e,t={}){return pt(e,t)}function Tn(e){return y(e)&&p(e,`~readonly`)}function En(e){return h({"~kind":`BigInt`},{type:`bigint`},e)}function Dn(e){return v(e,`BigInt`)}function On(e){return v(e,`Boolean`)}const kn=`-?(?:0|[1-9][0-9]*)`;function An(e){return h({"~kind":`Integer`},{type:`integer`},e)}function jn(e){return v(e,`Integer`)}var Mn=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function Nn(e){return s(e)?`bigint`:pe(e)?`boolean`:c(e)?`number`:u(e)?`string`:(()=>{throw new Mn(e)})()}function P(e,t){return h({"~kind":`Literal`},{type:Nn(e),const:e},t)}function Pn(e){return s(e)||pe(e)||c(e)||u(e)}function Fn(e){return F(e)&&s(e.const)}function In(e){return F(e)&&pe(e.const)}function Ln(e){return F(e)&&c(e.const)}function Rn(e){return F(e)&&u(e.const)}function F(e){return v(e,`Literal`)}function zn(e){return h({"~kind":`Null`},{type:`null`},e)}function Bn(e){return v(e,`Null`)}const Vn=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function Hn(e){return h({"~kind":`Number`},{type:`number`},e)}function I(e){return v(e,`Number`)}function Un(e){return h({"~kind":`Symbol`},{type:`symbol`},e)}function Wn(e){return v(e,`Symbol`)}function Gn(e){return h({"~kind":`String`},{type:`string`},e)}function Kn(e){return v(e,`String`)}function L(e,t={}){return h({"~kind":`Union`},{anyOf:e},t)}function R(e){return v(e,`Union`)}function qn(e){return g(e,[`~kind`,`anyOf`])}function Jn(e){let t=ma(e);return d(t.length,2)?t[0]:[]}function Yn(e){return!0}function Xn(e){return f(e,(e,t)=>Qn(e)?Xn(t):!1,()=>!0)}function Zn(e){return!d(e.length,0)&&Xn(e)}function Qn(e){return R(e)?Zn(e.anyOf):F(e)?Yn(e.const):!1}function $n(e){return Zn(e)}function er(e){return h({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function tr(e,t,n=[]){return f(e,(e,r)=>tr(r,t,[...n,`${e}${t}`]),()=>n)}function nr(e,t){return d(e.length,0)?[`${t}`]:tr(e,t)}function rr(e,t,n=[]){return f(t,(t,r)=>rr(e,r,[...n,...ir(e,t)]),()=>n)}function ir(e,t){return R(t)?rr(e,t.anyOf):F(t)?nr(e,t.const):j()}function ar(e,t){return f(t,(t,n)=>ar(ir(e,t),n),()=>e)}function or(e){return e.map(e=>P(e))}function sr(e){return L(or(ar([],e)))}function cr(e){return d(e.length,0)?j():d(e.length,1)&&F(e[0])?e[0]:sr(e)}function lr(e){let t=Jn(e);return d(t.length,0)?Gn():$n(t)?cr(t):er(e)}function ur(e){let t=lr(e);return W(t)?Gn():t}function dr(e,t){return h({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function fr(e){return dr(pi,e)}function pr(e){return T({true:e,false:e})}function z(e,t={}){let[n,r,i]=[e,e.length,!1];return h({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function B(e){return v(e,`Tuple`)}function mr(e){return g(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function hr(e){return g(e,[`~readonly`])}function gr(e,t){return _(hr(e),{},t)}function _r(e,t,n,r){return gr($(e,t,n),r)}function vr(e,t={}){return gr(e,t)}function yr(e){return g(e,[`~optional`])}function br(e,t){return _(yr(e),{},t)}function xr(e,t,n,r){return br($(e,t,n),r)}function Sr(e,t={}){return br(e,t)}function Cr(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function wr(e){return T(Cr(e.items))}function Tr(e,t){return Tn(e)?!!Tn(t):!1}function Er(e,t){return w(e)?!!w(t):!1}function Dr(e,t){let n=Tr(e,t),r=Er(e,t),i=vr(Sr(V([e,t])));return n&&r?wn(Mt(i)):n&&!r?wn(i):!n&&r?Mt(i):i}function Or(e,t,n){return n in e?n in t?Dr(e[n],t[n]):e[n]:n in t?t[n]:C()}function kr(e,t){return[...new Set([...m(t),...m(e)])].reduce((n,r)=>({...n,[r]:Or(e,t,r)}),{})}function Ar(e){return E(e)?e.properties:B(e)?Cr(e.items):j()}function jr(e,t){return T(kr(Ar(e),Ar(t)))}function Mr(e,t){let n=Ns(e,t);return d(n,`left-inside`)?e:d(n,`right-inside`)||d(n,`equal`)?t:C()}function Nr(e){return E(e)||B(e)}function Pr(e,t){let n=R(e),r=R(t);return n||r}function Fr(e,t){let n=Kr(e),r=Kr(t),i=Pr(n,r),a=Nr(n),o=Nr(r);return i?V([n,r]):a&&o?jr(n,r):a&&!o?n:!a&&o?r:Mr(n,r)}function Ir(e,t,n=[]){return f(t,(t,r)=>Ir(e,r,[...n,Fr(e,t)]),()=>d(n.length,0)?[e]:n)}function Lr(e,t,n=[]){return f(e,(e,r)=>Lr(r,t,[...n,...Rr([e],t)]),()=>n)}function Rr(e,t=[]){return f(e,(e,n)=>R(e)?Rr(n,Lr(e.anyOf,t)):Rr(n,Ir(e,t)),()=>t)}function zr(e,t){return q(Ms({},e,t))?[]:[e]}function Br(e,t){return e.reduce((e,n)=>[...e,...zr(n,t)],[])}function Vr(e,t){let n=Kr(e);return Gr(Br(R(n)?n.anyOf:[n],t))}function Hr(e,t,n){return Gr([Gt([e,t]),Vr(n,e)])}function Ur(e){return Gr(e.map(e=>P(e)))}function V(e){return qr(Rs(Rr(e)))}function Wr(e){return Kr(ur(e))}function Gr(e){return qr(Rs(e))}function Kr(e){return k(e)?Hr(e.if,e.then,e.else):Wt(e)?Ur(e.enum):A(e)?V(e.allOf):W(e)?Wr(e.pattern):R(e)?Gr(e.anyOf):e}function qr(e){return d(e.length,1)?e[0]:d(e.length,0)?C():L(e)}function Jr(e,t){return ci(Ur(e),t)}function Yr(e,t){return dr(di,t)}function Xr(e,t){return ci(V(e),t)}function Zr(e,t){return u(e)||c(e)?T({[e]:t}):d(e,!1)?T({false:t}):d(e,!0)?T({true:t}):T({})}function Qr(e,t){return dr(fi,t)}function $r(e,t){return p(e,`pattern`)&&(u(e.pattern)||e.pattern instanceof RegExp)?dr(e.pattern.toString(),t):dr(pi,t)}function ei(e,t){return $n(Jn(e))?ci(Wr(e),t):dr(e,t)}function ti(e){return R(e)?ni(e.anyOf):[e]}function ni(e){return e.reduce((e,t)=>[...e,...ti(t)],[])}function ri(e){return e.some(e=>Kn(e)||I(e)||jn(e))}function ii(e,t){return d(ri(e),!0)?dr(pi,t):void 0}function ai(e,t){return e.reduce((e,n)=>F(n)&&(u(n.const)||c(n.const))?{...e,[n.const]:t}:e,{})}function oi(e,t){return T(ai(e,t))}function si(e,t){let n=ni(e),r=ii(n,t);return y(r)?r:oi(n,t)}function ci(e,t){return At(e)?fr(t):On(e)?pr(t):Wt(e)?Jr(e.enum,t):jn(e)?Yr(e,t):A(e)?Xr(e.allOf,t):F(e)?Zr(e.const,t):I(e)?Qr(e,t):R(e)?si(e.anyOf,t):Kn(e)?$r(e,t):W(e)?ei(e.pattern,t):T({})}function li(e,t,n){return Q([e])?_(ci(e,t),{},n):mi(e,t,n)}function ui(e,t,n,r,i){return li($(e,t,n),$(e,t,r),i)}const di=`^${kn}$`,fi=`^${Vn}$`,pi=`^.*$`;function mi(e,t,n={}){return b(`Record`,[e,t],n)}function hi(e,t,n={}){return li(e,t,n)}function gi(e,t){return dr(e,t)}function _i(e){return d(e,pi)?Gn():d(e,di)?An():d(e,fi)?Hn():lr(e)}function vi(e){return m(e.patternProperties)[0]}function yi(e){return _i(vi(e))}function bi(e){return e.patternProperties[vi(e)]}function xi(e){return v(e,`Record`)}function Si(e){return h({"~kind":`Rest`},{type:`rest`,items:e},{})}function Ci(e){return v(e,`Rest`)}function wi(e){return v(e,`This`)}function Ti(e){return h({"~kind":`Undefined`},{type:`undefined`},e)}function Ei(e){return v(e,`Undefined`)}function Di(e){return v(e,`Void`)}function Oi(e){return En()}function ki(e){return Gn()}function Ai(e){return Hn()}function ji(e){return An()}function Mi(e){return C()}function Ni(e){return P(e)}function Pi(e){return e}function Fi(e){return L(e[1])}function Ii(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Li(e){return[e[0],...e[1]]}function Ri(e){return e}function zi(e){return e[1]}function Bi(e){return d(e.length,2)}function Vi(e,t,n){return Bi(e)?t(e[0],e[1]):n()}function Hi(e,t){return d(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Ui(e,t){for(let n=0;n<e.length;n++){let r=Hi(e[n],t);if(Bi(r))return r}return[]}function Wi(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}const Gi=[...Wi(97,122),...Wi(65,90)],Ki=[`0`,...Wi(49,57)];function qi(e){let t=e.indexOf(`*/`);return d(t,-1)?``:e.slice(t+2)}function Ji(e){let t=e.indexOf(`
|
|
2
|
+
`);return d(t,-1)?``:e.slice(t)}function Yi(e){return e.replace(/^[ \t\r\f\v]+/,``)}function Xi(e){let t=Yi(e);return t.startsWith(`/*`)?Xi(qi(t.slice(2))):t.startsWith(`//`)?Xi(Ji(t.slice(2))):t}function Zi(e){let t=e.trimStart();return t.startsWith(`/*`)?Zi(qi(t.slice(2))):t.startsWith(`//`)?Zi(Ji(t.slice(2))):t}[...Ki];function Qi(e,t){return Ui([e],t)}function H(e,t){return d(e,``)?[``,t]:e.startsWith(`
|
|
3
|
+
`)?Qi(e,Xi(t)):e.startsWith(` `)?Qi(e,t):Qi(e,Zi(t))}[...Gi,...Ki],[...Ki];function $i(e){return d(e,``)?[]:[e.slice(0,1),e.slice(1)]}function ea(e,t){return f(e,(e,n)=>t.startsWith(e)?!0:ea(n,t),()=>!1)}function ta(e,t,n=``){return Vi($i(t),(r,i)=>ea(e,t)?[n,t]:ta(e,i,`${n}${r}`),()=>[])}function na(e,t){return Vi(ta(e,t),(e,t)=>d(e,``)?[]:[e,t],()=>[])}const U=(e,t,n=()=>[])=>e.length===2?t(e):n(),ra=e=>U(H(`-?(?:0|[1-9][0-9]*)n`,e),([e,t])=>[Oi(e),t]),ia=e=>U(H(`.*`,e),([e,t])=>[ki(e),t]),aa=e=>U(H(`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,e),([e,t])=>[Ai(e),t]),oa=e=>U(H(`-?(?:0|[1-9][0-9]*)`,e),([e,t])=>[ji(e),t]),sa=e=>U(H(`(?!)`,e),([e,t])=>[Mi(e),t]),ca=e=>U(na([`-?(?:0|[1-9][0-9]*)n`,`.*`,`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,`-?(?:0|[1-9][0-9]*)`,`(?!)`,`(`,`)`,`$`,`|`],e),([e,t])=>[Ni(e),t]),la=e=>U(U(ra(e),([e,t])=>[e,t],()=>U(ia(e),([e,t])=>[e,t],()=>U(aa(e),([e,t])=>[e,t],()=>U(oa(e),([e,t])=>[e,t],()=>U(sa(e),([e,t])=>[e,t],()=>U(ua(e),([e,t])=>[e,t],()=>U(ca(e),([e,t])=>[e,t],()=>[]))))))),([e,t])=>[Pi(e),t]),ua=e=>U(U(H(`(`,e),([e,t])=>U(pa(t),([t,n])=>U(H(`)`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[Fi(e),t]),da=e=>U(U(U(fa(e),([e,t])=>U(H(`|`,t),([t,n])=>U(da(n),([n,r])=>[[e,t,n],r]))),([e,t])=>[e,t],()=>U(U(fa(e),([e,t])=>[[e],t]),([e,t])=>[e,t],()=>U([[],e],([e,t])=>[e,t],()=>[]))),([e,t])=>[Ii(e),t]),fa=e=>U(U(la(e),([e,t])=>U(pa(t),([t,n])=>[[e,t],n])),([e,t])=>[Li(e),t]),pa=e=>U(U(da(e),([e,t])=>[e,t],()=>U(fa(e),([e,t])=>[e,t],()=>[])),([e,t])=>[Ri(e),t]),ma=e=>U(U(H(`^`,e),([e,t])=>U(pa(t),([t,n])=>U(H(`$`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[zi(e),t]);function ha(e){return e.join(`|`)}function ga(e){return e.slice(1,e.length-1)}function _a(e,t,n){return Oa(t,`${n}${e}`)}function va(e,t){return Oa(e,`${t}-?(?:0|[1-9][0-9]*)n`)}function ya(e,t){return Oa(e,`${t}${kn}`)}function ba(e,t){return Oa(e,`${t}${Vn}`)}function xa(e,t){return Da(L([P(`false`),P(`true`)]),e,t)}function Sa(e,t){return Oa(e,`${t}.*`)}function Ca(e,t,n){return Oa(t,`${n}${ga(e)}`)}function wa(e,t,n){return Da(ja(e,{}),t,n)}function Ta(e,t,n){return Da(Ur(e),t,n)}function Ea(e,t,n,r=[]){return f(e,(e,i)=>Ea(i,t,n,[...r,Da(e,[],``)]),()=>Oa(t,`${n}(${ha(r)})`))}function Da(e,t,n){return Wt(e)?Ta(e.enum,t,n):jn(e)?ya(t,n):F(e)?_a(e.const,t,n):Dn(e)?va(t,n):On(e)?xa(t,n):I(e)?ba(t,n):Kn(e)?Sa(t,n):W(e)?Ca(e.pattern,t,n):Pa(e)?wa(e.parameters[0],t,n):R(e)?Ea(e.anyOf,t,n):`(?!)`}function Oa(e,t){return f(e,(e,n)=>Da(e,n,t),()=>t)}function ka(e){return`^${Oa(e,``)}$`}function Aa(e){return er(ka(e))}function ja(e,t){return Q(e)?_(Aa(e),{},t):Na(e,t)}function Ma(e,t,n,r){return ja(Fd(e,t,n),r)}function Na(e,t={}){return b(`TemplateLiteral`,[e],t)}function Pa(e){return y(e)&&p(e,`action`)&&d(e.action,`TemplateLiteral`)}function W(e){return v(e,`TemplateLiteral`)}function Fa(e){return h({"~kind":`ExtendsUnion`},{inferred:e})}function Ia(e){return l(e)&&p(e,`~kind`)&&p(e,`inferred`)&&d(e[`~kind`],`ExtendsUnion`)&&l(e.inferred)}function G(e){return h({"~kind":`ExtendsTrue`},{inferred:e})}function La(e){return l(e)&&p(e,`~kind`)&&p(e,`inferred`)&&d(e[`~kind`],`ExtendsTrue`)&&l(e.inferred)}function K(){return h({"~kind":`ExtendsFalse`},{})}function Ra(e){return l(e)&&p(e,`~kind`)&&d(e[`~kind`],`ExtendsFalse`)}function q(e){return Ia(e)||La(e)}function J(e,t,n){return q(e)?t(e.inferred):n()}function za(e,t,r,i){return J(X(e,r,i),i=>G(n(n(e,i),{[t]:r})),()=>K())}function Ba(e,t){return G(e)}function Va(e,t,n,r,i){return J(X(e,t,n),e=>J(X(e,t,r),e=>G(e),()=>K()),()=>J(X(e,t,i),e=>G(e),()=>K()))}function Ha(e,t,n){return X(e,t,Ur(n))}function Ua(e,t,n){return f(n,(n,r)=>J(X(e,t,n),e=>Ua(e,t,r),()=>K()),()=>G(e))}function Wa(e,t,n){return X(e,t,Wr(n))}function Ga(e,t,n){return f(n,(n,r)=>J(X(e,t,n),e=>G(e),()=>Ga(e,t,r)),()=>K())}function Y(e,t,n){return At(n)?Ba(e,t):k(n)?Va(e,t,n.if,n.then,n.else):Wt(n)?Ha(e,t,n.enum):O(n)?za(e,n.name,t,n.extends):A(n)?Ua(e,t,n.allOf):W(n)?Wa(e,t,n.pattern):R(n)?Ga(e,t,n.anyOf):D(n)?G(e):K()}function Ka(e,t,n){return O(n)?Y(e,t,n):At(n)||D(n)?G(e):Fa(e)}function qa(e,t){let n=Cn(e),r=Cn(t);return n&&r||!n&&r?!0:!(n&&!r)}function Ja(e,t,n,r){return x(r)?qa(t,r)?X(e,n,r.items):K():Y(e,t,r)}function Ya(e,t,n){return Dn(n)?G(e):Y(e,t,n)}function Xa(e,t,n){return On(n)?G(e):Y(e,t,n)}function Za(e,t,n,r,i){let a=O(r)?t:r,o=O(r)?r:t,ee=w(t),te=w(r);return!ee&&te?K():J(X(e,a,o),e=>eo(e,n,i),()=>K())}function Qa(e,t,n,r){return f(r,(r,i)=>Za(e,t,n,r,i),()=>w(t)?G(e):K())}function $a(e,t,n){return f(t,(t,r)=>Qa(e,t,r,n),()=>G(e))}function eo(e,t,n){return $a(e,t,n)}function to(e,t,n){return Di(n)?G(e):X(e,t,n)}function no(e,t,n,r){return At(r)||D(r)?G(e):xt(r)?J(eo(e,t,r.parameters),e=>to(e,n,r.instanceType),()=>K()):K()}function ro(e,t,n,r,i){return J(X(e,t,i),()=>X(e,n,i),()=>X(e,r,i))}function io(e,t,n){return X(e,Ur(t),n)}function ao(e,t,n,r){return At(r)||D(r)?G(e):wt(r)?J(eo(e,t,r.parameters),e=>to(e,n,r.returnType),()=>K()):K()}function oo(e,t,n){return jn(n)||I(n)?G(e):Y(e,t,n)}function so(e,t,n){return X(e,V(t),n)}function co(e,t,n){return t===n?G(e):K()}function lo(e,t,n){return F(n)?co(e,t,n.const):Dn(n)?G(e):Y(e,P(t),n)}function uo(e,t,n){return F(n)?co(e,t,n.const):On(n)?G(e):Y(e,P(t),n)}function fo(e,t,n){return F(n)?co(e,t,n.const):I(n)?G(e):Y(e,P(t),n)}function po(e,t,n){return F(n)?co(e,t,n.const):Kn(n)?G(e):Y(e,P(t),n)}function mo(e,t,n){return s(t.const)?lo(e,t.const,n):pe(t.const)?uo(e,t.const,n):c(t.const)?fo(e,t.const,n):u(t.const)?po(e,t.const,n):j()}function ho(e,t,n){return O(n)?Y(e,t,n):G(e)}function go(e,t,n){return Bn(n)?G(e):Y(e,t,n)}function _o(e,t,n){return I(n)?G(e):Y(e,t,n)}function vo(e,t,n){return w(t)?w(n)?G(e):K():G(e)}function yo(e,t,n){return O(n)&&jt(n.extends)?K():J(X(e,t,n),e=>vo(e,t,n),()=>K())}function bo(e,t){return e.reduce((e,n)=>n in t&&q(t[n])?{...e,...t[n].inferred}:j(),{})}function xo(e,t,r){let i={};for(let a of m(r))i[a]=a in t?yo({},t[a],r[a]):w(r[a])?O(r[a])?G(n(e,{[r[a].name]:r[a].extends})):G(e):K();let a=Le(i).every(e=>q(e)),o=a?bo(m(i),i):{};return a?G(o):K()}function So(e,t,r){let i=xo(e,t,r);return q(i)?G(n(e,i.inferred)):K()}function Co(e,t,n){return So(e,t,n)}function wo(e,t){return m(t).reduce((n,r)=>({...n,[r]:p(e,r)?R(n[r])?L([...n[r].anyOf,t[r]]):L([e[r],t[r]]):t[r]}),e)}function To(e,t,n,r){return f(t,(t,i)=>J(X({},e[t],n),t=>To(e,i,n,wo(r,t)),()=>K()),()=>G(r))}function Eo(e,t,n,r){return To(t,m(t),r,e)}function Do(e,t,n){return xi(n)?Eo(e,t,vi(n),bi(n)):E(n)?Co(e,t,n.properties):Y(e,T(t),n)}function Oo(e,t){return d(m(t).length,0)?G(e):K()}function ko(e,t,n,r,i){return X(e,n,i)}function Ao(e,t,n,r){return xi(r)?ko(e,_i(t),n,_i(vi(r)),bi(r)):E(r)?Oo(e,r.properties):At(r)||D(r)?G(e):K()}function jo(e,t,n){return Kn(n)?G(e):Y(e,t,n)}function Mo(e,t,n){return Wn(n)?G(e):Y(e,t,n)}function No(e,t,n){return X(e,Wr(t),n)}function Po(e,t){return h({"~kind":`Inferrable`},{name:e,type:t},{})}function Fo(e){return l(e)&&p(e,`~kind`)&&p(e,`name`)&&p(e,`type`)&&d(e[`~kind`],`Inferrable`)&&u(e.name)&&l(e.type)}function Io(e){return Ci(e)?O(e.items)?x(e.items.extends)?Po(e.items.name,e.items.extends.items):D(e.items.extends)?Po(e.items.name,e.items.extends):void 0:j():void 0}function Lo(e){return O(e)?Po(e.name,e.extends):void 0}function Ro(e,t,n=[]){return f(e,(e,r)=>J(X({},e,t),()=>Ro(r,t,[...n,e]),()=>void 0),()=>n)}function zo(e,t,r,i){let a=Ro(r,i);return fe(a)?G(n(e,{[t]:z(a)})):K()}function Bo(e,t,r,i){let a=Ro(r,i);return fe(a)?G(n(e,{[t]:L(a)})):K()}function Vo(e){return[...e].reverse()}function Ho(e,t){return t?Vo(e):e}function Uo(e){let t=e.length>0?e[0]:void 0;return y(y(t)?Io(t):void 0)}function Wo(e,t,n,r,i,a){return J(X(e,n,i),e=>qo(e,t,r,a),()=>K())}function Go(e,t,n,r,i){let a=Io(r);return Fo(a)?zo(e,a.name,Ho(n,t),a.type):f(n,(n,a)=>Wo(e,t,n,a,r,i),()=>K())}function Ko(e,t,n,r){return f(r,(r,i)=>Go(e,t,n,r,i),()=>d(n.length,0)?G(e):K())}function qo(e,t,n,r){return Ko(e,t,n,r)}function Jo(e,t,n){let r=Pd(e,Z([],[]),n),i=Uo(r);return qo(e,i,Ho(t,i),Ho(r,i))}function Yo(e,t,n){let r=Lo(n);return Fo(r)?Bo(e,r.name,t,r.type):f(t,(t,r)=>J(X(e,t,n),e=>Yo(e,r,n),()=>K()),()=>G(e))}function Xo(e,t,n){let r=Pd(e,Z([],[]),t);return B(n)?Jo(e,r,n.items):x(n)?Yo(e,r,n.items):Y(e,z(r),n)}function Zo(e,t,n){return Di(n)||Ei(n)?G(e):Y(e,t,n)}function Qo(e,t,n){return f(n,(n,r)=>J(X(e,t,n),e=>G(e),()=>Qo(e,t,r)),()=>K())}function $o(e,t,n){return f(t,(t,r)=>J(Qo(e,t,n),e=>$o(e,r,n),()=>K()),()=>G(e))}function es(e,t,n){let r=Lo(n);return Fo(r)?Bo(e,r.name,t,r.type):R(n)?$o(e,t,n.anyOf):$o(e,t,[n])}function ts(e,t,n){return O(n)?Y(e,t,n):At(n)||D(n)?G(e):K()}function ns(e,t,n){return Di(n)?G(e):Y(e,t,n)}function X(e,t,n){return At(t)?Ka(e,t,n):x(t)?Ja(e,t,t.items,n):Dn(t)?Ya(e,t,n):On(t)?Xa(e,t,n):xt(t)?no(e,t.parameters,t.instanceType,n):k(t)?ro(e,t.if,t.then,t.else,n):Wt(t)?io(e,t.enum,n):wt(t)?ao(e,t.parameters,t.returnType,n):jn(t)?oo(e,t,n):A(t)?so(e,t.allOf,n):F(t)?mo(e,t,n):jt(t)?ho(e,t,n):Bn(t)?go(e,t,n):I(t)?_o(e,t,n):E(t)?Do(e,t.properties,n):xi(t)?Ao(e,vi(t),bi(t),n):Kn(t)?jo(e,t,n):Wn(t)?Mo(e,t,n):W(t)?No(e,t.pattern,n):B(t)?Xo(e,t.items,n):Ei(t)?Zo(e,t,n):R(t)?es(e,t.anyOf,n):D(t)?ts(e,t,n):Di(t)?ns(e,t,n):K()}function rs(e,t){return V([...e,T(t)])}function is(e,t,n){return Q(e)?_(rs(e,t),{},n):os(e,t,n)}function as(e,t,n,r,i){return is(Fd(e,t,n),Nd(e,t,r),i)}function os(e,t,n={}){return b(`Interface`,[e,t],n)}function ss(e){return y(e)&&p(e,`action`)&&d(e.action,`Interface`)}function cs(e,t,n){return e.includes(n)?!0:ds([...e,n],t,t[n])}function ls(e,t,n){return us(e,t,It(n))}function us(e,t,n){return f(n,(n,r)=>ds(e,t,n)?!0:us(e,t,r),()=>!1)}function ds(e,t,n){return S(n)?cs(e,t,n.$ref):x(n)?ds(e,t,n.items):xt(n)?us(e,t,[...n.parameters,n.instanceType]):wt(n)?us(e,t,[...n.parameters,n.returnType]):ss(n)?ls(e,t,n.parameters[1]):A(n)?us(e,t,n.allOf):E(n)?ls(e,t,n.properties):R(n)?us(e,t,n.anyOf):B(n)?us(e,t,n.items):xi(n)?ds(e,t,bi(n)):!1}function fs(e,t,n){return ds(e,t,n)}function ps(e,t){return t.reduce((t,n)=>fs([n],e,e[n])?[...t,n]:t,[])}function ms(e){return ps(e,Ft(e))}function hs(e,t,n){return n.includes(t)?n:t in e?vs(e,e[t],[...n,t]):j()}function gs(e,t,n){return _s(e,It(t),n)}function _s(e,t,n){return t.reduce((t,n)=>vs(e,n,t),n)}function vs(e,t,n){return S(t)?hs(e,t.$ref,n):x(t)?vs(e,t.items,n):xt(t)?_s(e,[...t.parameters,t.instanceType],n):wt(t)?_s(e,[...t.parameters,t.returnType],n):ss(t)?gs(e,t.parameters[1],n):A(t)?_s(e,t.allOf,n):E(t)?gs(e,t.properties,n):R(t)?_s(e,t.anyOf,n):B(t)?_s(e,t.items,n):xi(t)?vs(e,bi(t),n):n}function ys(e,t,n){return vs(e,n,[t])}function bs(e){return kt()}function xs(e){return m(e).reduce((t,n)=>({...t,[n]:Cs(e[n])}),{})}function Ss(e){return e.reduce((e,t)=>[...e,Cs(t)],[])}function Cs(e){return S(e)?bs(e.$ref):x(e)?vt(Cs(e.items),yt(e)):xt(e)?bt(Ss(e.parameters),Cs(e.instanceType)):wt(e)?Ct(Ss(e.parameters),Cs(e.returnType)):A(e)?Gt(Ss(e.allOf)):E(e)?T(xs(e.properties)):xi(e)?hi(yi(e),Cs(bi(e))):R(e)?L(Ss(e.anyOf)):B(e)?z(Ss(e.items)):e}function ws(e,t){return t in e?Cs(e[t]):Rt()}function Ts(e){return ws(e.$defs,e.$ref)}function Es(e,t,n){let r=Fd(e,Z([],[]),t),i=Nd({},Z([],[]),n);return V([...r,T(i)])}function Ds(e,t){return m(e).filter(e=>t.includes(e)).reduce((t,n)=>{let r=e[n],i=ss(r)?Es(e,r.parameters[0],r.parameters[1]):r;return{...t,[n]:i}},{})}function Os(e,t,n){return zt(Ds(e,ys(e,t,n)),t)}function ks(e,t){return t in e?S(e[t])?ks(e,e[t].$ref):e[t]:C()}function As(e,t){return ks(e,t)}function js(e){return Bt(e)?Ts(e):Vt(e)?Rt():e}function Ms(e,t,n){return X(e,js(t),js(n))}function Ns(e,t){let n=[D(e)?K():Ms({},e,t),D(e)?G({}):Ms({},t,e)];return q(n[0])&&q(n[1])?`equal`:q(n[0])&&Ra(n[1])?`left-inside`:Ra(n[0])&&q(n[1])?`right-inside`:`disjoint`}function Ps(e,t){return t.filter(t=>Ns(e,t)!==`right-inside`)}function Fs(e,t){return d(t.some(t=>{let n=Ns(e,t);return d(n,`left-inside`)||d(n,`equal`)}),!1)}function Is(e,t){let n=Kr(e);return At(n)?[n]:Fs(n,t)?[...Ps(n,t),n]:t}function Ls(e){return e.reduce((e,t)=>E(t)?[...e,t]:jt(t)?e:Is(t,e),[])}function Rs(e){return ni(Ls(e))}function zs(e,t){return _(Kr(e),{},t)}function Bs(e,t,n,r){return zs($(e,t,n),r)}function Vs(e,t=[]){return dt(e)&&d(e.action,`Conditional`)?S(e.parameters[0])?Vs(e.parameters[2],Vs(e.parameters[3],[...t,e.parameters[0].$ref])):Vs(e.parameters[2],Vs(e.parameters[3],t)):dt(e)&&d(e.action,`Mapped`)&&dt(e.parameters[1])&&d(e.parameters[1].action,`KeyOf`)&&S(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function Hs(e,t){return e.reduce((e,n)=>[...e,t.includes(n.name)],[])}function Us(e,t,n=[]){return f(e,(e,r)=>f(t,(t,i)=>Us(r,i,[...n,[t,e]]),()=>n),()=>n)}function Ws(e){return R(e)?[...e.anyOf]:[e]}function Gs(e,t){return e.reduce((e,n)=>[...e,[...n,t]],[])}function Ks(e,t){return t.reduce((t,n)=>[...t,...Gs(e,n)],[])}function qs(e){return e.reduce((e,t)=>d(t[0],!0)?Ks(e,Ws(t[1])):Ks(e,[t[1]]),[[]])}function Js(e,t,n){let r=Us(t,Hs(e,Vs(n)));return dt(n)&&d(n.action,`Conditional`)||dt(n)&&d(n.action,`Mapped`)?qs(r):[t]}function Ys(){return[`(not-resolvable)`,C()]}function Xs(){return[`(not-generic)`,C()]}function Zs(e,t,n){return[e,Dt(t,n)]}function Qs(e,t,n){return t in e?$s(e,t,e[t],n):Ys()}function $s(e,t,n,r){return Ot(n)?Zs(t,n.parameters,n.expression):S(n)?Qs(e,n.$ref,r):Xs()}function ec(e,t,n){return $s(e,`(anonymous)`,t,n)}function tc(e,t,n){if(O(t)||pc(t)||q(Ms({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function nc(e,t,r,i,a){let o=$(e,t,a);return tc(r,o,i),n(e,{[r]:o})}function rc(e,t,n,r,i){let a=$(e,t,n.extends),o=$(e,t,n.equals);return f(i,(i,o)=>ic(nc(e,t,n.name,a,i),t,r,o),()=>ic(nc(e,t,n.name,a,o),t,r,[]))}function ic(e,t,n,r){return f(n,(n,i)=>rc(e,t,n,i,r),()=>e)}function ac(e,t,n,r){return ic(e,t,n,r)}function oc(e){return xe(e.callstack.length,0)?e.callstack[e.callstack.length-1]:``}function sc(e,t){return d(oc(e),t)}function cc(e,t,n,r,i,a){let o=ac(e,t,r,a),ee=$(o,Z([...t.callstack,n.$ref],t.visited),i);return $(o,Z([],[]),ee)}function lc(e,t,n,r,i,a){return a.reduce((a,o)=>[...a,cc(e,t,n,r,i,o)],[])}function uc(e,t,n,r,i,a){let o=lc(e,t,n,r,i,Js(r,a,i));return d(o.length,1)?o[0]:Gr(o)}function dc(e,t,n,r){let i=Fd(e,t,r),a=ec(e,n,r),o=a[0],ee=a[1];return Ot(ee)?sc(t,o)?fc(Et(o),i):uc(e,t,Et(o),ee.parameters,ee.expression,i):fc(n,i)}function fc(e,t){return h({"~kind":`Call`},{type:`call`,target:e,arguments:t},{})}function pc(e){return v(e,`Call`)}function mc(e){return g(e,[`~immutable`])}function hc(e,t){return _(mc(e),{},t)}function gc(e,t,n,r){return hc($(e,t,n),r)}function _c(e,t){return e(t)}function vc(e,t){return u(t)?P(_c(e,t)):P(t)}function yc(e,t){return xc(e,Wr(t))}function bc(e,t){return L(t.map(t=>xc(e,t)))}function xc(e,t){return F(t)?vc(e,t.const):W(t)?yc(e,t.pattern):R(t)?bc(e,t.anyOf):t}function Sc(e,t={}){return b(`Capitalize`,[e],t)}function Cc(e,t={}){return b(`Lowercase`,[e],t)}function wc(e,t={}){return b(`Uncapitalize`,[e],t)}function Tc(e,t={}){return b(`Uppercase`,[e],t)}const Ec=e=>e[0].toUpperCase()+e.slice(1),Dc=e=>e.toLowerCase(),Oc=e=>e[0].toLowerCase()+e.slice(1),kc=e=>e.toUpperCase();function Ac(e,t){return Q([e])?_(xc(Ec,e),{},t):Sc(e,t)}function jc(e,t){return Q([e])?_(xc(Dc,e),{},t):Cc(e,t)}function Mc(e,t){return Q([e])?_(xc(Oc,e),{},t):wc(e,t)}function Nc(e,t){return Q([e])?_(xc(kc,e),{},t):Tc(e,t)}function Pc(e,t,n,r){return Ac($(e,t,n),r)}function Fc(e,t,n,r){return jc($(e,t,n),r)}function Ic(e,t,n,r){return Mc($(e,t,n),r)}function Lc(e,t,n,r){return Nc($(e,t,n),r)}function Rc(e,t,n,r,i={}){return b(`Conditional`,[e,t,n,r],i)}function zc(e,t,n,r,i,a){let o=Ms(e,n,r);return Ia(o)?L([$(o.inferred,t,i),$(e,t,a)]):La(o)?$(o.inferred,t,i):$(e,t,a)}function Bc(e,t,n,r,i,a,o){return Q([n,r])?_(zc(e,t,n,r,i,a),{},o):Rc(n,r,i,a,o)}function Vc(e,t,n,r,i,a,o){return Bc(e,t,$(e,t,n),$(e,t,r),i,a,o)}function Hc(e,t={}){return b(`ConstructorParameters`,[e],t)}function Uc(e){let t=xt(e)?e.parameters:[];return z(Pd({},Z([],[]),t))}function Wc(e,t){return Q([e])?_(Uc(e),{},t):Hc(e,t)}function Gc(e,t,n,r){return Wc($(e,t,n),r)}function Kc(e,t,n={}){return b(`Exclude`,[e,t],n)}function qc(e,t,n){return Q([e,t])?_(Vr(e,t),{},n):Kc(e,t,n)}function Jc(e,t,n,r,i){return qc($(e,t,n),$(e,t,r),i)}function Yc(e,t,n={}){return b(`Extract`,[e,t],n)}function Xc(e,t){return q(Ms({},e,t))?[e]:[]}function Zc(e,t){return e.reduce((e,n)=>[...e,...Xc(n,t)],[])}function Qc(e,t){let n=Kr(e);return Gr(Zc(R(n)?n.anyOf:[n],t))}function $c(e,t,n){return Q([e,t])?_(Qc(e,t),{},n):Yc(e,t,n)}function el(e,t,n,r,i){return $c($(e,t,n),$(e,t,r),i)}function tl(e,t,n={}){return b(`Index`,[e,t],n)}function nl(e,t){return dl(As(e,t))}function rl(e,t,n){return dl(Hr(e,t,n))}function il(e,t){let r=m(e).filter(e=>!p(t,e)),i=m(t).filter(t=>!p(e,t)),a=m(e).filter(e=>p(t,e)),o=r.reduce((t,n)=>({...t,[n]:e[n]}),{}),ee=i.reduce((e,n)=>({...e,[n]:t[n]}),{}),te=a.reduce((n,r)=>({...n,[r]:V([e[r],t[r]])}),{});return n(n(o,ee),te)}function al(e){return e.reduce((e,t)=>il(e,dl(t)),{})}function ol(e){return e}function sl(e){return dl(wr(z(e)))}function cl(e,t){return m(e).filter(e=>e in t).reduce((n,r)=>({...n,[r]:Gr([e[r],t[r]])}),{})}function ll(e,t){return f(e,(e,n)=>ll(n,cl(t,dl(e))),()=>t)}function ul(e){return f(e,(e,t)=>ll(t,dl(e)),()=>j())}function dl(e){return Bt(e)?nl(e.$defs,e.$ref):k(e)?rl(e.if,e.then,e.else):A(e)?al(e.allOf):R(e)?ul(e.anyOf):B(e)?sl(e.items):E(e)?ol(e.properties):{}}function fl(e){return T(dl(e))}const pl=RegExp(`^(?:0|[1-9][0-9]*)$`);function ml(e){let t=`${e}`;return pl.test(t)?parseInt(t):e}function hl(e){return P(ml(e))}function gl(e){return e.map(e=>_l(e))}function _l(e){return A(e)?Gt(gl(e.allOf)):R(e)?L(gl(e.anyOf)):F(e)?hl(e.const):e}function vl(e,t){return q(Ms({},_l(t),Hn()))?e:F(t)&&d(t.const,`length`)?Hn():C()}function yl(e,t){return El(As(e,t))}function bl(e,t,n){return El(Hr(e,t,n))}function xl(e){return El(Ur(e))}function Sl(e){return El(V(e))}function Cl(e){return[`${e}`]}function wl(e){return El(Wr(e))}function Tl(e){return e.reduce((e,t)=>[...e,...El(t)],[])}function El(e){return Bt(e)?yl(e.$defs,e.$ref):k(e)?bl(e.if,e.then,e.else):Wt(e)?xl(e.enum):A(e)?Sl(e.allOf):F(e)?Cl(e.const):W(e)?wl(e.pattern):R(e)?Tl(e.anyOf):[]}function Dl(e){return El(e)}function Ol(e,t){return t.map(t=>kl(e,t))}function kl(e,t){return x(t)?vt(kl(e,t.items)):xt(t)?bt(Ol(e,t.parameters),kl(e,t.instanceType)):wt(t)?Ct(Ol(e,t.parameters),kl(e,t.returnType)):B(t)?z(Ol(e,t.items)):R(t)?L(Ol(e,t.anyOf)):A(t)?Gt(Ol(e,t.allOf)):wi(t)?T(e):t}function Al(e,t){return kl(e,t)}function jl(e,t){return Al(e,t in e?e[t]:C())}function Ml(e,t){return t.reduce((t,n)=>[...t,jl(e,n)],[])}function Nl(e,t){return Gr(Ml(e,Dl(t)))}const Pl=new RegExp(di);function Fl(e){return e.filter(e=>Pl.test(e))}function Il(e){return Gr(Ml(e,Fl(Ft(e))))}function Ll(e,t){return I(t)?Il(e):Nl(e,t)}function Rl(e){return P(ml(e))}function zl(e){return e.map(e=>Bl(e))}function Bl(e){return A(e)?Gt(zl(e.allOf)):R(e)?L(zl(e.anyOf)):F(e)?Rl(e.const):e}function Vl(e,t){return e.reduceRight((e,n,r)=>q(Ms({},P(r),t))?[n,...e]:e,[])}function Hl(e,t){return qr(Vl(e,Bl(t)))}function Ul(e){return qr(e)}function Wl(e,t){return F(t)&&d(t.const,`length`)?P(e.length):I(t)||jn(t)?Ul(e):Hl(e,t)}function Gl(e,t){return x(e)?vl(e.items,t):E(e)?Ll(e.properties,t):B(e)?Wl(e.items,t):C()}function Kl(e){return Bt(e)||k(e)||A(e)||R(e)?fl(e):e}function ql(e,t,n){return Q([e,t])?_(Gl(Kl(e),t),{},n):tl(e,t,n)}function Jl(e,t,n,r,i){return ql($(e,t,n),$(e,t,r),i)}function Yl(e,t={}){return b(`InstanceType`,[e],t)}function Xl(e){return xt(e)?e.instanceType:C()}function Zl(e,t){return Q([e])?_(Xl(e),{},t):Yl(e,t)}function Ql(e,t,n,r={}){return Zl($(e,t,n),r)}function $l(e,t={}){return b(`KeyOf`,[e],t)}function eu(){return L([Hn(),Gn(),Un()])}function tu(e){return Hn()}function nu(e){return e.reduce((e,t)=>Pn(t)?[...e,P(ml(t))]:j(),[])}function ru(e){return qr(nu(m(e)))}function iu(e){return yi(e)}function au(e){return qr(e.map((e,t)=>P(t)))}function ou(e){return At(e)?eu():x(e)?tu(e.items):E(e)?ru(e.properties):xi(e)?iu(e):B(e)?au(e.items):C()}function su(e){return Bt(e)||k(e)||A(e)||R(e)?fl(e):e}function cu(e,t){return Q([e])?_(ou(su(e)),{},t):$l(e,t)}function lu(e,t,n,r){return cu($(e,t,n),r)}function uu(e,t,n,r,i={}){return b(`Mapped`,[e,t,n,r],i)}function du(e){return hu(Wr(e))}function fu(e){return e.reduce((e,t)=>[...e,...hu(t)],[])}function pu(e){return hu(Ur(e))}function mu(e){return c(e)?[P(`${e}`)]:[P(e)]}function hu(e){return Wt(e)?pu(e.enum):F(e)?mu(e.const):W(e)?du(e.pattern):R(e)?fu(e.anyOf):[e]}function gu(e){return hu(e)}function _u(e){return W(e)?Wr(e.pattern):e}function vu(e,t,r,i,a,o){let ee=n(e,{[r.name]:i}),te=_u($(ee,t,a)),ne=$(ee,t,o);return Ln(te)||Rn(te)?{[te.const]:ne}:{}}function yu(e,t,n,r,i,a){return r.reduce((r,o)=>[...r,vu(e,t,n,o,i,a)],[])}function bu(e){return e.reduce((e,t)=>[...e,T(t)],[])}function xu(e,t,n,r,i,a){return V(bu(yu(e,t,n,gu(r),i,a)))}function Su(e,t,n,r,i,a,o){return Q([r])?_(xu(e,t,n,r,i,a),{},o):uu(n,r,i,a,o)}function Cu(e,t,n,r,i,a,o){return Su(e,t,n,$(e,t,r),i,a,o)}function wu(e,t,r){let i=n(e,t);return m(t).filter(e=>r.includes(e)).reduce((e,n)=>({...e,[n]:Os(i,n,t[n])}),{})}function Tu(e,t,r){let i=n(e,t);return m(t).filter(e=>!r.includes(e)).reduce((e,n)=>({...e,[n]:$(i,Z([],[]),t[n])}),{})}function Eu(e,t,n){let r=ms(t),i=wu(e,t,r),a=Tu(e,t,r);return _({...i,...a},{},n)}function Du(e,t,n,r){return Eu(e,n,r)}function Ou(e,t={}){return b(`NonNullable`,[e],t)}function ku(e){return qc(e,L([zn(),Ti()]),{})}function Au(e,t){return Q([e])?_(ku(e),{},t):Ou(e,t)}function ju(e,t,n,r){return Au($(e,t,n),r)}function Mu(e,t,n={}){return b(`Omit`,[e,t],n)}function Nu(e){let t=fl(e);return E(t)?t.properties:j()}function Pu(e,t){return m(e).reduce((n,r)=>t.includes(r)?n:{...n,[r]:e[r]},{})}function Fu(e,t){return T(Pu(Nu(e),Dl(t)))}function Iu(e,t,n){return Q([e,t])?_(Fu(e,t),{},n):Mu(e,t,n)}function Lu(e,t,n,r,i){return Iu($(e,t,n),$(e,t,r),i)}function Ru(e,t={}){return b(`Parameters`,[e],t)}function zu(e){let t=wt(e)?e.parameters:[];return z(Pd({},Z([],[]),t))}function Bu(e,t){return Q([e])?_(zu(e),{},t):Ru(e,t)}function Vu(e,t,n,r){return Bu($(e,t,n),r)}function Hu(e,t={}){return b(`Partial`,[e],t)}function Uu(e,t){let r=Ju(As(e,t));return zt(n(e,{[t]:r}),t)}function Wu(e,t,n){return Ju(Hr(e,t,n))}function Gu(e){return Ju(V(e))}function Ku(e){return L(e.map(e=>Ju(e)))}function qu(e){return T(m(e).reduce((t,n)=>({...t,[n]:Mt(e[n])}),{}))}function Ju(e){return Bt(e)?Uu(e.$defs,e.$ref):k(e)?Wu(e.if,e.then,e.else):A(e)?Gu(e.allOf):R(e)?Ku(e.anyOf):E(e)?qu(e.properties):T({})}function Yu(e,t){return Q([e])?_(Ju(e),{},t):Hu(e,t)}function Xu(e,t,n,r){return Yu($(e,t,n),r)}function Zu(e,t,n={}){return b(`Pick`,[e,t],n)}function Qu(e,t){return m(e).reduce((r,i)=>t.includes(i)?n(r,{[i]:e[i]}):r,{})}function $u(e,t){return T(Qu(Nu(e),Dl(t)))}function ed(e,t,n){return Q([e,t])?_($u(e,t),{},n):Zu(e,t,n)}function td(e,t,n,r,i){return ed($(e,t,n),$(e,t,r),i)}function nd(e,t={}){return b(`ReadonlyObject`,[e],t)}function rd(e){return Ud(vt(e))}function id(e,t){let r=ud(As(e,t));return zt(n(e,{[t]:r}),t)}function ad(e,t,n){return ud(Hr(e,t,n))}function od(e){return ud(V(e))}function sd(e){return T(m(e).reduce((t,n)=>({...t,[n]:wn(e[n])}),{}))}function cd(e){return Ud(z(e))}function ld(e){return L(e.map(e=>ud(e)))}function ud(e){return x(e)?rd(e.items):Bt(e)?id(e.$defs,e.$ref):k(e)?ad(e.if,e.then,e.else):A(e)?od(e.allOf):E(e)?sd(e.properties):B(e)?cd(e.items):R(e)?ld(e.anyOf):e}function dd(e,t){return Q([e])?_(ud(e),{},t):nd(e)}function fd(e,t,n,r){return dd($(e,t,n),r)}function pd(e,t,n,r){return t.visited.includes(r)?n:r in e?$(e,Z(t.callstack,[...t.visited,r]),e[r]):n}function md(e,t){let r=yd(As(e,t));return zt(n(e,{[t]:r}),t)}function hd(e,t,n){return yd(Hr(e,t,n))}function gd(e){return yd(V(e))}function _d(e){return L(e.map(e=>yd(e)))}function vd(e){return T(m(e).reduce((t,n)=>({...t,[n]:Sr(e[n])}),{}))}function yd(e){return Bt(e)?md(e.$defs,e.$ref):k(e)?hd(e.if,e.then,e.else):A(e)?gd(e.allOf):R(e)?_d(e.anyOf):E(e)?vd(e.properties):T({})}function bd(e,t={}){return b(`Required`,[e],t)}function xd(e,t){return Q([e])?_(yd(e),{},t):bd(e,t)}function Sd(e,t,n,r){return xd($(e,t,n),r)}function Cd(e,t={}){return b(`ReturnType`,[e],t)}function wd(e){return wt(e)?e.returnType:C()}function Td(e,t){return Q([e])?_(wd(e),{},t):Cd(e,t)}function Ed(e,t,n,r={}){return Td($(e,t,n),r)}function Dd(e,t){return b(`With`,[e,t],{})}function Od(e,t){return kd(e,t)}function kd(e,t){return Q([e])?_(e,{},t):Dd(e,t)}function Ad(e,t,n,r){return kd($(e,t,n),r)}function jd(e){return Ci(e)?B(e.items)?Md(e.items.items):O(e.items)||S(e.items)?[e]:[C()]:[e]}function Md(e){return e.reduce((e,t)=>[...e,...jd(t)],[])}function Z(e,t){return{callstack:e,visited:t}}function Q(e){return f(e,(e,t)=>!S(e)&&Q(t),()=>!0)}function Nd(e,t,n){return m(n).reduce((r,i)=>({...r,[i]:$(e,t,n[i])}),{})}function Pd(e,t,n){return Md(Fd(e,t,n))}function Fd(e,t,n){return n.map(n=>$(e,t,n))}function Id(e,t){let n=w(e)?gt(t,{}):t,r=Tn(e)?pt(n,{}):n;return Cn(e)?Vd(r,{}):r}function Ld(e,t,n,r,i){return d(n,`AddImmutable`)?Hd(e,t,r[0],i):d(n,`RemoveImmutable`)?gc(e,t,r[0],i):d(n,`AddReadonly`)?mt(e,t,r[0],i):d(n,`RemoveReadonly`)?_r(e,t,r[0],i):d(n,`AddOptional`)?_t(e,t,r[0],i):d(n,`RemoveOptional`)?xr(e,t,r[0],i):d(n,`Capitalize`)?Pc(e,t,r[0],i):d(n,`Conditional`)?Vc(e,t,r[0],r[1],r[2],r[3],i):d(n,`ConstructorParameters`)?Gc(e,t,r[0],i):d(n,`Evaluate`)?Bs(e,t,r[0],i):d(n,`Exclude`)?Jc(e,t,r[0],r[1],i):d(n,`Extract`)?el(e,t,r[0],r[1],i):d(n,`Index`)?Jl(e,t,r[0],r[1],i):d(n,`InstanceType`)?Ql(e,t,r[0],i):d(n,`Interface`)?as(e,t,r[0],r[1],i):d(n,`KeyOf`)?lu(e,t,r[0],i):d(n,`Lowercase`)?Fc(e,t,r[0],i):d(n,`Mapped`)?Cu(e,t,r[0],r[1],r[2],r[3],i):d(n,`Module`)?Du(e,t,r[0],i):d(n,`NonNullable`)?ju(e,t,r[0],i):d(n,`Pick`)?td(e,t,r[0],r[1],i):d(n,`Parameters`)?Vu(e,t,r[0],i):d(n,`Partial`)?Xu(e,t,r[0],i):d(n,`Omit`)?Lu(e,t,r[0],r[1],i):d(n,`ReadonlyObject`)?fd(e,t,r[0],i):d(n,`Record`)?ui(e,t,r[0],r[1],i):d(n,`Required`)?Sd(e,t,r[0],i):d(n,`ReturnType`)?Ed(e,t,r[0],i):d(n,`TemplateLiteral`)?Ma(e,t,r[0],i):d(n,`Uncapitalize`)?Ic(e,t,r[0],i):d(n,`Uppercase`)?Lc(e,t,r[0],i):d(n,`With`)?Ad(e,t,r[0],r[1]):b(n,r,i)}function Rd(e,t,n){return Id(n,S(n)?pd(e,t,n,n.$ref):x(n)?vt($(e,t,n.items),yt(n)):pc(n)?dc(e,t,n.target,n.arguments):xt(n)?bt(Fd(e,t,n.parameters),$(e,t,n.instanceType),St(n)):wt(n)?Ct(Fd(e,t,n.parameters),$(e,t,n.returnType),Tt(n)):k(n)?Ht($(e,t,n.if),$(e,t,n.then),$(e,t,n.else),Ut(n)):A(n)?Gt(Fd(e,t,n.allOf),Kt(n)):E(n)?T(Nd(e,t,n.properties),Lt(n)):xi(n)?gi(vi(n),$(e,t,bi(n))):Ci(n)?Si($(e,t,n.items)):B(n)?z(Pd(e,t,n.items),mr(n)):R(n)?L(Fd(e,t,n.anyOf),qn(n)):n)}function $(e,t,n){return dt(n)?Ld(e,t,n.action,n.parameters,n.options):Rd(e,t,n)}function zd(e,t){return $(e,Z([],[]),t)}function Bd(e){return _(e,{"~immutable":!0},{})}function Vd(e,t){return _(Bd(e),{},t)}function Hd(e,t,n,r){return Vd($(e,t,n),r)}function Ud(e,t={}){return Vd(e,t)}function Wd(e,t={}){return zs(e,t)}function Gd(e,t){let n=Ns(e,t);return d(n,`right-inside`)?1:+!!d(n,`disjoint`)}function Kd(e,t,n=[]){return f(t,(r,i)=>d(Gd(e,r),1)?Kd(e,i,[...n,r]):[...n,e,...t],()=>[...n,e])}function qd(e,t=[]){return f(e,(e,n)=>qd(n,Kd(e,t)),()=>t)}function Jd(e){return qd(e)}export{vt as $,jn as A,Ne as At,Bt as B,Bn as C,_e as Ct,Ln as D,u as Dt,In as E,ve as Et,qt as F,Nt as G,E as H,j as I,Et as J,jt as K,Gt as L,Dn as M,m as Mt,Sn as N,de as Nt,Rn as O,ye as Ot,xn as P,x as Q,A as R,Hn as S,Te as St,Fn as T,l as Tt,T as U,Rt as V,w as W,xt as X,wt as Y,yt as Z,L as _,ge as _t,W as a,je as at,Wn as b,ke as bt,xi as c,fe as ct,vi as d,me as dt,y as et,bi as f,Be as ft,R as g,xe as gt,ur as h,we as ht,Od as i,Pe as it,On as j,De as jt,P as k,be as kt,hi as l,s as lt,z as m,he as mt,Wd as n,ot as nt,Di as o,Me as ot,B as p,d as pt,S as q,zd as r,Fe as rt,Ei as s,p as st,Jd as t,ct as tt,yi as u,pe as ut,Kn as v,Ce as vt,F as w,c as wt,I as x,Ae as xt,Gn as y,Se as yt,Wt as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./logger-DDBAeTLF.js";import"./navigation-watcher-BpA1OwJw.js";import"./wc-follower-oauth-BPx1gTgG.js";import{n as t,t as n}from"./pending-request-table-k-D7ZZsL.js";var r=e(`cdp`);function i(e){return e===4001?`CDP connection superseded by another SLICC tab/window on this instance`:e===4002?`CDP connection reset by proxy (upstream Chrome connection was re-established)`:`CDP connection closed`}var a=class{ws=null;nextId=1;_superseded=!1;pending=new n;listeners=new Map;_state=`disconnected`;stateListeners=new Set;lastNotifiedState=`disconnected`;lastNotifiedReason;get state(){return this._state}onStateChange(e){return this.stateListeners.add(e),()=>{this.stateListeners.delete(e)}}get superseded(){return this._superseded}async connect(e){if(this._state!==`disconnected`)throw Error(`Cannot connect: state is ${this._state}`);if(!e?.url)throw Error(`CDPClient.connect() requires a WebSocket URL`);let{url:t,timeout:n=5e3,protocols:i}=e;return this._state=`connecting`,new Promise((e,a)=>{let o=setTimeout(()=>{this.cleanup(),a(Error(`CDP connection timed out after ${n}ms`))},n);try{this.ws=i===void 0?new WebSocket(t):new WebSocket(t,i)}catch(e){clearTimeout(o),this._state=`disconnected`,a(e);return}this.ws.onopen=()=>{clearTimeout(o),this._state=`connected`,this._superseded=!1,r.info(`Connected`,{url:t}),this.notifyState(`connected`),e()},this.ws.onerror=e=>{clearTimeout(o),this._state===`connecting`&&(r.error(`Connection failed`,{url:t}),this.cleanup(),a(Error(`CDP WebSocket connection failed`)))},this.ws.onmessage=e=>{this.handleMessage(e.data)},this.ws.onclose=e=>{this.handleClose(e?.code)}})}disconnect(){this.ws&&(this.ws.onclose=null,this.ws.close()),this._superseded=!1,this.cleanup(),r.info(`Disconnected`)}async send(e,t,n,i=3e4){if(this._state!==`connected`||!this.ws)throw Error(`CDP client is not connected`);let a=this.nextId++,o={id:a,method:e};t&&(o.params=t),n&&(o.sessionId=n),r.debug(`Send`,{method:e,id:a,sessionId:n});let s=this.pending.issue(a,i,`CDP command timed out after ${i}ms: ${e}`);return this.ws.send(JSON.stringify(o)),s}on(e,t){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(t)}off(e,t){let n=this.listeners.get(e);n&&(n.delete(t),n.size===0&&this.listeners.delete(e))}once(e,n=3e4){return t(t=>(this.on(e,t),()=>this.off(e,t)),n,`Timed out waiting for event: ${e}`)}handleMessage(e){let t;try{t=JSON.parse(e)}catch{return}if(`id`in t&&typeof t.id==`number`){let e=t;r.debug(`Response`,{id:e.id,hasError:!!e.error}),e.error?(r.error(`Command error`,{id:e.id,code:e.error.code,message:e.error.message}),this.pending.reject(e.id,Error(`CDP error: ${e.error.message} (${e.error.code})`))):this.pending.resolve(e.id,e.result??{});return}if(`method`in t){let e=t;r.debug(`Event`,{method:e.method,sessionId:e.sessionId});let n=this.listeners.get(e.method);if(n){let t=e.sessionId?{...e.params,sessionId:e.sessionId}:e.params??{};for(let e of n)try{e(t)}catch{}}}}handleClose(e){e===4001?(this._superseded=!0,r.warn(`CDP slot superseded by another SLICC tab/window on this instance`,{code:e})):e===4002?r.warn(`CDP proxy reset its upstream Chrome connection — sessions dropped`,{code:e,pendingCommands:this.pending.size}):r.error(`Connection closed unexpectedly`,{pendingCommands:this.pending.size}),this.cleanup(i(e))}cleanup(e=`CDP client disconnected`){this.ws=null,this._state=`disconnected`,this.pending.rejectAll(e),this.notifyState(`disconnected`,e)}notifyState(e,t){if(e!==this.lastNotifiedState||t!==this.lastNotifiedReason){this.lastNotifiedState=e,this.lastNotifiedReason=t;for(let n of this.stateListeners)try{n(e,t)}catch{}}}},o=class extends Error{step;name=`CommandAbortedError`;constructor(e){super(`Browser command aborted while ${e}. A CDP round trip already in flight cannot be cancelled, so it may still have been applied to the page; nothing after it was started.`),this.step=e}};function s(e,t){if(e?.aborted)throw new o(t)}function c(e,t){return e?{signal:e,error:()=>new o(t)}:void 0}function l(e,t,n){return new Promise((r,i)=>{if(t?.aborted){i(new o(n));return}let a=()=>{clearTimeout(s),i(new o(n))},s=setTimeout(()=>{t?.removeEventListener(`abort`,a),r()},e);t?.addEventListener(`abort`,a,{once:!0})})}function u(e,t,n){return t?t.aborted?Promise.reject(new o(n)):new Promise((r,i)=>{let a=()=>i(new o(n));t.addEventListener(`abort`,a,{once:!0}),e.then(()=>{t.removeEventListener(`abort`,a),r()},e=>{t.removeEventListener(`abort`,a),i(e instanceof Error?e:Error(String(e)))})}):e}var d=e(`har-recorder`),f=class{recordings=new Map;client;fs;eventCleanup=new Map;constructor(e,t){this.client=e,this.fs=t}async startRecording(e,t,n,r){let i=`rec-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;s(r,`about to enable Network on tab ${e}`),await this.client.send(`Network.enable`,{},t),s(r,`about to enable Page on tab ${e}`),await this.client.send(`Page.enable`,{},t),s(r,`about to read the URL of tab ${e}`);let a=(await this.client.send(`Runtime.evaluate`,{expression:`location.href`,returnByValue:!0},t)).result?.value??`about:blank`,o={id:i,targetId:e,sessionId:t,filterCode:n,pendingRequests:new Map,entries:[],startTime:Date.now(),currentUrl:a,snapshotCount:0};return this.recordings.set(i,o),this.setupEventListeners(o),await this.ensureDir(`/recordings/${i}`),d.debug(`Started recording`,{recordingId:i,targetId:e,currentUrl:a}),i}setupEventListeners(e){let{sessionId:t,id:n}=e,r=n=>{let r=n;r.sessionId===t&&this.handleRequestWillBeSent(e,r)},i=n=>{let r=n;r.sessionId===t&&this.handleResponseReceived(e,r)},a=r=>{let i=r;i.sessionId===t&&this.handleLoadingFinished(e,i).catch(e=>{d.error(`Failed to process loadingFinished event`,{recordingId:n,requestId:i.requestId,error:e instanceof Error?e.message:String(e)})})},o=n=>{let r=n;r.sessionId===t&&this.handleLoadingFailed(e,r)},s=r=>{let i=r;if(i.sessionId!==t)return;let a=i.frame;if(!a?.parentId&&a?.url){let t=[...e.entries],r=e.currentUrl;e.currentUrl=a.url,e.entries=[],e.pendingRequests.clear(),this.saveSnapshotWithEntries(e,`navigation`,t,r).catch(e=>{d.error(`Failed to save navigation snapshot`,{recordingId:n,error:e instanceof Error?e.message:String(e)})})}};this.client.on(`Network.requestWillBeSent`,r),this.client.on(`Network.responseReceived`,i),this.client.on(`Network.loadingFinished`,a),this.client.on(`Network.loadingFailed`,o),this.client.on(`Page.frameNavigated`,s),this.eventCleanup.set(n,()=>{this.client.off(`Network.requestWillBeSent`,r),this.client.off(`Network.responseReceived`,i),this.client.off(`Network.loadingFinished`,a),this.client.off(`Network.loadingFailed`,o),this.client.off(`Page.frameNavigated`,s)})}handleRequestWillBeSent(e,t){let{requestId:n,request:r,timestamp:i}=t;!n||!r||i==null||e.pendingRequests.set(n,{requestId:n,startTime:i*1e3,request:{method:r.method,url:r.url,headers:r.headers,postData:r.postData}})}handleResponseReceived(e,t){let{requestId:n,response:r}=t;if(!n||!r)return;let i=e.pendingRequests.get(n);i&&(i.response={status:r.status,statusText:r.statusText,headers:r.headers,mimeType:r.mimeType},i.timing=r.timing)}async handleLoadingFinished(e,t){let{requestId:n,timestamp:r}=t;if(!n||r==null)return;let i=e.pendingRequests.get(n);if(!i)return;i.endTime=r*1e3;try{let t=await this.client.send(`Network.getResponseBody`,{requestId:n},e.sessionId);i.responseBody=t.body,i.responseBodyBase64=t.base64Encoded===!0}catch{}let a=this.buildHarEntry(i);a&&e.entries.push(a),e.pendingRequests.delete(n)}handleLoadingFailed(e,t){let{requestId:n}=t;n&&e.pendingRequests.delete(n)}buildHarEntry(e){if(!e.response)return null;let{request:t,response:n,timing:r,startTime:i,endTime:a,responseBody:o,responseBodyBase64:s}=e,c=a?a-i:0,l=[];try{let e=new URL(t.url);l=Array.from(e.searchParams.entries()).map(([e,t])=>({name:e,value:t}))}catch{}let u=r?(()=>{let e=(e,t)=>{if(e==null||t==null||e<0||t<0)return-1;let n=t-e;return n>=0?n:-1},t=r.dnsStart>=0?r.dnsStart:r.connectStart>=0?r.connectStart:0;return{blocked:t>0?t:-1,dns:e(r.dnsStart,r.dnsEnd),connect:e(r.connectStart,r.connectEnd),ssl:e(r.sslStart,r.sslEnd),send:e(r.sendStart,r.sendEnd),wait:e(r.sendEnd,r.receiveHeadersStart),receive:e(r.receiveHeadersStart,r.receiveHeadersEnd)}})():{blocked:-1,dns:-1,connect:-1,ssl:-1,send:0,wait:c,receive:0},d={size:o?.length??0,mimeType:n.mimeType??`application/octet-stream`};o&&(d.text=o,s&&(d.encoding=`base64`));let f;return t.postData&&(f={mimeType:t.headers[`content-type`]??t.headers[`Content-Type`]??`text/plain`,text:t.postData}),{startedDateTime:new Date(i).toISOString(),time:c,request:{method:t.method,url:t.url,httpVersion:`HTTP/1.1`,cookies:[],headers:Object.entries(t.headers).map(([e,t])=>({name:e,value:t})),queryString:l,postData:f,headersSize:-1,bodySize:t.postData?.length??0},response:{status:n.status,statusText:n.statusText,httpVersion:`HTTP/1.1`,cookies:[],headers:Object.entries(n.headers).map(([e,t])=>({name:e,value:t})),content:d,redirectURL:n.headers.location??n.headers.Location??``,headersSize:-1,bodySize:d.size},cache:{},timings:u}}async saveSnapshot(e,t){return this.saveSnapshotWithEntries(e,t,e.entries,e.currentUrl)}async applyFilter(e,t){return p(e,t)}async saveSnapshotWithEntries(e,t,n,r){if(n.length===0)return d.debug(`No entries to save`,{recordingId:e.id,trigger:t}),null;let i=e.filterCode?await this.applyFilter(n,e.filterCode):n;if(i.length===0)return d.debug(`All entries filtered out`,{recordingId:e.id,trigger:t}),null;e.snapshotCount++;let a=new Date().toISOString().replace(/[:.]/g,`-`),o=this.urlToSlug(r),s=`${e.snapshotCount.toString().padStart(3,`0`)}-${a}-${t}-${o}.har`,c=`/recordings/${e.id}/${s}`,l={log:{version:`1.2`,creator:{name:`SLICC HAR Recorder`,version:`1.0.0`},entries:i}};return await this.fs.writeFile(c,JSON.stringify(l,null,2)),d.debug(`Saved HAR snapshot`,{recordingId:e.id,path:c,entryCount:i.length}),c}urlToSlug(e){try{let t=new URL(e);return`${t.hostname}${t.pathname}`.replace(/[^a-zA-Z0-9]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).slice(0,50)||`page`}catch{return`page`}}async stopRecording(e){let t=this.recordings.get(e);if(!t)throw Error(`Recording not found: ${e}`);await this.saveSnapshot(t,`close`);let n=this.eventCleanup.get(e);n&&(n(),this.eventCleanup.delete(e));try{await this.client.send(`Network.disable`,{},t.sessionId)}catch{}this.recordings.delete(e);let r=`/recordings/${e}`;return d.debug(`Stopped recording`,{recordingId:e,snapshotCount:t.snapshotCount}),r}getRecording(e){return this.recordings.get(e)}getRecordingByTarget(e){for(let[t,n]of this.recordings)if(n.targetId===e)return t}async ensureDir(e){await this.fs.mkdir(e,{recursive:!0})}};function p(e,t){try{let n=Function(`entry`,`return (${t})(entry);`),r=[];for(let t of e)try{let e=n(t);if(e===!1)continue;typeof e==`object`&&e?r.push(e):r.push(t)}catch(e){d.error(`Filter function error on entry, keeping it`,{error:e instanceof Error?e.message:String(e)}),r.push(t)}return r}catch(t){return d.error(`Failed to compile filter, returning unfiltered`,{error:t instanceof Error?t.message:String(t)}),e}}var m=`(function() {
|
|
1
|
+
import{t as e}from"./logger-DDBAeTLF.js";import"./navigation-watcher-BpA1OwJw.js";import"./wc-follower-oauth-CzgF8pm8.js";import{n as t,t as n}from"./pending-request-table-k-D7ZZsL.js";var r=e(`cdp`);function i(e){return e===4001?`CDP connection superseded by another SLICC tab/window on this instance`:e===4002?`CDP connection reset by proxy (upstream Chrome connection was re-established)`:`CDP connection closed`}var a=class{ws=null;nextId=1;_superseded=!1;pending=new n;listeners=new Map;_state=`disconnected`;stateListeners=new Set;lastNotifiedState=`disconnected`;lastNotifiedReason;get state(){return this._state}onStateChange(e){return this.stateListeners.add(e),()=>{this.stateListeners.delete(e)}}get superseded(){return this._superseded}async connect(e){if(this._state!==`disconnected`)throw Error(`Cannot connect: state is ${this._state}`);if(!e?.url)throw Error(`CDPClient.connect() requires a WebSocket URL`);let{url:t,timeout:n=5e3,protocols:i}=e;return this._state=`connecting`,new Promise((e,a)=>{let o=setTimeout(()=>{this.cleanup(),a(Error(`CDP connection timed out after ${n}ms`))},n);try{this.ws=i===void 0?new WebSocket(t):new WebSocket(t,i)}catch(e){clearTimeout(o),this._state=`disconnected`,a(e);return}this.ws.onopen=()=>{clearTimeout(o),this._state=`connected`,this._superseded=!1,r.info(`Connected`,{url:t}),this.notifyState(`connected`),e()},this.ws.onerror=e=>{clearTimeout(o),this._state===`connecting`&&(r.error(`Connection failed`,{url:t}),this.cleanup(),a(Error(`CDP WebSocket connection failed`)))},this.ws.onmessage=e=>{this.handleMessage(e.data)},this.ws.onclose=e=>{this.handleClose(e?.code)}})}disconnect(){this.ws&&(this.ws.onclose=null,this.ws.close()),this._superseded=!1,this.cleanup(),r.info(`Disconnected`)}async send(e,t,n,i=3e4){if(this._state!==`connected`||!this.ws)throw Error(`CDP client is not connected`);let a=this.nextId++,o={id:a,method:e};t&&(o.params=t),n&&(o.sessionId=n),r.debug(`Send`,{method:e,id:a,sessionId:n});let s=this.pending.issue(a,i,`CDP command timed out after ${i}ms: ${e}`);return this.ws.send(JSON.stringify(o)),s}on(e,t){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(t)}off(e,t){let n=this.listeners.get(e);n&&(n.delete(t),n.size===0&&this.listeners.delete(e))}once(e,n=3e4){return t(t=>(this.on(e,t),()=>this.off(e,t)),n,`Timed out waiting for event: ${e}`)}handleMessage(e){let t;try{t=JSON.parse(e)}catch{return}if(`id`in t&&typeof t.id==`number`){let e=t;r.debug(`Response`,{id:e.id,hasError:!!e.error}),e.error?(r.error(`Command error`,{id:e.id,code:e.error.code,message:e.error.message}),this.pending.reject(e.id,Error(`CDP error: ${e.error.message} (${e.error.code})`))):this.pending.resolve(e.id,e.result??{});return}if(`method`in t){let e=t;r.debug(`Event`,{method:e.method,sessionId:e.sessionId});let n=this.listeners.get(e.method);if(n){let t=e.sessionId?{...e.params,sessionId:e.sessionId}:e.params??{};for(let e of n)try{e(t)}catch{}}}}handleClose(e){e===4001?(this._superseded=!0,r.warn(`CDP slot superseded by another SLICC tab/window on this instance`,{code:e})):e===4002?r.warn(`CDP proxy reset its upstream Chrome connection — sessions dropped`,{code:e,pendingCommands:this.pending.size}):r.error(`Connection closed unexpectedly`,{pendingCommands:this.pending.size}),this.cleanup(i(e))}cleanup(e=`CDP client disconnected`){this.ws=null,this._state=`disconnected`,this.pending.rejectAll(e),this.notifyState(`disconnected`,e)}notifyState(e,t){if(e!==this.lastNotifiedState||t!==this.lastNotifiedReason){this.lastNotifiedState=e,this.lastNotifiedReason=t;for(let n of this.stateListeners)try{n(e,t)}catch{}}}},o=class extends Error{step;name=`CommandAbortedError`;constructor(e){super(`Browser command aborted while ${e}. A CDP round trip already in flight cannot be cancelled, so it may still have been applied to the page; nothing after it was started.`),this.step=e}};function s(e,t){if(e?.aborted)throw new o(t)}function c(e,t){return e?{signal:e,error:()=>new o(t)}:void 0}function l(e,t,n){return new Promise((r,i)=>{if(t?.aborted){i(new o(n));return}let a=()=>{clearTimeout(s),i(new o(n))},s=setTimeout(()=>{t?.removeEventListener(`abort`,a),r()},e);t?.addEventListener(`abort`,a,{once:!0})})}function u(e,t,n){return t?t.aborted?Promise.reject(new o(n)):new Promise((r,i)=>{let a=()=>i(new o(n));t.addEventListener(`abort`,a,{once:!0}),e.then(()=>{t.removeEventListener(`abort`,a),r()},e=>{t.removeEventListener(`abort`,a),i(e instanceof Error?e:Error(String(e)))})}):e}var d=e(`har-recorder`),f=class{recordings=new Map;client;fs;eventCleanup=new Map;constructor(e,t){this.client=e,this.fs=t}async startRecording(e,t,n,r){let i=`rec-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;s(r,`about to enable Network on tab ${e}`),await this.client.send(`Network.enable`,{},t),s(r,`about to enable Page on tab ${e}`),await this.client.send(`Page.enable`,{},t),s(r,`about to read the URL of tab ${e}`);let a=(await this.client.send(`Runtime.evaluate`,{expression:`location.href`,returnByValue:!0},t)).result?.value??`about:blank`,o={id:i,targetId:e,sessionId:t,filterCode:n,pendingRequests:new Map,entries:[],startTime:Date.now(),currentUrl:a,snapshotCount:0};return this.recordings.set(i,o),this.setupEventListeners(o),await this.ensureDir(`/recordings/${i}`),d.debug(`Started recording`,{recordingId:i,targetId:e,currentUrl:a}),i}setupEventListeners(e){let{sessionId:t,id:n}=e,r=n=>{let r=n;r.sessionId===t&&this.handleRequestWillBeSent(e,r)},i=n=>{let r=n;r.sessionId===t&&this.handleResponseReceived(e,r)},a=r=>{let i=r;i.sessionId===t&&this.handleLoadingFinished(e,i).catch(e=>{d.error(`Failed to process loadingFinished event`,{recordingId:n,requestId:i.requestId,error:e instanceof Error?e.message:String(e)})})},o=n=>{let r=n;r.sessionId===t&&this.handleLoadingFailed(e,r)},s=r=>{let i=r;if(i.sessionId!==t)return;let a=i.frame;if(!a?.parentId&&a?.url){let t=[...e.entries],r=e.currentUrl;e.currentUrl=a.url,e.entries=[],e.pendingRequests.clear(),this.saveSnapshotWithEntries(e,`navigation`,t,r).catch(e=>{d.error(`Failed to save navigation snapshot`,{recordingId:n,error:e instanceof Error?e.message:String(e)})})}};this.client.on(`Network.requestWillBeSent`,r),this.client.on(`Network.responseReceived`,i),this.client.on(`Network.loadingFinished`,a),this.client.on(`Network.loadingFailed`,o),this.client.on(`Page.frameNavigated`,s),this.eventCleanup.set(n,()=>{this.client.off(`Network.requestWillBeSent`,r),this.client.off(`Network.responseReceived`,i),this.client.off(`Network.loadingFinished`,a),this.client.off(`Network.loadingFailed`,o),this.client.off(`Page.frameNavigated`,s)})}handleRequestWillBeSent(e,t){let{requestId:n,request:r,timestamp:i}=t;!n||!r||i==null||e.pendingRequests.set(n,{requestId:n,startTime:i*1e3,request:{method:r.method,url:r.url,headers:r.headers,postData:r.postData}})}handleResponseReceived(e,t){let{requestId:n,response:r}=t;if(!n||!r)return;let i=e.pendingRequests.get(n);i&&(i.response={status:r.status,statusText:r.statusText,headers:r.headers,mimeType:r.mimeType},i.timing=r.timing)}async handleLoadingFinished(e,t){let{requestId:n,timestamp:r}=t;if(!n||r==null)return;let i=e.pendingRequests.get(n);if(!i)return;i.endTime=r*1e3;try{let t=await this.client.send(`Network.getResponseBody`,{requestId:n},e.sessionId);i.responseBody=t.body,i.responseBodyBase64=t.base64Encoded===!0}catch{}let a=this.buildHarEntry(i);a&&e.entries.push(a),e.pendingRequests.delete(n)}handleLoadingFailed(e,t){let{requestId:n}=t;n&&e.pendingRequests.delete(n)}buildHarEntry(e){if(!e.response)return null;let{request:t,response:n,timing:r,startTime:i,endTime:a,responseBody:o,responseBodyBase64:s}=e,c=a?a-i:0,l=[];try{let e=new URL(t.url);l=Array.from(e.searchParams.entries()).map(([e,t])=>({name:e,value:t}))}catch{}let u=r?(()=>{let e=(e,t)=>{if(e==null||t==null||e<0||t<0)return-1;let n=t-e;return n>=0?n:-1},t=r.dnsStart>=0?r.dnsStart:r.connectStart>=0?r.connectStart:0;return{blocked:t>0?t:-1,dns:e(r.dnsStart,r.dnsEnd),connect:e(r.connectStart,r.connectEnd),ssl:e(r.sslStart,r.sslEnd),send:e(r.sendStart,r.sendEnd),wait:e(r.sendEnd,r.receiveHeadersStart),receive:e(r.receiveHeadersStart,r.receiveHeadersEnd)}})():{blocked:-1,dns:-1,connect:-1,ssl:-1,send:0,wait:c,receive:0},d={size:o?.length??0,mimeType:n.mimeType??`application/octet-stream`};o&&(d.text=o,s&&(d.encoding=`base64`));let f;return t.postData&&(f={mimeType:t.headers[`content-type`]??t.headers[`Content-Type`]??`text/plain`,text:t.postData}),{startedDateTime:new Date(i).toISOString(),time:c,request:{method:t.method,url:t.url,httpVersion:`HTTP/1.1`,cookies:[],headers:Object.entries(t.headers).map(([e,t])=>({name:e,value:t})),queryString:l,postData:f,headersSize:-1,bodySize:t.postData?.length??0},response:{status:n.status,statusText:n.statusText,httpVersion:`HTTP/1.1`,cookies:[],headers:Object.entries(n.headers).map(([e,t])=>({name:e,value:t})),content:d,redirectURL:n.headers.location??n.headers.Location??``,headersSize:-1,bodySize:d.size},cache:{},timings:u}}async saveSnapshot(e,t){return this.saveSnapshotWithEntries(e,t,e.entries,e.currentUrl)}async applyFilter(e,t){return p(e,t)}async saveSnapshotWithEntries(e,t,n,r){if(n.length===0)return d.debug(`No entries to save`,{recordingId:e.id,trigger:t}),null;let i=e.filterCode?await this.applyFilter(n,e.filterCode):n;if(i.length===0)return d.debug(`All entries filtered out`,{recordingId:e.id,trigger:t}),null;e.snapshotCount++;let a=new Date().toISOString().replace(/[:.]/g,`-`),o=this.urlToSlug(r),s=`${e.snapshotCount.toString().padStart(3,`0`)}-${a}-${t}-${o}.har`,c=`/recordings/${e.id}/${s}`,l={log:{version:`1.2`,creator:{name:`SLICC HAR Recorder`,version:`1.0.0`},entries:i}};return await this.fs.writeFile(c,JSON.stringify(l,null,2)),d.debug(`Saved HAR snapshot`,{recordingId:e.id,path:c,entryCount:i.length}),c}urlToSlug(e){try{let t=new URL(e);return`${t.hostname}${t.pathname}`.replace(/[^a-zA-Z0-9]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).slice(0,50)||`page`}catch{return`page`}}async stopRecording(e){let t=this.recordings.get(e);if(!t)throw Error(`Recording not found: ${e}`);await this.saveSnapshot(t,`close`);let n=this.eventCleanup.get(e);n&&(n(),this.eventCleanup.delete(e));try{await this.client.send(`Network.disable`,{},t.sessionId)}catch{}this.recordings.delete(e);let r=`/recordings/${e}`;return d.debug(`Stopped recording`,{recordingId:e,snapshotCount:t.snapshotCount}),r}getRecording(e){return this.recordings.get(e)}getRecordingByTarget(e){for(let[t,n]of this.recordings)if(n.targetId===e)return t}async ensureDir(e){await this.fs.mkdir(e,{recursive:!0})}};function p(e,t){try{let n=Function(`entry`,`return (${t})(entry);`),r=[];for(let t of e)try{let e=n(t);if(e===!1)continue;typeof e==`object`&&e?r.push(e):r.push(t)}catch(e){d.error(`Filter function error on entry, keeping it`,{error:e instanceof Error?e.message:String(e)}),r.push(t)}return r}catch(t){return d.error(`Failed to compile filter, returning unfiltered`,{error:t instanceof Error?t.message:String(t)}),e}}var m=`(function() {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
// ===== DOM Utilities =====
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./account-store-
|
|
1
|
+
import{a as e}from"./account-store-PyDP25J-.js";import{a as t}from"./diagnostics-DN_idNHx.js";import{a as n}from"./compat-uEPf6-XW.js";import{r,s as i}from"./legacy-api-aliases-jKEvBgOL.js";const a=`cerebras`,o=`https://api.cerebras.ai/v1`,s=`openai-completions`,c=`${a}-openai`,l=`slicc-cerebras-models`;let u=[];const d=[{id:`gpt-oss-120b`,name:`GPT OSS 120B`,api:`openai`,reasoning:!0,input:[`text`],context_window:131072,max_tokens:40960},{id:`gemma-4-31b`,name:`Gemma 4 31B`,api:`openai`,reasoning:!1,input:[`text`,`image`],context_window:131072,max_tokens:40960},{id:`zai-glm-4.7`,name:`Z.AI GLM-4.7`,api:`openai`,reasoning:!1,input:[`text`],context_window:131072,max_tokens:40960}];function f(e){try{localStorage.setItem(l,JSON.stringify(e))}catch{}}function p(){try{let e=localStorage.getItem(l);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)&&t.length>0?t:[]}catch{return[]}}function m(e){let t=e.id??``,n=d.find(e=>e.id===t);return{id:t,name:e.name??n?.name??t,api:`openai`,reasoning:e.capabilities?.reasoning??n?.reasoning??!1,input:e.capabilities?.vision?[`text`,`image`]:n?.input??[`text`],context_window:e.limits?.max_context_length??n?.context_window??8192,max_tokens:e.limits?.max_completion_tokens??n?.max_tokens??4096}}async function h(e){let t=await fetch(`${o}/models`,{headers:{Authorization:`Bearer ${e}`}});if(!t.ok)throw Error(`GET /v1/models → ${t.status} ${t.statusText}`);let n=((await t.json()).data??[]).map(m).filter(e=>e.id.length>0);n.length>0&&(u=n,f(n))}function g(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:c,provider:a,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}function _(e){console.error(`[cerebras] Stream error:`,e instanceof Error?e.message:String(e))}const v=(e,n,r={})=>{let i=t();return y(i,e,n,r).catch(_),i};async function y(e,t,n,i){try{let a={...t,baseUrl:o,api:s},c=r(a,n,i);for await(let t of c)e.push(t);e.end()}catch(n){_(n),e.push(g(t,n)),e.end()}}const b=(e,n,r)=>{let i=t();return x(i,e,n,r).catch(_),i};async function x(e,t,n,r){try{let a={...t,baseUrl:o,api:s},c=i(a,n,r);for await(let t of c)e.push(t);e.end()}catch(n){_(n),e.push(g(t,n)),e.end()}}const S={id:a,name:`Cerebras`,description:`Ultra-fast inference on Cerebras hardware. Get an API key at cloud.cerebras.ai.`,requiresApiKey:!0,requiresBaseUrl:!1,getModelIds:()=>{if(u.length>0)return u;let e=p();return e.length>0?e:d},refreshModels:async t=>{let n=t??e(a)??``;if(n)try{await h(n)}catch(e){console.warn(`[cerebras] Failed to refresh model list:`,e instanceof Error?e.message:String(e))}}};function C(){n({api:c,stream:v,streamSimple:b})}export{S as config,C as register};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./account-store-
|
|
1
|
+
import{_ as e}from"./account-store-Bxl3Ct33.js";import{a as t}from"./diagnostics-DN_idNHx.js";import{d as n}from"./claude-model-version-CSATLzrT.js";import{r,s as i}from"./legacy-api-aliases-bAJ0Klzq.js";var a=`cerebras`,o=`https://api.cerebras.ai/v1`,s=`openai-completions`,c=`${a}-openai`,l=`slicc-cerebras-models`,u=[],d=[{id:`gpt-oss-120b`,name:`GPT OSS 120B`,api:`openai`,reasoning:!0,input:[`text`],context_window:131072,max_tokens:40960},{id:`gemma-4-31b`,name:`Gemma 4 31B`,api:`openai`,reasoning:!1,input:[`text`,`image`],context_window:131072,max_tokens:40960},{id:`zai-glm-4.7`,name:`Z.AI GLM-4.7`,api:`openai`,reasoning:!1,input:[`text`],context_window:131072,max_tokens:40960}];function f(e){try{localStorage.setItem(l,JSON.stringify(e))}catch{}}function p(){try{let e=localStorage.getItem(l);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)&&t.length>0?t:[]}catch{return[]}}function m(e){let t=e.id??``,n=d.find(e=>e.id===t);return{id:t,name:e.name??n?.name??t,api:`openai`,reasoning:e.capabilities?.reasoning??n?.reasoning??!1,input:e.capabilities?.vision?[`text`,`image`]:n?.input??[`text`],context_window:e.limits?.max_context_length??n?.context_window??8192,max_tokens:e.limits?.max_completion_tokens??n?.max_tokens??4096}}async function h(e){let t=await fetch(`${o}/models`,{headers:{Authorization:`Bearer ${e}`}});if(!t.ok)throw Error(`GET /v1/models → ${t.status} ${t.statusText}`);let n=((await t.json()).data??[]).map(m).filter(e=>e.id.length>0);n.length>0&&(u=n,f(n))}function g(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:c,provider:a,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}function _(e){console.error(`[cerebras] Stream error:`,e instanceof Error?e.message:String(e))}var v=(e,n,r={})=>{let i=t();return y(i,e,n,r).catch(_),i};async function y(e,t,n,i){try{let a={...t,baseUrl:o,api:s},c=r(a,n,i);for await(let t of c)e.push(t);e.end()}catch(n){_(n),e.push(g(t,n)),e.end()}}var b=(e,n,r)=>{let i=t();return x(i,e,n,r).catch(_),i};async function x(e,t,n,r){try{let a={...t,baseUrl:o,api:s},c=i(a,n,r);for await(let t of c)e.push(t);e.end()}catch(n){_(n),e.push(g(t,n)),e.end()}}var S={id:a,name:`Cerebras`,description:`Ultra-fast inference on Cerebras hardware. Get an API key at cloud.cerebras.ai.`,requiresApiKey:!0,requiresBaseUrl:!1,getModelIds:()=>{if(u.length>0)return u;let e=p();return e.length>0?e:d},refreshModels:async t=>{let n=t??e(a)??``;if(n)try{await h(n)}catch(e){console.warn(`[cerebras] Failed to refresh model list:`,e instanceof Error?e.message:String(e))}}};function C(){n({api:c,stream:v,streamSimple:b})}export{S as config,C as register};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";var n=e({DEFAULT_TIMEOUT_MS:()=>i,MCP_SUPPORTED_PROTOCOL_VERSIONS:()=>a,McpAuthRequiredError:()=>c,McpClient:()=>S,McpTimeoutError:()=>u,parseResourceMetadataUrl:()=>f,selectSseResponseFrame:()=>p});const r=t(`mcp-client`),i=6e4,a=[`2026-07-28`,`2025-06-18`],o=a[0],s=a[1];var c=class extends Error{status;resourceMetadataUrl;wwwAuthenticate;constructor(e){super(`MCP server requires authentication (HTTP ${e.status})`),this.name=`McpAuthRequiredError`,this.status=e.status,this.resourceMetadataUrl=e.resourceMetadataUrl,this.wwwAuthenticate=e.wwwAuthenticate}},l=class extends Error{rpcError;constructor(e){super(`MCP RPC error ${e.code}: ${e.message}`),this.name=`McpRpcFailure`,this.rpcError=e}},u=class extends Error{method;timeoutMs;constructor(e){super(`MCP request timed out after ${e.timeoutMs}ms (${e.method})`),this.name=`McpTimeoutError`,this.method=e.method,this.timeoutMs=e.timeoutMs}},d=class extends Error{status;rpcError;constructor(e){super(`MCP HTTP ${e.status} ${e.statusText} for ${e.method}: ${e.snippet||`(empty body)`}`),this.name=`McpHttpError`,this.status=e.status,this.rpcError=e.rpcError}};function f(e){if(!e)return;let t=/resource_metadata="([^"]+)"/i.exec(e);return t?t[1]:/resource_metadata=([^,\s]+)/i.exec(e)?.[1]}function p(e,t){let n=new TextDecoder(`utf-8`).decode(e).replace(/\r\n/g,`
|
|
2
2
|
`).split(/\n\n/);for(let e of n){if(!e.trim())continue;let n=[];for(let t of e.split(`
|
|
3
3
|
`))t.startsWith(`data:`)&&n.push(t.slice(5).trimStart());if(n.length===0)continue;let r=n.join(`
|
|
4
|
-
`),i;try{i=JSON.parse(r)}catch{continue}if(i.id!==void 0&&i.id!==null&&i.id===t)return i}throw Error(`MCP SSE stream ended without a response for request id ${String(t)}`)}function m(e,t){let n=t.toLowerCase();for(let[t,r]of Object.entries(e))if(t.toLowerCase()===n)return r}function h(e){if(e instanceof d||e instanceof l)return e.rpcError}function g(e){return new l(e)}function _(e,t,n){let r=e.id===t||n?.allowNullId===!0&&e.id===null;if(e.jsonrpc!==`2.0`||!r||Object.hasOwn(e,`result`))return;let i=e.error;return i&&typeof i.code==`number`&&typeof i.message==`string`?i:void 0}function v(e,t){try{return _(JSON.parse(e),t,{allowNullId:!0})}catch{return}}function y(e,t){if(!t)return!1;let n=e instanceof d?e.status:void 0;return t.code===-32601?n===400||e instanceof l:t.code===-32e3&&n===400&&t.message.toLowerCase().includes(`mcp-session-id`)}function b(e){if(!e.data||typeof e.data!=`object`)return[];let t=e.data.supported;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}async function x(){let{createProxiedFetch:e}=await import(`./proxied-fetch-
|
|
4
|
+
`),i;try{i=JSON.parse(r)}catch{continue}if(i.id!==void 0&&i.id!==null&&i.id===t)return i}throw Error(`MCP SSE stream ended without a response for request id ${String(t)}`)}function m(e,t){let n=t.toLowerCase();for(let[t,r]of Object.entries(e))if(t.toLowerCase()===n)return r}function h(e){if(e instanceof d||e instanceof l)return e.rpcError}function g(e){return new l(e)}function _(e,t,n){let r=e.id===t||n?.allowNullId===!0&&e.id===null;if(e.jsonrpc!==`2.0`||!r||Object.hasOwn(e,`result`))return;let i=e.error;return i&&typeof i.code==`number`&&typeof i.message==`string`?i:void 0}function v(e,t){try{return _(JSON.parse(e),t,{allowNullId:!0})}catch{return}}function y(e,t){if(!t)return!1;let n=e instanceof d?e.status:void 0;return t.code===-32601?n===400||e instanceof l:t.code===-32e3&&n===400&&t.message.toLowerCase().includes(`mcp-session-id`)}function b(e){if(!e.data||typeof e.data!=`object`)return[];let t=e.data.supported;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}async function x(){let{createProxiedFetch:e}=await import(`./proxied-fetch-DEK8DT-z.js`).then(e=>e.i),t=e();return async(e,n)=>{let r=await t(e,{method:n?.method,headers:n?.headers,body:n?.body});return{status:r.status,statusText:r.statusText,headers:r.headers,body:r.body}}}var S=class{url;staticHeaders;timeoutMs;getAuthHeader;preferredProtocolVersion;clientInfo;fetchImpl;fetchImplLoader=null;sessionId;negotiatedProtocolVersion;nextId=1;constructor(e){this.url=e.url,this.staticHeaders=e.headers??{},this.timeoutMs=e.timeoutMs??6e4,this.getAuthHeader=e.getAuthHeader,this.preferredProtocolVersion=e.protocolVersion??o,this.clientInfo=e.clientInfo??{name:`SLICC`,version:`0.0.0`},this.fetchImpl=e.fetchImpl??null,this.sessionId=e.sessionId}getSessionId(){return this.sessionId}getNegotiatedProtocolVersion(){return this.negotiatedProtocolVersion}async initialize(){if(this.preferredProtocolVersion===s)return this.initializeLegacy();try{return await this.discoverModern(this.preferredProtocolVersion)}catch(e){let t=h(e);if(t?.code===-32022){let e=b(t),n=a.find(t=>t!==s&&e.includes(t));if(!n)throw Error(`MCP server does not support a compatible modern protocol version (supported: ${e.join(`, `)||`none`})`);return this.discoverModern(n)}if(y(e,t))return r.debug(`server/discover identified a legacy server; using initialize`,{error:e instanceof Error?e.message:String(e)}),this.initializeLegacy();throw e}}async discoverModern(e){let t=await this.request(`server/discover`,{protocolVersion:e}),n=Array.isArray(t?.supportedVersions)?t.supportedVersions.filter(e=>typeof e==`string`):[],r=a.find(e=>e!==s&&n.includes(e));if(!r)throw Error(`MCP server discovery did not advertise a compatible modern protocol version (advertised: ${n.join(`, `)||`none`})`);return this.negotiatedProtocolVersion=r,this.sessionId=void 0,t}async toolsList(){return(await this.request(`tools/list`,{}))?.tools??[]}async toolsCall(e,t){return this.request(`tools/call`,{name:e,arguments:t})}async appsList(){try{return(await this.request(`apps/list`,{}))?.apps??[]}catch(e){if(e instanceof c)throw e;return r.debug(`apps/list not supported by server`,{error:e instanceof Error?e.message:String(e)}),[]}}async request(e,t){let n=this.nextId++,r=await this.resolveFetchImpl(),i={"Content-Type":`application/json`,Accept:`application/json, text/event-stream`,...this.staticHeaders};if(this.negotiatedProtocolVersion===s&&this.sessionId&&e!==`initialize`&&(i[`Mcp-Session-Id`]=this.sessionId),this.getAuthHeader){let e=await this.getAuthHeader();e&&(i.Authorization=e)}let a=JSON.stringify({jsonrpc:`2.0`,id:n,method:e,params:t}),o=new AbortController,l=!1,h,y=new Promise((t,n)=>{h=setTimeout(()=>{l=!0,n(new u({method:e,timeoutMs:this.timeoutMs})),o.abort()},this.timeoutMs)}),b,x=r(this.url,{method:`POST`,headers:i,body:a,signal:o.signal});try{b=await Promise.race([x,y])}catch(t){throw l?(x.catch(()=>void 0),new u({method:e,timeoutMs:this.timeoutMs})):t}finally{h&&clearTimeout(h)}if(b.status===401){let e=m(b.headers,`www-authenticate`);throw new c({status:401,wwwAuthenticate:e,resourceMetadataUrl:f(e)})}if(this.negotiatedProtocolVersion===s){let e=m(b.headers,`mcp-session-id`);e&&(this.sessionId=e)}if(b.status>=400){let t=new TextDecoder(`utf-8`).decode(b.body);throw new d({status:b.status,statusText:b.statusText,method:e,snippet:t.slice(0,512),rpcError:v(t,n)})}let S=(m(b.headers,`content-type`)??``).toLowerCase().includes(`text/event-stream`)?p(b.body,n):JSON.parse(new TextDecoder(`utf-8`).decode(b.body));if(S.error){let e=_(S,n);throw e?g(e):Error(`MCP invalid JSON-RPC error response for request id ${String(n)}`)}return S.result}async resolveFetchImpl(){return this.fetchImpl?this.fetchImpl:(this.fetchImplLoader||=x().then(e=>(this.fetchImpl=e,e)),this.fetchImplLoader)}async initializeLegacy(){return this.negotiatedProtocolVersion=s,this.request(`initialize`,{protocolVersion:s,capabilities:{},clientInfo:this.clientInfo})}};export{n,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./logger-DDBAeTLF.js";import{q as t}from"./wc-shortcuts-
|
|
1
|
+
import{t as e}from"./logger-DDBAeTLF.js";import{q as t}from"./wc-shortcuts-8_tK1cDi.js";import{n}from"./runtime-env-Dlaokqg1.js";import{t as r}from"./permissions-surface-registry-CilCRwhh.js";import{t as i}from"./speech-assets-bridge-CFYafE89.js";import{o as a}from"./transformers-env-IYiDhpM2.js";import{i as o,t as s}from"./whisper-session-Cbuk405M.js";var c=e(`speech:composer`),l=5e3,u=(e,t,n)=>new Promise((r,i)=>{let a=setTimeout(()=>i(Error(`${n} timed out after ${t}ms`)),t);e.then(e=>{clearTimeout(a),r(e)},e=>{clearTimeout(a),i(e)})}),d=class{#e;#t;#n;#r;#i;#a=null;#o=!1;#s={engine:`builtin`,state:`idle`};#c=a();#l=new Set;#u=null;constructor(e={}){this.#e=e.builtin??t(),this.#t=e.loadWhisper??o,this.#n=e.startSession??s,this.#r=e.getPermissionSurface??f,this.#i=e.ensureAssets??v}permission(){return this.#e.permission()}async requestPermission(){let e=this.#r();if(e)try{let t=await e.request(`microphone`);return t?(this.#p(t.stream),!0):!1}catch(e){return c.warn(`permission surface microphone request failed`,e),!1}return this.#e.requestPermission()}microphones(){return this.#e.microphones()}status(){return this.#s}onStatus(e){return this.#l.add(e),e(this.#s),()=>this.#l.delete(e)}warmup(){this.#o||(this.#o=!0,this.#c=a(),this.#_({engine:`builtin`,state:`downloading`}),this.#d().then(e=>{this.#a=e,this.#_({engine:`enhanced`,state:`ready`})},e=>{this.#o=!1,this.#_({engine:`builtin`,state:`unavailable`,message:m(e)}),c.warn(`enhanced speech engine unavailable`,e)}))}async#d(){let e=null;try{await this.#i(e=>this.#h(e))}catch(t){e=t,c.warn(`speech asset staging failed; trying already-present assets`,t)}try{return await this.#t(e=>this.#g(e))}catch(t){throw e??t}}async start(e){let t=this.#a;if(t){let n=null;try{return n=await this.#f(e.deviceId),await this.#n(t,{deviceId:e.deviceId,lang:e.lang,onPartial:e.onPartial,onError:e.onError,stream:n??void 0})}catch(e){if(n)for(let e of n.getTracks())e.stop();c.warn(`whisper session failed to start; falling back to builtin`,e)}}return this.#e.start(e)}async#f(e){let t=e&&e!=="default"?e:void 0,n=this.#m();if(n){if(!t&&p(n))return n;for(let e of n.getTracks())e.stop()}let r=this.#r();if(!r)return null;let i={audio:!t||{deviceId:{exact:t}}},a=await u(r.request(`microphone`,{constraints:i}),l,`microphone capture`);if(!a)throw Error(`microphone permission denied`);return a.stream}#p(e){if(this.#u&&this.#u!==e)for(let e of this.#u.getTracks())e.stop();this.#u=e}#m(){let e=this.#u;return this.#u=null,e}get enhancedReady(){return this.#a!==null}#h(e){if(this.#s.state!==`downloading`)return;(e.bytesTotal!=null||e.bytesLoaded!=null)&&this.#c.update(e.asset,e.bytesLoaded??0,e.bytesTotal??0);let t=this.#c.snapshot();t.total<=0||this.#_({engine:`builtin`,state:`downloading`,download:{loaded:t.loaded,total:t.total,etaSeconds:t.etaSeconds}})}#g(e){this.#s.state===`downloading`&&this.#_({engine:`builtin`,state:`downloading`,download:{loaded:e.loaded,total:e.total,etaSeconds:e.etaSeconds}})}#_(e){this.#s=e;for(let t of this.#l)t(e)}};function f(){let e=r();return e?{async request(t,n){let r=await e.request(t,n);return r?.kind===`microphone`?{kind:`microphone`,stream:r.stream}:null}}:null}function p(e){let t=e.getTracks();return t.length>0&&t.some(e=>e.readyState!==`ended`)}function m(e){return`Enhanced speech unavailable: ${e instanceof Error?e.message:String(e)}`}var h=n,g;function _(e){g=e}function v(e){return h()?Promise.resolve():i({instanceId:g,onProgress:e})}var y=null;function b(){return y??=new d,y}export{b as getComposerSpeech,_ as setComposerSpeechInstanceId};
|