sliccy 6.166.0 → 6.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/node-server/_shared/base64.d.ts.map +1 -1
- package/dist/node-server/_shared/base64.js +7 -3
- package/dist/node-server/_shared/base64.js.map +1 -1
- package/dist/node-server/_shared/computer-protocol.d.ts +2 -0
- package/dist/node-server/_shared/computer-protocol.d.ts.map +1 -1
- package/dist/node-server/_shared/tray-sync-protocol.d.ts +66 -2
- package/dist/node-server/_shared/tray-sync-protocol.d.ts.map +1 -1
- package/dist/node-server/_shared/tray-sync-protocol.js +75 -2
- package/dist/node-server/_shared/tray-sync-protocol.js.map +1 -1
- package/dist/ui/.vite/manifest.json +274 -260
- package/dist/ui/assets/SKILL-CWR-bsvH.js +1 -0
- package/dist/ui/assets/{account-store-BEqmysw9.js → account-store-B05_LKnj.js} +1 -1
- package/dist/ui/assets/{account-store-C35GYvum.js → account-store-CNTI4kr_.js} +2 -2
- package/dist/ui/assets/{adobe-BDH5oLAN.js → adobe-CRRWEbtf.js} +2 -2
- package/dist/ui/assets/{adobe-BcTGFCnQ.js → adobe-nu3irXcy.js} +1 -1
- package/dist/ui/assets/{agent-panels-DvqNnkLk.js → agent-panels-DvH_qfTh.js} +1 -1
- package/dist/ui/assets/{almost-bash-shell-headless-DqTtE9CM.js → almost-bash-shell-headless-BA5r_r61.js} +35 -35
- package/dist/ui/assets/{apply-layout-CjYRGs37.js → apply-layout-CASSSWEy.js} +1 -1
- package/dist/ui/assets/{apps-dzoLZ_5W.js → apps-BGe9_zJ7.js} +1 -1
- package/dist/ui/assets/{azure-openai-DKGdcr4S.js → azure-openai-C-Iw82HZ.js} +1 -1
- package/dist/ui/assets/{azure-openai-BffwoCtp.js → azure-openai-DuJciOKd.js} +1 -1
- package/dist/ui/assets/{backend-hostfs-CWIlIhve.js → backend-hostfs-DdAVlPMP.js} +1 -1
- package/dist/ui/assets/{base64-DzRgusa4.js → base64-BPBW1Gzr.js} +1 -1
- package/dist/ui/assets/{base64-DJRlyqZu.js → base64-ELzoYfwP.js} +1 -1
- package/dist/ui/assets/{capability-Ci9JmpEG.js → capability-C2eJ1wdx.js} +2 -2
- package/dist/ui/assets/{cdp-DXT6yEL1.js → cdp-DG8TVjf3.js} +1 -1
- package/dist/ui/assets/{cerebras-BF5efkRL.js → cerebras-BXwtUxTj.js} +1 -1
- package/dist/ui/assets/{cerebras-By0l7t0i.js → cerebras-Xadzrxfp.js} +1 -1
- package/dist/ui/assets/{client-B6iKb_ye.js → client-BDN4zG90.js} +1 -1
- package/dist/ui/assets/{composer-speech-DIEePbQC.js → composer-speech-_uq5e0Bo.js} +1 -1
- package/dist/ui/assets/{connect-surface-DBqs7oHf.js → connect-surface-odDz37TJ.js} +1 -1
- package/dist/ui/assets/{core-BMcS6rur.js → core-BoFWHLIW.js} +1 -1
- package/dist/ui/assets/{core-DP-MJcag.js → core-Bvc89tkf.js} +1 -1
- package/dist/ui/assets/{directed-approval-D1lGElvD.js → directed-approval-D_AXAvuz.js} +1 -1
- package/dist/ui/assets/{discovery-preference-Bw3Fi0jd.js → discovery-preference-TziZ7Yxu.js} +1 -1
- package/dist/ui/assets/encode-frame-B8GkHc2t.js +1 -0
- package/dist/ui/assets/engine-D531XNHE.js +1 -0
- package/dist/ui/assets/{ensure-speech-assets-BJXemBO4.js → ensure-speech-assets-DTj236n-.js} +1 -1
- package/dist/ui/assets/{extension-media-capture-BvLVZFQ0.js → extension-media-capture-DMB4r9UQ.js} +1 -1
- package/dist/ui/assets/{extension-ops-B0oi7ypc.js → extension-ops-DNPAsYbK.js} +1 -1
- package/dist/ui/assets/fake-computer-Jawax3MO.js +352 -0
- package/dist/ui/assets/{float-topology-YtctpJaG.js → float-topology-CurCyQFy.js} +1 -1
- package/dist/ui/assets/{follower-navigate-watcher-DnnHgZbM.js → follower-navigate-watcher-C98XMw_C.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-DYPhPMg7.js → frozen-archive-writer-BIzZxx8R.js} +1 -1
- package/dist/ui/assets/{fs-CBH-hQcI.js → fs-Bq8bUwe2.js} +1 -1
- package/dist/ui/assets/{fs-BapOupIM.js → fs-CJs9n90Q.js} +2 -2
- package/dist/ui/assets/{gelatiere-store-C2u47uk0.js → gelatiere-store-BY0hZvSS.js} +1 -1
- package/dist/ui/assets/{gelatiere-unit-wvDEO7gH.js → gelatiere-unit-DrQwRL3O.js} +1 -1
- package/dist/ui/assets/{github-Bx7_6LBm.js → github-D1gd3q6u.js} +2 -2
- package/dist/ui/assets/{github-auth-DtKS6UIX.js → github-auth-CzzE1eDf.js} +1 -1
- package/dist/ui/assets/{github-copilot-CtOjxhqK.js → github-copilot-Bx2lXrwK.js} +1 -1
- package/dist/ui/assets/{github-copilot-eCfmryv6.js → github-copilot-DidNEEe_.js} +1 -1
- package/dist/ui/assets/{github-install-B6W4-xcc.js → github-install--_xp8s-S.js} +1 -1
- package/dist/ui/assets/{github-Db015Tee.js → github-uDwUwz5H.js} +1 -1
- package/dist/ui/assets/{github-zip-Bv1smNmy.js → github-zip-Bs35nBig.js} +1 -1
- package/dist/ui/assets/{guest-tool-gate-Mu-876Hm.js → guest-tool-gate-B-lZT9hl.js} +1 -1
- package/dist/ui/assets/{hear-BZHckZJM.js → hear-BNmJphKg.js} +1 -1
- package/dist/ui/assets/{help-BU2Hjl0P.js → help-C7Nq107k.js} +1 -1
- package/dist/ui/assets/host-iTtS0MRF.js +1 -0
- package/dist/ui/assets/{image-markers-DuyWsic3.js → image-markers-CwM1dvoI.js} +1 -1
- package/dist/ui/assets/{image-markers-BFDmhPy4.js → image-markers-q8JQTtid.js} +1 -1
- package/dist/ui/assets/{installer-BbtH3u7z.js → installer-C0xiAs69.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-BT3mfq3w.js → js-realm-worker-B9Rz0g1p.js} +2 -2
- package/dist/ui/assets/jsh-CmIpo35m.js +1 -0
- package/dist/ui/assets/{jsh-executor-BWlgcE2N.js → jsh-executor-C7QPZ2Qr.js} +3 -3
- package/dist/ui/assets/{jsh-runtime-extensions-BnLXkzqP.js → jsh-runtime-extensions-ddeGEOUw.js} +1 -1
- package/dist/ui/assets/{kernel-worker-Dseu067f.js → kernel-worker-4aPSVJ1C.js} +10 -10
- package/dist/ui/assets/keys-Dexx8cLD.js +1 -0
- package/dist/ui/assets/{lick-ws-bridge-Cc9sToY7.js → lick-ws-bridge-BcAhlead.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-ChigxI36.js → lick-ws-bridge-DZ0vVYNF.js} +1 -1
- package/dist/ui/assets/{live-session-snapshot-B70raB09.js → live-session-snapshot-COMr2v0o.js} +1 -1
- package/dist/ui/assets/{local-llm-Dcp5IIP-.js → local-llm-DdGb9WMG.js} +1 -1
- package/dist/ui/assets/{local-llm-DpSg-Oe3.js → local-llm-DqeU7kV3.js} +1 -1
- package/dist/ui/assets/{main-cherry-VckJPHm5.js → main-cherry-BGZmJFd_.js} +1 -1
- package/dist/ui/assets/{main-CfF8CFBr.js → main-jc6OS8lz.js} +3 -3
- package/dist/ui/assets/{memory-curation-seam-DUaZFZG9.js → memory-curation-seam-B8pprlUo.js} +1 -1
- package/dist/ui/assets/{memory-health-D7uEvfAx.js → memory-health-CGkpyA7o.js} +1 -1
- package/dist/ui/assets/memory-v2-flag-DVbOtPFF.js +1 -0
- package/dist/ui/assets/{memory-write-execute-rXtR1z76.js → memory-write-execute-B-ahXjaO.js} +1 -1
- package/dist/ui/assets/{mount-8lU2iH4k.js → mount-BzdPNQoA.js} +3 -3
- package/dist/ui/assets/{mount-DoM0CLGG.js → mount-FkNAB0be.js} +1 -1
- package/dist/ui/assets/{mount-bridge-client-3a86Q6J0.js → mount-bridge-client-BO0N4wwP.js} +1 -1
- package/dist/ui/assets/{mount-bridge-client-CO2HxXrT.js → mount-bridge-client-CRnohfom.js} +1 -1
- package/dist/ui/assets/{new-session-DEhAjxP1.js → new-session-B8iOhaK0.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-DNTgbEZF.js → oauth-bootstrap-B9PwK4-d.js} +2 -2
- package/dist/ui/assets/{oauth-service-BsW9nY_u.js → oauth-service-Bkaz0Dt4.js} +1 -1
- package/dist/ui/assets/{oauth-service-IlBYPvwr.js → oauth-service-UTPOqIwj.js} +1 -1
- package/dist/ui/assets/{onboarding-orchestrator-DzPQ0pVG.js → onboarding-orchestrator-Cc8Glrem.js} +1 -1
- package/dist/ui/assets/{openai-codex-DYRKYWTe.js → openai-codex-BrQ1tsgu.js} +1 -1
- package/dist/ui/assets/{openai-codex-CsAhfz0D.js → openai-codex-DmHr_2RR.js} +1 -1
- package/dist/ui/assets/{openrouter-IyZlRHg4.js → openrouter-BvM36eS5.js} +1 -1
- package/dist/ui/assets/{openrouter-D9T6tXUF.js → openrouter-C6WDBJvB.js} +1 -1
- package/dist/ui/assets/{openrouter-free-DfbYsnmf.js → openrouter-free-CFBzPY5J.js} +1 -1
- package/dist/ui/assets/{openrouter-free-CPshAgQD.js → openrouter-free-CUKlyrhq.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-xKlWi_wI.js → openrouter-oauth-DOdpRMfw.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-hZg6oH0A.js → openrouter-oauth-RC0CxY4X.js} +1 -1
- package/dist/ui/assets/{opfs-mount-C9Iamj6N.js → opfs-mount-B78yj9gx.js} +1 -1
- package/dist/ui/assets/{page-approval-service-B8t-buCi.js → page-approval-service-Dy-UA1aK.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-Nu-wOrG9.js → panel-rpc-handlers-CQ_iaU6N.js} +2 -2
- package/dist/ui/assets/panelize-shell-CFPiIneK.js +4 -0
- package/dist/ui/assets/{pi-edit-execution-D6vx5LyF.js → pi-edit-execution-BDl_Xp_M.js} +1 -1
- package/dist/ui/assets/{port-bridge-client-Ds3xwapn.js → port-bridge-client-H03Pohgj.js} +1 -1
- package/dist/ui/assets/{port-bridge-client-Dn8JtUyP.js → port-bridge-client-ff8DctEN.js} +1 -1
- package/dist/ui/assets/{provider-Z5aj7SzG.js → provider-1ByYSphI.js} +2 -2
- package/dist/ui/assets/{provider-3--cEcAF.js → provider-Df8LFEZ7.js} +1 -1
- package/dist/ui/assets/{provider-settings-D9sjEfYE.js → provider-settings-Bk-fk9dp.js} +1 -1
- package/dist/ui/assets/provider-store-access-BJPbOUku.js +1 -0
- package/dist/ui/assets/provider-store-access-BrjCBzpb.js +1 -0
- package/dist/ui/assets/{providers-CnoKdyLc.js → providers-Q92pCQ8h.js} +2 -2
- package/dist/ui/assets/{providers-DVvrXbtx.js → providers-T_FH_8cU.js} +1 -1
- package/dist/ui/assets/{proxied-fetch-DyBveeCl.js → proxied-fetch-Bl8AeYdt.js} +1 -1
- package/dist/ui/assets/{proxied-fetch-DEK8DT-z.js → proxied-fetch-DARKNygr.js} +1 -1
- package/dist/ui/assets/{quick-llm-DjWE-wQw.js → quick-llm-CbGHjrhX.js} +1 -1
- package/dist/ui/assets/{realm-inprocess-D0iWBQzz.js → realm-inprocess-CWMnXeN3.js} +2 -2
- package/dist/ui/assets/{recovery-screen-Y1CSyfR-.js → recovery-screen-DhUqOdby.js} +1 -1
- package/dist/ui/assets/{redirect-uri-CgKdq7-K.js → redirect-uri-Dd0j1fSp.js} +1 -1
- package/dist/ui/assets/{request-body-DkfS6k_a.js → request-body-BF4moGct.js} +1 -1
- package/dist/ui/assets/{rest-ops-C8YK53pT.js → rest-ops-CQOwDiTR.js} +1 -1
- package/dist/ui/assets/{rest-ops-DNanZY2-.js → rest-ops-DkUeDpiM.js} +1 -1
- package/dist/ui/assets/{restore-DOkDX8BI.js → restore-CVkulBmU.js} +1 -1
- package/dist/ui/assets/{run-BOkp5G58.js → run-1aYSFTwj.js} +2 -2
- package/dist/ui/assets/{run-B-fA26ea.js → run-BX9uHbIi.js} +1 -1
- package/dist/ui/assets/{run-BOc9XLhg.js → run-COfTem8j.js} +1 -1
- package/dist/ui/assets/{run-BWJSDhS7.js → run-CUCg2cJM.js} +2 -2
- package/dist/ui/assets/{run-Bld9B0W0.js → run-CreCrLyX.js} +1 -1
- package/dist/ui/assets/{run-DgNh1E56.js → run-DgVV_DFr.js} +3 -3
- package/dist/ui/assets/{run-D0C4PgZM.js → run-DuW-7oJj.js} +2 -2
- package/dist/ui/assets/run-DvD576xV.js +53 -0
- package/dist/ui/assets/{run-vEDh-Me-.js → run-IexPmM2B.js} +2 -2
- package/dist/ui/assets/{run-a67LpkRp.js → run-ZmpHaamT.js} +2 -2
- package/dist/ui/assets/{screencapture-media-B1iFS6Qy.js → screencapture-media-DL5YxrlG.js} +1 -1
- package/dist/ui/assets/{screencapture-run-XrgS6hEd.js → screencapture-run-yMA5c_HS.js} +1 -1
- package/dist/ui/assets/{secret-env-CDLWFhsq.js → secret-env-BhWGz7yx.js} +1 -1
- package/dist/ui/assets/secret-topology-CVneCnID.js +1 -0
- package/dist/ui/assets/{secrets-bridge-client-ZpBL1Zhl.js → secrets-bridge-client-BS3V1JBF.js} +1 -1
- package/dist/ui/assets/{secrets-bridge-client--VZ3E0yk.js → secrets-bridge-client-C0tvQeuX.js} +1 -1
- package/dist/ui/assets/{session-command-memory-DB2GmPSU.js → session-command-memory-DzuRy-nC.js} +2 -2
- package/dist/ui/assets/{session-jsonl-DFC-2T76.js → session-jsonl-D01HYAS2.js} +1 -1
- package/dist/ui/assets/{session-jsonl-D_pTYppB.js → session-jsonl-iOOR_32X.js} +1 -1
- package/dist/ui/assets/{session-search-index-CN1zDLlx.js → session-search-index-CABvtt-r.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-BVd31Z12.js → setup-feature-flags-remote-CvstKwBW.js} +1 -1
- package/dist/ui/assets/{signed-fetch-BY2Mdjqe.js → signed-fetch-7NwdVmf1.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-CKAAh6GN.js → silent-renew-backoff-CXHqSiPb.js} +1 -1
- package/dist/ui/assets/slicc-version-CN6V2aMa.js +1 -0
- package/dist/ui/assets/{snapshot-gi8tDzvN.js → snapshot-BcYaw9Ip.js} +1 -1
- package/dist/ui/assets/{snapshot-features-DjMJkCGq.js → snapshot-features-3xslkGtL.js} +1 -1
- package/dist/ui/assets/{soundscape-Bl3LhUk9.js → soundscape-TygolFwj.js} +1 -1
- package/dist/ui/assets/{speak-BY_fDou2.js → speak-BCLm04Z2.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-C-NUJqPy.js → sprinkle-manager-DDzNanda.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-CcA6ie5u.js → sprinkle-renderer-B-CADNjq.js} +1 -1
- package/dist/ui/assets/{state-z3wOHLww.js → state-BCTAzK_L.js} +1 -1
- package/dist/ui/assets/{store-ByUcAFUa.js → store-C-AW4ogv.js} +1 -1
- package/dist/ui/assets/{store-ChWzn_H8.js → store-CzlK9KIc.js} +1 -1
- package/dist/ui/assets/{sudo-DNZFIZ-H.js → sudo-BtkDnUA_.js} +1 -1
- package/dist/ui/assets/{supervisor-BtH2-9sE.js → supervisor-B6-QPxI3.js} +1 -1
- package/dist/ui/assets/{sync-dialog-Jqz74VkZ.js → sync-dialog-B4G7kCwj.js} +1 -1
- package/dist/ui/assets/{transformers-env-pq1E2H6B.js → transformers-env-1TbBNkOp.js} +1 -1
- package/dist/ui/assets/{tray-leader-Bas0lH9O.js → tray-leader-_KISvFyF.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-B9aV_guA.js → tray-leave-runtime-CRsRkPHc.js} +1 -1
- package/dist/ui/assets/{tray-runtime-config-BZoJXfW0.js → tray-runtime-config-BVgVR3H2.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-DA8NfCV6.js → tray-sidecar-BRvCb-i7.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-B5ym__Gu.js → upgrade-detection-C5daiUbn.js} +1 -1
- package/dist/ui/assets/{upskill-lick-skip-CZGM2OFA.js → upskill-lick-skip-C2ZQ0c2-.js} +1 -1
- package/dist/ui/assets/v86-BfdTUFBK.js +1 -0
- package/dist/ui/assets/voice-reply-Dk4ztuZL.js +1 -0
- package/dist/ui/assets/{wc-attach-C5yXIQNU.js → wc-attach-CFj2ZF5_.js} +3 -3
- package/dist/ui/assets/wc-browser-BFL2Tl8W.js +1 -0
- package/dist/ui/assets/wc-computers-CcJuQUyG.js +3 -0
- package/dist/ui/assets/{wc-detached-f_qit-5b.js → wc-detached-ncc8KuL1.js} +1 -1
- package/dist/ui/assets/{wc-extension-DRx21-cq.js → wc-extension-DppNe2VK.js} +2 -2
- package/dist/ui/assets/{wc-follower-DcKt92kM.js → wc-follower-CcxFCW-y.js} +3 -3
- package/dist/ui/assets/wc-follower-oauth-DQ-JPxl6.js +5 -0
- package/dist/ui/assets/{wc-gelatiere-qAW7lWGW.js → wc-gelatiere-CANPh9TU.js} +1 -1
- package/dist/ui/assets/wc-live-BLozTZsg.js +427 -0
- package/dist/ui/assets/{wc-nav-DzPuXq_n.js → wc-nav-BlLpBAJG.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-CXM-z-7_.js → wc-onboarding-OKaUOQ3X.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-BBqbsuml.js → wc-placeholder-BrX9-mPv.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-BSUlxVVi.js → wc-secret-request-QPmTs_eW.js} +1 -1
- package/dist/ui/assets/{wc-settings-55mC-jVS.js → wc-settings-BFgFDtTk.js} +3 -3
- package/dist/ui/assets/{wc-shell-C71iKreG.js → wc-shell-CCKjmASt.js} +242 -187
- package/dist/ui/assets/{wc-shortcut-config-Crjq_rF1.js → wc-shortcut-config-CeUoljrV.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-Caji5y7n.js → wc-sprinkles-BNp18_jW.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-Dqe3SH1t.js → wc-transcript-export-DJnnZ8L-.js} +2 -2
- package/dist/ui/assets/wc-tray-f1LxbB98.js +5 -0
- package/dist/ui/assets/welcome-detection-Dg9THpkh.js +1 -0
- package/dist/ui/assets/{whisper-session-DfILe4Yb.js → whisper-session-CMiImrJg.js} +2 -2
- package/dist/ui/assets/{xai-grok-CVLBrxdD.js → xai-grok-BMr5udF6.js} +1 -1
- package/dist/ui/assets/{xai-grok-Dp8n52fO.js → xai-grok-Dzeo18XM.js} +1 -1
- package/dist/ui/index.html +11 -11
- package/dist/ui/packages/webapp/index.html +11 -11
- package/package.json +1 -1
- package/dist/ui/assets/SKILL-DB5CVwyu.js +0 -1
- package/dist/ui/assets/engine-B-OPe78i.js +0 -1
- package/dist/ui/assets/fake-computer-1f2_4vxY.js +0 -65
- package/dist/ui/assets/host-BQ2qKD-D.js +0 -1
- package/dist/ui/assets/jsh-CrSWPG4t.js +0 -1
- package/dist/ui/assets/keys-n5_C9sHW.js +0 -1
- package/dist/ui/assets/memory-v2-flag-BHVbti6Z.js +0 -1
- package/dist/ui/assets/panelize-shell-tFElgHWF.js +0 -4
- package/dist/ui/assets/provider-store-access-M0PvJ08M.js +0 -1
- package/dist/ui/assets/provider-store-access-RxIHhH6d.js +0 -1
- package/dist/ui/assets/run-BEt0RS3J.js +0 -52
- package/dist/ui/assets/secret-topology-DLJBhHOi.js +0 -1
- package/dist/ui/assets/slicc-version-BZyTvfoc.js +0 -1
- package/dist/ui/assets/v86-DseFx8Yp.js +0 -1
- package/dist/ui/assets/voice-reply-CL5tDo0l.js +0 -1
- package/dist/ui/assets/wc-browser-DO1Pnegi.js +0 -1
- package/dist/ui/assets/wc-follower-oauth-BF3qXDTt.js +0 -5
- package/dist/ui/assets/wc-live-DOMCfDT6.js +0 -427
- package/dist/ui/assets/wc-tray-B7ayzT1W.js +0 -5
- package/dist/ui/assets/welcome-detection-CEARSpAq.js +0 -1
|
@@ -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-BZyTvfoc.js";import{t as a}from"./buffer-polyfill-BccMjOKj.js";import{t as o}from"./buffer-B5d1xHaH.js";import{F as s,I as c,N as l,P as u}from"./shared-C_68vn79.js";import{I as d,M as f,R as p,T as m,_ as h,c as g,g as _,i as v,j as y,l as b,n as x,r as S,s as C,w}from"./sync-sab-wire-CC30v4TL.js";import{t as T}from"./tmpdir-env-ate4iNcK.js";import{t as E}from"./realm-browser-fetch-V3uggGbM.js";function D(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 O(e){let t=D(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function k(e){return Object.assign(Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function A(e){return Object.assign(Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function ee(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 te=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=D(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,symlinkTarget:t.symlinkTarget,truncated:t.truncated,size:t.size}),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=O(D(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=O(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=D(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=[...D(e.startsWith(`/`)?e:`${O(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=O(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0,!0))}isPartial(e){return this.tree.get(D(e))?.partial===!0}commitWrite(e,t){this.writeFile(e,t);let n=D(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=O(n)}}readFile(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t)?.entry;if(!n||n.isDirectory)throw k(t);if(n.truncated)throw A(t);return n.content}writeFile(e,t){this.touched=!0;let n=D(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=D(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t);if(!n)throw k(t);return this.toStat(n.entry)}lstat(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t,!0);if(!n)throw k(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=D(e),n=this.resolveEntry(t);if(!n?.entry.isDirectory)throw k(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=D(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=O(r);if(i!==`/`&&!this.tree.has(i)){if(!t)throw k(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=D(e),r=this.tree.get(n);if(!r)throw k(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=D(e),r=this.tree.get(n);if(!r||r.isDirectory)throw k(n);if(r.truncated)throw A(n);let i=D(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=D(e),r=this.tree.get(n);if(!r)throw k(n);let i=D(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=D(e),n=this.tree.get(t);if(!n)throw k(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=D(e);this.tombstones.add(n),t&&this.removedDirs.add(n)}isTombstoned(e){let t=D(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=D(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&&!ee(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 ne(){return globalThis.Buffer}function re(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function ie(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function ae(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function oe(e){return e===`/dev/stdin`||e===`/dev/stdout`||e===`/dev/stderr`}function se(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 ce(e,t){let n=se(e);if(n===0)return!0;if(n!==void 0||typeof e==`number`)throw ae(t,e);return!1}function le(e,t,n){let r=se(t);if(r===1)return e.writeStdout;if(r===2)return e.writeStderr;if(r!==void 0||typeof t==`number`)throw ae(n,t)}function ue(e){return typeof e==`string`?e:ie(xe(e))}function de(e,t){if(t===`utf8`||t===`utf-8`)return new TextDecoder().decode(e);let n=ne();return n?n.from(e):e}function fe(e){return typeof e==`string`?e:e?.encoding}function pe(){return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,isCharacterDevice:()=>!0,size:0}}function me(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(!ce(e,`read`))return n.readFile(e,r);let i=fe(r);if(i===null||i===`buffer`){let e=ne(),n=t.readStdinBytes();return e?e.from(n):n}return new TextDecoder().decode(t.readStdinBytes())},e.readFileBinary=async e=>ce(e,`read`)?t.readStdinBytes():n.readFileBinary(e),e.writeFile=async(e,r)=>{let i=le(t,e,`write`);return i?(i(ue(r)),!0):n.writeFile(e,r)},e.writeFileBinary=async(e,r)=>{let i=le(t,e,`write`);return i?(i(ie(r)),!0):n.writeFileBinary(e,r)},e.appendFile=async(e,r)=>{let i=le(t,e,`append`);if(!i)return n.appendFile(e,r);i(ue(r))},e.access=async e=>{if(!oe(e))return n.access(e)},e.exists=async e=>oe(e)||n.exists(e),e.stat=async e=>oe(e)?{isFile:!0,isDirectory:!1,size:0}:n.stat(e)}function he(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=typeof n==`string`?n:n?.encoding;if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=ne();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 me(p,n),p.promises=p,p}function j(e,t,n=``){return Object.assign(Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function ge(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 _e(e){let{syncFs:t,bridge:n,resolve:r,existsResolved:i,lstatResolved:a,statResolved:o,readBytes:s,writeThrough:c,persistDelete:l}=e,u=(e,r)=>ge(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 j(`ENOENT`,n,`rm`)},rmdirSync(e,t){let n=r(e);if(i(n)&&!a(n).isDirectory)throw j(`ENOTDIR`,n,`rmdir`);if(!u(n,{recursive:t?.recursive===!0}))throw j(`ENOENT`,n,`rmdir`)},unlinkSync(e){let t=r(e);if(!u(t,{requireFile:!0}))throw j(`ENOENT`,t,`unlink`)},renameSync(e,i){let a=r(e),l=r(i);try{t.rename(a,l);return}catch(e){if(e?.code!==`ENOENT`)throw e}if(!n||t.isTombstoned(a))throw j(`ENOENT`,a,`rename`);if(o(a).isDirectory)throw j(`EISDIR`,a,`rename`);if(c(l,s(a)),!u(a,{requireFile:!0}))throw j(`ENOENT`,a,`rename`)}}}function ve(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)=>ce(e,`read`)?de(t.readStdinBytes(),fe(r)):n.readFileSync(e,r),e.writeFileSync=(e,r)=>{let i=le(t,e,`write`);i?i(ue(r)):n.writeFileSync(e,r)},e.appendFileSync=(e,r)=>{let i=le(t,e,`append`);i?i(ue(r)):n.appendFileSync(e,r)},e.existsSync=e=>oe(e)||n.existsSync(e),e.accessSync=e=>{oe(e)||n.accessSync(e)},e.statSync=e=>oe(e)?pe():n.statSync(e),e.lstatSync=e=>oe(e)?pe():n.lstatSync(e)}function ye(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,n){let r=t=>e.isTombstoned(t);try{let i=e.readdir(n);if(!t||!e.isPartial(n)||r(n))return i;try{return ye(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 ye(n,[],t.readdir(n),r)}}function xe(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 Se(e,t,n,r,i){t?(t.writeFile(r,i),e.commitWrite(r,i)):(e.writeFile(r,i),n?.write?.(r,i))}function Ce(e,t,n,r,i){function a(e){return D(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)=>Se(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 be(e,n,t))p(f(t,i),f(r,i))}let m={..._e({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)),fe(t))},writeFileSync(e,t){s(a(e),xe(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=xe(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 j(`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 j(`ENOENT`,t,`realpath`);return t},readdirSync(t){return be(e,n,a(t))},copyFileSync(e,t){s(a(t),o(a(e)))},cpSync(e,t){p(a(e),a(t))},chmodSync(e){let t=a(e);if(!c(t))throw j(`ENOENT`,t,`chmod`)},mkdtempSync(t){return e.mkdtemp(a(t))}};return ve(m,r),m}function we(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-CN6V2aMa.js";import{t as a}from"./buffer-polyfill-BccMjOKj.js";import{t as o}from"./buffer-B5d1xHaH.js";import{F as s,I as c,N as l,P as u}from"./shared-C_68vn79.js";import{I as d,M as f,R as p,T as m,_ as h,c as g,g as _,i as v,j as y,l as b,n as x,r as S,s as C,w}from"./sync-sab-wire-CC30v4TL.js";import{t as T}from"./tmpdir-env-ate4iNcK.js";import{t as E}from"./realm-browser-fetch-V3uggGbM.js";function D(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 O(e){let t=D(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function k(e){return Object.assign(Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function A(e){return Object.assign(Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function ee(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 te=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=D(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,symlinkTarget:t.symlinkTarget,truncated:t.truncated,size:t.size}),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=O(D(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=O(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=D(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=[...D(e.startsWith(`/`)?e:`${O(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=O(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0,!0))}isPartial(e){return this.tree.get(D(e))?.partial===!0}commitWrite(e,t){this.writeFile(e,t);let n=D(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=O(n)}}readFile(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t)?.entry;if(!n||n.isDirectory)throw k(t);if(n.truncated)throw A(t);return n.content}writeFile(e,t){this.touched=!0;let n=D(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=D(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t);if(!n)throw k(t);return this.toStat(n.entry)}lstat(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t,!0);if(!n)throw k(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=D(e),n=this.resolveEntry(t);if(!n?.entry.isDirectory)throw k(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=D(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=O(r);if(i!==`/`&&!this.tree.has(i)){if(!t)throw k(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=D(e),r=this.tree.get(n);if(!r)throw k(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=D(e),r=this.tree.get(n);if(!r||r.isDirectory)throw k(n);if(r.truncated)throw A(n);let i=D(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=D(e),r=this.tree.get(n);if(!r)throw k(n);let i=D(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=D(e),n=this.tree.get(t);if(!n)throw k(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=D(e);this.tombstones.add(n),t&&this.removedDirs.add(n)}isTombstoned(e){let t=D(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=D(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&&!ee(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 ne(){return globalThis.Buffer}function re(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function ie(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function ae(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function oe(e){return e===`/dev/stdin`||e===`/dev/stdout`||e===`/dev/stderr`}function se(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 ce(e,t){let n=se(e);if(n===0)return!0;if(n!==void 0||typeof e==`number`)throw ae(t,e);return!1}function le(e,t,n){let r=se(t);if(r===1)return e.writeStdout;if(r===2)return e.writeStderr;if(r!==void 0||typeof t==`number`)throw ae(n,t)}function ue(e){return typeof e==`string`?e:ie(xe(e))}function de(e,t){if(t===`utf8`||t===`utf-8`)return new TextDecoder().decode(e);let n=ne();return n?n.from(e):e}function fe(e){return typeof e==`string`?e:e?.encoding}function pe(){return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,isCharacterDevice:()=>!0,size:0}}function me(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(!ce(e,`read`))return n.readFile(e,r);let i=fe(r);if(i===null||i===`buffer`){let e=ne(),n=t.readStdinBytes();return e?e.from(n):n}return new TextDecoder().decode(t.readStdinBytes())},e.readFileBinary=async e=>ce(e,`read`)?t.readStdinBytes():n.readFileBinary(e),e.writeFile=async(e,r)=>{let i=le(t,e,`write`);return i?(i(ue(r)),!0):n.writeFile(e,r)},e.writeFileBinary=async(e,r)=>{let i=le(t,e,`write`);return i?(i(ie(r)),!0):n.writeFileBinary(e,r)},e.appendFile=async(e,r)=>{let i=le(t,e,`append`);if(!i)return n.appendFile(e,r);i(ue(r))},e.access=async e=>{if(!oe(e))return n.access(e)},e.exists=async e=>oe(e)||n.exists(e),e.stat=async e=>oe(e)?{isFile:!0,isDirectory:!1,size:0}:n.stat(e)}function he(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=typeof n==`string`?n:n?.encoding;if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=ne();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 me(p,n),p.promises=p,p}function j(e,t,n=``){return Object.assign(Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function ge(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 _e(e){let{syncFs:t,bridge:n,resolve:r,existsResolved:i,lstatResolved:a,statResolved:o,readBytes:s,writeThrough:c,persistDelete:l}=e,u=(e,r)=>ge(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 j(`ENOENT`,n,`rm`)},rmdirSync(e,t){let n=r(e);if(i(n)&&!a(n).isDirectory)throw j(`ENOTDIR`,n,`rmdir`);if(!u(n,{recursive:t?.recursive===!0}))throw j(`ENOENT`,n,`rmdir`)},unlinkSync(e){let t=r(e);if(!u(t,{requireFile:!0}))throw j(`ENOENT`,t,`unlink`)},renameSync(e,i){let a=r(e),l=r(i);try{t.rename(a,l);return}catch(e){if(e?.code!==`ENOENT`)throw e}if(!n||t.isTombstoned(a))throw j(`ENOENT`,a,`rename`);if(o(a).isDirectory)throw j(`EISDIR`,a,`rename`);if(c(l,s(a)),!u(a,{requireFile:!0}))throw j(`ENOENT`,a,`rename`)}}}function ve(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)=>ce(e,`read`)?de(t.readStdinBytes(),fe(r)):n.readFileSync(e,r),e.writeFileSync=(e,r)=>{let i=le(t,e,`write`);i?i(ue(r)):n.writeFileSync(e,r)},e.appendFileSync=(e,r)=>{let i=le(t,e,`append`);i?i(ue(r)):n.appendFileSync(e,r)},e.existsSync=e=>oe(e)||n.existsSync(e),e.accessSync=e=>{oe(e)||n.accessSync(e)},e.statSync=e=>oe(e)?pe():n.statSync(e),e.lstatSync=e=>oe(e)?pe():n.lstatSync(e)}function ye(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,n){let r=t=>e.isTombstoned(t);try{let i=e.readdir(n);if(!t||!e.isPartial(n)||r(n))return i;try{return ye(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 ye(n,[],t.readdir(n),r)}}function xe(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 Se(e,t,n,r,i){t?(t.writeFile(r,i),e.commitWrite(r,i)):(e.writeFile(r,i),n?.write?.(r,i))}function Ce(e,t,n,r,i){function a(e){return D(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)=>Se(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 be(e,n,t))p(f(t,i),f(r,i))}let m={..._e({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)),fe(t))},writeFileSync(e,t){s(a(e),xe(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=xe(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 j(`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 j(`ENOENT`,t,`realpath`);return t},readdirSync(t){return be(e,n,a(t))},copyFileSync(e,t){s(a(t),o(a(e)))},cpSync(e,t){p(a(e),a(t))},chmodSync(e){let t=a(e);if(!c(t))throw j(`ENOENT`,t,`chmod`)},mkdtempSync(t){return e.mkdtemp(a(t))}};return ve(m,r),m}function we(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 M={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 Te(e){let t=e.isTTY&&!e.noColor,n=e=>n=>t?`${e}${n}${M.reset}`:String(n);return{enabled:t,green:n(M.green),red:n(M.red),yellow:n(M.yellow),gray:n(M.gray),bold:n(M.bold),cyan:n(M.cyan),dim:n(M.dim)}}const Ee=/\u001b\[[0-9;]*m/g;function De(e){return e.replace(Ee,``)}function Oe(e){return De(e).length}function ke(e,t){let n=String(e??``);return t<=0?``:Oe(n)<=t?n:t<=1?n.slice(0,t):`${De(n).slice(0,t-1)}…`}function Ae(e,t){let n=String(e??``),r=Oe(n);return r===t?n:r>t?ke(n,t):n+` `.repeat(t-r)}function je(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,Oe(e))}r[i]=t}return e.map(e=>r.map((t,n)=>Ae(n<e.length?String(e[n]??``):``,t)).join(` `).replace(/\s+$/,``)).join(`
|
|
4
4
|
`)}function Me(e){return e instanceof Date?e:new Date(e)}function Ne(e){return e<10?`0${e}`:String(e)}function Pe(e,t=`short`){let n=Me(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()}-${Ne(n.getMonth()+1)}-${Ne(n.getDate())}`}const Fe={trunc:ke,col:Ae,table:je,date:Pe};var N=class extends Error{actual;expected;operator;generatedMessage;code;constructor(e={}){let t=!e.message;super(e.message||`${Ie(e.actual)} ${e.operator||`!=`} ${Ie(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 Ie(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 P(e,t){return e instanceof Error?e:typeof e==`string`?new N({message:e}):t()}function Le(e,t,n,r){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ze(e[i],t[i],n,r))return!1;return!0}function Re(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)||!ze(Reflect.get(e,a),Reflect.get(t,a),n,r))return!1;return!0}function ze(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)?Le(e,t,n,r):Re(i,a,n,r):!1)}function Be(e,t){try{if(e instanceof t)return!0}catch{}try{return!!t(e)}catch{return!1}}function Ve(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 He(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`?Be(e,t):t&&typeof t==`object`?!e||typeof e!=`object`?!1:Ve(e,t):!1}function Ue(e){let t=(e,t)=>{if(!e)throw P(t,()=>new N({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 P(n,()=>new N({actual:e,expected:t,operator:`strictEqual`}))},i=(t,n,i)=>{if(e){r(t,n,i);return}if(t!=n)throw P(i,()=>new N({actual:t,expected:n,operator:`==`}))},a=(e,t,n)=>{if(Object.is(e,t))throw P(n,()=>new N({actual:e,expected:t,operator:`notStrictEqual`}))},o=(t,n,r)=>{if(e){a(t,n,r);return}if(t==n)throw P(r,()=>new N({actual:t,expected:n,operator:`!=`}))},s=(e,t,n)=>{if(!ze(e,t,!0,new WeakMap))throw P(n,()=>new N({actual:e,expected:t,operator:`deepStrictEqual`}))},c=(t,n,r)=>{if(e){s(t,n,r);return}if(!ze(t,n,!1,new WeakMap))throw P(r,()=>new N({actual:t,expected:n,operator:`deepEqual`}))},l=(e,t,n)=>{if(ze(e,t,!0,new WeakMap))throw P(n,()=>new N({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(ze(t,n,!1,new WeakMap))throw P(r,()=>new N({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 P(typeof t==`string`?t:n,()=>new N({message:`Missing expected exception`,operator:`throws`}));if(!(typeof t==`string`||t instanceof Error)&&!He(r,t))throw P(n,()=>new N({message:`Got unwanted exception`,actual:r,operator:`throws`}))},n.doesNotThrow=(e,t)=>{try{e()}catch(e){throw P(t,()=>new N({message:`Got unwanted exception`,actual:e,operator:`doesNotThrow`}))}},n.fail=e=>{throw P(e,()=>new N({message:`Failed`,operator:`fail`}))},n.AssertionError=N,n}const We=Ue(!0);We.strict=We;const Ge=Ue(!1);Ge.strict=We;function Ke(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 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});var Ye=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}},Xe=class extends Ye{read(){return null}destroy(){return this.closeOnDestroy()}},Ze=class extends Ye{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}destroy(){return this.closeOnDestroy()}},Qe=class extends Ye{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}read(){return null}destroy(){return this.closeOnDestroy()}};const $e={Readable:Xe,Writable:Ze,Transform:Qe,PassThrough:class extends Qe{},Stream:Ye},et=Symbol.for(`nodejs.util.inspect.custom`),tt=Symbol.for(`nodejs.util.promisify.custom`);function nt(e){return`'${e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`).replace(/\n/g,`\\n`)}'`}function rt(e){if(e===null)return`null`;let t=typeof e;if(t===`string`)return nt(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 it(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 at(e,t,n){if(Array.isArray(e))return e.length===0?`[]`:`[ ${e.map(e=>ot(e,t+1,n)).join(`, `)} ]`;if(e instanceof Map){let r=[...e].map(([e,r])=>`${ot(e,t+1,n)} => ${ot(r,t+1,n)}`);return`Map(${e.size}) {${r.length?` ${r.join(`, `)} `:``}}`}if(e instanceof Set){let r=[...e].map(e=>ot(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:nt(r)}: ${ot(e[r],t+1,n)}`).join(`, `)} }`}function ot(e,t,n){let r=rt(e);if(r!==null)return r;let i=e,a=it(i);if(a!==null)return a;let o=i[et];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 at(i,t,n)}finally{n.seen.delete(e)}}function st(e,t={}){let n=t.depth===void 0?2:t.depth;return ot(e,0,{seen:new Set,maxDepth:n,opts:t})}function ct(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):st(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++,st(i,{depth:4});case`%O`:return n.i++,st(i,{depth:null});case`%c`:return n.i++,``;default:return e}}function lt(e,...t){let n=t[0];if(typeof n!=`string`)return t.map(e=>typeof e==`string`?e:st(e)).join(` `);let r={i:1},i=n.replace(/%[sdifjoOc%]/g,n=>ct(n,t,r,e));for(;r.i<t.length;r.i++){let e=t[r.i];i+=` ${typeof e==`string`?e:st(e)}`}return i}function ut(...e){return lt({},...e)}function dt(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 ft(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type function`);let t=e[tt];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 pt(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 mt=st;mt.custom=et;const ht=ft;ht.custom=tt;function gt(e){return{format:ut,formatWithOptions:lt,inspect:mt,inherits:dt,promisify:ht,deprecate:pt(e)}}const _t=gt(()=>{});let vt=1;function yt(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 bt(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 xt(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))throw bt(`options.env`,`object`,e);let t={};for(let[n,r]of Object.entries(e))if(r!==void 0){if(typeof r!=`string`)throw bt(`options.env[${n}]`,`string`,r);t[n]=r}return t}function St(e){if(e!==void 0){if(typeof e!=`string`)throw bt(`options.cwd`,`string`,e);return e}}function Ct(e,t){return t===void 0||t===`utf8`||t===`utf-8`?e:t===`buffer`||t===null?Ke(e):Ke(e).toString(t)}function wt(e,t){if(e.length===0)return Ct(``,t);if(typeof e[0]==`string`)return e.join(``);let n=globalThis.Buffer;return n?n.concat(e):e[0]}function Tt(e,t,n){t.length>0&&e.emit(`data`,Ct(t,n)),e.readable=!1,e.emit(`end`)}function Et(e){let t=e=>{typeof e==`function`&&queueMicrotask(e)};return{writable:!0,write(n,r,i){return e.stdin.write(yt(n)),t(typeof r==`function`?r:i),!0},end(n,r,i){n!==void 0&&typeof n!=`function`&&e.stdin.write(yt(n)),e.stdin.end(),this.writable=!1,t(typeof n==`function`?n:typeof r==`function`?r:i)}}}var Dt=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=vt++,this.spawnfile=n,this.spawnargs=r,this.stdout=new Xe,this.stderr=new Xe,this.stdin=Et(e),e.done.then(e=>this.finish(e,t),e=>this.emit(`error`,e instanceof Error?e:Error(String(e))))}finish(e,t){Tt(this.stdout,e.stdout,t),Tt(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 Ot(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=St(e.cwd),n=xt(e.env);return{...e.input===void 0?{}:{input:yt(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=Ct(s.stdout,o),l=Ct(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:vt++})},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=vt++,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=Ct(``,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=Ct(d.stdout,c),p=Ct(d.stderr,c);return{pid:l,status:d.exitCode,signal:null,stdout:f,stderr:p,output:[null,f,p]}}}}function kt(e,t){let n=(t,n,r,i,a)=>{let o=St(n.cwd),s=xt(n.env),c={...o===void 0?{}:{cwd:o},...s===void 0?{}:{env:s}},l=e.start(t,c),u=new Dt(l,r,i,a);return n.input!==void 0&&u.stdin.write(yt(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,wt(i,t),wt(a,t))),e.once(`close`,(o,s)=>{let c=wt(i,t),l=wt(a,t);if(o===0){r(null,c,l);return}r(Object.assign(Error(`Command failed: ${n}\n${yt(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=Ot(t),d=(e,t)=>{Object.defineProperty(e,tt,{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:Dt}}function At(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var jt={exports:{}};
|
|
@@ -25,6 +25,6 @@ import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./__vite-browse
|
|
|
25
25
|
`).slice(3).join(`
|
|
26
26
|
`);if(!a)return;let o=a.endsWith(`
|
|
27
27
|
`)?a:`${a}\n`;t(n>0?`${` `.repeat(n)}${o}`:o)}function co(e,t,n){let r=no(n);if(e.has(r)){t(`Label '${r}' already exists for console.time()`);return}e.set(r,ro())}function lo(e,t,n,r){let i=no(r),a=e.get(i);if(a===void 0){t(`No such label '${i}' for console.timeEnd()`);return}e.delete(i),n(`${i}: ${io(ro()-a)}`)}function uo(e,t,n,r,i){let a=no(r),o=e.get(a);if(o===void 0){t(`No such label '${a}' for console.timeLog()`);return}let s=`${a}: ${io(ro()-o)}`;i.length===0?n(s):n(s,...i)}function fo(e,t,n){let r=no(n),i=(e.get(r)??0)+1;e.set(r,i),t(`${r}: ${i}`)}function po(e,t,n){let r=no(n);if(!e.has(r)){t(`Count for '${r}' does not exist`);return}e.set(r,0)}function mo(e,t,n){n.length>0&&t(...n),e.depth+=1}function ho(e){e.depth>0&&--e.depth}function go(e,t){let n=new Map,r=new Map,i={depth:0},a=(...t)=>ao(e,i.depth,t),o=(...e)=>ao(t,i.depth,e),s=(...e)=>mo(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:()=>ho(i),assert:(e,...t)=>oo(o,e,t),trace:(...e)=>so(o,t,i.depth,e),time:e=>co(r,o,e),timeEnd:e=>lo(r,o,a,e),timeLog:(e,...t)=>uo(r,o,a,e,t),count:e=>fo(n,a,e),countReset:e=>po(n,o,e)}}function _o(e,t,n){let r=!!e.env?.NO_COLOR,i=!1,a,o,c=e=>{i=!0,o=e,a=e},l=yo(e.stdin??``,c),u=Va(e.argv),d={write:t,end:()=>void 0,isTTY:!r},f={write:n,end:()=>void 0,isTTY:!r};return{processShim:{argv:u,env:e.env,versions:{node:s},version:`v${s}`,platform:`linux`,arch:`x64`,cwd:()=>e.cwd,get exitCode(){return a},set exitCode(e){a=$a(e)},exit:(...e)=>{if(e.length===0){let e=Ya(a);throw c(e),new Ja(e)}a=$a(e[0]);let t=Ya(a);throw c(t),new Ja(t)},stdin:l,stdout:d,stderr:f},getDidCallProcessExit:()=>i,getExitCode:()=>Ya(i?o:a),recordExit:c}}var vo=class extends $e.Stream{isTTY=!1;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 Ja){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 yo(e,t){return new vo(e,t)}function bo(e){if(e===``)return[];let t=e.split(`
|
|
28
|
-
`);return t[t.length-1]===``&&t.pop(),t.map(e=>e.endsWith(`\r`)?e.slice(0,-1):e)}function xo(e){if(typeof e==`string`)return e;if(e&&typeof e.read==`function`){let t=e.read();return typeof t==`string`?t:``}return``}function So(e){return new TextDecoder(`utf-8`).decode(re(e))}function Co(e){if(e&&typeof e.write==`function`)return e}var wo=class extends qe{terminal=!1;lines;cursor=0;closed=!1;flushScheduled=!1;output;onExit;constructor(e,t,n){super(),this.lines=bo(So(xo(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 Ja&&this.onExit){this.closed=!0,this.onExit(e.code);return}throw e}}};function To(e){let t=(t,n)=>{let r,i;if(t&&typeof t==`object`&&`input`in t){let e=t;r=e.input,i=Co(e.output)}else r=t,i=Co(n);if(r==null)throw TypeError(`readline.createInterface: an 'input' stream is required`);return new wo(r,i,e)},n=(...e)=>{let t=e[e.length-1];return typeof t==`function`&&queueMicrotask(()=>t()),!0},r={createInterface:t,Interface:wo,emitKeypressEvents:()=>void 0,cursorTo:n,moveCursor:n,clearLine:n,clearScreenDown:n};return{...r,promises:r}}var Eo=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`?`: ${Do(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 Do(e){try{return JSON.stringify(e)}catch{return String(e)}}function Oo(e){return new Promise(t=>setTimeout(t,e))}function ko(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 Ao(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?ko(r,n):r}function jo(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 Mo(e){if(!e)return!1;let t=e.toLowerCase();return t.startsWith(`application/json`)||/[+/]json(;|$|\s)/.test(t)}function No(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 Po(e){if(Mo(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 Fo(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 Io(e,t){return Object.keys(e).some(e=>e.toLowerCase()===t.toLowerCase())}async function Lo(e,t,n){let r=await t(n);r&&!Io(e,`authorization`)&&(e.Authorization=`Bearer ${r}`)}function Ro(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 zo(e,t){return{body:t,headers:Object.fromEntries(e.headers.entries()),status:e.status}}async function Bo(e,t){let n=await Po(e);return t?zo(e,n):n}async function Vo(e,t){let n=await Po(e).catch(()=>null);throw new Eo(e.status,e.statusText,t,n)}function Ho(e,t){let n=No(e.headers.get(`retry-after`));return n===null?500*2**t:n}async function Uo(e,t,n,r){let i=null;for(let a=0;a<e.maxAttempts;a++){let{signal:o,clearTimeout:s}=Ro(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 Bo(l,r.raw);if(!(a+1<e.maxAttempts&&e.retryOn.has(l.status)))return Vo(l,t);await e.sleep(Ho(l,a))}if(i)return Vo(i,t);throw Error(`http: no attempts made for ${n.method??`GET`} ${t}`)}function Wo(e){let t=e.sleep??Oo;function n(n){let r=new Set(n.retry?.on??[]),i=Math.max(1,Math.trunc(n.retry?.maxAttempts??1));async function a(a,o,s={}){let c=Ao(n.baseUrl,o,s.params),l=jo(n.headers,s.headers);n.token&&await Lo(l,n.token,{method:a,path:o,url:c});let u=Fo(s.body,l),d={method:a,headers:l};return u!==void 0&&(d.body=u),Uo({fetch:e.fetch,sleep:t,maxAttempts:i,retryOn:r,timeoutMs:n.timeoutMs},c,d,s)}return Object.freeze({get:((e,t)=>a(`GET`,e,t)),post:((e,t)=>a(`POST`,e,t)),put:((e,t)=>a(`PUT`,e,t)),patch:((e,t)=>a(`PATCH`,e,t)),delete:((e,t)=>a(`DELETE`,e,t))})}return Object.freeze({client:n})}function Go(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 Ko(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`,Go(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 qo(e,t){let n=t.cwd,r=async(t,r)=>{let i=r??{},a=await e.spawn(Ko(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 Jo(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 Yo(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=Jo(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 Xo(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 Zo(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 Zo(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 Qo(e){return{findTab:t=>e.call(`browser`,`findTab`,[es(t)]),ensureTab:(t,n={})=>e.call(`browser`,`ensureTab`,[t,ts(n)]),eval:(t,n)=>e.call(`browser`,`eval`,[Jo(t),$o(n,!1)]),evalAsync:(t,n)=>e.call(`browser`,`evalAsync`,[Jo(t),$o(n,!0)]),cookie:(t,n)=>e.call(`browser`,`cookie`,[Jo(t),n]),localStorage:(t,n)=>e.call(`browser`,`localStorage`,[Jo(t),n]),fetch:(t,n,r={})=>E(n,r).then(n=>e.call(`browser`,`evalAsync`,[Jo(t),n])),websocket:Yo(e)}}function $o(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 es(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 ts(e){return e.matchUrl===void 0?{}:{matchUrl:e.matchUrl instanceof RegExp?e.matchUrl.source:e.matchUrl}}function ns(e){return{register(t){let n=null,r=e.onEvent(`computer-call`,r=>{let i=r;i.id===t.id&&is(e,t,i,{getStop:()=>n,setStop:e=>{n=e}})}),i=rs(t);return e.call(`computer`,`register`,[i]).catch(()=>{}),()=>{n?.(),n=null,r(),e.call(`computer`,`unregister`,[t.id]).catch(()=>{})}}}}function rs(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 is(e,t,n,r){let i;try{i=await as(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 as(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 os(e,t,Number(n.args[0])||2,r);case`unsubscribe`:return r.getStop()?.(),r.setStop(null),{ok:!0};default:{let e=n.op;throw Error(`unknown computer op '${String(e)}'`)}}}function os(e,t,n,r){if(r.getStop()?.(),!t.subscribe)throw Error(`subscribe is not supported`);let i=t.subscribe(n,n=>{e.call(`computer`,`frame`,[t.id,n]).catch(()=>{})});return r.setStop(()=>{try{i()}catch{}}),{ok:!0}}function ss(e){return e===`SIGKILL`?137:e===`SIGINT`?130:143}function cs(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:ss(t)}),Promise.resolve(!0)),stdin:{write:e=>{!s&&!u&&o.push(e)},end:()=>m()},done:p}}});return l.exec=l,l}const ls=new Set([204,205,304]),us=new Set([`content-encoding`,`transfer-encoding`,`content-length`]);function ds(e,t){let n=fs(e.body),r=ps(e.headers),i=ls.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 hs(a,n),a}function fs(e){return e.byteLength===0?new Uint8Array:e.slice()}function ps(e){let t=new Headers;for(let[n,r]of Object.entries(e))if(!us.has(n.toLowerCase()))try{t.set(n,r)}catch{}return t}const ms=Symbol(`slicc.realmBufferedBody`);function hs(e,t){if(ms in e)return;Object.defineProperty(e,ms,{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,gs(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 gs(e){try{let t=e.body;t&&!t.locked&&t.getReader()}catch{}}function _s(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 vs(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ys(e){return e==null?[]:Array.isArray(e)?e:[e]}function bs(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:vs(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,_s(r)]),sendFeatureReport:(t,r)=>e.call(`hid`,`sendFeatureReport`,[n,t,_s(r)]),receiveFeatureReport:async t=>vs((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 xs(e){return{list:async()=>(await e.call(`hid`,`list`,[])).map(t=>bs(e,t)),request:async t=>{let n=(await e.call(`hid`,`request`,[ys(t)]))[0];if(!n)throw Error(`No device selected.`);return bs(e,n)}}}function Ss(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 Cs=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 };`)}},ws=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=Ss(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 Cs(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 Cs(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?.())}},Ts=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 ws(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()}},Es=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 ws(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 Ts(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 Ds(e){let t=async t=>new Es(e),n=async(t,n)=>new Es(e);return{chromium:{launch:t,connect:n,connectOverCDP:n},firefox:{launch:t,connect:n},webkit:{launch:t,connect:n}}}function Os(e){return{...e,time:Ka,fmt:Fe,pool:Ha}}function ks(e,t){return e?.startsWith(`/`)?qa(e):t}function As(e){return e.includes(`require`)||e.includes(`import`)||/(?:^|[;\n}])\s*export\b/.test(e)}async function js(e,t,n,r){return As(t)?e.call(`module`,`buildGraph`,[t,ks(r,n),r]):{files:[],entryMap:{},edges:{},edgeErrors:{},errors:{}}}function Ms(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 Ns(e){return{playwright:Ds(e)}}function Ps(e){let{graph:t,fsBridge:n,processShim:r,childProcess:i,nodeConsole:a,sliccyModules:o,shimmedPackages:s={},nodeReadline:l,nodeOsModule:d=xn,nodeUtilModule:p=_t}=e,m=new Map(t.files.map(e=>[e.path,e.cjsSource])),h=new Map(t.files.map(e=>[e.path,e.kind])),g=new Map,_=gn({requireFrom:(e,t)=>T(e,t),resolveFrom:(e,t)=>w(e,t)}),v=nn(()=>{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:Ls(e,o)};let t=e.startsWith(`node:`)?e.slice(5):e,a=Fs(t,{fsBridge:n,processShim:r,childProcess:i,nodeOsModule:d,nodeUtilModule:p,nodePathModule:v,nodeReadline:l,nodeModule:_});if(a.hit)return a;if(y.has(t))throw f(e,t);if(u.has(t))throw zs(e,t);return t in s?{hit:!0,value:s[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):Is(n)};function S(e){let n=g.get(e);if(n)return n.exports;let i=m.get(e);if(i===void 0)throw Error(`Cannot find module '${e}'`);let o={exports:{}};g.set(e,o);let s=n=>x(t.edges[e],n,e),c=qa(e);return Function(`module`,`exports`,`require`,`__dirname`,`__filename`,`process`,`console`,`Buffer`,`global`,i)(o,o.exports,s,c,e,r,a,globalThis.Buffer,globalThis),h.get(e)===`cjs`&&Ms(o.exports),o.exports}function C(e){return m.has(e)}function w(e,n){if(c(n))return n;let r=t.edges[e]?.[n];if(r)return r;let i=qa(e);if(hn(n)){let e=pn(i,n,C);if(e)return e}else{let e=mn(i,n,C);if(e)return e}let a=t.edgeErrors?.[e]?.[n];throw a?Error(a):Is(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 Fs(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:Wt}: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:Ge}:e===`assert/strict`?{hit:!0,value:We}:e===`util`?{hit:!0,value:o}:e===`events`?{hit:!0,value:Je}:e===`os`?{hit:!0,value:a}:e===`tty`?{hit:!0,value:Sn}:e===`stream`?{hit:!0,value:$e}:e===`url`?{hit:!0,value:sn}:e===`zlib`?{hit:!0,value:za}: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 Is(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 Ls(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 Rs={http:` Use fetch() instead.`,https:` Use fetch() instead.`,crypto:` Use globalThis.crypto (Web Crypto API) instead.`};function zs(e,t){return Error(`require('${e}'): Node built-in '${t}' is not available in the browser environment.${Rs[t]||``}`)}async function Bs(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";
|
|
28
|
+
`);return t[t.length-1]===``&&t.pop(),t.map(e=>e.endsWith(`\r`)?e.slice(0,-1):e)}function xo(e){if(typeof e==`string`)return e;if(e&&typeof e.read==`function`){let t=e.read();return typeof t==`string`?t:``}return``}function So(e){return new TextDecoder(`utf-8`).decode(re(e))}function Co(e){if(e&&typeof e.write==`function`)return e}var wo=class extends qe{terminal=!1;lines;cursor=0;closed=!1;flushScheduled=!1;output;onExit;constructor(e,t,n){super(),this.lines=bo(So(xo(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 Ja&&this.onExit){this.closed=!0,this.onExit(e.code);return}throw e}}};function To(e){let t=(t,n)=>{let r,i;if(t&&typeof t==`object`&&`input`in t){let e=t;r=e.input,i=Co(e.output)}else r=t,i=Co(n);if(r==null)throw TypeError(`readline.createInterface: an 'input' stream is required`);return new wo(r,i,e)},n=(...e)=>{let t=e[e.length-1];return typeof t==`function`&&queueMicrotask(()=>t()),!0},r={createInterface:t,Interface:wo,emitKeypressEvents:()=>void 0,cursorTo:n,moveCursor:n,clearLine:n,clearScreenDown:n};return{...r,promises:r}}var Eo=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`?`: ${Do(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 Do(e){try{return JSON.stringify(e)}catch{return String(e)}}function Oo(e){return new Promise(t=>setTimeout(t,e))}function ko(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 Ao(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?ko(r,n):r}function jo(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 Mo(e){if(!e)return!1;let t=e.toLowerCase();return t.startsWith(`application/json`)||/[+/]json(;|$|\s)/.test(t)}function No(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 Po(e){if(Mo(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 Fo(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 Io(e,t){return Object.keys(e).some(e=>e.toLowerCase()===t.toLowerCase())}async function Lo(e,t,n){let r=await t(n);r&&!Io(e,`authorization`)&&(e.Authorization=`Bearer ${r}`)}function Ro(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 zo(e,t){return{body:t,headers:Object.fromEntries(e.headers.entries()),status:e.status}}async function Bo(e,t){let n=await Po(e);return t?zo(e,n):n}async function Vo(e,t){let n=await Po(e).catch(()=>null);throw new Eo(e.status,e.statusText,t,n)}function Ho(e,t){let n=No(e.headers.get(`retry-after`));return n===null?500*2**t:n}async function Uo(e,t,n,r){let i=null;for(let a=0;a<e.maxAttempts;a++){let{signal:o,clearTimeout:s}=Ro(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 Bo(l,r.raw);if(!(a+1<e.maxAttempts&&e.retryOn.has(l.status)))return Vo(l,t);await e.sleep(Ho(l,a))}if(i)return Vo(i,t);throw Error(`http: no attempts made for ${n.method??`GET`} ${t}`)}function Wo(e){let t=e.sleep??Oo;function n(n){let r=new Set(n.retry?.on??[]),i=Math.max(1,Math.trunc(n.retry?.maxAttempts??1));async function a(a,o,s={}){let c=Ao(n.baseUrl,o,s.params),l=jo(n.headers,s.headers);n.token&&await Lo(l,n.token,{method:a,path:o,url:c});let u=Fo(s.body,l),d={method:a,headers:l};return u!==void 0&&(d.body=u),Uo({fetch:e.fetch,sleep:t,maxAttempts:i,retryOn:r,timeoutMs:n.timeoutMs},c,d,s)}return Object.freeze({get:((e,t)=>a(`GET`,e,t)),post:((e,t)=>a(`POST`,e,t)),put:((e,t)=>a(`PUT`,e,t)),patch:((e,t)=>a(`PATCH`,e,t)),delete:((e,t)=>a(`DELETE`,e,t))})}return Object.freeze({client:n})}function Go(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 Ko(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`,Go(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 qo(e,t){let n=t.cwd,r=async(t,r)=>{let i=r??{},a=await e.spawn(Ko(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 Jo(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 Yo(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=Jo(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 Xo(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 Zo(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 Zo(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 Qo(e){return{findTab:t=>e.call(`browser`,`findTab`,[es(t)]),ensureTab:(t,n={})=>e.call(`browser`,`ensureTab`,[t,ts(n)]),eval:(t,n)=>e.call(`browser`,`eval`,[Jo(t),$o(n,!1)]),evalAsync:(t,n)=>e.call(`browser`,`evalAsync`,[Jo(t),$o(n,!0)]),cookie:(t,n)=>e.call(`browser`,`cookie`,[Jo(t),n]),localStorage:(t,n)=>e.call(`browser`,`localStorage`,[Jo(t),n]),fetch:(t,n,r={})=>E(n,r).then(n=>e.call(`browser`,`evalAsync`,[Jo(t),n])),websocket:Yo(e)}}function $o(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 es(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 ts(e){return e.matchUrl===void 0?{}:{matchUrl:e.matchUrl instanceof RegExp?e.matchUrl.source:e.matchUrl}}function ns(e){return{register(t){let n=null,r=e.onEvent(`computer-call`,r=>{let i=r;i.id===t.id&&is(e,t,i,{getStop:()=>n,setStop:e=>{n=e}})}),i=rs(t);return e.call(`computer`,`register`,[i]).catch(()=>{}),()=>{n?.(),n=null,r(),e.call(`computer`,`unregister`,[t.id]).catch(()=>{})}}}}function rs(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 is(e,t,n,r){let i;try{i=await as(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 as(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 os(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 os(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 ss(e){return e===`SIGKILL`?137:e===`SIGINT`?130:143}function cs(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:ss(t)}),Promise.resolve(!0)),stdin:{write:e=>{!s&&!u&&o.push(e)},end:()=>m()},done:p}}});return l.exec=l,l}const ls=new Set([204,205,304]),us=new Set([`content-encoding`,`transfer-encoding`,`content-length`]);function ds(e,t){let n=fs(e.body),r=ps(e.headers),i=ls.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 hs(a,n),a}function fs(e){return e.byteLength===0?new Uint8Array:e.slice()}function ps(e){let t=new Headers;for(let[n,r]of Object.entries(e))if(!us.has(n.toLowerCase()))try{t.set(n,r)}catch{}return t}const ms=Symbol(`slicc.realmBufferedBody`);function hs(e,t){if(ms in e)return;Object.defineProperty(e,ms,{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,gs(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 gs(e){try{let t=e.body;t&&!t.locked&&t.getReader()}catch{}}function _s(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 vs(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ys(e){return e==null?[]:Array.isArray(e)?e:[e]}function bs(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:vs(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,_s(r)]),sendFeatureReport:(t,r)=>e.call(`hid`,`sendFeatureReport`,[n,t,_s(r)]),receiveFeatureReport:async t=>vs((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 xs(e){return{list:async()=>(await e.call(`hid`,`list`,[])).map(t=>bs(e,t)),request:async t=>{let n=(await e.call(`hid`,`request`,[ys(t)]))[0];if(!n)throw Error(`No device selected.`);return bs(e,n)}}}function Ss(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 Cs=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 };`)}},ws=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=Ss(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 Cs(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 Cs(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?.())}},Ts=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 ws(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()}},Es=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 ws(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 Ts(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 Ds(e){let t=async t=>new Es(e),n=async(t,n)=>new Es(e);return{chromium:{launch:t,connect:n,connectOverCDP:n},firefox:{launch:t,connect:n},webkit:{launch:t,connect:n}}}function Os(e){return{...e,time:Ka,fmt:Fe,pool:Ha}}function ks(e,t){return e?.startsWith(`/`)?qa(e):t}function As(e){return e.includes(`require`)||e.includes(`import`)||/(?:^|[;\n}])\s*export\b/.test(e)}async function js(e,t,n,r){return As(t)?e.call(`module`,`buildGraph`,[t,ks(r,n),r]):{files:[],entryMap:{},edges:{},edgeErrors:{},errors:{}}}function Ms(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 Ns(e){return{playwright:Ds(e)}}function Ps(e){let{graph:t,fsBridge:n,processShim:r,childProcess:i,nodeConsole:a,sliccyModules:o,shimmedPackages:s={},nodeReadline:l,nodeOsModule:d=xn,nodeUtilModule:p=_t}=e,m=new Map(t.files.map(e=>[e.path,e.cjsSource])),h=new Map(t.files.map(e=>[e.path,e.kind])),g=new Map,_=gn({requireFrom:(e,t)=>T(e,t),resolveFrom:(e,t)=>w(e,t)}),v=nn(()=>{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:Ls(e,o)};let t=e.startsWith(`node:`)?e.slice(5):e,a=Fs(t,{fsBridge:n,processShim:r,childProcess:i,nodeOsModule:d,nodeUtilModule:p,nodePathModule:v,nodeReadline:l,nodeModule:_});if(a.hit)return a;if(y.has(t))throw f(e,t);if(u.has(t))throw zs(e,t);return t in s?{hit:!0,value:s[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):Is(n)};function S(e){let n=g.get(e);if(n)return n.exports;let i=m.get(e);if(i===void 0)throw Error(`Cannot find module '${e}'`);let o={exports:{}};g.set(e,o);let s=n=>x(t.edges[e],n,e),c=qa(e);return Function(`module`,`exports`,`require`,`__dirname`,`__filename`,`process`,`console`,`Buffer`,`global`,i)(o,o.exports,s,c,e,r,a,globalThis.Buffer,globalThis),h.get(e)===`cjs`&&Ms(o.exports),o.exports}function C(e){return m.has(e)}function w(e,n){if(c(n))return n;let r=t.edges[e]?.[n];if(r)return r;let i=qa(e);if(hn(n)){let e=pn(i,n,C);if(e)return e}else{let e=mn(i,n,C);if(e)return e}let a=t.edgeErrors?.[e]?.[n];throw a?Error(a):Is(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 Fs(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:Wt}: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:Ge}:e===`assert/strict`?{hit:!0,value:We}:e===`util`?{hit:!0,value:o}:e===`events`?{hit:!0,value:Je}:e===`os`?{hit:!0,value:a}:e===`tty`?{hit:!0,value:Sn}:e===`stream`?{hit:!0,value:$e}:e===`url`?{hit:!0,value:sn}:e===`zlib`?{hit:!0,value:za}: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 Is(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 Ls(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 Rs={http:` Use fetch() instead.`,https:` Use fetch() instead.`,crypto:` Use globalThis.crypto (Web Crypto API) instead.`};function zs(e,t){return Error(`require('${e}'): Node built-in '${t}' is not available in the browser environment.${Rs[t]||``}`)}async function Bs(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";
|
|
29
29
|
`:``}${e}`);try{return await s(...a),0}catch(e){return e instanceof Ja?e.code:(n(`${e instanceof Error?e.stack??e.message:String(e)}\n`),1)}}function Vs(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?_s(t.until):void 0,timeoutMs:t.timeoutMs}]),write:t=>e.call(`serial`,`write`,[n,_s(t)]),getSignals:()=>e.call(`serial`,`getSignals`,[n]),setSignals:t=>e.call(`serial`,`setSignals`,[n,t])}}function Hs(e){return{list:async()=>(await e.call(`serial`,`list`,[])).map(t=>Vs(e,t)),request:async t=>Vs(e,await e.call(`serial`,`request`,[ys(t)]))}}function Us(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 Ws(e,t){let n=t.handle,r=e=>({status:e.status,data:vs(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,_s(r)]),transferIn:async(t,i)=>r(await e.call(`usb`,`transferIn`,[n,t,i])),transferOut:(t,r)=>e.call(`usb`,`transferOut`,[n,t,_s(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 Gs(e){return{list:async()=>(await e.call(`usb`,`list`,[])).map(t=>Ws(e,t)),request:async t=>Ws(e,await e.call(`usb`,`request`,[ys(t)]))}}function Ks(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t<0?``:t===0?`/`:e.substring(0,t)}function qs(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 Js(e){return/^[A-Za-z0-9_\-./:@]+$/.test(e)?e:`'`+e.replace(/'/g,`'\\''`)+`'`}function Ys(e,t){return e===``?t:e===`/`?`/${t}`:`${e}/${t}`}function Xs(e){let t=Ks(e.argv[1]??``),n=qs(t),r=Ys(n,`references`),i=Ys(n,`assets`),a=Ys(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)+`
|
|
30
30
|
`),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 ${Js(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})}function $(e,t){return Object.assign(Error(`${e}: ${t}`),{code:e})}function Zs(e){let t=$s(e);if(ec(t))return new Uint8Array(t.response);if(t.status>=200&&t.status<300)throw $(`EIO`,e.label);tc(t,e.label)}function Qs(e){let t=Zs(e);try{return JSON.parse(new TextDecoder().decode(t))}catch{throw $(`EIO`,e.label)}}function $s(e){let t=new XMLHttpRequest;try{t.open(e.method,e.url,!1),t.responseType=`arraybuffer`,t.timeout=e.timeoutMs,t.setRequestHeader(m,e.token),e.body?t.send(new Uint8Array(e.body)):t.send()}catch{throw $(`EIO`,e.label)}return t}function ec(e){return e.status>=200&&e.status<300&&e.getResponseHeader(`x-slicc-fs`)===`1`}function tc(e,t){throw $(e.getResponseHeader(`x-slicc-fs`)===`1`&&e.getResponseHeader(`x-slicc-fs-errno`)||`EIO`,t)}function nc(e){return(t,n,r)=>{let i=Qs({method:`POST`,url:_,token:e,body:new TextEncoder().encode(JSON.stringify({...t,channel:g})),timeoutMs:n+h,label:r});if(!i||typeof i.stdout!=`string`||typeof i.stderr!=`string`||typeof i.exitCode!=`number`)throw $(`EIO`,r);return{stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode}}}function rc(e,t){let n=e.getMutations();for(let e of n.deleted)t.rm(e);for(let e of n.created)e.isDirectory?t.mkdir(e.path):t.writeFile(e.path,e.content);for(let e of n.modified)t.writeFile(e.path,e.content);e.resetBaseline()}function ic(e,t={}){let n=t.timeoutMs??12e4,{syncFs:r,fsBridge:i}=t,a=t.transport??nc(e);return{run(e,t={}){let o=r?.wasUsed()===!0&&i!==void 0;o&&rc(r,i);let s=`sync-exec bridge, '${Array.isArray(e)?e.join(` `):e}'`,c=b(t.timeout,n),l={command:e,...t.args===void 0?{}:{args:t.args},...t.input===void 0?{}:{stdin:t.input},...t.cwd===void 0?{}:{cwd:t.cwd},...t.env===void 0?{}:{env:t.env},timeoutMs:c};try{return a(l,c,s)}finally{o&&r.invalidate()}}}}function ac(e,t){return $(e,`sync-fs bridge, '${t}'`)}function oc(e,t){let n=e.startsWith(`/`)?e:`/${e}`,r=w+n.split(`/`).map(encodeURIComponent).join(`/`);return t?`${r}?op=${t}`:r}function sc(e,t={}){let n=t.timeoutMs??3e4;function r(t,r,i,a){return{method:t,url:oc(r,a),token:e,...i?{body:i}:{},timeoutMs:n,label:`sync-fs bridge, '${r}'`}}return{readFile(e){return Zs(r(`GET`,e))},writeFile(e,t){Zs(r(`POST`,e,t))},stat(e){let t=Qs(r(`GET`,e,void 0,`stat`));if(!t||typeof t.isFile!=`boolean`||typeof t.isDirectory!=`boolean`||typeof t.size!=`number`)throw ac(`EIO`,e);return{isFile:t.isFile,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,size:t.size}},lstat(e){let t=Qs(r(`GET`,e,void 0,`lstat`));if(!t||typeof t.isFile!=`boolean`||typeof t.isDirectory!=`boolean`||typeof t.size!=`number`)throw ac(`EIO`,e);return{isFile:t.isFile,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,size:t.size}},readdir(e){let t=Qs(r(`GET`,e,void 0,`readdir`));if(!Array.isArray(t)||!t.every(e=>typeof e==`string`))throw ac(`EIO`,e);return t},exists(e){let t=Qs(r(`GET`,e,void 0,`exists`));if(typeof t!=`boolean`)throw ac(`EIO`,e);return t},mkdir(e){Zs(r(`POST`,e,void 0,`mkdir`))},rm(e){Zs(r(`POST`,e,void 0,`rm`))}}}function cc(e,t,n={}){let{header:r,window:i}=C(e),a=n.wait??((e,t,n,r)=>Atomics.wait(e,t,n,r)),o=n.now??(()=>performance.now()),s=0;function c(e,t,n){for(;;){let i=t-o();if(i<=0)throw $(`ETIMEDOUT`,n);if(a(r,0,1,i),Atomics.load(r,0)===2&&Atomics.load(r,1)===e)return;Atomics.load(r,0)===2&&Atomics.store(r,0,1)}}return{call(e,n,a){let l=++s,u=o()+n,d=null,f=0,p=0;try{for(;;){Atomics.store(r,0,1);let n=p===0?{type:S,id:l,req:e}:{type:x,id:l,offset:p};try{t.postMessage(n)}catch{throw $(`EIO`,a)}c(l,u,a);let o=Atomics.load(r,3),s=Atomics.load(r,4);if(Atomics.load(r,5)!==p||s<0||o<0||p+s>o)throw $(`EIO`,a);if(d===null&&(f=Atomics.load(r,2),d=new Uint8Array(o)),d.set(i.subarray(0,s),p),p+=s,p>=o)break;if(s===0)throw $(`EIO`,a)}}finally{Atomics.store(r,0,0)}return v(f,d)}}}function lc(e,t){return $(e,`sync-sab bridge, '${t}'`)}function uc(e){let t=e;return!!t&&typeof t.isFile==`boolean`&&typeof t.isDirectory==`boolean`&&typeof t.size==`number`}function dc(e,t={}){let n=t.timeoutMs??25e3;function r(t,r){let i=e.call(t,n,`sync-sab bridge, '${r}'`);if(!i.ok)throw lc(i.errno,r);return i}function i(e,t){let n=r(e,t);if(n.ok&&n.kind===`bytes`)return n.bytes;throw lc(`EIO`,t)}function a(e,t){let n=r(e,t);if(n.ok&&n.kind===`json`)return n.json;throw lc(`EIO`,t)}return{readFile:e=>i({op:`read`,path:e},e),writeFile:(e,t)=>{r({op:`write`,path:e,body:t},e)},stat:e=>{let t=a({op:`stat`,path:e},e);if(!uc(t))throw lc(`EIO`,e);return t},lstat:e=>{let t=a({op:`lstat`,path:e},e);if(!uc(t))throw lc(`EIO`,e);return t},readdir:e=>{let t=a({op:`readdir`,path:e},e);if(!Array.isArray(t)||!t.every(e=>typeof e==`string`))throw lc(`EIO`,e);return t},exists:e=>{let t=a({op:`exists`,path:e},e);if(typeof t!=`boolean`)throw lc(`EIO`,e);return t},mkdir:e=>{r({op:`mkdir`,path:e},e)},rm:e=>{r({op:`rm`,path:e},e)}}}function fc(e){return(t,n,r)=>{let i=e.call({...t,channel:g},n+h,r);if(!i.ok)throw $(i.errno,r);let a=i.kind===`json`?i.json:null;if(!a||typeof a.stdout!=`string`||typeof a.stderr!=`string`||typeof a.exitCode!=`number`)throw $(`EIO`,r);return{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode}}}const pc=65536;function mc(e,t){if(!t)return e;let n=e+t;return n.length<=pc?n:n.slice(n.length-pc)}async function hc(e,t,n){let r;try{r=await e.call(`vfs`,`snapshot`,[t])}catch(e){n?.(e instanceof Error?e.message:String(e)),r={entries:[]}}return new te(r)}function gc(e,t){if(e.syncFsToken)return e=>t(`[sync-fs] snapshot failed, sync metadata will be incomplete: ${e}\n`)}function _c(e,t){return t?dc(t):e.syncFsToken?sc(e.syncFsToken):void 0}function vc(e,t){if(!(!e.syncSab||typeof Atomics>`u`||typeof Atomics.wait!=`function`))return cc(e.syncSab,t)}function yc(e,t,n,r,i){let a=vc(e,t),o=_c(e,a);if(Object.assign(r,Ce(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})}})),e.syncFsToken)return ic(e.syncFsToken,{syncFs:n,...o?{fsBridge:o}:{},...a?{transport:fc(a)}:{}})}function bc(e=globalThis){Object.prototype.hasOwnProperty.call(e,`SLICC_VERSION`)||Object.defineProperty(e,"SLICC_VERSION",{value:i().version,writable:!1,enumerable:!1,configurable:!1})}function xc(e,t,n){let r=Te({isTTY:!e,noColor:e});return{colorApi:r,cliApi:we({writeStdout:t,writeStderr:n,exit:e=>{throw new Ja(e)},color:r})}}function Sc(e,t,n){return{readStdinBytes:()=>re(e.stdin??``),writeStdout:t,writeStderr:n}}function Cc(e){return{usbBridge:Gs(e),serialBridge:Hs(e),hidBridge:xs(e),computerBridge:ns(e)}}async function wc(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:mc(r.stdout,a):r.stderr=n?r.stderr+a:mc(r.stderr,a),t.postMessage({type:`realm-output`,stream:e,chunk:a})},a=e=>{i(`stdout`,e)},o=e=>{i(`stderr`,e)},s=go(a,o),c=_o(e,a,o),{colorApi:l,cliApi:u}=xc(!!e.env?.NO_COLOR,a,o),d=new p(t),f=Sc(e,a,o),m=he(d,E,f),h=await hc(d,e.cwd,gc(e,o)),g=yc(e,t,h,m,f),_=cs(d,h,e.cwd,o),v=qo(_,{cwd:e.cwd}),y=Xs({argv:e.argv,fs:m,exec:_}),b=Qo(d),{usbBridge:x,serialBridge:S,hidBridge:C,computerBridge:w}=Cc(d),T=Wo({fetch:E});async function E(e,t){let n=e instanceof Request?e.url:e instanceof URL?e.toString():String(e);return ds(await d.call(`fetch`,`request`,[n,await Xo(t,e)]),n)}let D=Os({exec:_,agent:v,skill:y,http:T,browser:b,usb:x,serial:S,hid:C,computer:w,cli:u,color:l}),O=e.filename,k=qa(O),A=await js(d,e.code,e.cwd,O),ee=Ps({graph:A,fsBridge:m,processShim:c.processShim,childProcess:kt(_,g),nodeConsole:s,sliccyModules:D,shimmedPackages:Ns(d),nodeReadline:To({output:{write:a},onExit:c.recordExit}),nodeOsModule:bn(e.env),nodeUtilModule:gt(e=>o(`${e}\n`))}).require,te={exports:{},filename:e.filename},ne=A.entrySource!==void 0;await Tc({entryCode:A.entrySource??e.code,isEsmEntry:ne,filename:O,dirname:k,proc:c,nodeConsole:s,requireShim:ee,moduleShim:te,realmFetch:E,writeStderr:o,rpc:d,syncFs:h,output:r,port:t})}async function Tc(e){let t=globalThis;bc(),t.__slicc_compileWasm=t=>e.rpc.call(`wasm`,`compile`,[t]);let n=Us(globalThis,{onCallbackError(e){if(!(e instanceof Ja))throw e}}),{createBodyReadHandleTracker:r}=await import(`./realm-body-handles-DtLxL_rB.js`),i=r(globalThis);n.install(),i.install();try{let r=await Ec({entryCode:e.entryCode,bridges:{process:e.proc.processShim,console:e.nodeConsole,require:e.requireShim,module:e.moduleShim,exports:e.moduleShim.exports,fetch:e.realmFetch,__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});delete t.__slicc_compileWasm,e.rpc.dispose(),e.port.postMessage({type:`realm-done`,stdout:e.output.stdout,stderr:e.output.stderr,exitCode:r})}finally{n.clearPending(),n.restore(),i.restore()}}async function Ec(e){let t=await Bs(e.entryCode,e.bridges,e.writeStderr,e.isEsmEntry);return await Dc(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()?(e.timers.clearPending(),e.proc.getExitCode()):(await Oc(e.rpc,e.timers,e.bodyReads,e.proc),e.proc.getDidCallProcessExit()&&e.timers.clearPending(),await Dc(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()||t===0?e.proc.getExitCode():t)}async function Dc(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 Oc(e,t,n,r){for(await t.tick();!r.getDidCallProcessExit()&&(e.pendingCount>0||t.pendingCount>0||n.pendingCount>0);){let i=[];if(e.pendingCount>0&&i.push(e.waitForProgress()),t.pendingCount>0&&i.push(t.waitForProgress()),n.pendingCount>0&&i.push(n.waitForProgress()),i.length===0)break;await Promise.race(i),r.getDidCallProcessExit()||await t.tick()}}function kc(){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 Ac(){return async({kind:e})=>{if(e!==`js`)throw Error(`createInProcessJsRealmFactory: only kind:js is supported`);let{realmSide:t,hostSide:n}=kc(),r=e=>{if(e.data?.type!==`realm-init`)return;t.removeEventListener(`message`,r);let n=e.data;n.kind===`js`&&wc(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 jc(){return async({kind:e})=>{if(e!==`py`)throw Error(`createInProcessPyRealmFactory: only kind:py is supported`);let{realmSide:t,hostSide:n}=kc(),r=e=>{if(e.data?.type!==`realm-init`)return;t.removeEventListener(`message`,r);let n=e.data;n.kind===`py`&&d(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{Ac as createInProcessJsRealmFactory,jc as createInProcessPyRealmFactory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e}from"./main-
|
|
1
|
+
import{l as e}from"./main-jc6OS8lz.js";async function t(){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 n(n,r,i={}){if(n.dataset.recoveryBusy===`1`)return;let a=i.wipe??t,o=i.reload??(()=>location.reload()),s=r instanceof Error?r.message:String(r),c=i.verdict===`browser-wedged`,l=document.createElement(`div`);l.style.cssText=`padding:2rem;text-align:center;font-family:system-ui;`;let u=document.createElement(`h1`);u.style.color=`var(--s2-negative, #e34850)`,u.textContent=c?`Your browser needs a restart`:`Failed to start`;let d=document.createElement(`p`);d.style.color=`var(--s2-content-tertiary, #717171)`,d.textContent=s;let f=document.createElement(`div`);f.style.cssText=`display:flex;gap:0.75rem;justify-content:center;flex-wrap:wrap;margin-top:1.5rem;`;let p=document.createElement(`button`);p.type=`button`,p.textContent=`Reset local data & reload`,p.dataset.variant=c?`demoted`:`destructive`,p.style.cssText=c?`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 m=document.createElement(`button`);if(m.type=`button`,m.textContent=`Reload`,m.style.cssText=c?`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;`,p.addEventListener(`click`,()=>{p.disabled=!0,m.disabled=!0,p.textContent=`Resetting…`,n.dataset.recoveryBusy=`1`,(async()=>{try{await a()}catch{}for(let t of e)try{localStorage.removeItem(t)}catch{}o()})()}),m.addEventListener(`click`,()=>{o()}),c){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.`,l.append(u,d,e),f.append(m,p)}else l.append(u,d),f.append(p,m);for(l.append(f);n.firstChild;)n.removeChild(n.firstChild);n.appendChild(l)}export{n as renderBootRecoveryScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
async function e(e){if(e===`extension-direct`){let e=chrome;return e.identity?.getRedirectURL?.(`mcp-callback`)??`https://${e.runtime?.id??``}.chromiumapp.org/mcp-callback`}if(e===`node-rest`){let{getLocalApiBaseUrl:e}=await import(`./proxied-fetch-
|
|
1
|
+
async function e(e){if(e===`extension-direct`){let e=chrome;return e.identity?.getRedirectURL?.(`mcp-callback`)??`https://${e.runtime?.id??``}.chromiumapp.org/mcp-callback`}if(e===`node-rest`){let{getLocalApiBaseUrl:e}=await import(`./proxied-fetch-DARKNygr.js`).then(e=>e.i),t=e();if(t)return`${t}/auth/callback`}let{getOAuthPageOrigin:t}=await import(`./oauth-service-UTPOqIwj.js`),{origin:n}=await t();return`${n}${e===`extension-delegate`?`/auth/mcp-callback`:`/auth/callback`}`}export{e as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./base64-
|
|
1
|
+
import{t as e}from"./base64-BPBW1Gzr.js";import{t}from"./content-type-_QKWY0B2.js";import{r as n}from"./fetch-body-CuwTaJC_.js";const r=new Set([`GET`,`HEAD`]);function i(i){let a=(i.method??`GET`).toUpperCase();if(i.body===void 0||r.has(a))return;if(i.bodyEncoding===`base64`)return e(i.body);let o=Object.entries(i.headers??{}).find(([e])=>e.toLowerCase()===`content-type`)?.[1]??``;return o&&!t(o)?n(i.body):new TextEncoder().encode(i.body)}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./base64-
|
|
1
|
+
import{r as e,t}from"./base64-ELzoYfwP.js";import{c as n,l as r,r as i,s as a,t as o}from"./proxied-fetch-Bl8AeYdt.js";import{t as s}from"./fetch-body-1l9I58Vk.js";import{a as c,t as l}from"./api-endpoint-DGxXvrur.js";import{t as u}from"./approval-decision-CS9Wwm5B.js";import{a as d,i as f,n as p,r as m}from"./capability-C2eJ1wdx.js";var h=new Set([`GET`,`HEAD`]);function g(e){let n=(e.method??`GET`).toUpperCase();if(e.body===void 0||h.has(n))return;if(e.bodyEncoding===`base64`)return t(e.body);let i=Object.entries(e.headers??{}).find(([e])=>e.toLowerCase()===`content-type`)?.[1]??``;return i&&!r(i)?s(e.body):new TextEncoder().encode(e.body)}var _=m,v=12e4;function y(e){return e instanceof Error&&(e.name===`AbortError`||e.name===`TimeoutError`)}function b(e,t,n){if(n)return t;let r=AbortSignal.timeout(e);return t&&typeof AbortSignal.any==`function`?AbortSignal.any([r,t]):r}function x(e){let t=e.fetchImpl??((...e)=>globalThis.fetch(...e)),n=e.resolveUrl??c,r=e.headers??l,i=e.controlTimeoutMs??_;async function a(e,r){try{return await t(n(e),r)}catch(e){return e instanceof Error?e:Error(String(e))}}return{headers:r,send:a,async callJson(e,t,n,o){let s=o?.timeoutMs??i,c=b(s,o?.signal,o?.humanPaced===!0),l={method:e,headers:r({"Content-Type":`application/json`}),...c?{signal:c}:{}};n!==void 0&&(l.body=JSON.stringify(n));let u=await a(t,l);if(u instanceof Error)return{status:0,ok:!1,body:{error:y(u)?`no answer within ${s}ms`:u.message}};let d=await u.json().catch(()=>void 0);return{status:u.status,ok:u.ok,body:d}}}}function S(e,t){let n=e.body?.error;return typeof n==`string`&&n.length>0?n:e.status===0?`${t} (transport unreachable)`:`${t} (HTTP ${e.status})`}function C(e){return e.status===0?void 0:e.status}function w(e,t,n,r){return f(e,t,S(n,r),C(n))}async function T(e,t){let n=await e.callJson(`GET`,p.secretsMasked);return n.ok?Array.isArray(n.body)?{ok:!0,value:n.body}:f(`secrets`,t,`masked secrets response is not an array`):w(`secrets`,t,n,`masked secrets request failed`)}function E(e){return{async listMaskedEnv(){let t=await T(e,`listMaskedEnv`);return t.ok?{ok:!0,value:{entries:t.value}}:t},async getMasked(t){let n=await T(e,`getMasked`);if(!n.ok)return n;let r=n.value.find(e=>e.name===t.name);return r?{ok:!0,value:r}:f(`secrets`,`getMasked`,`no secret named "${t.name}"`,404)},async set(t){let n=t.scope===`persisted`,r=n?p.secretsPersisted:p.secretsSession,i=await e.callJson(`POST`,r,{name:t.name,value:t.value,domains:[...t.domains??[]]});return n&&i.status===404?d(`secrets`,`set`,`this server has no persisted-secret write route (upgrade it; the route shipped in #2823), retry with scope: 'session'`):i.ok?{ok:!0,value:void 0}:w(`secrets`,`set`,i,`set secret failed`)},async delete(t){let n=await e.callJson(`DELETE`,`${p.secretsPersisted}/${encodeURIComponent(t.name)}`);if(!n.ok)return w(`secrets`,`delete`,n,`delete secret failed`);let r=n.body;return{ok:!0,value:{removed:r?.removed??!0,fromSession:r?.fromSession===!0}}}}}async function D(t,s){let c={method:s.method??`GET`,headers:t.headers({...n(s.headers),"X-Target-URL":s.url}),cache:`no-store`};s.signal&&(c.signal=s.signal);let l=g(s);if(l!==void 0){if(l.byteLength>33554432)return f(`network`,`crossOriginFetch`,`request body is ${l.byteLength} bytes, over the ${o}-byte proxy limit`);c.body=l}let u=await t.send(p.fetchProxy,c);if(u instanceof Error)return f(`network`,`crossOriginFetch`,y(u)?`request cancelled`:u.message);if(u.headers.get(`x-proxy-error`)===`1`){let e=await u.text().catch(()=>``);return f(`network`,`crossOriginFetch`,e||`fetch-proxy reported an error`,u.status)}let d=i(),m=Number(u.headers.get(`content-length`)??``);if(Number.isFinite(m)&&m>d)return f(`network`,`crossOriginFetch`,`response body is ${m} bytes, over the ${d}-byte download limit`,u.status);let h;try{h=new Uint8Array(await u.arrayBuffer())}catch(e){return f(`network`,`crossOriginFetch`,y(e)?`response body cancelled`:`response body failed: ${e instanceof Error?e.message:String(e)}`,u.status)}if(h.byteLength>d)return f(`network`,`crossOriginFetch`,`response body is ${h.byteLength} bytes, over the ${d}-byte download limit`,u.status);let _={};u.headers.forEach((e,t)=>{_[t]=e});let v=a(_),b=r(v[`content-type`]??``);return{ok:!0,value:{status:u.status,ok:u.ok,statusText:u.statusText,headers:v,body:b?new TextDecoder().decode(h):e(h),bodyEncoding:b?`text`:`base64`,url:s.url}}}async function O(e,t){let n=t.backend===`s3`?p.s3SignAndForward:p.daSignAndForward,r=await e.callJson(`POST`,n,t.envelope,{timeoutMs:v}),i=r.body;return i&&typeof i==`object`&&typeof i.ok==`boolean`?{ok:!0,value:i}:w(`mounts`,`signRequest`,r,`sign-and-forward response is not an envelope`)}async function k(e,t){let n=t.suggestedPattern??t.detail,r=await e.callJson(`POST`,p.sudoApprove,{kind:t.kind,detail:t.detail,suggestedPattern:n,...t.requester?{requester:t.requester}:{},...t.reason?{reason:t.reason}:{},...t.approver?{approver:t.approver}:{}},{humanPaced:!0,...t.signal?{signal:t.signal}:{}});return r.ok?{ok:!0,value:u(r.body,n)}:w(`approvals`,`request`,r,`approval endpoint returned non-OK`)}function A(e){let t=x(e);return{crossOriginFetch:e=>D(t,e),secrets:E(t),signRequest:e=>O(t,e),requestApproval:e=>k(t,e)}}export{A as createRestOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./base64-
|
|
1
|
+
import{r as e}from"./base64-BPBW1Gzr.js";import{t}from"./content-type-_QKWY0B2.js";import{c as n,r,s as i,t as a}from"./proxied-fetch-DARKNygr.js";import{o,t as s}from"./api-endpoint-3qEcn7BY.js";import{c,l,s as u}from"./types-BfwydWt7.js";import{n as d,t as f}from"./rest-paths-Dia19u9P.js";import{t as p}from"./request-body-BF4moGct.js";const m=d;function h(e){return e instanceof Error&&(e.name===`AbortError`||e.name===`TimeoutError`)}function g(e,t,n){if(n)return t;let r=AbortSignal.timeout(e);return t&&typeof AbortSignal.any==`function`?AbortSignal.any([r,t]):r}function _(e){let t=e.fetchImpl??((...e)=>globalThis.fetch(...e)),n=e.resolveUrl??o,r=e.headers??s,i=e.controlTimeoutMs??m;async function a(e,r){try{return await t(n(e),r)}catch(e){return e instanceof Error?e:Error(String(e))}}return{headers:r,send:a,async callJson(e,t,n,o){let s=o?.timeoutMs??i,c=g(s,o?.signal,o?.humanPaced===!0),l={method:e,headers:r({"Content-Type":`application/json`}),...c?{signal:c}:{}};n!==void 0&&(l.body=JSON.stringify(n));let u=await a(t,l);if(u instanceof Error)return{status:0,ok:!1,body:{error:h(u)?`no answer within ${s}ms`:u.message}};let d=await u.json().catch(()=>void 0);return{status:u.status,ok:u.ok,body:d}}}}function v(e,t){let n=e.body?.error;return typeof n==`string`&&n.length>0?n:e.status===0?`${t} (transport unreachable)`:`${t} (HTTP ${e.status})`}function y(e){return e.status===0?void 0:e.status}function b(e,t,n,r){return u(e,t,v(n,r),y(n))}async function x(e,t){let n=await e.callJson(`GET`,f.secretsMasked);return n.ok?Array.isArray(n.body)?{ok:!0,value:n.body}:u(`secrets`,t,`masked secrets response is not an array`):b(`secrets`,t,n,`masked secrets request failed`)}function S(e){return{async listMaskedEnv(){let t=await x(e,`listMaskedEnv`);return t.ok?{ok:!0,value:{entries:t.value}}:t},async getMasked(t){let n=await x(e,`getMasked`);if(!n.ok)return n;let r=n.value.find(e=>e.name===t.name);return r?{ok:!0,value:r}:u(`secrets`,`getMasked`,`no secret named "${t.name}"`,404)},async set(t){let n=t.scope===`persisted`,r=n?f.secretsPersisted:f.secretsSession,i=await e.callJson(`POST`,r,{name:t.name,value:t.value,domains:[...t.domains??[]]});return n&&i.status===404?c(`secrets`,`set`,`this server has no persisted-secret write route (upgrade it; the route shipped in #2823), retry with scope: 'session'`):i.ok?{ok:!0,value:void 0}:b(`secrets`,`set`,i,`set secret failed`)},async delete(t){let n=await e.callJson(`DELETE`,`${f.secretsPersisted}/${encodeURIComponent(t.name)}`);if(!n.ok)return b(`secrets`,`delete`,n,`delete secret failed`);let r=n.body;return{ok:!0,value:{removed:r?.removed??!0,fromSession:r?.fromSession===!0}}}}}async function C(o,s){let c={method:s.method??`GET`,headers:o.headers({...n(s.headers),"X-Target-URL":s.url}),cache:`no-store`};s.signal&&(c.signal=s.signal);let l=p(s);if(l!==void 0){if(l.byteLength>33554432)return u(`network`,`crossOriginFetch`,`request body is ${l.byteLength} bytes, over the ${a}-byte proxy limit`);c.body=l}let d=await o.send(f.fetchProxy,c);if(d instanceof Error)return u(`network`,`crossOriginFetch`,h(d)?`request cancelled`:d.message);if(d.headers.get(`x-proxy-error`)===`1`){let e=await d.text().catch(()=>``);return u(`network`,`crossOriginFetch`,e||`fetch-proxy reported an error`,d.status)}let m=r(),g=Number(d.headers.get(`content-length`)??``);if(Number.isFinite(g)&&g>m)return u(`network`,`crossOriginFetch`,`response body is ${g} bytes, over the ${m}-byte download limit`,d.status);let _;try{_=new Uint8Array(await d.arrayBuffer())}catch(e){return u(`network`,`crossOriginFetch`,h(e)?`response body cancelled`:`response body failed: ${e instanceof Error?e.message:String(e)}`,d.status)}if(_.byteLength>m)return u(`network`,`crossOriginFetch`,`response body is ${_.byteLength} bytes, over the ${m}-byte download limit`,d.status);let v={};d.headers.forEach((e,t)=>{v[t]=e});let y=i(v),b=t(y[`content-type`]??``);return{ok:!0,value:{status:d.status,ok:d.ok,statusText:d.statusText,headers:y,body:b?new TextDecoder().decode(_):e(_),bodyEncoding:b?`text`:`base64`,url:s.url}}}async function w(e,t){let n=t.backend===`s3`?f.s3SignAndForward:f.daSignAndForward,r=await e.callJson(`POST`,n,t.envelope,{timeoutMs:12e4}),i=r.body;return i&&typeof i==`object`&&typeof i.ok==`boolean`?{ok:!0,value:i}:b(`mounts`,`signRequest`,r,`sign-and-forward response is not an envelope`)}async function T(e,t){let n=t.suggestedPattern??t.detail,r=await e.callJson(`POST`,f.sudoApprove,{kind:t.kind,detail:t.detail,suggestedPattern:n,...t.requester?{requester:t.requester}:{},...t.reason?{reason:t.reason}:{},...t.approver?{approver:t.approver}:{}},{humanPaced:!0,...t.signal?{signal:t.signal}:{}});return r.ok?{ok:!0,value:l(r.body,n)}:b(`approvals`,`request`,r,`approval endpoint returned non-OK`)}function E(e){let t=_(e);return{crossOriginFetch:e=>C(t,e),secrets:S(t),signRequest:e=>w(t,e),requestApproval:e=>T(t,e)}}export{E as createRestOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,n as t,t as n}from"./almost-bash-shell-headless-
|
|
1
|
+
import{c as e,n as t,t as n}from"./almost-bash-shell-headless-BA5r_r61.js";import{n as r}from"./browser-eoO4vY7w.js";import{c as i}from"./sudoers-BdBYQPUn.js";import{r as a}from"./sudo-fs-D620mZry.js";import{n as o}from"./jsh-discovery-D3Gk1cKA.js";import{o as s}from"./just-bash-compat-B-SPHuh_.js";import{n as c,r as l}from"./supervisor-B6-QPxI3.js";function u(t,n){return new Map(Object.entries({HOME:e,PATH:o,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:t.cwd,...n,...t.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(e){let r=h(e.fs,e.sudo),i=new t(r),a=new n({fs:r,cwd:`/workspace`,processManager:e.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:e.fs,processManager:e.processManager,lickManager:e.lickManager,...e.realmFactory?{realmFactory:e.realmFactory}:{},buildContext:e=>m(i,e,o)}),u=(await l(e.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{n as e,r as t}from"./panel-rpc-BPwAqRch.js";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l}from"./ffmpeg-wasm-B77gfnB_.js";import{t as u}from"./permissions-surface-registry-BqPdUk9w.js";import{n as d,t as f}from"./extension-media-capture-
|
|
1
|
+
import{n as e,r as t}from"./panel-rpc-BPwAqRch.js";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l}from"./ffmpeg-wasm-B77gfnB_.js";import{t as u}from"./permissions-surface-registry-BqPdUk9w.js";import{n as d,t as f}from"./extension-media-capture-DMB4r9UQ.js";const p=`FFMPEG_ENGINE`;function m(e){let t=e?.get(p)?.trim().toLowerCase();return t===`wasm`||t===`mediabunny`?t:`auto`}const h=`FFMPEG_CORE`;function g(e){return e?.get(`FFMPEG_CORE`)?.trim().toLowerCase()===`mt`?`mt`:`st`}async function _(e,t,n){let r=e;if(typeof r.getNativeFile==`function`)try{let e=await r.getNativeFile(t);if(e){let i=await ee(e,t,n);if(await v(r,t,i,n))return i}}catch{}return y(await e.readFileBuffer(t))}async function v(e,t,n,r){if(typeof e.readFileRange!=`function`)return!0;let i,a;try{i=await e.readFileRange(t,0,64),a=(await e.stat(t)).size}catch{return!0}let o=new Uint8Array(await n.slice(0,64).arrayBuffer()),s=(a===void 0||a===n.size)&&o.byteLength===i.byteLength&&o.every((e,t)=>e===i[t]);return s||r?.(`ffmpeg: ${t}: native File (${n.size} bytes) does not match the VFS (${a??`?`} bytes, head differs=${o.byteLength!==i.byteLength||o.some((e,t)=>e!==i[t])}); reading it through the VFS instead`),s}async function ee(e,t,n,r=e=>void structuredClone(e)){let i=``,a=e=>{try{return r(e),!0}catch(e){return i=e instanceof Error?`${e.name}: ${e.message}`:String(e),!1}};if(a(e))return e;let o=new Blob([e],{type:e.type});return a(o)?(n?.(`ffmpeg: ${t}: native File is not transferable to the worker (${te(e)}; ${i}); wrapped it in a Blob`),o):(n?.(`ffmpeg: ${t}: native File is not transferable to the worker and neither is a Blob over it; read ${e.size} bytes into memory instead`),new Blob([await e.arrayBuffer()],{type:e.type}))}function y(e){return new Blob([e])}function te(e){return`${e.constructor?.name??`unknown`}, instanceof File=${typeof File<`u`&&e instanceof File}, instanceof Blob=${e instanceof Blob}, size=${e.size}, type=${JSON.stringify(e.type)}`}let b=0;function x(){b=b+1>>>0;let e=`${b}_${Date.now().toString(36)}`;return{id:e,dir:`__in${e}`}}function S(e,t){return`${e.dir}/${t}`}function C(e){return e.slice(e.lastIndexOf(`/`)+1)}function w(e,t){return`__out${e.id}_${t.split(`/`).pop()||`out.bin`}`}async function T(e,t,n){n.length!==0&&(await e.createDir(`/${t.dir}`),await e.mount(`WORKERFS`,{blobs:n},`/${t.dir}`))}async function E(e,t){try{await e.unmount(`/${t.dir}`)}catch(e){if(s(e))throw e}try{await e.deleteDir(`/${t.dir}`)}catch(e){if(s(e))throw e}}async function D(e,t){try{await e.deleteFile(t)}catch(e){if(s(e))throw e}}function O(){return{stdout:`ffmpeg - two engines behind the ffmpeg CLI
|
|
2
2
|
|
|
3
3
|
Usage:
|
|
4
4
|
ffmpeg [global-opts] -i input [input-opts] ... output [output-opts]
|
|
@@ -87,5 +87,5 @@ Notes:
|
|
|
87
87
|
`).map(e=>{let t=e.trim();if(!t.startsWith(`file `))return{raw:e};let n=Ce(t.slice(4).trim());return n?{raw:e,file:n}:{raw:e}})}function Ce(e){let t=e[0];if(t!==`'`&&t!==`"`)return e.replace(/\\(.)/g,`$1`);let n=``;for(let r=1;r<e.length;r++){let i=e[r];if(i===`\\`&&t===`"`&&r+1<e.length){n+=e[r+1],r+=1;continue}if(i!==t){n+=i;continue}if(t===`'`&&e.slice(r,r+4)===`'\\''`){n+=`'`,r+=3;continue}return n}return n}function we(e,t,n){return`__cat${t}_${n}_${e.slice(e.lastIndexOf(`/`)+1).replace(/[^A-Za-z0-9._-]/g,`_`)||`part.bin`}`}function Te(e){return e.startsWith(`/`)||/^[A-Za-z]:/.test(e)?!1:!e.split(`/`).includes(`..`)}function Ee(e){let t=e.raw.lastIndexOf(`-safe`);if(t<0)return!0;let n=e.raw[t+1];return!(n===`0`||n?.startsWith(`-`))}async function De(e,t,n,r,i,a,o){let s=Se(new TextDecoder().decode(t)),c=e.slice(0,e.lastIndexOf(`/`))||`/`,l=[],u=[];for(let e of s){if(e.file===void 0){u.push(e.raw);continue}if(r&&!Te(e.file))return{error:{kind:`unsafe`,file:e.file}};let t=a.fs.resolvePath(c,e.file);if(!await a.fs.exists(t))return{error:{kind:`missing`,file:e.file}};let s=S(i,we(e.file,n,l.length));l.push({ffmpegName:s,data:await _(a.fs,t,o)}),u.push(`file '${s}'`)}return{listBytes:new TextEncoder().encode(u.join(`
|
|
88
88
|
`)),extraFiles:l}}function Oe(e){return e.format===`lavfi`}async function ke(e,t,n,r=()=>{}){let i=[];for(let[a,o]of e.inputs.entries()){if(Oe(o)){i.push({ffmpegName:o.path,data:null,virtual:!0});continue}let e=n.fs.resolvePath(n.cwd,o.path);if(!await n.fs.exists(e))return{error:{stdout:``,stderr:`ffmpeg: input file not found: ${o.path}\n`,exitCode:1}};let s=S(t,de(o,a));if(xe(o)){let c=await De(e,await n.fs.readFileBuffer(e),a,Ee(o),t,n,r);if(`error`in c){let{kind:e,file:t}=c.error,n=e===`unsafe`?`unsafe file name: ${t} (pass -safe 0 to allow it)`:`file not found: ${t}`;return{error:{stdout:``,stderr:`ffmpeg: concat list ${o.path}: ${n}\n`,exitCode:1}}}i.push({ffmpegName:s,data:y(c.listBytes),virtual:!1,extraFiles:c.extraFiles});continue}i.push({ffmpegName:s,data:await _(n.fs,e,r),virtual:!1})}return{inputs:i}}const Ae={threads:8,filterThreads:2};function Z(e){return e.some(e=>e===`-threads`||e.startsWith(`-threads:`))}function je(e,t=Ae,n=typeof navigator<`u`?navigator.hardwareConcurrency:void 0){let r=String(Math.max(1,Math.min(t.threads,n??t.threads))),i=[...e.inputs.flatMap(e=>e.raw),...e.outputOpts],a=[];i.includes(`-filter_threads`)||a.push(`-filter_threads`,String(t.filterThreads)),i.includes(`-filter_complex_threads`)||a.push(`-filter_complex_threads`,String(t.filterThreads));let o=e.inputs.map((e,t)=>{let n=[...t===0?a:[],...Z(e.raw)?[]:[`-threads`,r]];return n.length>0?{...e,raw:[...n,...e.raw]}:e}),s=Z(e.outputOpts)?e.outputOpts:[`-threads`,r,...e.outputOpts];return{...e,inputs:o,outputOpts:s}}function Me(e){return{stdout:``,stderr:`${e}ffmpeg: the multi-threaded core deadlocks with more than one input (ffmpeg starts a demux thread per input; emscripten proxies their pthread_create to a main thread blocked in exec; see #2810). Run without FFMPEG_CORE=mt so the single-threaded @ffmpeg/core handles this job.
|
|
89
89
|
`,exitCode:1}}function Ne(e,t,n){let r=[];for(let[n,i]of e.inputs.entries()){let e=t[n],a=i.raw;for(let t=0;t<a.length;t++){if(a[t]===`-i`){r.push(`-i`,e.virtual?a[t+1]:e.ffmpegName),t+=1;continue}r.push(a[t])}}return r.push(...e.outputOpts),r.push(n),r}function Pe(e){let t=[];for(let n of e)if(n.data!==null){for(let e of n.extraFiles??[])t.push({name:C(e.ffmpegName),data:e.data});t.push({name:C(n.ffmpegName),data:n.data})}return t}async function Fe(e){let t=`__health_probe`;try{await e.writeFile(t,new Uint8Array([0])),await e.deleteFile(t)}catch(e){if(s(e))throw e}}async function Q(e,t,n){await E(e,t),await D(e,n)}async function Ie(e,t,n,r){let i;try{i=await e.readFile(t)}catch(e){if(s(e))throw e;return{error:{stdout:``,stderr:r()||`ffmpeg: produced no output file for ${n}\n`,exitCode:1}}}let a=i instanceof Uint8Array?i:new TextEncoder().encode(typeof i==`string`?i:``);return a.byteLength===0?{error:{stdout:``,stderr:r()||`ffmpeg: produced an empty output file for ${n}\n`,exitCode:1}}:{bytes:a}}function Le(e,t,n){return n?`__null_sink${e.id}`:w(e,t)}function $(e,t){return{stdout:``,stderr:`${e}ffmpeg: ${t instanceof Error?t.message:String(t)}\nffmpeg: the wasm core faulted and was recycled; retry the command (a large input may need to be split into smaller passes)
|
|
90
|
-
`,exitCode:1}}async function Re(e){let{ffmpeg:t,parsed:n,resolvedInputs:r,stage:i,outputName:a,outputPath:s,analysisSink:c,readStderr:u}=e,d=l()===o;if(d&&n.inputs.length>1)return{early:Me(u()),outputBytes:null};await T(t,i,Pe(r));let f=c?{...n,outputOpts:K(n.outputOpts)}:n,p=Ne(d?je(f):f,r,a),m=await t.exec(p);if(m!==0)return{early:{stdout:``,stderr:u()||`ffmpeg: exited with code ${m}\n`,exitCode:m||1},outputBytes:null};if(c)return await Fe(t),{early:{stdout:``,stderr:u(),exitCode:0},outputBytes:null};let h=await Ie(t,a,s,u);return`error`in h?{early:h.error,outputBytes:null}:{early:null,outputBytes:h.bytes}}async function ze(e){let{ffmpeg:t,logHandler:n,stage:i,outputName:a,readStderr:o,faulted:c}=e;try{t.off(`log`,n)}catch{}if(c)return null;try{return await Q(t,i,a),null}catch(e){return s(e)?(r(t),$(o(),e)):null}}async function Be(e,t,n,r,i){let{ffmpegEngineFromEnv:a}=await import(`./engine-
|
|
90
|
+
`,exitCode:1}}async function Re(e){let{ffmpeg:t,parsed:n,resolvedInputs:r,stage:i,outputName:a,outputPath:s,analysisSink:c,readStderr:u}=e,d=l()===o;if(d&&n.inputs.length>1)return{early:Me(u()),outputBytes:null};await T(t,i,Pe(r));let f=c?{...n,outputOpts:K(n.outputOpts)}:n,p=Ne(d?je(f):f,r,a),m=await t.exec(p);if(m!==0)return{early:{stdout:``,stderr:u()||`ffmpeg: exited with code ${m}\n`,exitCode:m||1},outputBytes:null};if(c)return await Fe(t),{early:{stdout:``,stderr:u(),exitCode:0},outputBytes:null};let h=await Ie(t,a,s,u);return`error`in h?{early:h.error,outputBytes:null}:{early:null,outputBytes:h.bytes}}async function ze(e){let{ffmpeg:t,logHandler:n,stage:i,outputName:a,readStderr:o,faulted:c}=e;try{t.off(`log`,n)}catch{}if(c)return null;try{return await Q(t,i,a),null}catch(e){return s(e)?(r(t),$(o(),e)):null}}async function Be(e,t,n,r,i){let{ffmpegEngineFromEnv:a}=await import(`./engine-D531XNHE.js`),o=a(i.env),s=t.length===1?t[0].data:null;if(o===`wasm`||r||s===null)return o===`mediabunny`?{result:{stdout:``,stderr:`ffmpeg: FFMPEG_ENGINE=mediabunny cannot run this: analysis sinks, lavfi and concat inputs are wasm-only
|
|
91
91
|
`,exitCode:1}}:{fallback:!0,note:null};let{runFfmpegFastPath:c}=await import(`./fast-path-CYxpDuii.js`);return c({parsed:e,input:s,outputPath:i.fs.resolvePath(i.cwd,n),fs:i.fs,engine:o})}async function Ve(e,t){let n=x(),r=[],i=await ke(e,n,t,e=>r.push(e));if(`error`in i)return i.error;let a=i.inputs,o=e.outputPath,s=G(e),c=await Be(e,a,o,s,t);if(`result`in c)return c.result;let l=await He({parsed:e,ctx:t,stage:n,resolvedInputs:a,outputPath:o,analysisSink:s}),u=[...c.note?[`ffmpeg: ${c.note}`]:[],...r].map(e=>`${e}\n`).join(``);return u?{...l,stderr:`${u}${l.stderr}`}:l}async function He(e){let{parsed:t,ctx:i,stage:a,resolvedInputs:o,outputPath:s,analysisSink:c}=e,l=Le(a,s,c),u=``,d;try{d=await n({onProgress:e=>{u+=`${e}\n`},ipk:q(i),preferMt:g(i.env)===`mt`})}catch(e){return{stdout:``,stderr:`${u}ffmpeg: failed to load wasm: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}let f=e=>{u+=`${e.message}\n`};d.on(`log`,f);let p=!1,m=null,h=null;try{let e=await Re({ffmpeg:d,parsed:t,resolvedInputs:o,stage:a,outputName:l,outputPath:s,analysisSink:c,readStderr:()=>u});m=e.early,h=e.outputBytes}catch(e){p=!0,r(d),m=$(u,e)}finally{let e=await ze({ffmpeg:d,logHandler:f,stage:a,outputName:l,readStderr:()=>u,faulted:p});e&&(m=e)}if(m)return m;try{await i.fs.writeFile(i.fs.resolvePath(i.cwd,s),h??new Uint8Array)}catch(e){return{stdout:``,stderr:`${u}ffmpeg: cannot write ${s}: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}return{stdout:``,stderr:u,exitCode:0}}export{_ as a,g as c,q as createIpkContextFromCtx,E as i,m as l,x as n,h as o,S as r,fe as runFfmpeg,p as s,T as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./base64-DzRgusa4.js";import{m as t}from"./state-z3wOHLww.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-BCTAzK_L.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(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./slicc-version-
|
|
1
|
+
import{n as e}from"./slicc-version-CN6V2aMa.js";import{a as t}from"./just-bash-compat-B-SPHuh_.js";const n=`/dev/null`;function r(e){return e.oldName===n}function i(e){return e.newName===n}function a(e){let t=e.indexOf(` `);return(t===-1?e.replace(/\s+\d{4}-\d\d-\d\d[ T].*$/,``):e.slice(0,t)).trimEnd()}const o=/^@@+ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function s(e){let t=o.exec(e);return t?{oldStart:Number(t[1]),oldCount:t[2]===void 0?1:Number(t[2]),newStart:Number(t[3]),newCount:t[4]===void 0?1:Number(t[4])}:null}function c(e,t){return{...e,oldLines:[],newLines:[],oldSeen:0,newSeen:0,changeSeen:!1,leadingContext:0,trailingContext:0,lastSide:null,oldNoNewlineAtEof:!1,newNoNewlineAtEof:!1,raw:[t]}}function l(e){return{oldStart:e.oldStart,newStart:e.newStart,oldLines:e.oldLines,newLines:e.newLines,leadingContext:e.leadingContext,trailingContext:e.trailingContext,oldNoNewlineAtEof:e.oldNoNewlineAtEof,newNoNewlineAtEof:e.newNoNewlineAtEof,raw:e.raw}}function u(e){return e.oldSeen>=e.oldCount&&e.newSeen>=e.newCount}function d(e,t){e.oldLines.push(t),e.newLines.push(t),e.oldSeen++,e.newSeen++,e.lastSide=`both`,e.changeSeen?e.trailingContext++:e.leadingContext++}function f(e,t,n){t===`old`?(e.oldLines.push(n),e.oldSeen++):(e.newLines.push(n),e.newSeen++),e.lastSide=t,e.changeSeen=!0,e.trailingContext=0}function p(e,t){if(t.startsWith(`\\`))return(e.lastSide===`old`||e.lastSide===`both`)&&(e.oldNoNewlineAtEof=!0),(e.lastSide===`new`||e.lastSide===`both`)&&(e.newNoNewlineAtEof=!0),e.raw.push(t),!0;if(t===``)return d(e,``),e.raw.push(` `),!0;let n=t.slice(1);switch(t[0]){case` `:d(e,n);break;case`-`:f(e,`old`,n);break;case`+`:f(e,`new`,n);break;default:return!1}return e.raw.push(t),!0}function m(e){e.hunk&&e.current&&e.current.hunks.push(l(e.hunk)),e.hunk=null,e.complete=!1}function h(e,t){let n=e.hunk;if(!n)return!1;if(e.complete){let r=t.startsWith(`\\`);return r&&p(n,t),m(e),r}return p(n,t)?(u(n)&&(e.complete=!0),!0):(m(e),!1)}function g(e){let t={files:[],current:null,hunk:null,complete:!1,pendingOld:null};for(let n of e.split(`
|
|
2
2
|
`)){if(h(t,n))continue;if(n.startsWith(`--- `)){t.pendingOld=a(n.slice(4));continue}if(n.startsWith(`+++ `)&&t.pendingOld!==null){t.current={oldName:t.pendingOld,newName:a(n.slice(4)),hunks:[]},t.files.push(t.current),t.pendingOld=null;continue}t.pendingOld=null;let e=s(n);e&&t.current&&(t.hunk=c(e,n))}return m(t),t.files.filter(e=>e.hunks.length>0)}function _(e){return{oldName:e.newName,newName:e.oldName,hunks:e.hunks.map(e=>({oldStart:e.newStart,newStart:e.oldStart,oldLines:e.newLines,newLines:e.oldLines,leadingContext:e.leadingContext,trailingContext:e.trailingContext,oldNoNewlineAtEof:e.newNoNewlineAtEof,newNoNewlineAtEof:e.oldNoNewlineAtEof,raw:v(e)}))}}function v(e){return e.raw.map((t,n)=>n===0?`@@ -${e.newStart},${e.newLines.length} +${e.oldStart},${e.oldLines.length} @@`:t.startsWith(`-`)?`+${t.slice(1)}`:t.startsWith(`+`)?`-${t.slice(1)}`:t)}function y(e){if(e===``)return{lines:[],newlineAtEof:!0};let t=e.endsWith(`
|
|
3
3
|
`),n=e.split(`
|
|
4
4
|
`);return t&&n.pop(),{lines:n,newlineAtEof:t}}function b(e){return e.lines.length===0?``:e.lines.join(`
|
|
@@ -42,7 +42,7 @@ Examples:
|
|
|
42
42
|
gelatiere suggest "$TMPDIR/candidates.json" && gelatiere deliver
|
|
43
43
|
gelatiere dismiss skill-github
|
|
44
44
|
gelatiere use-cases --limit 3 --json
|
|
45
|
-
`,i=[`--scoop`],a=[`--limit`],o=[...i,...a];function s(e){return{stdout:e,stderr:``,exitCode:0}}function c(e){return{stdout:``,stderr:`gelatiere: ${e}\n`,exitCode:1}}const l=`kernel host has not booted yet — try again in a moment`;function u(){let e=globalThis.__slicc_gelatiere;return e&&typeof e.roots==`function`?e:null}function d(){return import(`./gelatiere-store-
|
|
45
|
+
`,i=[`--scoop`],a=[`--limit`],o=[...i,...a];function s(e){return{stdout:e,stderr:``,exitCode:0}}function c(e){return{stdout:``,stderr:`gelatiere: ${e}\n`,exitCode:1}}const l=`kernel host has not booted yet — try again in a moment`;function u(){let e=globalThis.__slicc_gelatiere;return e&&typeof e.roots==`function`?e:null}function d(){return import(`./gelatiere-store-BY0hZvSS.js`)}async function f(t,n){let r=e(t,{bool:[`--reset`]});if(`error`in r)return c(r.error);let i=u();if(!i)return c(l);let a=await(await d()).loadGelatiereConfig(n),o=``;if(r.bools.has(`--reset`)){let e=await i.unregisterOwned();o=e.length?`Dropped ${e.length} gelatiere unit(s): ${e.join(`, `)}\n`:``}let f;try{f=await i.ensureUnit(a.allowedCommands)}catch(e){return c(e instanceof Error?e.message:String(e))}let m=await i.ensureNightly(a.nightly);return s(o+`${f.created?`Created`:`Found`} the gelatiere (${f.jid}, folder ${f.folder})\n`+p(f.allowList)+`${m.created?`Registered`:`Found`} nightly pass: cron "${m.cron}" (${m.id})\nSuggestions render in the suggestions card; \`gelatiere run\` asks for a pass now.
|
|
46
46
|
`)}function p(e){return e===`updated`?`Updated its command allow-list from GELATIERE.md
|
|
47
47
|
`:e===`deferred`?`Left its command allow-list alone: the gelatiere is mid-pass and applying it would
|
|
48
48
|
cancel the pass — run \`gelatiere init\` again once it is idle
|
|
@@ -50,5 +50,5 @@ cancel the pass — run \`gelatiere init\` again once it is idle
|
|
|
50
50
|
`),s(l)}async function g(t,n){let r=e(t,{value:i,bool:[`--force`]});if(`error`in r)return c(r.error);let a=u();if(!a)return c(l);let o=await d(),f=await o.readGelatiereSuggestions(n),p=o.openSuggestions(f),m=await o.readGelatiereState(n);if(o.suggestionsSince(f,m.lastDeliveredAt).length===0&&!r.bools.has(`--force`))return s(`Nothing new since the last delivery; no lick sent (use --force to resend).
|
|
51
51
|
`);let h=a.roots();if(h.length===0)return c(`no cone is running to deliver to`);let g=r.values.get(`--scoop`),v=g?h.find(e=>e.folder===g||e.name===g||e.jid===g):void 0;if(g&&!v)return c(`unknown delivery target "${g}" (cones: ${h.map(e=>e.folder).join(`, `)})`);let y=await _(a,h,v?[v]:h,{since:m.lastDeliveredAt,open:p,force:r.bools.has(`--force`),alias:g});g||await o.writeGelatiereState(n,{...m,lastDeliveredAt:new Date().toISOString()});let b=g?` (targeted; the delivery watermark is unchanged)`:``;return y.length===0?s(`Nothing addressed to ${g??`any running cone`}; no lick sent${b}\n`):s(`Delivered to ${y.length} cone(s): ${y.join(`, `)}${b}\n`)}async function _(e,t,n,r){let i=await d(),a=new Set(t.map(e=>e.folder)),o=t[0].folder,s=[];for(let t of n){let n=i.suggestionsForCone(r.open,t.folder,o,a),c=n.filter(e=>i.isNewSince(e,r.since,t.folder));if(c.length===0&&!(r.force&&n.length>0))continue;let l=r.alias??t.folder;e.lick(l,i.buildGelatiereLickBody(c,n)),s.push(`${l} (${c.length} new, ${n.length} open)`)}return s}async function v(t,n){let r=e(t,{bool:[`--all`,`--json`]});if(`error`in r)return c(r.error);let i=await d(),a=await i.readGelatiereSuggestions(n),o=r.bools.has(`--all`)?a:i.openSuggestions(a);if(r.bools.has(`--json`))return s(`${JSON.stringify(o,null,2)}\n`);if(o.length===0)return s(a.length===0?"No suggestions yet. `gelatiere run` asks for a pass now.\n":"No open suggestions (every one has been taken or dismissed; `--all` lists them).\n");let l=``;for(let e of o){let t=e.dismissedAt?` (dismissed)`:e.takenAt?` (taken)`:``;l+=`${e.id} [${e.kind}]${t}\n ${e.title}\n`,e.install&&(l+=` install: ${e.install}\n`),e.prompt&&(l+=` try: ${e.prompt}\n`)}return s(l)}async function y(e,t){let n=e[0];return n?await(await d()).dismissGelatiereSuggestion(t,n)?s(`Dismissed ${n}.\n`):c(`no open suggestion with id "${n}"`):c("dismiss requires a suggestion id (see `gelatiere list`)")}const b=`https://www.sliccy.com`,x=512e3,S=/^[a-z0-9][a-z0-9-]*$/;async function C(e,t){let n=await fetch(`${b}${e}`,{signal:AbortSignal.timeout(15e3)});if(!n.ok)throw Error(`${e}: HTTP ${n.status}`);let r=await n.text();return r.length>t?r.slice(0,t):r}async function w(){try{let e=await C(`/skills/catalog.json`,x);return s(e.endsWith(`
|
|
52
52
|
`)?e:`${e}\n`)}catch(e){return c(`catalog fetch failed: ${e instanceof Error?e.message:String(e)}`)}}async function T(){try{let e=[...(await C(`/sitemap.xml`,x)).matchAll(/<loc>[^<]*\/man\/([a-z0-9-]+)(?:\.html)?<\/loc>/g)].map(e=>e[1]).sort();return e.length===0?c(`no man pages found in the sitemap`):s(`${[...new Set(e)].join(` `)}\n`)}catch(e){return c(`sitemap fetch failed: ${e instanceof Error?e.message:String(e)}`)}}async function E(e){let t=e[0];if(!t)return c(`man requires a command name: gelatiere man <command>`);if(!S.test(t))return c(`not a command name: "${t}"`);try{let e=await C(`/man/${t}.plain.html`,16e3);return s(e.endsWith(`
|
|
53
|
-
`)?e:`${e}\n`)}catch(e){return c(`man fetch failed: ${e instanceof Error?e.message:String(e)}`)}}function D(e,t,n){let r=e=>{let t=n.match(RegExp(`<meta[^>]+name=["']${e}["'][^>]+content=(["'])((?:(?!\\1).)*)\\1`,`i`));return t?k(t[2]).trim():``},i=n.match(/<title[^>]*>([^<]*)<\/title>/i);return{slug:e,url:t,title:i?k(i[1]).trim():A(e),description:r(`description`),skills:r(`slicc-upskill`).split(`,`).map(e=>e.trim()).filter(Boolean)}}const O={amp:`&`,lt:`<`,gt:`>`,quot:`"`,"#39":`'`,"#x27":`'`};function k(e){return e.replace(/&(#x?[0-9a-fA-F]+|[a-z]+);/g,(e,t)=>{let n=O[t.toLowerCase()];if(n)return n;let r=t.match(/^#(x?)([0-9a-fA-F]+)$/i);if(!r)return e;let i=Number.parseInt(r[2],r[1]?16:10);return Number.isFinite(i)?String.fromCodePoint(i):e})}function A(e){let t=e.replace(/-/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function j(e,t){return e<=0?0:Math.floor(t/864e5)%e}function M(e,t,n){if(t>=e.length)return[...e];let r=j(e.length,n);return Array.from({length:t},(t,n)=>e[(r+n)%e.length])}async function N(e,t){let n=Array(e.length),r=0,i=async()=>{for(;r<e.length;){let i=r++;n[i]=await t(e[i])}};return await Promise.all(Array.from({length:Math.min(4,e.length)},()=>i())),n}async function P(t){let n=e(t,{value:a,bool:[`--json`]});if(`error`in n)return c(n.error);let r=n.values.get(`--limit`),i=r===void 0?12:Number(r);if(!Number.isInteger(i)||i<=0)return c(`--limit must be a positive whole number, not "${r}"`);let o;try{let e=await C(`/sitemap.xml`,x);o=[...new Set([...e.matchAll(/<loc>[^<]*\/use-cases\/([a-z0-9-]+)(?:\.html)?<\/loc>/g)].map(e=>e[1]))].sort()}catch(e){return c(`sitemap fetch failed: ${e instanceof Error?e.message:String(e)}`)}if(o.length===0)return c(`no use cases found in the sitemap`);let l=await N(M(o,Math.min(i,12),Date.now()),async e=>{let t=`${b}/use-cases/${e}`;try{return D(e,t,await C(`/use-cases/${e}`,24e3))}catch{return{slug:e,url:t,title:A(e),description:``,skills:[]}}});if(n.bools.has(`--json`))return s(`${JSON.stringify(l,null,2)}\n`);let u=``;for(let e of l)u+=`${e.slug}\t${e.title}\n ${e.url}\n`,e.description&&(u+=` ${e.description}\n`),e.skills.length&&(u+=` skills: ${e.skills.join(` `)}\n`);return s(u)}async function F(e){let t=await d(),n=u(),r=n?.unit(),i=await t.loadGelatiereConfig(e),a=await t.readGelatiereState(e),o=await t.readGelatiereSuggestions(e),c=``,{isMemoryV2Enabled:l}=await import(`./memory-v2-flag-
|
|
53
|
+
`)?e:`${e}\n`)}catch(e){return c(`man fetch failed: ${e instanceof Error?e.message:String(e)}`)}}function D(e,t,n){let r=e=>{let t=n.match(RegExp(`<meta[^>]+name=["']${e}["'][^>]+content=(["'])((?:(?!\\1).)*)\\1`,`i`));return t?k(t[2]).trim():``},i=n.match(/<title[^>]*>([^<]*)<\/title>/i);return{slug:e,url:t,title:i?k(i[1]).trim():A(e),description:r(`description`),skills:r(`slicc-upskill`).split(`,`).map(e=>e.trim()).filter(Boolean)}}const O={amp:`&`,lt:`<`,gt:`>`,quot:`"`,"#39":`'`,"#x27":`'`};function k(e){return e.replace(/&(#x?[0-9a-fA-F]+|[a-z]+);/g,(e,t)=>{let n=O[t.toLowerCase()];if(n)return n;let r=t.match(/^#(x?)([0-9a-fA-F]+)$/i);if(!r)return e;let i=Number.parseInt(r[2],r[1]?16:10);return Number.isFinite(i)?String.fromCodePoint(i):e})}function A(e){let t=e.replace(/-/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function j(e,t){return e<=0?0:Math.floor(t/864e5)%e}function M(e,t,n){if(t>=e.length)return[...e];let r=j(e.length,n);return Array.from({length:t},(t,n)=>e[(r+n)%e.length])}async function N(e,t){let n=Array(e.length),r=0,i=async()=>{for(;r<e.length;){let i=r++;n[i]=await t(e[i])}};return await Promise.all(Array.from({length:Math.min(4,e.length)},()=>i())),n}async function P(t){let n=e(t,{value:a,bool:[`--json`]});if(`error`in n)return c(n.error);let r=n.values.get(`--limit`),i=r===void 0?12:Number(r);if(!Number.isInteger(i)||i<=0)return c(`--limit must be a positive whole number, not "${r}"`);let o;try{let e=await C(`/sitemap.xml`,x);o=[...new Set([...e.matchAll(/<loc>[^<]*\/use-cases\/([a-z0-9-]+)(?:\.html)?<\/loc>/g)].map(e=>e[1]))].sort()}catch(e){return c(`sitemap fetch failed: ${e instanceof Error?e.message:String(e)}`)}if(o.length===0)return c(`no use cases found in the sitemap`);let l=await N(M(o,Math.min(i,12),Date.now()),async e=>{let t=`${b}/use-cases/${e}`;try{return D(e,t,await C(`/use-cases/${e}`,24e3))}catch{return{slug:e,url:t,title:A(e),description:``,skills:[]}}});if(n.bools.has(`--json`))return s(`${JSON.stringify(l,null,2)}\n`);let u=``;for(let e of l)u+=`${e.slug}\t${e.title}\n ${e.url}\n`,e.description&&(u+=` ${e.description}\n`),e.skills.length&&(u+=` skills: ${e.skills.join(` `)}\n`);return s(u)}async function F(e){let t=await d(),n=u(),r=n?.unit(),i=await t.loadGelatiereConfig(e),a=await t.readGelatiereState(e),o=await t.readGelatiereSuggestions(e),c=``,{isMemoryV2Enabled:l}=await import(`./memory-v2-flag-DVbOtPFF.js`);l()||(c+=`Memory v2: OFF — the nightly is unscheduled and session ends do not trigger passes
|
|
54
54
|
`),c+=`Unit: ${r?`${r.jid} (folder ${r.folder})`:"not created — run `gelatiere init`"}\n`;let f=n?.nightly();return c+=`Nightly: ${f?`registered, cron "${f.cron}" (${f.id})`:`not registered — run \`gelatiere init\` (cron "${i.nightly}")`}\n`,c+=`Interval: ${i.intervalHours}h between session-end passes\n`,c+=I(i.allowedCommands,n?.unitAllowedCommands(),t),c+=`Passes: ${a.passes}\n`,c+=`Last pass: ${a.lastPassAt??`never`}\n`,c+=`Last trigger: ${a.lastTriggeredAt??`never`}\n`,c+=`Last delivery: ${a.lastDeliveredAt??`never`}\n`,c+=`Suggestions: ${t.openSuggestions(o).length} open, ${t.takenSuggestions(o).length} taken, ${o.length} total\n`,s(c)}function I(e,t,n){let r=e=>{let t=e.filter(e=>!n.GELATIERE_BASE_ALLOWED_COMMANDS.includes(e));return t.length?` (+${t.join(`, `)} from GELATIERE.md)`:``};return t?t.length===e.length&&t.every((t,n)=>t===e[n])?`Commands: ${t.length} allowed without approval${r(t)}\n`:`Commands: ${t.length} in force${r(t)}; GELATIERE.md asks for ${e.length}${r(e)} — run \`gelatiere init\`\n`:`Commands: ${e.length} configured${r(e)}, pending — run \`gelatiere init\`\n`}async function L(e,n,i){let a=e[0];if(!a||t(e,{valueFlags:o}))return s(r);let l=e.slice(1);switch(a){case`init`:return f(l,i.fs);case`run`:return m(n.env);case`suggest`:return h(l,i.fs);case`deliver`:return g(l,i.fs);case`list`:return v(l,i.fs);case`dismiss`:return y(l,i.fs);case`status`:return F(i.fs);case`catalog`:return w();case`commands`:return T();case`man`:return E(l);case`use-cases`:return P(l);default:return c(`unknown command: ${a}\n${r}`)}}export{L as runGelatiere};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./panel-rpc-BPwAqRch.js";import{r as t}from"./base64-
|
|
1
|
+
import{n as e}from"./panel-rpc-BPwAqRch.js";import{r as t}from"./base64-BPBW1Gzr.js";import{a as n,i as r}from"./just-bash-compat-B-SPHuh_.js";const i=[`prompt`,`exec`,`watch`];function a(e){return{stdout:``,stderr:e.endsWith(`
|
|
2
2
|
`)?e:`${e}\n`,exitCode:1}}function o(e){return{stdout:e,stderr:``,exitCode:0}}function s(){return o(`slicc - talk to another SLICC leader as a client
|
|
3
3
|
|
|
4
4
|
Usage: slicc <target> prompt [--steer] [--timeout <s>] <text...>
|