sliccy 6.232.1 → 6.232.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/.vite/manifest.json +182 -182
- package/dist/ui/assets/{account-store-B9NAiCud.js → account-store-B857f9Kw.js} +1 -1
- package/dist/ui/assets/{account-store-BjfGeTTt.js → account-store-C8W_QB2_.js} +1 -1
- package/dist/ui/assets/{adobe-Bz-ZNRYT.js → adobe-C2NABnF7.js} +1 -1
- package/dist/ui/assets/{adobe-Djo2u4ZW.js → adobe-hInWK-RG.js} +1 -1
- package/dist/ui/assets/{agent-panels-CP61MyvH.js → agent-panels-DjIYV1_V.js} +1 -1
- package/dist/ui/assets/{almost-bash-shell-headless-CSew1mj5.js → almost-bash-shell-headless-Cr-YVYbG.js} +27 -27
- package/dist/ui/assets/{apply-layout-C5tkEPIw.js → apply-layout-6y46WnDn.js} +1 -1
- package/dist/ui/assets/{apps-Dp0TUE_0.js → apps-DkZBf0EF.js} +1 -1
- package/dist/ui/assets/{azure-openai-JkY4uYkc.js → azure-openai-BPC12gr1.js} +1 -1
- package/dist/ui/assets/{azure-openai-CzOmuJGM.js → azure-openai-DaGSGR26.js} +1 -1
- package/dist/ui/assets/{backend-hostfs-DoiWbvcu.js → backend-hostfs-CyFczT_n.js} +1 -1
- package/dist/ui/assets/{cdp-38zgn7rv.js → cdp-Cp2ul1Xk.js} +1 -1
- package/dist/ui/assets/{cerebras-DTSHi-Ie.js → cerebras-BEDSf9Z2.js} +1 -1
- package/dist/ui/assets/{cerebras-j4mzqJoZ.js → cerebras-CAFxbAAH.js} +1 -1
- package/dist/ui/assets/{composer-speech-BeeuLGg2.js → composer-speech-BveIVRUb.js} +1 -1
- package/dist/ui/assets/{connect-surface-CeR_GM7x.js → connect-surface-ogo7Rv2Y.js} +1 -1
- package/dist/ui/assets/{directed-approval-CX_HvwXp.js → directed-approval-BoAbm3IJ.js} +1 -1
- package/dist/ui/assets/{emscripten-vfs-hook-CD4XHFnz.js → emscripten-vfs-hook-CYIDH-AN.js} +1 -1
- package/dist/ui/assets/{ensure-speech-assets-D_Xx-dcP.js → ensure-speech-assets-BvTOfAF9.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-B2hU8rG5.js → frozen-archive-writer-Ce13R-3M.js} +1 -1
- package/dist/ui/assets/{fs-B-LLf0bG.js → fs-Bl4-flxd.js} +2 -2
- package/dist/ui/assets/{fs-BWRHmpI5.js → fs-CXdlfm9I.js} +1 -1
- package/dist/ui/assets/{gelatiere-unit-CSTPHfIX.js → gelatiere-unit-Cr5wm_Kg.js} +1 -1
- package/dist/ui/assets/{github-9cbMQjmV.js → github-DBc_eOzS.js} +2 -2
- package/dist/ui/assets/{github-j3XObHP4.js → github-DELN8f0M.js} +1 -1
- package/dist/ui/assets/{github-auth-BZVZ7x8a.js → github-auth-D7J-BVhH.js} +1 -1
- package/dist/ui/assets/{github-copilot-CoY3bmiB.js → github-copilot-D7W2tJJz.js} +1 -1
- package/dist/ui/assets/{github-copilot-BpQfJba9.js → github-copilot-kJD8s7l4.js} +1 -1
- package/dist/ui/assets/{github-install-D1o7qomc.js → github-install-Day-m9Yr.js} +1 -1
- package/dist/ui/assets/{github-zip-CF_1Mtat.js → github-zip-xnabOe2b.js} +1 -1
- package/dist/ui/assets/{go-driver-DKvMuQ4C.js → go-driver-xTPUsgZ_.js} +1 -1
- package/dist/ui/assets/{hear-BDEEoiSx.js → hear-CdqoxknG.js} +1 -1
- package/dist/ui/assets/{help-Dmz0iRDg.js → help-B1T-o5sr.js} +1 -1
- package/dist/ui/assets/{installer-vW0yDgjr.js → installer-Ce066nKI.js} +1 -1
- package/dist/ui/assets/{ipk-mamba-COgtFryU.js → ipk-mamba-fKbu5XN4.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-b9Yx9oEC.js → js-realm-worker-DluaIwWT.js} +2 -2
- package/dist/ui/assets/{jsh-executor-By4DIUnQ.js → jsh-executor-D3BSRLFA.js} +2 -2
- package/dist/ui/assets/{kernel-worker-Cvf_O6Kr.js → kernel-worker-M218S0e9.js} +9 -9
- package/dist/ui/assets/{lick-ws-bridge-Bn8djfxu.js → lick-ws-bridge-B0AqTybW.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-CIDrcFiD.js → lick-ws-bridge-k53YqSiL.js} +1 -1
- package/dist/ui/assets/{live-session-curation-kO8HahKE.js → live-session-curation-DtmCoogl.js} +1 -1
- package/dist/ui/assets/{live-session-snapshot-CabSfB3u.js → live-session-snapshot-CzH5VyWG.js} +1 -1
- package/dist/ui/assets/{local-llm-BncDAj1R.js → local-llm-BYFR1wMj.js} +1 -1
- package/dist/ui/assets/{local-llm-sQhI3SXN.js → local-llm-CUTYS-aa.js} +1 -1
- package/dist/ui/assets/{main-DFzXj4Ap.js → main-CxkrqswY.js} +3 -3
- package/dist/ui/assets/{main-cherry-DjaHu26a.js → main-cherry-DnV2EtCt.js} +1 -1
- package/dist/ui/assets/{mcp-command-BQXcGbwB.js → mcp-command-BoGKsJ--.js} +12 -12
- package/dist/ui/assets/{memory-curation-seam-B_qGv6QI.js → memory-curation-seam-CLon6-0I.js} +1 -1
- package/dist/ui/assets/{memory-health-Cr7zxx4A.js → memory-health-B8JnBJZW.js} +1 -1
- package/dist/ui/assets/{memory-write-execute-U7BM-a7_.js → memory-write-execute-D-eE12zu.js} +1 -1
- package/dist/ui/assets/{merge-folded-cost-into-frozen-DIIPiCza.js → merge-folded-cost-into-frozen-Cv81Es_U.js} +1 -1
- package/dist/ui/assets/{mount-CV-BVSM3.js → mount-DvlJAh57.js} +1 -1
- package/dist/ui/assets/{mount-D70lNd1N.js → mount-H5EgXlPD.js} +3 -3
- package/dist/ui/assets/{new-session-CQAuY4KE.js → new-session-DW8XeVxp.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-BaNDvFJl.js → oauth-bootstrap-BNFgdYgz.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-CeGSoBBd.js → onboarding-orchestrator-Ca--LViR.js} +1 -1
- package/dist/ui/assets/{openai-codex-AiKZcdM6.js → openai-codex-BUS22UvF.js} +1 -1
- package/dist/ui/assets/{openai-codex-D8h522X1.js → openai-codex-CVRDijVn.js} +1 -1
- package/dist/ui/assets/{openrouter-w4y3GCPU.js → openrouter-CNys7eBu.js} +1 -1
- package/dist/ui/assets/{openrouter-D4UvvWjX.js → openrouter-DaY_PmOO.js} +1 -1
- package/dist/ui/assets/{openrouter-free-Dpl6B5fH.js → openrouter-free-CLv2guAs.js} +1 -1
- package/dist/ui/assets/{openrouter-free-Jo6JUMdn.js → openrouter-free-DLoVUZYB.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-BzcBCIMl.js → openrouter-oauth-Dy_qCqcN.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CPpLFF4m.js → openrouter-oauth-YeISAtXv.js} +1 -1
- package/dist/ui/assets/{opfs-mount-CEISbLdP.js → opfs-mount-cbV6hAiM.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-COj4LAbm.js → panel-rpc-handlers-BNEtTGhT.js} +2 -2
- package/dist/ui/assets/{panelize-shell-gHzxRw9h.js → panelize-shell-zDW06WQ9.js} +1 -1
- package/dist/ui/assets/{pi-edit-execution-B-htZMe7.js → pi-edit-execution-Blmvyfch.js} +1 -1
- package/dist/ui/assets/{process-worker-BXcmjjns.js → process-worker-BKgTk6Wd.js} +1 -1
- package/dist/ui/assets/{provider-DqfbNx1g.js → provider-L54O0b3P.js} +1 -1
- package/dist/ui/assets/{provider-DV5A_7IM.js → provider-MDIcOntz.js} +2 -2
- package/dist/ui/assets/{provider-settings--5JFkAeb.js → provider-settings-5llrPtIb.js} +1 -1
- package/dist/ui/assets/provider-store-access-nagoWWb1.js +1 -0
- package/dist/ui/assets/provider-store-access-wdRnmqbS.js +1 -0
- package/dist/ui/assets/{providers-DRXtGsiH.js → providers-DSWENZNJ.js} +1 -1
- package/dist/ui/assets/{providers-DdxfStbH.js → providers-jygoVQBo.js} +2 -2
- package/dist/ui/assets/{quick-llm-BC2oDrme.js → quick-llm-D6Wr4TyZ.js} +1 -1
- package/dist/ui/assets/{realm-inprocess-9LFGFCcK.js → realm-inprocess-s4ChFcqp.js} +2 -2
- package/dist/ui/assets/{realm-unhandled-rejections-CAczZ0N0.js → realm-unhandled-rejections-BAiAaesU.js} +1 -1
- package/dist/ui/assets/{realm-unhandled-rejections-aM-BvJZR.js → realm-unhandled-rejections-Bju1msWn.js} +1 -1
- package/dist/ui/assets/{recovery-screen-ZhIfXWHL.js → recovery-screen-DLmHqUsS.js} +1 -1
- package/dist/ui/assets/{remote-terminal-view-BQ8uaUim.js → remote-terminal-view-WWBk5qFn.js} +2 -2
- package/dist/ui/assets/{restore-CTCRzvNh.js → restore-DTlvxkxE.js} +1 -1
- package/dist/ui/assets/{run-B8IAldKH.js → run-9qBbvzkW.js} +1 -1
- package/dist/ui/assets/{run-DuqDZMb3.js → run-BKv0GiVy.js} +1 -1
- package/dist/ui/assets/{run-CVZ8dV9Z.js → run-Bo0rlg63.js} +2 -2
- package/dist/ui/assets/{run-D7w8ut3l.js → run-CRimkv1y.js} +2 -2
- package/dist/ui/assets/{run-DemKXbNO.js → run-D31zYxYd.js} +1 -1
- package/dist/ui/assets/{run-g-X3dTSo.js → run-dFcc7q5n.js} +1 -1
- package/dist/ui/assets/{session-command-memory-wRVMs4Tj.js → session-command-memory-Df5JM1jy.js} +2 -2
- package/dist/ui/assets/{session-jsonl-BMe2gRCP.js → session-jsonl-CRg856OA.js} +1 -1
- package/dist/ui/assets/{session-jsonl-jHmA3Z8R.js → session-jsonl-DyYSpiR3.js} +1 -1
- package/dist/ui/assets/{session-search-index-CPxHdFiO.js → session-search-index-CxeajBYy.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-CLK9RQld.js → setup-feature-flags-remote-B7EvE5WG.js} +1 -1
- package/dist/ui/assets/{setup-model-catalog-DzoZIXjc.js → setup-model-catalog-CojuaZXL.js} +1 -1
- package/dist/ui/assets/{signed-fetch-BYlgbN5-.js → signed-fetch-C1-081oc.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-C_5vt7WN.js → silent-renew-backoff-BJestVXs.js} +1 -1
- package/dist/ui/assets/slicc-version-B0t7wsNA.js +1 -0
- package/dist/ui/assets/{snapshot-CRzAt7FE.js → snapshot-Cb2BkTl8.js} +1 -1
- package/dist/ui/assets/{snapshot-features-Dl5OZRRD.js → snapshot-features-CttxuZRc.js} +1 -1
- package/dist/ui/assets/{soundscape-B5wl6uNe.js → soundscape-CGPRupA1.js} +1 -1
- package/dist/ui/assets/{speak-CsDBSFSc.js → speak-CwevwRGG.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-ByegzK4g.js → sprinkle-manager-nQ3MRYze.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-DEvWTy4j.js → sprinkle-renderer-DQe4_ykh.js} +1 -1
- package/dist/ui/assets/{state-UjVstscY.js → state-CRuL5BZp.js} +1 -1
- package/dist/ui/assets/{store-jaaK6Occ.js → store-Ct6T8_vC.js} +1 -1
- package/dist/ui/assets/{store-uM0i8Poo.js → store-N9OMacY2.js} +1 -1
- package/dist/ui/assets/{sudo-DhuLhnRd.js → sudo-CVBz7Hub.js} +1 -1
- package/dist/ui/assets/{supervisor-C1NKlIKp.js → supervisor-d43UzH63.js} +1 -1
- package/dist/ui/assets/{sync-dialog-yG1Kj0Ua.js → sync-dialog-DFEhMgmr.js} +1 -1
- package/dist/ui/assets/{transformers-env-CXVElXgN.js → transformers-env-BVWRXJj7.js} +1 -1
- package/dist/ui/assets/{tray-leader-B4LxY7F_.js → tray-leader-DjSQqusA.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-CAdFVkVo.js → tray-leave-runtime-CZ1DjZNm.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-C8CforeJ.js → tray-sidecar-CjNuAx0_.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-QfynQMyL.js → upgrade-detection-j5O1jpk-.js} +1 -1
- package/dist/ui/assets/{upskill-lick-skip-B1oh3KFo.js → upskill-lick-skip-D9rXamQ_.js} +1 -1
- package/dist/ui/assets/{voice-reply-2rym12dk.js → voice-reply-DDhoSB_B.js} +1 -1
- package/dist/ui/assets/{wasi-runtime-DpCCpScc.js → wasi-runtime-Bc01Bdaa.js} +2 -2
- package/dist/ui/assets/{wc-attach-8DvAlvRk.js → wc-attach-VJjD6tJb.js} +2 -2
- package/dist/ui/assets/{wc-browser-Cc0wc7sK.js → wc-browser-H9i1tYs2.js} +1 -1
- package/dist/ui/assets/{wc-computers-D2WMYpRs.js → wc-computers-CZVMeb1a.js} +1 -1
- package/dist/ui/assets/{wc-detached-BYrJv1Pi.js → wc-detached-C3w-EnO2.js} +1 -1
- package/dist/ui/assets/{wc-extension-bGGA59Lc.js → wc-extension-BaXTVkwH.js} +2 -2
- package/dist/ui/assets/{wc-follower-BEFn4tDO.js → wc-follower-B2K4I2jj.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-BITU1r1m.js → wc-follower-oauth-Dpz6kwmb.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-DpUliuo8.js → wc-gelatiere-DUqsrBPY.js} +1 -1
- package/dist/ui/assets/{wc-live-B3xfspeg.js → wc-live-DPQeITgQ.js} +5 -5
- package/dist/ui/assets/{wc-nav-BvM4z5jU.js → wc-nav-DKr3h3r5.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-Cj-8agbG.js → wc-onboarding-nZO6VPxy.js} +2 -2
- package/dist/ui/assets/{wc-permissions-DC3jkato.js → wc-permissions-BncUPK23.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-DLtjzvI2.js → wc-placeholder-D8F3dotr.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-mkhCBMcE.js → wc-secret-request-BAhfbP9J.js} +1 -1
- package/dist/ui/assets/{wc-settings-MSj3TwSP.js → wc-settings-BnJRa_R9.js} +3 -3
- package/dist/ui/assets/{wc-shell-CjZMoCV4.js → wc-shell-BzYq0ESt.js} +3 -3
- package/dist/ui/assets/{wc-shortcut-config-D8qtJaB9.js → wc-shortcut-config-Dyjf2Wvu.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-CWh_QyqB.js → wc-sprinkles-qa2Yk76b.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-C4au4GRp.js → wc-transcript-export-Bk8nLIfQ.js} +2 -2
- package/dist/ui/assets/{wc-tray-Crx_RosL.js → wc-tray-BEN7TcmV.js} +4 -4
- package/dist/ui/assets/welcome-detection-DUIoHDqJ.js +1 -0
- package/dist/ui/assets/{whisper-session-DVySo8di.js → whisper-session-xH7lWXSW.js} +2 -2
- package/dist/ui/assets/{xai-grok-Dw3U-q7x.js → xai-grok-B11VgjUo.js} +1 -1
- package/dist/ui/assets/{xai-grok-BK3Rrluc.js → xai-grok-DgGOq90R.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/provider-store-access-Dtozn27m.js +0 -1
- package/dist/ui/assets/provider-store-access-Dzd2VXlw.js +0 -1
- package/dist/ui/assets/slicc-version-BQjDBKr6.js +0 -1
- package/dist/ui/assets/welcome-detection-H8o_tuf3.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/azure-openai-
|
|
2
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./preload-helper-Czpn1I53.js";var n={include:[`*`],exclude:[`amazon-bedrock`,`xai`]},r=e({getRegisteredProviderConfig:()=>d,getRegisteredProviderIds:()=>f,registerProviderConfig:()=>p,registerProviders:()=>u,shouldIncludeProvider:()=>a}),i=Object.assign({"/packages/dev-tools/providers.build.json":n})[`/packages/dev-tools/providers.build.json`]??{include:[`*`],exclude:[]};function a(e){let{include:t,exclude:n}=i;return n.includes(`*`)||n.includes(e)?!1:!!(t.includes(`*`)||t.includes(e))}var o=Object.assign({"./built-in/azure-ai-foundry.ts":()=>t(()=>import(`./azure-ai-foundry-Bo0FAJyX.js`),[]),"./built-in/azure-openai.ts":()=>t(()=>import(`./azure-openai-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/azure-openai-BPC12gr1.js","assets/diagnostics-Cag7MsZI.js","assets/models-Xc0Gclrk.js","assets/preload-helper-Czpn1I53.js","assets/compat-BAGLwgqY.js","assets/env-api-keys-BXRkymgV.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/openrouter.models-DHpsqCCC.js","assets/account-store-B857f9Kw.js","assets/core-4boN-CgI.js","assets/libesm-BypnjKEL.js","assets/logger-DDBAeTLF.js","assets/feature-flags-DvsApnS-.js","assets/proxied-fetch-Cplb-Tee.js","assets/base64-ELzoYfwP.js","assets/proxy-error-BSFYY7jj.js","assets/api-endpoint-DuEQRZ4g.js","assets/runtime-env-Dlaokqg1.js","assets/secret-topology-Dm_PZRZx.js","assets/float-topology-C9GjBEv-.js","assets/secrets-bridge-client-CWv2_nw7.js","assets/port-bridge-client-D_erEovW.js","assets/image-markers-q8JQTtid.js","assets/tool-ui-eSQ1g2I1.js","assets/panel-rpc-D3EPRnmw.js","assets/bedrock-camp-compat-B1oHsbyo.js","assets/bedrock-camp-extra-models-BYrxX19D.js","assets/claude-model-version-DZmbk9E2.js","assets/transform-messages-k2mfzJwY.js","assets/pi-transcript-context-miZCMig3.js","assets/bedrock-camp-CWYBPsp_.js","assets/temperature-support-DhoZT6gU.js","assets/local-llm-CUTYS-aa.js","assets/legacy-api-aliases-BjgG1CsY.js","assets/adobe-C2NABnF7.js","assets/main-CxkrqswY.js","assets/modulepreload-polyfill-P2Xu9kJm.js","assets/bridge-protocol-C52CnDIj.js","assets/telemetry-B0sKnLBU.js","assets/tray-follower-status-BAjnN7Ar.js","assets/clipboard-eqmn97SP.js","assets/silent-renew-backoff-BJestVXs.js","assets/provider-budget-LCzMPlKv.js","assets/oauth-service-B-vKfxAF.js","assets/permissions-surface-registry-CilCRwhh.js","assets/llm-session-id-bZQs6gBN.js","assets/cerebras-BEDSf9Z2.js","assets/github-copilot-D7W2tJJz.js","assets/github-DBc_eOzS.js","assets/global-db-CbuLl-zx.js","assets/bridge-token-required-DMk2va9k.js","assets/openai-codex-BUS22UvF.js","assets/pkce-hGf_TEnP.js","assets/openrouter-free-CLv2guAs.js","assets/openrouter-models-DawLtPaY.js","assets/openrouter-oauth-Dy_qCqcN.js","assets/openrouter-CNys7eBu.js","assets/xai-grok-B11VgjUo.js","assets/xai-grok-errors-bnlIBeu-.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./preload-helper-Czpn1I53.js";var n={include:[`*`],exclude:[`amazon-bedrock`,`xai`]},r=e({getRegisteredProviderConfig:()=>d,getRegisteredProviderIds:()=>f,registerProviderConfig:()=>p,registerProviders:()=>u,shouldIncludeProvider:()=>a}),i=Object.assign({"/packages/dev-tools/providers.build.json":n})[`/packages/dev-tools/providers.build.json`]??{include:[`*`],exclude:[]};function a(e){let{include:t,exclude:n}=i;return n.includes(`*`)||n.includes(e)?!1:!!(t.includes(`*`)||t.includes(e))}var o=Object.assign({"./built-in/azure-ai-foundry.ts":()=>t(()=>import(`./azure-ai-foundry-Bo0FAJyX.js`),[]),"./built-in/azure-openai.ts":()=>t(()=>import(`./azure-openai-BPC12gr1.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31])),"./built-in/bedrock-camp-compat.ts":()=>t(()=>import(`./bedrock-camp-compat-B1oHsbyo.js`).then(e=>e.o),__vite__mapDeps([27,8])),"./built-in/bedrock-camp-extra-models.ts":()=>t(()=>import(`./bedrock-camp-extra-models-BYrxX19D.js`).then(e=>e.n),__vite__mapDeps([28,8,27])),"./built-in/bedrock-camp.ts":()=>t(()=>import(`./bedrock-camp-CWYBPsp_.js`),__vite__mapDeps([32,1,2,3,4,5,6,7,8,9,27,29,30,31,33])),"./built-in/local-llm.ts":()=>t(()=>import(`./local-llm-CUTYS-aa.js`),__vite__mapDeps([34,1,4,2,3,5,6,7,8,9,35,13,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31]))}),s=Object.assign({"/packages/webapp/providers/adobe.ts":()=>t(()=>import(`./adobe-C2NABnF7.js`),__vite__mapDeps([36,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,35,10,26,27,28,29,37,38,39,40,41,42,43,44,45,46,31,33,47])),"/packages/webapp/providers/cerebras.ts":()=>t(()=>import(`./cerebras-BEDSf9Z2.js`),__vite__mapDeps([48,1,4,2,3,5,6,7,8,9,35,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31])),"/packages/webapp/providers/github-copilot.ts":()=>t(()=>import(`./github-copilot-D7W2tJJz.js`),__vite__mapDeps([49,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,35,10,26,27,28,29,37,38,39,40,41,42])),"/packages/webapp/providers/github.ts":()=>t(()=>import(`./github-DBc_eOzS.js`),__vite__mapDeps([50,3,10,8,11,4,2,1,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,37,38,39,40,41,42,43,45,46,51,52])),"/packages/webapp/providers/openai-codex.ts":()=>t(()=>import(`./openai-codex-BUS22UvF.js`),__vite__mapDeps([53,1,4,2,3,5,6,7,8,9,35,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,37,38,39,40,41,42,31,52,54])),"/packages/webapp/providers/openrouter-free.ts":()=>t(()=>import(`./openrouter-free-CLv2guAs.js`),__vite__mapDeps([55,1,4,2,3,5,6,7,8,9,35,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,37,38,39,40,41,42,31,56,57,54])),"/packages/webapp/providers/openrouter-models.ts":()=>t(()=>import(`./openrouter-models-DawLtPaY.js`),__vite__mapDeps([56,9])),"/packages/webapp/providers/openrouter-oauth.ts":()=>t(()=>import(`./openrouter-oauth-Dy_qCqcN.js`),__vite__mapDeps([57,10,8,11,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,37,38,39,40,41,42,54])),"/packages/webapp/providers/openrouter.ts":()=>t(()=>import(`./openrouter-CNys7eBu.js`),__vite__mapDeps([58,4,2,1,3,5,6,7,8,9,35,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,37,38,39,40,41,42,31,56,57,54])),"/packages/webapp/providers/xai-grok-errors.ts":()=>t(()=>import(`./xai-grok-errors-bnlIBeu-.js`),[]),"/packages/webapp/providers/xai-grok.ts":()=>t(()=>import(`./xai-grok-B11VgjUo.js`),__vite__mapDeps([59,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,35,10,26,27,28,29,37,38,39,40,41,42,31,52,54,60]))}),c=new Map,l=null;function u(){return l===null&&(l=(async()=>{let e=await Promise.all(Object.values(o).map(e=>e()));for(let t of e)t.config&&a(t.config.id)&&(c.set(t.config.id,t.config),t.register?.());let t=await Promise.all(Object.values(s).map(e=>e()));for(let e of t)e.config&&(c.set(e.config.id,e.config),e.register?.())})()),l}function d(e){return c.get(e)}function f(){return[...c.keys()]}function p(e){c.set(e.id,e)}export{u as a,p as i,f as n,a as o,r,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./compat-BAGLwgqY.js";import{t as n}from"./logger-DDBAeTLF.js";import{A as r,D as i,g as a,k as o}from"./account-store-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./compat-BAGLwgqY.js";import{t as n}from"./logger-DDBAeTLF.js";import{A as r,D as i,g as a,k as o}from"./account-store-B857f9Kw.js";import{t as s}from"./llm-session-id-bZQs6gBN.js";import{i as c,t as l}from"./icons-2DY2vYOc.js";var u=e({lucideIconNames:()=>h,pickLucideIcon:()=>g,quickLabel:()=>f}),d=n(`quick-llm`);async function f(e){let n=a();if(!n)return d.debug(`No API key for active provider — skipping`),null;let i=r(),s=o(),c;if(c=e.modelId?b(i,e.modelId)??b(i,s):_(i,s),!c)return d.debug(`No model available for provider`,{providerId:i}),null;let l={role:`user`,content:e.prompt,timestamp:Date.now()},u={};c.provider===`adobe`&&(u[`X-Session-Id`]=S());try{let r=(await t(c,{systemPrompt:e.system,messages:[l]},{apiKey:n,maxTokens:e.maxTokens??60,temperature:e.temperature??.3,signal:e.signal,headers:Object.keys(u).length>0?u:void 0})).content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim();return r.length>0?r:null}catch(e){return d.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}var p=null;function m(e){return e.replace(/([A-Z]+)([A-Z][a-z])/g,`$1-$2`).replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Za-z])(\d)/g,`$1-$2`).toLowerCase()}function h(){return p||=Object.keys(c).map(m).sort(),p}async function g(e){let t=h(),n=await(e.labelFn??f)({system:`You pick ONE icon for a UI element. Respond with exactly one icon name from the provided list — lowercase, no quotes, no punctuation, nothing else.`,prompt:`Pick the single most fitting icon for: ${e.subject}\n\nValid icon names:\n${t.join(` `)}`,maxTokens:16,temperature:.2,signal:e.signal});if(!n)return null;let r=n.trim().toLowerCase().replace(/[^a-z0-9-]/g,``);return l(r)?r:null}function _(e,t){let n=i(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],a=y(r.id),o=n.filter(e=>v(e,r,a));return o.length===0?r:(o.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),o[0])}function v(e,t,n){if(e.id===t.id)return!1;let r=t.cost?.input??1/0;if((e.cost?.input??1/0)>=r)return!1;let i=e.id.toLowerCase();switch(n){case`claude`:return i.includes(`haiku`);case`gpt`:return/(^|-)mini(-|$)|(^|-)nano(-|$)/.test(i);case`gemini`:return i.includes(`flash`);case`grok`:return/(^|-)mini(-|$)|(^|-)fast(-|$)/.test(i);case`unknown`:return!0}}function y(e){let t=e.toLowerCase();return t.includes(`claude`)?`claude`:t.includes(`gemini`)?`gemini`:t.includes(`grok`)?`grok`:/^(gpt|o\d)/.test(t)?`gpt`:`unknown`}function b(e,t){return i(e).find(e=>e.id===t)}var x=`ui-quick-llm`;function S(){return s(x)}export{u as n,f as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./__vite-browser-external-5eBdwsFd.js";import{r as n,t as r}from"./multipart-form-data-DopbgwRR.js";import{n as i}from"./slicc-version-BQjDBKr6.js";import{t as a}from"./src-CUSndb9K.js";import{t as o}from"./buffer-B5d1xHaH.js";import"./buffer-polyfill-BwLbCySD.js";import{i as s,n as c,r as l,t as u}from"./node-builtins-CDetdLPH.js";import{c as d,n as f,o as p,t as m}from"./require-guards-BX-XDJnh.js";import{t as h}from"./tmpdir-env-ate4iNcK.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./realm-sync-transport-CTz7jTgb.js";import{t as S}from"./realm-browser-fetch-V3uggGbM.js";function C(e){let t=typeof e==`string`?e:e.href;if(!t.startsWith(`file:`))throw TypeError(`fileURLToPath: not a file URL`);let n=new URL(t);if(n.hostname!==``&&n.hostname!==`localhost`)throw Object.assign(TypeError(`File URL host must be "localhost" or empty on posix`),{code:`ERR_INVALID_FILE_URL_HOST`});if(/%2f/i.test(n.pathname))throw Object.assign(TypeError(`File URL path must not include encoded / characters`),{code:`ERR_INVALID_FILE_URL_PATH`});return decodeURIComponent(n.pathname)}function w(e){let t=e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`);return new URL(`file://${t}`)}const T={URL:globalThis.URL,URLSearchParams:globalThis.URLSearchParams,fileURLToPath:C,pathToFileURL:w};function E(e,t){return Object.assign(TypeError(`The "${e}" argument must be of type string or an instance of Buffer or URL. Received ${t===null?`null`:typeof t}`),{code:`ERR_INVALID_ARG_TYPE`})}function D(e){return typeof e==`object`&&!!e&&typeof e.href==`string`&&typeof e.protocol==`string`}function O(e,t=`path`){if(typeof e==`string`)return e;if(D(e)){if(e.protocol!==`file:`)throw Object.assign(TypeError(`The URL must be of scheme file`),{code:`ERR_INVALID_URL_SCHEME`});return T.fileURLToPath(e.href)}if(e instanceof Uint8Array)return new TextDecoder().decode(e);throw E(t,e)}function ee(e,t){let n=[...t];switch(e){case`path`:n[0]=O(n[0]);break;case`fd`:typeof n[0]!=`number`&&(n[0]=O(n[0]));break;case`pair`:n[0]=O(n[0],`src`),n[1]=O(n[1],`dest`);break;case`second`:n[1]=O(n[1])}return n}function te(e,t,n={}){let r=e;for(let i of Object.keys(t)){let a=t[i],o=r[i];!a||typeof o!=`function`||(r[i]=((...t)=>{let r;try{r=ee(a,t)}catch(e){if(n.promises)return Promise.reject(e);throw e}return o.apply(e,r)}))}}function k(e){let t=!!e.isDirectory,n=e.mtimeMs??0;return{isFile:()=>!!e.isFile,isDirectory:()=>t,isSymbolicLink:()=>!!e.isSymbolicLink,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isFIFO:()=>!1,isSocket:()=>!1,size:e.size??0,mode:e.mode??(t?16877:33188),mtimeMs:n,mtime:new Date(n)}}const ne=new Set([`stat`,`lstat`]);function re(e){if(e.length===0)return e;if(e.length===1||e[1]===void 0)return[e[0],null];let t=e[1];return typeof t==`object`&&t&&!ArrayBuffer.isView(t)&&t.encoding===void 0?[e[0],{...t,encoding:null}]:e}function ie(e){if(e instanceof Error&&e.code===void 0){let t=/^(E[A-Z]+)\b/.exec(e.message)?.[1];t&&Object.assign(e,{code:t})}return e}function ae(e,t){return ne.has(e)?k(t):t}function oe(e,t,n,r){let i=e===`readFile`?re(r):r;return t.apply(n,i)}function se(e){let t={};for(let[n,r]of Object.entries(e))n!==`promises`&&(t[n]=typeof r==`function`?async(...t)=>{try{return ae(n,await oe(n,r,e,t))}catch(e){throw ie(e)}}:r);return t}function ce(e){let t=e;for(let[e,n]of Object.entries(t))e!==`promises`&&typeof n==`function`&&(t[e]=function(...t){let r=t[t.length-1];if(typeof r!=`function`)return n.apply(this,t);t.pop();let i;try{i=Promise.resolve(oe(e,n,this,t))}catch(e){i=Promise.reject(e)}i.then(t=>e===`exists`?r(t):r(null,ae(e,t)),t=>r(e!==`exists`&&ie(t)))})}function le(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function ue(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function de(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function fe(){return{readSync:e=>{throw le(`read`,e)},writeSync:e=>{throw le(`write`,e)}}}function pe(e){let t=0;return{readSync(n,r,i,a){if(n!==0)throw le(`read`,n);let o=ue(r),s=typeof i==`object`&&i?i:{offset:i,length:a},c=s.offset??0,l=s.length??o.length-c,u=e.readStdinBytes(),d=Math.max(0,Math.min(l,u.length-t));return o.set(u.subarray(t,t+d),c),t+=d,d},writeSync(t,n,r,i){let a=t===1?e.writeStdout:t===2?e.writeStderr:void 0;if(!a)throw le(`write`,t);if(typeof n==`string`)return a(n),new TextEncoder().encode(n).length;if(!ArrayBuffer.isView(n))throw TypeError(`writeSync: data must be a string or buffer`);let o=ue(n),s=typeof r==`number`?r:0,c=o.subarray(s,i===void 0?void 0:s+i);return a(de(c)),c.length}}}function A(e){if(!e||e===`/`)return`/`;e.startsWith(`/`)||(e=`/`+e);let t=e.split(`/`),n=[];for(let e of t)e!==``&&e!==`.`&&(e===`..`?n.pop():n.push(e));return`/`+n.join(`/`)}function me(e){let t=A(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function j(e){return Object.assign(Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function he(e){return Object.assign(Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function ge(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var _e=class{tree=new Map;initialPaths=new Set;initialContent=new Map;initialKind=new Map;mkdtempCounter=0;tombstones=new Set;removedDirs=new Set;touched=!1;constructor(e){this.loadSnapshot(e)}loadSnapshot(e){this.tree=new Map,this.tombstones=new Set,this.removedDirs=new Set,this.initialPaths=new Set,this.initialContent=new Map,this.initialKind=new Map,this.tree.set(`/`,{content:new Uint8Array,isDirectory:!0}),this.initialPaths.add(`/`),this.initialKind.set(`/`,`directory`);for(let t of e.entries){let e=A(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,symlinkTarget:t.symlinkTarget,truncated:t.truncated,size:t.size,...t.partial?{partial:!0}:{}}),this.initialPaths.add(e),this.initialKind.set(e,this.entryKind(t)),!t.isDirectory&&!t.isSymbolicLink&&this.initialContent.set(e,t.content)}for(let t of e.entries){let e=me(A(t.path));for(;e!==`/`&&!this.tree.has(e);)this.tree.set(e,{content:new Uint8Array,isDirectory:!0}),this.initialPaths.add(e),this.initialKind.set(e,`directory`),e=me(e)}}wasUsed(){return this.touched}applySnapshot(e){this.loadSnapshot(e)}applySnapshotPreservingMutations(e){let t=this.getMutations();this.loadSnapshot(e);for(let e of t.deleted){if(this.tree.get(e)?.isDirectory){let t=e===`/`?`/`:e+`/`;for(let n of Array.from(this.tree.keys()))n!==e&&n.startsWith(t)&&this.tree.delete(n)}this.tree.delete(e)}for(let e of t.created)this.ensureParentDirs(e.path),this.tree.set(e.path,{content:e.content,isDirectory:e.isDirectory,isSymbolicLink:e.isSymbolicLink,symlinkTarget:e.symlinkTarget});for(let e of t.modified)this.ensureParentDirs(e.path),this.tree.set(e.path,{content:e.content,isDirectory:!1})}invalidate(){this.loadSnapshot({entries:[]})}resetBaseline(){this.initialPaths=new Set,this.initialContent=new Map,this.initialKind=new Map;for(let[e,t]of this.tree.entries())this.initialPaths.add(e),this.initialKind.set(e,this.entryKind(t)),!t.isDirectory&&!t.isSymbolicLink&&this.initialContent.set(e,t.content)}entryKind(e){return e.isSymbolicLink?`symlink`:e.isDirectory?`directory`:`file`}resolveEntry(e,t=!1){let n=A(e),r=n.split(`/`).filter(Boolean),i=[],a=new Set,o=0;if(r.length===0){let e=this.tree.get(`/`);return e?{path:`/`,entry:e}:void 0}for(;r.length>0;){let e=r.shift(),s=`/${[...i,e].join(`/`)}`,c=this.tree.get(s);if(!c)return;let l=r.length===0;if(c.isSymbolicLink&&!(t&&l)){if(a.has(s)||o++===40)throw Object.assign(Error(`ELOOP: too many symbolic links, '${n}'`),{code:`ELOOP`});a.add(s);let e=c.symlinkTarget??``;r=[...A(e.startsWith(`/`)?e:`${me(s)}/${e}`).split(`/`).filter(Boolean),...r],i=[];continue}if(!l&&!c.isDirectory)return;if(i.push(e),l)return{path:s,entry:c}}}ensureParentDirs(e){let t=me(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0,!0))}isPartial(e){return this.tree.get(A(e))?.partial===!0}hasPartialWithin(e){let t=A(e),n=t===`/`?`/`:`${t}/`;for(let[e,r]of this.tree)if(r.partial&&(e===t||e.startsWith(n)))return!0;return!1}commitWrite(e,t){this.writeFile(e,t);let n=A(e);for(this.initialContent.set(n,t);n!==`/`;){let e=this.tree.get(n);e&&(this.initialPaths.add(n),this.initialKind.set(n,this.entryKind(e))),n=me(n)}}readFile(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t)?.entry;if(!n||n.isDirectory)throw j(t);if(n.truncated)throw he(t);return n.content}writeFile(e,t){this.touched=!0;let n=A(e);this.ensureParentDirs(n),this.tree.set(n,{content:t,isDirectory:!1}),this.tombstones.delete(n),this.removedDirs.delete(n)}exists(e){this.touched=!0;let t=A(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t);if(!n)throw j(t);return this.toStat(n.entry)}lstat(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t,!0);if(!n)throw j(t);return this.toStat(n.entry)}toStat(e){return{isFile:!e.isDirectory&&!e.isSymbolicLink,isDirectory:e.isDirectory,isSymbolicLink:e.isSymbolicLink===!0,size:e.isDirectory?0:e.size??e.content.byteLength}}readdir(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t);if(!n?.entry.isDirectory)throw j(t);let r=n.path===`/`?`/`:n.path+`/`,i=new Set;for(let e of this.tree.keys()){if(e===t||e===`/`||!e.startsWith(r))continue;let n=e.slice(r.length).split(`/`)[0];n&&i.add(n)}return Array.from(i)}mkdir(e,t,n=!1){this.touched=!0;let r=A(e);if(this.tree.has(r)){if(this.tree.get(r).isDirectory)return;throw Object.assign(Error(`EEXIST: file already exists, '${r}'`),{code:`EEXIST`})}let i=me(r);if(i!==`/`&&!this.tree.has(i)){if(!t)throw j(r);this.mkdir(i,!0,n)}this.tree.set(r,{content:new Uint8Array,isDirectory:!0,...n?{partial:!0}:{}}),this.tombstones.delete(r),this.removedDirs.delete(r)}rm(e,t){this.touched=!0;let n=A(e),r=this.tree.get(n);if(!r)throw j(n);if(r.isDirectory&&!r.isSymbolicLink){let e=n===`/`?`/`:n+`/`,r=Array.from(this.tree.keys()).filter(t=>t!==n&&t.startsWith(e));if(r.length>0&&!t)throw Object.assign(Error(`ENOTEMPTY: directory not empty, '${n}'`),{code:`ENOTEMPTY`});for(let e of r)this.tree.delete(e),this.tombstones.add(e);t&&this.removedDirs.add(n)}this.tree.delete(n),this.tombstones.add(n)}copyFile(e,t){this.touched=!0;let n=A(e),r=this.tree.get(n);if(!r||r.isDirectory)throw j(n);if(r.truncated)throw he(n);let i=A(t);this.ensureParentDirs(i),this.tree.set(i,{content:r.content.slice(),isDirectory:!1}),this.tombstones.delete(i),this.removedDirs.delete(i)}rename(e,t){this.touched=!0;let n=A(e),r=this.tree.get(n);if(!r)throw j(n);let i=A(t);if(r.isDirectory){let e=n===`/`?`/`:n+`/`,t=Array.from(this.tree.keys()).filter(t=>t!==n&&t.startsWith(e));this.ensureParentDirs(i),this.tree.set(i,r),this.tree.delete(n);for(let e of t){let t=this.tree.get(e),r=i+e.slice(n.length);this.tree.set(r,t),this.tree.delete(e)}this.tombstones.add(n),this.removedDirs.add(n),this.tombstones.delete(i),this.removedDirs.delete(i);return}this.ensureParentDirs(i),this.tree.set(i,r),this.tree.delete(n),this.tombstones.add(n),this.tombstones.delete(i),this.removedDirs.delete(i)}unlink(e){this.touched=!0;let t=A(e),n=this.tree.get(t);if(!n)throw j(t);if(n.isDirectory&&!n.isSymbolicLink)throw Object.assign(Error(`EISDIR: illegal operation on a directory, unlink '${t}'`),{code:`EISDIR`});this.tree.delete(t),this.tombstones.add(t)}markRemoved(e,t=!1){this.touched=!0;let n=A(e);this.tombstones.add(n),t&&this.removedDirs.add(n)}isTombstoned(e){let t=A(e);if(this.tombstones.has(t))return!0;for(let e of this.removedDirs)if(t===e||t.startsWith(`${e}/`))return!0;return!1}mkdtemp(e){this.touched=!0;for(let t=0;t<100;t++){let t=`_${String(this.mkdtempCounter).padStart(6,`0`)}`;this.mkdtempCounter++;let n=A(e+t);if(!this.tree.has(n))return this.mkdir(n,!0),n}throw Error(`mkdtemp: failed to create unique directory after 100 attempts`)}getMutations(){let e=[],t=[],n=[];for(let[r,i]of this.tree.entries()){if(r===`/`)continue;if(!this.initialPaths.has(r)){e.push({path:r,content:i.content,isDirectory:i.isDirectory,isSymbolicLink:i.isSymbolicLink,symlinkTarget:i.symlinkTarget});continue}let a=this.initialKind.get(r);if(a!==void 0&&a!==this.entryKind(i)){n.push(r),e.push({path:r,content:i.content,isDirectory:i.isDirectory,isSymbolicLink:i.isSymbolicLink,symlinkTarget:i.symlinkTarget});continue}if(!i.isDirectory&&!i.isSymbolicLink){let e=this.initialContent.get(r);e&&!ge(e,i.content)&&t.push({path:r,content:i.content})}}for(let e of this.initialPaths)e!==`/`&&(this.tree.has(e)||n.push(e));return{created:e,modified:t,deleted:n}}};function ve(){return globalThis.Buffer}function ye(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function be(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function xe(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function Se(e){return e===`/dev/stdin`||e===`/dev/stdout`||e===`/dev/stderr`}function Ce(e){if(e===0||e===`/dev/stdin`)return 0;if(e===1||e===`/dev/stdout`)return 1;if(e===2||e===`/dev/stderr`)return 2}function we(e,t){let n=Ce(e);if(n===0)return!0;if(n!==void 0||typeof e==`number`)throw xe(t,e);return!1}function Te(e,t,n){let r=Ce(t);if(r===1)return e.writeStdout;if(r===2)return e.writeStderr;if(r!==void 0||typeof t==`number`)throw xe(n,t)}function Ee(e){return typeof e==`string`?e:be(We(e))}function De(e,t){if(t===`utf8`||t===`utf-8`)return new TextDecoder().decode(e);let n=ve();return n?n.from(e):e}function Oe(e){return e===null?null:typeof e==`string`?e:e?.encoding}function ke(){return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,isCharacterDevice:()=>!0,size:0}}function Ae(e,t){if(!t)return;let n={readFile:e.readFile,readFileBinary:e.readFileBinary,writeFile:e.writeFile,writeFileBinary:e.writeFileBinary,appendFile:e.appendFile,access:e.access,exists:e.exists,stat:e.stat};e.readFile=async(e,r)=>{if(!we(e,`read`))return n.readFile(e,r);let i=Oe(r);if(i===null||i===`buffer`){let e=ve(),n=t.readStdinBytes();return e?e.from(n):n}return new TextDecoder().decode(t.readStdinBytes())},e.readFileBinary=async e=>we(e,`read`)?t.readStdinBytes():n.readFileBinary(e),e.writeFile=async(e,r)=>{let i=Te(t,e,`write`);return i?(i(Ee(r)),!0):n.writeFile(e,r)},e.writeFileBinary=async(e,r)=>{let i=Te(t,e,`write`);return i?(i(be(r)),!0):n.writeFileBinary(e,r)},e.appendFile=async(e,r)=>{let i=Te(t,e,`append`);if(!i)return n.appendFile(e,r);i(Ee(r))},e.access=async e=>{if(!Se(e))return n.access(e)},e.exists=async e=>Se(e)||n.exists(e),e.stat=async e=>Se(e)?{isFile:!0,isDirectory:!1,size:0}:n.stat(e)}function je(e,t,n){function r(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return e instanceof ArrayBuffer?new Uint8Array(e):new TextEncoder().encode(typeof e==`string`?e:String(e))}async function i(t,n){let r=Oe(n);if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=ve();return r?r.from(n instanceof Uint8Array?n:new Uint8Array(n)):n}return e.call(`vfs`,`readFile`,[t])}async function a(t,n){return typeof n==`string`?e.call(`vfs`,`writeFile`,[t,n]):e.call(`vfs`,`writeFileBinary`,[t,r(n)])}async function o(t,n){if(typeof n==`string`){await e.call(`vfs`,`appendFile`,[t,n]);return}await e.call(`vfs`,`appendFile`,[t,r(n)])}async function s(t,n,r){let i=await e.call(`vfs`,`stat`,[t]);if(i.isFile){let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r]);return}if(!i.isDirectory||!r?.recursive)throw Error(`cp: '${t}' is a directory (use {recursive: true})`);await l(n);let a=await e.call(`vfs`,`readDir`,[t]);for(let e of a)await s(`${t}/${e}`,`${n}/${e}`,r)}async function c(t,n){if(n?.force&&!await e.call(`vfs`,`exists`,[t]))return!0;if((await e.call(`vfs`,`stat`,[t])).isFile)return e.call(`vfs`,`rm`,[t]);if(!n?.recursive)throw Error(`rm: '${t}' is a directory (use {recursive: true})`);let r=await e.call(`vfs`,`readDir`,[t]);for(let e of r)await c(`${t}/${e}`,n);return e.call(`vfs`,`rm`,[t])}async function l(t){await e.call(`vfs`,`mkdir`,[t])}async function u(t){for(let n=0;n<5;n++){let n=`${t}${Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,6)}`;if(!await e.call(`vfs`,`exists`,[n]))return await e.call(`vfs`,`mkdir`,[n]),n}throw Error(`mkdtemp: failed to create unique directory after 5 attempts`)}async function d(t,n){try{await e.call(`vfs`,`rename`,[t,n])}catch{let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r]),await e.call(`vfs`,`rm`,[t])}}async function f(t){if(!await e.call(`vfs`,`exists`,[t]))throw Object.assign(Error(`ENOENT: no such file or directory, access '${t}'`),{code:`ENOENT`})}let p={readFile:i,readFileBinary:t=>e.call(`vfs`,`readFileBinary`,[t]),writeFile:a,writeFileBinary:(t,n)=>e.call(`vfs`,`writeFileBinary`,[t,n]),appendFile:o,cp:s,rm:c,readDir:t=>e.call(`vfs`,`readDir`,[t]),readdir:t=>e.call(`vfs`,`readDir`,[t]),exists:t=>e.call(`vfs`,`exists`,[t]),stat:t=>e.call(`vfs`,`stat`,[t]),mkdir:(t,n)=>e.call(`vfs`,`mkdir`,[t]),mkdtemp:u,rename:d,access:f,unlink:t=>e.call(`vfs`,`rm`,[t]),rmdir:t=>e.call(`vfs`,`rm`,[t]),copyFile:async(t,n)=>{let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r])},fetchToFile:async(n,r)=>{let i=await t(n);if(!i.ok)throw Error(`fetch ${i.status} ${i.statusText}`);let a=new Uint8Array(await i.arrayBuffer());return await e.call(`vfs`,`writeFileBinary`,[r,a]),a.byteLength},promises:null};return Ae(p,n),te(p,Me,{promises:!0}),p.promises=se(p),ce(p),p}const Me={readFile:`fd`,readFileBinary:`fd`,writeFile:`fd`,writeFileBinary:`fd`,appendFile:`fd`,cp:`pair`,rm:`path`,readDir:`path`,readdir:`path`,exists:`path`,stat:`path`,mkdir:`path`,mkdtemp:`path`,rename:`pair`,access:`path`,unlink:`path`,rmdir:`path`,copyFile:`pair`,fetchToFile:`second`},Ne={readFileSync:`fd`,writeFileSync:`fd`,appendFileSync:`fd`,truncateSync:`path`,existsSync:`path`,accessSync:`path`,mkdirSync:`path`,statSync:`path`,lstatSync:`path`,realpathSync:`path`,readdirSync:`path`,copyFileSync:`pair`,cpSync:`pair`,chmodSync:`path`,utimesSync:`path`,mkdtempSync:`path`,rmSync:`path`,rmdirSync:`path`,unlinkSync:`path`,renameSync:`pair`};function M(e,t,n=``){return Object.assign(Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function Pe(e,t,n,r={},i){let a=r.recursive===!0;try{return r.requireFile?e.unlink(n):e.rm(n,a),i?.(n),!0}catch(e){if(e?.code!==`ENOENT`)throw e}let o=t;if(!o?.rm||e.isTombstoned(n))return!1;try{if(!o.exists(n))return!1}catch{return!1}return o.rm(n),e.markRemoved(n,a),!0}function Fe(e,t,n){let r=t;if(!(!r?.rename||!r.rmdir||!r.rm||!e.hasPartialWithin(n)))return r}function Ie(e,t,n){y(e,t);try{n()}finally{e.invalidate()}}function Le(e){let{syncFs:t,bridge:n,resolve:r,existsResolved:i,lstatResolved:a,statResolved:o,readBytes:s,writeThrough:c,persistDelete:l}=e,u=(e,r)=>{let i=r?.requireFile?void 0:Fe(t,n,e);return i?(Ie(t,i,()=>r?.recursive?i.rm(e):i.rmdir(e)),!0):Pe(t,n,e,r,l)};return{rmSync(e,t){let n=r(e);if(!(t?.force&&!i(n))&&!u(n,{recursive:t?.recursive===!0})&&!t?.force)throw M(`ENOENT`,n,`rm`)},rmdirSync(e,t){let n=r(e);if(i(n)&&!a(n).isDirectory)throw M(`ENOTDIR`,n,`rmdir`);if(!u(n,{recursive:t?.recursive===!0}))throw M(`ENOENT`,n,`rmdir`)},unlinkSync(e){let t=r(e);if(!u(t,{requireFile:!0}))throw M(`ENOENT`,t,`unlink`)},renameSync(e,i){let a=r(e),l=r(i),d=Fe(t,n,a);if(d){Ie(t,d,()=>d.rename(a,l));return}try{t.rename(a,l);return}catch(e){if(e?.code!==`ENOENT`)throw e}if(!n||t.isTombstoned(a))throw M(`ENOENT`,a,`rename`);if(o(a).isDirectory)throw M(`EISDIR`,a,`rename`);if(c(l,s(a)),!u(a,{requireFile:!0}))throw M(`ENOENT`,a,`rename`)}}}function Re(e,t){if(!t)return;let n={readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,existsSync:e.existsSync,accessSync:e.accessSync,statSync:e.statSync,lstatSync:e.lstatSync};e.readFileSync=(e,r)=>we(e,`read`)?De(t.readStdinBytes(),Oe(r)):n.readFileSync(e,r),e.writeFileSync=(e,r)=>{let i=Te(t,e,`write`);i?i(Ee(r)):n.writeFileSync(e,r)},e.appendFileSync=(e,r)=>{let i=Te(t,e,`append`);i?i(Ee(r)):n.appendFileSync(e,r)},e.existsSync=e=>Se(e)||n.existsSync(e),e.accessSync=e=>{Se(e)||n.accessSync(e)},e.statSync=e=>Se(e)?ke():n.statSync(e),e.lstatSync=e=>Se(e)?ke():n.lstatSync(e),Object.assign(e,pe(t))}function ze(e,t,n,r){let i=t=>e===`/`?`/${t}`:`${e}/${t}`,a=new Set(n);for(let e of t)a.add(e);for(let e of a)r(i(e))&&a.delete(e);return[...a]}function Be(e,t){if(e instanceof Date)return e.getTime();if(typeof e==`string`&&e.trim()!==``&&Number.isFinite(Number(e)))return Number(e)*1e3;if(typeof e==`number`){if(!Number.isFinite(e))throw Object.assign(TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`});return e<0?Date.now():e*1e3}throw Object.assign(TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`})}function Ve(e,t,n,r,i){let a=e?.utimes;if(!(!e||typeof a!=`function`||t.isTombstoned(n)))try{a.call(e,n,r,i)}catch(e){let r=e?.code;if(r===`ENOSYS`||r===`ENOENT`&&t.exists(n))return;throw e}}function He(e,t,n,r){return{chmodSync(n){let r=e(n);if(!t(r))throw M(`ENOENT`,r,`chmod`)},utimesSync(i,a,o){let s=Be(a,`atime`),c=Be(o,`mtime`),l=e(i);if(!t(l))throw M(`ENOENT`,l,`utime`);Ve(n,r,l,s,c)}}}function Ue(e,t,n){let r=t=>e.isTombstoned(t);try{let i=e.readdir(n);if(!t||!e.isPartial(n)||r(n))return i;try{return ze(n,i,t.readdir(n),r)}catch(e){if(e?.code===`ENOENT`)return i;throw e}}catch(e){let i=e?.code;if(!t||r(n)||i!==`ENOENT`)throw e;return ze(n,[],t.readdir(n),r)}}function We(e){if(typeof e==`string`)return new TextEncoder().encode(e);if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return new TextEncoder().encode(String(e))}function Ge(e,t,n,r,i){t?(t.writeFile(r,i),e.commitWrite(r,i)):(e.writeFile(r,i),n?.write?.(r,i))}function Ke(e,t,n,r,i){function a(e){return A(e.startsWith(`/`)?e:t+(t.endsWith(`/`)?``:`/`)+e)}function o(t){try{return e.readFile(t)}catch(r){let i=r?.code;if(n&&!e.isTombstoned(t)&&(i===`ENOENT`||i===`ENOSYNC`))return n.readFile(t);throw r}}let s=(t,r)=>Ge(e,n,i,t,r);function c(t){if(e.exists(t))return!0;if(!n||e.isTombstoned(t))return!1;try{return n.exists(t)}catch{return!1}}function l(t){try{return e.stat(t)}catch(r){let i=r?.code;if(!n||e.isTombstoned(t)||i!==`ENOENT`)throw r;return n.stat(t)}}function u(t){try{return e.lstat(t)}catch(r){let i=r?.code;if(!n||e.isTombstoned(t)||i!==`ENOENT`)throw r;return n.lstat(t)}}let d=e=>({isFile:()=>e.isFile,isDirectory:()=>e.isDirectory,isSymbolicLink:()=>e.isSymbolicLink===!0,isCharacterDevice:()=>!1,size:e.size}),f=(e,t)=>e===`/`?`/${t}`:`${e}/${t}`;function p(t,r){if(!l(t).isDirectory){s(r,o(t));return}e.mkdir(r,!0);for(let i of Ue(e,n,t))p(f(t,i),f(r,i))}let m={...Le({syncFs:e,bridge:n,persistDelete:i?.delete,resolve:a,existsResolved:c,statResolved:l,lstatResolved:u,readBytes:o,writeThrough:s}),readFileSync(e,t){return De(o(a(e)),Oe(t))},writeFileSync(e,t){s(a(e),We(t))},appendFileSync(e,t){let n=a(e),r=new Uint8Array;try{r=o(n)}catch(e){if(e?.code!==`ENOENT`)throw e}let i=We(t),c=new Uint8Array(r.byteLength+i.byteLength);c.set(r),c.set(i,r.byteLength),s(n,c)},truncateSync(e,t=0){let n=a(e),r=o(n),i=new Uint8Array(t);i.set(r.subarray(0,Math.min(t,r.byteLength))),s(n,i)},existsSync(e){return c(a(e))},accessSync(e){let t=a(e);if(!c(t))throw M(`ENOENT`,t,`access`)},mkdirSync(t,n){e.mkdir(a(t),n?.recursive)},statSync:e=>d(l(a(e))),lstatSync:e=>d(u(a(e))),realpathSync(e){let t=a(e);if(!c(t))throw M(`ENOENT`,t,`realpath`);return t},readdirSync(t){return Ue(e,n,a(t))},copyFileSync(e,t){s(a(t),o(a(e)))},cpSync(e,t){p(a(e),a(t))},...He(a,c,n,e),mkdtempSync(t){return e.mkdtemp(a(t))}},h=Object.assign(m,fe());Re(h,r),te(h,Ne);let g=h.existsSync;return h.existsSync=e=>{try{return g(e)}catch{return!1}},h}var qe=class{_events=new Map;on(e,t){let n=this._events.get(e);return n?n.push(t):this._events.set(e,[t]),this}addListener(e,t){return this.on(e,t)}off(e,t){let n=this._events.get(e);if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1),n.length===0&&this._events.delete(e)}return this}removeListener(e,t){return this.off(e,t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}emit(e,...t){let n=this._events.get(e);if(!n||n.length===0)return!1;for(let e of[...n])e(...t);return!0}removeAllListeners(e){return e===void 0?this._events.clear():this._events.delete(e),this}listenerCount(e){return this._events.get(e)?.length??0}listeners(e){return[...this._events.get(e)??[]]}};const Je=Object.assign(qe,{EventEmitter:qe,default:qe});function Ye(e){let t=e=>{if(typeof e==`string`)return e;if(e instanceof Error)return e.message;if(e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}},n=(e,t,n)=>t===void 0?`${e(`Error:`)} ${n}\n`:t===``?`${e(n)}\n`:`${e(`${t}:`)} ${n}\n`,r=(t,n)=>t===void 0?`${e.color.yellow(`Warning:`)} ${n}\n`:t===``?`${e.color.yellow(n)}\n`:`${e.color.yellow(`${t}:`)} ${n}\n`;return{die(r,i){let a=typeof i==`number`?i:i?.exitCode??1,o=typeof i==`object`&&i&&`prefix`in i?i.prefix:void 0,s=t(r);throw e.writeStderr(n(e.color.red,o,s)),e.exit(a),Error(`unreachable`)},out(t){if(typeof t==`string`){e.writeStdout(t.endsWith(`
|
|
1
|
+
import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./__vite-browser-external-5eBdwsFd.js";import{r as n,t as r}from"./multipart-form-data-DopbgwRR.js";import{n as i}from"./slicc-version-B0t7wsNA.js";import{t as a}from"./src-CUSndb9K.js";import{t as o}from"./buffer-B5d1xHaH.js";import"./buffer-polyfill-BwLbCySD.js";import{i as s,n as c,r as l,t as u}from"./node-builtins-CDetdLPH.js";import{c as d,n as f,o as p,t as m}from"./require-guards-BX-XDJnh.js";import{t as h}from"./tmpdir-env-ate4iNcK.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./realm-sync-transport-CTz7jTgb.js";import{t as S}from"./realm-browser-fetch-V3uggGbM.js";function C(e){let t=typeof e==`string`?e:e.href;if(!t.startsWith(`file:`))throw TypeError(`fileURLToPath: not a file URL`);let n=new URL(t);if(n.hostname!==``&&n.hostname!==`localhost`)throw Object.assign(TypeError(`File URL host must be "localhost" or empty on posix`),{code:`ERR_INVALID_FILE_URL_HOST`});if(/%2f/i.test(n.pathname))throw Object.assign(TypeError(`File URL path must not include encoded / characters`),{code:`ERR_INVALID_FILE_URL_PATH`});return decodeURIComponent(n.pathname)}function w(e){let t=e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`);return new URL(`file://${t}`)}const T={URL:globalThis.URL,URLSearchParams:globalThis.URLSearchParams,fileURLToPath:C,pathToFileURL:w};function E(e,t){return Object.assign(TypeError(`The "${e}" argument must be of type string or an instance of Buffer or URL. Received ${t===null?`null`:typeof t}`),{code:`ERR_INVALID_ARG_TYPE`})}function D(e){return typeof e==`object`&&!!e&&typeof e.href==`string`&&typeof e.protocol==`string`}function O(e,t=`path`){if(typeof e==`string`)return e;if(D(e)){if(e.protocol!==`file:`)throw Object.assign(TypeError(`The URL must be of scheme file`),{code:`ERR_INVALID_URL_SCHEME`});return T.fileURLToPath(e.href)}if(e instanceof Uint8Array)return new TextDecoder().decode(e);throw E(t,e)}function ee(e,t){let n=[...t];switch(e){case`path`:n[0]=O(n[0]);break;case`fd`:typeof n[0]!=`number`&&(n[0]=O(n[0]));break;case`pair`:n[0]=O(n[0],`src`),n[1]=O(n[1],`dest`);break;case`second`:n[1]=O(n[1])}return n}function te(e,t,n={}){let r=e;for(let i of Object.keys(t)){let a=t[i],o=r[i];!a||typeof o!=`function`||(r[i]=((...t)=>{let r;try{r=ee(a,t)}catch(e){if(n.promises)return Promise.reject(e);throw e}return o.apply(e,r)}))}}function k(e){let t=!!e.isDirectory,n=e.mtimeMs??0;return{isFile:()=>!!e.isFile,isDirectory:()=>t,isSymbolicLink:()=>!!e.isSymbolicLink,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isFIFO:()=>!1,isSocket:()=>!1,size:e.size??0,mode:e.mode??(t?16877:33188),mtimeMs:n,mtime:new Date(n)}}const ne=new Set([`stat`,`lstat`]);function re(e){if(e.length===0)return e;if(e.length===1||e[1]===void 0)return[e[0],null];let t=e[1];return typeof t==`object`&&t&&!ArrayBuffer.isView(t)&&t.encoding===void 0?[e[0],{...t,encoding:null}]:e}function ie(e){if(e instanceof Error&&e.code===void 0){let t=/^(E[A-Z]+)\b/.exec(e.message)?.[1];t&&Object.assign(e,{code:t})}return e}function ae(e,t){return ne.has(e)?k(t):t}function oe(e,t,n,r){let i=e===`readFile`?re(r):r;return t.apply(n,i)}function se(e){let t={};for(let[n,r]of Object.entries(e))n!==`promises`&&(t[n]=typeof r==`function`?async(...t)=>{try{return ae(n,await oe(n,r,e,t))}catch(e){throw ie(e)}}:r);return t}function ce(e){let t=e;for(let[e,n]of Object.entries(t))e!==`promises`&&typeof n==`function`&&(t[e]=function(...t){let r=t[t.length-1];if(typeof r!=`function`)return n.apply(this,t);t.pop();let i;try{i=Promise.resolve(oe(e,n,this,t))}catch(e){i=Promise.reject(e)}i.then(t=>e===`exists`?r(t):r(null,ae(e,t)),t=>r(e!==`exists`&&ie(t)))})}function le(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function ue(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function de(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function fe(){return{readSync:e=>{throw le(`read`,e)},writeSync:e=>{throw le(`write`,e)}}}function pe(e){let t=0;return{readSync(n,r,i,a){if(n!==0)throw le(`read`,n);let o=ue(r),s=typeof i==`object`&&i?i:{offset:i,length:a},c=s.offset??0,l=s.length??o.length-c,u=e.readStdinBytes(),d=Math.max(0,Math.min(l,u.length-t));return o.set(u.subarray(t,t+d),c),t+=d,d},writeSync(t,n,r,i){let a=t===1?e.writeStdout:t===2?e.writeStderr:void 0;if(!a)throw le(`write`,t);if(typeof n==`string`)return a(n),new TextEncoder().encode(n).length;if(!ArrayBuffer.isView(n))throw TypeError(`writeSync: data must be a string or buffer`);let o=ue(n),s=typeof r==`number`?r:0,c=o.subarray(s,i===void 0?void 0:s+i);return a(de(c)),c.length}}}function A(e){if(!e||e===`/`)return`/`;e.startsWith(`/`)||(e=`/`+e);let t=e.split(`/`),n=[];for(let e of t)e!==``&&e!==`.`&&(e===`..`?n.pop():n.push(e));return`/`+n.join(`/`)}function me(e){let t=A(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function j(e){return Object.assign(Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function he(e){return Object.assign(Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function ge(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var _e=class{tree=new Map;initialPaths=new Set;initialContent=new Map;initialKind=new Map;mkdtempCounter=0;tombstones=new Set;removedDirs=new Set;touched=!1;constructor(e){this.loadSnapshot(e)}loadSnapshot(e){this.tree=new Map,this.tombstones=new Set,this.removedDirs=new Set,this.initialPaths=new Set,this.initialContent=new Map,this.initialKind=new Map,this.tree.set(`/`,{content:new Uint8Array,isDirectory:!0}),this.initialPaths.add(`/`),this.initialKind.set(`/`,`directory`);for(let t of e.entries){let e=A(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,symlinkTarget:t.symlinkTarget,truncated:t.truncated,size:t.size,...t.partial?{partial:!0}:{}}),this.initialPaths.add(e),this.initialKind.set(e,this.entryKind(t)),!t.isDirectory&&!t.isSymbolicLink&&this.initialContent.set(e,t.content)}for(let t of e.entries){let e=me(A(t.path));for(;e!==`/`&&!this.tree.has(e);)this.tree.set(e,{content:new Uint8Array,isDirectory:!0}),this.initialPaths.add(e),this.initialKind.set(e,`directory`),e=me(e)}}wasUsed(){return this.touched}applySnapshot(e){this.loadSnapshot(e)}applySnapshotPreservingMutations(e){let t=this.getMutations();this.loadSnapshot(e);for(let e of t.deleted){if(this.tree.get(e)?.isDirectory){let t=e===`/`?`/`:e+`/`;for(let n of Array.from(this.tree.keys()))n!==e&&n.startsWith(t)&&this.tree.delete(n)}this.tree.delete(e)}for(let e of t.created)this.ensureParentDirs(e.path),this.tree.set(e.path,{content:e.content,isDirectory:e.isDirectory,isSymbolicLink:e.isSymbolicLink,symlinkTarget:e.symlinkTarget});for(let e of t.modified)this.ensureParentDirs(e.path),this.tree.set(e.path,{content:e.content,isDirectory:!1})}invalidate(){this.loadSnapshot({entries:[]})}resetBaseline(){this.initialPaths=new Set,this.initialContent=new Map,this.initialKind=new Map;for(let[e,t]of this.tree.entries())this.initialPaths.add(e),this.initialKind.set(e,this.entryKind(t)),!t.isDirectory&&!t.isSymbolicLink&&this.initialContent.set(e,t.content)}entryKind(e){return e.isSymbolicLink?`symlink`:e.isDirectory?`directory`:`file`}resolveEntry(e,t=!1){let n=A(e),r=n.split(`/`).filter(Boolean),i=[],a=new Set,o=0;if(r.length===0){let e=this.tree.get(`/`);return e?{path:`/`,entry:e}:void 0}for(;r.length>0;){let e=r.shift(),s=`/${[...i,e].join(`/`)}`,c=this.tree.get(s);if(!c)return;let l=r.length===0;if(c.isSymbolicLink&&!(t&&l)){if(a.has(s)||o++===40)throw Object.assign(Error(`ELOOP: too many symbolic links, '${n}'`),{code:`ELOOP`});a.add(s);let e=c.symlinkTarget??``;r=[...A(e.startsWith(`/`)?e:`${me(s)}/${e}`).split(`/`).filter(Boolean),...r],i=[];continue}if(!l&&!c.isDirectory)return;if(i.push(e),l)return{path:s,entry:c}}}ensureParentDirs(e){let t=me(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0,!0))}isPartial(e){return this.tree.get(A(e))?.partial===!0}hasPartialWithin(e){let t=A(e),n=t===`/`?`/`:`${t}/`;for(let[e,r]of this.tree)if(r.partial&&(e===t||e.startsWith(n)))return!0;return!1}commitWrite(e,t){this.writeFile(e,t);let n=A(e);for(this.initialContent.set(n,t);n!==`/`;){let e=this.tree.get(n);e&&(this.initialPaths.add(n),this.initialKind.set(n,this.entryKind(e))),n=me(n)}}readFile(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t)?.entry;if(!n||n.isDirectory)throw j(t);if(n.truncated)throw he(t);return n.content}writeFile(e,t){this.touched=!0;let n=A(e);this.ensureParentDirs(n),this.tree.set(n,{content:t,isDirectory:!1}),this.tombstones.delete(n),this.removedDirs.delete(n)}exists(e){this.touched=!0;let t=A(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t);if(!n)throw j(t);return this.toStat(n.entry)}lstat(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t,!0);if(!n)throw j(t);return this.toStat(n.entry)}toStat(e){return{isFile:!e.isDirectory&&!e.isSymbolicLink,isDirectory:e.isDirectory,isSymbolicLink:e.isSymbolicLink===!0,size:e.isDirectory?0:e.size??e.content.byteLength}}readdir(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t);if(!n?.entry.isDirectory)throw j(t);let r=n.path===`/`?`/`:n.path+`/`,i=new Set;for(let e of this.tree.keys()){if(e===t||e===`/`||!e.startsWith(r))continue;let n=e.slice(r.length).split(`/`)[0];n&&i.add(n)}return Array.from(i)}mkdir(e,t,n=!1){this.touched=!0;let r=A(e);if(this.tree.has(r)){if(this.tree.get(r).isDirectory)return;throw Object.assign(Error(`EEXIST: file already exists, '${r}'`),{code:`EEXIST`})}let i=me(r);if(i!==`/`&&!this.tree.has(i)){if(!t)throw j(r);this.mkdir(i,!0,n)}this.tree.set(r,{content:new Uint8Array,isDirectory:!0,...n?{partial:!0}:{}}),this.tombstones.delete(r),this.removedDirs.delete(r)}rm(e,t){this.touched=!0;let n=A(e),r=this.tree.get(n);if(!r)throw j(n);if(r.isDirectory&&!r.isSymbolicLink){let e=n===`/`?`/`:n+`/`,r=Array.from(this.tree.keys()).filter(t=>t!==n&&t.startsWith(e));if(r.length>0&&!t)throw Object.assign(Error(`ENOTEMPTY: directory not empty, '${n}'`),{code:`ENOTEMPTY`});for(let e of r)this.tree.delete(e),this.tombstones.add(e);t&&this.removedDirs.add(n)}this.tree.delete(n),this.tombstones.add(n)}copyFile(e,t){this.touched=!0;let n=A(e),r=this.tree.get(n);if(!r||r.isDirectory)throw j(n);if(r.truncated)throw he(n);let i=A(t);this.ensureParentDirs(i),this.tree.set(i,{content:r.content.slice(),isDirectory:!1}),this.tombstones.delete(i),this.removedDirs.delete(i)}rename(e,t){this.touched=!0;let n=A(e),r=this.tree.get(n);if(!r)throw j(n);let i=A(t);if(r.isDirectory){let e=n===`/`?`/`:n+`/`,t=Array.from(this.tree.keys()).filter(t=>t!==n&&t.startsWith(e));this.ensureParentDirs(i),this.tree.set(i,r),this.tree.delete(n);for(let e of t){let t=this.tree.get(e),r=i+e.slice(n.length);this.tree.set(r,t),this.tree.delete(e)}this.tombstones.add(n),this.removedDirs.add(n),this.tombstones.delete(i),this.removedDirs.delete(i);return}this.ensureParentDirs(i),this.tree.set(i,r),this.tree.delete(n),this.tombstones.add(n),this.tombstones.delete(i),this.removedDirs.delete(i)}unlink(e){this.touched=!0;let t=A(e),n=this.tree.get(t);if(!n)throw j(t);if(n.isDirectory&&!n.isSymbolicLink)throw Object.assign(Error(`EISDIR: illegal operation on a directory, unlink '${t}'`),{code:`EISDIR`});this.tree.delete(t),this.tombstones.add(t)}markRemoved(e,t=!1){this.touched=!0;let n=A(e);this.tombstones.add(n),t&&this.removedDirs.add(n)}isTombstoned(e){let t=A(e);if(this.tombstones.has(t))return!0;for(let e of this.removedDirs)if(t===e||t.startsWith(`${e}/`))return!0;return!1}mkdtemp(e){this.touched=!0;for(let t=0;t<100;t++){let t=`_${String(this.mkdtempCounter).padStart(6,`0`)}`;this.mkdtempCounter++;let n=A(e+t);if(!this.tree.has(n))return this.mkdir(n,!0),n}throw Error(`mkdtemp: failed to create unique directory after 100 attempts`)}getMutations(){let e=[],t=[],n=[];for(let[r,i]of this.tree.entries()){if(r===`/`)continue;if(!this.initialPaths.has(r)){e.push({path:r,content:i.content,isDirectory:i.isDirectory,isSymbolicLink:i.isSymbolicLink,symlinkTarget:i.symlinkTarget});continue}let a=this.initialKind.get(r);if(a!==void 0&&a!==this.entryKind(i)){n.push(r),e.push({path:r,content:i.content,isDirectory:i.isDirectory,isSymbolicLink:i.isSymbolicLink,symlinkTarget:i.symlinkTarget});continue}if(!i.isDirectory&&!i.isSymbolicLink){let e=this.initialContent.get(r);e&&!ge(e,i.content)&&t.push({path:r,content:i.content})}}for(let e of this.initialPaths)e!==`/`&&(this.tree.has(e)||n.push(e));return{created:e,modified:t,deleted:n}}};function ve(){return globalThis.Buffer}function ye(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function be(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function xe(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function Se(e){return e===`/dev/stdin`||e===`/dev/stdout`||e===`/dev/stderr`}function Ce(e){if(e===0||e===`/dev/stdin`)return 0;if(e===1||e===`/dev/stdout`)return 1;if(e===2||e===`/dev/stderr`)return 2}function we(e,t){let n=Ce(e);if(n===0)return!0;if(n!==void 0||typeof e==`number`)throw xe(t,e);return!1}function Te(e,t,n){let r=Ce(t);if(r===1)return e.writeStdout;if(r===2)return e.writeStderr;if(r!==void 0||typeof t==`number`)throw xe(n,t)}function Ee(e){return typeof e==`string`?e:be(We(e))}function De(e,t){if(t===`utf8`||t===`utf-8`)return new TextDecoder().decode(e);let n=ve();return n?n.from(e):e}function Oe(e){return e===null?null:typeof e==`string`?e:e?.encoding}function ke(){return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,isCharacterDevice:()=>!0,size:0}}function Ae(e,t){if(!t)return;let n={readFile:e.readFile,readFileBinary:e.readFileBinary,writeFile:e.writeFile,writeFileBinary:e.writeFileBinary,appendFile:e.appendFile,access:e.access,exists:e.exists,stat:e.stat};e.readFile=async(e,r)=>{if(!we(e,`read`))return n.readFile(e,r);let i=Oe(r);if(i===null||i===`buffer`){let e=ve(),n=t.readStdinBytes();return e?e.from(n):n}return new TextDecoder().decode(t.readStdinBytes())},e.readFileBinary=async e=>we(e,`read`)?t.readStdinBytes():n.readFileBinary(e),e.writeFile=async(e,r)=>{let i=Te(t,e,`write`);return i?(i(Ee(r)),!0):n.writeFile(e,r)},e.writeFileBinary=async(e,r)=>{let i=Te(t,e,`write`);return i?(i(be(r)),!0):n.writeFileBinary(e,r)},e.appendFile=async(e,r)=>{let i=Te(t,e,`append`);if(!i)return n.appendFile(e,r);i(Ee(r))},e.access=async e=>{if(!Se(e))return n.access(e)},e.exists=async e=>Se(e)||n.exists(e),e.stat=async e=>Se(e)?{isFile:!0,isDirectory:!1,size:0}:n.stat(e)}function je(e,t,n){function r(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return e instanceof ArrayBuffer?new Uint8Array(e):new TextEncoder().encode(typeof e==`string`?e:String(e))}async function i(t,n){let r=Oe(n);if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=ve();return r?r.from(n instanceof Uint8Array?n:new Uint8Array(n)):n}return e.call(`vfs`,`readFile`,[t])}async function a(t,n){return typeof n==`string`?e.call(`vfs`,`writeFile`,[t,n]):e.call(`vfs`,`writeFileBinary`,[t,r(n)])}async function o(t,n){if(typeof n==`string`){await e.call(`vfs`,`appendFile`,[t,n]);return}await e.call(`vfs`,`appendFile`,[t,r(n)])}async function s(t,n,r){let i=await e.call(`vfs`,`stat`,[t]);if(i.isFile){let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r]);return}if(!i.isDirectory||!r?.recursive)throw Error(`cp: '${t}' is a directory (use {recursive: true})`);await l(n);let a=await e.call(`vfs`,`readDir`,[t]);for(let e of a)await s(`${t}/${e}`,`${n}/${e}`,r)}async function c(t,n){if(n?.force&&!await e.call(`vfs`,`exists`,[t]))return!0;if((await e.call(`vfs`,`stat`,[t])).isFile)return e.call(`vfs`,`rm`,[t]);if(!n?.recursive)throw Error(`rm: '${t}' is a directory (use {recursive: true})`);let r=await e.call(`vfs`,`readDir`,[t]);for(let e of r)await c(`${t}/${e}`,n);return e.call(`vfs`,`rm`,[t])}async function l(t){await e.call(`vfs`,`mkdir`,[t])}async function u(t){for(let n=0;n<5;n++){let n=`${t}${Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,6)}`;if(!await e.call(`vfs`,`exists`,[n]))return await e.call(`vfs`,`mkdir`,[n]),n}throw Error(`mkdtemp: failed to create unique directory after 5 attempts`)}async function d(t,n){try{await e.call(`vfs`,`rename`,[t,n])}catch{let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r]),await e.call(`vfs`,`rm`,[t])}}async function f(t){if(!await e.call(`vfs`,`exists`,[t]))throw Object.assign(Error(`ENOENT: no such file or directory, access '${t}'`),{code:`ENOENT`})}let p={readFile:i,readFileBinary:t=>e.call(`vfs`,`readFileBinary`,[t]),writeFile:a,writeFileBinary:(t,n)=>e.call(`vfs`,`writeFileBinary`,[t,n]),appendFile:o,cp:s,rm:c,readDir:t=>e.call(`vfs`,`readDir`,[t]),readdir:t=>e.call(`vfs`,`readDir`,[t]),exists:t=>e.call(`vfs`,`exists`,[t]),stat:t=>e.call(`vfs`,`stat`,[t]),mkdir:(t,n)=>e.call(`vfs`,`mkdir`,[t]),mkdtemp:u,rename:d,access:f,unlink:t=>e.call(`vfs`,`rm`,[t]),rmdir:t=>e.call(`vfs`,`rm`,[t]),copyFile:async(t,n)=>{let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r])},fetchToFile:async(n,r)=>{let i=await t(n);if(!i.ok)throw Error(`fetch ${i.status} ${i.statusText}`);let a=new Uint8Array(await i.arrayBuffer());return await e.call(`vfs`,`writeFileBinary`,[r,a]),a.byteLength},promises:null};return Ae(p,n),te(p,Me,{promises:!0}),p.promises=se(p),ce(p),p}const Me={readFile:`fd`,readFileBinary:`fd`,writeFile:`fd`,writeFileBinary:`fd`,appendFile:`fd`,cp:`pair`,rm:`path`,readDir:`path`,readdir:`path`,exists:`path`,stat:`path`,mkdir:`path`,mkdtemp:`path`,rename:`pair`,access:`path`,unlink:`path`,rmdir:`path`,copyFile:`pair`,fetchToFile:`second`},Ne={readFileSync:`fd`,writeFileSync:`fd`,appendFileSync:`fd`,truncateSync:`path`,existsSync:`path`,accessSync:`path`,mkdirSync:`path`,statSync:`path`,lstatSync:`path`,realpathSync:`path`,readdirSync:`path`,copyFileSync:`pair`,cpSync:`pair`,chmodSync:`path`,utimesSync:`path`,mkdtempSync:`path`,rmSync:`path`,rmdirSync:`path`,unlinkSync:`path`,renameSync:`pair`};function M(e,t,n=``){return Object.assign(Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function Pe(e,t,n,r={},i){let a=r.recursive===!0;try{return r.requireFile?e.unlink(n):e.rm(n,a),i?.(n),!0}catch(e){if(e?.code!==`ENOENT`)throw e}let o=t;if(!o?.rm||e.isTombstoned(n))return!1;try{if(!o.exists(n))return!1}catch{return!1}return o.rm(n),e.markRemoved(n,a),!0}function Fe(e,t,n){let r=t;if(!(!r?.rename||!r.rmdir||!r.rm||!e.hasPartialWithin(n)))return r}function Ie(e,t,n){y(e,t);try{n()}finally{e.invalidate()}}function Le(e){let{syncFs:t,bridge:n,resolve:r,existsResolved:i,lstatResolved:a,statResolved:o,readBytes:s,writeThrough:c,persistDelete:l}=e,u=(e,r)=>{let i=r?.requireFile?void 0:Fe(t,n,e);return i?(Ie(t,i,()=>r?.recursive?i.rm(e):i.rmdir(e)),!0):Pe(t,n,e,r,l)};return{rmSync(e,t){let n=r(e);if(!(t?.force&&!i(n))&&!u(n,{recursive:t?.recursive===!0})&&!t?.force)throw M(`ENOENT`,n,`rm`)},rmdirSync(e,t){let n=r(e);if(i(n)&&!a(n).isDirectory)throw M(`ENOTDIR`,n,`rmdir`);if(!u(n,{recursive:t?.recursive===!0}))throw M(`ENOENT`,n,`rmdir`)},unlinkSync(e){let t=r(e);if(!u(t,{requireFile:!0}))throw M(`ENOENT`,t,`unlink`)},renameSync(e,i){let a=r(e),l=r(i),d=Fe(t,n,a);if(d){Ie(t,d,()=>d.rename(a,l));return}try{t.rename(a,l);return}catch(e){if(e?.code!==`ENOENT`)throw e}if(!n||t.isTombstoned(a))throw M(`ENOENT`,a,`rename`);if(o(a).isDirectory)throw M(`EISDIR`,a,`rename`);if(c(l,s(a)),!u(a,{requireFile:!0}))throw M(`ENOENT`,a,`rename`)}}}function Re(e,t){if(!t)return;let n={readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,existsSync:e.existsSync,accessSync:e.accessSync,statSync:e.statSync,lstatSync:e.lstatSync};e.readFileSync=(e,r)=>we(e,`read`)?De(t.readStdinBytes(),Oe(r)):n.readFileSync(e,r),e.writeFileSync=(e,r)=>{let i=Te(t,e,`write`);i?i(Ee(r)):n.writeFileSync(e,r)},e.appendFileSync=(e,r)=>{let i=Te(t,e,`append`);i?i(Ee(r)):n.appendFileSync(e,r)},e.existsSync=e=>Se(e)||n.existsSync(e),e.accessSync=e=>{Se(e)||n.accessSync(e)},e.statSync=e=>Se(e)?ke():n.statSync(e),e.lstatSync=e=>Se(e)?ke():n.lstatSync(e),Object.assign(e,pe(t))}function ze(e,t,n,r){let i=t=>e===`/`?`/${t}`:`${e}/${t}`,a=new Set(n);for(let e of t)a.add(e);for(let e of a)r(i(e))&&a.delete(e);return[...a]}function Be(e,t){if(e instanceof Date)return e.getTime();if(typeof e==`string`&&e.trim()!==``&&Number.isFinite(Number(e)))return Number(e)*1e3;if(typeof e==`number`){if(!Number.isFinite(e))throw Object.assign(TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`});return e<0?Date.now():e*1e3}throw Object.assign(TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`})}function Ve(e,t,n,r,i){let a=e?.utimes;if(!(!e||typeof a!=`function`||t.isTombstoned(n)))try{a.call(e,n,r,i)}catch(e){let r=e?.code;if(r===`ENOSYS`||r===`ENOENT`&&t.exists(n))return;throw e}}function He(e,t,n,r){return{chmodSync(n){let r=e(n);if(!t(r))throw M(`ENOENT`,r,`chmod`)},utimesSync(i,a,o){let s=Be(a,`atime`),c=Be(o,`mtime`),l=e(i);if(!t(l))throw M(`ENOENT`,l,`utime`);Ve(n,r,l,s,c)}}}function Ue(e,t,n){let r=t=>e.isTombstoned(t);try{let i=e.readdir(n);if(!t||!e.isPartial(n)||r(n))return i;try{return ze(n,i,t.readdir(n),r)}catch(e){if(e?.code===`ENOENT`)return i;throw e}}catch(e){let i=e?.code;if(!t||r(n)||i!==`ENOENT`)throw e;return ze(n,[],t.readdir(n),r)}}function We(e){if(typeof e==`string`)return new TextEncoder().encode(e);if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return new TextEncoder().encode(String(e))}function Ge(e,t,n,r,i){t?(t.writeFile(r,i),e.commitWrite(r,i)):(e.writeFile(r,i),n?.write?.(r,i))}function Ke(e,t,n,r,i){function a(e){return A(e.startsWith(`/`)?e:t+(t.endsWith(`/`)?``:`/`)+e)}function o(t){try{return e.readFile(t)}catch(r){let i=r?.code;if(n&&!e.isTombstoned(t)&&(i===`ENOENT`||i===`ENOSYNC`))return n.readFile(t);throw r}}let s=(t,r)=>Ge(e,n,i,t,r);function c(t){if(e.exists(t))return!0;if(!n||e.isTombstoned(t))return!1;try{return n.exists(t)}catch{return!1}}function l(t){try{return e.stat(t)}catch(r){let i=r?.code;if(!n||e.isTombstoned(t)||i!==`ENOENT`)throw r;return n.stat(t)}}function u(t){try{return e.lstat(t)}catch(r){let i=r?.code;if(!n||e.isTombstoned(t)||i!==`ENOENT`)throw r;return n.lstat(t)}}let d=e=>({isFile:()=>e.isFile,isDirectory:()=>e.isDirectory,isSymbolicLink:()=>e.isSymbolicLink===!0,isCharacterDevice:()=>!1,size:e.size}),f=(e,t)=>e===`/`?`/${t}`:`${e}/${t}`;function p(t,r){if(!l(t).isDirectory){s(r,o(t));return}e.mkdir(r,!0);for(let i of Ue(e,n,t))p(f(t,i),f(r,i))}let m={...Le({syncFs:e,bridge:n,persistDelete:i?.delete,resolve:a,existsResolved:c,statResolved:l,lstatResolved:u,readBytes:o,writeThrough:s}),readFileSync(e,t){return De(o(a(e)),Oe(t))},writeFileSync(e,t){s(a(e),We(t))},appendFileSync(e,t){let n=a(e),r=new Uint8Array;try{r=o(n)}catch(e){if(e?.code!==`ENOENT`)throw e}let i=We(t),c=new Uint8Array(r.byteLength+i.byteLength);c.set(r),c.set(i,r.byteLength),s(n,c)},truncateSync(e,t=0){let n=a(e),r=o(n),i=new Uint8Array(t);i.set(r.subarray(0,Math.min(t,r.byteLength))),s(n,i)},existsSync(e){return c(a(e))},accessSync(e){let t=a(e);if(!c(t))throw M(`ENOENT`,t,`access`)},mkdirSync(t,n){e.mkdir(a(t),n?.recursive)},statSync:e=>d(l(a(e))),lstatSync:e=>d(u(a(e))),realpathSync(e){let t=a(e);if(!c(t))throw M(`ENOENT`,t,`realpath`);return t},readdirSync(t){return Ue(e,n,a(t))},copyFileSync(e,t){s(a(t),o(a(e)))},cpSync(e,t){p(a(e),a(t))},...He(a,c,n,e),mkdtempSync(t){return e.mkdtemp(a(t))}},h=Object.assign(m,fe());Re(h,r),te(h,Ne);let g=h.existsSync;return h.existsSync=e=>{try{return g(e)}catch{return!1}},h}var qe=class{_events=new Map;on(e,t){let n=this._events.get(e);return n?n.push(t):this._events.set(e,[t]),this}addListener(e,t){return this.on(e,t)}off(e,t){let n=this._events.get(e);if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1),n.length===0&&this._events.delete(e)}return this}removeListener(e,t){return this.off(e,t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}emit(e,...t){let n=this._events.get(e);if(!n||n.length===0)return!1;for(let e of[...n])e(...t);return!0}removeAllListeners(e){return e===void 0?this._events.clear():this._events.delete(e),this}listenerCount(e){return this._events.get(e)?.length??0}listeners(e){return[...this._events.get(e)??[]]}};const Je=Object.assign(qe,{EventEmitter:qe,default:qe});function Ye(e){let t=e=>{if(typeof e==`string`)return e;if(e instanceof Error)return e.message;if(e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}},n=(e,t,n)=>t===void 0?`${e(`Error:`)} ${n}\n`:t===``?`${e(n)}\n`:`${e(`${t}:`)} ${n}\n`,r=(t,n)=>t===void 0?`${e.color.yellow(`Warning:`)} ${n}\n`:t===``?`${e.color.yellow(n)}\n`:`${e.color.yellow(`${t}:`)} ${n}\n`;return{die(r,i){let a=typeof i==`number`?i:i?.exitCode??1,o=typeof i==`object`&&i&&`prefix`in i?i.prefix:void 0,s=t(r);throw e.writeStderr(n(e.color.red,o,s)),e.exit(a),Error(`unreachable`)},out(t){if(typeof t==`string`){e.writeStdout(t.endsWith(`
|
|
2
2
|
`)?t:`${t}\n`);return}try{e.writeStdout(`${JSON.stringify(t,null,2)}\n`)}catch{e.writeStdout(`${String(t)}\n`)}},warn(n,i){let a=typeof i==`object`&&i&&`prefix`in i?i.prefix:void 0;e.writeStderr(r(a,t(n)))},help(t){throw e.writeStdout(t.endsWith(`
|
|
3
3
|
`)?t:`${t}\n`),e.exit(0),Error(`unreachable`)}}}const N={reset:`\x1B[0m`,green:`\x1B[32m`,red:`\x1B[31m`,yellow:`\x1B[33m`,gray:`\x1B[90m`,bold:`\x1B[1m`,cyan:`\x1B[36m`,dim:`\x1B[2m`};function Xe(e){let t=e.isTTY&&!e.noColor,n=e=>n=>t?`${e}${n}${N.reset}`:String(n);return{enabled:t,green:n(N.green),red:n(N.red),yellow:n(N.yellow),gray:n(N.gray),bold:n(N.bold),cyan:n(N.cyan),dim:n(N.dim)}}const Ze=/\u001b\[[0-9;]*m/g;function Qe(e){return e.replace(Ze,``)}function $e(e){return Qe(e).length}function et(e,t){let n=String(e??``);return t<=0?``:$e(n)<=t?n:t<=1?n.slice(0,t):`${Qe(n).slice(0,t-1)}…`}function tt(e,t){let n=String(e??``),r=$e(n);return r===t?n:r>t?et(n,t):n+` `.repeat(t-r)}function nt(e,t){if(!e.length)return``;let n=Math.max(...e.map(e=>e.length)),r=[];for(let i=0;i<n;i++)if(t&&t[i]!==void 0)r[i]=t[i];else{let t=0;for(let n of e){let e=i<n.length?String(n[i]??``):``;t=Math.max(t,$e(e))}r[i]=t}return e.map(e=>r.map((t,n)=>tt(n<e.length?String(e[n]??``):``,t)).join(` `).replace(/\s+$/,``)).join(`
|
|
4
4
|
`)}function rt(e){return e instanceof Date?e:new Date(e)}function it(e){return e<10?`0${e}`:String(e)}function at(e,t=`short`){let n=rt(e);if(Number.isNaN(n.getTime()))return String(e);if(t===`iso`)return n.toISOString();if(t===`locale`)return new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}).format(n);if(t===`human`){let e=Date.now()-n.getTime(),t=Math.abs(e);if(t<6e4)return e>=0?`just now`:`in a moment`;let r=(t,n)=>e>=0?`${t} ${n}${t===1?``:`s`} ago`:`in ${t} ${n}${t===1?``:`s`}`;return t<36e5?r(Math.round(t/6e4),`minute`):t<864e5?r(Math.round(t/36e5),`hour`):t<26298e5?r(Math.round(t/864e5),`day`):t<315576e5?r(Math.round(t/26298e5),`month`):r(Math.round(t/315576e5),`year`)}return`${n.getFullYear()}-${it(n.getMonth()+1)}-${it(n.getDate())}`}const ot={trunc:et,col:tt,table:nt,date:at};var P=class extends Error{actual;expected;operator;generatedMessage;code;constructor(e={}){let t=!e.message;super(e.message||`${st(e.actual)} ${e.operator||`!=`} ${st(e.expected)}`),this.name=`AssertionError`,this.actual=e.actual,this.expected=e.expected,this.operator=e.operator||``,this.generatedMessage=t,this.code=`ERR_ASSERTION`}};function st(e){if(typeof e==`string`)return JSON.stringify(e);if(e==null)return String(e);if(typeof e==`object`)try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function F(e,t){return e instanceof Error?e:typeof e==`string`?new P({message:e}):t()}function ct(e,t,n,r){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ut(e[i],t[i],n,r))return!1;return!0}function lt(e,t,n,r){let i=Object.keys(e);if(i.length!==Object.keys(t).length)return!1;for(let a of i)if(!Object.prototype.hasOwnProperty.call(t,a)||!ut(Reflect.get(e,a),Reflect.get(t,a),n,r))return!1;return!0}function ut(e,t,n,r){if((n?Object.is(e,t):e===t)||!n&&e==t)return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null)return!1;let i=e,a=t;return n&&Object.getPrototypeOf(i)!==Object.getPrototypeOf(a)?!1:r.get(i)===a||(r.set(i,a),Array.isArray(e)===Array.isArray(t)?Array.isArray(e)&&Array.isArray(t)?ct(e,t,n,r):lt(i,a,n,r):!1)}function dt(e,t){try{if(e instanceof t)return!0}catch{}try{return!!t(e)}catch{return!1}}function ft(e,t){for(let[n,r]of Object.entries(t)){let t=Reflect.get(e,n);if(r instanceof RegExp){if(typeof t!=`string`||!r.test(t))return!1}else if(t!==r)return!1}return!0}function pt(e,t){if(t===void 0)return!0;if(t instanceof RegExp){let n=e instanceof Error?e.message:String(e);return t.test(n)}return typeof t==`function`?dt(e,t):t&&typeof t==`object`?!e||typeof e!=`object`?!1:ft(e,t):!1}function mt(e){let t=(e,t)=>{if(!e)throw F(t,()=>new P({message:`The expression evaluated to a falsy value`,actual:e,expected:!0,operator:`==`}))},n=((e,n)=>t(e,n)),r=(e,t,n)=>{if(!Object.is(e,t))throw F(n,()=>new P({actual:e,expected:t,operator:`strictEqual`}))},i=(t,n,i)=>{if(e){r(t,n,i);return}if(t!=n)throw F(i,()=>new P({actual:t,expected:n,operator:`==`}))},a=(e,t,n)=>{if(Object.is(e,t))throw F(n,()=>new P({actual:e,expected:t,operator:`notStrictEqual`}))},o=(t,n,r)=>{if(e){a(t,n,r);return}if(t==n)throw F(r,()=>new P({actual:t,expected:n,operator:`!=`}))},s=(e,t,n)=>{if(!ut(e,t,!0,new WeakMap))throw F(n,()=>new P({actual:e,expected:t,operator:`deepStrictEqual`}))},c=(t,n,r)=>{if(e){s(t,n,r);return}if(!ut(t,n,!1,new WeakMap))throw F(r,()=>new P({actual:t,expected:n,operator:`deepEqual`}))},l=(e,t,n)=>{if(ut(e,t,!0,new WeakMap))throw F(n,()=>new P({actual:e,expected:t,operator:`notDeepStrictEqual`}))};return n.ok=t,n.equal=i,n.notEqual=o,n.strictEqual=r,n.notStrictEqual=a,n.deepEqual=c,n.deepStrictEqual=s,n.notDeepEqual=(t,n,r)=>{if(e){l(t,n,r);return}if(ut(t,n,!1,new WeakMap))throw F(r,()=>new P({actual:t,expected:n,operator:`notDeepEqual`}))},n.notDeepStrictEqual=l,n.throws=(e,t,n)=>{let r,i=!1;try{e()}catch(e){r=e,i=!0}if(!i)throw F(typeof t==`string`?t:n,()=>new P({message:`Missing expected exception`,operator:`throws`}));if(!(typeof t==`string`||t instanceof Error)&&!pt(r,t))throw F(n,()=>new P({message:`Got unwanted exception`,actual:r,operator:`throws`}))},n.doesNotThrow=(e,t)=>{try{e()}catch(e){throw F(t,()=>new P({message:`Got unwanted exception`,actual:e,operator:`doesNotThrow`}))}},n.fail=e=>{throw F(e,()=>new P({message:`Failed`,operator:`fail`}))},n.AssertionError=P,n}const ht=mt(!0);ht.strict=ht;const gt=mt(!1);gt.strict=ht;function _t(e,t){let n=globalThis.Buffer;if(!n)throw Error(`crypto.createHash: Buffer is unavailable in this environment`);return t?n.from(e,t):n.from(e)}var vt=class{_events=new Map;closeScheduled=!1;writable=!0;readable=!0;on(e,t){let n=this._events.get(e);return n?n.push(t):this._events.set(e,[t]),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this._events.get(e);if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}return this}emit(e,...t){let n=this._events.get(e);if(!n||n.length===0)return!1;for(let e of[...n])e(...t);return!0}pipe(e){return this.on(`data`,t=>e.write(t)),this.once(`end`,()=>e.end()),e}closeOnDestroy(){return this.closeScheduled?this:(this.closeScheduled=!0,queueMicrotask(()=>this.emit(`close`)),this)}removeListener(e,t){return this.off(e,t)}removeAllListeners(){return this._events.clear(),this}},yt=class extends vt{read(){return null}destroy(){return this.closeOnDestroy()}},bt=class extends vt{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}destroy(){return this.closeOnDestroy()}},xt=class extends vt{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}read(){return null}destroy(){return this.closeOnDestroy()}};const St={Readable:yt,Writable:bt,Transform:xt,PassThrough:class extends xt{},Stream:vt};function Ct(e,t){return Object.assign(TypeError(t),{code:e})}const wt=e=>e.startsWith(`--`)&&e.length>2,Tt=e=>/^-[^-]/.test(e);function Et(e,t,n){let r=[];for(let i=1;i<e.length;i++)if(t[n(e[i])]?.type!==`string`||i===e.length-1)r.push(`-${e[i]}`);else{r.push(`-${e.slice(i)}`);break}return r}function Dt(e,t,n){let r=[],i=[...e],a=-1,o=0,s=(e,t,n,r)=>({kind:`option`,name:e,rawName:t,index:a,value:n,inlineValue:r}),c=e=>t[e]?.type===`string`;for(;i.length>0;){let e=i.shift(),l=i[0];if(o>0?o--:a++,e===`--`){r.push({kind:`option-terminator`,index:a});for(let e of i)r.push({kind:`positional`,index:++a,value:e});break}if(Tt(e)&&e.length===2){let t=n(e[1]);c(t)&&l!==void 0?(i.shift(),r.push(s(t,e,l,!1)),a++):r.push(s(t,e,void 0,void 0));continue}if(Tt(e)){let a=n(e[1]);if(c(a))r.push(s(a,`-${e[1]}`,e.slice(2),!0));else{let r=Et(e,t,n);i.unshift(...r),o=r.length}continue}if(wt(e)){let t=e.indexOf(`=`);if(t!==-1){r.push(s(e.slice(2,t),e.slice(0,t),e.slice(t+1),!0));continue}let n=e.slice(2);c(n)&&l!==void 0?(i.shift(),r.push(s(n,e,l,!1)),a++):r.push(s(n,e,void 0,void 0));continue}r.push({kind:`positional`,index:a,value:e})}return r}function Ot(e,t){let n=t?.short?`'-${t.short}, --${e.name}'`:`'--${e.name}'`;if(!t)throw Ct(`ERR_PARSE_ARGS_UNKNOWN_OPTION`,`Unknown option '${e.rawName}'${e.rawName.startsWith(`--`)?``:`. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- "-"'`}`);if(t.type===`string`&&typeof e.value!=`string`)throw Ct(`ERR_PARSE_ARGS_INVALID_OPTION_VALUE`,`Option ${n.replace(/'$/,` <value>'`)} argument missing`);if(t.type===`boolean`&&e.value!==void 0)throw Ct(`ERR_PARSE_ARGS_INVALID_OPTION_VALUE`,`Option ${n} does not take an argument`);let r=e.value!==void 0&&e.value.length>1&&e.value[0]===`-`;if(t.type===`string`&&e.inlineValue===!1&&r)throw Ct(`ERR_PARSE_ARGS_INVALID_OPTION_VALUE`,`Option '${e.rawName}' argument is ambiguous.\nDid you forget to specify the option argument for '${e.rawName}'?\nTo specify an option argument starting with a dash use '${e.rawName.startsWith(`--`)?`${e.rawName}=-XYZ`:`--${e.name}=-XYZ' or '${e.rawName}-XYZ`}'.`)}function kt(e,t,n,r){if(!r){e[t]=n;return}let i=e[t];e[t]=Array.isArray(i)?[...i,n]:[n]}function At(e,t,n){let r=e.slice(3);return n&&e.startsWith(`no-`)?{name:r,negated:!0}:{name:e,negated:!1}}function jt(e,t,n,r,i){let{name:a,negated:o}=At(t.name,n,i);t.name=a;let s=n[a];r&&Ot(t,o&&s?.type!==`boolean`?void 0:s),kt(e,a,o?!1:t.value??!0,s?.multiple===!0)}function Mt(e={},t=()=>[]){let n=e.args??t(),r=e.options??{},i=e.strict??!0,a=e.allowPositionals??!i,o=e.allowNegative??!1,s=e=>Object.keys(r).find(t=>r[t].short===e)??e,c=Object.create(null),l=[],u=Dt(n,r,s);for(let e of u){if(e.kind===`positional`){if(i&&!a)throw Ct(`ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL`,`Unexpected argument '${e.value}'. This command does not take positional arguments`);l.push(e.value);continue}e.kind===`option`&&jt(c,e,r,i,o)}for(let[e,t]of Object.entries(r))t.default!==void 0&&c[e]===void 0&&(c[e]=t.default);return e.tokens?{values:c,positionals:l,tokens:u}:{values:c,positionals:l}}const Nt=Symbol.for(`nodejs.util.inspect.custom`),Pt=Symbol.for(`nodejs.util.promisify.custom`);function Ft(e){return`'${e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`).replace(/\n/g,`\\n`)}'`}function It(e){if(e===null)return`null`;let t=typeof e;if(t===`string`)return Ft(e);if(t===`number`)return Object.is(e,-0)?`-0`:String(e);if(t===`bigint`)return`${String(e)}n`;if(t===`boolean`||t===`undefined`)return String(e);if(t===`symbol`)return e.toString();if(t===`function`){let t=e.name;return t?`[Function: ${t}]`:`[Function (anonymous)]`}return null}function Lt(e){return e instanceof RegExp?e.toString():e instanceof Date?Number.isNaN(e.getTime())?`Invalid Date`:e.toISOString():e instanceof Error?e.stack||`${e.name}: ${e.message}`:null}function Rt(e,t,n){if(Array.isArray(e))return e.length===0?`[]`:`[ ${e.map(e=>zt(e,t+1,n)).join(`, `)} ]`;if(e instanceof Map){let r=[...e].map(([e,r])=>`${zt(e,t+1,n)} => ${zt(r,t+1,n)}`);return`Map(${e.size}) {${r.length?` ${r.join(`, `)} `:``}}`}if(e instanceof Set){let r=[...e].map(e=>zt(e,t+1,n));return`Set(${e.size}) {${r.length?` ${r.join(`, `)} `:``}}`}let r=Object.keys(e),i=e.constructor?e.constructor.name:``,a=i&&i!==`Object`?`${i} `:``;return r.length===0?`${a}{}`:`${a}{ ${r.map(r=>`${/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(r)?r:Ft(r)}: ${zt(e[r],t+1,n)}`).join(`, `)} }`}function zt(e,t,n){let r=It(e);if(r!==null)return r;let i=e,a=Lt(i);if(a!==null)return a;let o=i[Nt];if(typeof o==`function`)try{return String(o.call(i,n.maxDepth,n.opts))}catch{}if(n.seen.has(e))return`[Circular *1]`;if(n.maxDepth!==null&&t>n.maxDepth)return Array.isArray(e)?`[Array]`:`[Object]`;n.seen.add(e);try{return Rt(i,t,n)}finally{n.seen.delete(e)}}function Bt(e,t={}){let n=t.depth===void 0?2:t.depth;return zt(e,0,{seen:new Set,maxDepth:n,opts:t})}function Vt(e,t,n,r){if(e===`%%`)return`%`;if(n.i>=t.length)return e;let i=t[n.i];switch(e){case`%s`:return n.i++,typeof i==`string`?i:typeof i==`bigint`?`${String(i)}n`:i==null||typeof i==`number`||typeof i==`boolean`?String(i):Bt(i,{depth:r.depth===void 0?2:r.depth});case`%d`:return n.i++,typeof i==`bigint`?`${String(i)}n`:Number.isNaN(Number(i))?`NaN`:String(Number(i));case`%i`:return n.i++,typeof i==`bigint`?`${String(i)}n`:String(Number.parseInt(i,10));case`%f`:return n.i++,String(typeof i==`bigint`?i:Number.parseFloat(i));case`%j`:n.i++;try{return JSON.stringify(i)??`undefined`}catch{return`[Circular]`}case`%o`:return n.i++,Bt(i,{depth:4});case`%O`:return n.i++,Bt(i,{depth:null});case`%c`:return n.i++,``;default:return e}}function Ht(e,...t){let n=t[0];if(typeof n!=`string`)return t.map(e=>typeof e==`string`?e:Bt(e)).join(` `);let r={i:1},i=n.replace(/%[sdifjoOc%]/g,n=>Vt(n,t,r,e));for(;r.i<t.length;r.i++){let e=t[r.i];i+=` ${typeof e==`string`?e:Bt(e)}`}return i}function Ut(...e){return Ht({},...e)}function Wt(e,t){if(e==null)throw TypeError(`The constructor to "inherits" must not be null or undefined`);if(t==null)throw TypeError(`The super constructor to "inherits" must not be null or undefined`);if(t.prototype===void 0)throw TypeError(`The super constructor to "inherits" must have a prototype`);e.super_=t,Object.setPrototypeOf(e.prototype,t.prototype)}function Gt(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type function`);let t=e[Pt];if(t){if(typeof t!=`function`)throw TypeError(`The [util.promisify.custom] property must be of type function`);return t}function n(...t){return new Promise((n,r)=>{e.call(this,...t,(e,...t)=>{if(e){r(e);return}n(t.length>1?t:t[0])})})}return Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)),n}function Kt(e){return function(t,n,r){if(typeof t!=`function`)throw TypeError(`The "fn" argument must be of type function`);let i=!1;function a(...a){return i||(i=!0,e(r?`[${r}] DeprecationWarning: ${n}`:`DeprecationWarning: ${n}`)),new.target?Reflect.construct(t,a,new.target):t.apply(this,a)}return Object.setPrototypeOf(a,Object.getPrototypeOf(t)),t.prototype&&(a.prototype=t.prototype),a}}const qt=Bt;qt.custom=Nt;const Jt=Gt;Jt.custom=Pt;function Yt(e,t=()=>[]){return{parseArgs:e=>Mt(e,t),format:Ut,formatWithOptions:Ht,inspect:qt,inherits:Wt,promisify:Jt,deprecate:Kt(e)}}const Xt=Yt(()=>{});let Zt=1;function Qt(e){if(typeof e==`string`)return e;if(ArrayBuffer.isView(e)){let t=e;return new TextDecoder().decode(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}return e==null?``:String(e)}function $t(e,t,n){return Object.assign(TypeError(`The "${e}" argument must be of type ${t}. Received ${n===null?`null`:Array.isArray(n)?`array`:typeof n}`),{code:`ERR_INVALID_ARG_TYPE`})}function en(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))throw $t(`options.env`,`object`,e);let t={};for(let[n,r]of Object.entries(e))if(r!==void 0){if(typeof r!=`string`)throw $t(`options.env[${n}]`,`string`,r);t[n]=r}return t}function tn(e){if(e!==void 0){if(typeof e==`string`)return e;if(typeof e==`object`&&e&&typeof e.href==`string`)try{return T.fileURLToPath(e.href)}catch{throw $t(`options.cwd`,`string or an instance of URL (file:)`,e)}throw $t(`options.cwd`,`string or an instance of URL`,e)}}function nn(e,t){return t===void 0||t===`utf8`||t===`utf-8`?e:t===`buffer`||t===null?_t(e):_t(e).toString(t)}function rn(e,t){if(e.length===0)return nn(``,t);if(typeof e[0]==`string`)return e.join(``);let n=globalThis.Buffer;return n?n.concat(e):e[0]}function an(e,t,n){t.length>0&&e.emit(`data`,nn(t,n)),e.readable=!1,e.emit(`end`)}function on(e){let t=e=>{typeof e==`function`&&queueMicrotask(e)};return{writable:!0,write(n,r,i){return e.stdin.write(Qt(n)),t(typeof r==`function`?r:i),!0},end(n,r,i){n!==void 0&&typeof n!=`function`&&e.stdin.write(Qt(n)),e.stdin.end(),this.writable=!1,t(typeof n==`function`?n:typeof r==`function`?r:i)}}}var sn=class extends qe{stdout;stderr;stdin;pid;exitCode=null;signalCode=null;killed=!1;spawnfile;spawnargs;handle;constructor(e,t,n,r){super(),this.handle=e,this.pid=Zt++,this.spawnfile=n,this.spawnargs=r,this.stdout=new yt,this.stderr=new yt,this.stdin=on(e),e.done.then(e=>this.finish(e,t),e=>this.emit(`error`,e instanceof Error?e:Error(String(e))))}finish(e,t){an(this.stdout,e.stdout,t),an(this.stderr,e.stderr,t),this.exitCode=e.exitCode;let n=this.killed?null:e.exitCode,r=this.killed?this.signalCode:null;this.emit(`exit`,n,r),this.emit(`close`,n,r)}kill(e=`SIGTERM`){return this.killed=!0,this.signalCode=e,this.handle.kill(e).catch(()=>{}),!0}};function cn(e){let t=(t,n,r)=>{if(!e)throw Error(`child_process.${t} is not available in this browser realm (no synchronous bridge — the page has no controlling Service Worker). Use the async form instead: await promisify(${t.replace(/Sync$/,``)})(…).`);return e.run(n,r)},n=e=>{let t=tn(e.cwd),n=en(e.env);return{...e.input===void 0?{}:{input:Qt(e.input)},...e.timeout===void 0?{}:{timeout:e.timeout},...t===void 0?{}:{cwd:t},...n===void 0?{}:{env:n}}},r=(e,r,i,a)=>{let o=a.encoding===void 0?`buffer`:a.encoding,s=t(e,r,n(a)),c=nn(s.stdout,o),l=nn(s.stderr,o);if(s.exitCode===0)return c;throw Object.assign(Error(`Command failed: ${i}\n${s.stderr}`),{status:s.exitCode,signal:null,stdout:c,stderr:l,output:[null,c,l],pid:Zt++})},i=(e,t)=>({args:Array.isArray(e)?e:[],options:(Array.isArray(e)?t:e)??{}});return{execSync:(e,t={})=>r(`execSync`,e,e,t),execFileSync:(e,t,n)=>{let{args:a,options:o}=i(t,n),s=[e,...a];return r(`execFileSync`,s,s.join(` `),o)},spawnSync:(e,r,a)=>{let{args:o,options:s}=i(r,a),c=s.encoding===void 0?`buffer`:s.encoding,l=Zt++,u=s.shell?`${e}${o.length?` ${o.join(` `)}`:``}`:[e,...o],d;try{d=t(`spawnSync`,u,n(s))}catch(e){if(e instanceof TypeError)throw e;let t=nn(``,c);return{pid:l,status:null,signal:null,stdout:t,stderr:t,output:[null,t,t],error:e instanceof Error?e:Error(String(e))}}let f=nn(d.stdout,c),p=nn(d.stderr,c);return{pid:l,status:d.exitCode,signal:null,stdout:f,stderr:p,output:[null,f,p]}}}}function ln(e,t){let n=(t,n,r,i,a)=>{let o=tn(n.cwd),s=en(n.env),c={...o===void 0?{}:{cwd:o},...s===void 0?{}:{env:s}},l=e.start(t,c),u=new sn(l,r,i,a);return n.input!==void 0&&u.stdin.write(Qt(n.input)),queueMicrotask(()=>l.stdin.end()),u},r=(e,t,n,r)=>{if(typeof r!=`function`)return;let i=[],a=[];e.stdout.on(`data`,e=>i.push(e)),e.stderr.on(`data`,e=>a.push(e)),e.once(`error`,e=>r(e,rn(i,t),rn(a,t))),e.once(`close`,(o,s)=>{let c=rn(i,t),l=rn(a,t);if(o===0){r(null,c,l);return}r(Object.assign(Error(`Command failed: ${n}\n${Qt(l)}`),{code:o===null?void 0:o,killed:e.killed,signal:s??null,cmd:n}),c,l)})},i=(e,t,i)=>{let a=typeof t==`function`?t:i,o=t&&typeof t==`object`?t:{},s=o.encoding===void 0?`utf8`:o.encoding,c=n(e,o,s,e,[]);return r(c,s,e,a),c},a=(e,t,i,a)=>{let o=[],s={},c;Array.isArray(t)?(o=t,typeof i==`function`?c=i:(s=i??{},c=typeof a==`function`?a:void 0)):typeof t==`function`?c=t:t&&typeof t==`object`&&(s=t,c=typeof i==`function`?i:void 0);let l=s.encoding===void 0?`utf8`:s.encoding,u=[e,...o],d=n(u,s,l,e,o);return r(d,l,u.join(` `),c),d},o=(e,t,r)=>{let i=[],a={};Array.isArray(t)?(i=t,a=r??{}):t&&typeof t==`object`&&(a=t);let o=a.encoding===void 0?`buffer`:a.encoding,s=a.shell?`${e}${i.length?` ${i.join(` `)}`:``}`:[e,...i];return n(s,a,o,e,i)},s=(e,t)=>new Promise((n,r)=>{i(e,t,(e,t,i)=>{if(e){r(Object.assign(e,{stdout:t,stderr:i}));return}n({stdout:t,stderr:i})})}),c=(e,t,n)=>new Promise((r,i)=>{a(e,Array.isArray(t)?t:[],Array.isArray(t)?n:t,(e,t,n)=>{if(e){i(Object.assign(e,{stdout:t,stderr:n}));return}r({stdout:t,stderr:n})})}),l=e=>()=>{throw Error(`child_process.${e} is not available in the browser realm`)},u=cn(t),d=(e,t)=>{Object.defineProperty(e,Pt,{value:t,enumerable:!1,configurable:!0})};return d(i,s),d(a,c),{exec:i,execFile:a,spawn:o,execSync:u.execSync,spawnSync:u.spawnSync,execFileSync:u.execFileSync,fork:l(`fork`),ChildProcess:sn}}function un(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var dn={exports:{}};
|
|
@@ -30,4 +30,4 @@ for (var __vm_i = 0; __vm_i < __vm_fns.length; __vm_i++) {
|
|
|
30
30
|
`)?a:`${a}\n`;t(n>0?`${` `.repeat(n)}${o}`:o)}function os(e,t,n){let r=es(n);if(e.has(r)){t(`Label '${r}' already exists for console.time()`);return}e.set(r,ts())}function ss(e,t,n,r){let i=es(r),a=e.get(i);if(a===void 0){t(`No such label '${i}' for console.timeEnd()`);return}e.delete(i),n(`${i}: ${ns(ts()-a)}`)}function cs(e,t,n,r,i){let a=es(r),o=e.get(a);if(o===void 0){t(`No such label '${a}' for console.timeLog()`);return}let s=`${a}: ${ns(ts()-o)}`;i.length===0?n(s):n(s,...i)}function ls(e,t,n){let r=es(n),i=(e.get(r)??0)+1;e.set(r,i),t(`${r}: ${i}`)}function us(e,t,n){let r=es(n);if(!e.has(r)){t(`Count for '${r}' does not exist`);return}e.set(r,0)}function ds(e,t,n){n.length>0&&t(...n),e.depth+=1}function fs(e){e.depth>0&&--e.depth}function ps(e,t){let n=new Map,r=new Map,i={depth:0},a=(...t)=>rs(e,i.depth,t),o=(...e)=>rs(t,i.depth,e),s=(...e)=>ds(i,a,e);return{log:a,info:a,debug:a,dirxml:a,table:a,warn:o,error:o,dir:(e,t)=>a(e),clear:()=>void 0,group:s,groupCollapsed:s,groupEnd:()=>fs(i),assert:(e,...t)=>is(o,e,t),trace:(...e)=>as(o,t,i.depth,e),time:e=>os(r,o,e),timeEnd:e=>ss(r,o,a,e),timeLog:(e,...t)=>cs(r,o,a,e,t),count:e=>ls(n,a,e),countReset:e=>us(n,o,e)}}function ms(e,t){return e.process===void 0?(e.process=t,()=>{e.process===t&&delete e.process}):()=>void 0}function hs(e,t,n){return Object.assign(new qe,{fd:e,write:e=>(t(e),!0),end:()=>void 0,isTTY:n})}function gs(e,t,n){let r=!!e.env?.NO_COLOR,i=!1,a,o,s=e=>{i=!0,o=e,a=e},c=vs(e.stdin??``,s),u=Bo(e.argv),d=hs(1,t,!r),f=hs(2,n,!r);return{processShim:{argv:u,env:e.env,versions:{node:l},version:`v${l}`,platform:`linux`,arch:`x64`,cwd:()=>e.cwd,get exitCode(){return a},set exitCode(e){a=Zo(e)},exit:(...e)=>{if(e.length===0){let e=qo(a);throw s(e),new Q(e)}a=Zo(e[0]);let t=qo(a);throw s(t),new Q(t)},stdin:c,stdout:d,stderr:f},getDidCallProcessExit:()=>i,getExitCode:()=>qo(i?o:a),recordExit:s}}var _s=class extends St.Stream{isTTY=!1;fd=0;consumed=!1;flowScheduled=!1;paused=!1;buffer;onExit;constructor(e,t){super(),this.buffer=e,this.onExit=t}read(){return this.consumed?null:(this.consumed=!0,this.buffer.length>0?this.buffer:null)}toString(){return this.buffer}setEncoding(e){return this}pause(){return this.paused=!0,this}resume(){return this.paused=!1,this.scheduleFlow(),this}on(e,t){return super.on(e,t),e===`data`&&this.scheduleFlow(),this}addListener(e,t){return this.on(e,t)}once(e,t){return super.once(e,t),e===`data`&&this.scheduleFlow(),this}scheduleFlow(){this.flowScheduled||(this.flowScheduled=!0,queueMicrotask(()=>this.flush()))}flush(){if(this.paused){this.flowScheduled=!1;return}try{this.consumed||(this.consumed=!0,this.buffer.length>0&&this.emit(`data`,this.buffer)),this.readable=!1,this.emit(`end`),this.emit(`close`)}catch(e){if(e instanceof Q){this.onExit(e.code);return}throw e}}[Symbol.asyncIterator](){return{next:async()=>this.consumed?{value:void 0,done:!0}:(this.consumed=!0,{value:this.buffer,done:!1})}}};function vs(e,t){return new _s(e,t)}function ys(e){if(e===``)return[];let t=e.split(`
|
|
31
31
|
`);return t[t.length-1]===``&&t.pop(),t.map(e=>e.endsWith(`\r`)?e.slice(0,-1):e)}function bs(e){if(typeof e==`string`)return e;if(e&&typeof e.read==`function`){let t=e.read();return typeof t==`string`?t:``}return``}function xs(e){return new TextDecoder(`utf-8`).decode(ye(e))}function Ss(e){if(e&&typeof e.write==`function`)return e}var Cs=class extends qe{terminal=!1;lines;cursor=0;closed=!1;flushScheduled=!1;output;onExit;constructor(e,t,n){super(),this.lines=ys(xs(bs(e))),this.output=t??n.output,this.onExit=n.onExit}on(e,t){return super.on(e,t),e===`line`&&this.scheduleFlush(),this}once(e,t){return super.once(e,t),e===`line`&&this.scheduleFlush(),this}pause(){return this}resume(){return this}close(){this.closed||(this.closed=!0,this.emit(`close`))}question(e,t,n){let r=typeof t==`function`?t:typeof n==`function`?n:void 0;this.output?.write(String(e));let i=this.cursor<this.lines.length?this.lines[this.cursor++]:``;if(r){queueMicrotask(()=>this.runHandler(()=>r(i)));return}return Promise.resolve(i)}[Symbol.asyncIterator](){return{next:async()=>!this.closed&&this.cursor<this.lines.length?{value:this.lines[this.cursor++],done:!1}:(this.close(),{value:void 0,done:!0})}}scheduleFlush(){this.flushScheduled||this.closed||(this.flushScheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this.flushScheduled=!1,this.runHandler(()=>{for(;!this.closed&&this.cursor<this.lines.length;)this.emit(`line`,this.lines[this.cursor++]);this.close()})}runHandler(e){try{e()}catch(e){if(e instanceof Q&&this.onExit){this.closed=!0,this.onExit(e.code);return}throw e}}};function ws(e){let t=(t,n)=>{let r,i;if(t&&typeof t==`object`&&`input`in t){let e=t;r=e.input,i=Ss(e.output)}else r=t,i=Ss(n);if(r==null)throw TypeError(`readline.createInterface: an 'input' stream is required`);return new Cs(r,i,e)},n=(...e)=>{let t=e[e.length-1];return typeof t==`function`&&queueMicrotask(()=>t()),!0},r={createInterface:t,Interface:Cs,emitKeypressEvents:()=>void 0,cursorTo:n,moveCursor:n,clearLine:n,clearScreenDown:n};return{...r,promises:r}}var Ts=class extends Error{status;statusText;url;body;constructor(e,t,n,r){let i=typeof r==`string`&&r?`: ${r.slice(0,200)}`:r&&typeof r==`object`?`: ${Es(r).slice(0,200)}`:``;super(`HTTP ${e} ${t} ${n}${i}`),this.status=e,this.statusText=t,this.url=n,this.body=r,this.name=`HttpError`}};function Es(e){try{return JSON.stringify(e)}catch{return String(e)}}function Ds(e){return new Promise(t=>setTimeout(t,e))}function Os(e,t){let n=[];for(let[e,r]of Object.entries(t))if(r!=null){if(Array.isArray(r))for(let t of r)t!=null&&n.push(`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`);else n.push(`${encodeURIComponent(e)}=${encodeURIComponent(String(r))}`)}return n.length===0?e:e+(e.includes(`?`)?`&`:`?`)+n.join(`&`)}function ks(e,t,n){let r;return r=/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:e?`${e.endsWith(`/`)?e.slice(0,-1):e}${t.startsWith(`/`)?t:`/${t}`}`:t,n?Os(r,n):r}function As(e,t){let n={};if(e)for(let[t,r]of Object.entries(e))n[t]=r;if(t)for(let[e,r]of Object.entries(t))n[e]=r;return n}function js(e){if(!e)return!1;let t=e.toLowerCase();return t.startsWith(`application/json`)||/[+/]json(;|$|\s)/.test(t)}function Ms(e){if(!e)return null;let t=e.trim();if(!t)return null;if(/^\d+(\.\d+)?$/.test(t)){let e=Number(t);if(Number.isFinite(e)&&e>=0)return Math.round(e*1e3)}let n=Date.parse(t);if(Number.isFinite(n)){let e=n-Date.now();return e>0?e:0}return null}async function Ns(e){if(js(e.headers.get(`content-type`))){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}return e.text()}function Ps(e,t){if(e!=null)return typeof e==`string`||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof Blob<`u`&&e instanceof Blob||typeof FormData<`u`&&e instanceof FormData||typeof URLSearchParams<`u`&&e instanceof URLSearchParams||typeof ReadableStream<`u`&&e instanceof ReadableStream?e:typeof e==`object`?(Object.keys(t).some(e=>e.toLowerCase()===`content-type`)||(t[`Content-Type`]=`application/json`),JSON.stringify(e)):String(e)}function Fs(e,t){return Object.keys(e).some(e=>e.toLowerCase()===t.toLowerCase())}async function Is(e,t,n){let r=await t(n);r&&!Fs(e,`authorization`)&&(e.Authorization=`Bearer ${r}`)}function Ls(e,t){if(!t)return{signal:e,clearTimeout:null};let n=new AbortController,r=setTimeout(()=>n.abort(Error(`timeout`)),t),i=()=>clearTimeout(r);return e?{signal:AbortSignal.any([e,n.signal]),clearTimeout:i}:{signal:n.signal,clearTimeout:i}}function Rs(e,t){return{body:t,headers:Object.fromEntries(e.headers.entries()),status:e.status}}async function zs(e,t){let n=await Ns(e);return t?Rs(e,n):n}async function Bs(e,t){let n=await Ns(e).catch(()=>null);throw new Ts(e.status,e.statusText,t,n)}function Vs(e,t){let n=Ms(e.headers.get(`retry-after`));return n===null?500*2**t:n}const Hs=new Set([`GET`,`HEAD`,`OPTIONS`,`TRACE`,`PUT`,`DELETE`]),Us=new Set([429]);function Ws(e,t,n){return Us.has(e)?!0:n.has(t.toUpperCase())}async function Gs(e,t,n,r){let i=null;for(let a=0;a<e.maxAttempts;a++){let{signal:o,clearTimeout:s}=Ls(r.signal,e.timeoutMs),c=o?{...n,signal:o}:n,l;try{l=await e.fetch(t,c)}finally{s?.()}if(i=l,l.ok)return zs(l,r.raw);let u=n.method??`GET`;if(!(a+1<e.maxAttempts&&e.retryOn.has(l.status)&&Ws(l.status,u,e.retryMethods)))return Bs(l,t);await e.sleep(Vs(l,a))}if(i)return Bs(i,t);throw Error(`http: no attempts made for ${n.method??`GET`} ${t}`)}function Ks(e){let t=e.sleep??Ds;function n(n){let r=new Set(n.retry?.on??[]),i=Math.max(1,Math.trunc(n.retry?.maxAttempts??1)),a=n.retry?.methods?new Set(n.retry.methods.map(e=>e.toUpperCase())):new Set(Hs);async function o(o,s,c={}){let l=ks(n.baseUrl,s,c.params),u=As(n.headers,c.headers);n.token&&await Is(u,n.token,{method:o,path:s,url:l});let d=Ps(c.body,u),f={method:o,headers:u};return d!==void 0&&(f.body=d),Gs({fetch:e.fetch,sleep:t,maxAttempts:i,retryOn:r,retryMethods:a,timeoutMs:n.timeoutMs},l,f,c)}return Object.freeze({get:((e,t)=>o(`GET`,e,t)),post:((e,t)=>o(`POST`,e,t)),put:((e,t)=>o(`PUT`,e,t)),patch:((e,t)=>o(`PATCH`,e,t)),delete:((e,t)=>o(`DELETE`,e,t))})}return Object.freeze({client:n})}function qs(e){let t=new TextEncoder().encode(e),n=``;for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return btoa(n)}function Js(e,t,n){let r=[];t.model&&r.push(`--model`,String(t.model)),t.thinking&&r.push(`--thinking`,String(t.thinking)),t.schema&&r.push(`--schema-b64`,qs(JSON.stringify(t.schema))),t.readOnly!==void 0&&r.push(`--read-only`,Array.isArray(t.readOnly)?t.readOnly.join(`,`):String(t.readOnly));let i=t.cwd===void 0?n||`.`:String(t.cwd),a=t.allowedCommands===void 0?`*`:String(t.allowedCommands);return[`agent`,...r,i,a,String(e)]}function Ys(e,t){let n=t.cwd,r=async(t,r)=>{let i=r??{},a=await e.spawn(Js(t,i,n)),o=typeof a.exitCode==`number`?a.exitCode:0;return{finalText:String(a.stdout??``).replace(/\n+$/,``),exitCode:o,stderr:String(a.stderr??``).replace(/\n+$/,``)}},i=(async(e,t)=>{let n=t??{},i=await r(e,n);if(i.exitCode!==0)throw Error(`agent: exited with code ${i.exitCode}${i.stderr?`: ${i.stderr}`:``}`);if(n.schema)try{return JSON.parse(i.finalText)}catch{throw Error(`agent: schema response was not valid JSON (exit ${i.exitCode}): ${i.finalText.slice(0,200)}`)}return i.finalText});return i.spawn=r,i}function $(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`&&typeof e.targetId==`string`)return e.targetId;throw TypeError(`browser: expected a tab handle or targetId string`)}function Xs(e){function t(t){return{...t,async update(n){let r={};return n.urlMatch!==void 0&&(r.urlMatch=n.urlMatch===null?null:n.urlMatch instanceof RegExp?n.urlMatch.source:n.urlMatch),n.filter!==void 0&&(r.filter=n.filter),e.call(`browser`,`wsUpdate`,[t.id,r])},async close(){return e.call(`browser`,`wsClose`,[t.id])}}}return{on(n,r={}){let i=$(n),a=r.urlMatch===void 0?void 0:r.urlMatch instanceof RegExp?r.urlMatch.source:r.urlMatch,o,s={filter(e){if(typeof e==`function`||typeof e==`string`)throw TypeError(`browser.websocket: filter must be a declarative JSON object, not a function or string`);return o=e,s},async forward(n){return t(await e.call(`browser`,`wsObserve`,[{targetId:i,urlMatch:a,filter:o,forward:n}]))}};return s},async list(){return e.call(`browser`,`wsList`,[])}}}async function Zs(e,t){if(!e&&!(t instanceof Request))return;let n=t instanceof Request?t:null,r=(e?.method??n?.method??`GET`).toUpperCase(),i={};if(e?.headers){if(e.headers instanceof Headers)e.headers.forEach((e,t)=>{i[t]=e});else if(Array.isArray(e.headers))for(let[t,n]of e.headers)i[t]=n;else Object.assign(i,e.headers)}else n&&n.headers.forEach((e,t)=>{i[t]=e});let a,o;if(r!==`GET`&&r!==`HEAD`&&e?.body!==void 0&&e?.body!==null&&e?.body!==``){let t=await Qs(e.body);a=t.body,o=t.defaultContentType}return o&&!Object.keys(i).some(e=>e.toLowerCase()===`content-type`)&&(i[`Content-Type`]=o),{method:r,headers:i,body:a}}async function Qs(e){if(typeof e==`string`)return{body:e};if(e instanceof URLSearchParams)return{body:e.toString(),defaultContentType:`application/x-www-form-urlencoded;charset=UTF-8`};if(e instanceof Blob)return{body:new Uint8Array(await e.arrayBuffer()),defaultContentType:e.type||`application/octet-stream`};if(e instanceof ArrayBuffer)return{body:new Uint8Array(e).slice(),defaultContentType:`application/octet-stream`};if(ArrayBuffer.isView(e))return{body:new Uint8Array(e.buffer,e.byteOffset,e.byteLength).slice(),defaultContentType:`application/octet-stream`};if(n(e)){let t=await r(e);return{body:t.bytes,defaultContentType:t.contentType}}throw typeof ReadableStream<`u`&&e instanceof ReadableStream?Error(`node fetch shim: ReadableStream request bodies are not supported (collect into a Uint8Array or string before calling fetch)`):Error(`node fetch shim: unsupported request body type (${Object.prototype.toString.call(e)}); use a string, Uint8Array, ArrayBuffer, Blob, FormData, or URLSearchParams`)}function $s(e){return{findTab:t=>e.call(`browser`,`findTab`,[tc(t)]),ensureTab:(t,n={})=>e.call(`browser`,`ensureTab`,[t,nc(n)]),openWindow:(t,n={})=>e.call(`browser`,`openWindow`,[t,n]),windowBounds:t=>e.call(`browser`,`windowBounds`,[$(t)]),setWindowBounds:(t,n)=>e.call(`browser`,`setWindowBounds`,[$(t),n]),eval:(t,n)=>e.call(`browser`,`eval`,[$(t),ec(n,!1)]),evalAsync:(t,n)=>e.call(`browser`,`evalAsync`,[$(t),ec(n,!0)]),cookie:(t,n)=>e.call(`browser`,`cookie`,[$(t),n]),localStorage:(t,n)=>e.call(`browser`,`localStorage`,[$(t),n]),fetch:(t,n,r={})=>S(n,r).then(n=>e.call(`browser`,`evalAsync`,[$(t),n])),websocket:Xs(e)}}function ec(e,t){if(typeof e==`function`)return`(${e.toString()})()`;if(typeof e==`string`)return e;throw TypeError(`browser.eval/evalAsync: source must be a function or string`)}function tc(e){let t={};return e.domain!==void 0&&(t.domain=e.domain),e.urlMatch!==void 0&&(t.urlMatch=e.urlMatch instanceof RegExp?e.urlMatch.source:e.urlMatch),t}function nc(e){return e.matchUrl===void 0?{}:{matchUrl:e.matchUrl instanceof RegExp?e.matchUrl.source:e.matchUrl}}function rc(e){return{register(t){let n=null,r=e.onEvent(`computer-call`,r=>{let i=r;i.id===t.id&&ac(e,t,i,{getStop:()=>n,setStop:e=>{n=e}})}),i=ic(t);return e.call(`computer`,`register`,[i]).catch(()=>{}),()=>{n?.(),n=null,r(),e.call(`computer`,`unregister`,[t.id]).catch(()=>{})}}}}function ic(e){return{id:e.id,kind:`jsh`,title:e.title??e.id,size:e.size??null,state:`live`,capabilities:e.capabilities,pid:null,...e.softKeys?{softKeys:e.softKeys}:{}}}async function ac(e,t,n,r){let i;try{i=await oc(e,t,n,r)}catch(e){i={error:e instanceof Error?e.message:String(e)}}try{await e.call(`computer`,`reply`,[n.requestId,i])}catch{}}async function oc(e,t,n,r){switch(n.op){case`screenshot`:return t.screenshot(n.args[0]??{format:`jpeg`});case`text`:return t.text?t.text():null;case`input`:return await t.input(n.args[0]??[]),{ok:!0};case`exec`:if(!t.exec)throw Error(`exec is not supported`);return t.exec(String(n.args[0]??``));case`subscribe`:return sc(e,t,Number(n.args[0])||2,Number(n.args[1])||void 0,r);case`unsubscribe`:return r.getStop()?.(),r.setStop(null),{ok:!0};default:{let e=n.op;throw Error(`unknown computer op '${String(e)}'`)}}}function sc(e,t,n,r,i){if(i.getStop()?.(),!t.subscribe)throw Error(`subscribe is not supported`);let a=t.subscribe(n,n=>{e.call(`computer`,`frame`,[t.id,n]).catch(()=>{})},r);return i.setStop(()=>{try{a()}catch{}}),{ok:!0}}function cc(e){return e===`SIGKILL`?137:e===`SIGINT`?130:143}function lc(e,t,n,r){let i=async()=>{if(!t?.wasUsed())return;let n=t.getMutations();if(n.created.length||n.modified.length||n.deleted.length)try{await e.call(`vfs`,`flushWrites`,[n])}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[realm-exec] pre-exec sync-fs flush failed (will retry at exit): ${t}`);return}t.resetBaseline()},a=async(i=!1)=>{if(t?.wasUsed())try{let r=await e.call(`vfs`,`snapshot`,[n]);i?t.applySnapshotPreservingMutations(r):t.applySnapshot(r)}catch(e){let t=e instanceof Error?e.message:String(e);r?.(`[sync-fs] re-snapshot after exec failed: ${t}\n`)}},o=async t=>{await i();try{return await e.call(`exec`,`run`,[t])}finally{await a()}},s=async t=>{await i();try{return await e.call(`exec`,`spawn`,[t])}finally{await a()}},c=1,l=Object.assign(o,{spawn:s,start:(t,n)=>{let r=c++,o=[],s=!1,l=!1,u=!1,d,f,p=new Promise((e,t)=>{d=e,f=t}),m=()=>{if(s||u||l)return;l=!0;let c=o.length>0?o.join(``):n?.stdin,p={};c!==void 0&&(p.stdin=c),n?.stdinKind!==void 0&&(p.stdinKind=n.stdinKind),n?.args!==void 0&&(p.args=n.args),n?.cwd!==void 0&&(p.cwd=n.cwd),n?.env!==void 0&&(p.env=n.env),(async()=>{try{if(await i(),u){await a(!0);return}s=!0;let n=await e.call(`exec`,`start`,[r,t,p]);await a(!0),d(n)}catch(e){await a(!0),f(e)}})()};return{kill:t=>s?e.call(`exec`,`kill`,[r,t]):(u=!0,d({stdout:``,stderr:``,exitCode:cc(t)}),Promise.resolve(!0)),stdin:{write:e=>{!s&&!u&&o.push(e)},end:()=>m()},done:p}}});return l.exec=l,l}const uc=new Set([204,205,304]),dc=new Set([`content-encoding`,`transfer-encoding`,`content-length`]);function fc(e,t){let n=pc(e.body),r=mc(e.headers),i=uc.has(e.status)||n.byteLength===0,a=new Response(i?null:n,{status:e.status,statusText:e.statusText,headers:r});try{Object.defineProperty(a,"url",{value:e.url||t,writable:!1,configurable:!0,enumerable:!1})}catch{}return gc(a,n),a}function pc(e){return e.byteLength===0?new Uint8Array:e.slice()}function mc(e){let t=new Headers;for(let[n,r]of Object.entries(e))if(!dc.has(n.toLowerCase()))try{t.set(n,r)}catch{}return t}const hc=Symbol(`slicc.realmBufferedBody`);function gc(e,t){if(hc in e)return;Object.defineProperty(e,hc,{value:!0,configurable:!0});let n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),`bodyUsed`),r=!1,i=()=>{if(r)throw TypeError(`Failed to read response body: body already used`);return r=!0,_c(e),t},a=async()=>new TextDecoder().decode(i()),o=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);Object.defineProperties(e,{bodyUsed:{configurable:!0,enumerable:!1,get(){return r?!0:n?.get?!!n.get.call(e):!1}},text:{value:a,configurable:!0},json:{value:async()=>JSON.parse(await a()),configurable:!0},arrayBuffer:{value:async()=>o(i()),configurable:!0},blob:{value:async()=>new Blob([o(i())]),configurable:!0},bytes:{value:async()=>i(),configurable:!0}})}function _c(e){try{let t=e.body;t&&!t.locked&&t.getReader()}catch{}}function vc(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new Uint8Array(e);throw TypeError(`expected an ArrayBuffer or typed array`)}function yc(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function bc(e){return e==null?[]:Array.isArray(e)?e:[e]}function xc(e,t){let n=t.handle,r=new Set,i=new Set,a=!1,o=null,s=e=>{let t=e;if(!t||t.handle!==n)return;let i={reportId:t.reportId,data:yc(t.bytes)};for(let e of[...r])try{e(i)}catch{}},c=()=>{a||(a=!0,o=e.onEvent?e.onEvent(`hid-input-report`,s):null,e.call(`hid`,`subscribeInputReports`,[n]).catch(()=>{a=!1,o?.(),o=null}))},l=()=>{!a||r.size>0||(a=!1,o?.(),o=null,e.call(`hid`,`unsubscribeInputReports`,[n]).catch(()=>{}))};return{...t,open:()=>e.call(`hid`,`open`,[n]),close:()=>e.call(`hid`,`close`,[n]),sendReport:(t,r)=>e.call(`hid`,`sendReport`,[n,t,vc(r)]),sendFeatureReport:(t,r)=>e.call(`hid`,`sendFeatureReport`,[n,t,vc(r)]),receiveFeatureReport:async t=>yc((await e.call(`hid`,`receiveFeatureReport`,[n,t])).bytes),addEventListener(e,t){if(e===`inputreport`)r.add(t),c();else if(e===`disconnect`)i.add(t);else throw TypeError(`hid device: unknown event type '${String(e)}'`)},removeEventListener(e,t){e===`inputreport`?(r.delete(t),l()):e===`disconnect`&&i.delete(t)},onInputReport(e){r.add(e),c()}}}function Sc(e){return{list:async()=>(await e.call(`hid`,`list`,[])).map(t=>xc(e,t)),request:async t=>{let n=(await e.call(`hid`,`request`,[bc(t)]))[0];if(!n)throw Error(`No device selected.`);return xc(e,n)}}}function Cc(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var wc=class{rpc;targetId;selector;index;constructor(e,t,n,r){this.rpc=e,this.targetId=t,this.selector=n,this.index=r}evalOnElement(e){let t=`(() => { const els = document.querySelectorAll(${JSON.stringify(this.selector)}); const el = els[${this.index}]; ${e} })()`;return this.rpc.call(`browser`,`evalAsync`,[this.targetId,t])}async textContent(){return this.evalOnElement(`return el ? el.textContent : null;`)}async getAttribute(e){return this.evalOnElement(`return el ? el.getAttribute(${JSON.stringify(e)}) : null;`)}async isVisible(){return this.evalOnElement(`if (!el) return false; const s = getComputedStyle(el); if (s.display === 'none' || s.visibility === 'hidden' || s.opacity === '0') return false; const r = el.getBoundingClientRect(); return r.width > 0 && r.height > 0;`)}async boundingBox(){return this.evalOnElement(`if (!el) return null; const r = el.getBoundingClientRect(); return { x: r.x, y: r.y, width: r.width, height: r.height };`)}},Tc=class{rpc;targetId;onClose;closed=!1;constructor(e,t,n){this.rpc=e,this.targetId=t,this.onClose=n}async goto(e,t){await this.rpc.call(`browser`,`navigateTab`,[this.targetId,e])}async waitForLoadState(e){await this.rpc.call(`browser`,`waitForLoadState`,[this.targetId,e??`load`])}async waitForTimeout(e){await new Promise(t=>setTimeout(t,e))}async evaluate(e,...t){let n=typeof e==`string`?e:`(${e.toString()}).apply(null, JSON.parse(${JSON.stringify(JSON.stringify(t))}))`;return this.rpc.call(`browser`,`evalAsync`,[this.targetId,n])}async screenshot(e){let t={};e?.fullPage!==void 0&&(t.fullPage=e.fullPage);let n=Cc(await this.rpc.call(`browser`,`screenshotTab`,[this.targetId,t]));return e?.path&&await this.rpc.call(`vfs`,`writeFileBinary`,[e.path,n]),n}async $(e){return await this.rpc.call(`browser`,`evalAsync`,[this.targetId,`!!document.querySelector(${JSON.stringify(e)})`])?new wc(this.rpc,this.targetId,e,0):null}async $$(e){let t=await this.rpc.call(`browser`,`evalAsync`,[this.targetId,`document.querySelectorAll(${JSON.stringify(e)}).length`]),n=[];for(let r=0;r<t;r++)n.push(new wc(this.rpc,this.targetId,e,r));return n}async $$eval(e,t,...n){if(typeof t==`string`)return this.rpc.call(`browser`,`evalAsync`,[this.targetId,t]);let r=`(${t.toString()}).apply(null, [Array.from(document.querySelectorAll(${JSON.stringify(e)}))].concat(JSON.parse(${JSON.stringify(JSON.stringify(n))})))`;return this.rpc.call(`browser`,`evalAsync`,[this.targetId,r])}async content(){return this.rpc.call(`browser`,`evalAsync`,[this.targetId,`document.documentElement.outerHTML`])}async setViewportSize(e){await this.rpc.call(`browser`,`setViewport`,[this.targetId,e.width,e.height])}async close(){this.closed||(this.closed=!0,await this.rpc.call(`browser`,`closeTab`,[this.targetId]),this.onClose?.())}},Ec=class{rpc;openPages=[];constructor(e){this.rpc=e}async newPage(e){let t=await this.rpc.call(`browser`,`createTab`,[`about:blank`]);e?.viewport&&await this.rpc.call(`browser`,`setViewport`,[t,e.viewport.width,e.viewport.height]);let n=new Tc(this.rpc,t,()=>{let e=this.openPages.indexOf(n);e!==-1&&this.openPages.splice(e,1)});return this.openPages.push(n),n}pages(){return[...this.openPages]}async close(){let e=this.openPages.splice(0,this.openPages.length);for(let t of e)await t.close()}},Dc=class{rpc;openPages=[];openContexts=[];constructor(e){this.rpc=e}async newPage(e){let t=await this.rpc.call(`browser`,`createTab`,[`about:blank`]);e?.viewport&&await this.rpc.call(`browser`,`setViewport`,[t,e.viewport.width,e.viewport.height]);let n=new Tc(this.rpc,t,()=>{let e=this.openPages.indexOf(n);e!==-1&&this.openPages.splice(e,1)});return this.openPages.push(n),n}async newContext(e){let t=new Ec(this.rpc);return this.openContexts.push(t),t}contexts(){return[...this.openContexts]}async close(){let e=this.openPages.splice(0,this.openPages.length);for(let t of e)await t.close();let t=this.openContexts.splice(0,this.openContexts.length);for(let e of t)await e.close()}};function Oc(e){let t=async t=>new Dc(e),n=async(t,n)=>new Dc(e);return{chromium:{launch:t,connect:n,connectOverCDP:n},firefox:{launch:t,connect:n},webkit:{launch:t,connect:n}}}function kc(e){return{...e,time:Go,fmt:ot,pool:Vo}}function Ac(e,t){return e?.startsWith(`/`)?Ko(e):t}function jc(e){return e.includes(`require`)||e.includes(`import`)||/(?:^|[;\n}])\s*export\b/.test(e)}async function Mc(e,t,n,r){return jc(t)?e.call(`module`,`buildGraph`,[t,Ac(r,n),r]):{files:[],entryMap:{},edges:{},edgeErrors:{},errors:{}}}function Nc(e){if(typeof e!=`object`||!e)return;let t=e;if(t.__esModule&&!Object.prototype.hasOwnProperty.call(t,`default`)&&Object.isExtensible(t))try{Object.defineProperty(t,"default",{value:t,enumerable:!1,configurable:!0})}catch{}}function Pc(e){return{playwright:Oc(e)}}function Fc(e){let{graph:t,fsBridge:n,processShim:r,childProcess:i,nodeConsole:a,sliccyModules:o,shimmedPackages:l={},nodeReadline:u,nodeOsModule:d=Zn,nodeUtilModule:p=Xt}=e,h=new Map(t.files.map(e=>[e.path,e.cjsSource])),g=new Map(t.files.map(e=>[e.path,e.kind])),_=new Map,v=Kn({requireFrom:(e,t)=>T(e,t),resolveFrom:(e,t)=>w(e,t)}),y=In(()=>{let e=r?.cwd?.();return typeof e==`string`&&e.length>0?e:`/`}),b=e=>{if(typeof e==`string`&&e.startsWith(`sliccy:`))return{hit:!0,value:Rc(e,o)};let t=e.startsWith(`node:`)?e.slice(5):e,a=Ic(t,{fsBridge:n,processShim:r,childProcess:i,nodeOsModule:d,nodeUtilModule:p,nodePathModule:y,nodeReadline:u,nodeModule:v});if(a.hit)return a;if(m.has(t))throw f(e,t);if(c.has(t))throw Bc(e,t);return t in l?{hit:!0,value:l[t]}:{hit:!1}},x=(e,n,r)=>{let i=b(n);if(i.hit)return i.value;let a=e?.[n];if(a)return S(a);let o=r===null?t.errors[n]:t.edgeErrors?.[r]?.[n];throw o?Error(o):Lc(n)};function S(e){let n=_.get(e);if(n)return n.exports;let i=h.get(e);if(i===void 0)throw Error(`Cannot find module '${e}'`);let o={exports:{}};_.set(e,o);let s=n=>x(t.edges[e],n,e),c=[`module`,`exports`,`require`,`process`,`console`,`Buffer`,`global`],l=[o,o.exports,s,r,a,globalThis.Buffer,globalThis];return g.get(e)!==`esm`&&(c.push(`__dirname`,`__filename`),l.push(Ko(e),e)),Function(...c,i)(...l),g.get(e)===`cjs`&&Nc(o.exports),o.exports}function C(e){return h.has(e)}function w(e,n){if(s(n))return n;let r=t.edges[e]?.[n];if(r)return r;let i=Ko(e);if(Gn(n)){let e=Un(i,n,C);if(e)return e}else{let e=Wn(i,n,C);if(e)return e}let a=t.edgeErrors?.[e]?.[n];throw a?Error(a):Lc(n)}function T(e,t){let n=b(t);return n.hit?n.value:S(w(e,t))}return{require:e=>x(t.entryMap,e,null)}}function Ic(e,t){let{fsBridge:n,processShim:r,childProcess:i,nodeOsModule:a,nodeUtilModule:o,nodePathModule:s,nodeReadline:c,nodeModule:l}=t;return e===`fs`||e===`fs/promises`?{hit:!0,value:n}:e===`path`?{hit:!0,value:s}:e===`crypto`?{hit:!0,value:wn}:e===`child_process`?{hit:!0,value:i}:e===`process`?{hit:!0,value:r}:e===`buffer`?{hit:!0,value:{Buffer:globalThis.Buffer}}:e===`assert`?{hit:!0,value:gt}:e===`assert/strict`?{hit:!0,value:ht}:e===`util`?{hit:!0,value:o}:e===`events`?{hit:!0,value:Je}:e===`os`?{hit:!0,value:a}:e===`tty`?{hit:!0,value:Qn}:e===`stream`?{hit:!0,value:St}:e===`url`?{hit:!0,value:T}:e===`zlib`?{hit:!0,value:Ro}:e===`vm`?{hit:!0,value:vr}:e===`readline`&&c?{hit:!0,value:c}:e===`readline/promises`&&c?{hit:!0,value:c.promises}:e===`module`&&l?{hit:!0,value:l}:{hit:!1}}function Lc(e){if(e.startsWith(`.`)||e.startsWith(`/`)||e.startsWith(`node:`))return Error(`Cannot find module '${e}'`);let t=e.startsWith(`@`)?e.split(`/`).slice(0,2).join(`/`):e.split(`/`)[0];return Error(`Cannot find module '${e}' (run: ipk install ${t})`)}function Rc(e,t){let n=e.slice(7);if(n===``)throw Error(`require('sliccy:'): empty sliccy: module name`);if(!Object.prototype.hasOwnProperty.call(t,n))throw Error(`require('${e}'): unknown sliccy: module '${n}'. Known names: ${Object.keys(t).sort().join(`, `)}`);return t[n]}const zc={http:` Use fetch() instead.`,https:` Use fetch() instead.`,crypto:` Use globalThis.crypto (Web Crypto API) instead.`};function Bc(e,t){return Error(`require('${e}'): Node built-in '${t}' is not available in the browser environment.${zc[t]||``}`)}async function Vc(e,t,n,r){let i=Object.keys(t),a=i.map(e=>t[e]),o=Object.getPrototypeOf(async function(){}).constructor,s=new o(...i,`${r?`"use strict";
|
|
32
32
|
`:``}${e}`);try{return await s(...a),0}catch(e){return e instanceof Q?e.code:(n(`${e instanceof Error?e.stack??e.message:String(e)}\n`),1)}}function Hc(e,t){let n=t.handle;return{...t,open:t=>e.call(`serial`,`open`,[n,t]),close:()=>e.call(`serial`,`close`,[n]),read:(t={})=>e.call(`serial`,`read`,[n,{maxBytes:t.maxBytes??t.bytes,until:t.until?vc(t.until):void 0,timeoutMs:t.timeoutMs}]),write:t=>e.call(`serial`,`write`,[n,vc(t)]),getSignals:()=>e.call(`serial`,`getSignals`,[n]),setSignals:t=>e.call(`serial`,`setSignals`,[n,t])}}function Uc(e){return{list:async()=>(await e.call(`serial`,`list`,[])).map(t=>Hc(e,t)),request:async t=>Hc(e,await e.call(`serial`,`request`,[bc(t)]))}}function Wc(e=globalThis,t){let n=e.setTimeout,r=e.clearTimeout,i=e.setInterval,a=e.clearInterval,o=n.bind(e),s=r.bind(e),c=i.bind(e),l=a.bind(e),u=new Set,d=new Set,f=new Set,p=!1,m=()=>{if(f.size===0)return;let e=[...f];f.clear();for(let t of e)t()},h=e=>{if(e==null)return!1;let t=u.delete(e),n=d.delete(e);return t||n},g=(e,n)=>{try{e(...n)}catch(e){if(t?.onCallbackError?.(e),!t?.onCallbackError)throw e}finally{m()}};return{get pendingCount(){return u.size+d.size},install(){p||(p=!0,e.setTimeout=((e,t,...n)=>{if(typeof e!=`function`)return o(e,t,...n);let r=o(()=>{u.delete(r),g(e,n)},t);return u.add(r),r}),e.clearTimeout=(e=>{let t=h(e);s(e),t&&m()}),e.setInterval=((e,t,...n)=>{if(typeof e!=`function`)return c(e,t,...n);let r=c(()=>{g(e,n)},t);return d.add(r),r}),e.clearInterval=(e=>{let t=h(e);l(e),t&&m()}))},restore(){p&&(p=!1,e.setTimeout=n,e.clearTimeout=r,e.setInterval=i,e.clearInterval=a)},clearPending(){for(let e of u)s(e);u.clear();for(let e of d)l(e);d.clear(),m()},tick(){return new Promise(e=>{o(e,0)})},waitForProgress(){return u.size+d.size===0?Promise.resolve():new Promise(e=>{f.add(e)})}}}function Gc(e,t){let n=t.handle,r=e=>({status:e.status,data:yc(e.bytes)}),i=new Set,a=new Set,o=!1,s=null,c=e=>{let t=e;if(!t||t.handle!==n)return;let r=t.type===`disconnect`?i:a;for(let e of[...r])try{e(t)}catch{}},l=()=>{o||(o=!0,s=e.onEvent?e.onEvent(`usb-claim-event`,c):null,e.call(`usb`,`subscribeClaimEvents`,[n]).catch(()=>{o=!1,s?.(),s=null}))},u=()=>{!o||i.size>0||a.size>0||(o=!1,s?.(),s=null,e.call(`usb`,`unsubscribeClaimEvents`,[n]).catch(()=>{}))};return{...t,open:()=>e.call(`usb`,`open`,[n]),close:t=>e.call(`usb`,`close`,t?.force?[n,{force:!0}]:[n]),reset:t=>e.call(`usb`,`reset`,t?.force?[n,{force:!0}]:[n]),clearHalt:(t,r)=>e.call(`usb`,`clearHalt`,[n,t,r]),selectConfiguration:t=>e.call(`usb`,`selectConfig`,[n,t]),claimInterface:(t,r)=>e.call(`usb`,`claim`,r?.wait?[n,t,{wait:!0}]:[n,t]),releaseInterface:t=>e.call(`usb`,`release`,[n,t]),controlTransferIn:async(t,i)=>r(await e.call(`usb`,`controlIn`,[n,t,i])),controlTransferOut:(t,r)=>e.call(`usb`,`controlOut`,[n,t,vc(r)]),transferIn:async(t,i)=>r(await e.call(`usb`,`transferIn`,[n,t,i])),transferOut:(t,r)=>e.call(`usb`,`transferOut`,[n,t,vc(r)]),addEventListener(e,t){if(e===`disconnect`)i.add(t);else if(e===`claim-lost`)a.add(t);else throw TypeError(`usb device: unknown event type '${String(e)}'`);l()},removeEventListener(e,t){e===`disconnect`?i.delete(t):e===`claim-lost`&&a.delete(t),u()}}}function Kc(e){return{list:async()=>(await e.call(`usb`,`list`,[])).map(t=>Gc(e,t)),request:async t=>Gc(e,await e.call(`usb`,`request`,[bc(t)]))}}function qc(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t<0?``:t===0?`/`:e.substring(0,t)}function Jc(e){if(!e)return e;let t=e.startsWith(`/`),n=e.split(`/`).filter(e=>e.length>0),r=n.indexOf(`scripts`);if(r<0)return e;let i=n.slice(0,r);return i.length===0?t?`/`:``:(t?`/`:``)+i.join(`/`)}function Yc(e){return/^[A-Za-z0-9_\-./:@]+$/.test(e)?e:`'`+e.replace(/'/g,`'\\''`)+`'`}function Xc(e,t){return e===``?t:e===`/`?`/${t}`:`${e}/${t}`}function Zc(e){let t=qc(e.argv[1]??``),n=Jc(t),r=Xc(n,`references`),i=Xc(n,`assets`),a=Xc(t,`.config`);async function o(){let t;try{t=await e.fs.exists(a)}catch{return null}if(!t)return null;let n;try{n=await e.fs.readFile(a)}catch{return null}let r=typeof n==`string`?n:String(n);if(!r.trim())return null;let i;try{i=JSON.parse(r)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`skill.config(): failed to parse ${a}: ${t}`)}if(i&&typeof i==`object`&&!Array.isArray(i))return i;throw Error(`skill.config(): ${a} must contain a JSON object`)}async function s(t){let n=await o();if(t===void 0)return n;if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`skill.config(updates): updates must be a plain object`);let r={...n??{},...t};return await e.fs.writeFile(a,JSON.stringify(r,null,2)+`
|
|
33
|
-
`),r}async function c(t){if(typeof t!=`string`||!t.trim())throw TypeError(`skill.token(providerId): providerId must be a non-empty string`);let n=`oauth-token ${Yc(t)}`,{stdout:r,stderr:i,exitCode:a}=await e.exec(n);if(a!==0){let e=i.trim()||`oauth-token exited with code ${a}`;throw Error(`skill.token('${t}'): ${e}`)}return r.replace(/\r?\n+$/,``)}return Object.freeze({dir:t,root:n,refs:r,assets:i,config:s,token:c})}const Qc=65536;function $c(e,t){if(!t)return e;let n=e+t;return n.length<=Qc?n:n.slice(n.length-Qc)}async function el(e,t,n,r){let i;try{i=await e.call(`vfs`,`snapshot`,r?[t,r]:[t])}catch(e){n?.(e instanceof Error?e.message:String(e)),i={entries:[]}}return new _e(i)}function tl(e,t){if(e.syncFsToken)return e=>t(`[sync-fs] snapshot failed, sync metadata will be incomplete: ${e}\n`)}function nl(e,t,n,r){globalThis.__slicc_mountVfs=async(i,a)=>{let{mountVfsIntoEmscripten:o}=await import(`./emscripten-vfs-hook-BJh0QvlC.js`);return o(i,{bridge:e,syncFs:t,cwd:n,warn:e=>r.writeStderr(`slicc: ${e}\n`)},a)}}function rl(e,t,n,r,i){let a=b(e,t),o=v(e,a);if(Object.assign(r,Ke(n,e.cwd,o,i,{write:(e,n)=>{t.postMessage({type:`realm-fs-write`,path:e,bytes:n})},delete:e=>{t.postMessage({type:`realm-fs-delete`,path:e})}})),o&&nl(o,n,e.cwd,i),e.syncFsToken)return g(e.syncFsToken,{syncFs:n,...o?{fsBridge:o}:{},...a?{transport:_(a),noDefaultDeadline:!0}:{}})}function il(e=globalThis){Object.prototype.hasOwnProperty.call(e,`SLICC_VERSION`)||Object.defineProperty(e,"SLICC_VERSION",{value:i().version,writable:!1,enumerable:!1,configurable:!1})}function al(e,t,n){let r=Xe({isTTY:!e,noColor:e});return{colorApi:r,cliApi:Ye({writeStdout:t,writeStderr:n,exit:e=>{throw new Q(e)},color:r})}}function ol(e,t,n){return{readStdinBytes:()=>ye(e.stdin??``),writeStdout:t,writeStderr:n}}function sl(e){return{usbBridge:Kc(e),serialBridge:Uc(e),hidBridge:Sc(e),computerBridge:rc(e)}}async function cl(e,t){let n=e.captureOutput!==!1,r={stdout:``,stderr:``},i=(e,i)=>{let a=typeof i==`string`?i:String(i);e===`stdout`?r.stdout=n?r.stdout+a:$c(r.stdout,a):r.stderr=n?r.stderr+a:$c(r.stderr,a),t.postMessage({type:`realm-output`,stream:e,chunk:a})},a=e=>{i(`stdout`,e)},o=e=>{i(`stderr`,e)},s=ps(a,o),c=gs(e,a,o),{colorApi:l,cliApi:u}=al(!!e.env?.NO_COLOR,a,o),f=new d(t),p=ol(e,a,o),m=je(f,D,p),h=await el(f,e.cwd,tl(e,o),x(e)?{timeBudgetMs:150}:void 0),g=rl(e,t,h,m,p),_=lc(f,h,e.cwd,o),v=Ys(_,{cwd:e.cwd}),y=Zc({argv:e.argv,fs:m,exec:_}),b=$s(f),{usbBridge:S,serialBridge:C,hidBridge:w,computerBridge:T}=sl(f),E=Ks({fetch:D});async function D(e,t){let n=e instanceof Request?e.url:e instanceof URL?e.toString():String(e);return fc(await f.call(`fetch`,`request`,[n,await Zs(t,e)]),n)}let O=kc({exec:_,agent:v,skill:y,http:E,browser:b,usb:S,serial:C,hid:w,computer:T,cli:u,color:l}),ee=e.filename,te=Ko(ee),k=await Mc(f,e.code,e.cwd,ee),ne=Fc({graph:k,fsBridge:m,processShim:c.processShim,childProcess:ln(_,g),nodeConsole:s,sliccyModules:O,shimmedPackages:Pc(f),nodeReadline:ws({output:{write:a},onExit:c.recordExit}),nodeOsModule:Xn(e.env),nodeUtilModule:Yt(e=>o(`${e}\n`),()=>c.processShim.argv.slice(2))}).require,re={exports:{},filename:e.filename},ie=k.entrySource!==void 0;await ll({entryCode:k.entrySource??e.code,isEsmEntry:ie,entryIsModule:k.entryIsModule===!0,filename:ee,dirname:te,proc:c,nodeConsole:s,requireShim:ne,moduleShim:re,realmFetch:D,writeStderr:o,rpc:f,syncFs:h,output:r,port:t})}async function ll(e){let t=globalThis;il(),t.__slicc_compileWasm=t=>e.rpc.call(`wasm`,`compile`,[t]);let n=Wc(globalThis,{onCallbackError(e){if(!(e instanceof Q))throw e}}),{createBodyReadHandleTracker:r}=await import(`./realm-body-handles-BeoKKjy1.js`),i=r(globalThis);n.install(),i.install();let a=ms(globalThis,e.proc.processShim),{watchUnhandledRejections:o}=await import(`./realm-unhandled-rejections-
|
|
33
|
+
`),r}async function c(t){if(typeof t!=`string`||!t.trim())throw TypeError(`skill.token(providerId): providerId must be a non-empty string`);let n=`oauth-token ${Yc(t)}`,{stdout:r,stderr:i,exitCode:a}=await e.exec(n);if(a!==0){let e=i.trim()||`oauth-token exited with code ${a}`;throw Error(`skill.token('${t}'): ${e}`)}return r.replace(/\r?\n+$/,``)}return Object.freeze({dir:t,root:n,refs:r,assets:i,config:s,token:c})}const Qc=65536;function $c(e,t){if(!t)return e;let n=e+t;return n.length<=Qc?n:n.slice(n.length-Qc)}async function el(e,t,n,r){let i;try{i=await e.call(`vfs`,`snapshot`,r?[t,r]:[t])}catch(e){n?.(e instanceof Error?e.message:String(e)),i={entries:[]}}return new _e(i)}function tl(e,t){if(e.syncFsToken)return e=>t(`[sync-fs] snapshot failed, sync metadata will be incomplete: ${e}\n`)}function nl(e,t,n,r){globalThis.__slicc_mountVfs=async(i,a)=>{let{mountVfsIntoEmscripten:o}=await import(`./emscripten-vfs-hook-BJh0QvlC.js`);return o(i,{bridge:e,syncFs:t,cwd:n,warn:e=>r.writeStderr(`slicc: ${e}\n`)},a)}}function rl(e,t,n,r,i){let a=b(e,t),o=v(e,a);if(Object.assign(r,Ke(n,e.cwd,o,i,{write:(e,n)=>{t.postMessage({type:`realm-fs-write`,path:e,bytes:n})},delete:e=>{t.postMessage({type:`realm-fs-delete`,path:e})}})),o&&nl(o,n,e.cwd,i),e.syncFsToken)return g(e.syncFsToken,{syncFs:n,...o?{fsBridge:o}:{},...a?{transport:_(a),noDefaultDeadline:!0}:{}})}function il(e=globalThis){Object.prototype.hasOwnProperty.call(e,`SLICC_VERSION`)||Object.defineProperty(e,"SLICC_VERSION",{value:i().version,writable:!1,enumerable:!1,configurable:!1})}function al(e,t,n){let r=Xe({isTTY:!e,noColor:e});return{colorApi:r,cliApi:Ye({writeStdout:t,writeStderr:n,exit:e=>{throw new Q(e)},color:r})}}function ol(e,t,n){return{readStdinBytes:()=>ye(e.stdin??``),writeStdout:t,writeStderr:n}}function sl(e){return{usbBridge:Kc(e),serialBridge:Uc(e),hidBridge:Sc(e),computerBridge:rc(e)}}async function cl(e,t){let n=e.captureOutput!==!1,r={stdout:``,stderr:``},i=(e,i)=>{let a=typeof i==`string`?i:String(i);e===`stdout`?r.stdout=n?r.stdout+a:$c(r.stdout,a):r.stderr=n?r.stderr+a:$c(r.stderr,a),t.postMessage({type:`realm-output`,stream:e,chunk:a})},a=e=>{i(`stdout`,e)},o=e=>{i(`stderr`,e)},s=ps(a,o),c=gs(e,a,o),{colorApi:l,cliApi:u}=al(!!e.env?.NO_COLOR,a,o),f=new d(t),p=ol(e,a,o),m=je(f,D,p),h=await el(f,e.cwd,tl(e,o),x(e)?{timeBudgetMs:150}:void 0),g=rl(e,t,h,m,p),_=lc(f,h,e.cwd,o),v=Ys(_,{cwd:e.cwd}),y=Zc({argv:e.argv,fs:m,exec:_}),b=$s(f),{usbBridge:S,serialBridge:C,hidBridge:w,computerBridge:T}=sl(f),E=Ks({fetch:D});async function D(e,t){let n=e instanceof Request?e.url:e instanceof URL?e.toString():String(e);return fc(await f.call(`fetch`,`request`,[n,await Zs(t,e)]),n)}let O=kc({exec:_,agent:v,skill:y,http:E,browser:b,usb:S,serial:C,hid:w,computer:T,cli:u,color:l}),ee=e.filename,te=Ko(ee),k=await Mc(f,e.code,e.cwd,ee),ne=Fc({graph:k,fsBridge:m,processShim:c.processShim,childProcess:ln(_,g),nodeConsole:s,sliccyModules:O,shimmedPackages:Pc(f),nodeReadline:ws({output:{write:a},onExit:c.recordExit}),nodeOsModule:Xn(e.env),nodeUtilModule:Yt(e=>o(`${e}\n`),()=>c.processShim.argv.slice(2))}).require,re={exports:{},filename:e.filename},ie=k.entrySource!==void 0;await ll({entryCode:k.entrySource??e.code,isEsmEntry:ie,entryIsModule:k.entryIsModule===!0,filename:ee,dirname:te,proc:c,nodeConsole:s,requireShim:ne,moduleShim:re,realmFetch:D,writeStderr:o,rpc:f,syncFs:h,output:r,port:t})}async function ll(e){let t=globalThis;il(),t.__slicc_compileWasm=t=>e.rpc.call(`wasm`,`compile`,[t]);let n=Wc(globalThis,{onCallbackError(e){if(!(e instanceof Q))throw e}}),{createBodyReadHandleTracker:r}=await import(`./realm-body-handles-BeoKKjy1.js`),i=r(globalThis);n.install(),i.install();let a=ms(globalThis,e.proc.processShim),{watchUnhandledRejections:o}=await import(`./realm-unhandled-rejections-BAiAaesU.js`),s=o(globalThis,{writeStderr:e.writeStderr,didExit:e.proc.getDidCallProcessExit,recordExit:e.proc.recordExit});try{let r=await ul({entryCode:e.entryCode,bridges:{process:e.proc.processShim,console:e.nodeConsole,require:e.requireShim,module:e.moduleShim,exports:e.moduleShim.exports,fetch:e.realmFetch,...e.entryIsModule?{}:{__dirname:e.dirname,__filename:e.filename}},writeStderr:e.writeStderr,isEsmEntry:e.isEsmEntry,rpc:e.rpc,syncFs:e.syncFs,proc:e.proc,timers:n,bodyReads:i,fatal:s.fatal});delete t.__slicc_compileWasm,delete t.__slicc_mountVfs,e.rpc.dispose(),e.port.postMessage({type:`realm-done`,stdout:e.output.stdout,stderr:e.output.stderr,exitCode:r})}finally{s.dispose(),n.clearPending(),n.restore(),i.restore(),a()}}async function ul(e){let t=await Vc(e.entryCode,e.bridges,e.writeStderr,e.isEsmEntry);return await dl(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()?(e.timers.clearPending(),e.proc.getExitCode()):(await fl(e.rpc,e.timers,e.bodyReads,e.proc,e.fatal),e.proc.getDidCallProcessExit()&&e.timers.clearPending(),await dl(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()||t===0?e.proc.getExitCode():t)}async function dl(e,t,n){let r=t.getMutations();if(r.created.length||r.modified.length||r.deleted.length)try{await e.call(`vfs`,`flushWrites`,[r]),t.resetBaseline()}catch(e){let t=e instanceof Error?e.message:String(e);n(`[sync-fs] ERROR: flush failed — ${r.created.length+r.modified.length} write(s) + ${r.deleted.length} delete(s) were NOT persisted: ${t}\n`)}}async function fl(e,t,n,r,i){await t.tick();let a=0;for(;!r.getDidCallProcessExit()&&a<2;){let o=[];if(e.pendingCount>0&&o.push(e.waitForProgress()),t.pendingCount>0&&o.push(t.waitForProgress()),n.pendingCount>0&&o.push(n.waitForProgress()),o.length===0){a+=1,await t.tick();continue}a=0,o.push(i),await Promise.race(o),r.getDidCallProcessExit()||await t.tick()}}function pl(){let e=new Set,t=new Set;return{realmSide:{postMessage:e=>{queueMicrotask(()=>{for(let n of[...t])n({data:e})})},addEventListener:(t,n)=>{e.add(n)},removeEventListener:(t,n)=>{e.delete(n)}},hostSide:{postMessage:t=>{queueMicrotask(()=>{for(let n of[...e])n({data:t})})},addEventListener:(e,n)=>{t.add(n)},removeEventListener:(e,n)=>{t.delete(n)}}}}function ml(){return async({kind:e})=>{if(e!==`js`)throw Error(`createInProcessJsRealmFactory: only kind:js is supported`);let{realmSide:t,hostSide:n}=pl(),r=e=>{if(e.data?.type!==`realm-init`)return;t.removeEventListener(`message`,r);let n=e.data;n.kind===`js`&&cl(n,t).catch(e=>{let n={type:`realm-error`,message:e instanceof Error?e.message:String(e)};t.postMessage(n)})};return t.addEventListener(`message`,r),{controlPort:n,terminate(){t.removeEventListener(`message`,r)}}}}function hl(){return async({kind:e})=>{if(e!==`py`)throw Error(`createInProcessPyRealmFactory: only kind:py is supported`);let{realmSide:t,hostSide:n}=pl(),r=e=>{if(e.data?.type!==`realm-init`)return;t.removeEventListener(`message`,r);let n=e.data;n.kind===`py`&&p(n,t).catch(e=>{let n={type:`realm-error`,message:e instanceof Error?e.message:String(e)};t.postMessage(n)})};return t.addEventListener(`message`,r),{controlPort:n,terminate(){t.removeEventListener(`message`,r)}}}}export{ml as createInProcessJsRealmFactory,hl as createInProcessPyRealmFactory,Q as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./realm-inprocess-
|
|
1
|
+
import{t as e}from"./realm-inprocess-s4ChFcqp.js";function t(e){return e instanceof Error?`${e.stack??`${e.name}: ${e.message}`}\n`:`Uncaught ${typeof e==`string`?`'${e}'`:String(e)}\n`}function n(n,r){let i=()=>void 0,a=new Promise(e=>{i=e});if(typeof n.addEventListener!=`function`)return{fatal:a,dispose:()=>void 0};let o=n=>{let a=n.reason;n.preventDefault(),!(a instanceof e||r.didExit())&&(r.writeStderr(t(a)),r.recordExit(1),i())};return n.addEventListener(`unhandledrejection`,o),{fatal:a,dispose:()=>n.removeEventListener?.(`unhandledrejection`,o)}}export{n as watchUnhandledRejections};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./js-realm-worker-
|
|
1
|
+
import{t as e}from"./js-realm-worker-DluaIwWT.js";function t(e){return e instanceof Error?`${e.stack??`${e.name}: ${e.message}`}\n`:`Uncaught ${typeof e==`string`?`'${e}'`:String(e)}\n`}function n(n,r){let i=()=>void 0,a=new Promise(e=>{i=e});if(typeof n.addEventListener!=`function`)return{fatal:a,dispose:()=>void 0};let o=n=>{let a=n.reason;n.preventDefault(),!(a instanceof e||r.didExit())&&(r.writeStderr(t(a)),r.recordExit(1),i())};return n.addEventListener(`unhandledrejection`,o),{fatal:a,dispose:()=>n.removeEventListener?.(`unhandledrejection`,o)}}export{n as watchUnhandledRejections};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./api-endpoint-DuEQRZ4g.js";import{h as t}from"./main-
|
|
1
|
+
import{o as e}from"./api-endpoint-DuEQRZ4g.js";import{h as t}from"./main-CxkrqswY.js";async function n(){try{let e=await navigator.serviceWorker?.getRegistrations?.();e&&await Promise.all(e.map(e=>e.unregister().catch(()=>!1)))}catch{}try{let e=await indexedDB.databases();await Promise.all(e.filter(e=>!!e.name).map(e=>new Promise(t=>{let n=indexedDB.deleteDatabase(e.name);n.onsuccess=()=>t(),n.onerror=()=>t(),n.onblocked=()=>t()})))}catch{}try{let e=navigator.storage;if(typeof e?.getDirectory==`function`){let t=await e.getDirectory(),n=[];for await(let e of t.keys())n.push(e);await Promise.all(n.map(e=>t.removeEntry(e,{recursive:!0}).catch(()=>{})))}}catch{}}function r(r,i,a={}){if(r.dataset.recoveryBusy===`1`)return;let o=a.wipe??n,s=a.reload??(()=>location.reload()),c=i instanceof Error?i.message:String(i),l=a.verdict===`browser-wedged`,u=e(i),d=l||u,f=document.createElement(`div`);f.style.cssText=`padding:2rem;text-align:center;font-family:system-ui;`;let p=document.createElement(`h1`);p.style.color=`var(--s2-negative, #e34850)`,p.textContent=l?`Your browser needs a restart`:`Failed to start`;let m=document.createElement(`p`);m.style.color=`var(--s2-content-tertiary, #717171)`,m.textContent=c;let h=document.createElement(`div`);h.style.cssText=`display:flex;gap:0.75rem;justify-content:center;flex-wrap:wrap;margin-top:1.5rem;`;let g=document.createElement(`button`);g.type=`button`,g.textContent=`Reset local data & reload`,g.dataset.variant=d?`demoted`:`destructive`,g.style.cssText=d?`padding:0.5rem 1rem;cursor:pointer;border:1px solid var(--s2-content-tertiary, #717171);background:transparent;color:inherit;border-radius:4px;`:`padding:0.5rem 1rem;cursor:pointer;border:1px solid var(--s2-negative, #e34850);background:var(--s2-negative, #e34850);color:#fff;border-radius:4px;`;let _=document.createElement(`button`);if(_.type=`button`,_.textContent=`Reload`,_.style.cssText=l?`padding:0.5rem 1rem;cursor:pointer;border:1px solid var(--s2-accent, #0265dc);background:var(--s2-accent, #0265dc);color:#fff;border-radius:4px;`:`padding:0.5rem 1rem;cursor:pointer;border:1px solid var(--s2-content-tertiary, #717171);background:transparent;color:inherit;border-radius:4px;`,g.addEventListener(`click`,()=>{g.disabled=!0,_.disabled=!0,g.textContent=`Resetting…`,r.dataset.recoveryBusy=`1`,(async()=>{try{await o()}catch{}for(let e of t)try{localStorage.removeItem(e)}catch{}s()})()}),_.addEventListener(`click`,()=>{s()}),l){let e=document.createElement(`p`);e.style.cssText=`max-width:34rem;margin:1rem auto 0;`,e.textContent=`This browser has stopped starting web workers — a browser process issue, not a problem with your data. Quit the browser completely, reopen it, and come back. Your local data is intact; resetting it will not fix this.`,f.append(p,m,e),h.append(_,g)}else f.append(p,m),h.append(g,_);for(f.append(h);r.firstChild;)r.removeChild(r.firstChild);r.appendChild(f)}export{r as renderBootRecoveryScreen};
|
package/dist/ui/assets/{remote-terminal-view-BQ8uaUim.js → remote-terminal-view-WWBk5qFn.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wc-shell-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wc-shell-BzYq0ESt.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/preload-helper-Czpn1I53.js","assets/logger-DDBAeTLF.js","assets/mime-types-D0xZwlMO.js","assets/base64-ELzoYfwP.js","assets/bridge-protocol-C52CnDIj.js","assets/account-store-B857f9Kw.js","assets/core-4boN-CgI.js","assets/compat-BAGLwgqY.js","assets/models-Xc0Gclrk.js","assets/diagnostics-Cag7MsZI.js","assets/env-api-keys-BXRkymgV.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/openrouter.models-DHpsqCCC.js","assets/libesm-BypnjKEL.js","assets/feature-flags-DvsApnS-.js","assets/proxied-fetch-Cplb-Tee.js","assets/proxy-error-BSFYY7jj.js","assets/api-endpoint-DuEQRZ4g.js","assets/runtime-env-Dlaokqg1.js","assets/secret-topology-Dm_PZRZx.js","assets/float-topology-C9GjBEv-.js","assets/secrets-bridge-client-CWv2_nw7.js","assets/port-bridge-client-D_erEovW.js","assets/image-markers-q8JQTtid.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-jygoVQBo.js","assets/panel-rpc-D3EPRnmw.js","assets/bedrock-camp-compat-B1oHsbyo.js","assets/bedrock-camp-extra-models-BYrxX19D.js","assets/claude-model-version-DZmbk9E2.js","assets/telemetry-B0sKnLBU.js","assets/types-D8gIX-W-.js","assets/same-file-identity-DuEcSmPX.js","assets/icons-2DY2vYOc.js","assets/wc-shell-WkeczD9x.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{t as e}from"./preload-helper-Czpn1I53.js";import"./tool-ui-eSQ1g2I1.js";import{t}from"./permissions-surface-registry-CilCRwhh.js";import{storePendingHandle as n}from"./mount-picker-popup-qcWGbpG5.js";import{r,t as i}from"./hid-device-registry-B2R-0rNt.js";import"./browser-BhTdBqdp.js";import{a,n as o}from"./serial-port-registry-CCqklAEr.js";import{a as s,t as c}from"./usb-device-registry--JwKRTYp.js";import"./usb-operations-v1mGAdRY.js";import{t as l}from"./terminal-session-client-DmE-iBjP.js";function u(e,t){let n=[],r=new Map,i=new Set;for(let a=0;a<e.length;a++){let o=e[a];o.startsWith(`-`)?t.has(o)?r.set(o,e[++a]??``):i.add(o):n.push(o)}return{positionals:n,flags:r,bools:i}}new TextDecoder(`utf-8`,{fatal:!1}),new TextEncoder;var d=new Set([`--vid`,`--pid`,`--baud`,`--data-bits`,`--stop-bits`,`--parity`,`--flow-control`,`--buffer-size`,`--bytes`,`--until`,`--timeout-ms`,`--dtr`,`--rts`,`--break`,`--__resolved`]);function f(e){return u(e,d)}function p(e,t){let n=/^0x/i.test(e)?parseInt(e,16):parseInt(e,10);if(!Number.isFinite(n)||Number.isNaN(n))throw Error(`invalid ${t}: '${e}'`);return n}function m(e){let t={};return e.has(`--vid`)&&(t.usbVendorId=p(e.get(`--vid`),`vid`)),e.has(`--pid`)&&(t.usbProductId=p(e.get(`--pid`),`pid`)),Object.keys(t).length>0?[t]:[]}`${o}${o}`;var h=new Set([`--port`,`--baud`,`--vid`,`--pid`]),g=115200;function _(e){return u(e,h)}`${g}`;var v=new Set([`--vid`,`--pid`,`--usage-page`,`--usage`,`--__resolved`,`--timeout`]);function y(e){return u(e,v)}function b(e,t){let n=/^0x/i.test(e)?parseInt(e,16):parseInt(e,10);if(!Number.isFinite(n)||Number.isNaN(n))throw Error(`invalid ${t}: '${e}'`);return n}function x(e){let t={};return e.has(`--vid`)&&(t.vendorId=b(e.get(`--vid`),`vid`)),e.has(`--pid`)&&(t.productId=b(e.get(`--pid`),`pid`)),e.has(`--usage-page`)&&(t.usagePage=b(e.get(`--usage-page`),`usage-page`)),e.has(`--usage`)&&(t.usage=b(e.get(`--usage`),`usage`)),Object.keys(t).length>0?[t]:[]}`${i}`;var S=new Set([`--vid`,`--pid`,`--class`,`--subclass`,`--protocol`,`--serial`,`--request-type`,`--recipient`,`--request`,`--value`,`--index`,`--__resolved`]);function C(e){return u(e,S)}function w(e,t){let n=/^0x/i.test(e)?parseInt(e,16):parseInt(e,10);if(!Number.isFinite(n)||Number.isNaN(n))throw Error(`invalid ${t}: '${e}'`);return n}function T(e){let t={};return e.has(`--vid`)&&(t.vendorId=w(e.get(`--vid`),`vid`)),e.has(`--pid`)&&(t.productId=w(e.get(`--pid`),`pid`)),e.has(`--class`)&&(t.classCode=w(e.get(`--class`),`class`)),e.has(`--subclass`)&&(t.subclassCode=w(e.get(`--subclass`),`subclass`)),e.has(`--protocol`)&&(t.protocolCode=w(e.get(`--protocol`),`protocol`)),e.has(`--serial`)&&(t.serialNumber=e.get(`--serial`)),Object.keys(t).length>0?[t]:[]}`${c}`;var E=`\x1B]7777;`,D=/\x1b\]7777;(\d+)\x07/g;String.raw`printf '\033]7777;%s\007' "$?"`,[`if [ -f ~/.bashrc ]; then . ~/.bashrc; fi`,`exec 98<&-`,``].join(`
|
|
3
3
|
`);function O(e){let t=e.replace(/\r\n/g,`
|
|
4
4
|
`),n=t.indexOf(`
|
|
@@ -6,7 +6,7 @@ import{t as e}from"./preload-helper-Czpn1I53.js";import"./tool-ui-eSQ1g2I1.js";i
|
|
|
6
6
|
`),this.prompt=e,this.line=[],this.cursor=0,this.historyIndex=this.history.length,this.draft=``,this.anchorRow=this.display.getCursor().row,this.display.write(e),new Promise((e,t)=>{this.resolve=e,this.reject=t})}abort(e){this.reject?.(e),this.resolve=null,this.reject=null}setLine(e){this.isReading&&(this.line=[...e],this.cursor=this.line.length,this.redraw())}insert(e){if(!this.isReading||!e)return;let t=[...e.replace(/[\r\n\x1b]/g,``)];this.line.splice(this.cursor,0,...t),this.cursor+=t.length,this.redraw()}list(e){if(!this.isReading)return;let t=this.cursor;this.cursor=this.line.length,this.redraw(),this.display.write(`\r\n${e.join(` `)}\r\n`),this.anchorRow=this.display.getCursor().row,this.cursor=t,this.redraw()}accept(){if(!this.resolve)return;this.cursor=this.line.length,this.redraw();let e=this.text;this.display.write(`\r
|
|
7
7
|
`),e.trim()&&this.history.at(-1)!==e&&(this.history.push(e),this.history.length>A&&this.history.shift());let t=this.resolve;this.resolve=null,this.reject=null,t(e)}cancel(){if(!this.resolve)return;this.cursor=this.line.length,this.redraw(),this.display.write(`^C\r
|
|
8
8
|
`);let e=this.resolve;this.resolve=null,this.reject=null,e(``)}feed(e){if(this.isReading)switch(e){case`\r`:case`
|
|
9
|
-
`:this.accept();return;case``:this.cancel();return;case``:case`\b`:this.cursor>0&&(this.line.splice(--this.cursor,1),this.redraw());return;case`\x1B[3~`:this.cursor<this.line.length&&(this.line.splice(this.cursor,1),this.redraw());return;case`\x1B[D`:case`\x1BOD`:this.cursor=Math.max(0,this.cursor-1),this.redraw();return;case`\x1B[C`:case`\x1BOC`:this.cursor=Math.min(this.line.length,this.cursor+1),this.redraw();return;case`\x1B[H`:case`\x1BOH`:case``:this.cursor=0,this.redraw();return;case`\x1B[F`:case`\x1BOF`:case``:this.cursor=this.line.length,this.redraw();return;case`\x1B[A`:case`\x1BOA`:this.navigate(-1);return;case`\x1B[B`:case`\x1BOB`:this.navigate(1);return;case``:this.line.splice(0,this.cursor),this.cursor=0,this.redraw();return;case`\v`:this.line.splice(this.cursor),this.redraw();return;case``:{let e=this.cursor;for(;e>0&&/\s/.test(this.line[e-1]??``);)e--;for(;e>0&&!/\s/.test(this.line[e-1]??``);)e--;this.line.splice(e,this.cursor-e),this.cursor=e,this.redraw();return}default:!e.includes(`\x1B`)&&!/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/.test(e)&&this.insert(e.replace(/[\r\n\t]+/g,` `))}}navigate(e){e<0&&this.historyIndex===0||e>0&&this.historyIndex===this.history.length||(this.historyIndex===this.history.length&&(this.draft=this.text),this.historyIndex+=e,this.line=[...this.history[this.historyIndex]??this.draft],this.cursor=this.line.length,this.redraw())}redraw(){let{row:e}=this.display.getCursor(),t=this.display.getScrollbackCount(),n=e-this.anchorRow;n>0&&this.display.write(`\x1b[${n}A`),this.display.write(`\r\x1B[0J`),this.display.write(this.prompt+this.beforeCursor),this.display.write(`\x1B7`),this.display.write(this.line.slice(this.cursor).join(``)),this.display.write(`\x1B8`),this.anchorRow=Math.max(0,this.anchorRow-(this.display.getScrollbackCount()-t))}},M=`\x1B[34m/\x1B[0m \x1B[90m$\x1B[0m `,N=class{options;client;terminal=null;terminalHost=null;previewHost=null;previewUrls=[];hasPreview=!1;previewStateListener=null;resizeObserver=null;rejectTerminalReady=null;editor=null;disposed=!1;programmaticResolve=null;isExecuting=!1;ptyMode=!1;loginShell=!1;loginSawPty=!1;marks=new k;settleSession=()=>{};sessionSettled=new Promise(e=>{this.settleSession=e});reportedSize=``;suppressOutput=!1;tabBusy=!1;pendingTabInput=[];constructor(e){this.options=e;let t=e.sid??`panel-terminal-${Date.now()}`;this.client=new l({client:e.client,sid:t,onEvent:e=>this.handleEvent(e)})}async mount(t){if(await e(()=>import(`./wc-shell-
|
|
9
|
+
`:this.accept();return;case``:this.cancel();return;case``:case`\b`:this.cursor>0&&(this.line.splice(--this.cursor,1),this.redraw());return;case`\x1B[3~`:this.cursor<this.line.length&&(this.line.splice(this.cursor,1),this.redraw());return;case`\x1B[D`:case`\x1BOD`:this.cursor=Math.max(0,this.cursor-1),this.redraw();return;case`\x1B[C`:case`\x1BOC`:this.cursor=Math.min(this.line.length,this.cursor+1),this.redraw();return;case`\x1B[H`:case`\x1BOH`:case``:this.cursor=0,this.redraw();return;case`\x1B[F`:case`\x1BOF`:case``:this.cursor=this.line.length,this.redraw();return;case`\x1B[A`:case`\x1BOA`:this.navigate(-1);return;case`\x1B[B`:case`\x1BOB`:this.navigate(1);return;case``:this.line.splice(0,this.cursor),this.cursor=0,this.redraw();return;case`\v`:this.line.splice(this.cursor),this.redraw();return;case``:{let e=this.cursor;for(;e>0&&/\s/.test(this.line[e-1]??``);)e--;for(;e>0&&!/\s/.test(this.line[e-1]??``);)e--;this.line.splice(e,this.cursor-e),this.cursor=e,this.redraw();return}default:!e.includes(`\x1B`)&&!/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/.test(e)&&this.insert(e.replace(/[\r\n\t]+/g,` `))}}navigate(e){e<0&&this.historyIndex===0||e>0&&this.historyIndex===this.history.length||(this.historyIndex===this.history.length&&(this.draft=this.text),this.historyIndex+=e,this.line=[...this.history[this.historyIndex]??this.draft],this.cursor=this.line.length,this.redraw())}redraw(){let{row:e}=this.display.getCursor(),t=this.display.getScrollbackCount(),n=e-this.anchorRow;n>0&&this.display.write(`\x1b[${n}A`),this.display.write(`\r\x1B[0J`),this.display.write(this.prompt+this.beforeCursor),this.display.write(`\x1B7`),this.display.write(this.line.slice(this.cursor).join(``)),this.display.write(`\x1B8`),this.anchorRow=Math.max(0,this.anchorRow-(this.display.getScrollbackCount()-t))}},M=`\x1B[34m/\x1B[0m \x1B[90m$\x1B[0m `,N=class{options;client;terminal=null;terminalHost=null;previewHost=null;previewUrls=[];hasPreview=!1;previewStateListener=null;resizeObserver=null;rejectTerminalReady=null;editor=null;disposed=!1;programmaticResolve=null;isExecuting=!1;ptyMode=!1;loginShell=!1;loginSawPty=!1;marks=new k;settleSession=()=>{};sessionSettled=new Promise(e=>{this.settleSession=e});reportedSize=``;suppressOutput=!1;tabBusy=!1;pendingTabInput=[];constructor(e){this.options=e;let t=e.sid??`panel-terminal-${Date.now()}`;this.client=new l({client:e.client,sid:t,onEvent:e=>this.handleEvent(e)})}async mount(t){if(await e(()=>import(`./wc-shell-BzYq0ESt.js`).then(e=>e.N),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37])),this.disposed)return;t.replaceChildren(),this.terminalHost=document.createElement(`div`),this.terminalHost.className=`terminal-panel__terminal-host`,t.appendChild(this.terminalHost),this.previewHost=document.createElement(`div`),this.previewHost.className=`terminal-panel__preview`,t.appendChild(this.previewHost);let n=document.createElement(`slicc-terminal`);n.hideHeader=!0,n.style.width=`100%`,n.style.height=`100%`,this.terminal=n;let r=new Promise((e,t)=>{let r=()=>{n.removeEventListener(`terminal-ready`,i),n.removeEventListener(`terminal-error`,a),this.rejectTerminalReady=null},i=()=>{r(),e()},a=e=>{r(),t(e.detail)};this.rejectTerminalReady=e=>{r(),t(e)},n.addEventListener(`terminal-ready`,i),n.addEventListener(`terminal-error`,a)});n.addEventListener(`terminal-data`,e=>{this.handleTerminalData(e.detail)}),this.terminalHost.appendChild(n),await r,!this.disposed&&(n.fit(),this.editor=new j({write:e=>n.write(e),getCursor:()=>n.terminal?.bridge?.getCursor()??{row:0,col:0},getScrollbackCount:()=>n.terminal?.bridge?.getScrollbackCount()??0}),this.resizeObserver=new ResizeObserver(()=>this.refit()),this.resizeObserver.observe(this.terminalHost),await this.client.open({cwd:this.options.cwd,env:this.options.env}),this.startSession(n))}async startSession(e){let t=await this.runLoginShell();this.disposed||(t||(e.writeln(`\x1B[1mslicc\x1B[0m \x1B[90mshell (kernel)\x1B[0m`),e.writeln(`\x1B[90mType "help" for available commands.\x1B[0m`),e.writeln(``)),this.runPromptLoop(),this.settleSession())}async runLoginShell(){this.loginShell=!0,this.loginSawPty=!1;let e=await this.runRemote(`wasm --login`,{discardCapturedOutput:!0});return this.loginShell=!1,this.marks.end(),!this.loginSawPty&&e.exitCode===125?null:(this.terminal?.writeln(`\x1b[90mbash exited (${e.exitCode}); this is the slicc shell. \`wasm --login\` starts bash again.\x1b[0m`),e)}refit(){this.terminal?.fit(),this.reportSize()}reportSize(){let e=this.terminal?.terminal;if(!e)return;let t=`${e.cols}x${e.rows}`;t!==this.reportedSize&&(this.reportedSize=t,this.client.resize(e.cols,e.rows))}clearTerminal(){this.terminal?.clear()}async executeCommandInTerminal(e){let t=e.trim();if(!t)return{stdout:``,stderr:``,exitCode:0};if(this.editor&&!(this.loginShell&&this.ptyMode)&&await this.sessionSettled,this.loginShell&&this.ptyMode)return this.typeIntoLoginShell(t);if(!this.terminal||!this.editor)return this.client.exec(t);if(this.isExecuting||this.programmaticResolve||!this.editor.isReading||this.editor.text)return{stdout:``,stderr:`terminal is busy; finish current input first
|
|
10
10
|
`,exitCode:1};let n=new Promise(e=>{this.programmaticResolve=e});return this.editor.setLine(t),this.editor.accept(),n}typeIntoLoginShell(e){if(this.marks.pending)return Promise.resolve({stdout:``,stderr:`terminal is busy
|
|
11
11
|
`,exitCode:1});let t=this.marks.seen?this.marks.expect():Promise.resolve({stdout:``,stderr:``,exitCode:0});return this.client.stdin(`${e}\r`),t}setPreviewStateListener(e){this.previewStateListener=e,e?.(this.hasPreview)}dispose(){this.disposed=!0,this.settleSession(),this.rejectTerminalReady?.(Error(`terminal disposed`)),this.editor?.abort(Error(`terminal disposed`)),this.clearMediaPreview(),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.terminal?.remove(),this.terminal=null,this.editor=null,this.pendingTabInput=[],this.terminalHost=null,this.previewHost=null,this.client.close(),this.client.dispose()}renderMediaPreview(e){if(!this.previewHost)return;let t=document.createElement(`div`);t.className=`terminal-panel__preview-item`;let n=document.createElement(`div`);n.className=`terminal-panel__preview-label`;let r=e.path.split(`/`).pop()??e.path;if(n.textContent=`${r} · ${e.mediaType}`,t.appendChild(n),e.mediaType===`image/png`){let n=document.createElement(`slicc-terminal`);n.hideHeader=!0,n.style.width=`100%`,n.style.height=`180px`,n.style.pointerEvents=`none`,n.setAttribute(`aria-label`,`Kitty graphics preview of ${r}`),n.addEventListener(`terminal-ready`,()=>requestAnimationFrame(()=>{let e=n.shadowRoot?.querySelector(`.host`);e&&(e.scrollTop=0),this.terminal?.focus()}),{once:!0}),t.appendChild(n);for(let t=0;t<e.data.length;t+=4096){let r=t===0,i=t+4096>=e.data.length,a=r?`a=T,f=100,t=d,m=${+!i}`:`m=${+!i}`;n.write(`\x1b_G${a};${e.data.slice(t,t+4096)}\x1b\\`)}}else if(e.mediaType.startsWith(`video/`)){let n=Uint8Array.from(atob(e.data),e=>e.charCodeAt(0)),r=URL.createObjectURL(new Blob([n],{type:e.mediaType}));this.previewUrls.push(r);let i=document.createElement(`video`);i.className=`terminal-panel__preview-media`,i.controls=!0,i.autoplay=!0,i.loop=!0,i.muted=!0,i.playsInline=!0,i.src=r,i.addEventListener(`loadedmetadata`,()=>this.refit(),{once:!0}),t.appendChild(i)}else{let n=Uint8Array.from(atob(e.data),e=>e.charCodeAt(0)),i=URL.createObjectURL(new Blob([n],{type:e.mediaType}));this.previewUrls.push(i);let a=document.createElement(`img`);a.className=`terminal-panel__preview-media`,a.alt=r,a.src=i,a.addEventListener(`load`,()=>this.refit(),{once:!0}),t.appendChild(a)}this.previewHost.appendChild(t),this.previewHost.classList.add(`terminal-panel__preview--visible`),this.hasPreview=!0,this.previewStateListener?.(!0)}clearMediaPreview(){for(let e of this.previewUrls)URL.revokeObjectURL(e);this.previewUrls=[],this.previewHost&&(this.previewHost.replaceChildren(),this.previewHost.classList.remove(`terminal-panel__preview--visible`)),this.hasPreview=!1,this.previewStateListener?.(!1)}async runPromptLoop(){for(;!this.disposed&&this.editor&&this.terminal;){let e;try{e=await this.readNextLine()}catch{break}let t=this.programmaticResolve!==null,n=await this.processLine(e,t);this.programmaticResolve&&=(this.programmaticResolve(n),null)}}readNextLine(){if(!this.editor)return Promise.reject(Error(`terminal not mounted`));let e=this.editor.read(M);return this.flushPendingTabInput(),e}flushPendingTabInput(){for(;this.editor?.isReading&&this.pendingTabInput.length>0;)this.editor.feed(this.pendingTabInput.shift()??``)}handleTerminalData(e){if(this.ptyMode){this.client.stdin(e);return}e===` `?this.tabBusy||this.handleTab():e===``&&this.isExecuting?this.signalInterruptDuringExec():this.tabBusy?this.pendingTabInput.push(e):this.editor?.feed(e)}async processLine(e,t=!1){let n=e.trim(),r={stdout:``,stderr:``,exitCode:0};return n?n===`wasm --login`?await this.runLoginShell()??{stdout:``,stderr:`wasm: --login: no GNU bash to log in to (install @ai-ecoverse/wasm-bash)
|
|
12
12
|
`,exitCode:125}:!t&&await this.tryRunPicker(n)?r:this.runRemote(n):r}async tryRunPicker(e){let t=P(e);if(t)return await this.runRemoteWithLocalPicker(e,t),!0;let n=V(e);if(n)return await this.runRemoteWithUsbPicker(n),!0;let r=H(e);if(r)return await this.runRemoteWithHidPicker(r),!0;let i=W(e);if(i)return await this.runRemoteWithSerialPicker(i),!0;let a=G(e);if(a)return await this.runRemoteWithEsptoolPicker(e,a),!0;let o=B(e);return o?(await this.runRemoteWithScreenShare(o.name),!0):!1}signalInterruptDuringExec(){this.isExecuting&&(this.terminal?.writeln(`^C`),this.client.signal(`SIGINT`))}async handleTab(){if(!(!this.terminal||!this.editor)&&!(this.isExecuting||this.tabBusy)){this.tabBusy=!0,this.isExecuting=!0;try{let e=this.editor.beforeCursor,{currentWord:t,isFirstWord:n,compgenCmd:r}=q(e);this.suppressOutput=!0;let i=``;try{i=(await this.client.exec(r)).stdout}finally{this.suppressOutput=!1}let a=i.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,s as t,t as n}from"./almost-bash-shell-headless-
|
|
1
|
+
import{n as e,s as t,t as n}from"./almost-bash-shell-headless-Cr-YVYbG.js";import{n as r}from"./browser-Jlk38XAj.js";import{c as i}from"./sudoers-BdBYQPUn.js";import{r as a}from"./sudo-fs-mI-V4QkM.js";import{n as o}from"./jsh-discovery-CnvNKojr.js";import{o as s}from"./just-bash-compat-B-SPHuh_.js";import{n as c,r as l}from"./supervisor-d43UzH63.js";function u(e,n){return new Map(Object.entries({HOME:t,PATH:o,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:e.cwd,...n,...e.env}))}function d(e,t,n,i){let a=u(t,i);return r({fs:e,cwd:t.cwd,env:a,stdin:s(``),exec:(e,r)=>n.exec(e,{env:r?.env??Object.fromEntries(a),cwd:r?.cwd??t.cwd,args:r?.args,...r?.env===void 0?{}:{replaceEnv:!0}})})}const f={requestApproval:async()=>({decision:`deny`})};async function p(t){let r=h(t.fs,t.sudo),i=new e(r),a=new n({fs:r,cwd:`/workspace`,processManager:t.processManager,processOwner:{kind:`jshd`}}),o={exec:(e,t)=>a.getBash().exec(e,{env:t?.env??a.getEnv(),cwd:t?.cwd??`/workspace`,args:t?.args,...t?.env===void 0?{}:{replaceEnv:!0}})},s=c({fs:t.fs,processManager:t.processManager,lickManager:t.lickManager,...t.realmFactory?{realmFactory:t.realmFactory}:{},buildContext:e=>m(i,e,o)}),u=(await l(t.fs)).filter(e=>e.enabled);if(u.length===0)return[];let d=[];for(let e of u)try{await s.start(e),d.push(e.name)}catch{}return d}function m(e,t,n){return d(e,t,n)}function h(e,t){return a(e,{broker:t?.broker??f,getPolicy:t?.getPolicy??i,defaultDisposition:`allow`})}export{p as restoreEnabledJshdUnits};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./base64-BPBW1Gzr.js";import{m as t}from"./state-UjVstscY.js";import{t as n}from"./realm-browser-fetch-V3uggGbM.js";const r=new TextEncoder;function i(e){return typeof e==`object`&&!!e&&`exitCode`in e}async function a(e,t){try{return await e.fs.readFileBuffer(e.fs.resolvePath(e.cwd,t))}catch{return{message:`curlwright: cannot read ${t}`,exitCode:26}}}function o(e){let t=new Uint8Array(e.length),n=0;for(let r of e)r!==10&&r!==13&&(t[n++]=r);return t.subarray(0,n)}async function s(e,t){let n=t.indexOf(`=`),o=t.indexOf(`@`),s=o!==-1&&(n===-1||o<n),c=s?o:n,l=c===-1?``:t.slice(0,c),u=c===-1?t:t.slice(c+1),d=u;if(s){let t=await a(e,u);if(i(t))return t;d=new TextDecoder().decode(t)}let f=encodeURIComponent(d);return r.encode(l===``?f:`${l}=${f}`)}async function c(e,t){if(t.kind===`urlencode`)return s(e,t.value);if(t.kind===`raw`||!t.value.startsWith(`@`))return r.encode(t.value);let n=await a(e,t.value.slice(1));return i(n)||t.kind===`binary`?n:o(n)}function l(e){let t=Math.max(0,e.length-1),n=e.reduce((e,t)=>e+t.length,0)+t,r=new Uint8Array(n),i=0;return e.forEach((e,t)=>{t>0&&(r[i++]=38),r.set(e,i),i+=e.length}),r}function u(e){let t=e.split(`;`);return{value:t[0],options:t.slice(1)}}function d(e,t){for(let n of e){let e=n.trim();if(e.startsWith(`${t}=`))return e.slice(t.length+1)}return null}function f(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n===-1?t:t.slice(n+1)}async function p(e,t,n){let r=n.value.indexOf(`=`);if(r===-1)return{message:`curlwright: -F requires name=content (got "${n.value}")`,exitCode:2};let o=n.value.slice(0,r),s=n.value.slice(r+1);if(n.literal||s[0]!==`@`&&s[0]!==`<`)return t.append(o,s),null;let{value:c,options:l}=u(s.slice(1)),p=await a(e,c);if(i(p))return p;if(s[0]===`<`)return t.append(o,new TextDecoder().decode(p)),null;let m=d(l,`type`)??`application/octet-stream`,h=d(l,`filename`)??f(c);return t.append(o,new Blob([p],{type:m}),h),null}async function m(e,t,n){if(t.length>0&&n.length>0)return{message:`curlwright: -F cannot be combined with -d`,exitCode:2};if(n.length>0){let t=new FormData;for(let r of n){let n=await p(e,t,r);if(n)return n}return{bytes:null,form:t,contentType:null,accept:null}}if(t.length===0)return{bytes:null,form:null,contentType:null,accept:null};let r=[];for(let n of t){let t=await c(e,n);if(i(t))return t;r.push(t)}let a=t.some(e=>e.kind===`json`);return{bytes:l(r),form:null,contentType:a?`application/json`:`application/x-www-form-urlencoded`,accept:a?`application/json`:null}}const h=new Set([`request`,`header`,`data`,`data-raw`,`data-binary`,`data-ascii`,`data-urlencode`,`json`,`form`,`form-string`,`output`,`dump-header`,`write-out`,`max-time`,`user`,`referer`,`range`,`url`,`tab`,`frame`]),g=new Set([`silent`,`show-error`,`include`,`head`,`verbose`,`fail`,`location`,`remote-name`,`get`,`no-credentials`,`help`]),_={X:`request`,H:`header`,d:`data`,F:`form`,o:`output`,D:`dump-header`,w:`write-out`,m:`max-time`,u:`user`,e:`referer`,r:`range`},v={s:`silent`,S:`show-error`,i:`include`,I:`head`,v:`verbose`,f:`fail`,L:`location`,O:`remote-name`,G:`get`,h:`help`},y={cert:`client certificates are the browser profile's to present, not the shell's`,"cert-type":`client certificates are the browser profile's to present, not the shell's`,key:`client certificates are the browser profile's to present, not the shell's`,cacert:`the browser decides which roots to trust`,capath:`the browser decides which roots to trust`,insecure:`the browser enforces TLS verification; a page cannot opt out`,proxy:`proxying is configured on the browser, not per request`,"proxy-user":`proxying is configured on the browser, not per request`,interface:`a page cannot choose an outgoing interface`,"unix-socket":`a page cannot dial a unix socket`,resolve:`a page cannot override DNS resolution`,compressed:`always on — the browser negotiates encoding itself`,cookie:"the tab's own cookies are already sent; set one with `playwright-cli cookie-set`","cookie-jar":"cookies live in the browser profile; read them with `playwright-cli cookies`","limit-rate":`a page cannot throttle a fetch`,"continue-at":"a page fetch cannot resume; use `-H 'Range: bytes=N-'`","connect-timeout":"a page fetch cannot time the connect phase alone; use `--max-time`","http1.1":`the browser negotiates the HTTP version`,http2:`the browser negotiates the HTTP version`,http3:`the browser negotiates the HTTP version`,"no-buffer":`responses are read whole, never streamed to stdout`,"trace-ascii":"no wire trace exists; use `playwright-cli network-requests`",trace:"no wire trace exists; use `playwright-cli network-requests`","user-agent":`User-Agent is a forbidden header name for fetch(); the tab sets it`},b={k:`insecure`,x:`proxy`,b:`cookie`,c:`cookie-jar`,E:`cert`,C:`continue-at`,N:`no-buffer`,A:`user-agent`};function ee(){return{url:null,requestMethod:null,headers:[],data:[],form:[],get:!1,output:null,remoteName:!1,include:!1,head:!1,dumpHeader:null,writeOut:null,silent:!1,showError:!1,verbose:!1,failOnError:!1,maxTimeSeconds:null,credentials:`include`,tab:null,frame:null,user:null,referer:null,range:null,help:!1}}function x(e,t){return{message:`curlwright: option ${e} is not supported in a page context — ${y[t]}`,exitCode:2}}function S(e){return{message:`curlwright: unknown option ${e}\nRun 'curlwright --help' for the supported flags.`,exitCode:2}}function C(e){let t=e.indexOf(`:`);if(t===-1)return e.endsWith(`;`)?{name:e.slice(0,-1).trim(),value:``,unset:!1}:{name:e.trim(),value:``,unset:!1};let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();return{name:n,value:r,unset:r===``}}function w(e,t,n,r){switch(t){case`request`:return e.requestMethod=n,null;case`header`:return e.headers.push(C(n??``)),null;case`data`:case`data-ascii`:return e.data.push({kind:`ascii`,value:n??``}),null;case`data-raw`:return e.data.push({kind:`raw`,value:n??``}),null;case`data-binary`:return e.data.push({kind:`binary`,value:n??``}),null;case`data-urlencode`:return e.data.push({kind:`urlencode`,value:n??``}),null;case`json`:return e.data.push({kind:`json`,value:n??``}),null;case`form`:return e.form.push({value:n??``,literal:!1}),null;case`form-string`:return e.form.push({value:n??``,literal:!0}),null;case`output`:return e.output=n,null;case`dump-header`:return e.dumpHeader=n,null;case`write-out`:return e.writeOut=n,null;case`max-time`:return T(e,n,r);case`user`:return e.user=n,null;case`referer`:return e.referer=n,null;case`range`:return e.range=n,null;case`url`:return e.url=n,null;case`tab`:return e.tab=n,null;case`frame`:return e.frame=n,null;default:return E(e,t,r)}}function T(e,t,n){let r=Number(t);return!Number.isFinite(r)||r<=0?{message:`curlwright: ${n} expects a positive number of seconds`,exitCode:2}:(e.maxTimeSeconds=r,null)}function E(e,t,n){switch(t){case`silent`:return e.silent=!0,null;case`show-error`:return e.showError=!0,null;case`include`:return e.include=!0,null;case`head`:return e.head=!0,null;case`verbose`:return e.verbose=!0,null;case`fail`:return e.failOnError=!0,null;case`location`:return null;case`remote-name`:return e.remoteName=!0,null;case`get`:return e.get=!0,null;case`no-credentials`:return e.credentials=`omit`,null;case`help`:return e.help=!0,null;default:return S(n)}}function te(e,t,n){let r=t[n],i=r.indexOf(`=`),a=(i===-1?r.slice(2):r.slice(2,i)).trim(),o=i===-1?null:r.slice(i+1);if(a in y)return x(`--${a}`,a);if(h.has(a)){let r=o??t[n+1];return r===void 0?{message:`curlwright: option --${a} requires a value`,exitCode:2}:w(e,a,r,`--${a}`)??{next:o===null?n+2:n+1}}return g.has(a)?w(e,a,null,`--${a}`)??{next:n+1}:S(`--${a}`)}function ne(e,t,n){let r=t[n];for(let i=1;i<r.length;i++){let a=r[i];if(a in b)return x(`-${a}`,b[a]);if(a in _){let o=r.slice(i+1),s=o===``?t[n+1]:o;return s===void 0?{message:`curlwright: option -${a} requires a value`,exitCode:2}:w(e,_[a],s,`-${a}`)??{next:o===``?n+2:n+1}}if(!(a in v))return S(`-${a}`);let o=w(e,v[a],null,`-${a}`);if(o)return o}return{next:n+1}}function re(e,t){return e.url!==null&&e.url!==t?{message:`curlwright: only one URL is supported (got "${e.url}" and "${t}")`,exitCode:2}:(e.url=t,null)}function ie(e){let t=ee(),n=0,r=!1;for(;n<e.length;){let i=e[n];if(!r&&i===`--`){r=!0,n++;continue}if(!r&&i.startsWith(`--`)){let r=te(t,e,n);if(`message`in r)return r;n=r.next;continue}if(!r&&i.startsWith(`-`)&&i.length>1){let r=ne(t,e,n);if(`message`in r)return r;n=r.next;continue}let a=re(t,i);if(a)return a;n++}return t}function ae(e){return`message`in e}const D={"accept-charset":`the browser sets it`,"accept-encoding":`the browser negotiates encoding`,connection:`the browser owns the connection`,"content-length":`derived from the body`,cookie:"the tab's cookies are sent already; set one with `playwright-cli cookie-set`",cookie2:`the tab's cookies are sent already`,date:`the browser sets it`,dnt:`the browser sets it`,expect:`a page fetch cannot send it`,host:`derived from the URL`,"keep-alive":`the browser owns the connection`,origin:`the tab's own origin is sent automatically`,referer:`use -e/--referer, which sets the fetch referrer`,te:`the browser owns transfer encoding`,trailer:`the browser owns transfer encoding`,"transfer-encoding":`the browser owns transfer encoding`,upgrade:`the browser owns the connection`,via:`the browser sets it`};function oe(e){let t=e.toLowerCase();return t in D?D[t]:t.startsWith(`proxy-`)?`proxying is configured on the browser`:t.startsWith(`sec-`)?`Sec- headers are reserved for the browser`:null}function se(e){for(let t of e){let e=oe(t.name);if(e)return{message:`curlwright: header "${t.name}" cannot be set from a page — ${e}`,exitCode:2}}return null}function O(e,t){let n=t.toLowerCase();return Object.keys(e).some(e=>e.toLowerCase()===n)}function k(e){let t={},n=new Set;for(let r of e.headers)if(r.name!==``){if(r.unset){n.add(r.name.toLowerCase());continue}t[r.name]=r.value}return{headers:t,suppressed:n}}function A(e,t,n){return!O(e,n)&&!t.has(n)}function j(e){return/^[a-zA-Z]+=/.test(e)?e:`bytes=${e}`}function M(e,t,n,r){n.user!==null&&A(e,t,`authorization`)&&(e.Authorization=`Basic ${btoa(n.user)}`),n.range!==null&&A(e,t,`range`)&&(e.Range=j(n.range)),r.contentType&&A(e,t,`content-type`)&&(e[`Content-Type`]=r.contentType),r.accept&&A(e,t,`accept`)&&(e.Accept=r.accept)}function N(e,t){if(t===``)return e;let[n,r]=P(e);return`${n}${n.includes(`?`)?`&`:`?`}${t}${r}`}function P(e){let t=e.indexOf(`#`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t)]}function F(e,t){return e.requestMethod?e.requestMethod:e.head?`HEAD`:t?`POST`:`GET`}function I(e,t,n){let r=e.toUpperCase();return!t||r!==`GET`&&r!==`HEAD`?null:{message:`curlwright: ${n.requestMethod?`-X ${n.requestMethod}`:`-I`} cannot carry a request body — a page fetch rejects a ${r} with one. Drop the data, or use -G to send it as a query string.`,exitCode:2}}function L(e,t){if(e.url===null)return{message:`curlwright: no URL specified`,exitCode:2};let{headers:n,suppressed:r}=k(e),i=e.get&&t.bytes!==null,a=i?{...t,bytes:null,contentType:null}:t;M(n,r,e,a);let o=i?N(e.url,new TextDecoder().decode(t.bytes??new Uint8Array)):e.url,s=a.bytes!==null||a.form!==null,c=F(e,s),l=I(c,s,e);if(l)return l;let u={method:c,headers:n,credentials:e.credentials,responseType:`binary`};return a.form?u.body=a.form:a.bytes&&(u.body=a.bytes),e.referer!==null&&(u.referrer=e.referer),e.maxTimeSeconds!==null&&(u.timeoutMs=e.maxTimeSeconds*1e3),{url:o,method:c,fetchOptions:u,uploadSize:a.bytes?.length??0}}function R(e){let t=e.fetchOptions.headers??{},n=[`> ${e.method} ${e.url}`];for(let[e,r]of Object.entries(t))n.push(`> ${e}: ${r}`);return n.push(`> `),`${n.join(`
|
|
1
|
+
import{t as e}from"./base64-BPBW1Gzr.js";import{m as t}from"./state-CRuL5BZp.js";import{t as n}from"./realm-browser-fetch-V3uggGbM.js";const r=new TextEncoder;function i(e){return typeof e==`object`&&!!e&&`exitCode`in e}async function a(e,t){try{return await e.fs.readFileBuffer(e.fs.resolvePath(e.cwd,t))}catch{return{message:`curlwright: cannot read ${t}`,exitCode:26}}}function o(e){let t=new Uint8Array(e.length),n=0;for(let r of e)r!==10&&r!==13&&(t[n++]=r);return t.subarray(0,n)}async function s(e,t){let n=t.indexOf(`=`),o=t.indexOf(`@`),s=o!==-1&&(n===-1||o<n),c=s?o:n,l=c===-1?``:t.slice(0,c),u=c===-1?t:t.slice(c+1),d=u;if(s){let t=await a(e,u);if(i(t))return t;d=new TextDecoder().decode(t)}let f=encodeURIComponent(d);return r.encode(l===``?f:`${l}=${f}`)}async function c(e,t){if(t.kind===`urlencode`)return s(e,t.value);if(t.kind===`raw`||!t.value.startsWith(`@`))return r.encode(t.value);let n=await a(e,t.value.slice(1));return i(n)||t.kind===`binary`?n:o(n)}function l(e){let t=Math.max(0,e.length-1),n=e.reduce((e,t)=>e+t.length,0)+t,r=new Uint8Array(n),i=0;return e.forEach((e,t)=>{t>0&&(r[i++]=38),r.set(e,i),i+=e.length}),r}function u(e){let t=e.split(`;`);return{value:t[0],options:t.slice(1)}}function d(e,t){for(let n of e){let e=n.trim();if(e.startsWith(`${t}=`))return e.slice(t.length+1)}return null}function f(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n===-1?t:t.slice(n+1)}async function p(e,t,n){let r=n.value.indexOf(`=`);if(r===-1)return{message:`curlwright: -F requires name=content (got "${n.value}")`,exitCode:2};let o=n.value.slice(0,r),s=n.value.slice(r+1);if(n.literal||s[0]!==`@`&&s[0]!==`<`)return t.append(o,s),null;let{value:c,options:l}=u(s.slice(1)),p=await a(e,c);if(i(p))return p;if(s[0]===`<`)return t.append(o,new TextDecoder().decode(p)),null;let m=d(l,`type`)??`application/octet-stream`,h=d(l,`filename`)??f(c);return t.append(o,new Blob([p],{type:m}),h),null}async function m(e,t,n){if(t.length>0&&n.length>0)return{message:`curlwright: -F cannot be combined with -d`,exitCode:2};if(n.length>0){let t=new FormData;for(let r of n){let n=await p(e,t,r);if(n)return n}return{bytes:null,form:t,contentType:null,accept:null}}if(t.length===0)return{bytes:null,form:null,contentType:null,accept:null};let r=[];for(let n of t){let t=await c(e,n);if(i(t))return t;r.push(t)}let a=t.some(e=>e.kind===`json`);return{bytes:l(r),form:null,contentType:a?`application/json`:`application/x-www-form-urlencoded`,accept:a?`application/json`:null}}const h=new Set([`request`,`header`,`data`,`data-raw`,`data-binary`,`data-ascii`,`data-urlencode`,`json`,`form`,`form-string`,`output`,`dump-header`,`write-out`,`max-time`,`user`,`referer`,`range`,`url`,`tab`,`frame`]),g=new Set([`silent`,`show-error`,`include`,`head`,`verbose`,`fail`,`location`,`remote-name`,`get`,`no-credentials`,`help`]),_={X:`request`,H:`header`,d:`data`,F:`form`,o:`output`,D:`dump-header`,w:`write-out`,m:`max-time`,u:`user`,e:`referer`,r:`range`},v={s:`silent`,S:`show-error`,i:`include`,I:`head`,v:`verbose`,f:`fail`,L:`location`,O:`remote-name`,G:`get`,h:`help`},y={cert:`client certificates are the browser profile's to present, not the shell's`,"cert-type":`client certificates are the browser profile's to present, not the shell's`,key:`client certificates are the browser profile's to present, not the shell's`,cacert:`the browser decides which roots to trust`,capath:`the browser decides which roots to trust`,insecure:`the browser enforces TLS verification; a page cannot opt out`,proxy:`proxying is configured on the browser, not per request`,"proxy-user":`proxying is configured on the browser, not per request`,interface:`a page cannot choose an outgoing interface`,"unix-socket":`a page cannot dial a unix socket`,resolve:`a page cannot override DNS resolution`,compressed:`always on — the browser negotiates encoding itself`,cookie:"the tab's own cookies are already sent; set one with `playwright-cli cookie-set`","cookie-jar":"cookies live in the browser profile; read them with `playwright-cli cookies`","limit-rate":`a page cannot throttle a fetch`,"continue-at":"a page fetch cannot resume; use `-H 'Range: bytes=N-'`","connect-timeout":"a page fetch cannot time the connect phase alone; use `--max-time`","http1.1":`the browser negotiates the HTTP version`,http2:`the browser negotiates the HTTP version`,http3:`the browser negotiates the HTTP version`,"no-buffer":`responses are read whole, never streamed to stdout`,"trace-ascii":"no wire trace exists; use `playwright-cli network-requests`",trace:"no wire trace exists; use `playwright-cli network-requests`","user-agent":`User-Agent is a forbidden header name for fetch(); the tab sets it`},b={k:`insecure`,x:`proxy`,b:`cookie`,c:`cookie-jar`,E:`cert`,C:`continue-at`,N:`no-buffer`,A:`user-agent`};function ee(){return{url:null,requestMethod:null,headers:[],data:[],form:[],get:!1,output:null,remoteName:!1,include:!1,head:!1,dumpHeader:null,writeOut:null,silent:!1,showError:!1,verbose:!1,failOnError:!1,maxTimeSeconds:null,credentials:`include`,tab:null,frame:null,user:null,referer:null,range:null,help:!1}}function x(e,t){return{message:`curlwright: option ${e} is not supported in a page context — ${y[t]}`,exitCode:2}}function S(e){return{message:`curlwright: unknown option ${e}\nRun 'curlwright --help' for the supported flags.`,exitCode:2}}function C(e){let t=e.indexOf(`:`);if(t===-1)return e.endsWith(`;`)?{name:e.slice(0,-1).trim(),value:``,unset:!1}:{name:e.trim(),value:``,unset:!1};let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();return{name:n,value:r,unset:r===``}}function w(e,t,n,r){switch(t){case`request`:return e.requestMethod=n,null;case`header`:return e.headers.push(C(n??``)),null;case`data`:case`data-ascii`:return e.data.push({kind:`ascii`,value:n??``}),null;case`data-raw`:return e.data.push({kind:`raw`,value:n??``}),null;case`data-binary`:return e.data.push({kind:`binary`,value:n??``}),null;case`data-urlencode`:return e.data.push({kind:`urlencode`,value:n??``}),null;case`json`:return e.data.push({kind:`json`,value:n??``}),null;case`form`:return e.form.push({value:n??``,literal:!1}),null;case`form-string`:return e.form.push({value:n??``,literal:!0}),null;case`output`:return e.output=n,null;case`dump-header`:return e.dumpHeader=n,null;case`write-out`:return e.writeOut=n,null;case`max-time`:return T(e,n,r);case`user`:return e.user=n,null;case`referer`:return e.referer=n,null;case`range`:return e.range=n,null;case`url`:return e.url=n,null;case`tab`:return e.tab=n,null;case`frame`:return e.frame=n,null;default:return E(e,t,r)}}function T(e,t,n){let r=Number(t);return!Number.isFinite(r)||r<=0?{message:`curlwright: ${n} expects a positive number of seconds`,exitCode:2}:(e.maxTimeSeconds=r,null)}function E(e,t,n){switch(t){case`silent`:return e.silent=!0,null;case`show-error`:return e.showError=!0,null;case`include`:return e.include=!0,null;case`head`:return e.head=!0,null;case`verbose`:return e.verbose=!0,null;case`fail`:return e.failOnError=!0,null;case`location`:return null;case`remote-name`:return e.remoteName=!0,null;case`get`:return e.get=!0,null;case`no-credentials`:return e.credentials=`omit`,null;case`help`:return e.help=!0,null;default:return S(n)}}function te(e,t,n){let r=t[n],i=r.indexOf(`=`),a=(i===-1?r.slice(2):r.slice(2,i)).trim(),o=i===-1?null:r.slice(i+1);if(a in y)return x(`--${a}`,a);if(h.has(a)){let r=o??t[n+1];return r===void 0?{message:`curlwright: option --${a} requires a value`,exitCode:2}:w(e,a,r,`--${a}`)??{next:o===null?n+2:n+1}}return g.has(a)?w(e,a,null,`--${a}`)??{next:n+1}:S(`--${a}`)}function ne(e,t,n){let r=t[n];for(let i=1;i<r.length;i++){let a=r[i];if(a in b)return x(`-${a}`,b[a]);if(a in _){let o=r.slice(i+1),s=o===``?t[n+1]:o;return s===void 0?{message:`curlwright: option -${a} requires a value`,exitCode:2}:w(e,_[a],s,`-${a}`)??{next:o===``?n+2:n+1}}if(!(a in v))return S(`-${a}`);let o=w(e,v[a],null,`-${a}`);if(o)return o}return{next:n+1}}function re(e,t){return e.url!==null&&e.url!==t?{message:`curlwright: only one URL is supported (got "${e.url}" and "${t}")`,exitCode:2}:(e.url=t,null)}function ie(e){let t=ee(),n=0,r=!1;for(;n<e.length;){let i=e[n];if(!r&&i===`--`){r=!0,n++;continue}if(!r&&i.startsWith(`--`)){let r=te(t,e,n);if(`message`in r)return r;n=r.next;continue}if(!r&&i.startsWith(`-`)&&i.length>1){let r=ne(t,e,n);if(`message`in r)return r;n=r.next;continue}let a=re(t,i);if(a)return a;n++}return t}function ae(e){return`message`in e}const D={"accept-charset":`the browser sets it`,"accept-encoding":`the browser negotiates encoding`,connection:`the browser owns the connection`,"content-length":`derived from the body`,cookie:"the tab's cookies are sent already; set one with `playwright-cli cookie-set`",cookie2:`the tab's cookies are sent already`,date:`the browser sets it`,dnt:`the browser sets it`,expect:`a page fetch cannot send it`,host:`derived from the URL`,"keep-alive":`the browser owns the connection`,origin:`the tab's own origin is sent automatically`,referer:`use -e/--referer, which sets the fetch referrer`,te:`the browser owns transfer encoding`,trailer:`the browser owns transfer encoding`,"transfer-encoding":`the browser owns transfer encoding`,upgrade:`the browser owns the connection`,via:`the browser sets it`};function oe(e){let t=e.toLowerCase();return t in D?D[t]:t.startsWith(`proxy-`)?`proxying is configured on the browser`:t.startsWith(`sec-`)?`Sec- headers are reserved for the browser`:null}function se(e){for(let t of e){let e=oe(t.name);if(e)return{message:`curlwright: header "${t.name}" cannot be set from a page — ${e}`,exitCode:2}}return null}function O(e,t){let n=t.toLowerCase();return Object.keys(e).some(e=>e.toLowerCase()===n)}function k(e){let t={},n=new Set;for(let r of e.headers)if(r.name!==``){if(r.unset){n.add(r.name.toLowerCase());continue}t[r.name]=r.value}return{headers:t,suppressed:n}}function A(e,t,n){return!O(e,n)&&!t.has(n)}function j(e){return/^[a-zA-Z]+=/.test(e)?e:`bytes=${e}`}function M(e,t,n,r){n.user!==null&&A(e,t,`authorization`)&&(e.Authorization=`Basic ${btoa(n.user)}`),n.range!==null&&A(e,t,`range`)&&(e.Range=j(n.range)),r.contentType&&A(e,t,`content-type`)&&(e[`Content-Type`]=r.contentType),r.accept&&A(e,t,`accept`)&&(e.Accept=r.accept)}function N(e,t){if(t===``)return e;let[n,r]=P(e);return`${n}${n.includes(`?`)?`&`:`?`}${t}${r}`}function P(e){let t=e.indexOf(`#`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t)]}function F(e,t){return e.requestMethod?e.requestMethod:e.head?`HEAD`:t?`POST`:`GET`}function I(e,t,n){let r=e.toUpperCase();return!t||r!==`GET`&&r!==`HEAD`?null:{message:`curlwright: ${n.requestMethod?`-X ${n.requestMethod}`:`-I`} cannot carry a request body — a page fetch rejects a ${r} with one. Drop the data, or use -G to send it as a query string.`,exitCode:2}}function L(e,t){if(e.url===null)return{message:`curlwright: no URL specified`,exitCode:2};let{headers:n,suppressed:r}=k(e),i=e.get&&t.bytes!==null,a=i?{...t,bytes:null,contentType:null}:t;M(n,r,e,a);let o=i?N(e.url,new TextDecoder().decode(t.bytes??new Uint8Array)):e.url,s=a.bytes!==null||a.form!==null,c=F(e,s),l=I(c,s,e);if(l)return l;let u={method:c,headers:n,credentials:e.credentials,responseType:`binary`};return a.form?u.body=a.form:a.bytes&&(u.body=a.bytes),e.referer!==null&&(u.referrer=e.referer),e.maxTimeSeconds!==null&&(u.timeoutMs=e.maxTimeSeconds*1e3),{url:o,method:c,fetchOptions:u,uploadSize:a.bytes?.length??0}}function R(e){let t=e.fetchOptions.headers??{},n=[`> ${e.method} ${e.url}`];for(let[e,r]of Object.entries(t))n.push(`> ${e}: ${r}`);return n.push(`> `),`${n.join(`
|
|
2
2
|
`)}\n`}function z(e,t){let n=[`< ${e}`];for(let[e,r]of Object.entries(t))n.push(`< ${e}: ${r}`);return n.push(`< `),`${n.join(`
|
|
3
3
|
`)}\n`}function B(t,n){return typeof t==`string`?n===`base64`?e(t):new TextEncoder().encode(t):new Uint8Array}function V(e,t){return t?`HTTP/1.1 ${e} ${t}`:`HTTP/1.1 ${e}`}function H(e,t,n){let r=[V(e,t)];for(let[e,t]of Object.entries(n))r.push(`${e}: ${t}`);return`${r.join(`\r
|
|
4
4
|
`)}\r\n\r\n`}function U(e){if(e.includes(0))return!0;try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(e),!1}catch{return!0}}function W(e){let t;try{t=new URL(e).pathname}catch{t=e.split(`?`)[0]}return t.replace(/\/+$/,``).split(`/`).pop()||null}function G(e,t,n){return new TextEncoder().encode(H(e,t,n)).length}function K(e){try{return new URL(e).origin}catch{return null}}function q(e){return e.map(e=>` --tab=${e.targetId} ${e.url}`).join(`
|