sliccy 6.248.12 → 6.248.13

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.
Files changed (131) hide show
  1. package/dist/ui/.vite/manifest.json +200 -200
  2. package/dist/ui/assets/{account-store-D0e9GeOG.js → account-store-AloIt5Ss.js} +1 -1
  3. package/dist/ui/assets/{account-store-BP0-Mqyf.js → account-store-D4Humqb-.js} +1 -1
  4. package/dist/ui/assets/{adobe-D0KRBXPj.js → adobe-COzZgYMJ.js} +1 -1
  5. package/dist/ui/assets/{adobe-BMlejZ76.js → adobe-DzPNN5WH.js} +1 -1
  6. package/dist/ui/assets/{agent-panels-DDsYvxLe.js → agent-panels-C7WGWk6D.js} +1 -1
  7. package/dist/ui/assets/{almost-bash-shell-headless-EFGubLAy.js → almost-bash-shell-headless--HYnQClo.js} +12 -12
  8. package/dist/ui/assets/{apply-layout-CRSKm6Ba.js → apply-layout-C4DLtjYf.js} +1 -1
  9. package/dist/ui/assets/{azure-openai-Bhhihk9l.js → azure-openai-DCtV7Fk7.js} +1 -1
  10. package/dist/ui/assets/{azure-openai-6xgVEKV3.js → azure-openai-qBC0T6wP.js} +1 -1
  11. package/dist/ui/assets/{cdp-CGkHzMd4.js → cdp-CCSeAKYa.js} +1 -1
  12. package/dist/ui/assets/{cerebras-Czq-tnWY.js → cerebras-BlBAjiPm.js} +1 -1
  13. package/dist/ui/assets/{cerebras-DtBI_gM6.js → cerebras-D05pSaD3.js} +1 -1
  14. package/dist/ui/assets/{composer-speech-DuwfvFb-.js → composer-speech-ZEQzpxXl.js} +1 -1
  15. package/dist/ui/assets/{connect-surface-_2qtZZak.js → connect-surface-DVe7YnEx.js} +1 -1
  16. package/dist/ui/assets/{directed-approval-Cu86OGA8.js → directed-approval-DpSG1Fn9.js} +1 -1
  17. package/dist/ui/assets/{emscripten-vfs-hook-EtC57PJB.js → emscripten-vfs-hook-rbqoLuA5.js} +1 -1
  18. package/dist/ui/assets/{frozen-archive-writer-BBomoaln.js → frozen-archive-writer-ClcpBoUl.js} +1 -1
  19. package/dist/ui/assets/{frozen-archive-writer-BCkRktFY.js → frozen-archive-writer-D6ckorva.js} +1 -1
  20. package/dist/ui/assets/{frozen-session-delete-DuPE85FS.js → frozen-session-delete-_74oIhfQ.js} +1 -1
  21. package/dist/ui/assets/{frozen-session-identity-CbFcW0gt.js → frozen-session-identity-DRez4L_k.js} +1 -1
  22. package/dist/ui/assets/{frozen-session-identity-hf2cKRyg.js → frozen-session-identity-DW7M6tap.js} +1 -1
  23. package/dist/ui/assets/{gelatiere-unit-LEGH6U9y.js → gelatiere-unit-DY9kFx7W.js} +1 -1
  24. package/dist/ui/assets/{github-DdY_7Nut.js → github-BAVQKGLM.js} +1 -1
  25. package/dist/ui/assets/{github-copilot-BSyPXNk7.js → github-copilot-B2ui266i.js} +1 -1
  26. package/dist/ui/assets/{github-copilot-DzlBKVNv.js → github-copilot-NuiVJlRe.js} +1 -1
  27. package/dist/ui/assets/{github-BtIOov6m.js → github-seYRLByd.js} +1 -1
  28. package/dist/ui/assets/{hear-waeOEiF9.js → hear-LEawuxbU.js} +1 -1
  29. package/dist/ui/assets/{js-realm-worker-gCWtclsC.js → js-realm-worker-BQ2E7b6Z.js} +2 -2
  30. package/dist/ui/assets/{jsh-executor-dZ0E8OWq.js → jsh-executor-BA7Owezg.js} +3 -3
  31. package/dist/ui/assets/{kernel-worker-D698PKFz.js → kernel-worker-Bl7wfxQy.js} +8 -8
  32. package/dist/ui/assets/{lick-ws-bridge-DElVrfug.js → lick-ws-bridge-BEHNQbo5.js} +1 -1
  33. package/dist/ui/assets/{lick-ws-bridge-uXWDwK6c.js → lick-ws-bridge-BIajXq6B.js} +1 -1
  34. package/dist/ui/assets/{live-session-curation-DU31GiT4.js → live-session-curation-BJVU7yfS.js} +1 -1
  35. package/dist/ui/assets/{live-session-curation-O66ZEy4b.js → live-session-curation-C8cnTFuk.js} +1 -1
  36. package/dist/ui/assets/{live-session-snapshot-CnzVaiNh.js → live-session-snapshot-DB7ATVqO.js} +1 -1
  37. package/dist/ui/assets/{local-llm-jA4Uiim7.js → local-llm-B72jeBdJ.js} +1 -1
  38. package/dist/ui/assets/{local-llm-jVTpMC6G.js → local-llm-Dxm6T0ph.js} +1 -1
  39. package/dist/ui/assets/{main-cherry-BnNhWj0g.js → main-cherry-Cndxk3tr.js} +1 -1
  40. package/dist/ui/assets/{main-Cv-je9Rc.js → main-pG2z7nDr.js} +3 -3
  41. package/dist/ui/assets/{mcp-command-L7PjP1mU.js → mcp-command-R_syvmA2.js} +10 -10
  42. package/dist/ui/assets/{memory-curation-seam-DJumMsqR.js → memory-curation-seam-xAt4_ZGt.js} +1 -1
  43. package/dist/ui/assets/{memory-health-CQ-a47lj.js → memory-health-N-Qft3RQ.js} +1 -1
  44. package/dist/ui/assets/{memory-write-execute-_6492M1n.js → memory-write-execute-CcPwzxh2.js} +1 -1
  45. package/dist/ui/assets/{merge-folded-cost-into-frozen-C_7ZRri4.js → merge-folded-cost-into-frozen-D5QzQftk.js} +1 -1
  46. package/dist/ui/assets/{new-session-CbcR9xaj.js → new-session-CzmqZfEw.js} +2 -2
  47. package/dist/ui/assets/{oauth-bootstrap-CSuhhsId.js → oauth-bootstrap-BgBpgpMH.js} +2 -2
  48. package/dist/ui/assets/{onboarding-orchestrator-CfIlPa5s.js → onboarding-orchestrator-B0EOdDeN.js} +1 -1
  49. package/dist/ui/assets/{openai-codex-G2p2EV_-.js → openai-codex-BuzdyFkb.js} +1 -1
  50. package/dist/ui/assets/{openai-codex-DHrvA_gh.js → openai-codex-CBBCnX5G.js} +1 -1
  51. package/dist/ui/assets/{openrouter-yRyVYBsj.js → openrouter-CajNnUyi.js} +1 -1
  52. package/dist/ui/assets/{openrouter-free-Dyn8oC5q.js → openrouter-free-CoKNk8Q9.js} +1 -1
  53. package/dist/ui/assets/{openrouter-free-CVp7yz7p.js → openrouter-free-DvQSB466.js} +1 -1
  54. package/dist/ui/assets/{openrouter-oauth-FvnbQ-_a.js → openrouter-oauth-Cwnv6aaR.js} +1 -1
  55. package/dist/ui/assets/{openrouter-oauth-CoTDuH1p.js → openrouter-oauth-Dm2bFG2r.js} +1 -1
  56. package/dist/ui/assets/{openrouter-GYjqrrbU.js → openrouter-yrPyWZSZ.js} +1 -1
  57. package/dist/ui/assets/{panel-rpc-handlers-Bj7Ewkuc.js → panel-rpc-handlers-0Asc887-.js} +2 -2
  58. package/dist/ui/assets/{panelize-shell-BTtSLMeI.js → panelize-shell-CYWV616_.js} +1 -1
  59. package/dist/ui/assets/{pi-edit-execution-BXKymnwc.js → pi-edit-execution-DUHiH3Ek.js} +1 -1
  60. package/dist/ui/assets/{provider-pESeRrgl.js → provider-DQEpec-V.js} +1 -1
  61. package/dist/ui/assets/{provider-Beo3KnMC.js → provider-gVV-Tw2o.js} +1 -1
  62. package/dist/ui/assets/{provider-settings-D4dahP2q.js → provider-settings-HdIWRUQi.js} +1 -1
  63. package/dist/ui/assets/provider-store-access-BG9uc1UB.js +1 -0
  64. package/dist/ui/assets/provider-store-access-CkviLtwb.js +1 -0
  65. package/dist/ui/assets/{providers-DfuNj1kC.js → providers-BPtyhTCJ.js} +2 -2
  66. package/dist/ui/assets/{providers-BGZJlF11.js → providers-BqUoo02I.js} +1 -1
  67. package/dist/ui/assets/{quick-llm-efZ786_L.js → quick-llm-DKIeT-Bm.js} +1 -1
  68. package/dist/ui/assets/{realm-inprocess-Cl0vw0Bl.js → realm-inprocess-I1Oa37_B.js} +2 -2
  69. package/dist/ui/assets/{realm-unhandled-rejections-CEsfeJY7.js → realm-unhandled-rejections-5totJ0nZ.js} +1 -1
  70. package/dist/ui/assets/{realm-unhandled-rejections-DR09BQoo.js → realm-unhandled-rejections-Vf408gQs.js} +1 -1
  71. package/dist/ui/assets/{recovery-screen-DBBPBqDy.js → recovery-screen-d6N9mctq.js} +1 -1
  72. package/dist/ui/assets/{remote-terminal-view-DxBlyTFr.js → remote-terminal-view-B8EZ4je-.js} +2 -2
  73. package/dist/ui/assets/{restore-DEp3FGCS.js → restore-YHJZnRoZ.js} +1 -1
  74. package/dist/ui/assets/{run-BYAUzJ7h.js → run-Ds5q8C_n.js} +2 -2
  75. package/dist/ui/assets/{run-HHTi0ySM.js → run-QN9mmLnD.js} +1 -1
  76. package/dist/ui/assets/{run-83BfsEf_.js → run-jEnj-WXZ.js} +2 -2
  77. package/dist/ui/assets/{run-BLaT47am.js → run-qBD2W0pE.js} +1 -1
  78. package/dist/ui/assets/{serve-command-DmAl0Ofo.js → serve-command-ClUJJ3EB.js} +2 -2
  79. package/dist/ui/assets/{serve-runtime-DbVW48FC.js → serve-runtime-WdVepvEi.js} +1 -1
  80. package/dist/ui/assets/{session-command-memory-Dg6TUtA8.js → session-command-memory-CQnSNVmV.js} +2 -2
  81. package/dist/ui/assets/{session-jsonl-gGqdYluO.js → session-jsonl-BGHEGuWx.js} +1 -1
  82. package/dist/ui/assets/{session-jsonl-BLS0Lhly.js → session-jsonl-BjBaj5ud.js} +1 -1
  83. package/dist/ui/assets/{session-search-index-DSkUnGiE.js → session-search-index-DFWu63Zi.js} +1 -1
  84. package/dist/ui/assets/{setup-feature-flags-remote-DNStuYG4.js → setup-feature-flags-remote-CUbaBhWB.js} +1 -1
  85. package/dist/ui/assets/{setup-model-catalog-BbgUD19y.js → setup-model-catalog-CykSe_Dx.js} +1 -1
  86. package/dist/ui/assets/{silent-renew-backoff-BgxLAhiO.js → silent-renew-backoff-BMr_pGCU.js} +1 -1
  87. package/dist/ui/assets/slicc-version-D_fWoQ7a.js +1 -0
  88. package/dist/ui/assets/{soundscape-DlSE4wJ0.js → soundscape-Blo80kkF.js} +1 -1
  89. package/dist/ui/assets/{speak-aa5haM5d.js → speak-DYYfW_FH.js} +1 -1
  90. package/dist/ui/assets/{sprinkle-manager-Ljoyy6IX.js → sprinkle-manager-6IcFnb1j.js} +1 -1
  91. package/dist/ui/assets/{sprinkle-renderer-DzHCoSrV.js → sprinkle-renderer-BnGOcTUx.js} +1 -1
  92. package/dist/ui/assets/{sudo-ByfhezCP.js → sudo-cs2WnTRn.js} +1 -1
  93. package/dist/ui/assets/{supervisor-IIeyJvg5.js → supervisor-BULFrqrk.js} +1 -1
  94. package/dist/ui/assets/{sync-dialog-ClAMRf3Q.js → sync-dialog-MmcHaZwh.js} +1 -1
  95. package/dist/ui/assets/{transformers-env-DkZ_rlLG.js → transformers-env-Fm5j4giD.js} +1 -1
  96. package/dist/ui/assets/{tray-leader-BZHr3elV.js → tray-leader-CFIVvD5G.js} +1 -1
  97. package/dist/ui/assets/{tray-leave-runtime-3Iuks3yT.js → tray-leave-runtime-BSxSDTw5.js} +1 -1
  98. package/dist/ui/assets/{tray-sidecar-DyKogz7R.js → tray-sidecar-DQqVkAjk.js} +1 -1
  99. package/dist/ui/assets/{upgrade-detection-CxYbJzam.js → upgrade-detection-MAFg6kZz.js} +1 -1
  100. package/dist/ui/assets/{voice-reply-D5fh6cLr.js → voice-reply-Bum2oQcA.js} +1 -1
  101. package/dist/ui/assets/{wc-attach-BQ6Nf-M2.js → wc-attach-BJHnH6pd.js} +2 -2
  102. package/dist/ui/assets/{wc-browser-BXPUeqQ9.js → wc-browser-sNhsHdWm.js} +1 -1
  103. package/dist/ui/assets/{wc-computers-DfOF1PAO.js → wc-computers-CWg9NiMK.js} +1 -1
  104. package/dist/ui/assets/{wc-detached-CoA3z0b3.js → wc-detached-DZvftcPT.js} +1 -1
  105. package/dist/ui/assets/{wc-extension-CSckjicd.js → wc-extension-BaYtWo4q.js} +2 -2
  106. package/dist/ui/assets/{wc-follower-K44SsGuB.js → wc-follower-C3skKl26.js} +3 -3
  107. package/dist/ui/assets/{wc-follower-oauth-k4Kafofp.js → wc-follower-oauth-iJKLKYov.js} +1 -1
  108. package/dist/ui/assets/{wc-gelatiere-zH35fvBZ.js → wc-gelatiere-DaysrnKa.js} +1 -1
  109. package/dist/ui/assets/{wc-live-CCIu6y-_.js → wc-live-DEo-6NQK.js} +5 -5
  110. package/dist/ui/assets/{wc-nav-Cd4q6eRA.js → wc-nav-DqmL5N5I.js} +2 -2
  111. package/dist/ui/assets/{wc-onboarding-DsqCrKs_.js → wc-onboarding-Dg7G2Ykz.js} +2 -2
  112. package/dist/ui/assets/{wc-permissions-CdIjrgeO.js → wc-permissions-wBb5q-ot.js} +2 -2
  113. package/dist/ui/assets/{wc-placeholder-pxBtM346.js → wc-placeholder-Dcqr3sQ2.js} +3 -3
  114. package/dist/ui/assets/{wc-secret-request-BtXzm9Qq.js → wc-secret-request-DLngmY78.js} +1 -1
  115. package/dist/ui/assets/{wc-settings-S6NOXksl.js → wc-settings-DhxNLvFd.js} +3 -3
  116. package/dist/ui/assets/{wc-shell-D4V2456X.js → wc-shell-RF_bfAGN.js} +3 -3
  117. package/dist/ui/assets/{wc-shortcut-config-BGYlRFkN.js → wc-shortcut-config-Cr8zuZad.js} +1 -1
  118. package/dist/ui/assets/{wc-sprinkles-DMkA08sJ.js → wc-sprinkles-DyMWm1jp.js} +2 -2
  119. package/dist/ui/assets/{wc-transcript-export-BOD_uIrO.js → wc-transcript-export-DVyU4B6b.js} +2 -2
  120. package/dist/ui/assets/{wc-tray-C493vCfc.js → wc-tray-BjkHiwAE.js} +4 -4
  121. package/dist/ui/assets/welcome-detection-ZKXELBPe.js +1 -0
  122. package/dist/ui/assets/{whisper-session-DEyrzem0.js → whisper-session-nBcuStI7.js} +2 -2
  123. package/dist/ui/assets/{xai-grok-CCzGQE3l.js → xai-grok-B-1EsChx.js} +1 -1
  124. package/dist/ui/assets/{xai-grok-lKV4uY4R.js → xai-grok-B0VdJo2K.js} +1 -1
  125. package/dist/ui/index.html +3 -3
  126. package/dist/ui/packages/webapp/index.html +3 -3
  127. package/package.json +1 -1
  128. package/dist/ui/assets/provider-store-access-CBkIcehf.js +0 -1
  129. package/dist/ui/assets/provider-store-access-V0dKAQSY.js +0 -1
  130. package/dist/ui/assets/slicc-version-BErSvAx-.js +0 -1
  131. package/dist/ui/assets/welcome-detection-DUx6dD5_.js +0 -1
@@ -1 +1 @@
1
- import{t as e}from"./logger-DDBAeTLF.js";import{t}from"./permissions-surface-registry-CilCRwhh.js";import{a as n,i as r,n as i,o as a,r as o}from"./whisper-session-DEyrzem0.js";var s=e(`speech:hear`),c={};function l(){return c.getPermissionSurface?c.getPermissionSurface():t()||null}var u=3e4;function d(){if(typeof window>`u`)return null;let{SpeechRecognition:e,webkitSpeechRecognition:t}=window;return e??t??null}var f=class extends Error{code;constructor(e){super(p(e)),this.name=`SpeechRecognitionError`,this.code=e}};function p(e){switch(e){case`network`:case`service-not-allowed`:return"builtin speech recognition is unsupported in this browser (no Web Speech cloud backend) — use `hear --engine enhanced`";case`not-allowed`:return`microphone permission denied for builtin speech recognition`;case`audio-capture`:return`no microphone available for builtin speech recognition`;case`no-speech`:return`no speech detected`;case`aborted`:return`speech recognition aborted`;default:return`speech recognition error: ${e}`}}function m(e){return e instanceof f&&(e.code===`network`||e.code===`service-not-allowed`)}function h(e,t){let n=d();return n?new Promise((r,i)=>{let a=Date.now(),o=()=>Date.now()-a,c=new n;c.continuous=!1,c.interimResults=!1,e&&(c.lang=e),s.debug(`builtinOnce: recognizer constructed`,{lang:e??`(browser default)`,timeoutMs:t});let l=``,u=!1,d=setTimeout(()=>{s.debug(`builtinOnce: timeout reached — stopping recognizer`,{elapsedMs:o()});try{c.stop()}catch{}},t);c.onstart=()=>s.debug(`builtinOnce: onstart (recognition service active)`,{elapsedMs:o()}),c.onaudiostart=()=>s.debug(`builtinOnce: onaudiostart (capturing audio)`,{elapsedMs:o()}),c.onspeechstart=()=>s.debug(`builtinOnce: onspeechstart (speech detected)`,{elapsedMs:o()}),c.onspeechend=()=>s.debug(`builtinOnce: onspeechend (speech ended)`,{elapsedMs:o()}),c.onnomatch=()=>s.debug(`builtinOnce: onnomatch (no recognizable speech)`,{elapsedMs:o()}),c.onresult=e=>{let t=[];for(let n=0;n<e.results.length;n++)t.push(e.results[n][0]?.transcript??``);l=t.join(` `).trim(),s.debug(`builtinOnce: onresult`,{elapsedMs:o(),resultCount:e.results.length,transcriptLength:l.length})},c.onerror=e=>{if(e.error===`no-speech`||e.error===`aborted`){s.debug(`builtinOnce: onerror (non-fatal — ends with empty transcript)`,{elapsedMs:o(),code:e.error});return}u=!0,clearTimeout(d),s.error(`builtinOnce: onerror (fatal)`,{elapsedMs:o(),code:e.error}),i(new f(e.error))},c.onend=()=>{clearTimeout(d),u?s.debug(`builtinOnce: onend after fatal error (already rejected)`,{elapsedMs:o()}):(s.debug(`builtinOnce: onend — resolving`,{elapsedMs:o(),transcriptLength:l.length,empty:l.length===0}),r(l))},s.debug(`builtinOnce: calling recognizer.start()`,{elapsedMs:o()}),c.start()}):Promise.reject(Error(`speech recognition unavailable in this environment`))}async function g(e){let t={audio:!e||{deviceId:{exact:e}}},n=l();if(n){s.debug(`acquireMicrophoneStream: requesting microphone via permission surface`,{hasDeviceId:!!e});let r=await n.prompt({kinds:[`microphone`],description:`The hear command needs your microphone to transcribe speech.`,requestOptions:{microphone:{constraints:t}},skipIfGranted:!0});if(r.status!==`granted`){s.error(`acquireMicrophoneStream: microphone permission not granted`,{status:r.status,reason:r.reason});let e=r.message?`: ${r.message}`:``;throw Error(`microphone permission ${r.reason??r.status}${e}`)}let i=r.grants.find(e=>e.kind===`microphone`);if(!i)throw s.error(`acquireMicrophoneStream: permission granted without a microphone stream`),Error(`microphone permission granted without a stream`);return s.debug(`acquireMicrophoneStream: microphone stream acquired via surface`),i.stream}if(!navigator.mediaDevices?.getUserMedia)throw s.error(`acquireMicrophoneStream: getUserMedia unavailable in this realm`),Error(`microphone capture unavailable in this realm`);s.debug(`acquireMicrophoneStream: no permission surface; calling getUserMedia directly`);try{let e=await navigator.mediaDevices.getUserMedia(t);return s.debug(`acquireMicrophoneStream: getUserMedia succeeded (direct)`),e}catch(e){throw s.error(`acquireMicrophoneStream: getUserMedia failed (direct)`,e),e}}async function _(e){let t=await g(e),n=new MediaRecorder(t),r=[];n.ondataavailable=e=>{e.data.size>0&&r.push(e.data)},n.start(500);let i=()=>{for(let e of t.getTracks())e.stop()};return{stop:()=>new Promise(e=>{n.onstop=()=>{i(),e(r.length?new Blob(r,{type:n.mimeType||`audio/webm`}):null)};try{n.stop()}catch{i(),e(null)}}),cancel:()=>{try{n.stop()}catch{}i()}}}async function v(e){if(!l())return s.debug(`primeBuiltinPermission: no permission surface; recognizer drives its own prompt`),null;s.debug(`primeBuiltinPermission: priming microphone grant via permission surface`,{hasDeviceId:!!e});let t=await g(e);return s.debug(`primeBuiltinPermission: microphone primed; holding stream open for recognizer`),t}function y(e){if(e){for(let t of e.getTracks())t.stop();s.debug(`primeBuiltinPermission: released primed microphone stream`)}}async function b(e,t){let n=await _(e.deviceId),a=``;try{a=await h(e.lang,t)}catch(e){s.warn(`builtin endpointing failed; transcribing captured audio anyway`,e)}let c=await n.stop();if(!c)return{transcript:a,engine:`builtin`};try{let t=await r(),n=await o(await c.arrayBuffer()),a=await t.transcribe(n,{language:i(e.lang)});if(a)return{transcript:a,engine:`enhanced`}}catch(e){s.warn(`whisper transcription failed; falling back to builtin text`,e)}return{transcript:a,engine:`builtin`}}async function x(e={}){let t=e.timeoutMs??u,n=e.engine??`auto`,r=a()===`ready`;if(n===`enhanced`&&!r)throw s.error(`hearCapture: enhanced engine requested but whisper is not ready`),Error("enhanced engine not ready — run `hear --warmup` (check progress with `hear --status`)");let i=n!==`builtin`&&r;if(s.debug(`hearCapture: engine dispatch`,{requested:n,enhancedReady:r,resolved:i?`enhanced`:`builtin`}),i)return b(e,t);let o=await v(e.deviceId);try{let n=await h(e.lang,t);return s.debug(`hearCapture: builtin recognition produced a transcript`),{transcript:n,engine:`builtin`}}catch(n){if(!m(n))throw s.error(`hearCapture: builtin recognition failed`,n),n;if(r)return s.debug(`hearCapture: builtin unsupported in this browser; falling back to enhanced whisper`),y(o),o=null,b(e,t);throw s.error(`hearCapture: builtin unsupported and whisper not ready`,{code:n.code}),n}finally{y(o)}}async function S(e,t){let n=await r(),a=await o(e);return{transcript:await n.transcribe(a,{language:i(t)}),engine:`enhanced`}}function C(){let e=n();return{state:a(),...e?{loaded:e.loaded,total:e.total,etaSeconds:e.etaSeconds}:{}}}function w(){return r().catch(()=>{}),C()}export{x as hearCapture,C as hearStatus,S as hearTranscribe,w as hearWarmup};
1
+ import{t as e}from"./logger-DDBAeTLF.js";import{t}from"./permissions-surface-registry-CilCRwhh.js";import{a as n,i as r,n as i,o as a,r as o}from"./whisper-session-nBcuStI7.js";var s=e(`speech:hear`),c={};function l(){return c.getPermissionSurface?c.getPermissionSurface():t()||null}var u=3e4;function d(){if(typeof window>`u`)return null;let{SpeechRecognition:e,webkitSpeechRecognition:t}=window;return e??t??null}var f=class extends Error{code;constructor(e){super(p(e)),this.name=`SpeechRecognitionError`,this.code=e}};function p(e){switch(e){case`network`:case`service-not-allowed`:return"builtin speech recognition is unsupported in this browser (no Web Speech cloud backend) — use `hear --engine enhanced`";case`not-allowed`:return`microphone permission denied for builtin speech recognition`;case`audio-capture`:return`no microphone available for builtin speech recognition`;case`no-speech`:return`no speech detected`;case`aborted`:return`speech recognition aborted`;default:return`speech recognition error: ${e}`}}function m(e){return e instanceof f&&(e.code===`network`||e.code===`service-not-allowed`)}function h(e,t){let n=d();return n?new Promise((r,i)=>{let a=Date.now(),o=()=>Date.now()-a,c=new n;c.continuous=!1,c.interimResults=!1,e&&(c.lang=e),s.debug(`builtinOnce: recognizer constructed`,{lang:e??`(browser default)`,timeoutMs:t});let l=``,u=!1,d=setTimeout(()=>{s.debug(`builtinOnce: timeout reached — stopping recognizer`,{elapsedMs:o()});try{c.stop()}catch{}},t);c.onstart=()=>s.debug(`builtinOnce: onstart (recognition service active)`,{elapsedMs:o()}),c.onaudiostart=()=>s.debug(`builtinOnce: onaudiostart (capturing audio)`,{elapsedMs:o()}),c.onspeechstart=()=>s.debug(`builtinOnce: onspeechstart (speech detected)`,{elapsedMs:o()}),c.onspeechend=()=>s.debug(`builtinOnce: onspeechend (speech ended)`,{elapsedMs:o()}),c.onnomatch=()=>s.debug(`builtinOnce: onnomatch (no recognizable speech)`,{elapsedMs:o()}),c.onresult=e=>{let t=[];for(let n=0;n<e.results.length;n++)t.push(e.results[n][0]?.transcript??``);l=t.join(` `).trim(),s.debug(`builtinOnce: onresult`,{elapsedMs:o(),resultCount:e.results.length,transcriptLength:l.length})},c.onerror=e=>{if(e.error===`no-speech`||e.error===`aborted`){s.debug(`builtinOnce: onerror (non-fatal — ends with empty transcript)`,{elapsedMs:o(),code:e.error});return}u=!0,clearTimeout(d),s.error(`builtinOnce: onerror (fatal)`,{elapsedMs:o(),code:e.error}),i(new f(e.error))},c.onend=()=>{clearTimeout(d),u?s.debug(`builtinOnce: onend after fatal error (already rejected)`,{elapsedMs:o()}):(s.debug(`builtinOnce: onend — resolving`,{elapsedMs:o(),transcriptLength:l.length,empty:l.length===0}),r(l))},s.debug(`builtinOnce: calling recognizer.start()`,{elapsedMs:o()}),c.start()}):Promise.reject(Error(`speech recognition unavailable in this environment`))}async function g(e){let t={audio:!e||{deviceId:{exact:e}}},n=l();if(n){s.debug(`acquireMicrophoneStream: requesting microphone via permission surface`,{hasDeviceId:!!e});let r=await n.prompt({kinds:[`microphone`],description:`The hear command needs your microphone to transcribe speech.`,requestOptions:{microphone:{constraints:t}},skipIfGranted:!0});if(r.status!==`granted`){s.error(`acquireMicrophoneStream: microphone permission not granted`,{status:r.status,reason:r.reason});let e=r.message?`: ${r.message}`:``;throw Error(`microphone permission ${r.reason??r.status}${e}`)}let i=r.grants.find(e=>e.kind===`microphone`);if(!i)throw s.error(`acquireMicrophoneStream: permission granted without a microphone stream`),Error(`microphone permission granted without a stream`);return s.debug(`acquireMicrophoneStream: microphone stream acquired via surface`),i.stream}if(!navigator.mediaDevices?.getUserMedia)throw s.error(`acquireMicrophoneStream: getUserMedia unavailable in this realm`),Error(`microphone capture unavailable in this realm`);s.debug(`acquireMicrophoneStream: no permission surface; calling getUserMedia directly`);try{let e=await navigator.mediaDevices.getUserMedia(t);return s.debug(`acquireMicrophoneStream: getUserMedia succeeded (direct)`),e}catch(e){throw s.error(`acquireMicrophoneStream: getUserMedia failed (direct)`,e),e}}async function _(e){let t=await g(e),n=new MediaRecorder(t),r=[];n.ondataavailable=e=>{e.data.size>0&&r.push(e.data)},n.start(500);let i=()=>{for(let e of t.getTracks())e.stop()};return{stop:()=>new Promise(e=>{n.onstop=()=>{i(),e(r.length?new Blob(r,{type:n.mimeType||`audio/webm`}):null)};try{n.stop()}catch{i(),e(null)}}),cancel:()=>{try{n.stop()}catch{}i()}}}async function v(e){if(!l())return s.debug(`primeBuiltinPermission: no permission surface; recognizer drives its own prompt`),null;s.debug(`primeBuiltinPermission: priming microphone grant via permission surface`,{hasDeviceId:!!e});let t=await g(e);return s.debug(`primeBuiltinPermission: microphone primed; holding stream open for recognizer`),t}function y(e){if(e){for(let t of e.getTracks())t.stop();s.debug(`primeBuiltinPermission: released primed microphone stream`)}}async function b(e,t){let n=await _(e.deviceId),a=``;try{a=await h(e.lang,t)}catch(e){s.warn(`builtin endpointing failed; transcribing captured audio anyway`,e)}let c=await n.stop();if(!c)return{transcript:a,engine:`builtin`};try{let t=await r(),n=await o(await c.arrayBuffer()),a=await t.transcribe(n,{language:i(e.lang)});if(a)return{transcript:a,engine:`enhanced`}}catch(e){s.warn(`whisper transcription failed; falling back to builtin text`,e)}return{transcript:a,engine:`builtin`}}async function x(e={}){let t=e.timeoutMs??u,n=e.engine??`auto`,r=a()===`ready`;if(n===`enhanced`&&!r)throw s.error(`hearCapture: enhanced engine requested but whisper is not ready`),Error("enhanced engine not ready — run `hear --warmup` (check progress with `hear --status`)");let i=n!==`builtin`&&r;if(s.debug(`hearCapture: engine dispatch`,{requested:n,enhancedReady:r,resolved:i?`enhanced`:`builtin`}),i)return b(e,t);let o=await v(e.deviceId);try{let n=await h(e.lang,t);return s.debug(`hearCapture: builtin recognition produced a transcript`),{transcript:n,engine:`builtin`}}catch(n){if(!m(n))throw s.error(`hearCapture: builtin recognition failed`,n),n;if(r)return s.debug(`hearCapture: builtin unsupported in this browser; falling back to enhanced whisper`),y(o),o=null,b(e,t);throw s.error(`hearCapture: builtin unsupported and whisper not ready`,{code:n.code}),n}finally{y(o)}}async function S(e,t){let n=await r(),a=await o(e);return{transcript:await n.transcribe(a,{language:i(t)}),engine:`enhanced`}}function C(){let e=n();return{state:a(),...e?{loaded:e.loaded,total:e.total,etaSeconds:e.etaSeconds}:{}}}function w(){return r().catch(()=>{}),C()}export{x as hearCapture,C as hearStatus,S as hearTranscribe,w as hearWarmup};
@@ -7,7 +7,7 @@ e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=
7
7
  * @author Feross Aboukhadijeh <https://feross.org>
8
8
  * @license MIT
9
9
  */
10
- let r=t(),i=n(),a=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=l,e.SlowBuffer=b,e.INSPECT_MAX_BYTES=50;let o=2147483647;e.kMaxLength=o,l.TYPED_ARRAY_SUPPORT=s(),!l.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{let e=/* @__PURE__ */ new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function c(e){if(e>o)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return p(e)}return u(e,t,n)}l.poolSize=8192;function u(e,t,n){if(typeof e==`string`)return m(e,t);if(ArrayBuffer.isView(e))return g(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return _(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return l.from(r,t,n);let i=v(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return l.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}l.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function d(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function f(e,t,n){return d(e),e<=0||t===void 0?c(e):typeof n==`string`?c(e).fill(t,n):c(e).fill(t)}l.alloc=function(e,t,n){return f(e,t,n)};function p(e){return d(e),c(e<0?0:y(e)|0)}l.allocUnsafe=function(e){return p(e)},l.allocUnsafeSlow=function(e){return p(e)};function m(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!l.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=x(e,t)|0,r=c(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function h(e){let t=e.length<0?0:y(e.length)|0,n=c(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function g(e){if(F(e,Uint8Array)){let t=new Uint8Array(e);return _(t.buffer,t.byteOffset,t.byteLength)}return h(e)}function _(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,l.prototype),r}function v(e){if(l.isBuffer(e)){let t=y(e.length)|0,n=c(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||Te(e.length)?c(0):h(e);if(e.type===`Buffer`&&Array.isArray(e.data))return h(e.data)}function y(e){if(e>=o)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+o.toString(16)+` bytes`);return e|0}function b(e){return+e!=e&&(e=0),l.alloc(+e)}l.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==l.prototype},l.compare=function(e,t){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},l.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return l.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=l.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(F(t,Uint8Array))i+t.length>r.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(l.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function x(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return be(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return Ce(e).length;default:if(i)return r?-1:be(e).length;t=(``+t).toLowerCase(),i=!0}}l.byteLength=x;function S(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return se(this,t,n);case`utf8`:case`utf-8`:return ie(this,t,n);case`ascii`:return ae(this,t,n);case`latin1`:case`binary`:return oe(this,t,n);case`base64`:return re(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ce(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}l.prototype._isBuffer=!0;function C(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}l.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)C(this,t,t+1);return this},l.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)C(this,t,t+3),C(this,t+1,t+2);return this},l.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)C(this,t,t+7),C(this,t+1,t+6),C(this,t+2,t+5),C(this,t+3,t+4);return this},l.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?ie(this,0,e):S.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||l.compare(this,e)===0},l.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},a&&(l.prototype[a]=l.prototype.inspect),l.prototype.compare=function(e,t,n,r,i){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,s=Math.min(a,o),c=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<s;++e)if(c[e]!==u[e]){a=c[e],o=u[e];break}return a<o?-1:+(o<a)};function w(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Te(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=l.from(t,r)),l.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}l.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},l.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(Te(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return we(be(t,e.length-n),e,n,r)}function ee(e,t,n,r){return we(xe(t),e,n,r)}function te(e,t,n,r){return we(Ce(t),e,n,r)}function ne(e,t,n,r){return we(Se(t,e.length-n),e,n,r)}l.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return ee(this,e,t,n);case`base64`:return te(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ne(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function re(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function ie(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return k(r)}let O=4096;function k(e){let t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=O));return n}function ae(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function oe(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function se(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=Ee[e[r]];return i}function ce(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}l.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,l.prototype),r};function A(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=De(function(e){e>>>=0,_e(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),l.prototype.readBigUInt64BE=De(function(e){e>>>=0,_e(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},l.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=De(function(e){e>>>=0,_e(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),l.prototype.readBigInt64BE=De(function(e){e>>>=0,_e(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!1,52,8)};function j(e,t,n,r,i,a){if(!l.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;j(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;j(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,255,0),this[t]=e&255,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function le(e,t,n,r,i){ge(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function M(e,t,n,r,i){ge(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}l.prototype.writeBigUInt64LE=De(function(e,t=0){return le(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),l.prototype.writeBigUInt64BE=De(function(e,t=0){return M(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);j(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);j(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},l.prototype.writeBigInt64LE=De(function(e,t=0){return le(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),l.prototype.writeBigInt64BE=De(function(e,t=0){return M(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ue(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function N(e,t,n,r,a){return t=+t,n>>>=0,a||ue(e,t,n,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,n,r,23,4),n+4}l.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)};function de(e,t,n,r,a){return t=+t,n>>>=0,a||ue(e,t,n,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,n,r,52,8),n+8}l.prototype.writeDoubleLE=function(e,t,n){return de(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return de(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(!l.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},l.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!l.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=l.isBuffer(e)?e:l.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let fe={};function pe(e,t,n){fe[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}pe(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),pe(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),pe(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=me(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=me(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function me(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function he(e,t,n){_e(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&P(t,e.length-(n+1))}function ge(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new fe.ERR_OUT_OF_RANGE(`value`,i,e)}he(r,i,a)}function _e(e,t){if(typeof e!=`number`)throw new fe.ERR_INVALID_ARG_TYPE(t,`number`,e)}function P(e,t,n){throw Math.floor(e)===e?t<0?new fe.ERR_BUFFER_OUT_OF_BOUNDS:new fe.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(_e(e,n),new fe.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ve=/[^+/0-9A-Za-z-_]/g;function ye(e){if(e=e.split(`=`)[0],e=e.trim().replace(ve,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function be(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function xe(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Se(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function Ce(e){return r.toByteArray(ye(e))}function we(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function F(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Te(e){return e!==e}let Ee=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function De(e){return typeof BigInt>`u`?I:e}function I(){throw Error(`BigInt not supported`)}})),i=r();globalThis.Buffer===void 0&&(globalThis.Buffer=i.Buffer);function a(){return{version:`6.248.12`,releasedAt:`2026-10-14T16:00:47Z`,buildId:`6.248.12-mv8ar2et`}}function o(e){let t=typeof e==`string`?e:e.href;if(!t.startsWith(`file:`))throw TypeError(`fileURLToPath: not a file URL`);let n=new URL(t);if(n.hostname!==``&&n.hostname!==`localhost`)throw Object.assign(/* @__PURE__ */ TypeError(`File URL host must be "localhost" or empty on posix`),{code:`ERR_INVALID_FILE_URL_HOST`});if(/%2f/i.test(n.pathname))throw Object.assign(/* @__PURE__ */ TypeError(`File URL path must not include encoded / characters`),{code:`ERR_INVALID_FILE_URL_PATH`});return decodeURIComponent(n.pathname)}function s(e){let t=e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`);return new URL(`file://${t}`)}const c={URL:globalThis.URL,URLSearchParams:globalThis.URLSearchParams,fileURLToPath:o,pathToFileURL:s};function l(e,t){return Object.assign(/* @__PURE__ */ TypeError(`The "${e}" argument must be of type string or an instance of Buffer or URL. Received ${t===null?`null`:typeof t}`),{code:`ERR_INVALID_ARG_TYPE`})}function u(e){return typeof e==`object`&&!!e&&typeof e.href==`string`&&typeof e.protocol==`string`}function d(e,t=`path`){if(typeof e==`string`)return e;if(u(e)){if(e.protocol!==`file:`)throw Object.assign(/* @__PURE__ */ TypeError(`The URL must be of scheme file`),{code:`ERR_INVALID_URL_SCHEME`});return c.fileURLToPath(e.href)}if(e instanceof Uint8Array)return new TextDecoder().decode(e);throw l(t,e)}function f(e,t){let n=[...t];switch(e){case`path`:n[0]=d(n[0]);break;case`fd`:typeof n[0]!=`number`&&(n[0]=d(n[0]));break;case`pair`:n[0]=d(n[0],`src`),n[1]=d(n[1],`dest`);break;case`second`:n[1]=d(n[1])}return n}function p(e,t,n={}){let r=e;for(let i of Object.keys(t)){let a=t[i],o=r[i];a&&typeof o==`function`&&(r[i]=((...t)=>{let r;try{r=f(a,t)}catch(e){if(n.promises)return Promise.reject(e);throw e}return o.apply(e,r)}))}}function m(e){let t=!!e.isDirectory,n=e.mtimeMs??0;return{isFile:()=>!!e.isFile,isDirectory:()=>t,isSymbolicLink:()=>!!e.isSymbolicLink,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isFIFO:()=>!1,isSocket:()=>!1,size:e.size??0,mode:e.mode??(t?16877:33188),mtimeMs:n,mtime:new Date(n)}}const h=/* @__PURE__ */ new Set([`stat`,`lstat`]);function g(e){if(e.length===0)return e;if(e.length===1||e[1]===void 0)return[e[0],null];let t=e[1];return typeof t==`object`&&t&&!ArrayBuffer.isView(t)&&t.encoding===void 0?[e[0],{...t,encoding:null}]:e}function _(e){if(e instanceof Error&&e.code===void 0){let t=/^(E[A-Z]+)\b/.exec(e.message)?.[1];t&&Object.assign(e,{code:t})}return e}function v(e,t){return h.has(e)?m(t):t}function y(e,t,n,r){let i=e===`readFile`?g(r):r;return t.apply(n,i)}function b(e){let t={};for(let[n,r]of Object.entries(e))n!==`promises`&&(t[n]=typeof r==`function`?async(...t)=>{try{return v(n,await y(n,r,e,t))}catch(e){throw _(e)}}:r);return t}function x(e){let t=e;for(let[e,n]of Object.entries(t))e!==`promises`&&typeof n==`function`&&(t[e]=function(...t){let r=t[t.length-1];if(typeof r!=`function`)return n.apply(this,t);t.pop();let i;try{i=Promise.resolve(y(e,n,this,t))}catch(e){i=Promise.reject(e)}i.then(t=>e===`exists`?r(t):r(null,v(e,t)),t=>r(e!==`exists`&&_(t)))})}function S(e,t){return Object.assign(/* @__PURE__ */ Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function C(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function w(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function T(){return{readSync:e=>{throw S(`read`,e)},writeSync:e=>{throw S(`write`,e)}}}function E(e){let t=0;return{readSync(n,r,i,a){if(n!==0)throw S(`read`,n);let o=C(r),s=typeof i==`object`&&i?i:{offset:i,length:a},c=s.offset??0,l=s.length??o.length-c,u=e.readStdinBytes(),d=Math.max(0,Math.min(l,u.length-t));return o.set(u.subarray(t,t+d),c),t+=d,d},writeSync(t,n,r,i){let a=t===1?e.writeStdout:t===2?e.writeStderr:void 0;if(!a)throw S(`write`,t);if(typeof n==`string`)return a(n),new TextEncoder().encode(n).length;if(!ArrayBuffer.isView(n))throw TypeError(`writeSync: data must be a string or buffer`);let o=C(n),s=typeof r==`number`?r:0,c=o.subarray(s,i===void 0?void 0:s+i);return a(w(c)),c.length}}}const D=`exec`,ee=6e5,te=5e3;function ne(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function re(e){return e===void 0||e===0}function ie(e,t){return ne(e)?Math.min(e,ee):Math.min(t,ee)}function O(e,t){return Object.assign(/* @__PURE__ */ Error(`${e}: ${t}`),{code:e})}function k(e){let t=oe(e);if(se(t))return new Uint8Array(t.response);if(t.status>=200&&t.status<300)throw O(`EIO`,e.label);ce(t,e.label)}function ae(e){let t=k(e);try{return JSON.parse(new TextDecoder().decode(t))}catch{throw O(`EIO`,e.label)}}function oe(e){let t=new XMLHttpRequest;try{t.open(e.method,e.url,!1),t.responseType=`arraybuffer`,t.timeout=e.timeoutMs,t.setRequestHeader(`x-slicc-fs-token`,e.token),e.body?t.send(new Uint8Array(e.body)):t.send()}catch{throw O(`EIO`,e.label)}return t}function se(e){return e.status>=200&&e.status<300&&e.getResponseHeader(`x-slicc-fs`)===`1`}function ce(e,t){throw O(e.getResponseHeader(`x-slicc-fs`)===`1`&&e.getResponseHeader(`x-slicc-fs-errno`)||`EIO`,t)}function A(e){return(t,n,r)=>{let i=ae({method:`POST`,url:`/__slicc/exec-sync`,token:e,body:new TextEncoder().encode(JSON.stringify({...t,channel:D})),timeoutMs:n+te,label:r});if(!i||typeof i.stdout!=`string`||typeof i.stderr!=`string`||typeof i.exitCode!=`number`)throw O(`EIO`,r);return{stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode}}}function j(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 le(e,t={}){let n=t.timeoutMs??12e4,{syncFs:r,fsBridge:i}=t,a=t.transport??A(e);return{run(e,o={}){let s=r?.wasUsed()===!0&&i!==void 0;s&&j(r,i);let c=`sync-exec bridge, '${Array.isArray(e)?e.join(` `):e}'`,l=t.noDefaultDeadline===!0&&re(o.timeout),u=l?1/0:ie(o.timeout,n),d={command:e,...o.args===void 0?{}:{args:o.args},...o.input===void 0?{}:{stdin:o.input},...o.cwd===void 0?{}:{cwd:o.cwd},...o.env===void 0?{}:{env:o.env},...l?{}:{timeoutMs:u}};try{return a(d,u,c)}finally{s&&r.invalidate()}}}}function M(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 ue(e){let t=M(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function N(e){return Object.assign(/* @__PURE__ */ Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function de(e){return Object.assign(/* @__PURE__ */ Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function fe(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 pe=class{tree=/* @__PURE__ */ new Map;initialPaths=/* @__PURE__ */ new Set;initialContent=/* @__PURE__ */ new Map;initialKind=/* @__PURE__ */ new Map;mkdtempCounter=0;tombstones=/* @__PURE__ */ new Set;removedDirs=/* @__PURE__ */ new Set;touched=!1;constructor(e){this.loadSnapshot(e)}loadSnapshot(e){this.tree=/* @__PURE__ */ new Map,this.tombstones=/* @__PURE__ */ new Set,this.removedDirs=/* @__PURE__ */ new Set,this.initialPaths=/* @__PURE__ */ new Set,this.initialContent=/* @__PURE__ */ new Map,this.initialKind=/* @__PURE__ */ new Map,this.tree.set(`/`,{content:/* @__PURE__ */ new Uint8Array,isDirectory:!0}),this.initialPaths.add(`/`),this.initialKind.set(`/`,`directory`);for(let t of e.entries){let e=M(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,symlinkTarget:t.symlinkTarget,truncated:t.truncated,size:t.size,...t.partial?{partial:!0}:{}}),this.initialPaths.add(e),this.initialKind.set(e,this.entryKind(t)),!t.isDirectory&&!t.isSymbolicLink&&this.initialContent.set(e,t.content)}for(let t of e.entries){let e=ue(M(t.path));for(;e!==`/`&&!this.tree.has(e);)this.tree.set(e,{content:/* @__PURE__ */ new Uint8Array,isDirectory:!0}),this.initialPaths.add(e),this.initialKind.set(e,`directory`),e=ue(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=/* @__PURE__ */ new Set,this.initialContent=/* @__PURE__ */ new Map,this.initialKind=/* @__PURE__ */ 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=M(e),r=n.split(`/`).filter(Boolean),i=[],a=/* @__PURE__ */ 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(/* @__PURE__ */ Error(`ELOOP: too many symbolic links, '${n}'`),{code:`ELOOP`});a.add(s);let e=c.symlinkTarget??``;r=[...M(e.startsWith(`/`)?e:`${ue(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=ue(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0,!0))}isPartial(e){return this.tree.get(M(e))?.partial===!0}hasPartialWithin(e){let t=M(e),n=t===`/`?`/`:`${t}/`;for(let[e,r]of this.tree)if(r.partial&&(e===t||e.startsWith(n)))return!0;return!1}commitWrite(e,t){this.writeFile(e,t);let n=M(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=ue(n)}}readFile(e){this.touched=!0;let t=M(e),n=this.resolveEntry(t)?.entry;if(!n||n.isDirectory)throw N(t);if(n.truncated)throw de(t);return n.content}writeFile(e,t){this.touched=!0;let n=M(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=M(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=M(e),n=this.resolveEntry(t);if(!n)throw N(t);return this.toStat(n.entry)}lstat(e){this.touched=!0;let t=M(e),n=this.resolveEntry(t,!0);if(!n)throw N(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=M(e),n=this.resolveEntry(t);if(!n?.entry.isDirectory)throw N(t);let r=n.path===`/`?`/`:n.path+`/`,i=/* @__PURE__ */ 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=M(e);if(this.tree.has(r)){if(this.tree.get(r).isDirectory)return;throw Object.assign(/* @__PURE__ */ Error(`EEXIST: file already exists, '${r}'`),{code:`EEXIST`})}let i=ue(r);if(i!==`/`&&!this.tree.has(i)){if(!t)throw N(r);this.mkdir(i,!0,n)}this.tree.set(r,{content:/* @__PURE__ */ new Uint8Array,isDirectory:!0,...n?{partial:!0}:{}}),this.tombstones.delete(r),this.removedDirs.delete(r)}rm(e,t){this.touched=!0;let n=M(e),r=this.tree.get(n);if(!r)throw N(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(/* @__PURE__ */ 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=M(e),r=this.tree.get(n);if(!r||r.isDirectory)throw N(n);if(r.truncated)throw de(n);let i=M(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=M(e),r=this.tree.get(n);if(!r)throw N(n);let i=M(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=M(e),n=this.tree.get(t);if(!n)throw N(t);if(n.isDirectory&&!n.isSymbolicLink)throw Object.assign(/* @__PURE__ */ 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=M(e);this.tombstones.add(n),t&&this.removedDirs.add(n)}isTombstoned(e){let t=M(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=M(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&&!fe(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 me(){return globalThis.Buffer}function he(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function ge(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function _e(e,t){return Object.assign(/* @__PURE__ */ Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function P(e){return e===`/dev/stdin`||e===`/dev/stdout`||e===`/dev/stderr`}function ve(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 ye(e,t){let n=ve(e);if(n===0)return!0;if(n!==void 0||typeof e==`number`)throw _e(t,e);return!1}function be(e,t,n){let r=ve(t);if(r===1)return e.writeStdout;if(r===2)return e.writeStderr;if(r!==void 0||typeof t==`number`)throw _e(n,t)}function xe(e){return typeof e==`string`?e:ge(Re(e))}function Se(e,t){if(t===`utf8`||t===`utf-8`)return new TextDecoder().decode(e);let n=me();return n?n.from(e):e}function Ce(e){return e===null?null:typeof e==`string`?e:e?.encoding}function we(){return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,isCharacterDevice:()=>!0,size:0}}function F(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(!ye(e,`read`))return n.readFile(e,r);let i=Ce(r);if(i===null||i===`buffer`){let e=me(),n=t.readStdinBytes();return e?e.from(n):n}return new TextDecoder().decode(t.readStdinBytes())},e.readFileBinary=async e=>ye(e,`read`)?t.readStdinBytes():n.readFileBinary(e),e.writeFile=async(e,r)=>{let i=be(t,e,`write`);return i?(i(xe(r)),!0):n.writeFile(e,r)},e.writeFileBinary=async(e,r)=>{let i=be(t,e,`write`);return i?(i(ge(r)),!0):n.writeFileBinary(e,r)},e.appendFile=async(e,r)=>{let i=be(t,e,`append`);if(!i)return n.appendFile(e,r);i(xe(r))},e.access=async e=>{if(!P(e))return n.access(e)},e.exists=async e=>P(e)||n.exists(e),e.stat=async e=>P(e)?{isFile:!0,isDirectory:!1,size:0}:n.stat(e)}function Te(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=Ce(n);if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=me();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(/* @__PURE__ */ Error(`ENOENT: no such file or directory, access '${t}'`),{code:`ENOENT`})}let m={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 F(m,n),p(m,Ee,{promises:!0}),m.promises=b(m),x(m),m}const Ee={readFile:`fd`,readFileBinary:`fd`,writeFile:`fd`,writeFileBinary:`fd`,appendFile:`fd`,cp:`pair`,rm:`path`,readDir:`path`,readdir:`path`,exists:`path`,stat:`path`,mkdir:`path`,mkdtemp:`path`,rename:`pair`,access:`path`,unlink:`path`,rmdir:`path`,copyFile:`pair`,fetchToFile:`second`},De={readFileSync:`fd`,writeFileSync:`fd`,appendFileSync:`fd`,truncateSync:`path`,existsSync:`path`,accessSync:`path`,mkdirSync:`path`,statSync:`path`,lstatSync:`path`,realpathSync:`path`,readdirSync:`path`,copyFileSync:`pair`,cpSync:`pair`,chmodSync:`path`,utimesSync:`path`,mkdtempSync:`path`,rmSync:`path`,rmdirSync:`path`,unlinkSync:`path`,renameSync:`pair`};function I(e,t,n=``){return Object.assign(/* @__PURE__ */ Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function Oe(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 ke(e,t,n){let r=t;if(r?.rename&&r.rmdir&&r.rm&&e.hasPartialWithin(n))return r}function Ae(e,t,n){j(e,t);try{n()}finally{e.invalidate()}}function je(e){let{syncFs:t,bridge:n,resolve:r,existsResolved:i,lstatResolved:a,statResolved:o,readBytes:s,writeThrough:c,persistDelete:l}=e,u=(e,r)=>{let i=r?.requireFile?void 0:ke(t,n,e);return i?(Ae(t,i,()=>r?.recursive?i.rm(e):i.rmdir(e)),!0):Oe(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 I(`ENOENT`,n,`rm`)},rmdirSync(e,t){let n=r(e);if(i(n)&&!a(n).isDirectory)throw I(`ENOTDIR`,n,`rmdir`);if(!u(n,{recursive:t?.recursive===!0}))throw I(`ENOENT`,n,`rmdir`)},unlinkSync(e){let t=r(e);if(!u(t,{requireFile:!0}))throw I(`ENOENT`,t,`unlink`)},renameSync(e,i){let a=r(e),l=r(i),d=ke(t,n,a);if(d){Ae(t,d,()=>d.rename(a,l));return}try{t.rename(a,l);return}catch(e){if(e?.code!==`ENOENT`)throw e}if(!n||t.isTombstoned(a))throw I(`ENOENT`,a,`rename`);if(o(a).isDirectory)throw I(`EISDIR`,a,`rename`);if(c(l,s(a)),!u(a,{requireFile:!0}))throw I(`ENOENT`,a,`rename`)}}}function Me(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)=>ye(e,`read`)?Se(t.readStdinBytes(),Ce(r)):n.readFileSync(e,r),e.writeFileSync=(e,r)=>{let i=be(t,e,`write`);i?i(xe(r)):n.writeFileSync(e,r)},e.appendFileSync=(e,r)=>{let i=be(t,e,`append`);i?i(xe(r)):n.appendFileSync(e,r)},e.existsSync=e=>P(e)||n.existsSync(e),e.accessSync=e=>{P(e)||n.accessSync(e)},e.statSync=e=>P(e)?we():n.statSync(e),e.lstatSync=e=>P(e)?we():n.lstatSync(e),Object.assign(e,E(t))}function Ne(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 Pe(e,t){if(e instanceof Date)return e.getTime();if(typeof e==`string`&&e.trim()!==``&&Number.isFinite(Number(e)))return Number(e)*1e3;if(typeof e==`number`){if(!Number.isFinite(e))throw Object.assign(/* @__PURE__ */ TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`});return e<0?Date.now():e*1e3}throw Object.assign(/* @__PURE__ */ TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`})}function Fe(e,t,n,r,i){let a=e?.utimes;if(e&&typeof a==`function`&&!t.isTombstoned(n))try{a.call(e,n,r,i)}catch(e){let r=e?.code;if(r===`ENOSYS`||r===`ENOENT`&&t.exists(n))return;throw e}}function Ie(e,t,n,r){return{chmodSync(n){let r=e(n);if(!t(r))throw I(`ENOENT`,r,`chmod`)},utimesSync(i,a,o){let s=Pe(a,`atime`),c=Pe(o,`mtime`),l=e(i);if(!t(l))throw I(`ENOENT`,l,`utime`);Fe(n,r,l,s,c)}}}function Le(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 Ne(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 Ne(n,[],t.readdir(n),r)}}function Re(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 ze(e,t,n,r,i){t?(t.writeFile(r,i),e.commitWrite(r,i)):(e.writeFile(r,i),n?.write?.(r,i))}function Be(e,t,n,r,i){function a(e){return M(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)=>ze(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 m(t,r){if(!l(t).isDirectory){s(r,o(t));return}e.mkdir(r,!0);for(let i of Le(e,n,t))m(f(t,i),f(r,i))}let h={...je({syncFs:e,bridge:n,persistDelete:i?.delete,resolve:a,existsResolved:c,statResolved:l,lstatResolved:u,readBytes:o,writeThrough:s}),readFileSync(e,t){return Se(o(a(e)),Ce(t))},writeFileSync(e,t){s(a(e),Re(t))},appendFileSync(e,t){let n=a(e),r=/* @__PURE__ */ new Uint8Array;try{r=o(n)}catch(e){if(e?.code!==`ENOENT`)throw e}let i=Re(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 I(`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 I(`ENOENT`,t,`realpath`);return t},readdirSync(t){return Le(e,n,a(t))},copyFileSync(e,t){s(a(t),o(a(e)))},cpSync(e,t){m(a(e),a(t))},...Ie(a,c,n,e),mkdtempSync(t){return e.mkdtemp(a(t))}},g=Object.assign(h,T());Me(g,r),p(g,De);let _=g.existsSync;return g.existsSync=e=>{try{return _(e)}catch{return!1}},g}var Ve=class{_events=/* @__PURE__ */ 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 He=Object.assign(Ve,{EventEmitter:Ve,default:Ve});function Ue(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(`
10
+ let r=t(),i=n(),a=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=l,e.SlowBuffer=b,e.INSPECT_MAX_BYTES=50;let o=2147483647;e.kMaxLength=o,l.TYPED_ARRAY_SUPPORT=s(),!l.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{let e=/* @__PURE__ */ new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function c(e){if(e>o)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return p(e)}return u(e,t,n)}l.poolSize=8192;function u(e,t,n){if(typeof e==`string`)return m(e,t);if(ArrayBuffer.isView(e))return g(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return _(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return l.from(r,t,n);let i=v(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return l.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}l.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function d(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function f(e,t,n){return d(e),e<=0||t===void 0?c(e):typeof n==`string`?c(e).fill(t,n):c(e).fill(t)}l.alloc=function(e,t,n){return f(e,t,n)};function p(e){return d(e),c(e<0?0:y(e)|0)}l.allocUnsafe=function(e){return p(e)},l.allocUnsafeSlow=function(e){return p(e)};function m(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!l.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=x(e,t)|0,r=c(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function h(e){let t=e.length<0?0:y(e.length)|0,n=c(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function g(e){if(F(e,Uint8Array)){let t=new Uint8Array(e);return _(t.buffer,t.byteOffset,t.byteLength)}return h(e)}function _(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,l.prototype),r}function v(e){if(l.isBuffer(e)){let t=y(e.length)|0,n=c(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||Te(e.length)?c(0):h(e);if(e.type===`Buffer`&&Array.isArray(e.data))return h(e.data)}function y(e){if(e>=o)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+o.toString(16)+` bytes`);return e|0}function b(e){return+e!=e&&(e=0),l.alloc(+e)}l.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==l.prototype},l.compare=function(e,t){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},l.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return l.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=l.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(F(t,Uint8Array))i+t.length>r.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(l.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function x(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return be(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return Ce(e).length;default:if(i)return r?-1:be(e).length;t=(``+t).toLowerCase(),i=!0}}l.byteLength=x;function S(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return se(this,t,n);case`utf8`:case`utf-8`:return ie(this,t,n);case`ascii`:return ae(this,t,n);case`latin1`:case`binary`:return oe(this,t,n);case`base64`:return re(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ce(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}l.prototype._isBuffer=!0;function C(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}l.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)C(this,t,t+1);return this},l.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)C(this,t,t+3),C(this,t+1,t+2);return this},l.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)C(this,t,t+7),C(this,t+1,t+6),C(this,t+2,t+5),C(this,t+3,t+4);return this},l.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?ie(this,0,e):S.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||l.compare(this,e)===0},l.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},a&&(l.prototype[a]=l.prototype.inspect),l.prototype.compare=function(e,t,n,r,i){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,s=Math.min(a,o),c=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<s;++e)if(c[e]!==u[e]){a=c[e],o=u[e];break}return a<o?-1:+(o<a)};function w(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Te(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=l.from(t,r)),l.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}l.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},l.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(Te(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return we(be(t,e.length-n),e,n,r)}function ee(e,t,n,r){return we(xe(t),e,n,r)}function te(e,t,n,r){return we(Ce(t),e,n,r)}function ne(e,t,n,r){return we(Se(t,e.length-n),e,n,r)}l.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return ee(this,e,t,n);case`base64`:return te(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ne(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function re(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function ie(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return k(r)}let O=4096;function k(e){let t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=O));return n}function ae(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function oe(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function se(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=Ee[e[r]];return i}function ce(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}l.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,l.prototype),r};function A(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=De(function(e){e>>>=0,_e(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),l.prototype.readBigUInt64BE=De(function(e){e>>>=0,_e(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},l.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=De(function(e){e>>>=0,_e(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),l.prototype.readBigInt64BE=De(function(e){e>>>=0,_e(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!1,52,8)};function j(e,t,n,r,i,a){if(!l.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;j(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;j(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,255,0),this[t]=e&255,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function le(e,t,n,r,i){ge(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function M(e,t,n,r,i){ge(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}l.prototype.writeBigUInt64LE=De(function(e,t=0){return le(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),l.prototype.writeBigUInt64BE=De(function(e,t=0){return M(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);j(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);j(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},l.prototype.writeBigInt64LE=De(function(e,t=0){return le(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),l.prototype.writeBigInt64BE=De(function(e,t=0){return M(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ue(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function N(e,t,n,r,a){return t=+t,n>>>=0,a||ue(e,t,n,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,n,r,23,4),n+4}l.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)};function de(e,t,n,r,a){return t=+t,n>>>=0,a||ue(e,t,n,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,n,r,52,8),n+8}l.prototype.writeDoubleLE=function(e,t,n){return de(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return de(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(!l.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},l.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!l.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=l.isBuffer(e)?e:l.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let fe={};function pe(e,t,n){fe[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}pe(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),pe(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),pe(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=me(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=me(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function me(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function he(e,t,n){_e(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&P(t,e.length-(n+1))}function ge(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new fe.ERR_OUT_OF_RANGE(`value`,i,e)}he(r,i,a)}function _e(e,t){if(typeof e!=`number`)throw new fe.ERR_INVALID_ARG_TYPE(t,`number`,e)}function P(e,t,n){throw Math.floor(e)===e?t<0?new fe.ERR_BUFFER_OUT_OF_BOUNDS:new fe.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(_e(e,n),new fe.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ve=/[^+/0-9A-Za-z-_]/g;function ye(e){if(e=e.split(`=`)[0],e=e.trim().replace(ve,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function be(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function xe(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Se(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function Ce(e){return r.toByteArray(ye(e))}function we(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function F(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Te(e){return e!==e}let Ee=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function De(e){return typeof BigInt>`u`?I:e}function I(){throw Error(`BigInt not supported`)}})),i=r();globalThis.Buffer===void 0&&(globalThis.Buffer=i.Buffer);function a(){return{version:`6.248.13`,releasedAt:`2026-10-15T00:26:18Z`,buildId:`6.248.13-mv8st5zl`}}function o(e){let t=typeof e==`string`?e:e.href;if(!t.startsWith(`file:`))throw TypeError(`fileURLToPath: not a file URL`);let n=new URL(t);if(n.hostname!==``&&n.hostname!==`localhost`)throw Object.assign(/* @__PURE__ */ TypeError(`File URL host must be "localhost" or empty on posix`),{code:`ERR_INVALID_FILE_URL_HOST`});if(/%2f/i.test(n.pathname))throw Object.assign(/* @__PURE__ */ TypeError(`File URL path must not include encoded / characters`),{code:`ERR_INVALID_FILE_URL_PATH`});return decodeURIComponent(n.pathname)}function s(e){let t=e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`);return new URL(`file://${t}`)}const c={URL:globalThis.URL,URLSearchParams:globalThis.URLSearchParams,fileURLToPath:o,pathToFileURL:s};function l(e,t){return Object.assign(/* @__PURE__ */ TypeError(`The "${e}" argument must be of type string or an instance of Buffer or URL. Received ${t===null?`null`:typeof t}`),{code:`ERR_INVALID_ARG_TYPE`})}function u(e){return typeof e==`object`&&!!e&&typeof e.href==`string`&&typeof e.protocol==`string`}function d(e,t=`path`){if(typeof e==`string`)return e;if(u(e)){if(e.protocol!==`file:`)throw Object.assign(/* @__PURE__ */ TypeError(`The URL must be of scheme file`),{code:`ERR_INVALID_URL_SCHEME`});return c.fileURLToPath(e.href)}if(e instanceof Uint8Array)return new TextDecoder().decode(e);throw l(t,e)}function f(e,t){let n=[...t];switch(e){case`path`:n[0]=d(n[0]);break;case`fd`:typeof n[0]!=`number`&&(n[0]=d(n[0]));break;case`pair`:n[0]=d(n[0],`src`),n[1]=d(n[1],`dest`);break;case`second`:n[1]=d(n[1])}return n}function p(e,t,n={}){let r=e;for(let i of Object.keys(t)){let a=t[i],o=r[i];a&&typeof o==`function`&&(r[i]=((...t)=>{let r;try{r=f(a,t)}catch(e){if(n.promises)return Promise.reject(e);throw e}return o.apply(e,r)}))}}function m(e){let t=!!e.isDirectory,n=e.mtimeMs??0;return{isFile:()=>!!e.isFile,isDirectory:()=>t,isSymbolicLink:()=>!!e.isSymbolicLink,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isFIFO:()=>!1,isSocket:()=>!1,size:e.size??0,mode:e.mode??(t?16877:33188),mtimeMs:n,mtime:new Date(n)}}const h=/* @__PURE__ */ new Set([`stat`,`lstat`]);function g(e){if(e.length===0)return e;if(e.length===1||e[1]===void 0)return[e[0],null];let t=e[1];return typeof t==`object`&&t&&!ArrayBuffer.isView(t)&&t.encoding===void 0?[e[0],{...t,encoding:null}]:e}function _(e){if(e instanceof Error&&e.code===void 0){let t=/^(E[A-Z]+)\b/.exec(e.message)?.[1];t&&Object.assign(e,{code:t})}return e}function v(e,t){return h.has(e)?m(t):t}function y(e,t,n,r){let i=e===`readFile`?g(r):r;return t.apply(n,i)}function b(e){let t={};for(let[n,r]of Object.entries(e))n!==`promises`&&(t[n]=typeof r==`function`?async(...t)=>{try{return v(n,await y(n,r,e,t))}catch(e){throw _(e)}}:r);return t}function x(e){let t=e;for(let[e,n]of Object.entries(t))e!==`promises`&&typeof n==`function`&&(t[e]=function(...t){let r=t[t.length-1];if(typeof r!=`function`)return n.apply(this,t);t.pop();let i;try{i=Promise.resolve(y(e,n,this,t))}catch(e){i=Promise.reject(e)}i.then(t=>e===`exists`?r(t):r(null,v(e,t)),t=>r(e!==`exists`&&_(t)))})}function S(e,t){return Object.assign(/* @__PURE__ */ Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function C(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function w(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function T(){return{readSync:e=>{throw S(`read`,e)},writeSync:e=>{throw S(`write`,e)}}}function E(e){let t=0;return{readSync(n,r,i,a){if(n!==0)throw S(`read`,n);let o=C(r),s=typeof i==`object`&&i?i:{offset:i,length:a},c=s.offset??0,l=s.length??o.length-c,u=e.readStdinBytes(),d=Math.max(0,Math.min(l,u.length-t));return o.set(u.subarray(t,t+d),c),t+=d,d},writeSync(t,n,r,i){let a=t===1?e.writeStdout:t===2?e.writeStderr:void 0;if(!a)throw S(`write`,t);if(typeof n==`string`)return a(n),new TextEncoder().encode(n).length;if(!ArrayBuffer.isView(n))throw TypeError(`writeSync: data must be a string or buffer`);let o=C(n),s=typeof r==`number`?r:0,c=o.subarray(s,i===void 0?void 0:s+i);return a(w(c)),c.length}}}const D=`exec`,ee=6e5,te=5e3;function ne(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function re(e){return e===void 0||e===0}function ie(e,t){return ne(e)?Math.min(e,ee):Math.min(t,ee)}function O(e,t){return Object.assign(/* @__PURE__ */ Error(`${e}: ${t}`),{code:e})}function k(e){let t=oe(e);if(se(t))return new Uint8Array(t.response);if(t.status>=200&&t.status<300)throw O(`EIO`,e.label);ce(t,e.label)}function ae(e){let t=k(e);try{return JSON.parse(new TextDecoder().decode(t))}catch{throw O(`EIO`,e.label)}}function oe(e){let t=new XMLHttpRequest;try{t.open(e.method,e.url,!1),t.responseType=`arraybuffer`,t.timeout=e.timeoutMs,t.setRequestHeader(`x-slicc-fs-token`,e.token),e.body?t.send(new Uint8Array(e.body)):t.send()}catch{throw O(`EIO`,e.label)}return t}function se(e){return e.status>=200&&e.status<300&&e.getResponseHeader(`x-slicc-fs`)===`1`}function ce(e,t){throw O(e.getResponseHeader(`x-slicc-fs`)===`1`&&e.getResponseHeader(`x-slicc-fs-errno`)||`EIO`,t)}function A(e){return(t,n,r)=>{let i=ae({method:`POST`,url:`/__slicc/exec-sync`,token:e,body:new TextEncoder().encode(JSON.stringify({...t,channel:D})),timeoutMs:n+te,label:r});if(!i||typeof i.stdout!=`string`||typeof i.stderr!=`string`||typeof i.exitCode!=`number`)throw O(`EIO`,r);return{stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode}}}function j(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 le(e,t={}){let n=t.timeoutMs??12e4,{syncFs:r,fsBridge:i}=t,a=t.transport??A(e);return{run(e,o={}){let s=r?.wasUsed()===!0&&i!==void 0;s&&j(r,i);let c=`sync-exec bridge, '${Array.isArray(e)?e.join(` `):e}'`,l=t.noDefaultDeadline===!0&&re(o.timeout),u=l?1/0:ie(o.timeout,n),d={command:e,...o.args===void 0?{}:{args:o.args},...o.input===void 0?{}:{stdin:o.input},...o.cwd===void 0?{}:{cwd:o.cwd},...o.env===void 0?{}:{env:o.env},...l?{}:{timeoutMs:u}};try{return a(d,u,c)}finally{s&&r.invalidate()}}}}function M(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 ue(e){let t=M(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function N(e){return Object.assign(/* @__PURE__ */ Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function de(e){return Object.assign(/* @__PURE__ */ Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function fe(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 pe=class{tree=/* @__PURE__ */ new Map;initialPaths=/* @__PURE__ */ new Set;initialContent=/* @__PURE__ */ new Map;initialKind=/* @__PURE__ */ new Map;mkdtempCounter=0;tombstones=/* @__PURE__ */ new Set;removedDirs=/* @__PURE__ */ new Set;touched=!1;constructor(e){this.loadSnapshot(e)}loadSnapshot(e){this.tree=/* @__PURE__ */ new Map,this.tombstones=/* @__PURE__ */ new Set,this.removedDirs=/* @__PURE__ */ new Set,this.initialPaths=/* @__PURE__ */ new Set,this.initialContent=/* @__PURE__ */ new Map,this.initialKind=/* @__PURE__ */ new Map,this.tree.set(`/`,{content:/* @__PURE__ */ new Uint8Array,isDirectory:!0}),this.initialPaths.add(`/`),this.initialKind.set(`/`,`directory`);for(let t of e.entries){let e=M(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,symlinkTarget:t.symlinkTarget,truncated:t.truncated,size:t.size,...t.partial?{partial:!0}:{}}),this.initialPaths.add(e),this.initialKind.set(e,this.entryKind(t)),!t.isDirectory&&!t.isSymbolicLink&&this.initialContent.set(e,t.content)}for(let t of e.entries){let e=ue(M(t.path));for(;e!==`/`&&!this.tree.has(e);)this.tree.set(e,{content:/* @__PURE__ */ new Uint8Array,isDirectory:!0}),this.initialPaths.add(e),this.initialKind.set(e,`directory`),e=ue(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=/* @__PURE__ */ new Set,this.initialContent=/* @__PURE__ */ new Map,this.initialKind=/* @__PURE__ */ 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=M(e),r=n.split(`/`).filter(Boolean),i=[],a=/* @__PURE__ */ 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(/* @__PURE__ */ Error(`ELOOP: too many symbolic links, '${n}'`),{code:`ELOOP`});a.add(s);let e=c.symlinkTarget??``;r=[...M(e.startsWith(`/`)?e:`${ue(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=ue(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0,!0))}isPartial(e){return this.tree.get(M(e))?.partial===!0}hasPartialWithin(e){let t=M(e),n=t===`/`?`/`:`${t}/`;for(let[e,r]of this.tree)if(r.partial&&(e===t||e.startsWith(n)))return!0;return!1}commitWrite(e,t){this.writeFile(e,t);let n=M(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=ue(n)}}readFile(e){this.touched=!0;let t=M(e),n=this.resolveEntry(t)?.entry;if(!n||n.isDirectory)throw N(t);if(n.truncated)throw de(t);return n.content}writeFile(e,t){this.touched=!0;let n=M(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=M(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=M(e),n=this.resolveEntry(t);if(!n)throw N(t);return this.toStat(n.entry)}lstat(e){this.touched=!0;let t=M(e),n=this.resolveEntry(t,!0);if(!n)throw N(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=M(e),n=this.resolveEntry(t);if(!n?.entry.isDirectory)throw N(t);let r=n.path===`/`?`/`:n.path+`/`,i=/* @__PURE__ */ 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=M(e);if(this.tree.has(r)){if(this.tree.get(r).isDirectory)return;throw Object.assign(/* @__PURE__ */ Error(`EEXIST: file already exists, '${r}'`),{code:`EEXIST`})}let i=ue(r);if(i!==`/`&&!this.tree.has(i)){if(!t)throw N(r);this.mkdir(i,!0,n)}this.tree.set(r,{content:/* @__PURE__ */ new Uint8Array,isDirectory:!0,...n?{partial:!0}:{}}),this.tombstones.delete(r),this.removedDirs.delete(r)}rm(e,t){this.touched=!0;let n=M(e),r=this.tree.get(n);if(!r)throw N(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(/* @__PURE__ */ 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=M(e),r=this.tree.get(n);if(!r||r.isDirectory)throw N(n);if(r.truncated)throw de(n);let i=M(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=M(e),r=this.tree.get(n);if(!r)throw N(n);let i=M(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=M(e),n=this.tree.get(t);if(!n)throw N(t);if(n.isDirectory&&!n.isSymbolicLink)throw Object.assign(/* @__PURE__ */ 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=M(e);this.tombstones.add(n),t&&this.removedDirs.add(n)}isTombstoned(e){let t=M(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=M(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&&!fe(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 me(){return globalThis.Buffer}function he(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function ge(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function _e(e,t){return Object.assign(/* @__PURE__ */ Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function P(e){return e===`/dev/stdin`||e===`/dev/stdout`||e===`/dev/stderr`}function ve(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 ye(e,t){let n=ve(e);if(n===0)return!0;if(n!==void 0||typeof e==`number`)throw _e(t,e);return!1}function be(e,t,n){let r=ve(t);if(r===1)return e.writeStdout;if(r===2)return e.writeStderr;if(r!==void 0||typeof t==`number`)throw _e(n,t)}function xe(e){return typeof e==`string`?e:ge(Re(e))}function Se(e,t){if(t===`utf8`||t===`utf-8`)return new TextDecoder().decode(e);let n=me();return n?n.from(e):e}function Ce(e){return e===null?null:typeof e==`string`?e:e?.encoding}function we(){return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,isCharacterDevice:()=>!0,size:0}}function F(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(!ye(e,`read`))return n.readFile(e,r);let i=Ce(r);if(i===null||i===`buffer`){let e=me(),n=t.readStdinBytes();return e?e.from(n):n}return new TextDecoder().decode(t.readStdinBytes())},e.readFileBinary=async e=>ye(e,`read`)?t.readStdinBytes():n.readFileBinary(e),e.writeFile=async(e,r)=>{let i=be(t,e,`write`);return i?(i(xe(r)),!0):n.writeFile(e,r)},e.writeFileBinary=async(e,r)=>{let i=be(t,e,`write`);return i?(i(ge(r)),!0):n.writeFileBinary(e,r)},e.appendFile=async(e,r)=>{let i=be(t,e,`append`);if(!i)return n.appendFile(e,r);i(xe(r))},e.access=async e=>{if(!P(e))return n.access(e)},e.exists=async e=>P(e)||n.exists(e),e.stat=async e=>P(e)?{isFile:!0,isDirectory:!1,size:0}:n.stat(e)}function Te(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=Ce(n);if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=me();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(/* @__PURE__ */ Error(`ENOENT: no such file or directory, access '${t}'`),{code:`ENOENT`})}let m={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 F(m,n),p(m,Ee,{promises:!0}),m.promises=b(m),x(m),m}const Ee={readFile:`fd`,readFileBinary:`fd`,writeFile:`fd`,writeFileBinary:`fd`,appendFile:`fd`,cp:`pair`,rm:`path`,readDir:`path`,readdir:`path`,exists:`path`,stat:`path`,mkdir:`path`,mkdtemp:`path`,rename:`pair`,access:`path`,unlink:`path`,rmdir:`path`,copyFile:`pair`,fetchToFile:`second`},De={readFileSync:`fd`,writeFileSync:`fd`,appendFileSync:`fd`,truncateSync:`path`,existsSync:`path`,accessSync:`path`,mkdirSync:`path`,statSync:`path`,lstatSync:`path`,realpathSync:`path`,readdirSync:`path`,copyFileSync:`pair`,cpSync:`pair`,chmodSync:`path`,utimesSync:`path`,mkdtempSync:`path`,rmSync:`path`,rmdirSync:`path`,unlinkSync:`path`,renameSync:`pair`};function I(e,t,n=``){return Object.assign(/* @__PURE__ */ Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function Oe(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 ke(e,t,n){let r=t;if(r?.rename&&r.rmdir&&r.rm&&e.hasPartialWithin(n))return r}function Ae(e,t,n){j(e,t);try{n()}finally{e.invalidate()}}function je(e){let{syncFs:t,bridge:n,resolve:r,existsResolved:i,lstatResolved:a,statResolved:o,readBytes:s,writeThrough:c,persistDelete:l}=e,u=(e,r)=>{let i=r?.requireFile?void 0:ke(t,n,e);return i?(Ae(t,i,()=>r?.recursive?i.rm(e):i.rmdir(e)),!0):Oe(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 I(`ENOENT`,n,`rm`)},rmdirSync(e,t){let n=r(e);if(i(n)&&!a(n).isDirectory)throw I(`ENOTDIR`,n,`rmdir`);if(!u(n,{recursive:t?.recursive===!0}))throw I(`ENOENT`,n,`rmdir`)},unlinkSync(e){let t=r(e);if(!u(t,{requireFile:!0}))throw I(`ENOENT`,t,`unlink`)},renameSync(e,i){let a=r(e),l=r(i),d=ke(t,n,a);if(d){Ae(t,d,()=>d.rename(a,l));return}try{t.rename(a,l);return}catch(e){if(e?.code!==`ENOENT`)throw e}if(!n||t.isTombstoned(a))throw I(`ENOENT`,a,`rename`);if(o(a).isDirectory)throw I(`EISDIR`,a,`rename`);if(c(l,s(a)),!u(a,{requireFile:!0}))throw I(`ENOENT`,a,`rename`)}}}function Me(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)=>ye(e,`read`)?Se(t.readStdinBytes(),Ce(r)):n.readFileSync(e,r),e.writeFileSync=(e,r)=>{let i=be(t,e,`write`);i?i(xe(r)):n.writeFileSync(e,r)},e.appendFileSync=(e,r)=>{let i=be(t,e,`append`);i?i(xe(r)):n.appendFileSync(e,r)},e.existsSync=e=>P(e)||n.existsSync(e),e.accessSync=e=>{P(e)||n.accessSync(e)},e.statSync=e=>P(e)?we():n.statSync(e),e.lstatSync=e=>P(e)?we():n.lstatSync(e),Object.assign(e,E(t))}function Ne(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 Pe(e,t){if(e instanceof Date)return e.getTime();if(typeof e==`string`&&e.trim()!==``&&Number.isFinite(Number(e)))return Number(e)*1e3;if(typeof e==`number`){if(!Number.isFinite(e))throw Object.assign(/* @__PURE__ */ TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`});return e<0?Date.now():e*1e3}throw Object.assign(/* @__PURE__ */ TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`})}function Fe(e,t,n,r,i){let a=e?.utimes;if(e&&typeof a==`function`&&!t.isTombstoned(n))try{a.call(e,n,r,i)}catch(e){let r=e?.code;if(r===`ENOSYS`||r===`ENOENT`&&t.exists(n))return;throw e}}function Ie(e,t,n,r){return{chmodSync(n){let r=e(n);if(!t(r))throw I(`ENOENT`,r,`chmod`)},utimesSync(i,a,o){let s=Pe(a,`atime`),c=Pe(o,`mtime`),l=e(i);if(!t(l))throw I(`ENOENT`,l,`utime`);Fe(n,r,l,s,c)}}}function Le(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 Ne(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 Ne(n,[],t.readdir(n),r)}}function Re(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 ze(e,t,n,r,i){t?(t.writeFile(r,i),e.commitWrite(r,i)):(e.writeFile(r,i),n?.write?.(r,i))}function Be(e,t,n,r,i){function a(e){return M(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)=>ze(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 m(t,r){if(!l(t).isDirectory){s(r,o(t));return}e.mkdir(r,!0);for(let i of Le(e,n,t))m(f(t,i),f(r,i))}let h={...je({syncFs:e,bridge:n,persistDelete:i?.delete,resolve:a,existsResolved:c,statResolved:l,lstatResolved:u,readBytes:o,writeThrough:s}),readFileSync(e,t){return Se(o(a(e)),Ce(t))},writeFileSync(e,t){s(a(e),Re(t))},appendFileSync(e,t){let n=a(e),r=/* @__PURE__ */ new Uint8Array;try{r=o(n)}catch(e){if(e?.code!==`ENOENT`)throw e}let i=Re(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 I(`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 I(`ENOENT`,t,`realpath`);return t},readdirSync(t){return Le(e,n,a(t))},copyFileSync(e,t){s(a(t),o(a(e)))},cpSync(e,t){m(a(e),a(t))},...Ie(a,c,n,e),mkdtempSync(t){return e.mkdtemp(a(t))}},g=Object.assign(h,T());Me(g,r),p(g,De);let _=g.existsSync;return g.existsSync=e=>{try{return _(e)}catch{return!1}},g}var Ve=class{_events=/* @__PURE__ */ 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 He=Object.assign(Ve,{EventEmitter:Ve,default:Ve});function Ue(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(`
11
11
  `)?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(`
12
12
  `)?t:`${t}\n`),e.exit(0),Error(`unreachable`)}}}const We={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 Ge(e){let t=e.isTTY&&!e.noColor,n=e=>n=>t?`${e}${n}${We.reset}`:String(n);return{enabled:t,green:n(We.green),red:n(We.red),yellow:n(We.yellow),gray:n(We.gray),bold:n(We.bold),cyan:n(We.cyan),dim:n(We.dim)}}const Ke=/\u001b\[[0-9;]*m/g;function qe(e){return e.replace(Ke,``)}function Je(e){return qe(e).length}function Ye(e,t){let n=String(e??``);return t<=0?``:Je(n)<=t?n:t<=1?n.slice(0,t):`${qe(n).slice(0,t-1)}…`}function Xe(e,t){let n=String(e??``),r=Je(n);return r===t?n:r>t?Ye(n,t):n+` `.repeat(t-r)}function Ze(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,Je(e))}r[i]=t}return e.map(e=>r.map((t,n)=>Xe(n<e.length?String(e[n]??``):``,t)).join(` `).replace(/\s+$/,``)).join(`
13
13
  `)}function Qe(e){return e instanceof Date?e:new Date(e)}function $e(e){return e<10?`0${e}`:String(e)}function et(e,t=`short`){let n=Qe(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()}-${$e(n.getMonth()+1)}-${$e(n.getDate())}`}const tt={trunc:Ye,col:Xe,table:Ze,date:et};var L=class extends Error{actual;expected;operator;generatedMessage;code;constructor(e={}){let t=!e.message;super(e.message||`${nt(e.actual)} ${e.operator||`!=`} ${nt(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 nt(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 R(e,t){return e instanceof Error?e:typeof e==`string`?new L({message:e}):t()}function rt(e,t,n,r){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!at(e[i],t[i],n,r))return!1;return!0}function it(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)||!at(Reflect.get(e,a),Reflect.get(t,a),n,r))return!1;return!0}function at(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)?rt(e,t,n,r):it(i,a,n,r):!1)}function ot(e,t){try{if(e instanceof t)return!0}catch{}try{return!!t(e)}catch{return!1}}function st(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 ct(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`?ot(e,t):t&&typeof t==`object`?!e||typeof e!=`object`?!1:st(e,t):!1}function lt(e){let t=(e,t)=>{if(!e)throw R(t,()=>new L({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 R(n,()=>new L({actual:e,expected:t,operator:`strictEqual`}))},i=(t,n,i)=>{if(e){r(t,n,i);return}if(t!=n)throw R(i,()=>new L({actual:t,expected:n,operator:`==`}))},a=(e,t,n)=>{if(Object.is(e,t))throw R(n,()=>new L({actual:e,expected:t,operator:`notStrictEqual`}))},o=(t,n,r)=>{if(e){a(t,n,r);return}if(t==n)throw R(r,()=>new L({actual:t,expected:n,operator:`!=`}))},s=(e,t,n)=>{if(!at(e,t,!0,/* @__PURE__ */ new WeakMap))throw R(n,()=>new L({actual:e,expected:t,operator:`deepStrictEqual`}))},c=(t,n,r)=>{if(e){s(t,n,r);return}if(!at(t,n,!1,/* @__PURE__ */ new WeakMap))throw R(r,()=>new L({actual:t,expected:n,operator:`deepEqual`}))},l=(e,t,n)=>{if(at(e,t,!0,/* @__PURE__ */ new WeakMap))throw R(n,()=>new L({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(at(t,n,!1,/* @__PURE__ */ new WeakMap))throw R(r,()=>new L({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 R(typeof t==`string`?t:n,()=>new L({message:`Missing expected exception`,operator:`throws`}));if(!(typeof t==`string`||t instanceof Error)&&!ct(r,t))throw R(n,()=>new L({message:`Got unwanted exception`,actual:r,operator:`throws`}))},n.doesNotThrow=(e,t)=>{try{e()}catch(e){throw R(t,()=>new L({message:`Got unwanted exception`,actual:e,operator:`doesNotThrow`}))}},n.fail=e=>{throw R(e,()=>new L({message:`Failed`,operator:`fail`}))},n.AssertionError=L,n}const ut=lt(!0);ut.strict=ut;const dt=lt(!1);dt.strict=ut;function ft(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 pt=class{_events=/* @__PURE__ */ 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}},mt=class extends pt{read(){return null}destroy(){return this.closeOnDestroy()}},ht=class extends pt{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}destroy(){return this.closeOnDestroy()}},gt=class extends pt{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}read(){return null}destroy(){return this.closeOnDestroy()}};const _t={Readable:mt,Writable:ht,Transform:gt,PassThrough:class extends gt{},Stream:pt};function vt(e,t){return Object.assign(TypeError(t),{code:e})}const yt=e=>e.startsWith(`--`)&&e.length>2,bt=e=>/^-[^-]/.test(e);function xt(e,t,n){let r=[];for(let i=1;i<e.length;i++)if(t[n(e[i])]?.type!==`string`||i===e.length-1)r.push(`-${e[i]}`);else{r.push(`-${e.slice(i)}`);break}return r}function St(e,t,n){let r=[],i=[...e],a=-1,o=0,s=(e,t,n,r)=>({kind:`option`,name:e,rawName:t,index:a,value:n,inlineValue:r}),c=e=>t[e]?.type===`string`;for(;i.length>0;){let e=i.shift(),l=i[0];if(o>0?o--:a++,e===`--`){r.push({kind:`option-terminator`,index:a});for(let e of i)r.push({kind:`positional`,index:++a,value:e});break}if(bt(e)&&e.length===2){let t=n(e[1]);c(t)&&l!==void 0?(i.shift(),r.push(s(t,e,l,!1)),a++):r.push(s(t,e,void 0,void 0));continue}if(bt(e)){let a=n(e[1]);if(c(a))r.push(s(a,`-${e[1]}`,e.slice(2),!0));else{let r=xt(e,t,n);i.unshift(...r),o=r.length}continue}if(yt(e)){let t=e.indexOf(`=`);if(t!==-1){r.push(s(e.slice(2,t),e.slice(0,t),e.slice(t+1),!0));continue}let n=e.slice(2);c(n)&&l!==void 0?(i.shift(),r.push(s(n,e,l,!1)),a++):r.push(s(n,e,void 0,void 0));continue}r.push({kind:`positional`,index:a,value:e})}return r}function Ct(e,t){let n=t?.short?`'-${t.short}, --${e.name}'`:`'--${e.name}'`;if(!t)throw vt(`ERR_PARSE_ARGS_UNKNOWN_OPTION`,`Unknown option '${e.rawName}'${e.rawName.startsWith(`--`)?``:`. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- "-"'`}`);if(t.type===`string`&&typeof e.value!=`string`)throw vt(`ERR_PARSE_ARGS_INVALID_OPTION_VALUE`,`Option ${n.replace(/'$/,` <value>'`)} argument missing`);if(t.type===`boolean`&&e.value!==void 0)throw vt(`ERR_PARSE_ARGS_INVALID_OPTION_VALUE`,`Option ${n} does not take an argument`);let r=e.value!==void 0&&e.value.length>1&&e.value[0]===`-`;if(t.type===`string`&&e.inlineValue===!1&&r)throw vt(`ERR_PARSE_ARGS_INVALID_OPTION_VALUE`,`Option '${e.rawName}' argument is ambiguous.\nDid you forget to specify the option argument for '${e.rawName}'?\nTo specify an option argument starting with a dash use '${e.rawName.startsWith(`--`)?`${e.rawName}=-XYZ`:`--${e.name}=-XYZ' or '${e.rawName}-XYZ`}'.`)}function wt(e,t,n,r){if(!r){e[t]=n;return}let i=e[t];e[t]=Array.isArray(i)?[...i,n]:[n]}function Tt(e,t,n){let r=e.slice(3);return n&&e.startsWith(`no-`)?{name:r,negated:!0}:{name:e,negated:!1}}function Et(e,t,n,r,i){let{name:a,negated:o}=Tt(t.name,n,i);t.name=a;let s=n[a];r&&Ct(t,o&&s?.type!==`boolean`?void 0:s),wt(e,a,o?!1:t.value??!0,s?.multiple===!0)}function Dt(e={},t=()=>[]){let n=e.args??t(),r=e.options??{},i=e.strict??!0,a=e.allowPositionals??!i,o=e.allowNegative??!1,s=e=>Object.keys(r).find(t=>r[t].short===e)??e,c=Object.create(null),l=[],u=St(n,r,s);for(let e of u){if(e.kind===`positional`){if(i&&!a)throw vt(`ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL`,`Unexpected argument '${e.value}'. This command does not take positional arguments`);l.push(e.value);continue}e.kind===`option`&&Et(c,e,r,i,o)}for(let[e,t]of Object.entries(r))t.default!==void 0&&c[e]===void 0&&(c[e]=t.default);return e.tokens?{values:c,positionals:l,tokens:u}:{values:c,positionals:l}}const Ot=Symbol.for(`nodejs.util.inspect.custom`),kt=Symbol.for(`nodejs.util.promisify.custom`);function At(e){return`'${e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`).replace(/\n/g,`\\n`)}'`}function jt(e){if(e===null)return`null`;let t=typeof e;if(t===`string`)return At(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 Mt(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 Nt(e,t,n){if(Array.isArray(e))return e.length===0?`[]`:`[ ${e.map(e=>Pt(e,t+1,n)).join(`, `)} ]`;if(e instanceof Map){let r=[...e].map(([e,r])=>`${Pt(e,t+1,n)} => ${Pt(r,t+1,n)}`);return`Map(${e.size}) {${r.length?` ${r.join(`, `)} `:``}}`}if(e instanceof Set){let r=[...e].map(e=>Pt(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:At(r)}: ${Pt(e[r],t+1,n)}`).join(`, `)} }`}function Pt(e,t,n){let r=jt(e);if(r!==null)return r;let i=e,a=Mt(i);if(a!==null)return a;let o=i[Ot];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 Nt(i,t,n)}finally{n.seen.delete(e)}}function Ft(e,t={}){let n=t.depth===void 0?2:t.depth;return Pt(e,0,{seen:/* @__PURE__ */ new Set,maxDepth:n,opts:t})}function It(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):Ft(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++,Ft(i,{depth:4});case`%O`:return n.i++,Ft(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:Ft(e)).join(` `);let r={i:1},i=n.replace(/%[sdifjoOc%]/g,n=>It(n,t,r,e));for(;r.i<t.length;r.i++){let e=t[r.i];i+=` ${typeof e==`string`?e:Ft(e)}`}return i}function Rt(...e){return Lt({},...e)}function zt(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 Bt(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type function`);let t=e[kt];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 Vt(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 Ht=Ft;Ht.custom=Ot;const Ut=Bt;Ut.custom=kt;function Wt(e,t=()=>[]){return{parseArgs:e=>Dt(e,t),format:Rt,formatWithOptions:Lt,inspect:Ht,inherits:zt,promisify:Ut,deprecate:Vt(e)}}const Gt=Wt(()=>{});let Kt=1;function qt(e){if(typeof e==`string`)return e;if(ArrayBuffer.isView(e)){let t=e;return new TextDecoder().decode(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}return e==null?``:String(e)}function Jt(e,t,n){return Object.assign(/* @__PURE__ */ 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 Yt(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))throw Jt(`options.env`,`object`,e);let t={};for(let[n,r]of Object.entries(e))if(r!==void 0){if(typeof r!=`string`)throw Jt(`options.env[${n}]`,`string`,r);t[n]=r}return t}function Xt(e){if(e!==void 0){if(typeof e==`string`)return e;if(typeof e==`object`&&e&&typeof e.href==`string`)try{return c.fileURLToPath(e.href)}catch{throw Jt(`options.cwd`,`string or an instance of URL (file:)`,e)}throw Jt(`options.cwd`,`string or an instance of URL`,e)}}function Zt(e,t){return t===void 0||t===`utf8`||t===`utf-8`?e:t===`buffer`||t===null?ft(e):ft(e).toString(t)}function Qt(e,t){if(e.length===0)return Zt(``,t);if(typeof e[0]==`string`)return e.join(``);let n=globalThis.Buffer;return n?n.concat(e):e[0]}function $t(e,t,n){t.length>0&&e.emit(`data`,Zt(t,n)),e.readable=!1,e.emit(`end`)}function en(e){let t=e=>{typeof e==`function`&&queueMicrotask(e)};return{writable:!0,write(n,r,i){return e.stdin.write(qt(n)),t(typeof r==`function`?r:i),!0},end(n,r,i){n!==void 0&&typeof n!=`function`&&e.stdin.write(qt(n)),e.stdin.end(),this.writable=!1,t(typeof n==`function`?n:typeof r==`function`?r:i)}}}var tn=class extends Ve{stdout;stderr;stdin;pid;exitCode=null;signalCode=null;killed=!1;spawnfile;spawnargs;handle;constructor(e,t,n,r){super(),this.handle=e,this.pid=Kt++,this.spawnfile=n,this.spawnargs=r,this.stdout=new mt,this.stderr=new mt,this.stdin=en(e),e.done.then(e=>this.finish(e,t),e=>this.emit(`error`,e instanceof Error?e:Error(String(e))))}finish(e,t){$t(this.stdout,e.stdout,t),$t(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 nn(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=Xt(e.cwd),n=Yt(e.env);return{...e.input===void 0?{}:{input:qt(e.input)},...e.timeout===void 0?{}:{timeout:e.timeout},...t===void 0?{}:{cwd:t},...n===void 0?{}:{env:n}}},r=(e,r,i,a)=>{let o=a.encoding===void 0?`buffer`:a.encoding,s=t(e,r,n(a)),c=Zt(s.stdout,o),l=Zt(s.stderr,o);if(s.exitCode===0)return c;throw Object.assign(/* @__PURE__ */ Error(`Command failed: ${i}\n${s.stderr}`),{status:s.exitCode,signal:null,stdout:c,stderr:l,output:[null,c,l],pid:Kt++})},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=Kt++,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=Zt(``,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=Zt(d.stdout,c),p=Zt(d.stderr,c);return{pid:l,status:d.exitCode,signal:null,stdout:f,stderr:p,output:[null,f,p]}}}}function rn(e,t){let n=(t,n,r,i,a)=>{let o=Xt(n.cwd),s=Yt(n.env),c={...o===void 0?{}:{cwd:o},...s===void 0?{}:{env:s}},l=e.start(t,c),u=new tn(l,r,i,a);return n.input!==void 0&&u.stdin.write(qt(n.input)),queueMicrotask(()=>l.stdin.end()),u},r=(e,t,n,r)=>{if(typeof r!=`function`)return;let i=[],a=[];e.stdout.on(`data`,e=>i.push(e)),e.stderr.on(`data`,e=>a.push(e)),e.once(`error`,e=>r(e,Qt(i,t),Qt(a,t))),e.once(`close`,(o,s)=>{let c=Qt(i,t),l=Qt(a,t);if(o===0){r(null,c,l);return}r(Object.assign(/* @__PURE__ */ Error(`Command failed: ${n}\n${qt(l)}`),{code:o===null?void 0:o,killed:e.killed,signal:s??null,cmd:n}),c,l)})},i=(e,t,i)=>{let a=typeof t==`function`?t:i,o=t&&typeof t==`object`?t:{},s=o.encoding===void 0?`utf8`:o.encoding,c=n(e,o,s,e,[]);return r(c,s,e,a),c},a=(e,t,i,a)=>{let o=[],s={},c;Array.isArray(t)?(o=t,typeof i==`function`?c=i:(s=i??{},c=typeof a==`function`?a:void 0)):typeof t==`function`?c=t:t&&typeof t==`object`&&(s=t,c=typeof i==`function`?i:void 0);let l=s.encoding===void 0?`utf8`:s.encoding,u=[e,...o],d=n(u,s,l,e,o);return r(d,l,u.join(` `),c),d},o=(e,t,r)=>{let i=[],a={};Array.isArray(t)?(i=t,a=r??{}):t&&typeof t==`object`&&(a=t);let o=a.encoding===void 0?`buffer`:a.encoding,s=a.shell?`${e}${i.length?` ${i.join(` `)}`:``}`:[e,...i];return n(s,a,o,e,i)},s=(e,t)=>new Promise((n,r)=>{i(e,t,(e,t,i)=>{if(e){r(Object.assign(e,{stdout:t,stderr:i}));return}n({stdout:t,stderr:i})})}),c=(e,t,n)=>new Promise((r,i)=>{a(e,Array.isArray(t)?t:[],Array.isArray(t)?n:t,(e,t,n)=>{if(e){i(Object.assign(e,{stdout:t,stderr:n}));return}r({stdout:t,stderr:n})})}),l=e=>()=>{throw Error(`child_process.${e} is not available in the browser realm`)},u=nn(t),d=(e,t)=>{Object.defineProperty(e,kt,{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:tn}}function an(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var on={exports:{}};
@@ -58,4 +58,4 @@ ${Dc(i.value)}\r
58
58
  `)),{bytes:Ac(r),contentType:`multipart/form-data; boundary=${t}`,boundary:t}}async function Ec(e,t=Cc()){let n=[];for(let[t,r]of e.entries()){if(typeof r==`string`){n.push({name:t,value:r});continue}let e=typeof r.name==`string`?r.name:`blob`;n.push({name:t,file:{bytes:new Uint8Array(await r.arrayBuffer()),filename:e,contentType:r.type||void 0}})}return Tc(n,t)}function Dc(e){return e.replace(/\r\n|\r|\n/g,`\r
59
59
  `)}function Oc(e){return e.replace(/\r/g,`%0D`).replace(/\n/g,`%0A`).replace(/"/g,`%22`)}function kc(e){return(e??``).replace(/[\r\n]/g,``).trim()}function Ac(e){let t=0;for(let n of e)t+=n.byteLength;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}function jc(e){let t=``,n=32768;for(let r=0;r<e.length;r+=n)t+=String.fromCharCode(...Array.from(e.subarray(r,r+n)));return btoa(t)}async function Mc(e){let t=[];for(let[n,r]of e.entries()){if(typeof r==`string`){t.push({name:n,value:r});continue}let e=new Uint8Array(await r.arrayBuffer());t.push({name:n,file:{data:jc(e),filename:typeof r.name==`string`?r.name:`blob`,type:r.type||``}})}return{kind:`formdata`,entries:t}}async function Nc(e,t){let n=()=>Object.keys(t).some(e=>e.toLowerCase()===`content-type`);return typeof e==`string`?{body:e}:e instanceof URLSearchParams?(n()||(t[`Content-Type`]=`application/x-www-form-urlencoded;charset=UTF-8`),{body:e.toString()}):e instanceof Blob?{descriptor:{kind:`blob`,data:jc(new Uint8Array(await e.arrayBuffer())),type:e.type||``}}:e instanceof ArrayBuffer?{descriptor:{kind:`bytes`,data:jc(new Uint8Array(e))}}:ArrayBuffer.isView(e)?{descriptor:{kind:`bytes`,data:jc(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}:e instanceof FormData?{descriptor:await Mc(e)}:(n()||(t[`Content-Type`]=`application/json`),{body:JSON.stringify(e)})}function Pc(e){return e?`const __b64 = (s) => { const bin = atob(s); const n = bin.length; const u = new Uint8Array(n); for (let i = 0; i < n; i++) u[i] = bin.charCodeAt(i); return u; };const __body = `+JSON.stringify(e)+`;if (__body.kind === 'bytes') { __init.body = __b64(__body.data); }else if (__body.kind === 'blob') { __init.body = new Blob([__b64(__body.data)], { type: __body.type }); }else if (__body.kind === 'formdata') { const __fd = new FormData(); for (const e of __body.entries) { if (e.file) { __fd.append(e.name, new Blob([__b64(e.file.data)], { type: e.file.type }), e.file.filename); } else { __fd.append(e.name, e.value); } } __init.body = __fd; }`:``}function Fc(e){return`const h = {};r.headers.forEach((v, k) => { h[k] = v; });const ct = r.headers.get('content-type') || '';const __rt = `+JSON.stringify(e??null)+`;const __ctl = ct.toLowerCase();const __binPrefixes = ['image/','audio/','video/','application/octet-stream','application/pdf','application/protobuf','application/x-protobuf','application/wasm','application/zip'];const __isXml = __ctl.indexOf('+xml') !== -1 || __ctl.indexOf('application/xml') === 0 || __ctl.indexOf('text/xml') === 0;const __isBinary = __rt === 'binary' || (__rt !== 'text' && __rt !== 'json' && !__isXml && __binPrefixes.some((p) => __ctl.indexOf(p) === 0));const __meta = { ok: r.ok, status: r.status, statusText: r.statusText, url: r.url, redirected: !!r.redirected, headers: h };if (__isBinary) {const __u = new Uint8Array(await r.arrayBuffer());let __s = ''; const __cs = 0x8000;for (let __i = 0; __i < __u.length; __i += __cs) { __s += String.fromCharCode.apply(null, __u.subarray(__i, __i + __cs)); }return Object.assign(__meta, { body: btoa(__s), bodyEncoding: 'base64' });}const t = await r.text();let b;const __jsonWanted = __rt === 'json' || (__rt !== 'text' && ct.indexOf('application/json') !== -1);if (__jsonWanted) { if (!t) { b = null; } else { try { b = JSON.parse(t); } catch (e) { b = t; } } }else { b = t; }return Object.assign(__meta, { body: b });`}async function Ic(e,t={}){let n={},r=t.headers??{};for(let[e,t]of Object.entries(r))typeof t==`string`&&(n[e]=t);let i=typeof t.method==`string`?t.method:`GET`,a=t.credentials===`same-origin`||t.credentials===`omit`?t.credentials:`include`,o=t.body,{body:s,descriptor:c}=o==null?{}:await Nc(o,n),l={method:i,credentials:a,headers:n};s!==void 0&&(l.body=s),t.mode!==void 0&&(l.mode=t.mode),t.cache!==void 0&&(l.cache=t.cache),t.redirect!==void 0&&(l.redirect=t.redirect),t.referrer!==void 0&&(l.referrer=t.referrer),t.referrerPolicy!==void 0&&(l.referrerPolicy=t.referrerPolicy),t.integrity!==void 0&&(l.integrity=t.integrity),t.keepalive!==void 0&&(l.keepalive=t.keepalive);let u=Pc(c),d=Fc(t.responseType),f=typeof t.timeoutMs==`number`&&Number.isFinite(t.timeoutMs)&&t.timeoutMs>0?Math.round(t.timeoutMs):0,p=f>0?`__init.signal = AbortSignal.timeout(${f});`:``;return`(async () => {const __init = `+JSON.stringify(l)+`;`+p+u+`const r = await fetch(`+JSON.stringify(e)+`, __init);`+d+`})()`}function Lc(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 Rc(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=Lc(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 zc(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 Bc(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 Bc(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(wc(e)){let t=await Ec(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 Vc(e){return{findTab:t=>e.call(`browser`,`findTab`,[Uc(t)]),ensureTab:(t,n={})=>e.call(`browser`,`ensureTab`,[t,Wc(n)]),openWindow:(t,n={})=>e.call(`browser`,`openWindow`,[t,n]),windowBounds:t=>e.call(`browser`,`windowBounds`,[Lc(t)]),setWindowBounds:(t,n)=>e.call(`browser`,`setWindowBounds`,[Lc(t),n]),eval:(t,n)=>e.call(`browser`,`eval`,[Lc(t),Hc(n,!1)]),evalAsync:(t,n)=>e.call(`browser`,`evalAsync`,[Lc(t),Hc(n,!0)]),cookie:(t,n)=>e.call(`browser`,`cookie`,[Lc(t),n]),localStorage:(t,n)=>e.call(`browser`,`localStorage`,[Lc(t),n]),fetch:(t,n,r={})=>Ic(n,r).then(n=>e.call(`browser`,`evalAsync`,[Lc(t),n])),websocket:Rc(e)}}function Hc(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 Uc(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 Wc(e){return e.matchUrl===void 0?{}:{matchUrl:e.matchUrl instanceof RegExp?e.matchUrl.source:e.matchUrl}}function Gc(e){return{register(t){let n=null,r=e.onEvent(`computer-call`,r=>{let i=r;i.id===t.id&&qc(e,t,i,{getStop:()=>n,setStop:e=>{n=e}})}),i=Kc(t);return e.call(`computer`,`register`,[i]).catch(()=>{}),()=>{n?.(),n=null,r(),e.call(`computer`,`unregister`,[t.id]).catch(()=>{})}}}}function Kc(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 qc(e,t,n,r){let i;try{i=await Jc(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 Jc(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 Yc(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 Yc(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 Xc(e){return e===`SIGKILL`?137:e===`SIGINT`?130:143}function Zc(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:Xc(t)}),Promise.resolve(!0)),stdin:{write:e=>{!s&&!u&&o.push(e)},end:()=>m()},done:p}}});return l.exec=l,l}const Qc=/* @__PURE__ */ new Set([204,205,304]),$c=/* @__PURE__ */ new Set([`content-encoding`,`transfer-encoding`,`content-length`]);function el(e,t){let n=tl(e.body),r=nl(e.headers),i=Qc.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 il(a,n),a}function tl(e){return e.byteLength===0?/* @__PURE__ */ new Uint8Array:e.slice()}function nl(e){let t=new Headers;for(let[n,r]of Object.entries(e))if(!$c.has(n.toLowerCase()))try{t.set(n,r)}catch{}return t}const rl=Symbol(`slicc.realmBufferedBody`);function il(e,t){if(rl in e)return;Object.defineProperty(e,rl,{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,al(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 al(e){try{let t=e.body;t&&!t.locked&&t.getReader()}catch{}}function ol(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 sl(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function cl(e){return e==null?[]:Array.isArray(e)?e:[e]}function ll(e,t){let n=t.handle,r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a=!1,o=null,s=e=>{let t=e;if(!t||t.handle!==n)return;let i={reportId:t.reportId,data:sl(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,ol(r)]),sendFeatureReport:(t,r)=>e.call(`hid`,`sendFeatureReport`,[n,t,ol(r)]),receiveFeatureReport:async t=>sl((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 ul(e){return{list:async()=>(await e.call(`hid`,`list`,[])).map(t=>ll(e,t)),request:async t=>{let n=(await e.call(`hid`,`request`,[cl(t)]))[0];if(!n)throw Error(`No device selected.`);return ll(e,n)}}}function dl(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 fl=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 };`)}},pl=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=dl(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 fl(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 fl(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?.())}},ml=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 pl(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()}},hl=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 pl(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 ml(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 gl(e){let t=async t=>new hl(e),n=async(t,n)=>new hl(e);return{chromium:{launch:t,connect:n,connectOverCDP:n},firefox:{launch:t,connect:n},webkit:{launch:t,connect:n}}}const _l=/* @__PURE__ */ new Set([`bcrypt`,`better-sqlite3`,`canvas`,`cpu-features`,`fsevents`,`leveldown`,`libxmljs`,`libxmljs2`,`node-gyp-build`,`node-sass`,`puppeteer`,`robotjs`,`sass-embedded`,`sharp`,`snappy`,`sqlite3`,`tree-sitter`,`usb`]),vl={sharp:` Use the built-in 'convert' shell command for image work.`,canvas:` Use the built-in 'convert' / OffscreenCanvas for image work.`,"better-sqlite3":` Use the built-in 'sqlite3' shell command (sql.js WASM).`,sqlite3:` Use the built-in 'sqlite3' shell command (sql.js WASM).`,bcrypt:` Use crypto.subtle.digest() with PBKDF2 / Argon2 in pure JS.`,puppeteer:` Use the built-in browser-automation shell commands.`};function yl(e,t){let n=vl[t]??``;return/* @__PURE__ */ Error(`require('${e}'): '${t}' is a Node native module (C++ bindings) — it cannot run in the browser sandbox.${n}`)}function bl(e){return{...e,time:hs,fmt:tt,pool:ds}}function xl(e,t){return e?.startsWith(`/`)?gs(e):t}function Sl(e){return e.includes(`require`)||e.includes(`import`)||/(?:^|[;\n}])\s*export\b/.test(e)}async function Cl(e,t,n,r){return Sl(t)?e.call(`module`,`buildGraph`,[t,xl(r,n),r]):{files:[],entryMap:{},edges:{},edgeErrors:{},errors:{}}}function wl(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 Tl(e){return{playwright:gl(e)}}function El(e){let{graph:t,fsBridge:n,processShim:r,childProcess:i,nodeConsole:a,sliccyModules:o,shimmedPackages:s={},nodeReadline:c,nodeOsModule:l=hr,nodeUtilModule:u=Gt}=e,d=new Map(t.files.map(e=>[e.path,e.cjsSource])),f=new Map(t.files.map(e=>[e.path,e.kind])),p=/* @__PURE__ */ new Map,m=cr({requireFrom:(e,t)=>x(e,t),resolveFrom:(e,t)=>b(e,t)}),h=Qn(()=>{let e=r?.cwd?.();return typeof e==`string`&&e.length>0?e:`/`}),g=e=>{if(typeof e==`string`&&e.startsWith(`sliccy:`))return{hit:!0,value:kl(e,o)};let t=e.startsWith(`node:`)?e.slice(5):e,a=Dl(t,{fsBridge:n,processShim:r,childProcess:i,nodeOsModule:l,nodeUtilModule:u,nodePathModule:h,nodeReadline:c,nodeModule:m});if(a.hit)return a;if(_l.has(t))throw yl(e,t);if(Rn.has(t))throw jl(e,t);return t in s?{hit:!0,value:s[t]}:{hit:!1}},_=(e,n,r)=>{let i=g(n);if(i.hit)return i.value;let a=e?.[n];if(a)return v(a);let o=r===null?t.errors[n]:t.edgeErrors?.[r]?.[n];throw o?Error(o):Ol(n)};function v(e){let n=p.get(e);if(n)return n.exports;let i=d.get(e);if(i===void 0)throw Error(`Cannot find module '${e}'`);let o={exports:{}};p.set(e,o);let s=n=>_(t.edges[e],n,e),c=[`module`,`exports`,`require`,`process`,`console`,`Buffer`,`global`],l=[o,o.exports,s,r,a,globalThis.Buffer,globalThis];return f.get(e)!==`esm`&&(c.push(`__dirname`,`__filename`),l.push(gs(e),e)),Function(...c,i)(...l),f.get(e)===`cjs`&&wl(o.exports),o.exports}function y(e){return d.has(e)}function b(e,n){if(Bn(n))return n;let r=t.edges[e]?.[n];if(r)return r;let i=gs(e);if(sr(n)){let e=ar(i,n,y);if(e)return e}else{let e=or(i,n,y);if(e)return e}let a=t.edgeErrors?.[e]?.[n];throw a?Error(a):Ol(n)}function x(e,t){let n=g(t);return n.hit?n.value:v(b(e,t))}return{require:e=>_(t.entryMap,e,null)}}function Dl(e,t){let{fsBridge:n,processShim:r,childProcess:i,nodeOsModule:a,nodeUtilModule:o,nodePathModule:s,nodeReadline:l,nodeModule:u}=t;return e===`fs`||e===`fs/promises`?{hit:!0,value:n}:e===`path`?{hit:!0,value:s}:e===`crypto`?{hit:!0,value:Pn}: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:dt}:e===`assert/strict`?{hit:!0,value:ut}:e===`util`?{hit:!0,value:o}:e===`events`?{hit:!0,value:He}:e===`os`?{hit:!0,value:a}:e===`tty`?{hit:!0,value:gr}:e===`stream`?{hit:!0,value:_t}:e===`url`?{hit:!0,value:c}:e===`zlib`?{hit:!0,value:cs}:e===`vm`?{hit:!0,value:Ir}:e===`readline`&&l?{hit:!0,value:l}:e===`readline/promises`&&l?{hit:!0,value:l.promises}:e===`module`&&u?{hit:!0,value:u}:{hit:!1}}function Ol(e){if(e.startsWith(`.`)||e.startsWith(`/`)||e.startsWith(`node:`))return/* @__PURE__ */ Error(`Cannot find module '${e}'`);let t=e.startsWith(`@`)?e.split(`/`).slice(0,2).join(`/`):e.split(`/`)[0];return/* @__PURE__ */ Error(`Cannot find module '${e}' (run: ipk install ${t})`)}function kl(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 Al={http:` Use fetch() instead.`,https:` Use fetch() instead.`,crypto:` Use globalThis.crypto (Web Crypto API) instead.`};function jl(e,t){return/* @__PURE__ */ Error(`require('${e}'): Node built-in '${t}' is not available in the browser environment.${Al[t]||``}`)}async function Ml(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";
60
60
  `:``}${e}`);try{return await s(...a),0}catch(e){return e instanceof _s?e.code:(n(`${e instanceof Error?e.stack??e.message:String(e)}\n`),1)}}var Nl=class{port;nextId=1;pending=/* @__PURE__ */ new Map;eventSubscribers=/* @__PURE__ */ new Map;progressWaiters=/* @__PURE__ */ new Set;handler;disposed=!1;constructor(e){this.port=e,this.handler=e=>{let t=e.data;if(t?.type===`realm-rpc-res`){let t=e.data,n=this.pending.get(t.id);if(!n)return;this.pending.delete(t.id),typeof t.error==`string`?n.reject(Error(t.error)):n.resolve(t.result),this.notifyProgress();return}if(t?.type===`realm-event`){let t=e.data,n=this.eventSubscribers.get(t.channel);if(!n)return;for(let e of[...n])try{e(t.payload)}catch{}}},e.addEventListener(`message`,this.handler),e.start?.()}get pendingCount(){return this.pending.size+this.eventSubscriptionCount}get eventSubscriptionCount(){let e=0;for(let t of this.eventSubscribers.values())e+=t.size;return e}waitForProgress(){return this.pendingCount===0?Promise.resolve():new Promise(e=>{this.progressWaiters.add(e)})}notifyProgress(){if(this.progressWaiters.size===0)return;let e=[...this.progressWaiters];this.progressWaiters.clear();for(let t of e)t()}call(e,t,n=[]){if(this.disposed)return Promise.reject(/* @__PURE__ */ Error(`realm-rpc: client disposed`));let r=this.nextId++,i={type:`realm-rpc-req`,id:r,channel:e,op:t,args:n};return new Promise((e,t)=>{this.pending.set(r,{resolve:e,reject:t}),this.port.postMessage(i)})}onEvent(e,t){if(this.disposed)return()=>{};let n=this.eventSubscribers.get(e);return n||(n=/* @__PURE__ */ new Set,this.eventSubscribers.set(e,n)),n.add(t),this.notifyProgress(),()=>{let n=this.eventSubscribers.get(e);n&&(n.delete(t),n.size===0&&this.eventSubscribers.delete(e),this.notifyProgress())}}dispose(){if(this.disposed)return;this.disposed=!0,this.port.removeEventListener(`message`,this.handler);let e=/* @__PURE__ */ Error(`realm-rpc: client disposed`);for(let t of this.pending.values())t.reject(e);this.pending.clear(),this.eventSubscribers.clear(),this.notifyProgress()}};function Pl(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?ol(t.until):void 0,timeoutMs:t.timeoutMs}]),write:t=>e.call(`serial`,`write`,[n,ol(t)]),getSignals:()=>e.call(`serial`,`getSignals`,[n]),setSignals:t=>e.call(`serial`,`setSignals`,[n,t])}}function Fl(e){return{list:async()=>(await e.call(`serial`,`list`,[])).map(t=>Pl(e,t)),request:async t=>Pl(e,await e.call(`serial`,`request`,[cl(t)]))}}function Il(e){let t=e;return!t||typeof t.isFile!=`boolean`||typeof t.isDirectory!=`boolean`||typeof t.size!=`number`?null:{isFile:t.isFile,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,size:t.size,...typeof t.mode==`number`?{mode:t.mode}:{},...typeof t.mtimeMs==`number`?{mtimeMs:t.mtimeMs}:{},...typeof t.ino==`number`?{ino:t.ino}:{}}}function Ll(e,t){return O(e,`sync-fs bridge, '${t}'`)}function Rl(e,t){let n=`/__slicc/fs-sync`+(e.startsWith(`/`)?e:`/${e}`).split(`/`).map(encodeURIComponent).join(`/`);return t?`${n}?op=${t}`:n}function zl(e,t={}){let n=t.timeoutMs??3e4;function r(t,r,i,a){return{method:t,url:Rl(r,a),token:e,...i?{body:i}:{},timeoutMs:n,label:`sync-fs bridge, '${r}'`}}return{readFile(e){return k(r(`GET`,e))},writeFile(e,t){k(r(`POST`,e,t))},stat(e){let t=Il(ae(r(`GET`,e,void 0,`stat`)));if(!t)throw Ll(`EIO`,e);return t},lstat(e){let t=Il(ae(r(`GET`,e,void 0,`lstat`)));if(!t)throw Ll(`EIO`,e);return t},readdir(e){let t=ae(r(`GET`,e,void 0,`readdir`));if(!Array.isArray(t)||!t.every(e=>typeof e==`string`))throw Ll(`EIO`,e);return t},exists(e){let t=ae(r(`GET`,e,void 0,`exists`));if(typeof t!=`boolean`)throw Ll(`EIO`,e);return t},mkdir(e){k(r(`POST`,e,void 0,`mkdir`))},rm(e){k(r(`POST`,e,void 0,`rm`))},rename(e,t){k(r(`POST`,e,Bl({arg2:t}),`rename`))},unlink(e){k(r(`POST`,e,Bl({}),`unlink`))},rmdir(e){k(r(`POST`,e,Bl({}),`rmdir`))},symlink(e,t){k(r(`POST`,t,Bl({arg2:e}),`symlink`))},readlink(e){let t=ae(r(`GET`,e,void 0,`readlink`));if(typeof t!=`string`)throw Ll(`EIO`,e);return t},chmod(e,t){k(r(`POST`,e,Bl({mode:t}),`chmod`))},utimes(e,t,n){k(r(`POST`,e,Bl({atimeMs:t,mtimeMs:n}),`utimes`))}}}function Bl(e){return new TextEncoder().encode(JSON.stringify(e))}new TextEncoder;const Vl=new TextDecoder;function Hl(e,t){switch(e){case 1:return{ok:!0,kind:`bytes`,bytes:t};case 3:return{ok:!0,kind:`void`};case 2:try{return{ok:!0,kind:`json`,json:JSON.parse(Vl.decode(t))}}catch{return{ok:!1,errno:`EIO`,message:`sync-sab: malformed json payload`}}case 4:try{let e=JSON.parse(Vl.decode(t)),n=typeof e.errno==`string`&&/^E[A-Z]+$/.test(e.errno)?e.errno:`EIO`;return{ok:!1,errno:n,message:String(e.message??n)}}catch{return{ok:!1,errno:`EIO`,message:`sync-sab: malformed errno payload`}}default:return{ok:!1,errno:`EIO`,message:`sync-sab: unknown status ${e}`}}}function Ul(e){if(e.byteLength<4160)throw Error(`sync-sab: buffer too small (${e.byteLength} < 4160)`);return{header:new Int32Array(e,0,16),window:new Uint8Array(e,64)}}function Wl(e,t,n={}){let{header:r,window:i}=Ul(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 O(`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:`sync-sab-req`,id:l,req:e}:{type:`sync-sab-next`,id:l,offset:p};try{t.postMessage(n)}catch{throw O(`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 O(`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 O(`EIO`,a)}}finally{Atomics.store(r,0,0)}return Hl(f,d)}}}function $(e,t){return O(e,`sync-sab bridge, '${t}'`)}function Gl(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 $(i.errno,r);return i}function i(e,t){let n=r(e,t);if(n.ok&&n.kind===`bytes`)return n.bytes;throw $(`EIO`,t)}function a(e,t){let n=r(e,t);if(n.ok&&n.kind===`json`)return n.json;throw $(`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=Il(a({op:`stat`,path:e},e));if(!t)throw $(`EIO`,e);return t},lstat:e=>{let t=Il(a({op:`lstat`,path:e},e));if(!t)throw $(`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 $(`EIO`,e);return t},readdirStat:e=>{let t=a({op:`readdir-stat`,path:e},e);if(!Array.isArray(t))throw $(`EIO`,e);return t.map(t=>{if(!Array.isArray(t)||typeof t[0]!=`string`)throw $(`EIO`,e);if(t[1]===null)return[t[0],null];let n=Il(t[1]);if(!n)throw $(`EIO`,e);return[t[0],n]})},exists:e=>{let t=a({op:`exists`,path:e},e);if(typeof t!=`boolean`)throw $(`EIO`,e);return t},mkdir:e=>{r({op:`mkdir`,path:e},e)},rm:e=>{r({op:`rm`,path:e},e)},rename:(e,t)=>{r({op:`rename`,path:e,arg2:t},e)},unlink:e=>{r({op:`unlink`,path:e},e)},rmdir:e=>{r({op:`rmdir`,path:e},e)},symlink:(e,t)=>{r({op:`symlink`,path:t,arg2:e},t)},readlink:e=>{let t=a({op:`readlink`,path:e},e);if(typeof t!=`string`)throw $(`EIO`,e);return t},chmod:(e,t)=>{r({op:`chmod`,path:e,mode:t},e)},utimes:(e,t,n)=>{r({op:`utimes`,path:e,atimeMs:t,mtimeMs:n},e)}}}function Kl(e){return(t,n,r)=>{let i=e.call({...t,channel:D},n+te,r);if(!i.ok)throw O(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 O(`EIO`,r);return{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode}}}function ql(e,t){if(e.syncSab&&Jl())return Wl(e.syncSab,t)}function Jl(){return typeof Atomics<`u`&&typeof Atomics.wait==`function`}function Yl(e){return!!e.syncFsToken||!!e.syncSab&&Jl()}function Xl(e,t){return t?Gl(t):e.syncFsToken?zl(e.syncFsToken):void 0}function Zl(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=/* @__PURE__ */ new Set,d=/* @__PURE__ */ new Set,f=/* @__PURE__ */ 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 Ql(e,t){let n=t.handle,r=e=>({status:e.status,data:sl(e.bytes)}),i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ 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,ol(r)]),transferIn:async(t,i)=>r(await e.call(`usb`,`transferIn`,[n,t,i])),transferOut:(t,r)=>e.call(`usb`,`transferOut`,[n,t,ol(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 $l(e){return{list:async()=>(await e.call(`usb`,`list`,[])).map(t=>Ql(e,t)),request:async t=>Ql(e,await e.call(`usb`,`request`,[cl(t)]))}}function eu(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t<0?``:t===0?`/`:e.substring(0,t)}function tu(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 nu(e){return/^[A-Za-z0-9_\-./:@]+$/.test(e)?e:`'`+e.replace(/'/g,`'\\''`)+`'`}function ru(e,t){return e===``?t:e===`/`?`/${t}`:`${e}/${t}`}function iu(e){let t=eu(e.argv[1]??``),n=tu(t),r=ru(n,`references`),i=ru(n,`assets`),a=ru(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)+`
61
- `),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 ${nu(t)}`,{stdout:r,stderr:i,exitCode:a}=await e.exec(n);if(a!==0){let e=i.trim()||`oauth-token exited with code ${a}`;throw Error(`skill.token('${t}'): ${e}`)}return r.replace(/\r?\n+$/,``)}return Object.freeze({dir:t,root:n,refs:r,assets:i,config:s,token:c})}const au=65536;function ou(e,t){if(!t)return e;let n=e+t;return n.length<=au?n:n.slice(n.length-au)}async function su(e,t,n,r){let i;try{i=await e.call(`vfs`,`snapshot`,r?[t,r]:[t])}catch(e){n?.(e instanceof Error?e.message:String(e)),i={entries:[]}}return new pe(i)}function cu(e,t){if(e.syncFsToken)return e=>t(`[sync-fs] snapshot failed, sync metadata will be incomplete: ${e}\n`)}function lu(e,t,n,r){globalThis.__slicc_mountVfs=async(i,a)=>{let{mountVfsIntoEmscripten:o}=await import(`./emscripten-vfs-hook-EtC57PJB.js`);return o(i,{bridge:e,syncFs:t,cwd:n,warn:e=>r.writeStderr(`slicc: ${e}\n`)},a)}}function uu(e,t,n,r,i){let a=ql(e,t),o=Xl(e,a);if(Object.assign(r,Be(n,e.cwd,o,i,{write:(e,n)=>{t.postMessage({type:`realm-fs-write`,path:e,bytes:n})},delete:e=>{t.postMessage({type:`realm-fs-delete`,path:e})}})),o&&lu(o,n,e.cwd,i),e.syncFsToken)return le(e.syncFsToken,{syncFs:n,...o?{fsBridge:o}:{},...a?{transport:Kl(a),noDefaultDeadline:!0}:{}})}function du(e=globalThis){Object.prototype.hasOwnProperty.call(e,`SLICC_VERSION`)||Object.defineProperty(e,"SLICC_VERSION",{value:a().version,writable:!1,enumerable:!1,configurable:!1})}function fu(e,t,n){let r=Ge({isTTY:!e,noColor:e});return{colorApi:r,cliApi:Ue({writeStdout:t,writeStderr:n,exit:e=>{throw new _s(e)},color:r})}}function pu(e,t,n){return{readStdinBytes:()=>he(e.stdin??``),writeStdout:t,writeStderr:n}}function mu(e){return{usbBridge:$l(e),serialBridge:Fl(e),hidBridge:ul(e),computerBridge:Gc(e)}}async function hu(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:ou(r.stdout,a):r.stderr=n?r.stderr+a:ou(r.stderr,a),t.postMessage({type:`realm-output`,stream:e,chunk:a})},a=e=>{i(`stdout`,e)},o=e=>{i(`stderr`,e)},s=Rs(a,o),c=Vs(e,a,o),{colorApi:l,cliApi:u}=fu(!!e.env?.NO_COLOR,a,o),d=new Nl(t),f=pu(e,a,o),p=Te(d,T,f),m=await su(d,e.cwd,cu(e,o),Yl(e)?{timeBudgetMs:150}:void 0),h=uu(e,t,m,p,f),g=Zc(d,m,e.cwd,o),_=Sc(g,{cwd:e.cwd}),v=iu({argv:e.argv,fs:p,exec:g}),y=Vc(d),{usbBridge:b,serialBridge:x,hidBridge:S,computerBridge:C}=mu(d),w=vc({fetch:T});async function T(e,t){let n=e instanceof Request?e.url:e instanceof URL?e.toString():String(e);return el(await d.call(`fetch`,`request`,[n,await zc(t,e)]),n)}let E=bl({exec:g,agent:_,skill:v,http:w,browser:y,usb:b,serial:x,hid:S,computer:C,cli:u,color:l}),D=e.filename,ee=gs(D),te=await Cl(d,e.code,e.cwd,D),ne=El({graph:te,fsBridge:p,processShim:c.processShim,childProcess:rn(g,h),nodeConsole:s,sliccyModules:E,shimmedPackages:Tl(d),nodeReadline:Ys({output:{write:a},onExit:c.recordExit}),nodeOsModule:mr(e.env),nodeUtilModule:Wt(e=>o(`${e}\n`),()=>c.processShim.argv.slice(2))}).require,re={exports:{},filename:e.filename},ie=te.entrySource!==void 0;await gu({entryCode:te.entrySource??e.code,isEsmEntry:ie,entryIsModule:te.entryIsModule===!0,filename:D,dirname:ee,proc:c,nodeConsole:s,requireShim:ne,moduleShim:re,realmFetch:T,writeStderr:o,rpc:d,syncFs:m,output:r,port:t})}async function gu(e){let t=globalThis;du(),t.__slicc_compileWasm=t=>e.rpc.call(`wasm`,`compile`,[t]);let n=Zl(globalThis,{onCallbackError(e){if(!(e instanceof _s))throw e}}),{createBodyReadHandleTracker:r}=await import(`./realm-body-handles-BczvKQ6G.js`),i=r(globalThis);n.install(),i.install();let a=zs(globalThis,e.proc.processShim),{watchUnhandledRejections:o}=await import(`./realm-unhandled-rejections-CEsfeJY7.js`),s=o(globalThis,{writeStderr:e.writeStderr,didExit:e.proc.getDidCallProcessExit,recordExit:e.proc.recordExit});try{let r=await _u({entryCode:e.entryCode,bridges:{process:e.proc.processShim,console:e.nodeConsole,require:e.requireShim,module:e.moduleShim,exports:e.moduleShim.exports,fetch:e.realmFetch,...e.entryIsModule?{}:{__dirname:e.dirname,__filename:e.filename}},writeStderr:e.writeStderr,isEsmEntry:e.isEsmEntry,rpc:e.rpc,syncFs:e.syncFs,proc:e.proc,timers:n,bodyReads:i,fatal:s.fatal});delete t.__slicc_compileWasm,delete t.__slicc_mountVfs,e.rpc.dispose(),e.port.postMessage({type:`realm-done`,stdout:e.output.stdout,stderr:e.output.stderr,exitCode:r})}finally{s.dispose(),n.clearPending(),n.restore(),i.restore(),a()}}async function _u(e){let t=await Ml(e.entryCode,e.bridges,e.writeStderr,e.isEsmEntry);return await vu(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()?(e.timers.clearPending(),e.proc.getExitCode()):(await yu(e.rpc,e.timers,e.bodyReads,e.proc,e.fatal),e.proc.getDidCallProcessExit()&&e.timers.clearPending(),await vu(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()||t===0?e.proc.getExitCode():t)}async function vu(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 yu(e,t,n,r,i){await t.tick();let a=0;for(;!r.getDidCallProcessExit()&&a<2;){let o=[];if(e.pendingCount>0&&o.push(e.waitForProgress()),t.pendingCount>0&&o.push(t.waitForProgress()),n.pendingCount>0&&o.push(n.waitForProgress()),o.length===0){a+=1,await t.tick();continue}a=0,o.push(i),await Promise.race(o),r.getDidCallProcessExit()||await t.tick()}}const bu={postMessage:(e,t)=>t?self.postMessage(e,t):self.postMessage(e),addEventListener:(e,t)=>self.addEventListener(e,t),removeEventListener:(e,t)=>self.removeEventListener(e,t)};self.addEventListener(`message`,e=>{if(e.data?.type!==`realm-init`)return;let t=e.data;t.kind===`js`&&hu(t,bu).catch(e=>{let t={type:`realm-error`,message:e instanceof Error?e.message:String(e)};self.postMessage(t)})});export{j as n,_s as t};
61
+ `),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 ${nu(t)}`,{stdout:r,stderr:i,exitCode:a}=await e.exec(n);if(a!==0){let e=i.trim()||`oauth-token exited with code ${a}`;throw Error(`skill.token('${t}'): ${e}`)}return r.replace(/\r?\n+$/,``)}return Object.freeze({dir:t,root:n,refs:r,assets:i,config:s,token:c})}const au=65536;function ou(e,t){if(!t)return e;let n=e+t;return n.length<=au?n:n.slice(n.length-au)}async function su(e,t,n,r){let i;try{i=await e.call(`vfs`,`snapshot`,r?[t,r]:[t])}catch(e){n?.(e instanceof Error?e.message:String(e)),i={entries:[]}}return new pe(i)}function cu(e,t){if(e.syncFsToken)return e=>t(`[sync-fs] snapshot failed, sync metadata will be incomplete: ${e}\n`)}function lu(e,t,n,r){globalThis.__slicc_mountVfs=async(i,a)=>{let{mountVfsIntoEmscripten:o}=await import(`./emscripten-vfs-hook-rbqoLuA5.js`);return o(i,{bridge:e,syncFs:t,cwd:n,warn:e=>r.writeStderr(`slicc: ${e}\n`)},a)}}function uu(e,t,n,r,i){let a=ql(e,t),o=Xl(e,a);if(Object.assign(r,Be(n,e.cwd,o,i,{write:(e,n)=>{t.postMessage({type:`realm-fs-write`,path:e,bytes:n})},delete:e=>{t.postMessage({type:`realm-fs-delete`,path:e})}})),o&&lu(o,n,e.cwd,i),e.syncFsToken)return le(e.syncFsToken,{syncFs:n,...o?{fsBridge:o}:{},...a?{transport:Kl(a),noDefaultDeadline:!0}:{}})}function du(e=globalThis){Object.prototype.hasOwnProperty.call(e,`SLICC_VERSION`)||Object.defineProperty(e,"SLICC_VERSION",{value:a().version,writable:!1,enumerable:!1,configurable:!1})}function fu(e,t,n){let r=Ge({isTTY:!e,noColor:e});return{colorApi:r,cliApi:Ue({writeStdout:t,writeStderr:n,exit:e=>{throw new _s(e)},color:r})}}function pu(e,t,n){return{readStdinBytes:()=>he(e.stdin??``),writeStdout:t,writeStderr:n}}function mu(e){return{usbBridge:$l(e),serialBridge:Fl(e),hidBridge:ul(e),computerBridge:Gc(e)}}async function hu(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:ou(r.stdout,a):r.stderr=n?r.stderr+a:ou(r.stderr,a),t.postMessage({type:`realm-output`,stream:e,chunk:a})},a=e=>{i(`stdout`,e)},o=e=>{i(`stderr`,e)},s=Rs(a,o),c=Vs(e,a,o),{colorApi:l,cliApi:u}=fu(!!e.env?.NO_COLOR,a,o),d=new Nl(t),f=pu(e,a,o),p=Te(d,T,f),m=await su(d,e.cwd,cu(e,o),Yl(e)?{timeBudgetMs:150}:void 0),h=uu(e,t,m,p,f),g=Zc(d,m,e.cwd,o),_=Sc(g,{cwd:e.cwd}),v=iu({argv:e.argv,fs:p,exec:g}),y=Vc(d),{usbBridge:b,serialBridge:x,hidBridge:S,computerBridge:C}=mu(d),w=vc({fetch:T});async function T(e,t){let n=e instanceof Request?e.url:e instanceof URL?e.toString():String(e);return el(await d.call(`fetch`,`request`,[n,await zc(t,e)]),n)}let E=bl({exec:g,agent:_,skill:v,http:w,browser:y,usb:b,serial:x,hid:S,computer:C,cli:u,color:l}),D=e.filename,ee=gs(D),te=await Cl(d,e.code,e.cwd,D),ne=El({graph:te,fsBridge:p,processShim:c.processShim,childProcess:rn(g,h),nodeConsole:s,sliccyModules:E,shimmedPackages:Tl(d),nodeReadline:Ys({output:{write:a},onExit:c.recordExit}),nodeOsModule:mr(e.env),nodeUtilModule:Wt(e=>o(`${e}\n`),()=>c.processShim.argv.slice(2))}).require,re={exports:{},filename:e.filename},ie=te.entrySource!==void 0;await gu({entryCode:te.entrySource??e.code,isEsmEntry:ie,entryIsModule:te.entryIsModule===!0,filename:D,dirname:ee,proc:c,nodeConsole:s,requireShim:ne,moduleShim:re,realmFetch:T,writeStderr:o,rpc:d,syncFs:m,output:r,port:t})}async function gu(e){let t=globalThis;du(),t.__slicc_compileWasm=t=>e.rpc.call(`wasm`,`compile`,[t]);let n=Zl(globalThis,{onCallbackError(e){if(!(e instanceof _s))throw e}}),{createBodyReadHandleTracker:r}=await import(`./realm-body-handles-BczvKQ6G.js`),i=r(globalThis);n.install(),i.install();let a=zs(globalThis,e.proc.processShim),{watchUnhandledRejections:o}=await import(`./realm-unhandled-rejections-5totJ0nZ.js`),s=o(globalThis,{writeStderr:e.writeStderr,didExit:e.proc.getDidCallProcessExit,recordExit:e.proc.recordExit});try{let r=await _u({entryCode:e.entryCode,bridges:{process:e.proc.processShim,console:e.nodeConsole,require:e.requireShim,module:e.moduleShim,exports:e.moduleShim.exports,fetch:e.realmFetch,...e.entryIsModule?{}:{__dirname:e.dirname,__filename:e.filename}},writeStderr:e.writeStderr,isEsmEntry:e.isEsmEntry,rpc:e.rpc,syncFs:e.syncFs,proc:e.proc,timers:n,bodyReads:i,fatal:s.fatal});delete t.__slicc_compileWasm,delete t.__slicc_mountVfs,e.rpc.dispose(),e.port.postMessage({type:`realm-done`,stdout:e.output.stdout,stderr:e.output.stderr,exitCode:r})}finally{s.dispose(),n.clearPending(),n.restore(),i.restore(),a()}}async function _u(e){let t=await Ml(e.entryCode,e.bridges,e.writeStderr,e.isEsmEntry);return await vu(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()?(e.timers.clearPending(),e.proc.getExitCode()):(await yu(e.rpc,e.timers,e.bodyReads,e.proc,e.fatal),e.proc.getDidCallProcessExit()&&e.timers.clearPending(),await vu(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()||t===0?e.proc.getExitCode():t)}async function vu(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 yu(e,t,n,r,i){await t.tick();let a=0;for(;!r.getDidCallProcessExit()&&a<2;){let o=[];if(e.pendingCount>0&&o.push(e.waitForProgress()),t.pendingCount>0&&o.push(t.waitForProgress()),n.pendingCount>0&&o.push(n.waitForProgress()),o.length===0){a+=1,await t.tick();continue}a=0,o.push(i),await Promise.race(o),r.getDidCallProcessExit()||await t.tick()}}const bu={postMessage:(e,t)=>t?self.postMessage(e,t):self.postMessage(e),addEventListener:(e,t)=>self.addEventListener(e,t),removeEventListener:(e,t)=>self.removeEventListener(e,t)};self.addEventListener(`message`,e=>{if(e.data?.type!==`realm-init`)return;let t=e.data;t.kind===`js`&&hu(t,bu).catch(e=>{let t={type:`realm-error`,message:e instanceof Error?e.message:String(e)};self.postMessage(t)})});export{j as n,_s as t};