sliccy 5.63.4 → 5.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/node-server/_shared/secrets-pipeline.d.ts +25 -7
  2. package/dist/node-server/_shared/secrets-pipeline.d.ts.map +1 -1
  3. package/dist/node-server/_shared/secrets-pipeline.js +35 -8
  4. package/dist/node-server/_shared/secrets-pipeline.js.map +1 -1
  5. package/dist/node-server/routes/fetch-proxy.js +3 -0
  6. package/dist/node-server/secrets/proxy-manager.d.ts +2 -0
  7. package/dist/ui/assets/{account-store-B9-adorx.js → account-store-0KfyaB_Y.js} +1 -1
  8. package/dist/ui/assets/{account-store-BFKOVoJK.js → account-store-O8B4A1Cp.js} +1 -1
  9. package/dist/ui/assets/{adobe-DljiV8CX.js → adobe-BA1lmOYx.js} +1 -1
  10. package/dist/ui/assets/{adobe-Cimz7Qad.js → adobe-DPWNL1tn.js} +1 -1
  11. package/dist/ui/assets/{apps-EdGaobBt.js → apps--X4sn_V2.js} +1 -1
  12. package/dist/ui/assets/{azure-openai-DZfQfbEN.js → azure-openai-DG3rPUFz.js} +1 -1
  13. package/dist/ui/assets/{azure-openai-B1LGYY5w.js → azure-openai-DWNTc7zl.js} +1 -1
  14. package/dist/ui/assets/{cerebras-D9rdJuv7.js → cerebras-D8FzL0rQ.js} +1 -1
  15. package/dist/ui/assets/{cerebras-Dd-I5CEf.js → cerebras-_3t84WRb.js} +1 -1
  16. package/dist/ui/assets/{connect-surface-Dre9TL7S.js → connect-surface-DaZKS0Lr.js} +1 -1
  17. package/dist/ui/assets/fs-Bu2r8jU8.js +2 -0
  18. package/dist/ui/assets/fs-DVjU94G5.js +1 -0
  19. package/dist/ui/assets/{github-CyPb8Ejb.js → github-DBqthTVS.js} +1 -1
  20. package/dist/ui/assets/{github-D9N2QXEG.js → github-IAPS6ldF.js} +2 -2
  21. package/dist/ui/assets/{github-copilot-D1D7dY7b.js → github-copilot-BCnsU1ES.js} +1 -1
  22. package/dist/ui/assets/{github-copilot-md_u_Xt0.js → github-copilot-CYCZVUKg.js} +1 -1
  23. package/dist/ui/assets/{js-realm-worker-vnTP6x9C.js → js-realm-worker-FgXpYXua.js} +7 -7
  24. package/dist/ui/assets/{kernel-worker-Bg1GG_Na.js → kernel-worker-DwA7Ndre.js} +27 -27
  25. package/dist/ui/assets/{lick-ws-bridge-RSsqIMjw.js → lick-ws-bridge-BkMe-xPV.js} +1 -1
  26. package/dist/ui/assets/{local-llm-C3oGat0H.js → local-llm-BW8Tu5rb.js} +1 -1
  27. package/dist/ui/assets/{local-llm-BaoGgCFz.js → local-llm-BaiaM-eK.js} +1 -1
  28. package/dist/ui/assets/{main-vzVT7hjL.js → main-BtekKitA.js} +3 -3
  29. package/dist/ui/assets/{mount-CB9LbKIo.js → mount-DXVsSVpg.js} +2 -2
  30. package/dist/ui/assets/{mount-KPh5FQy2.js → mount-YiUVBgZj.js} +1 -1
  31. package/dist/ui/assets/{mount-recovery-l9BFFyMp.js → mount-recovery-B98mAfuD.js} +1 -1
  32. package/dist/ui/assets/{new-session-CCs-0HLH.js → new-session-C7oDK2Kk.js} +2 -2
  33. package/dist/ui/assets/{oauth-bootstrap-KDRfKJJk.js → oauth-bootstrap-B_ydSM5a.js} +2 -2
  34. package/dist/ui/assets/{openai-codex-G98kDIrK.js → openai-codex-Cx2WiSHz.js} +1 -1
  35. package/dist/ui/assets/{openai-codex-CG1BFVNV.js → openai-codex-Dx55_uE7.js} +1 -1
  36. package/dist/ui/assets/{panel-rpc-handlers-CtaGdPiZ.js → panel-rpc-handlers-g-IcBZgz.js} +2 -2
  37. package/dist/ui/assets/{provider-1UnA0iTT.js → provider-D7tuUspk.js} +2 -2
  38. package/dist/ui/assets/{provider-CXZ0Yoon.js → provider-DlfrkDnN.js} +1 -1
  39. package/dist/ui/assets/{provider-settings-B1ye5KnA.js → provider-settings-CLFfVTte.js} +1 -1
  40. package/dist/ui/assets/{provider-settings-X4c7CFKN.js → provider-settings-DXZqWMxH.js} +1 -1
  41. package/dist/ui/assets/provider-store-access-2_FnhYqS.js +1 -0
  42. package/dist/ui/assets/{provider-store-access-Bcg6OLsk.js → provider-store-access-B48zmrjF.js} +2 -2
  43. package/dist/ui/assets/{providers-DhwIRhTh.js → providers-C5IxOdJy.js} +2 -2
  44. package/dist/ui/assets/{providers-DmcTo7yV.js → providers-DSGqRskI.js} +1 -1
  45. package/dist/ui/assets/{quick-llm-C_5W6jkO.js → quick-llm-DEwzmM-S.js} +1 -1
  46. package/dist/ui/assets/{session-freezer-5VJvody6.js → session-freezer-DdYYo55y.js} +2 -2
  47. package/dist/ui/assets/{setup-sudo-hbE3YS_h.js → setup-sudo-CpuvPX2I.js} +2 -2
  48. package/dist/ui/assets/{skills-BhOiOEZH.js → skills-CllGu9dI.js} +1 -1
  49. package/dist/ui/assets/{store-DxxV-bbY.js → store-DJbSm8Z_.js} +1 -1
  50. package/dist/ui/assets/{sudo-DchLnUf3.js → sudo-xF6nYDZf.js} +1 -1
  51. package/dist/ui/assets/{upgrade-detection-BW3VRd1P.js → upgrade-detection-Cein6N3L.js} +1 -1
  52. package/dist/ui/assets/{wc-extension-C29GXMnK.js → wc-extension-D3wWW1XJ.js} +2 -2
  53. package/dist/ui/assets/{wc-follower-Cw_-1J-M.js → wc-follower-DwatFMHA.js} +3 -3
  54. package/dist/ui/assets/{wc-live-Ddn6PNV5.js → wc-live-DcaNrDBs.js} +3 -3
  55. package/dist/ui/assets/{wc-nav-GP31iyge.js → wc-nav-wVpt4FYo.js} +2 -2
  56. package/dist/ui/assets/{wc-onboarding-CJqGobRI.js → wc-onboarding-B5Jx6i_M.js} +2 -2
  57. package/dist/ui/assets/{wc-placeholder-CaVn58Qm.js → wc-placeholder-DJEXeUOp.js} +2 -2
  58. package/dist/ui/assets/{wc-settings-D8xvXhKu.js → wc-settings-HdKp6PRa.js} +2 -2
  59. package/dist/ui/assets/{wc-shell-DMnWuIZ-.js → wc-shell-BcLe36CI.js} +2 -2
  60. package/dist/ui/assets/{wc-sprinkles-3sLH601k.js → wc-sprinkles-Ce05-7PD.js} +2 -2
  61. package/dist/ui/assets/{wc-tray-BIFpwQo6.js → wc-tray-CLX4el5K.js} +2 -2
  62. package/dist/ui/assets/{xai-grok-DW_swkku.js → xai-grok-170AT997.js} +1 -1
  63. package/dist/ui/assets/{xai-grok-B9IjiF5p.js → xai-grok-C2qHyLFl.js} +1 -1
  64. package/dist/ui/index.html +5 -5
  65. package/dist/ui/packages/webapp/index.html +5 -5
  66. package/package.json +3 -3
  67. package/dist/ui/assets/fs-2Bn7XMhr.js +0 -2
  68. package/dist/ui/assets/fs-Dn5olo3p.js +0 -1
  69. package/dist/ui/assets/provider-store-access-BOUsNLHm.js +0 -1
@@ -1 +1 @@
1
- import{O as e,i as t}from"./account-store-BFKOVoJK.js";import{p as n}from"./transform-messages-CVIV-EgO.js";import{p as r}from"./bedrock-camp-CvxD6hHk.js";import{c as i,i as a}from"./legacy-api-aliases-DWJHPSiz.js";import"./provider-settings-X4c7CFKN.js";import{XaiErrorCode as o,XaiOAuthError as s}from"./xai-grok-errors-ByEMMSoz.js";import{resolveModels as c,toModelMetadata as l}from"./xai-grok-models-B0Tf--xf.js";import{sanitizePayload as u}from"./xai-grok-sanitize-CV6qvaEF.js";const d=`xai-grok`,f=`https://auth.x.ai`,p=`${f}/oauth2/authorize`,m=`${f}/oauth2/token`,h=`b1a00492-073a-47ea-816f-4c329264a828`,g=`http://127.0.0.1:56121/callback`,_=`https://api.x.ai/v1`,v=`openai-responses`,y=`${d}-openai`;function b(){return typeof process>`u`?null:{}.PI_XAI_OAUTH_MODELS??null}const x=c(b());function S(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function C(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}function w(){return S(C(32))}async function T(e){let t=new TextEncoder().encode(e);return S(new Uint8Array(await crypto.subtle.digest(`SHA-256`,t)))}function E(){return S(C(16))}async function D(e,t){let n=new URLSearchParams({grant_type:`authorization_code`,code:e,redirect_uri:g,client_id:h,code_verifier:t}),r=await fetch(m,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:n});if(!r.ok)throw new s(`xAI token exchange failed: ${r.status} ${await r.text()}`,o.TOKEN_EXCHANGE_FAILED);let i=await r.json();if(!i.access_token)throw new s(`xAI token exchange did not return access_token.`,o.TOKEN_EXCHANGE_INVALID);return i}async function O(e){try{let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:h}),n=await fetch(m,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t});return n.ok?await n.json():(console.error(`[xai-grok] refresh failed:`,n.status,await n.text()),null)}catch(e){return console.error(`[xai-grok] refresh error:`,e instanceof Error?e.message:String(e)),null}}function k(){return t().find(e=>e.providerId===d)}async function A(){let t=k();if(!t?.accessToken)throw new s("Not signed in to xAI Grok — run /login or `oauth-token xai-grok`",o.AUTH_MISSING,!0);let n=t.tokenExpiresAt??0;if(n&&Date.now()+6e4<n)return t.accessToken;if(t.refreshToken){let n=await O(t.refreshToken);if(n?.access_token)return await e({providerId:d,accessToken:n.access_token,refreshToken:n.refresh_token??t.refreshToken,tokenExpiresAt:Date.now()+(n.expires_in??21600)*1e3}),n.access_token}return t.accessToken}function j(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:y,provider:d,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}function M(e,t){return n=>!n||typeof n!=`object`?n:u(n,e,t)}function N(e,t){return t?{...e??{},"x-grok-conv-id":t}:e}const P=(e,t,r={})=>{let i=n();return(async()=>{try{let n=await A(),o=r.sessionId,s=a({...e,baseUrl:_,api:v},t,{...r,apiKey:n,headers:N(r.headers,o),onPayload:M(e.id,o)});for await(let e of s)i.push(e);i.end()}catch(t){console.error(`[xai-grok] Stream error:`,t instanceof Error?t.message:String(t)),i.push(j(e,t)),i.end()}})(),i},F=(e,t,r)=>{let a=n();return(async()=>{try{let n=await A(),o=r?.sessionId,s=i({...e,baseUrl:_,api:v},t,{...r,apiKey:n,headers:N(r?.headers,o),onPayload:M(e.id,o)});for await(let e of s)a.push(e);a.end()}catch(t){console.error(`[xai-grok] Stream error:`,t instanceof Error?t.message:String(t)),a.push(j(e,t)),a.end()}})(),a},I={id:d,name:`xAI Grok (SuperGrok OAuth)`,description:`Grok via xAI OAuth — uses your SuperGrok subscription, no API key needed. Default model is Grok Heavy.`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:`grok-4.20-multi-agent-0309`,oauthTokenDomains:[`api.x.ai`,`*.x.ai`,`auth.x.ai`,`accounts.x.ai`],getModelIds:()=>x.map(e=>{let t=l(e);return e.thinkingLevelMap?{...t,thinkingLevelMap:e.thinkingLevelMap}:t}),onOAuthLoginIntercepted:async(t,n,r)=>{let i=w(),a=await T(i),c=E(),l=E(),u=new URL(p);u.searchParams.set(`response_type`,`code`),u.searchParams.set(`client_id`,h),u.searchParams.set(`redirect_uri`,g),u.searchParams.set(`scope`,r?.scopes??`openid profile email offline_access grok-cli:access api:access`),u.searchParams.set(`code_challenge`,a),u.searchParams.set(`code_challenge_method`,`S256`),u.searchParams.set(`state`,c),u.searchParams.set(`nonce`,l),u.searchParams.set(`plan`,`generic`),u.searchParams.set(`referrer`,`slicc`);let f=await t({authorizeUrl:u.toString(),redirectUriPattern:`http://127.0.0.1:56121/*`,onCapture:`close`});if(!f)throw new s(`xAI OAuth login was cancelled or timed out`,o.CALLBACK_TIMEOUT);let m=new URL(f),v=m.searchParams.get(`code`),y=m.searchParams.get(`state`);if(!v)throw new s(`xAI OAuth redirect did not include a code`,o.CODE_MISSING);if(y!==c)throw new s(`xAI OAuth state mismatch — possible CSRF, aborting`,o.STATE_MISMATCH);let b=await D(v,i);await e({providerId:d,accessToken:b.access_token,refreshToken:b.refresh_token,tokenExpiresAt:Date.now()+(b.expires_in??21600)*1e3,baseUrl:_}),n()},onOAuthLogout:async()=>{await e({providerId:d,accessToken:``})},onSilentRenew:async()=>{let t=k();if(!t?.refreshToken)return null;let n=await O(t.refreshToken);return n?.access_token?(await e({providerId:d,accessToken:n.access_token,refreshToken:n.refresh_token??t.refreshToken,tokenExpiresAt:Date.now()+(n.expires_in??21600)*1e3}),n.access_token):null}};function L(){r({api:y,stream:P,streamSimple:F})}export{o as XaiErrorCode,s as XaiOAuthError,I as config,L as register};
1
+ import{O as e,i as t}from"./account-store-O8B4A1Cp.js";import{p as n}from"./transform-messages-CVIV-EgO.js";import{p as r}from"./bedrock-camp-CvxD6hHk.js";import{c as i,i as a}from"./legacy-api-aliases-DWJHPSiz.js";import"./provider-settings-DXZqWMxH.js";import{XaiErrorCode as o,XaiOAuthError as s}from"./xai-grok-errors-ByEMMSoz.js";import{resolveModels as c,toModelMetadata as l}from"./xai-grok-models-B0Tf--xf.js";import{sanitizePayload as u}from"./xai-grok-sanitize-CV6qvaEF.js";const d=`xai-grok`,f=`https://auth.x.ai`,p=`${f}/oauth2/authorize`,m=`${f}/oauth2/token`,h=`b1a00492-073a-47ea-816f-4c329264a828`,g=`http://127.0.0.1:56121/callback`,_=`https://api.x.ai/v1`,v=`openai-responses`,y=`${d}-openai`;function b(){return typeof process>`u`?null:{}.PI_XAI_OAUTH_MODELS??null}const x=c(b());function S(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function C(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}function w(){return S(C(32))}async function T(e){let t=new TextEncoder().encode(e);return S(new Uint8Array(await crypto.subtle.digest(`SHA-256`,t)))}function E(){return S(C(16))}async function D(e,t){let n=new URLSearchParams({grant_type:`authorization_code`,code:e,redirect_uri:g,client_id:h,code_verifier:t}),r=await fetch(m,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:n});if(!r.ok)throw new s(`xAI token exchange failed: ${r.status} ${await r.text()}`,o.TOKEN_EXCHANGE_FAILED);let i=await r.json();if(!i.access_token)throw new s(`xAI token exchange did not return access_token.`,o.TOKEN_EXCHANGE_INVALID);return i}async function O(e){try{let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:h}),n=await fetch(m,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t});return n.ok?await n.json():(console.error(`[xai-grok] refresh failed:`,n.status,await n.text()),null)}catch(e){return console.error(`[xai-grok] refresh error:`,e instanceof Error?e.message:String(e)),null}}function k(){return t().find(e=>e.providerId===d)}async function A(){let t=k();if(!t?.accessToken)throw new s("Not signed in to xAI Grok — run /login or `oauth-token xai-grok`",o.AUTH_MISSING,!0);let n=t.tokenExpiresAt??0;if(n&&Date.now()+6e4<n)return t.accessToken;if(t.refreshToken){let n=await O(t.refreshToken);if(n?.access_token)return await e({providerId:d,accessToken:n.access_token,refreshToken:n.refresh_token??t.refreshToken,tokenExpiresAt:Date.now()+(n.expires_in??21600)*1e3}),n.access_token}return t.accessToken}function j(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:y,provider:d,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}function M(e,t){return n=>!n||typeof n!=`object`?n:u(n,e,t)}function N(e,t){return t?{...e??{},"x-grok-conv-id":t}:e}const P=(e,t,r={})=>{let i=n();return(async()=>{try{let n=await A(),o=r.sessionId,s=a({...e,baseUrl:_,api:v},t,{...r,apiKey:n,headers:N(r.headers,o),onPayload:M(e.id,o)});for await(let e of s)i.push(e);i.end()}catch(t){console.error(`[xai-grok] Stream error:`,t instanceof Error?t.message:String(t)),i.push(j(e,t)),i.end()}})(),i},F=(e,t,r)=>{let a=n();return(async()=>{try{let n=await A(),o=r?.sessionId,s=i({...e,baseUrl:_,api:v},t,{...r,apiKey:n,headers:N(r?.headers,o),onPayload:M(e.id,o)});for await(let e of s)a.push(e);a.end()}catch(t){console.error(`[xai-grok] Stream error:`,t instanceof Error?t.message:String(t)),a.push(j(e,t)),a.end()}})(),a},I={id:d,name:`xAI Grok (SuperGrok OAuth)`,description:`Grok via xAI OAuth — uses your SuperGrok subscription, no API key needed. Default model is Grok Heavy.`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:`grok-4.20-multi-agent-0309`,oauthTokenDomains:[`api.x.ai`,`*.x.ai`,`auth.x.ai`,`accounts.x.ai`],getModelIds:()=>x.map(e=>{let t=l(e);return e.thinkingLevelMap?{...t,thinkingLevelMap:e.thinkingLevelMap}:t}),onOAuthLoginIntercepted:async(t,n,r)=>{let i=w(),a=await T(i),c=E(),l=E(),u=new URL(p);u.searchParams.set(`response_type`,`code`),u.searchParams.set(`client_id`,h),u.searchParams.set(`redirect_uri`,g),u.searchParams.set(`scope`,r?.scopes??`openid profile email offline_access grok-cli:access api:access`),u.searchParams.set(`code_challenge`,a),u.searchParams.set(`code_challenge_method`,`S256`),u.searchParams.set(`state`,c),u.searchParams.set(`nonce`,l),u.searchParams.set(`plan`,`generic`),u.searchParams.set(`referrer`,`slicc`);let f=await t({authorizeUrl:u.toString(),redirectUriPattern:`http://127.0.0.1:56121/*`,onCapture:`close`});if(!f)throw new s(`xAI OAuth login was cancelled or timed out`,o.CALLBACK_TIMEOUT);let m=new URL(f),v=m.searchParams.get(`code`),y=m.searchParams.get(`state`);if(!v)throw new s(`xAI OAuth redirect did not include a code`,o.CODE_MISSING);if(y!==c)throw new s(`xAI OAuth state mismatch — possible CSRF, aborting`,o.STATE_MISMATCH);let b=await D(v,i);await e({providerId:d,accessToken:b.access_token,refreshToken:b.refresh_token,tokenExpiresAt:Date.now()+(b.expires_in??21600)*1e3,baseUrl:_}),n()},onOAuthLogout:async()=>{await e({providerId:d,accessToken:``})},onSilentRenew:async()=>{let t=k();if(!t?.refreshToken)return null;let n=await O(t.refreshToken);return n?.access_token?(await e({providerId:d,accessToken:n.access_token,refreshToken:n.refresh_token??t.refreshToken,tokenExpiresAt:Date.now()+(n.expires_in??21600)*1e3}),n.access_token):null}};function L(){r({api:y,stream:P,streamSimple:F})}export{o as XaiErrorCode,s as XaiOAuthError,I as config,L as register};
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>slicc</title>
7
7
  <link rel="icon" type="image/png" href="/logos/sliccy-color-1scoops-32x32.png" />
8
- <script type="module" crossorigin src="/assets/main-vzVT7hjL.js"></script>
8
+ <script type="module" crossorigin src="/assets/main-BtekKitA.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-Dezn_h7o.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
@@ -24,21 +24,21 @@
24
24
  <link rel="modulepreload" crossorigin href="/assets/port-bridge-client-CdvMlimf.js">
25
25
  <link rel="modulepreload" crossorigin href="/assets/secrets-bridge-client-CONYX8PU.js">
26
26
  <link rel="modulepreload" crossorigin href="/assets/tool-ui-DfXu6quJ.js">
27
- <link rel="modulepreload" crossorigin href="/assets/providers-DhwIRhTh.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/providers-C5IxOdJy.js">
28
28
  <link rel="modulepreload" crossorigin href="/assets/panel-rpc-DmJSNs0I.js">
29
29
  <link rel="modulepreload" crossorigin href="/assets/transform-messages-fFaW-DLG.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/bedrock-camp-BEi8MYUS.js">
31
- <link rel="modulepreload" crossorigin href="/assets/account-store-B9-adorx.js">
31
+ <link rel="modulepreload" crossorigin href="/assets/account-store-0KfyaB_Y.js">
32
32
  <link rel="modulepreload" crossorigin href="/assets/electron-overlay-route-CjT6k9Df.js">
33
33
  <link rel="modulepreload" crossorigin href="/assets/bridge-launch-params-jegYRGJ6.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/messages-BD4p8GuF.js">
35
35
  <link rel="modulepreload" crossorigin href="/assets/tray-runtime-config-DJIIJaBR.js">
36
- <link rel="modulepreload" crossorigin href="/assets/setup-sudo-hbE3YS_h.js">
36
+ <link rel="modulepreload" crossorigin href="/assets/setup-sudo-CpuvPX2I.js">
37
37
  <link rel="modulepreload" crossorigin href="/assets/telemetry-C8rZr13D.js">
38
38
  <link rel="modulepreload" crossorigin href="/assets/tray-follower-status-CyJIKXH4.js">
39
39
  <link rel="modulepreload" crossorigin href="/assets/clipboard-DuHpK59o.js">
40
40
  <link rel="modulepreload" crossorigin href="/assets/tray-join-url-BIvzbiFR.js">
41
- <link rel="modulepreload" crossorigin href="/assets/provider-settings-B1ye5KnA.js">
41
+ <link rel="modulepreload" crossorigin href="/assets/provider-settings-CLFfVTte.js">
42
42
  </head>
43
43
  <body>
44
44
  <div id="app"></div>
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>slicc</title>
7
7
  <link rel="icon" type="image/png" href="/logos/sliccy-color-1scoops-32x32.png" />
8
- <script type="module" crossorigin src="/assets/main-vzVT7hjL.js"></script>
8
+ <script type="module" crossorigin src="/assets/main-BtekKitA.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-Dezn_h7o.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
@@ -24,21 +24,21 @@
24
24
  <link rel="modulepreload" crossorigin href="/assets/port-bridge-client-CdvMlimf.js">
25
25
  <link rel="modulepreload" crossorigin href="/assets/secrets-bridge-client-CONYX8PU.js">
26
26
  <link rel="modulepreload" crossorigin href="/assets/tool-ui-DfXu6quJ.js">
27
- <link rel="modulepreload" crossorigin href="/assets/providers-DhwIRhTh.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/providers-C5IxOdJy.js">
28
28
  <link rel="modulepreload" crossorigin href="/assets/panel-rpc-DmJSNs0I.js">
29
29
  <link rel="modulepreload" crossorigin href="/assets/transform-messages-fFaW-DLG.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/bedrock-camp-BEi8MYUS.js">
31
- <link rel="modulepreload" crossorigin href="/assets/account-store-B9-adorx.js">
31
+ <link rel="modulepreload" crossorigin href="/assets/account-store-0KfyaB_Y.js">
32
32
  <link rel="modulepreload" crossorigin href="/assets/electron-overlay-route-CjT6k9Df.js">
33
33
  <link rel="modulepreload" crossorigin href="/assets/bridge-launch-params-jegYRGJ6.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/messages-BD4p8GuF.js">
35
35
  <link rel="modulepreload" crossorigin href="/assets/tray-runtime-config-DJIIJaBR.js">
36
- <link rel="modulepreload" crossorigin href="/assets/setup-sudo-hbE3YS_h.js">
36
+ <link rel="modulepreload" crossorigin href="/assets/setup-sudo-CpuvPX2I.js">
37
37
  <link rel="modulepreload" crossorigin href="/assets/telemetry-C8rZr13D.js">
38
38
  <link rel="modulepreload" crossorigin href="/assets/tray-follower-status-CyJIKXH4.js">
39
39
  <link rel="modulepreload" crossorigin href="/assets/clipboard-DuHpK59o.js">
40
40
  <link rel="modulepreload" crossorigin href="/assets/tray-join-url-BIvzbiFR.js">
41
- <link rel="modulepreload" crossorigin href="/assets/provider-settings-B1ye5KnA.js">
41
+ <link rel="modulepreload" crossorigin href="/assets/provider-settings-CLFfVTte.js">
42
42
  </head>
43
43
  <body>
44
44
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliccy",
3
- "version": "5.63.4",
3
+ "version": "5.64.0",
4
4
  "description": "Browser-based coding agent with thin CLI server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -112,8 +112,8 @@
112
112
  "patch-package": "8.0.1",
113
113
  "playwright": "^1.58.2",
114
114
  "prettier": "3.9.5",
115
- "semantic-release": "25.0.6",
116
- "tsx": "4.23.0",
115
+ "semantic-release": "25.0.7",
116
+ "tsx": "4.23.1",
117
117
  "typescript": "^6.0.0",
118
118
  "vite": "8.1.4",
119
119
  "vitest": "4.1.10"
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-0FRaZO2z.js","assets/rolldown-runtime-aKtaBQYM.js","assets/dist-Bj10RLrf.js","assets/mount-CB9LbKIo.js","assets/preload-helper-Czpn1I53.js","assets/mime-types-ugOWOUZ9.js","assets/base64-DpPqYZJF.js","assets/src-CS5gSDhT.js","assets/proxied-fetch-DETjVL-j.js","assets/runtime-env-DH4NDw4t.js","assets/fetch-body-D2PwksUW.js","assets/types-idfTVsM8.js","assets/backend-local-smcj-_Ox.js","assets/tool-ui-DfXu6quJ.js","assets/logger-DDBAeTLF.js","assets/picker-approval-CdWaB1mR.js","assets/mount-picker-popup-Bs1o43Z5.js","assets/picker-popup-BvzmBsGL.js","assets/mount-table-store-CfQUN_2R.js","assets/mount-bridge-client-BVLVI9yX.js","assets/port-bridge-client-CdvMlimf.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./logger-DDBAeTLF.js";import{t as n}from"./types-idfTVsM8.js";import{t as r}from"./backend-local-smcj-_Ox.js";import{a as i,i as a,n as o,t as s}from"./mount-table-store-CfQUN_2R.js";var c=t(`fs-watcher`),l=0;function u(e,t){return t===`/`||e===t||e.startsWith(t+`/`)}var d=class{registrations=new Map;watch(e,t,n){let r=`fsw-${++l}`;return this.registrations.set(r,{id:r,basePath:e,filter:t,callback:n}),c.debug(`Watch registered`,{id:r,basePath:e}),()=>{this.registrations.delete(r),c.debug(`Watch unregistered`,{id:r})}}notify(e){if(e.length!==0)for(let[,t]of this.registrations){let n=e.filter(e=>u(e.path,t.basePath)&&t.filter(e.path));if(n.length>0)try{t.callback(n)}catch(e){c.error(`Watch callback error`,{id:t.id,error:e instanceof Error?e.message:String(e)})}}}dispose(){this.registrations.clear(),c.debug(`All watchers disposed`)}get size(){return this.registrations.size}},f=t(`mount-index`),p=400,m=2e6,h=`SLICC_MOUNT_INDEX_MAX_DEPTH`,g=`SLICC_MOUNT_INDEX_MAX_ENTRIES`,_=256,v=class extends Error{cause;constructor(e,t){super(e),this.name=`MountIndexAbortError`,this.cause=t}};function y(e){let t=e.map(([e,t])=>`${e}\u0000${t.kind}`).sort(),n=t.length>_?t.slice(0,_):t;return`${t.length}\u0001${n.join(``)}`}async function b(e,t){let n=e.isSameEntry;if(typeof n!=`function`)return!1;try{return await n.call(e,t)}catch{return!1}}function x(e,t){return e instanceof Map?e.get(t):e[t]}function S(e){let t=e.trim();if(t===``)return;let n=Number(t);if(!(!Number.isInteger(n)||n<=0))return n}function C(e,t,n){let r=x(e,t);if(r===void 0||r.trim()===``)return n;let i=S(r);return i===void 0?(f.warn(`Ignoring invalid ${t}; expected a positive integer, using default`,{value:r,fallback:n}),n):i}function w(e){return{maxDepth:C(e,h,p),maxEntries:C(e,g,m)}}var T=class{mounts=new Map;listeners=new Set;registerMount(e,t,n=w({})){this.mounts.get(e)?.abortController?.abort();let r=new AbortController,i={handle:t,state:{status:`pending`,indexed:0},files:new Set,directories:new Set,abortController:r,limits:n};this.mounts.set(e,i),this.notifyListeners(),this.indexMount(e,i,r.signal)}unregisterMount(e){let t=this.mounts.get(e);t&&(t.abortController?.abort(),this.mounts.delete(e),this.notifyListeners())}async refreshMount(e,t){let n=this.mounts.get(e);if(!n)throw Error(`No mount at ${e}`);n.abortController?.abort();let r=new AbortController;n.abortController=r,n.state={status:`pending`,indexed:0},n.files.clear(),n.directories.clear(),t&&(n.limits=t),this.notifyListeners(),await this.indexMount(e,n,r.signal)}isReady(e){return this.mounts.get(e)?.state.status===`ready`}isAnyIndexing(){for(let e of this.mounts.values())if(e.state.status===`indexing`||e.state.status===`pending`)return!0;return!1}dispose(){for(let e of this.mounts.values())e.abortController?.abort();this.mounts.clear(),this.listeners.clear()}getState(e){return this.mounts.get(e)?.state}getFiles(e,t){let n=this.mounts.get(e);if(n?.state.status!==`ready`)return;if(!t)return[...n.files];let r=[];for(let e of n.files)t(e)&&r.push(e);return r}getDirectoryEntries(e,t){let n=this.mounts.get(e);if(n?.state.status!==`ready`)return;let r=t===`/`?`/`:t+`/`,i=new Map;for(let e of n.files){if(!e.startsWith(r))continue;let t=e.slice(r.length);t.includes(`/`)||i.set(t,`file`)}for(let e of n.directories){if(!e.startsWith(r))continue;let t=e.slice(r.length);t.includes(`/`)||i.set(t,`directory`)}return[...i.entries()].map(([e,t])=>({name:e,type:t}))}hasPath(e,t){let n=this.mounts.get(e);if(n?.state.status===`ready`)return n.files.has(t)||n.directories.has(t)}notifyWrite(e){let t=this.findMountForPath(e);if(!t)return;let n=this.mounts.get(t);if(n?.state.status!==`ready`)return;n.files.add(e);let r=e;for(;r!==t;){let e=r.lastIndexOf(`/`);if(e<=0)break;r=r.slice(0,e)||`/`,r.length>=t.length&&n.directories.add(r)}}notifyDelete(e){let t=this.findMountForPath(e);if(!t)return;let n=this.mounts.get(t);if(n?.state.status!==`ready`)return;n.files.delete(e),n.directories.delete(e);let r=e+`/`;for(let e of n.files)e.startsWith(r)&&n.files.delete(e);for(let e of n.directories)e.startsWith(r)&&n.directories.delete(e)}notifyRename(e,t){let n=this.findMountForPath(e);if(!n)return;let r=this.mounts.get(n);if(r?.state.status===`ready`){if(r.files.has(e)){r.files.delete(e),r.files.add(t);return}if(r.directories.has(e)){r.directories.delete(e),r.directories.add(t);let n=e+`/`,i=t+`/`;for(let e of[...r.files])e.startsWith(n)&&(r.files.delete(e),r.files.add(i+e.slice(n.length)));for(let e of[...r.directories])e.startsWith(n)&&(r.directories.delete(e),r.directories.add(i+e.slice(n.length)))}}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}findMountForPath(e){let t;for(let n of this.mounts.keys())(e===n||e.startsWith(n+`/`))&&(!t||n.length>t.length)&&(t=n);return t}notifyListeners(){for(let e of this.listeners)try{e()}catch{}}async indexMount(e,t,n){t.state={status:`indexing`,indexed:0},this.notifyListeners();try{if(await this.walkHandle(e,t.handle,t,n),n.aborted)return;t.state={status:`ready`,indexed:t.files.size+t.directories.size,total:t.files.size+t.directories.size},t.abortController=null,f.info(`Mount indexed`,{path:e,files:t.files.size,directories:t.directories.size})}catch(r){if(n.aborted)return;let i=r instanceof Error?r.message:String(r),a=r instanceof v?r.cause:`indexing-error`;t.state={status:`error`,indexed:0,error:i,abortCause:a},f.error(`Mount indexing failed`,{path:e,error:i,abortCause:a})}this.notifyListeners()}async walkHandle(e,t,n,r,i=0,a=new Map){if(r.aborted)return;this.enforceWalkBounds(i,n),n.directories.add(e);let o=await this.readChildren(t,r,n);if(r.aborted)return;let s=await this.confirmNoCycle(e,t,o,a),c=this.pushAncestor(a,s,e,t);try{await this.walkChildren(e,o,n,r,i,a)}finally{this.popAncestor(a,s,c)}}enforceWalkBounds(e,t){if(e>t.limits.maxDepth)throw new v(`mount indexing aborted: directory nesting exceeded ${t.limits.maxDepth} levels`,`depth-exceeded`);if(t.directories.size+t.files.size>=t.limits.maxEntries)throw new v(`mount indexing aborted: exceeded ${t.limits.maxEntries} entries`,`entries-exceeded`)}async readChildren(e,t,n){let r=e,i=[];for await(let e of r){if(t.aborted)break;if(n.directories.size+n.files.size+i.length>=n.limits.maxEntries)throw new v(`mount indexing aborted: exceeded ${n.limits.maxEntries} entries`,`entries-exceeded`);i.push(e)}return i}async confirmNoCycle(e,t,n,r){let i=y(n),a=r.get(i);if(a){for(let n of a)if(await b(n.handle,t))throw new v(`mount indexing aborted: self-referential mount cycle detected at ${e} (re-exposes ${n.path})`,`cycle-detected`)}return i}pushAncestor(e,t,n,r){let i=e.get(t);return i||(i=[],e.set(t,i)),i.push({path:n,handle:r,signature:t}),i}popAncestor(e,t,n){n.pop(),n.length===0&&e.delete(t)}async walkChildren(e,t,n,r,i,a){for(let[o,s]of t){if(r.aborted)return;let t=e===`/`?`/${o}`:`${e}/${o}`;s.kind===`file`?(n.files.add(t),n.state.indexed++):s.kind===`directory`&&await this.walkHandle(t,s,n,r,i+1,a),n.state.indexed%500==0&&(this.notifyListeners(),await new Promise(e=>setTimeout(e,0)))}}};function E(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 D(e){let t=E(e);if(t===`/`)return{dir:`/`,base:``};let n=t.lastIndexOf(`/`);return{dir:n===0?`/`:t.slice(0,n),base:t.slice(n+1)}}function O(e){let t=E(e);return t===`/`?[]:t.slice(1).split(`/`)}function k(...e){return E(e.join(`/`))}var A={"/dev/null":{stat:()=>({type:`file`,size:0,mtime:0,ctime:0}),read:e=>(e?.encoding??`utf-8`)===`utf-8`?``:new Uint8Array,readText:()=>``,write:()=>{}}},j=class{vfs;allowedPrefixes;readOnlyPrefixes;writeEnforcement;constructor(e,t,n=[],r=`hard`){this.vfs=e;let i=e=>{let t=E(e);return t.endsWith(`/`)?t:t+`/`};this.allowedPrefixes=t.map(i),this.readOnlyPrefixes=n.map(i),this.writeEnforcement=r}getAllPrefixes(){let e=this.vfs.listMounts().map(e=>e.endsWith(`/`)?e:e+`/`);return[...this.allowedPrefixes,...this.readOnlyPrefixes,...e]}isAllowed(e){let t=E(e);return this.getAllPrefixes().some(e=>t===e.slice(0,-1)||t.startsWith(e)||t===`/`||e.startsWith(t+`/`))}isAllowedStrict(e){let t=E(e);return this.getAllPrefixes().some(e=>t===e.slice(0,-1)||t.startsWith(e))}isWritable(e){let t=E(e);return this.allowedPrefixes.some(e=>t===e.slice(0,-1)||t.startsWith(e))}canWrite(e){return this.isWritable(e)}checkWrite(e){if(this.writeEnforcement!==`sudo-delegated`&&!this.isWritable(e))throw new n(`EACCES`,`permission denied`,E(e))}async resolveAndCheckRead(e){try{let t=await this.vfs.realpath(e);if(!this.isAllowedStrict(t))throw new n(`ENOENT`,`no such file or directory`,E(e));return t}catch(t){throw t instanceof n?t:new n(`ENOENT`,`no such file or directory`,E(e))}}async resolveAndCheckWrite(e){try{let t=await this.vfs.realpath(e);if(!this.isWritable(t)&&!this.isSymlinkEscapeAllowed(t))throw new n(`EACCES`,`permission denied`,E(e));return t}catch(t){throw t instanceof n?t:new n(`EACCES`,`permission denied`,E(e))}}isSymlinkEscapeAllowed(e){return!1}async checkParentRealpathEscape(e){let t=this.vfs.dirname(e),r=this.vfs.basename(e),i;try{i=await this.vfs.realpath(t)}catch(e){if(e instanceof n&&e.code===`EACCES`)throw e;return}let a=i+`/`+r;if(this.isWritable(a))return;let o=E(i)!==E(t);if(!(this.writeEnforcement===`sudo-delegated`&&!o))throw new n(`EACCES`,`permission denied`,E(e))}getUnderlyingFS(){return this.vfs}invalidatePaths(e){this.vfs.invalidatePaths(e)}isPathUnderMount(e){return this.vfs.isPathUnderMount(e)}async readFile(e,t){let r=A[E(e)];if(r)return r.read(t);if(!this.isAllowedStrict(e))throw new n(`ENOENT`,`no such file or directory`,E(e));let i=await this.resolveAndCheckRead(e);return this.vfs.readFile(i,t)}async readDir(e){if(!this.isAllowed(e))return[];let t=e;if(this.isAllowedStrict(e))try{t=await this.resolveAndCheckRead(e)}catch{return[]}let n=await this.vfs.readDir(t);if(!this.isAllowedStrict(e)){let t=E(e);return n.filter(e=>{let n=t===`/`?`/${e.name}`:`${t}/${e.name}`;return this.isAllowed(n)})}return n}async stat(e){let t=A[E(e)];if(t)return t.stat();if(!this.isAllowed(e))throw new n(`ENOENT`,`no such file or directory`,E(e));if(this.isAllowedStrict(e)){let t=await this.resolveAndCheckRead(e);return this.vfs.stat(t)}return this.vfs.stat(e)}scanPathForSymlinks(e,t){let n=E(e);if(n===`/`)return!1;let r=n.slice(1).split(`/`),i=t?r.length:r.length-1,a=``;for(let e=0;e<i;e++){a=a+`/`+r[e];let t=this.vfs.lstatSync(a);if(t===null)return null;if(t.type===`symlink`)return!0}return!1}statSync(e){let t=A[E(e)];return t?t.stat():!this.isAllowedStrict(e)||this.scanPathForSymlinks(e,!0)!==!1?null:this.vfs.statSync(e)}lstatSync(e){let t=A[E(e)];return t?t.stat():!this.isAllowed(e)||this.scanPathForSymlinks(e,!1)!==!1?null:this.vfs.lstatSync(e)}readDirSync(e){if(!this.isAllowed(e)||this.scanPathForSymlinks(e,!0)!==!1)return null;let t=this.vfs.readDirSync(e);if(t===null)return null;if(this.isAllowedStrict(e))return t;let n=E(e);return t.filter(e=>{let t=n===`/`?`/${e.name}`:`${n}/${e.name}`;return this.isAllowed(t)})}async realpath(e){let t;try{t=await this.vfs.realpath(e)}catch(t){throw t instanceof n?t:new n(`ENOENT`,`no such file or directory`,E(e))}if(!this.isAllowedStrict(t))throw new n(`ENOENT`,`no such file or directory`,E(e));return t}async exists(e){if(A[E(e)])return!0;if(!this.isAllowed(e))return!1;if(this.isAllowedStrict(e))try{await this.resolveAndCheckRead(e)}catch{return!1}return this.vfs.exists(e)}async readTextFile(e){let t=A[E(e)];if(t)return t.readText();if(!this.isAllowedStrict(e))throw new n(`ENOENT`,`no such file or directory`,E(e));let r=await this.resolveAndCheckRead(e);return this.vfs.readTextFile(r)}async*walk(e){if(!this.isAllowed(e))return;let t=e;if(this.isAllowedStrict(e))try{t=await this.resolveAndCheckRead(e)}catch{return}for await(let e of this.vfs.walk(t))this.isAllowed(e)&&(yield e)}async writeFile(e,t,r){let i=A[E(e)];if(i){i.write(t);return}this.checkWrite(e),await this.checkParentRealpathEscape(e);try{(await this.vfs.lstat(e)).type===`symlink`&&await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof n&&e.code===`EACCES`)throw e}return this.vfs.writeFile(e,t,r)}async mkdir(e,t){return this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.mkdir(e,t)}async rm(e,t){this.checkWrite(e);try{(await this.vfs.lstat(e)).type===`symlink`||await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof n&&e.code===`EACCES`)throw e}return this.vfs.rm(e,t)}async rename(e,t){return this.checkWrite(e),this.checkWrite(t),await this.resolveAndCheckWrite(e),await this.checkParentRealpathEscape(t),this.vfs.rename(e,t)}async copyFile(e,t){if(!this.isAllowed(e))throw new n(`ENOENT`,`no such file or directory`,E(e));this.checkWrite(t);let r=await this.resolveAndCheckRead(e);await this.checkParentRealpathEscape(t);try{(await this.vfs.lstat(t)).type===`symlink`&&await this.resolveAndCheckWrite(t)}catch(e){if(e instanceof n&&e.code===`EACCES`)throw e}return this.vfs.copyFile(r,t)}async symlink(e,t){return this.checkWrite(t),await this.checkParentRealpathEscape(t),this.vfs.symlink(e,t)}async readlink(e){if(!this.isAllowedStrict(e))throw new n(`ENOENT`,`no such file or directory`,E(e));let t=await this.vfs.readlink(e),r;if(r=t.startsWith(`/`)?E(t):E(this.vfs.dirname(e)+`/`+t),!this.isAllowedStrict(r))throw new n(`ENOENT`,`no such file or directory`,E(e));return t}async lstat(e){let t=A[E(e)];if(t)return t.stat();if(!this.isAllowed(e))throw new n(`ENOENT`,`no such file or directory`,E(e));let r=E(e),i=this.vfs.dirname(r),a=this.vfs.basename(r),o;if(i===r)o=i;else try{o=await this.vfs.realpath(i)}catch{throw new n(`ENOENT`,`no such file or directory`,r)}let s=o===`/`?`/${a}`:`${o}/${a}`;if(!this.isAllowed(s))throw new n(`ENOENT`,`no such file or directory`,r);return this.vfs.lstat(s)}watch(e,t,r){if(!this.isAllowed(e))throw new n(`EACCES`,`permission denied`,E(e));let i=this.vfs.getWatcher();if(!i)throw new n(`EINVAL`,`no watcher configured`);return i.watch(E(e),t,r)}dirname(e){return this.vfs.dirname(e)}basename(e){return this.vfs.basename(e)}async mount(e,t,n){return this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.mount(e,t,n)}async unmount(e){return this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.unmount(e)}listMounts(){return this.vfs.listMounts()}getMountIndex(){return this.vfs.getMountIndex()}async refreshMount(e,t){return this.checkWrite(e),this.vfs.refreshMount(e,t)}async dispose(){await this.vfs.dispose()}},M=10,N=64,P=1e5;function F(){try{if(typeof globalThis.navigator?.storage?.getDirectory==`function`)return`opfs`}catch{}return`memory`}var I=class t{lfs;lfsSync;rawLfs=null;rawLfsSync=null;_ready;_readyResolved=!1;backend;mountPoints=new Map;opfsBackendFs=null;opfsHandle=null;mountRoot=``;internalMounts=new Set;watcher=null;dbName;mountSyncChannel=null;mountIndex=new T;_writeLock=Promise.resolve();constructor(e,n,r,i){if(this.dbName=e,this.backend=r===`opfs`?`opfs`:`memory`,this.lfs=this.makeDeferredLfs(),this.lfsSync=this.makeDeferredLfsSync(),this._ready=this.backend===`opfs`?t.initOpfsBackend(this,i,n===!0):t.initMemoryBackend(this,e,n===!0),this._ready.then(()=>{this._readyResolved=!0},()=>{}),typeof BroadcastChannel<`u`)try{this.mountSyncChannel=new BroadcastChannel(`vfs-mount-sync:${e}`),this.mountSyncChannel.onmessage=e=>{let{type:t,path:n,descriptor:r}=e.data??{};if(t===`mount`&&typeof n==`string`&&r)this.reconstructBackendFromDescriptor(r).then(e=>{this.mountPoints.set(n,e),e.kind===`local`&&this.mountIndex.registerMount(n,e.getHandle()),this.watcher?.notify([{type:`modify`,path:n,entryType:`directory`}])}).catch(()=>{});else if(t===`unmount`&&typeof n==`string`){let e=this.mountPoints.get(n);this.mountPoints.delete(n),this.mountIndex.unregisterMount(n),e?.close(),this.watcher?.notify([{type:`modify`,path:n,entryType:`directory`}])}}}catch{}}static async initOpfsBackend(n,r,i){let a=r??await t.acquireOpfsHandle(n.dbName,i);await t.seedOpfsMetadataSidecarIfMissing(a);let[o,{WebAccess:s}]=await Promise.all([e(()=>import(`./dist-0FRaZO2z.js`).then(e=>e.t),__vite__mapDeps([0,1])),e(()=>import(`./dist-Bj10RLrf.js`),__vite__mapDeps([2,0,1]))]);await t.ensureRootMount(o);let c=`/__opfs__/${n.dbName}`,l=t.opfsBackends.get(n.dbName);if(l&&i){try{o.umount(c)}catch{}t.opfsBackends.delete(n.dbName),l=void 0}if(!l){let e=await o.resolveMountConfig({backend:s,handle:a,metadata:`/.metadata.json`});try{o.mount(c,e)}catch{}l={backendFs:e,refs:0},t.opfsBackends.set(n.dbName,l)}l.refs+=1,n.opfsBackendFs=l.backendFs.index?l.backendFs:null,n.opfsHandle=a,n.mountRoot=c,n.rawLfs=o.promises,n.rawLfsSync=o}static async initMemoryBackend(n,r,i){let a=await e(()=>import(`./dist-0FRaZO2z.js`).then(e=>e.t),__vite__mapDeps([0,1]));await t.ensureRootMount(a);let o=`/__zenfs__/${r}`,s=t.memoryBackends.get(r);if(s&&i){try{a.umount(o)}catch{}t.memoryBackends.delete(r),s=void 0}s||(s={store:a.InMemory.create({label:r}),refs:0},t.memoryBackends.set(r,s)),s.refs+=1;try{a.mount(o,s.store)}catch{}n.mountRoot=o,n.rawLfs=a.promises,n.rawLfsSync=a,n.opfsBackendFs=null,n.opfsHandle=null}static rootMountReady=null;static memoryBackends=new Map;static opfsBackends=new Map;static async ensureRootMount(e){return t.rootMountReady||=(async()=>{await e.configureSingle({backend:e.InMemory,label:`__vfs_root__`})})(),t.rootMountReady}prefix(e){return this.mountRoot?e===`/`?this.mountRoot:this.mountRoot+e:e}unprefix(e){return!this.mountRoot||!e.startsWith(this.mountRoot)?e:e.slice(this.mountRoot.length)||`/`}makeDeferredLfs(){let e=e=>this.prefix(e),t=e=>this.unprefix(e),n=()=>{if(!this.rawLfs)throw Error(`VirtualFS used before init resolved`);return this.rawLfs};return{readFile:(t,r)=>this._readyResolved?n().readFile(e(t),r):this._ready.then(()=>n().readFile(e(t),r)),writeFile:(t,r,i)=>this._readyResolved?n().writeFile(e(t),r,i):this._ready.then(()=>n().writeFile(e(t),r,i)),readdir:t=>this._readyResolved?n().readdir(e(t)):this._ready.then(()=>n().readdir(e(t))),mkdir:(t,r)=>this._readyResolved?n().mkdir(e(t),r):this._ready.then(()=>n().mkdir(e(t),r)),rmdir:t=>this._readyResolved?n().rmdir(e(t)):this._ready.then(()=>n().rmdir(e(t))),unlink:t=>this._readyResolved?n().unlink(e(t)):this._ready.then(()=>n().unlink(e(t))),rename:(t,r)=>this._readyResolved?n().rename(e(t),e(r)):this._ready.then(()=>n().rename(e(t),e(r))),stat:t=>this._readyResolved?n().stat(e(t)):this._ready.then(()=>n().stat(e(t))),lstat:t=>this._readyResolved?n().lstat(e(t)):this._ready.then(()=>n().lstat(e(t))),symlink:(t,r)=>{let i=t.startsWith(`/`)?e(t):t;return this._readyResolved?n().symlink(i,e(r)):this._ready.then(()=>n().symlink(i,e(r)))},readlink:async r=>(this._readyResolved||await this._ready,t(await n().readlink(e(r)))),truncate:async(t,r)=>{this._readyResolved||await this._ready;let i=n();typeof i.truncate==`function`&&await i.truncate(e(t),r)},realpath:async r=>{this._readyResolved||await this._ready;let i=n();return typeof i.realpath==`function`?t(await i.realpath(e(r))):e(r)}}}makeDeferredLfsSync(){let e=e=>this.prefix(e),t=e=>this.unprefix(e);return{readdirSync:t=>{let n=this.rawLfsSync;return n?.readdirSync?n.readdirSync(e(t)):void 0},statSync:t=>{let n=this.rawLfsSync;return n?.statSync?n.statSync(e(t)):void 0},lstatSync:t=>{let n=this.rawLfsSync;return n?.lstatSync?n.lstatSync(e(t)):void 0},readlinkSync:n=>{let r=this.rawLfsSync;return r?.readlinkSync?t(r.readlinkSync(e(n))):void 0}}}static async seedOpfsMetadataSidecarIfMissing(e){let t=`.metadata.json`;try{await e.getFileHandle(t);return}catch(e){if(e?.name!==`NotFoundError`)throw e}let n=await(await e.getFileHandle(t,{create:!0})).createWritable(),r=JSON.stringify({version:1,maxSize:4294967295,entries:{}});await n.write(r),await n.close()}static async acquireOpfsHandle(e,t){let r=navigator.storage;if(!r?.getDirectory)throw new n(`EINVAL`,`OPFS is not available in this environment`);let i=await r.getDirectory();if(t)try{await i.removeEntry(e,{recursive:!0})}catch{}return i.getDirectoryHandle(e,{create:!0})}static _createSyncForTests(e){return new t(e)}static async create(e){let n=e?.dbName??`browser-fs`,r=e?.wipe===!0,i=e?.backend??F(),a=new t(n,r,i);return await a._ready,r&&await s().catch(()=>{}),a}async flush(){await this.writeOpfsMetadataSidecar()}async writeOpfsMetadataSidecar(){if(this.backend!==`opfs`)return;let e=this.opfsBackendFs,t=this.opfsHandle;if(!e||!t)return;let n=JSON.stringify(e.index.toJSON()),r=await(await t.getFileHandle(`.metadata.json`,{create:!0})).createWritable();await r.write(n),await r.close()}invalidatePaths(e){if(this.backend!==`opfs`||!this.opfsBackendFs)return;let t=this.opfsBackendFs;for(let n of e){let e=E(n);t.index.delete(e),t._handles?.delete(e)}}canWrite(e){return!0}setWatcher(e){this.watcher=e}getWatcher(){return this.watcher}async dispose(){if(this.mountSyncChannel?.close(),this.mountSyncChannel=null,this.watcher?.dispose(),this.watcher=null,this.mountIndex.dispose(),await this.writeOpfsMetadataSidecar(),this.mountRoot){let n=this.backend===`opfs`?t.opfsBackends:t.memoryBackends,r=n.get(this.dbName);if(r&&(--r.refs,r.refs<=0)){n.delete(this.dbName);try{(await e(()=>import(`./dist-0FRaZO2z.js`).then(e=>e.t),__vite__mapDeps([0,1]))).umount(this.mountRoot)}catch{}}}}readDirSync(e){let t=E(e);if(this.findMount(t))return null;let n=this.lfsSync;if(typeof n.readdirSync!=`function`||typeof n.lstatSync!=`function`)return null;try{let e=n.readdirSync(t),r=[];for(let i of e){let e=t===`/`?`/${i}`:`${t}/${i}`;try{let t=n.lstatSync(e),a=t.isSymbolicLink()?`symlink`:t.isDirectory()?`directory`:`file`;r.push({name:i,type:a})}catch{}}return r}catch{return null}}statSync(e){let t=E(e);if(this.findMount(t))return null;let n=this.lfsSync;if(typeof n.statSync!=`function`||typeof n.lstatSync!=`function`||typeof n.readlinkSync!=`function`)return null;let r=t;for(let e=0;e<=M;e++){let e;try{e=n.lstatSync(r)}catch{return null}if(!e.isSymbolicLink())return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs};let t;try{t=n.readlinkSync(r)}catch{return null}r=t.startsWith(`/`)?E(t):E(k(D(r).dir,t))}return null}lstatSync(e){let t=E(e);if(this.findMount(t))return null;let n=this.lfsSync;if(typeof n.lstatSync!=`function`)return null;try{let e=n.lstatSync(t);if(e.isSymbolicLink()){let r=n.readlinkSync?n.readlinkSync(t):``;return{type:`symlink`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,isSymlink:!0,symlinkTarget:r}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch{return null}}async mount(e,t,r){let a=E(e);if(this.mountPoints.has(a))throw new n(`EEXIST`,`mount point is already mounted`,a);try{if((await this.lstat(a)).type!==`directory`)throw new n(`ENOTDIR`,`mount point must be a directory`,a);if((await this.readDir(a)).length>0)throw new n(`ENOTEMPTY`,`mount point must be empty to avoid shadowing existing files`,a)}catch(e){if(!(e instanceof n)||e.code!==`ENOENT`)throw e}let{dir:o}=D(a);o!==`/`&&await this.mkdir(o,{recursive:!0});try{await this.lfs.mkdir(a)}catch{}if(this.mountPoints.set(a,t),t.kind===`local`){let e=w(r?.env??{});this.mountIndex.registerMount(a,t.getHandle(),e)}let s=t.kind===`local`?{kind:`local`,mountId:t.mountId,idbHandleKey:a}:t.kind===`s3`?{kind:`s3`,mountId:t.mountId,source:t.source,profile:t.profile??`default`}:{kind:`da`,mountId:t.mountId,source:t.source,profile:t.profile??`default`};try{this.mountSyncChannel?.postMessage({type:`mount`,path:a,descriptor:s})}catch{}this.watcher?.notify([{type:`modify`,path:a,entryType:`directory`}]);try{await i({targetPath:a,descriptor:s,createdAt:Date.now()},t.kind===`local`?t.getHandle():void 0)}catch{}}async unmount(e){let t=E(e),n=this.mountPoints.get(t);this.mountPoints.delete(t),this.mountIndex.unregisterMount(t);try{this.mountSyncChannel?.postMessage({type:`unmount`,path:t})}catch{}this.watcher?.notify([{type:`modify`,path:t,entryType:`directory`}]),await n?.close();try{await a(t)}catch{}}async reconstructBackendFromDescriptor(t){switch(t.kind){case`local`:{let e=await o(t.idbHandleKey);if(!e)throw Error(`no handle stored for ${t.idbHandleKey}`);return r.fromHandle(e,{mountId:t.mountId})}case`s3`:{let{S3MountBackend:n,RemoteMountCache:r,makeSignedFetchS3:i}=await e(async()=>{let{S3MountBackend:e,RemoteMountCache:t,makeSignedFetchS3:n}=await import(`./mount-CB9LbKIo.js`);return{S3MountBackend:e,RemoteMountCache:t,makeSignedFetchS3:n}},__vite__mapDeps([3,4,5,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20])),a=new r({mountId:t.mountId,ttlMs:3e4});return new n({source:t.source,profile:t.profile,cache:a,mountId:t.mountId,signedFetch:i(t.profile)})}case`da`:{let{DaMountBackend:n,RemoteMountCache:r,makeSignedFetchDa:i}=await e(async()=>{let{DaMountBackend:e,RemoteMountCache:t,makeSignedFetchDa:n}=await import(`./mount-CB9LbKIo.js`);return{DaMountBackend:e,RemoteMountCache:t,makeSignedFetchDa:n}},__vite__mapDeps([3,4,5,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20])),a=new r({mountId:t.mountId,ttlMs:3e4});return new n({source:t.source,profile:t.profile,cache:a,mountId:t.mountId,signedFetch:i()})}}}listMounts(){let e=[];for(let t of this.mountPoints.keys())this.internalMounts.has(t)||e.push(t);return e}listInternalMounts(){return[...this.internalMounts]}listMountPoints(){let e=[];for(let[t,n]of this.mountPoints)this.internalMounts.has(t)||e.push({path:t,kind:n.kind});return e}async mountInternal(e,t){let r=E(e);if(this.mountPoints.has(r))throw new n(`EEXIST`,`mount point is already mounted`,r);let{dir:i}=D(r);i!==`/`&&await this.mkdir(i,{recursive:!0});try{await this.lfs.mkdir(r)}catch{}this.mountPoints.set(r,t),this.internalMounts.add(r),this.watcher?.notify([{type:`modify`,path:r,entryType:`directory`}])}async unmountInternal(e){let t=E(e);if(!this.internalMounts.has(t))throw new n(`ENOENT`,`not an internal mount point`,t);let r=this.mountPoints.get(t);this.mountPoints.delete(t),this.internalMounts.delete(t),this.watcher?.notify([{type:`modify`,path:t,entryType:`directory`}]),await r?.close()}getMountIndex(){return this.mountIndex}async refreshMount(e,t){let r=E(e),i=this.mountPoints.get(r);if(!i)throw new n(`ENOENT`,`not a mount point`,r);let a=await i.refresh(t);return i.kind===`local`&&await this.mountIndex.refreshMount(r,w(t?.env??{})),a}isPathUnderMount(e){for(let t of this.mountPoints.keys())if(e===t||e.startsWith(t+`/`))return!0;return!1}static rebrandFsError(e,t){if(e instanceof n){let r=`${e.code}: `,i=e.message;throw i.startsWith(r)&&(i=i.slice(r.length)),e.path&&i.endsWith(` '${e.path}'`)&&(i=i.slice(0,i.length-` '${e.path}'`.length)),new n(e.code,i,t)}throw e}findMount(e){let t=null;for(let[n,r]of this.mountPoints)(e===n||e.startsWith(n+`/`))&&(!t||n.length>t.mountPath.length)&&(t={mountPath:n,backend:r});return t?e===t.mountPath?{path:t.mountPath,backend:t.backend,relParts:[]}:{path:t.mountPath,backend:t.backend,relParts:e.slice(t.mountPath.length+1).split(`/`).filter(Boolean)}:null}async readFile(e,r){let i=E(e),a=this.findMount(i);if(a){if(a.relParts.length===0)throw new n(`EISDIR`,`is a directory`,i);let e=a.relParts.join(`/`);try{let t=await a.backend.readFile(e);return(r?.encoding??`utf-8`)===`utf-8`?new TextDecoder(`utf-8`).decode(t):t}catch(e){t.rebrandFsError(e,i)}}let o=await this.resolveSymlinks(i);try{return(r?.encoding??`utf-8`)===`utf-8`?await this.lfs.readFile(o,{encoding:`utf8`}):await this.lfs.readFile(o)}catch(e){throw this.convertError(e,i)}}async writeFile(e,r,i){let a=E(e),o=this.findMount(a);if(o){if(o.relParts.length===0)throw new n(`EISDIR`,`is a directory`,a);let e=o.relParts.join(`/`),i=!1;try{await this.stat(a),i=!0}catch{}let s=typeof r==`string`?new TextEncoder().encode(r):r instanceof Uint8Array?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);try{await o.backend.writeFile(e,s)}catch(e){t.rebrandFsError(e,a)}this.watcher?.notify([{type:i?`modify`:`create`,path:a,entryType:`file`}]),this.mountIndex.notifyWrite(a);return}let s;try{s=await this.resolveSymlinks(a)}catch{s=a}let c=!1;try{await this.lfs.stat(s),c=!0}catch{}let{dir:l}=D(s);await this.withWriteLock(async()=>{l!==`/`&&await this.mkdirRecursiveUnlocked(l);let e=typeof r==`string`?new TextEncoder().encode(r).byteLength:(r instanceof Uint8Array,r.byteLength);try{await this.lfs.writeFile(s,r)}catch(e){if(l!==`/`&&e instanceof Error&&e.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(l);try{await this.lfs.writeFile(s,r)}catch(e){throw this.convertError(e,a)}}else throw this.convertError(e,a)}try{await this.lfs.truncate?.(s,e)}catch(e){throw this.convertError(e,a)}}),this.watcher?.notify([{type:c?`modify`:`create`,path:s,entryType:`file`}])}async readDir(e){let t=E(e),n=this.findMount(t);return n?this.readDirMounted(t,n):this.readDirLocal(t)}async readDirMounted(e,n){let r=this.mountIndex.getDirectoryEntries(n.path,e);if(r!==void 0){let t=new Map;for(let e of r)t.set(e.name,{name:e.name,type:e.type});return this.addNestedMountEntries(t,e),[...t.values()]}let i=n.relParts.join(`/`)||`/`,a;try{a=await n.backend.readDir(i)}catch(n){t.rebrandFsError(n,e)}let o=new Map;for(let e of a)o.set(e.name,{name:e.name,type:e.kind===`directory`?`directory`:`file`});return this.addNestedMountEntries(o,e),[...o.values()]}async readDirLocal(e){let t=await this.resolveSymlinks(e);try{let e=await this.lfs.readdir(t),n=[];for(let r of e){let e=await this.statDirEntry(t,r);e&&n.push(e)}return n}catch(t){throw this.convertError(t,e)}}async statDirEntry(e,t){let n=e===`/`?`/${t}`:`${e}/${t}`;try{let e=await this.lfs.lstat(n);return e.isSymbolicLink()?{name:t,type:`symlink`}:{name:t,type:e.isDirectory()?`directory`:`file`}}catch{return null}}addNestedMountEntries(e,t){let n=t===`/`?`/`:`${t}/`;for(let r of this.mountPoints.keys()){if(r===t||!r.startsWith(n))continue;let i=r.slice(n.length);!i||i.includes(`/`)||e.has(i)||e.set(i,{name:i,type:`directory`})}}async withWriteLock(e){let t,n=new Promise(e=>{t=e}),r=this._writeLock;this._writeLock=n,await r;try{return await e()}finally{t()}}async mkdirRecursiveUnlocked(e){let t=e.split(`/`).filter(Boolean),n=``;for(let e of t){n+=`/`+e;try{await this.lfs.mkdir(n)}catch(e){if(e instanceof Error&&!e.message.includes(`EEXIST`))throw this.convertError(e,n)}}}async mkdir(e,n){let r=E(e);if(r===`/`)return;let i=this.findMount(r);if(i){if(i.relParts.length===0)return;let e=i.relParts.join(`/`),n=await this.exists(r);try{await i.backend.mkdir(e)}catch(e){t.rebrandFsError(e,r)}n||this.watcher?.notify([{type:`create`,path:r,entryType:`directory`}]);return}n?.recursive?await this.withWriteLock(()=>this.mkdirRecursiveUnlocked(r)):(await this.withWriteLock(async()=>{try{await this.lfs.mkdir(r)}catch(e){throw this.convertError(e,r)}}),this.watcher?.notify([{type:`create`,path:r,entryType:`directory`}]))}async rm(e,r){let i=E(e),a=this.findMount(i);if(a){if(a.relParts.length===0)throw new n(`EINVAL`,`cannot remove a mount point — use unmount`,i);let e;try{e=(await this.stat(i)).type}catch{}let o=a.relParts.join(`/`);try{await a.backend.remove(o,{recursive:r?.recursive})}catch(e){t.rebrandFsError(e,i)}this.watcher?.notify([{type:`delete`,path:i,entryType:e}]),this.mountIndex.notifyDelete(i);return}try{let e=await this.lfs.lstat(i);await this.withWriteLock(async()=>{e.isSymbolicLink()?await this.lfs.unlink(i):e.isDirectory()?r?.recursive?await this.rmRecursiveUnlocked(i):await this.lfs.rmdir(i):await this.lfs.unlink(i),await this.writeOpfsMetadataSidecar()})}catch(e){throw this.convertError(e,i)}this.watcher?.notify([{type:`delete`,path:i}])}async rmRecursiveUnlocked(e){let t=await this.lfs.readdir(e);for(let n of t){let t=e===`/`?`/${n}`:`${e}/${n}`,r=await this.lfs.lstat(t);r.isSymbolicLink()?await this.lfs.unlink(t):r.isDirectory()?await this.rmRecursiveUnlocked(t):await this.lfs.unlink(t)}await this.lfs.rmdir(e)}async stat(e){let n=E(e),r=this.findMount(n);if(r){if(r.relParts.length===0)try{let e=await this.lfs.stat(n);return{type:`directory`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch{return{type:`directory`,size:0,mtime:Date.now(),ctime:Date.now()}}let e=r.relParts.join(`/`);try{let t=await r.backend.stat(e);return{type:t.kind===`directory`?`directory`:`file`,size:t.size,mtime:t.mtime,ctime:t.mtime}}catch(e){t.rebrandFsError(e,n)}}let i=await this.resolveSymlinks(n);try{let e=await this.lfs.stat(i);return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch(e){throw this.convertError(e,n)}}async exists(e){let t=E(e),n=this.findMount(t);if(n){if(n.relParts.length===0)return!0;try{return await this.stat(t),!0}catch{return!1}}try{return await this.stat(t),!0}catch{try{return await this.lfs.lstat(t),!0}catch{return!1}}}async rename(e,t){let n=E(e),r=E(t),i;try{i=(await this.lstat(n)).type}catch{}try{await this.lfs.rename(n,r)}catch(e){throw this.convertError(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:i},{type:`create`,path:r,entryType:i}]),this.mountIndex.notifyRename(n,r)}async readTextFile(e){return await this.readFile(e,{encoding:`utf-8`})}async*walk(e,t,n=0){let r=E(e);if(this.canUseWalkFastPath(r)){let e=this.mountIndex.getFiles(r);if(e){for(let t of e)yield t;return}}let i=t??new Set;if(n>N||i.size>=P)return;let a=await this.safeRealpath(r);if(i.has(a))return;i.add(a);let o=await this.readDir(r);for(let e of o){let t=r===`/`?`/${e.name}`:`${r}/${e.name}`;yield*this.walkEntry(e,t,i,n+1)}}canUseWalkFastPath(e){return this.mountPoints.size===0||!this.mountPoints.has(e)||!this.mountIndex.isReady(e)?!1:![...this.mountPoints.keys()].some(t=>t!==e&&t.startsWith(e+`/`))}async safeRealpath(e){try{return await this.realpath(e)}catch{return e}}async*walkEntry(e,t,n,r){if(e.type===`file`){yield t;return}if(e.type===`symlink`){yield*this.walkSymlink(t,n,r);return}yield*this.walk(t,n,r)}async*walkSymlink(e,t,n){try{let r=await this.stat(e);r.type===`file`?yield e:r.type===`directory`&&(yield*this.walk(e,t,n))}catch{}}async copyFile(e,t){if((await this.stat(e)).type===`directory`)throw new n(`EISDIR`,`is a directory`,e);let r=await this.readFile(e,{encoding:`binary`});await this.writeFile(t,r)}dirname(e){return D(E(e)).dir}basename(e){return D(E(e)).base}async symlink(e,t){let r=E(t);if(this.findMount(r))throw new n(`EINVAL`,`symlinks not supported on mounted filesystems`,r);let{dir:i}=D(r);await this.withWriteLock(async()=>{i!==`/`&&await this.mkdirRecursiveUnlocked(i);try{await this.lfs.symlink(e,r)}catch(t){if(i!==`/`&&t instanceof Error&&t.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(i);try{await this.lfs.symlink(e,r)}catch(e){throw this.convertError(e,r)}}else throw this.convertError(t,r)}await this.writeOpfsMetadataSidecar()}),this.watcher?.notify([{type:`create`,path:r,entryType:`symlink`}])}async readlink(e){let t=E(e);try{return await this.lfs.readlink(t)}catch(e){throw this.convertError(e,t)}}async lstat(e){let t=E(e);if(this.findMount(t))return this.stat(t);try{let e=await this.lfs.lstat(t);if(e.isSymbolicLink()){let n=await this.lfs.readlink(t);return{type:`symlink`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,isSymlink:!0,symlinkTarget:n}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch(e){throw this.convertError(e,t)}}async realpath(e){let t=E(e);if(this.findMount(t))return t;let n=t.split(`/`).filter(Boolean),r=`/`,i=0;for(let e=0;e<n.length;e++){let a=await this.resolveRealpathComponent(r,n[e],e===n.length-1,t,i);r=a.resolved,i=a.hops}return r}async resolveRealpathComponent(e,t,r,i,a){let o=e===`/`?`/${t}`:`${e}/${t}`;for(;;){let e=await this.lstatOrThrow(o,r,i);if(e===null||!e.isSymbolicLink())return{resolved:o,hops:a};if(++a>M)throw new n(`ELOOP`,`too many symbolic links encountered`,i);o=await this.readAndResolveLink(o,i)}}async lstatOrThrow(e,t,n){try{return await this.lfs.lstat(e)}catch(e){let r=this.convertError(e,n);if(r.code===`ENOENT`&&t)return null;throw r}}async readAndResolveLink(e,t){let n;try{n=await this.lfs.readlink(e)}catch(e){throw this.convertError(e,t)}return n.startsWith(`/`)?E(n):E(k(D(e).dir,n))}async resolveSymlinks(e){return this.findMount(e)?e:this.realpath(e)}convertError(e,t){if(e instanceof n)return e;let r=e?.code;if(typeof r==`string`){let i=r;if([`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`EIO`].includes(i))return new n(i,(e instanceof Error?e.message:String(e))||i,t)}let i=e instanceof Error?e.message:String(e);return i.includes(`ENOENT`)?new n(`ENOENT`,`no such file or directory`,t):i.includes(`EEXIST`)?new n(`EEXIST`,`file already exists`,t):i.includes(`ENOTDIR`)?new n(`ENOTDIR`,`not a directory`,t):i.includes(`EISDIR`)?new n(`EISDIR`,`is a directory`,t):i.includes(`ENOTEMPTY`)?new n(`ENOTEMPTY`,`directory not empty`,t):i.includes(`ELOOP`)?new n(`ELOOP`,`too many levels of symbolic links`,t):new n(`EINVAL`,i,t)}};export{n as FsError,d as FsWatcher,T as MountIndex,j as RestrictedFS,I as VirtualFS,k as joinPath,E as normalizePath,O as pathSegments,F as resolveVfsBackendFromEnv,D as splitPath};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./logger-LESFN7Hj.js";import{t as n}from"./backend-local-D4WZgy4J.js";import{t as r}from"./types-idfTVsM8.js";import{a as i,i as a,n as o,t as s}from"./mount-table-store-CTrzlrNn.js";import{i as c,n as l,r as u,t as d}from"./path-utils-DU6QhF_k.js";const f=t(`fs-watcher`);let p=0;function m(e,t){return t===`/`||e===t||e.startsWith(t+`/`)}var h=class{registrations=new Map;watch(e,t,n){let r=`fsw-${++p}`;return this.registrations.set(r,{id:r,basePath:e,filter:t,callback:n}),f.debug(`Watch registered`,{id:r,basePath:e}),()=>{this.registrations.delete(r),f.debug(`Watch unregistered`,{id:r})}}notify(e){if(e.length!==0)for(let[,t]of this.registrations){let n=e.filter(e=>m(e.path,t.basePath)&&t.filter(e.path));if(n.length>0)try{t.callback(n)}catch(e){f.error(`Watch callback error`,{id:t.id,error:e instanceof Error?e.message:String(e)})}}}dispose(){this.registrations.clear(),f.debug(`All watchers disposed`)}get size(){return this.registrations.size}};const g=t(`mount-index`);var _=class extends Error{cause;constructor(e,t){super(e),this.name=`MountIndexAbortError`,this.cause=t}};function v(e){let t=e.map(([e,t])=>`${e}\u0000${t.kind}`).sort(),n=t.length>256?t.slice(0,256):t;return`${t.length}\u0001${n.join(``)}`}async function y(e,t){let n=e.isSameEntry;if(typeof n!=`function`)return!1;try{return await n.call(e,t)}catch{return!1}}function b(e,t){return e instanceof Map?e.get(t):e[t]}function x(e){let t=e.trim();if(t===``)return;let n=Number(t);if(!(!Number.isInteger(n)||n<=0))return n}function S(e,t,n){let r=b(e,t);if(r===void 0||r.trim()===``)return n;let i=x(r);return i===void 0?(g.warn(`Ignoring invalid ${t}; expected a positive integer, using default`,{value:r,fallback:n}),n):i}function C(e){return{maxDepth:S(e,`SLICC_MOUNT_INDEX_MAX_DEPTH`,400),maxEntries:S(e,`SLICC_MOUNT_INDEX_MAX_ENTRIES`,2e6)}}var w=class{mounts=new Map;listeners=new Set;registerMount(e,t,n=C({})){this.mounts.get(e)?.abortController?.abort();let r=new AbortController,i={handle:t,state:{status:`pending`,indexed:0},files:new Set,directories:new Set,abortController:r,limits:n};this.mounts.set(e,i),this.notifyListeners(),this.indexMount(e,i,r.signal)}unregisterMount(e){let t=this.mounts.get(e);t&&(t.abortController?.abort(),this.mounts.delete(e),this.notifyListeners())}async refreshMount(e,t){let n=this.mounts.get(e);if(!n)throw Error(`No mount at ${e}`);n.abortController?.abort();let r=new AbortController;n.abortController=r,n.state={status:`pending`,indexed:0},n.files.clear(),n.directories.clear(),t&&(n.limits=t),this.notifyListeners(),await this.indexMount(e,n,r.signal)}isReady(e){return this.mounts.get(e)?.state.status===`ready`}isAnyIndexing(){for(let e of this.mounts.values())if(e.state.status===`indexing`||e.state.status===`pending`)return!0;return!1}dispose(){for(let e of this.mounts.values())e.abortController?.abort();this.mounts.clear(),this.listeners.clear()}getState(e){return this.mounts.get(e)?.state}getFiles(e,t){let n=this.mounts.get(e);if(n?.state.status!==`ready`)return;if(!t)return[...n.files];let r=[];for(let e of n.files)t(e)&&r.push(e);return r}getDirectoryEntries(e,t){let n=this.mounts.get(e);if(n?.state.status!==`ready`)return;let r=t===`/`?`/`:t+`/`,i=new Map;for(let e of n.files){if(!e.startsWith(r))continue;let t=e.slice(r.length);t.includes(`/`)||i.set(t,`file`)}for(let e of n.directories){if(!e.startsWith(r))continue;let t=e.slice(r.length);t.includes(`/`)||i.set(t,`directory`)}return[...i.entries()].map(([e,t])=>({name:e,type:t}))}hasPath(e,t){let n=this.mounts.get(e);if(n?.state.status===`ready`)return n.files.has(t)||n.directories.has(t)}notifyWrite(e){let t=this.findMountForPath(e);if(!t)return;let n=this.mounts.get(t);if(n?.state.status!==`ready`)return;n.files.add(e);let r=e;for(;r!==t;){let e=r.lastIndexOf(`/`);if(e<=0)break;r=r.slice(0,e)||`/`,r.length>=t.length&&n.directories.add(r)}}notifyDelete(e){let t=this.findMountForPath(e);if(!t)return;let n=this.mounts.get(t);if(n?.state.status!==`ready`)return;n.files.delete(e),n.directories.delete(e);let r=e+`/`;for(let e of n.files)e.startsWith(r)&&n.files.delete(e);for(let e of n.directories)e.startsWith(r)&&n.directories.delete(e)}notifyRename(e,t){let n=this.findMountForPath(e);if(!n)return;let r=this.mounts.get(n);if(r?.state.status===`ready`){if(r.files.has(e)){r.files.delete(e),r.files.add(t);return}if(r.directories.has(e)){r.directories.delete(e),r.directories.add(t);let n=e+`/`,i=t+`/`;for(let e of[...r.files])e.startsWith(n)&&(r.files.delete(e),r.files.add(i+e.slice(n.length)));for(let e of[...r.directories])e.startsWith(n)&&(r.directories.delete(e),r.directories.add(i+e.slice(n.length)))}}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}findMountForPath(e){let t;for(let n of this.mounts.keys())(e===n||e.startsWith(n+`/`))&&(!t||n.length>t.length)&&(t=n);return t}notifyListeners(){for(let e of this.listeners)try{e()}catch{}}async indexMount(e,t,n){t.state={status:`indexing`,indexed:0},this.notifyListeners();try{if(await this.walkHandle(e,t.handle,t,n),n.aborted)return;t.state={status:`ready`,indexed:t.files.size+t.directories.size,total:t.files.size+t.directories.size},t.abortController=null,g.info(`Mount indexed`,{path:e,files:t.files.size,directories:t.directories.size})}catch(r){if(n.aborted)return;let i=r instanceof Error?r.message:String(r),a=r instanceof _?r.cause:`indexing-error`;t.state={status:`error`,indexed:0,error:i,abortCause:a},g.error(`Mount indexing failed`,{path:e,error:i,abortCause:a})}this.notifyListeners()}async walkHandle(e,t,n,r,i=0,a=new Map){if(r.aborted)return;this.enforceWalkBounds(i,n),n.directories.add(e);let o=await this.readChildren(t,r,n);if(r.aborted)return;let s=await this.confirmNoCycle(e,t,o,a),c=this.pushAncestor(a,s,e,t);try{await this.walkChildren(e,o,n,r,i,a)}finally{this.popAncestor(a,s,c)}}enforceWalkBounds(e,t){if(e>t.limits.maxDepth)throw new _(`mount indexing aborted: directory nesting exceeded ${t.limits.maxDepth} levels`,`depth-exceeded`);if(t.directories.size+t.files.size>=t.limits.maxEntries)throw new _(`mount indexing aborted: exceeded ${t.limits.maxEntries} entries`,`entries-exceeded`)}async readChildren(e,t,n){let r=e,i=[];for await(let e of r){if(t.aborted)break;if(n.directories.size+n.files.size+i.length>=n.limits.maxEntries)throw new _(`mount indexing aborted: exceeded ${n.limits.maxEntries} entries`,`entries-exceeded`);i.push(e)}return i}async confirmNoCycle(e,t,n,r){let i=v(n),a=r.get(i);if(a){for(let n of a)if(await y(n.handle,t))throw new _(`mount indexing aborted: self-referential mount cycle detected at ${e} (re-exposes ${n.path})`,`cycle-detected`)}return i}pushAncestor(e,t,n,r){let i=e.get(t);return i||(i=[],e.set(t,i)),i.push({path:n,handle:r,signature:t}),i}popAncestor(e,t,n){n.pop(),n.length===0&&e.delete(t)}async walkChildren(e,t,n,r,i,a){for(let[o,s]of t){if(r.aborted)return;let t=e===`/`?`/${o}`:`${e}/${o}`;s.kind===`file`?(n.files.add(t),n.state.indexed++):s.kind===`directory`&&await this.walkHandle(t,s,n,r,i+1,a),n.state.indexed%500==0&&(this.notifyListeners(),await new Promise(e=>setTimeout(e,0)))}}};const T=`/dev/null`,E=new Set([T]);function D(e){return E.has(e)}const O={[T]:{stat:()=>({type:`file`,size:0,mtime:0,ctime:0}),read:e=>(e?.encoding??`utf-8`)===`utf-8`?``:new Uint8Array,readText:()=>``,write:()=>{}}};var k=class{vfs;allowedPrefixes;readOnlyPrefixes;writeEnforcement;constructor(e,t,n=[],r=`hard`){this.vfs=e;let i=e=>{let t=l(e);return t.endsWith(`/`)?t:t+`/`};this.allowedPrefixes=t.map(i),this.readOnlyPrefixes=n.map(i),this.writeEnforcement=r}getAllPrefixes(){let e=this.vfs.listMounts().map(e=>e.endsWith(`/`)?e:e+`/`);return[...this.allowedPrefixes,...this.readOnlyPrefixes,...e]}isAllowed(e){let t=l(e);return this.getAllPrefixes().some(e=>t===e.slice(0,-1)||t.startsWith(e)||t===`/`||e.startsWith(t+`/`))}isAllowedStrict(e){let t=l(e);return this.getAllPrefixes().some(e=>t===e.slice(0,-1)||t.startsWith(e))}isWritable(e){let t=l(e);return this.allowedPrefixes.some(e=>t===e.slice(0,-1)||t.startsWith(e))}canWrite(e){return this.isWritable(e)}checkWrite(e){if(this.writeEnforcement!==`sudo-delegated`&&!this.isWritable(e))throw new r(`EACCES`,`permission denied`,l(e))}async resolveAndCheckRead(e){try{let t=await this.vfs.realpath(e);if(!this.isAllowedStrict(t))throw new r(`ENOENT`,`no such file or directory`,l(e));return t}catch(t){throw t instanceof r?t:new r(`ENOENT`,`no such file or directory`,l(e))}}async resolveAndCheckWrite(e){try{let t=await this.vfs.realpath(e);if(!this.isWritable(t)&&!this.isSymlinkEscapeAllowed(t))throw new r(`EACCES`,`permission denied`,l(e));return t}catch(t){throw t instanceof r?t:new r(`EACCES`,`permission denied`,l(e))}}isSymlinkEscapeAllowed(e){return!1}async checkParentRealpathEscape(e){let t=this.vfs.dirname(e),n=this.vfs.basename(e),i;try{i=await this.vfs.realpath(t)}catch(e){if(e instanceof r&&e.code===`EACCES`)throw e;return}let a=i+`/`+n;if(this.isWritable(a))return;let o=l(i)!==l(t);if(!(this.writeEnforcement===`sudo-delegated`&&!o))throw new r(`EACCES`,`permission denied`,l(e))}getUnderlyingFS(){return this.vfs}invalidatePaths(e){this.vfs.invalidatePaths(e)}isPathUnderMount(e){return this.vfs.isPathUnderMount(e)}async readFile(e,t){let n=O[l(e)];if(n)return n.read(t);if(!this.isAllowedStrict(e))throw new r(`ENOENT`,`no such file or directory`,l(e));let i=await this.resolveAndCheckRead(e);return this.vfs.readFile(i,t)}async readDir(e){if(!this.isAllowed(e))return[];let t=e;if(this.isAllowedStrict(e))try{t=await this.resolveAndCheckRead(e)}catch{return[]}let n=await this.vfs.readDir(t);if(!this.isAllowedStrict(e)){let t=l(e);return n.filter(e=>{let n=t===`/`?`/${e.name}`:`${t}/${e.name}`;return this.isAllowed(n)})}return n}async stat(e){let t=O[l(e)];if(t)return t.stat();if(!this.isAllowed(e))throw new r(`ENOENT`,`no such file or directory`,l(e));if(this.isAllowedStrict(e)){let t=await this.resolveAndCheckRead(e);return this.vfs.stat(t)}return this.vfs.stat(e)}scanPathForSymlinks(e,t){let n=l(e);if(n===`/`)return!1;let r=n.slice(1).split(`/`),i=t?r.length:r.length-1,a=``;for(let e=0;e<i;e++){a=a+`/`+r[e];let t=this.vfs.lstatSync(a);if(t===null)return null;if(t.type===`symlink`)return!0}return!1}statSync(e){let t=O[l(e)];return t?t.stat():!this.isAllowedStrict(e)||this.scanPathForSymlinks(e,!0)!==!1?null:this.vfs.statSync(e)}lstatSync(e){let t=O[l(e)];return t?t.stat():!this.isAllowed(e)||this.scanPathForSymlinks(e,!1)!==!1?null:this.vfs.lstatSync(e)}readDirSync(e){if(!this.isAllowed(e)||this.scanPathForSymlinks(e,!0)!==!1)return null;let t=this.vfs.readDirSync(e);if(t===null)return null;if(this.isAllowedStrict(e))return t;let n=l(e);return t.filter(e=>{let t=n===`/`?`/${e.name}`:`${n}/${e.name}`;return this.isAllowed(t)})}async realpath(e){let t;try{t=await this.vfs.realpath(e)}catch(t){throw t instanceof r?t:new r(`ENOENT`,`no such file or directory`,l(e))}if(!this.isAllowedStrict(t))throw new r(`ENOENT`,`no such file or directory`,l(e));return t}async exists(e){if(O[l(e)])return!0;if(!this.isAllowed(e))return!1;if(this.isAllowedStrict(e))try{await this.resolveAndCheckRead(e)}catch{return!1}return this.vfs.exists(e)}async readTextFile(e){let t=O[l(e)];if(t)return t.readText();if(!this.isAllowedStrict(e))throw new r(`ENOENT`,`no such file or directory`,l(e));let n=await this.resolveAndCheckRead(e);return this.vfs.readTextFile(n)}async*walk(e){if(!this.isAllowed(e))return;let t=e;if(this.isAllowedStrict(e))try{t=await this.resolveAndCheckRead(e)}catch{return}for await(let e of this.vfs.walk(t))this.isAllowed(e)&&(yield e)}async writeFile(e,t,n){let i=O[l(e)];if(i){i.write(t);return}this.checkWrite(e),await this.checkParentRealpathEscape(e);try{(await this.vfs.lstat(e)).type===`symlink`&&await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof r&&e.code===`EACCES`)throw e}return this.vfs.writeFile(e,t,n)}async mkdir(e,t){return this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.mkdir(e,t)}async rm(e,t){this.checkWrite(e);try{(await this.vfs.lstat(e)).type===`symlink`||await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof r&&e.code===`EACCES`)throw e}return this.vfs.rm(e,t)}async rename(e,t){return this.checkWrite(e),this.checkWrite(t),await this.resolveAndCheckWrite(e),await this.checkParentRealpathEscape(t),this.vfs.rename(e,t)}async copyFile(e,t){if(!this.isAllowed(e))throw new r(`ENOENT`,`no such file or directory`,l(e));this.checkWrite(t);let n=await this.resolveAndCheckRead(e);await this.checkParentRealpathEscape(t);try{(await this.vfs.lstat(t)).type===`symlink`&&await this.resolveAndCheckWrite(t)}catch(e){if(e instanceof r&&e.code===`EACCES`)throw e}return this.vfs.copyFile(n,t)}async symlink(e,t){return this.checkWrite(t),await this.checkParentRealpathEscape(t),this.vfs.symlink(e,t)}async readlink(e){if(!this.isAllowedStrict(e))throw new r(`ENOENT`,`no such file or directory`,l(e));let t=await this.vfs.readlink(e),n;if(n=t.startsWith(`/`)?l(t):l(this.vfs.dirname(e)+`/`+t),!this.isAllowedStrict(n))throw new r(`ENOENT`,`no such file or directory`,l(e));return t}async lstat(e){let t=O[l(e)];if(t)return t.stat();if(!this.isAllowed(e))throw new r(`ENOENT`,`no such file or directory`,l(e));let n=l(e),i=this.vfs.dirname(n),a=this.vfs.basename(n),o;if(i===n)o=i;else try{o=await this.vfs.realpath(i)}catch{throw new r(`ENOENT`,`no such file or directory`,n)}let s=o===`/`?`/${a}`:`${o}/${a}`;if(!this.isAllowed(s))throw new r(`ENOENT`,`no such file or directory`,n);return this.vfs.lstat(s)}watch(e,t,n){if(!this.isAllowed(e))throw new r(`EACCES`,`permission denied`,l(e));let i=this.vfs.getWatcher();if(!i)throw new r(`EINVAL`,`no watcher configured`);return i.watch(l(e),t,n)}dirname(e){return this.vfs.dirname(e)}basename(e){return this.vfs.basename(e)}async mount(e,t,n){return this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.mount(e,t,n)}async unmount(e){return this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.unmount(e)}listMounts(){return this.vfs.listMounts()}getMountIndex(){return this.vfs.getMountIndex()}async refreshMount(e,t){return this.checkWrite(e),this.vfs.refreshMount(e,t)}async dispose(){await this.vfs.dispose()}};function A(){try{if(typeof globalThis.navigator?.storage?.getDirectory==`function`)return`opfs`}catch{}return`memory`}var j=class e{lfs;lfsSync;rawLfs=null;rawLfsSync=null;_ready;_readyResolved=!1;backend;mountPoints=new Map;opfsBackendFs=null;opfsHandle=null;mountRoot=``;internalMounts=new Set;watcher=null;dbName;mountSyncChannel=null;mountIndex=new w;_writeLock=Promise.resolve();constructor(t,n,r,i){if(this.dbName=t,this.backend=r===`opfs`?`opfs`:`memory`,this.lfs=this.makeDeferredLfs(),this.lfsSync=this.makeDeferredLfsSync(),this._ready=this.backend===`opfs`?e.initOpfsBackend(this,i,n===!0):e.initMemoryBackend(this,t,n===!0),this._ready.then(()=>{this._readyResolved=!0},()=>{}),typeof BroadcastChannel<`u`)try{this.mountSyncChannel=new BroadcastChannel(`vfs-mount-sync:${t}`),this.mountSyncChannel.onmessage=e=>{let{type:t,path:n,descriptor:r}=e.data??{};if(t===`mount`&&typeof n==`string`&&r)this.reconstructBackendFromDescriptor(r).then(e=>{this.mountPoints.set(n,e),e.kind===`local`&&this.mountIndex.registerMount(n,e.getHandle()),this.watcher?.notify([{type:`modify`,path:n,entryType:`directory`}])}).catch(()=>{});else if(t===`unmount`&&typeof n==`string`){let e=this.mountPoints.get(n);this.mountPoints.delete(n),this.mountIndex.unregisterMount(n),e?.close(),this.watcher?.notify([{type:`modify`,path:n,entryType:`directory`}])}}}catch{}}static async initOpfsBackend(t,n,r){let i=n??await e.acquireOpfsHandle(t.dbName,r);await e.seedOpfsMetadataSidecarIfMissing(i);let[a,{WebAccess:o}]=await Promise.all([import(`./dist-CJ6ilPeJ.js`).then(e=>e.t),import(`./dist-BhEJb2Dl.js`)]);await e.ensureRootMount(a);let s=`/__opfs__/${t.dbName}`,c=e.opfsBackends.get(t.dbName);if(c&&r){try{a.umount(s)}catch{}e.opfsBackends.delete(t.dbName),c=void 0}if(!c){let n=await a.resolveMountConfig({backend:o,handle:i,metadata:`/.metadata.json`});try{a.mount(s,n)}catch{}c={backendFs:n,refs:0},e.opfsBackends.set(t.dbName,c)}c.refs+=1,t.opfsBackendFs=c.backendFs.index?c.backendFs:null,t.opfsHandle=i,t.mountRoot=s,t.rawLfs=a.promises,t.rawLfsSync=a}static async initMemoryBackend(t,n,r){let i=await import(`./dist-CJ6ilPeJ.js`).then(e=>e.t);await e.ensureRootMount(i);let a=`/__zenfs__/${n}`,o=e.memoryBackends.get(n);if(o&&r){try{i.umount(a)}catch{}e.memoryBackends.delete(n),o=void 0}o||(o={store:i.InMemory.create({label:n}),refs:0},e.memoryBackends.set(n,o)),o.refs+=1;try{i.mount(a,o.store)}catch{}t.mountRoot=a,t.rawLfs=i.promises,t.rawLfsSync=i,t.opfsBackendFs=null,t.opfsHandle=null}static rootMountReady=null;static memoryBackends=new Map;static opfsBackends=new Map;static async ensureRootMount(t){return e.rootMountReady||=(async()=>{await t.configureSingle({backend:t.InMemory,label:`__vfs_root__`})})(),e.rootMountReady}prefix(e){return this.mountRoot?e===`/`?this.mountRoot:this.mountRoot+e:e}unprefix(e){return!this.mountRoot||!e.startsWith(this.mountRoot)?e:e.slice(this.mountRoot.length)||`/`}makeDeferredLfs(){let e=e=>this.prefix(e),t=e=>this.unprefix(e),n=()=>{if(!this.rawLfs)throw Error(`VirtualFS used before init resolved`);return this.rawLfs};return{readFile:(t,r)=>this._readyResolved?n().readFile(e(t),r):this._ready.then(()=>n().readFile(e(t),r)),writeFile:(t,r,i)=>this._readyResolved?n().writeFile(e(t),r,i):this._ready.then(()=>n().writeFile(e(t),r,i)),readdir:t=>this._readyResolved?n().readdir(e(t)):this._ready.then(()=>n().readdir(e(t))),mkdir:(t,r)=>this._readyResolved?n().mkdir(e(t),r):this._ready.then(()=>n().mkdir(e(t),r)),rmdir:t=>this._readyResolved?n().rmdir(e(t)):this._ready.then(()=>n().rmdir(e(t))),unlink:t=>this._readyResolved?n().unlink(e(t)):this._ready.then(()=>n().unlink(e(t))),rename:(t,r)=>this._readyResolved?n().rename(e(t),e(r)):this._ready.then(()=>n().rename(e(t),e(r))),stat:t=>this._readyResolved?n().stat(e(t)):this._ready.then(()=>n().stat(e(t))),lstat:t=>this._readyResolved?n().lstat(e(t)):this._ready.then(()=>n().lstat(e(t))),symlink:(t,r)=>{let i=t.startsWith(`/`)?e(t):t;return this._readyResolved?n().symlink(i,e(r)):this._ready.then(()=>n().symlink(i,e(r)))},readlink:async r=>(this._readyResolved||await this._ready,t(await n().readlink(e(r)))),truncate:async(t,r)=>{this._readyResolved||await this._ready;let i=n();typeof i.truncate==`function`&&await i.truncate(e(t),r)},realpath:async r=>{this._readyResolved||await this._ready;let i=n();return typeof i.realpath==`function`?t(await i.realpath(e(r))):e(r)}}}makeDeferredLfsSync(){let e=e=>this.prefix(e),t=e=>this.unprefix(e);return{readdirSync:t=>{let n=this.rawLfsSync;return n?.readdirSync?n.readdirSync(e(t)):void 0},statSync:t=>{let n=this.rawLfsSync;return n?.statSync?n.statSync(e(t)):void 0},lstatSync:t=>{let n=this.rawLfsSync;return n?.lstatSync?n.lstatSync(e(t)):void 0},readlinkSync:n=>{let r=this.rawLfsSync;return r?.readlinkSync?t(r.readlinkSync(e(n))):void 0}}}static async seedOpfsMetadataSidecarIfMissing(e){let t=`.metadata.json`;try{await e.getFileHandle(t);return}catch(e){if(e?.name!==`NotFoundError`)throw e}let n=await(await e.getFileHandle(t,{create:!0})).createWritable(),r=JSON.stringify({version:1,maxSize:4294967295,entries:{}});await n.write(r),await n.close()}static async acquireOpfsHandle(e,t){let n=navigator.storage;if(!n?.getDirectory)throw new r(`EINVAL`,`OPFS is not available in this environment`);let i=await n.getDirectory();if(t)try{await i.removeEntry(e,{recursive:!0})}catch{}return i.getDirectoryHandle(e,{create:!0})}static _createSyncForTests(t){return new e(t)}static async create(t){let n=t?.dbName??`browser-fs`,r=t?.wipe===!0,i=t?.backend??A(),a=new e(n,r,i);return await a._ready,r&&await s().catch(()=>{}),a}async flush(){await this.writeOpfsMetadataSidecar()}async writeOpfsMetadataSidecar(){if(this.backend!==`opfs`)return;let e=this.opfsBackendFs,t=this.opfsHandle;if(!e||!t)return;let n=JSON.stringify(e.index.toJSON()),r=await(await t.getFileHandle(`.metadata.json`,{create:!0})).createWritable();await r.write(n),await r.close()}invalidatePaths(e){if(this.backend!==`opfs`||!this.opfsBackendFs)return;let t=this.opfsBackendFs;for(let n of e){let e=l(n);t.index.delete(e),t._handles?.delete(e)}}canWrite(e){return!0}setWatcher(e){this.watcher=e}getWatcher(){return this.watcher}async dispose(){if(this.mountSyncChannel?.close(),this.mountSyncChannel=null,this.watcher?.dispose(),this.watcher=null,this.mountIndex.dispose(),await this.writeOpfsMetadataSidecar(),this.mountRoot){let t=this.backend===`opfs`?e.opfsBackends:e.memoryBackends,n=t.get(this.dbName);if(n&&(--n.refs,n.refs<=0)){t.delete(this.dbName);try{(await import(`./dist-CJ6ilPeJ.js`).then(e=>e.t)).umount(this.mountRoot)}catch{}}}}readDirSync(e){let t=l(e);if(this.findMount(t))return null;let n=this.lfsSync;if(typeof n.readdirSync!=`function`||typeof n.lstatSync!=`function`)return null;try{let e=n.readdirSync(t),r=[];for(let i of e){let e=t===`/`?`/${i}`:`${t}/${i}`;try{let t=n.lstatSync(e),a=t.isSymbolicLink()?`symlink`:t.isDirectory()?`directory`:`file`;r.push({name:i,type:a})}catch{}}return r}catch{return null}}statSync(e){let t=l(e);if(this.findMount(t))return null;let n=this.lfsSync;if(typeof n.statSync!=`function`||typeof n.lstatSync!=`function`||typeof n.readlinkSync!=`function`)return null;let r=t;for(let e=0;e<=10;e++){let e;try{e=n.lstatSync(r)}catch{return null}if(!e.isSymbolicLink())return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs};let t;try{t=n.readlinkSync(r)}catch{return null}r=t.startsWith(`/`)?l(t):l(d(c(r).dir,t))}return null}lstatSync(e){let t=l(e);if(this.findMount(t))return null;let n=this.lfsSync;if(typeof n.lstatSync!=`function`)return null;try{let e=n.lstatSync(t);if(e.isSymbolicLink()){let r=n.readlinkSync?n.readlinkSync(t):``;return{type:`symlink`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,isSymlink:!0,symlinkTarget:r}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch{return null}}async mount(e,t,n){let a=l(e);if(this.mountPoints.has(a))throw new r(`EEXIST`,`mount point is already mounted`,a);try{if((await this.lstat(a)).type!==`directory`)throw new r(`ENOTDIR`,`mount point must be a directory`,a);if((await this.readDir(a)).length>0)throw new r(`ENOTEMPTY`,`mount point must be empty to avoid shadowing existing files`,a)}catch(e){if(!(e instanceof r)||e.code!==`ENOENT`)throw e}let{dir:o}=c(a);o!==`/`&&await this.mkdir(o,{recursive:!0});try{await this.lfs.mkdir(a)}catch{}if(this.mountPoints.set(a,t),t.kind===`local`){let e=C(n?.env??{});this.mountIndex.registerMount(a,t.getHandle(),e)}let s=t.kind===`local`?{kind:`local`,mountId:t.mountId,idbHandleKey:a}:t.kind===`s3`?{kind:`s3`,mountId:t.mountId,source:t.source,profile:t.profile??`default`}:{kind:`da`,mountId:t.mountId,source:t.source,profile:t.profile??`default`};try{this.mountSyncChannel?.postMessage({type:`mount`,path:a,descriptor:s})}catch{}this.watcher?.notify([{type:`modify`,path:a,entryType:`directory`}]);try{await i({targetPath:a,descriptor:s,createdAt:Date.now()},t.kind===`local`?t.getHandle():void 0)}catch{}}async unmount(e){let t=l(e),n=this.mountPoints.get(t);this.mountPoints.delete(t),this.mountIndex.unregisterMount(t);try{this.mountSyncChannel?.postMessage({type:`unmount`,path:t})}catch{}this.watcher?.notify([{type:`modify`,path:t,entryType:`directory`}]),await n?.close();try{await a(t)}catch{}}async reconstructBackendFromDescriptor(e){switch(e.kind){case`local`:{let t=await o(e.idbHandleKey);if(!t)throw Error(`no handle stored for ${e.idbHandleKey}`);return n.fromHandle(t,{mountId:e.mountId})}case`s3`:{let{S3MountBackend:t,RemoteMountCache:n,makeSignedFetchS3:r}=await import(`./mount-KPh5FQy2.js`).then(e=>e.t),i=new n({mountId:e.mountId,ttlMs:3e4});return new t({source:e.source,profile:e.profile,cache:i,mountId:e.mountId,signedFetch:r(e.profile)})}case`da`:{let{DaMountBackend:t,RemoteMountCache:n,makeSignedFetchDa:r}=await import(`./mount-KPh5FQy2.js`).then(e=>e.t),i=new n({mountId:e.mountId,ttlMs:3e4});return new t({source:e.source,profile:e.profile,cache:i,mountId:e.mountId,signedFetch:r()})}}}listMounts(){let e=[];for(let t of this.mountPoints.keys())this.internalMounts.has(t)||e.push(t);return e}listInternalMounts(){return[...this.internalMounts]}listMountPoints(){let e=[];for(let[t,n]of this.mountPoints)this.internalMounts.has(t)||e.push({path:t,kind:n.kind});return e}async mountInternal(e,t){let n=l(e);if(this.mountPoints.has(n))throw new r(`EEXIST`,`mount point is already mounted`,n);let{dir:i}=c(n);i!==`/`&&await this.mkdir(i,{recursive:!0});try{await this.lfs.mkdir(n)}catch{}this.mountPoints.set(n,t),this.internalMounts.add(n),this.watcher?.notify([{type:`modify`,path:n,entryType:`directory`}])}async unmountInternal(e){let t=l(e);if(!this.internalMounts.has(t))throw new r(`ENOENT`,`not an internal mount point`,t);let n=this.mountPoints.get(t);this.mountPoints.delete(t),this.internalMounts.delete(t),this.watcher?.notify([{type:`modify`,path:t,entryType:`directory`}]),await n?.close()}getMountIndex(){return this.mountIndex}async refreshMount(e,t){let n=l(e),i=this.mountPoints.get(n);if(!i)throw new r(`ENOENT`,`not a mount point`,n);let a=await i.refresh(t);return i.kind===`local`&&await this.mountIndex.refreshMount(n,C(t?.env??{})),a}isPathUnderMount(e){for(let t of this.mountPoints.keys())if(e===t||e.startsWith(t+`/`))return!0;return!1}static rebrandFsError(e,t){if(e instanceof r){let n=`${e.code}: `,i=e.message;throw i.startsWith(n)&&(i=i.slice(n.length)),e.path&&i.endsWith(` '${e.path}'`)&&(i=i.slice(0,i.length-` '${e.path}'`.length)),new r(e.code,i,t)}throw e}findMount(e){let t=null;for(let[n,r]of this.mountPoints)(e===n||e.startsWith(n+`/`))&&(!t||n.length>t.mountPath.length)&&(t={mountPath:n,backend:r});return t?e===t.mountPath?{path:t.mountPath,backend:t.backend,relParts:[]}:{path:t.mountPath,backend:t.backend,relParts:e.slice(t.mountPath.length+1).split(`/`).filter(Boolean)}:null}async readFile(t,n){let i=l(t),a=this.findMount(i);if(a){if(a.relParts.length===0)throw new r(`EISDIR`,`is a directory`,i);let t=a.relParts.join(`/`);try{let e=await a.backend.readFile(t);return(n?.encoding??`utf-8`)===`utf-8`?new TextDecoder(`utf-8`).decode(e):e}catch(t){e.rebrandFsError(t,i)}}let o=await this.resolveSymlinks(i);try{return(n?.encoding??`utf-8`)===`utf-8`?await this.lfs.readFile(o,{encoding:`utf8`}):await this.lfs.readFile(o)}catch(e){throw this.convertError(e,i)}}async writeFile(t,n,i){let a=l(t),o=this.findMount(a);if(o){if(o.relParts.length===0)throw new r(`EISDIR`,`is a directory`,a);let t=o.relParts.join(`/`),i=!1;try{await this.stat(a),i=!0}catch{}let s=typeof n==`string`?new TextEncoder().encode(n):n instanceof Uint8Array?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n);try{await o.backend.writeFile(t,s)}catch(t){e.rebrandFsError(t,a)}this.watcher?.notify([{type:i?`modify`:`create`,path:a,entryType:`file`}]),this.mountIndex.notifyWrite(a);return}let s;try{s=await this.resolveSymlinks(a)}catch{s=a}let u=!1;try{await this.lfs.stat(s),u=!0}catch{}let{dir:d}=c(s);await this.withWriteLock(async()=>{d!==`/`&&await this.mkdirRecursiveUnlocked(d);let e=typeof n==`string`?new TextEncoder().encode(n).byteLength:(n instanceof Uint8Array,n.byteLength);try{await this.lfs.writeFile(s,n)}catch(e){if(d!==`/`&&e instanceof Error&&e.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(d);try{await this.lfs.writeFile(s,n)}catch(e){throw this.convertError(e,a)}}else throw this.convertError(e,a)}try{await this.lfs.truncate?.(s,e)}catch(e){throw this.convertError(e,a)}}),this.watcher?.notify([{type:u?`modify`:`create`,path:s,entryType:`file`}])}async readDir(e){let t=l(e),n=this.findMount(t);return n?this.readDirMounted(t,n):this.readDirLocal(t)}async readDirMounted(t,n){let r=this.mountIndex.getDirectoryEntries(n.path,t);if(r!==void 0){let e=new Map;for(let t of r)e.set(t.name,{name:t.name,type:t.type});return this.addNestedMountEntries(e,t),[...e.values()]}let i=n.relParts.join(`/`)||`/`,a;try{a=await n.backend.readDir(i)}catch(n){e.rebrandFsError(n,t)}let o=new Map;for(let e of a)o.set(e.name,{name:e.name,type:e.kind===`directory`?`directory`:`file`});return this.addNestedMountEntries(o,t),[...o.values()]}async readDirLocal(e){let t=await this.resolveSymlinks(e);try{let e=await this.lfs.readdir(t),n=[];for(let r of e){let e=await this.statDirEntry(t,r);e&&n.push(e)}return n}catch(t){throw this.convertError(t,e)}}async statDirEntry(e,t){let n=e===`/`?`/${t}`:`${e}/${t}`;try{let e=await this.lfs.lstat(n);return e.isSymbolicLink()?{name:t,type:`symlink`}:{name:t,type:e.isDirectory()?`directory`:`file`}}catch{return null}}addNestedMountEntries(e,t){let n=t===`/`?`/`:`${t}/`;for(let r of this.mountPoints.keys()){if(r===t||!r.startsWith(n))continue;let i=r.slice(n.length);!i||i.includes(`/`)||e.has(i)||e.set(i,{name:i,type:`directory`})}}async withWriteLock(e){let t,n=new Promise(e=>{t=e}),r=this._writeLock;this._writeLock=n,await r;try{return await e()}finally{t()}}async mkdirRecursiveUnlocked(e){let t=e.split(`/`).filter(Boolean),n=``;for(let e of t){n+=`/`+e;try{await this.lfs.mkdir(n)}catch(e){if(e instanceof Error&&!e.message.includes(`EEXIST`))throw this.convertError(e,n)}}}async mkdir(t,n){let r=l(t);if(r===`/`)return;let i=this.findMount(r);if(i){if(i.relParts.length===0)return;let t=i.relParts.join(`/`),n=await this.exists(r);try{await i.backend.mkdir(t)}catch(t){e.rebrandFsError(t,r)}n||this.watcher?.notify([{type:`create`,path:r,entryType:`directory`}]);return}n?.recursive?await this.withWriteLock(()=>this.mkdirRecursiveUnlocked(r)):(await this.withWriteLock(async()=>{try{await this.lfs.mkdir(r)}catch(e){throw this.convertError(e,r)}}),this.watcher?.notify([{type:`create`,path:r,entryType:`directory`}]))}async rm(t,n){let i=l(t),a=this.findMount(i);if(a){if(a.relParts.length===0)throw new r(`EINVAL`,`cannot remove a mount point — use unmount`,i);let t;try{t=(await this.stat(i)).type}catch{}let o=a.relParts.join(`/`);try{await a.backend.remove(o,{recursive:n?.recursive})}catch(t){e.rebrandFsError(t,i)}this.watcher?.notify([{type:`delete`,path:i,entryType:t}]),this.mountIndex.notifyDelete(i);return}try{let e=await this.lfs.lstat(i);await this.withWriteLock(async()=>{e.isSymbolicLink()?await this.lfs.unlink(i):e.isDirectory()?n?.recursive?await this.rmRecursiveUnlocked(i):await this.lfs.rmdir(i):await this.lfs.unlink(i),await this.writeOpfsMetadataSidecar()})}catch(e){throw this.convertError(e,i)}this.watcher?.notify([{type:`delete`,path:i}])}async rmRecursiveUnlocked(e){let t=await this.lfs.readdir(e);for(let n of t){let t=e===`/`?`/${n}`:`${e}/${n}`,r=await this.lfs.lstat(t);r.isSymbolicLink()?await this.lfs.unlink(t):r.isDirectory()?await this.rmRecursiveUnlocked(t):await this.lfs.unlink(t)}await this.lfs.rmdir(e)}async stat(t){let n=l(t),r=this.findMount(n);if(r){if(r.relParts.length===0)try{let e=await this.lfs.stat(n);return{type:`directory`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch{return{type:`directory`,size:0,mtime:Date.now(),ctime:Date.now()}}let t=r.relParts.join(`/`);try{let e=await r.backend.stat(t);return{type:e.kind===`directory`?`directory`:`file`,size:e.size,mtime:e.mtime,ctime:e.mtime}}catch(t){e.rebrandFsError(t,n)}}let i=await this.resolveSymlinks(n);try{let e=await this.lfs.stat(i);return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch(e){throw this.convertError(e,n)}}async exists(e){let t=l(e),n=this.findMount(t);if(n){if(n.relParts.length===0)return!0;try{return await this.stat(t),!0}catch{return!1}}try{return await this.stat(t),!0}catch{try{return await this.lfs.lstat(t),!0}catch{return!1}}}async rename(e,t){let n=l(e),r=l(t),i;try{i=(await this.lstat(n)).type}catch{}try{await this.lfs.rename(n,r)}catch(e){throw this.convertError(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:i},{type:`create`,path:r,entryType:i}]),this.mountIndex.notifyRename(n,r)}async readTextFile(e){return await this.readFile(e,{encoding:`utf-8`})}async*walk(e,t,n=0){let r=l(e);if(this.canUseWalkFastPath(r)){let e=this.mountIndex.getFiles(r);if(e){for(let t of e)yield t;return}}let i=t??new Set;if(n>64||i.size>=1e5)return;let a=await this.safeRealpath(r);if(i.has(a))return;i.add(a);let o=await this.readDir(r);for(let e of o){let t=r===`/`?`/${e.name}`:`${r}/${e.name}`;yield*this.walkEntry(e,t,i,n+1)}}canUseWalkFastPath(e){return this.mountPoints.size===0||!this.mountPoints.has(e)||!this.mountIndex.isReady(e)?!1:![...this.mountPoints.keys()].some(t=>t!==e&&t.startsWith(e+`/`))}async safeRealpath(e){try{return await this.realpath(e)}catch{return e}}async*walkEntry(e,t,n,r){if(e.type===`file`){yield t;return}if(e.type===`symlink`){yield*this.walkSymlink(t,n,r);return}yield*this.walk(t,n,r)}async*walkSymlink(e,t,n){try{let r=await this.stat(e);r.type===`file`?yield e:r.type===`directory`&&(yield*this.walk(e,t,n))}catch{}}async copyFile(e,t){if((await this.stat(e)).type===`directory`)throw new r(`EISDIR`,`is a directory`,e);let n=await this.readFile(e,{encoding:`binary`});await this.writeFile(t,n)}dirname(e){return c(l(e)).dir}basename(e){return c(l(e)).base}async symlink(e,t){let n=l(t);if(this.findMount(n))throw new r(`EINVAL`,`symlinks not supported on mounted filesystems`,n);let{dir:i}=c(n);await this.withWriteLock(async()=>{i!==`/`&&await this.mkdirRecursiveUnlocked(i);try{await this.lfs.symlink(e,n)}catch(t){if(i!==`/`&&t instanceof Error&&t.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(i);try{await this.lfs.symlink(e,n)}catch(e){throw this.convertError(e,n)}}else throw this.convertError(t,n)}await this.writeOpfsMetadataSidecar()}),this.watcher?.notify([{type:`create`,path:n,entryType:`symlink`}])}async readlink(e){let t=l(e);try{return await this.lfs.readlink(t)}catch(e){throw this.convertError(e,t)}}async lstat(e){let t=l(e);if(this.findMount(t))return this.stat(t);try{let e=await this.lfs.lstat(t);if(e.isSymbolicLink()){let n=await this.lfs.readlink(t);return{type:`symlink`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,isSymlink:!0,symlinkTarget:n}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch(e){throw this.convertError(e,t)}}async realpath(e){let t=l(e);if(this.findMount(t))return t;let n=t.split(`/`).filter(Boolean),r=`/`,i=0;for(let e=0;e<n.length;e++){let a=await this.resolveRealpathComponent(r,n[e],e===n.length-1,t,i);r=a.resolved,i=a.hops}return r}async resolveRealpathComponent(e,t,n,i,a){let o=e===`/`?`/${t}`:`${e}/${t}`;for(;;){let e=await this.lstatOrThrow(o,n,i);if(e===null||!e.isSymbolicLink())return{resolved:o,hops:a};if(++a>10)throw new r(`ELOOP`,`too many symbolic links encountered`,i);o=await this.readAndResolveLink(o,i)}}async lstatOrThrow(e,t,n){try{return await this.lfs.lstat(e)}catch(e){let r=this.convertError(e,n);if(r.code===`ENOENT`&&t)return null;throw r}}async readAndResolveLink(e,t){let n;try{n=await this.lfs.readlink(e)}catch(e){throw this.convertError(e,t)}return n.startsWith(`/`)?l(n):l(d(c(e).dir,n))}async resolveSymlinks(e){return this.findMount(e)?e:this.realpath(e)}convertError(e,t){if(e instanceof r)return e;let n=e?.code;if(typeof n==`string`){let i=n;if([`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`EIO`].includes(i))return new r(i,(e instanceof Error?e.message:String(e))||i,t)}let i=e instanceof Error?e.message:String(e);return i.includes(`ENOENT`)?new r(`ENOENT`,`no such file or directory`,t):i.includes(`EEXIST`)?new r(`EEXIST`,`file already exists`,t):i.includes(`ENOTDIR`)?new r(`ENOTDIR`,`not a directory`,t):i.includes(`EISDIR`)?new r(`EISDIR`,`is a directory`,t):i.includes(`ENOTEMPTY`)?new r(`ENOTEMPTY`,`directory not empty`,t):i.includes(`ELOOP`)?new r(`ELOOP`,`too many levels of symbolic links`,t):new r(`EINVAL`,i,t)}},M=e({FsError:()=>r,FsWatcher:()=>h,MountIndex:()=>w,RestrictedFS:()=>k,VirtualFS:()=>j,joinPath:()=>d,normalizePath:()=>l,pathSegments:()=>u,resolveVfsBackendFromEnv:()=>A,splitPath:()=>c});export{h as a,D as i,j as n,k as r,M as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./store-DxxV-bbY.js";export{e as readMcpAuthEntries};