@jxsuite/studio 5.5.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/chunks/{2020-g8mwpbkq.js → 2020-zvax9fmb.js} +3 -3
- package/dist/chunks/adapter-6zhjbpmd.js +4 -0
- package/dist/chunks/cf-account-picker-zfycs4k2.js +4 -0
- package/dist/chunks/cf-settings-fpa485q3.js +4 -0
- package/dist/chunks/components-b0vh4sq8.js +4 -0
- package/dist/chunks/content-source-z5t0d0h9.js +4 -0
- package/dist/chunks/convert-to-repeater-x19jr6c7.js +4 -0
- package/dist/chunks/editor-7e23n4a8.js +4 -0
- package/dist/chunks/entry-commands-5cm6aba2.js +4 -0
- package/dist/chunks/extension-sections-y90sa0n4.js +4 -0
- package/dist/chunks/file-ops-hv7gf757.js +4 -0
- package/dist/chunks/files-kb0epdxf.js +4 -0
- package/dist/chunks/format-host-eg1wy2bp.js +4 -0
- package/dist/chunks/fs-events-ky3vxfmh.js +4 -0
- package/dist/chunks/git-panel-yyg3bzp2.js +4 -0
- package/dist/chunks/grid-view-5mqv1cbd.css +1 -0
- package/dist/chunks/grid-view-d9mybhn0.js +51 -0
- package/dist/chunks/iframe-host-9wdf0hes.js +4 -0
- package/dist/chunks/index-2tf0m2ne.js +4 -0
- package/dist/chunks/{index-arg188jq.js → index-vnwy9d44.js} +3 -3
- package/dist/chunks/{javascript-zcdmye2k.js → javascript-f0nrbdjb.js} +2 -2
- package/dist/chunks/{jsonMode-6x5e1nbf.js → jsonMode-nfa90dtf.js} +5 -5
- package/dist/chunks/jx-validate-7w11db9v.js +4 -0
- package/dist/chunks/layers-7zasrpse.js +4 -0
- package/dist/chunks/layers-panel-9nzc4fdq.js +4 -0
- package/dist/chunks/lit-html-5qr7nbng.js +4 -0
- package/dist/chunks/media-picker-maevn9d4.js +4 -0
- package/dist/chunks/menu-wq6q0v3y.js +4 -0
- package/dist/chunks/{monaco-binding-4az2kh5p.js → monaco-binding-antn79jf.js} +3 -3
- package/dist/chunks/monaco-buffer-9ry2rn5x.js +4 -0
- package/dist/chunks/{monaco-setup-d7mwkcx3.js → monaco-setup-k8s40vwg.js} +3 -3
- package/dist/chunks/notify-g91gjd6w.js +4 -0
- package/dist/chunks/platform-jdwjp2vt.js +4 -0
- package/dist/chunks/publish-panel-8yym447p.js +4 -0
- package/dist/chunks/quick-search-9bzm9kh3.js +4 -0
- package/dist/chunks/references-znssfqvq.js +4 -0
- package/dist/chunks/right-panel-czbzktm8.js +4 -0
- package/dist/chunks/section-registry-0rtq73qs.js +4 -0
- package/dist/chunks/studio-011em5cf.js +5 -0
- package/dist/chunks/studio-02y9cb4h.js +6 -0
- package/dist/chunks/{studio-7gqyhjns.js → studio-09n3fyy0.js} +4 -4
- package/dist/chunks/{studio-xcng8nx7.js → studio-0c3fpdqj.js} +5 -5
- package/dist/chunks/studio-0mm38y62.js +5 -0
- package/dist/chunks/studio-0nm2skex.js +4 -0
- package/dist/chunks/{studio-73czgk6a.js → studio-153mwkyq.js} +4 -4
- package/dist/chunks/{studio-f8jyp45j.js → studio-1pxvgx1t.js} +4 -4
- package/dist/chunks/studio-27tc8q0h.js +5 -0
- package/dist/chunks/studio-28pz4s1k.js +5 -0
- package/dist/chunks/{studio-x5esgzct.js → studio-36s6qjgq.js} +4 -4
- package/dist/chunks/studio-4yztve2t.js +5 -0
- package/dist/chunks/{studio-x9sagq2d.js → studio-5fc0728f.js} +7 -7
- package/dist/chunks/{studio-7jazdy6y.js → studio-654fxcr0.js} +4 -4
- package/dist/chunks/studio-6exg5z4x.js +4 -0
- package/dist/chunks/studio-6k1eswp9.js +5 -0
- package/dist/chunks/{studio-5wfrgee9.js → studio-6zyt56ek.js} +4 -4
- package/dist/chunks/studio-7djymzt2.js +5 -0
- package/dist/chunks/{studio-b4epb26c.js → studio-7w04zw8h.js} +7 -7
- package/dist/chunks/studio-805fwp9k.js +5 -0
- package/dist/chunks/{studio-k1eaqyzm.js → studio-81twpmzj.js} +4 -4
- package/dist/chunks/studio-891t1tv9.js +5 -0
- package/dist/chunks/{studio-5n1km79v.js → studio-9n2j9nqk.js} +4 -4
- package/dist/chunks/{studio-he2fhrgp.js → studio-9tkaykt5.js} +4 -4
- package/dist/chunks/studio-ant1zbp3.js +5 -0
- package/dist/chunks/studio-b29h7g7s.js +5 -0
- package/dist/chunks/studio-b5rxwkj2.js +5 -0
- package/dist/chunks/studio-d007j0z3.js +7 -0
- package/dist/chunks/studio-dknr8m7b.js +14 -0
- package/dist/chunks/{studio-eq27rrr0.js → studio-dmymvk2j.js} +3 -3
- package/dist/chunks/studio-dtmdjmqb.js +5 -0
- package/dist/chunks/studio-eb5sty2k.js +5 -0
- package/dist/chunks/{studio-hc9q4j24.js → studio-ebt49j3c.js} +5 -5
- package/dist/chunks/studio-eegyf5vg.js +5 -0
- package/dist/chunks/studio-frv7vjhw.js +5 -0
- package/dist/chunks/studio-ft8pfpp0.js +5 -0
- package/dist/chunks/{studio-mhhc9btt.js → studio-gj4j9e7k.js} +4 -4
- package/dist/chunks/{studio-hf4qdjc8.js → studio-gxna6yta.js} +4 -4
- package/dist/chunks/studio-je15p5v8.js +6 -0
- package/dist/chunks/{studio-21enxdr8.js → studio-jsr14n1s.js} +4 -4
- package/dist/chunks/studio-k9pwvmz8.js +5 -0
- package/dist/chunks/{studio-p1eggxcf.js → studio-ks0ecgjx.js} +3 -3
- package/dist/chunks/studio-mb8jhtr4.js +64 -0
- package/dist/chunks/studio-mf41717j.js +5 -0
- package/dist/chunks/{studio-625ezz59.js → studio-mm8x32gg.js} +4 -4
- package/dist/chunks/{studio-pkkw32j0.js → studio-n2e133d6.js} +4 -4
- package/dist/chunks/{studio-c4pnt1c6.js → studio-njmg0e73.js} +5 -5
- package/dist/chunks/studio-nvykrgbj.js +4 -0
- package/dist/chunks/studio-nw4q9sdn.js +5 -0
- package/dist/chunks/studio-p6avneaq.js +5 -0
- package/dist/chunks/studio-pvj970st.js +5 -0
- package/dist/chunks/studio-r7yeeqc4.js +5 -0
- package/dist/chunks/studio-s85vah66.js +6 -0
- package/dist/chunks/studio-sadckcpp.js +7 -0
- package/dist/chunks/studio-sgzss898.js +9 -0
- package/dist/chunks/{studio-7by9a93k.js → studio-t0v47dpc.js} +4 -4
- package/dist/chunks/{studio-jnb285we.js → studio-tj28pxa1.js} +4 -4
- package/dist/chunks/{studio-6j2jn55a.js → studio-tzs6njnb.js} +8 -8
- package/dist/chunks/studio-vz7b43ng.js +5 -0
- package/dist/chunks/studio-w8w9frjy.js +16 -0
- package/dist/chunks/{studio-xc8ebsts.js → studio-wr0pq67n.js} +4 -4
- package/dist/chunks/{studio-8r4y2x0z.js → studio-y164brht.js} +4 -4
- package/dist/chunks/studio-y17505ge.js +928 -0
- package/dist/chunks/studio-ymsjnvp9.js +5 -0
- package/dist/chunks/studio-z1vdxq0e.js +5 -0
- package/dist/chunks/studio-z47mm077.js +10 -0
- package/dist/chunks/studio-zkkdbbvd.js +9 -0
- package/dist/chunks/{studio-awqghqxv.js → studio-zkvyd3ev.js} +4 -4
- package/dist/chunks/{tsMode-rtwt7w1a.js → tsMode-eq26t9gs.js} +5 -5
- package/dist/chunks/workspace-emt8454d.js +4 -0
- package/dist/chunks/ws-client-3gxqp06s.js +4 -0
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +62 -59
- package/dist/studio.css +1 -1
- package/dist/studio.js +115 -117
- package/package.json +5 -5
- package/src/account/action-flow.ts +294 -0
- package/src/account/action-required.ts +68 -0
- package/src/account-status.ts +29 -1
- package/src/browse/library-model.ts +3 -1
- package/src/browse/library-preview.ts +6 -2
- package/src/canvas/asset-refs.ts +3 -1
- package/src/canvas/asset-resolve.ts +79 -1
- package/src/canvas/iframe-entry.ts +38 -1
- package/src/canvas/iframe-host.ts +85 -0
- package/src/canvas/iframe-protocol.ts +13 -0
- package/src/files/asset-versions.ts +294 -0
- package/src/files/files.ts +61 -9
- package/src/files/fs-events.ts +279 -28
- package/src/files/media-meta.ts +2 -1
- package/src/files/media-paths.ts +5 -2
- package/src/files/media-upload.ts +5 -1
- package/src/new-project/add-repo-modal.ts +12 -1
- package/src/new-project/new-project-modal.ts +12 -1
- package/src/panels/git-panel.ts +25 -2
- package/src/platform-errors.ts +61 -1
- package/src/platforms/cloud.ts +389 -50
- package/src/platforms/devserver.ts +17 -1
- package/src/publish/pages-service.ts +17 -7
- package/src/services/ai-models.ts +30 -6
- package/src/services/ai-system-prompt.ts +81 -51
- package/src/settings/preferences-accounts.ts +42 -3
- package/src/settings/preferences-dialog.ts +8 -1
- package/src/studio.ts +18 -1
- package/src/surfaces/dialog.ts +5 -0
- package/src/surfaces/welcome.json +86 -1
- package/src/surfaces/welcome.ts +61 -2
- package/src/types.ts +84 -2
- package/src/ui/ai-managed-connect.ts +41 -4
- package/src/ui/media-picker.ts +2 -1
- package/dist/chunks/adapter-bsbs78x9.js +0 -4
- package/dist/chunks/cf-account-picker-gnm7xeqb.js +0 -4
- package/dist/chunks/cf-settings-9y6jyscp.js +0 -4
- package/dist/chunks/components-s51h3b7c.js +0 -4
- package/dist/chunks/content-source-ty3be0qg.js +0 -4
- package/dist/chunks/convert-to-repeater-c3e7q61z.js +0 -4
- package/dist/chunks/editor-t002b41m.js +0 -4
- package/dist/chunks/entry-commands-sb72e9gy.js +0 -4
- package/dist/chunks/extension-sections-ktn2ntnj.js +0 -4
- package/dist/chunks/file-ops-78zeytkm.js +0 -4
- package/dist/chunks/files-gatzrz8v.js +0 -4
- package/dist/chunks/format-host-r59b1651.js +0 -4
- package/dist/chunks/fs-events-f8h91ndt.js +0 -4
- package/dist/chunks/git-panel-y12zf7nj.js +0 -4
- package/dist/chunks/grid-view-rfd8b2pg.js +0 -51
- package/dist/chunks/grid-view-tafenfm2.css +0 -1
- package/dist/chunks/iframe-host-vsrsj20g.js +0 -4
- package/dist/chunks/index-5aghyrfh.js +0 -4
- package/dist/chunks/jx-validate-653krkrf.js +0 -4
- package/dist/chunks/layers-32p8gtae.js +0 -4
- package/dist/chunks/layers-panel-rs58m105.js +0 -4
- package/dist/chunks/lit-html-54bmkwz3.js +0 -4
- package/dist/chunks/media-picker-5bb04wct.js +0 -4
- package/dist/chunks/menu-cbha7w2e.js +0 -4
- package/dist/chunks/monaco-buffer-9vbbyfr1.js +0 -4
- package/dist/chunks/notify-dc1nz5ar.js +0 -4
- package/dist/chunks/platform-2m49s1zf.js +0 -4
- package/dist/chunks/publish-panel-nx3ycmma.js +0 -4
- package/dist/chunks/quick-search-yzrzh9x3.js +0 -4
- package/dist/chunks/references-vx7mbj9f.js +0 -4
- package/dist/chunks/right-panel-7jzpbxja.js +0 -4
- package/dist/chunks/section-registry-gjryse41.js +0 -4
- package/dist/chunks/studio-3znfhcxg.js +0 -5
- package/dist/chunks/studio-58qam27v.js +0 -4
- package/dist/chunks/studio-6j59fwaw.js +0 -5
- package/dist/chunks/studio-7z69g1gx.js +0 -5
- package/dist/chunks/studio-93j3v6zx.js +0 -5
- package/dist/chunks/studio-9gf6v8zy.js +0 -5
- package/dist/chunks/studio-9rhmettf.js +0 -4
- package/dist/chunks/studio-ac5aq677.js +0 -10
- package/dist/chunks/studio-as65vbns.js +0 -5
- package/dist/chunks/studio-bkv0sga4.js +0 -6
- package/dist/chunks/studio-bttmqef4.js +0 -5
- package/dist/chunks/studio-c3y9d41k.js +0 -5
- package/dist/chunks/studio-ccegp7gz.js +0 -9
- package/dist/chunks/studio-chxabn98.js +0 -6
- package/dist/chunks/studio-cktcdsxz.js +0 -16
- package/dist/chunks/studio-cnspfke5.js +0 -5
- package/dist/chunks/studio-de3p1ktm.js +0 -5
- package/dist/chunks/studio-fsbcn530.js +0 -928
- package/dist/chunks/studio-gftga7a3.js +0 -64
- package/dist/chunks/studio-hf1rpcq0.js +0 -4
- package/dist/chunks/studio-hz02hq70.js +0 -5
- package/dist/chunks/studio-jsv3s3s1.js +0 -5
- package/dist/chunks/studio-ks7cksh0.js +0 -5
- package/dist/chunks/studio-nptx0dbs.js +0 -5
- package/dist/chunks/studio-pg0z7k98.js +0 -5
- package/dist/chunks/studio-pve0b2f2.js +0 -5
- package/dist/chunks/studio-q7zmjv3b.js +0 -6
- package/dist/chunks/studio-rpmvw7kj.js +0 -5
- package/dist/chunks/studio-rwhss52s.js +0 -5
- package/dist/chunks/studio-sbg3g3h0.js +0 -5
- package/dist/chunks/studio-sq1bn60g.js +0 -14
- package/dist/chunks/studio-vwz7rma2.js +0 -5
- package/dist/chunks/studio-wa55e8gf.js +0 -5
- package/dist/chunks/studio-x0mzdha2.js +0 -5
- package/dist/chunks/studio-xrgpakvc.js +0 -9
- package/dist/chunks/studio-xt3djk1w.js +0 -7
- package/dist/chunks/studio-yh3nggx1.js +0 -7
- package/dist/chunks/studio-zmecp6hq.js +0 -5
- package/dist/chunks/workspace-g6dvaete.js +0 -4
- package/dist/chunks/ws-client-shf41j5p.js +0 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{te}from"./studio-ery42sqr.js";import{v,S}from"./studio-
|
|
1
|
+
import{te}from"./studio-ery42sqr.js";import{v,S}from"./studio-0nm2skex.js";import{hn,sn}from"./studio-dknr8m7b.js";import{rt,zt,T,R,Nn,Ct}from"./studio-z1vdxq0e.js";var G={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGithubAuth",$description:"The RFC 8628 device flow's waiting room: the code GitHub minted, the page to type it into, and a Cancel. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop — and it is the reason the dialog has no confirm button at all: the answer arrives from GitHub over a poll rather than from anything the reader can press here, so a primary button would be a control with nothing to do. Nothing in this document talks to GitHub: `github/github-auth.ts` keeps the client id, the poll loop, its failure budget and every report the three outcomes raise.",tagName:"jx-dialog",$props:{headline:"Sign in to GitHub",confirmLabel:"",cancelLabel:"Cancel",size:"sm"},attributes:{part:"github-auth"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"Four `.github-auth-*` rules in `styles/overlays.css` become the parts below, and two things in them do not travel. `.github-auth-dialog`'s `padding: 16px 0` was the card's own body padding drawn by hand, and `jx-dialog` already pads its body; `.github-auth-dialog p { font-size: 13px }` was a body size this surface picked for itself, and what the paragraphs now inherit is the dialog's own `--jx-text-md`. The `8px 0` margins go with them — the column is a flex column with a gap, so a margin between two rows would be a second opinion about the same space. The code keeps its 24px, which is above the token scale on purpose: it is a string the reader has to copy onto another screen, and reading it out loud is the whole job of this dialog.",'& [part="device"]':{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",textAlign:"center"},'& [part="lede"], & [part="waiting"]':{margin:"0"},'& [part="code"]':{$description:"`<code>`, not a styled `<div>`: this is a literal string to be transcribed, and the element that says so is also the one a reader's own stylesheet and a screen reader's character-by-character mode already know about. It is this dialog's message, and the one string in it the reader must carry to another screen, so it opts back in to selection against the root's `user-select: none`. `all` rather than `text`: one click selects the whole code, so a copy never leaves a character behind.",userSelect:"all",fontFamily:"var(--font-mono)",fontSize:"24px",fontWeight:"700",letterSpacing:"2px",padding:"var(--jx-space-3) var(--jx-space-4)",background:"var(--hover-bg)",borderRadius:"var(--radius)"},'& [part="link"]':{$description:"The blue this carried as a `var(--accent, …)` fallback is gone: `--accent` is declared on `:root` in `styles/tokens.css`, so the fallback could only ever have painted when the token was missing — which is a theme fault to fix rather than a colour to hard-code.",color:"var(--accent)",textDecoration:"underline"},'& [part="waiting"]':{color:"var(--fg-dim)",fontStyle:"italic"}},children:[{tagName:"div",attributes:{part:"device"},children:[{tagName:"p",attributes:{part:"lede"},textContent:"Enter this code on GitHub to authorize Jx Studio:"},{tagName:"code",attributes:{part:"code"},textContent:"${state.userCode}"},{tagName:"a",attributes:{part:"link",href:"${state.verificationUri}",target:"_blank",rel:"noreferrer"},textContent:"Open ${state.verificationUri}"},{tagName:"p",attributes:{part:"waiting"},textContent:"Waiting for authorization…"}]}]};T("github-auth",G);function A(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(rt,zt("dialog","github-auth")),e.layer.append(t);let r=!1,u=()=>{if(r)return;r=!0,e.onClosed()},f=v({cancel:()=>{e.onCancel()},closed:u,userCode:e.userCode,verificationUri:e.verificationUri}),s=null,c=R("github-auth",f,t).then(async(o)=>{s=o;let n=o.root;if(r)return o.dispose(),n;if(await Nn(n),r)return n;return hn(n),n});return{close(){let o=s?.root;if(o instanceof HTMLElement)sn(o);s?.dispose(),s=null,t.remove(),u()},host:t,ready:c}}var _="jx_github_token";function p(){return globalThis.__jxPlatform?.githubAuth??null}var g=null,C=!1;function E(e){g=e}function p1(){return g!==null||C||localStorage.getItem("jx_github_token")!==null}function f1(){return p()?"desktop":"browser"}function b(){return g??localStorage.getItem("jx_github_token")}function m1(){g=null,C=!1,localStorage.removeItem("jx_github_token"),p()?.signOut().catch(()=>{})}var H="Ov23liYVlMFpgjOEPXJH",O="github.auth",j="Source Control",N="git.signInToGithub",U=3,M="The request never reached GitHub. GitHub's device-flow endpoints send no CORS headers, so a "+"browser cannot call them directly — the desktop app can. A machine that is offline fails "+"identically, and the browser does not say which happened.";function D(e){S.error("Could not reach GitHub to sign in.",{action:N,detail:`${M}
|
|
2
2
|
|
|
3
|
-
${te(e)}`,key:O,source:j})}function y(e,t){S.warn(e,{action:N,detail:t,key:O,source:j})}async function Y(){let e;try{e=await fetch("https://github.com/login/device/code",{body:JSON.stringify({client_id:H,scope:"repo"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})}catch(t){return D(t),null}if(!e.ok)return y("GitHub refused to start the sign-in.",`GitHub answered ${e.status}${e.statusText?` ${e.statusText}`:""}.`),null;return await e.json()}async function
|
|
4
|
-
export{
|
|
3
|
+
${te(e)}`,key:O,source:j})}function y(e,t){S.warn(e,{action:N,detail:t,key:O,source:j})}async function Y(){let e;try{e=await fetch("https://github.com/login/device/code",{body:JSON.stringify({client_id:H,scope:"repo"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})}catch(t){return D(t),null}if(!e.ok)return y("GitHub refused to start the sign-in.",`GitHub answered ${e.status}${e.statusText?` ${e.statusText}`:""}.`),null;return await e.json()}async function _w(){let e=b();if(e)return e;let t=p();if(t)try{let{token:o}=await t.signIn();return E(o),o}catch(o){return y("GitHub sign-in was not completed.",te(o)),null}let r=await Y();if(!r)return null;let{device_code:u,user_code:f,verification_uri:s,interval:c=5}=r;return new Promise((o)=>{let n=!1,a=null,m=0,w=!1,I=(l)=>{if(w)return;if(w=!0,n=!0,a)clearTimeout(a),a=null;o(l)},k=!1,x=()=>{if(k)return;k=!0,L.close()},d=(l)=>{I(l),x()},h=async()=>{if(n)return;try{let i=await(await fetch("https://github.com/login/oauth/access_token",{body:JSON.stringify({client_id:H,device_code:u,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})).json();if(m=0,i.access_token){localStorage.setItem(_,i.access_token),d(i.access_token);return}if(i.error==="authorization_pending"){a=setTimeout(h,c*1000);return}if(i.error==="slow_down"){a=setTimeout(h,(c+5)*1000);return}y("GitHub sign-in was not completed.",i.error==="access_denied"?"The authorization was declined on GitHub.":i.error==="expired_token"?"The device code expired before it was entered.":`GitHub answered "${i.error??"an unrecognised response"}".`),d(null)}catch(l){if(m+=1,m>=U){D(l),d(null);return}a=setTimeout(h,c*1000)}},L=A({layer:Ct("dialog"),onCancel:()=>{x()},onClosed:()=>{d(null)},userCode:f,verificationUri:s});a=setTimeout(h,c*1000)})}
|
|
4
|
+
export{p1,f1,m1,_w};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
7
|
-
//# sourceMappingURL=studio-
|
|
6
|
+
//# debugId=B75EEAF60638A99C64756E2164756E21
|
|
7
|
+
//# sourceMappingURL=studio-0c3fpdqj.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{p}from"./studio-6k1eswp9.js";import{di}from"./studio-b29h7g7s.js";import{Ir}from"./studio-k9pwvmz8.js";import{Gi,up,xL,_L}from"./studio-ant1zbp3.js";var r=new Map,d=new Map,a=new Map;function l(e,t){let n=xL(e),i=a.get(e);return{bytes:typeof t?.size==="number"?t.size:null,ext:Gi(n),height:i?.height??null,kind:up({name:n}),modified:t?.modified??null,name:n,path:e,width:i?.width??null}}function lb(e){return r.get(di(e))??null}function wE(e){for(let t of e){if(t.type!=="file")continue;let n=di(t.path);if(!r.has(n))r.set(n,l(n,t))}}async function xE(e){let t=di(e),n=r.get(t);if(n)return n;let i=d.get(t);if(i)return i;let o=(async()=>{let u;try{u=(await Ir(()=>p().listDirectory(_L(t)))).find((f)=>di(f.path)===t)}catch{u=void 0}return l(t,u)})();d.set(t,o);let s=await o;return d.delete(t),r.set(t,s),s}function cb(e,t,n){if(!(t>0&&n>0))return!1;let i=di(e),o=a.get(i);if(o&&o.width===t&&o.height===n)return!1;a.set(i,{height:n,width:t});let s=r.get(i);if(s)r.set(i,{...s,height:n,width:t});return!0}function _E(){r.clear(),a.clear()}function g1(e){if(e<1024)return`${e} B`;if(e<1048576)return`${Math.round(e/1024)} KB`;return`${(e/1048576).toFixed(1)} MB`}function CE(e){if(!e)return"";let t=[];if(e.width!==null&&e.height!==null)t.push(`${e.width} × ${e.height}`);if(e.bytes!==null)t.push(g1(e.bytes));return t.join(" · ")}
|
|
2
|
+
export{lb,wE,xE,cb,_E,g1,CE};
|
|
3
|
+
|
|
4
|
+
//# debugId=9BDE3C4B721D9D5464756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-0mm38y62.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
function q(e){let t=Object.create(null);for(let n of e.split(","))t[n]=1;return(n)=>(n in t)}var F=Object.assign;var je=Object.prototype.hasOwnProperty,j=(e,t)=>je.call(e,t),R=Array.isArray,C=(e)=>he(e)==="[object Map]";var de=(e)=>typeof e==="function",He=(e)=>typeof e==="string",O=(e)=>typeof e==="symbol",D=(e)=>e!==null&&typeof e==="object";var Ue=Object.prototype.toString,he=(e)=>Ue.call(e),me=(e)=>he(e).slice(8,-1);var H=(e)=>He(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e;var U=(e)=>{let t=Object.create(null);return(n)=>t[n]||(t[n]=e(n))},Ke=/-\w/g,ht=U((e)=>e.replace(Ke,(t)=>t.slice(1).toUpperCase())),ze=/\B([A-Z])/g,gt=U((e)=>e.replace(ze,"-$1").toLowerCase()),_e=U((e)=>e.charAt(0).toUpperCase()+e.slice(1)),mt=U((e)=>e?`on${_e(e)}`:""),E=(e,t)=>!Object.is(e,t);var We="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly";var _t=q(We+",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");var d;class Ee{constructor(e=!1){if(this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&d)if(d.active)this.parent=d,this.index=(d.scopes||(d.scopes=[])).push(this)-1;else this._active=!1,this._warnOnRun=!1}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active){if(this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let r=this.scopes.slice();for(e=0,t=r.length;e<t;e++)r[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}}run(e){if(this._active){let t=d;try{return d=this,e()}finally{d=t}}}on(){if(++this._on===1)this.prevScope=d,d=this}off(){if(this._on>0&&--this._on===0){if(d===this)d=this.prevScope;else{let e=d;while(e){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();this.effects.length=0;for(t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let r=this.scopes.slice();for(t=0,n=r.length;t<n;t++)r[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let r=this.parent.scopes.pop();if(r&&r!==this)this.parent.scopes[this.index]=r,r.index=this.index}this.parent=void 0}}}function ge(e){return new Ee(e)}function Xa(e,t=!1){if(d)d.cleanups.push(e)}var f;var X=new WeakSet;class W{constructor(e){if(this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,d)if(d.active)d.effects.push(this);else this.flags&=-2}pause(){this.flags|=64}resume(){if(this.flags&64){if(this.flags&=-65,X.has(this))X.delete(this),this.trigger()}}notify(){if(this.flags&2&&!(this.flags&32))return;if(!(this.flags&8))Se(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,ye(this),we(this);let e=f,t=m;f=this,m=!0;try{return this.fn()}finally{Te(this),f=e,m=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ae(e);this.deps=this.depsTail=void 0,ye(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){if(this.flags&64)X.add(this);else if(this.scheduler)this.scheduler();else this.runIfDirty()}runIfDirty(){if(ee(this))this.run()}get dirty(){return ee(this)}}var be=0,M,L;function Se(e,t=!1){if(e.flags|=8,t){e.next=L,L=e;return}e.next=M,M=e}function se(){be++}function oe(){if(--be>0)return;if(L){let t=L;L=void 0;while(t){let n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;while(M){let t=M;M=void 0;while(t){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){if(!e)e=r}t=n}}if(e)throw e}function we(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Te(e){let t,n=e.depsTail,r=n;while(r){let i=r.prevDep;if(r.version===-1){if(r===n)n=i;ae(r),Ge(r)}else t=r;r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}e.deps=t,e.depsTail=n}function ee(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Ne(t.dep.computed)||t.dep.version!==t.version))return!0;if(e._dirty)return!0;return!1}function Ne(e){if(e.flags&4&&!(e.flags&16))return;if(e.flags&=-17,e.globalVersion===P)return;if(e.globalVersion=P,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ee(e)))return;e.flags|=2;let t=e.dep,n=f,r=m;f=e,m=!0;try{we(e);let i=e.fn(e._value);if(t.version===0||E(i,e._value))e.flags|=128,e._value=i,t.version++}catch(i){throw t.version++,i}finally{f=n,m=r,Te(e),e.flags&=-3}}function ae(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r)r.nextSub=i,e.prevSub=void 0;if(i)i.prevSub=r,e.nextSub=void 0;if(n.subs===e){if(n.subs=r,!r&&n.computed){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)ae(s,!0)}}if(!t&&!--n.sc&&n.map)n.map.delete(n.key)}function Ge(e){let{prevDep:t,nextDep:n}=e;if(t)t.nextDep=n,e.prevDep=void 0;if(n)n.prevDep=t,e.nextDep=void 0}function Q(e,t){if(e.effect instanceof W)e=e.effect.fn;let n=new W(e);if(t)F(n,t);try{n.run()}catch(i){throw n.stop(),i}let r=n.run.bind(n);return r.effect=n,r}var m=!0,xe=[];function sh(){xe.push(m),m=!1}function ah(){let e=xe.pop();m=e===void 0?!0:e}function qx(e,t=!1){if(f instanceof W)f.cleanup=e}function ye(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let n=f;f=void 0;try{t()}finally{f=n}}}var P=0;class Ae{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Y{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!f||!m||f===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==f){if(t=this.activeLink=new Ae(f,this),!f.deps)f.deps=f.depsTail=t;else t.prevDep=f.depsTail,f.depsTail.nextDep=t,f.depsTail=t;Re(t)}else if(t.version===-1){if(t.version=this.version,t.nextDep){let n=t.nextDep;if(n.prevDep=t.prevDep,t.prevDep)t.prevDep.nextDep=n;if(t.prevDep=f.depsTail,t.nextDep=void 0,f.depsTail.nextDep=t,f.depsTail=t,f.deps===t)f.deps=n}}return t}trigger(e){this.version++,P++,this.notify(e)}notify(e){se();try{for(let t=this.subs;t;t=t.prevSub)if(t.sub.notify())t.sub.dep.notify()}finally{oe()}}}function Re(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)Re(r)}let n=e.dep.subs;if(n!==e){if(e.prevSub=n,n)n.nextSub=e}e.dep.subs=e}}var te=new WeakMap,x=Symbol(""),ne=Symbol(""),V=Symbol("");function h(e,t,n){if(m&&f){let r=te.get(e);if(!r)te.set(e,r=new Map);let i=r.get(n);if(!i)r.set(n,i=new Y),i.map=r,i.key=n;i.track()}}function T(e,t,n,r,i,s){let o=te.get(e);if(!o){P++;return}let a=(c)=>{if(c)c.trigger()};if(se(),t==="clear")o.forEach(a);else{let c=R(e),l=c&&H(n);if(c&&n==="length"){let u=Number(r);o.forEach((p,g)=>{if(g==="length"||g===V||!O(g)&&g>=u)a(p)})}else{if(n!==void 0||o.has(void 0))a(o.get(n));if(l)a(o.get(V));switch(t){case"add":if(!c){if(a(o.get(x)),C(e))a(o.get(ne))}else if(l)a(o.get("length"));break;case"delete":if(!c){if(a(o.get(x)),C(e))a(o.get(ne))}break;case"set":if(C(e))a(o.get(x));break}}}oe()}function k(e){let t=re(e);if(t===e)return t;if(h(t,"iterate",V),N(e))return t;if(!w(e))return t.map(y);return Vm(e)?t.map((n)=>A(y(n))):t.map(A)}function ce(e){return h(e=re(e),"iterate",V),e}function _(e,t){if(w(e))return Vm(e)?A(y(t)):A(t);return y(t)}var $e={__proto__:null,[Symbol.iterator](){return J(this,Symbol.iterator,(e)=>_(this,e))},concat(...e){return k(this).concat(...e.map((t)=>R(t)?k(t):t))},entries(){return J(this,"entries",(e)=>(e[1]=_(this,e[1]),e))},every(e,t){return b(this,"every",e,t,void 0,arguments)},filter(e,t){return b(this,"filter",e,t,(n)=>n.map((r)=>_(this,r)),arguments)},find(e,t){return b(this,"find",e,t,(n)=>_(this,n),arguments)},findIndex(e,t){return b(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return b(this,"findLast",e,t,(n)=>_(this,n),arguments)},findLastIndex(e,t){return b(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return b(this,"forEach",e,t,void 0,arguments)},includes(...e){return Z(this,"includes",e)},indexOf(...e){return Z(this,"indexOf",e)},join(e){return k(this).join(e)},lastIndexOf(...e){return Z(this,"lastIndexOf",e)},map(e,t){return b(this,"map",e,t,void 0,arguments)},pop(){return I(this,"pop")},push(...e){return I(this,"push",e)},reduce(e,...t){return ve(this,"reduce",e,t)},reduceRight(e,...t){return ve(this,"reduceRight",e,t)},shift(){return I(this,"shift")},some(e,t){return b(this,"some",e,t,void 0,arguments)},splice(...e){return I(this,"splice",e)},toReversed(){return k(this).toReversed()},toSorted(e){return k(this).toSorted(e)},toSpliced(...e){return k(this).toSpliced(...e)},unshift(...e){return I(this,"unshift",e)},values(){return J(this,"values",(e)=>_(this,e))}};function J(e,t,n){let r=ce(e),i=r[t]();if(r!==e&&!N(e))i._next=i.next,i.next=()=>{let s=i._next();if(!s.done)s.value=n(s.value);return s};return i}var Ye=Array.prototype;function b(e,t,n,r,i,s){let o=ce(e),a=o!==e&&!N(e),c=o[t];if(c!==Ye[t]){let p=c.apply(e,s);return a?y(p):p}let l=n;if(o!==e){if(a)l=function(p,g){return n.call(this,_(e,p),g,e)};else if(n.length>2)l=function(p,g){return n.call(this,p,g,e)}}let u=c.call(o,l,r);return a&&i?i(u):u}function ve(e,t,n,r){let i=ce(e),s=i!==e&&!N(e),o=n,a=!1;if(i!==e){if(s)a=r.length===0,o=function(l,u,p){if(a)a=!1,l=_(e,l);return n.call(this,l,_(e,u),p,e)};else if(n.length>3)o=function(l,u,p){return n.call(this,l,u,p,e)}}let c=i[t](o,...r);return a?_(e,c):c}function Z(e,t,n){let r=re(e);h(r,"iterate",V);let i=r[t](...n);if((i===-1||i===!1)&&ot(n[0]))return n[0]=re(n[0]),r[t](...n);return i}function I(e,t,n=[]){sh(),se();let r=re(e)[t].apply(e,n);return oe(),ah(),r}var Be=q("__proto__,__v_isRef,__isVue"),Oe=new Set(Object.getOwnPropertyNames(Symbol).filter((e)=>e!=="arguments"&&e!=="caller").map((e)=>Symbol[e]).filter(O));function qe(e){if(!O(e))e=String(e);let t=re(this);return h(t,"has",e),t.hasOwnProperty(e)}class le{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t==="__v_skip")return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t==="__v_isReactive")return!r;else if(t==="__v_isReadonly")return r;else if(t==="__v_isShallow")return i;else if(t==="__v_raw"){if(n===(r?i?rt:Ie:i?Ce:ke).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n))return e;return}let s=R(e);if(!r){let a;if(s&&(a=$e[t]))return a;if(t==="hasOwnProperty")return qe}let o=Reflect.get(e,t,Hd(e)?e:n);if(O(t)?Oe.has(t):Be(t))return o;if(!r)h(e,"get",t);if(i)return o;if(Hd(o)){let a=s&&H(t)?o:o.value;return r&&D(a)?G(a):a}if(D(o))return r?G(o):v(o);return o}}class fe extends le{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],s=R(e)&&H(t);if(!this._isShallow){let c=w(i);if(!N(n)&&!w(n))i=re(i),n=re(n);if(!s&&Hd(i)&&!Hd(n))if(c)return!0;else return i.value=n,!0}let o=s?Number(t)<e.length:j(e,t),a=Reflect.set(e,t,n,Hd(e)?e:r);if(e===re(r)&&a){if(!o)T(e,"add",t,n);else if(E(n,i))T(e,"set",t,n,i)}return a}deleteProperty(e,t){let n=j(e,t),r=e[t],i=Reflect.deleteProperty(e,t);if(i&&n)T(e,"delete",t,void 0,r);return i}has(e,t){let n=Reflect.has(e,t);if(!O(t)||!Oe.has(t))h(e,"has",t);return n}ownKeys(e){return h(e,"iterate",R(e)?"length":x),Reflect.ownKeys(e)}}class De extends le{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}var Xe=new fe,Je=new De,Ze=new fe(!0);var ie=(e)=>e,K=(e)=>Reflect.getPrototypeOf(e);function Qe(e,t,n){return function(...r){let i=this.__v_raw,s=re(i),o=C(s),a=e==="entries"||e===Symbol.iterator&&o,c=e==="keys"&&o,l=i[e](...r),u=n?ie:t?A:y;return!t&&h(s,"iterate",c?ne:x),F(Object.create(l),{next(){let{value:p,done:g}=l.next();return g?{value:p,done:g}:{value:a?[u(p[0]),u(p[1])]:u(p),done:g}}})}}function z(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function et(e,t){let n={get(i){let s=this.__v_raw,o=re(s),a=re(i);if(!e){if(E(i,a))h(o,"get",i);h(o,"get",a)}let{has:c}=K(o),l=t?ie:e?A:y;if(c.call(o,i))return l(s.get(i));else if(c.call(o,a))return l(s.get(a));else if(s!==o)s.get(i)},get size(){let i=this.__v_raw;return!e&&h(re(i),"iterate",x),i.size},has(i){let s=this.__v_raw,o=re(s),a=re(i);if(!e){if(E(i,a))h(o,"has",i);h(o,"has",a)}return i===a?s.has(i):s.has(i)||s.has(a)},forEach(i,s){let o=this,a=o.__v_raw,c=re(a),l=t?ie:e?A:y;return!e&&h(c,"iterate",x),a.forEach((u,p)=>i.call(s,l(u),l(p),o))}};return F(n,e?{add:z("add"),set:z("set"),delete:z("delete"),clear:z("clear")}:{add(i){let s=re(this),o=K(s),a=re(i),c=!t&&!N(i)&&!w(i)?a:i;if(!(o.has.call(s,c)||E(i,c)&&o.has.call(s,i)||E(a,c)&&o.has.call(s,a)))s.add(c),T(s,"add",c,c);return this},set(i,s){if(!t&&!N(s)&&!w(s))s=re(s);let o=re(this),{has:a,get:c}=K(o),l=a.call(o,i);if(!l)i=re(i),l=a.call(o,i);let u=c.call(o,i);if(o.set(i,s),!l)T(o,"add",i,s);else if(E(s,u))T(o,"set",i,s,u);return this},delete(i){let s=re(this),{has:o,get:a}=K(s),c=o.call(s,i);if(!c)i=re(i),c=o.call(s,i);let l=a?a.call(s,i):void 0,u=s.delete(i);if(c)T(s,"delete",i,void 0,l);return u},clear(){let i=re(this),s=i.size!==0,o=void 0,a=i.clear();if(s)T(i,"clear",void 0,void 0,void 0);return a}}),["keys","values","entries",Symbol.iterator].forEach((i)=>{n[i]=Qe(i,e,t)}),n}function ue(e,t){let n=et(e,t);return(r,i,s)=>{if(i==="__v_isReactive")return!e;else if(i==="__v_isReadonly")return e;else if(i==="__v_raw")return r;return Reflect.get(j(n,i)&&i in r?n:r,i,s)}}var tt={get:ue(!1,!1)},nt={get:ue(!1,!0)},it={get:ue(!0,!1)};var ke=new WeakMap,Ce=new WeakMap,Ie=new WeakMap,rt=new WeakMap;function st(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function v(e){if(w(e))return e;return pe(e,!1,Xe,tt,ke)}function Wm(e){return pe(e,!1,Ze,nt,Ce)}function G(e){return pe(e,!0,Je,it,Ie)}function pe(e,t,n,r,i){if(!D(e))return e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;if(e.__v_skip||!Object.isExtensible(e))return e;let s=i.get(e);if(s)return s;let o=st(me(e));if(o===0)return e;let a=new Proxy(e,o===2?r:n);return i.set(e,a),a}function Vm(e){if(w(e))return Vm(e.__v_raw);return!!(e&&e.__v_isReactive)}function w(e){return!!(e&&e.__v_isReadonly)}function N(e){return!!(e&&e.__v_isShallow)}function ot(e){return e?!!e.__v_raw:!1}function re(e){let t=e&&e.__v_raw;return t?re(t):e}var y=(e)=>D(e)?v(e):e,A=(e)=>D(e)?G(e):e;function Hd(e){return e?e.__v_isRef===!0:!1}function Qa(e){return Me(e,!1)}function el(e){return Me(e,!0)}function Me(e,t){if(Hd(e))return e;return new Le(e,t)}class Le{constructor(e,t){this.dep=new Y,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:re(e),this._value=t?e:y(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||N(e)||w(e);if(e=n?e:re(e),E(e,t))this._rawValue=e,this._value=n?e:y(e),this.dep.trigger()}}class Pe{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Y(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=P-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&f!==this)return Se(this,!0),!0}get value(){let e=this.dep.track();if(Ne(this),e)e.version=this.dep.version;return this._value}set value(e){if(this.setter)this.setter(e)}}function Bd(e,t,n=!1){let r,i;if(de(e))r=e;else r=e.get,i=e.set;return new Pe(r,i,n)}var at={assertive:"jx-live-assertive",polite:"jx-live-polite"};function ct(e){if(typeof document>"u")return null;let t=at[e],n=document.querySelector(`#${t}`);if(n)return n;let r=document.createElement("div");return r.id=t,r.setAttribute("aria-live",e),r.setAttribute("role",e==="assertive"?"alert":"status"),r.setAttribute("aria-atomic","true"),r.style.cssText="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0",document.body.append(r),r}function Pv(e,t="polite"){if(e==="")return;let n=ct(t);if(!n)return;n.textContent="",setTimeout(()=>{n.textContent=e},0)}var Ve=null;function Zi(){return Ve??Date.now()}function PI(e){let t=e instanceof Date?e.getTime():typeof e==="number"?e:Date.parse(e);if(!Number.isFinite(t))throw TypeError(`clock: cannot pin to ${JSON.stringify(e)}`);return Ve=t,t}var lt={error:"problem",info:"toast",success:"toast",warn:"toast"},ft={error:8000,info:4000,success:4000,warn:8000},Fe=0;function ut(){return Fe+=1,`n${Fe}`}var $c=v([]),Jr=v([]),pt=4;function dt(e){return e==="problem"?Jr:$c}function S(e,t,n={}){let r=n.tier??lt[e],i={at:Zi(),id:ut(),message:t,severity:e,tier:r,...n.action===void 0?{}:{action:n.action},...n.actionArgs===void 0?{}:{actionArgs:n.actionArgs},...n.detail===void 0?{}:{detail:n.detail},...n.source===void 0?{}:{source:n.source},...n.path===void 0?{}:{path:n.path},...n.key===void 0?{}:{key:n.key},...r==="toast"?{timeoutMs:n.timeoutMs??ft[e]}:{}},s=dt(r);if(i.key!==void 0){let o=s.findIndex((a)=>a.key===i.key);if(o!==-1)s.splice(o,1)}if(s.push(i),r==="toast")while($c.length>pt)$c.shift();return Pv(i.source===void 0?i.message:`${i.source}: ${i.message}`,e==="error"?"assertive":"polite"),i}function B(e){return(t,n={})=>S(e,t,n)}S.success=B("success");S.info=B("info");S.warn=B("warn");S.error=B("error");function zd(e){for(let t of[$c,Jr]){let n=t.findIndex((r)=>r.id===e);if(n!==-1)return t.splice(n,1),!0}return!1}function tl(e){let t=e?Jr.filter((r)=>!e(r)):[],n=Jr.length-t.length;return Jr.splice(0,Jr.length,...t),n}function lh(e){let t=[];for(let n of Jr){if(n.source!==e)continue;let r={message:n.message,severity:n.severity};if(n.detail!==void 0)r.detail=n.detail;if(n.path!==void 0)r.path=n.path;if(n.key!==void 0)r.key=n.key;if(n.action!==void 0)r.action=n.action;if(n.actionArgs!==void 0)r.actionArgs=n.actionArgs;t.push(r)}return t}function Fp(e){return e===void 0?Jr.length:Jr.filter((t)=>t.severity===e).length}export{ge,Xa,Q,sh,ah,qx,v,Wm,Vm,re,Hd,Qa,el,Bd,Pv,Zi,PI,$c,Jr,S,zd,tl,lh,Fp};
|
|
2
|
+
|
|
3
|
+
//# debugId=18B58B8A75C08C9E64756E2164756E21
|
|
4
|
+
//# sourceMappingURL=studio-0nm2skex.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Ot,
|
|
2
|
-
export{
|
|
1
|
+
import{Ot,rh,Ve}from"./studio-p6avneaq.js";var Rm=400;var Tc=350,dI=30000;function K(e,t){let n=e;for(let r of t){if(n==null)return;n=n[r]}return n}function so(e){return Array.isArray(e?.children)?e.children:[]}function $m(e){if(!e||typeof e!=="object")return e;if(Array.isArray(e)){for(let r of e)$m(r);return e}let t=e,{children:n}=t;if(n&&typeof n==="object"&&!Array.isArray(n)&&n.$prototype==="Array")t.children=[n];if(Array.isArray(t.children))for(let r of t.children)$m(r);if(t.$prototype==="Array"&&t.map&&typeof t.map==="object")$m(t.map);if(t.cases&&typeof t.cases==="object")for(let r of Object.values(t.cases))$m(r);return e}function ht(e){return e.length>=2?e.slice(0,-2):null}function _n(e){return e.at(-1)}function aS(e){return e.join("/")}function Xo(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;return e.every((n,r)=>n===t[r])}function qa(e,t){if(e.length>t.length)return!1;return e.every((n,r)=>n===t[r])}function Ad(e,t=[],n=0){let r=[];return l(e,t,n,r,!1),r}function l(e,t,n,r,o){if(typeof e==="string"||typeof e==="number"||typeof e==="boolean"){if(!o)r.push({depth:n,node:e,nodeType:"text",path:t});return}if(e.$prototype==="Array"){if(!o)r.push({depth:n,node:e,nodeType:"map",path:t});let s=e.map;if(s&&typeof s==="object")l(s,[...t,"map"],n+1,r,!1);return}if(!o)r.push({depth:n,node:e,nodeType:"element",path:t});if(e.$props&&Ve(e.tagName).includes("-")&&!Array.isArray(e.children))return;let{children:i}=e;if(Array.isArray(i))for(let s=0;s<i.length;s++){let a=[...t,"children",s];l(i[s],a,n+1,r,!1)}else if(i&&typeof i==="object"&&i.$prototype==="Array")l(i,[...t,"children"],n+1,r,!1);if(e.$switch&&e.cases&&typeof e.cases==="object")for(let[s,a]of Object.entries(e.cases)){let c=[...t,"cases",s];if(a&&typeof a==="object"&&a.$ref)r.push({depth:n+1,node:a,nodeType:"case-ref",path:c});else if(a&&typeof a==="object")r.push({depth:n+1,node:a,nodeType:"case",path:c}),l(a,c,n+2,r,!0)}}function Mo(e){if(!e)return"?";if(e.$prototype==="Array"){let{items:r}=e;return`Repeater → ${(Ot(r)?r.$ref:void 0)||"items"}`}if(e.$title)return e.$title;if(e.$id)return e.$id;if(e.tagName==="slot"){let r=e.attributes?.name;return typeof r==="string"&&r.trim()?`slot: ${r.trim()}`:"slot"}let t=Ve(e.tagName)||"div",n=e.$switch?" ⇆":"";if(typeof e.textContent==="string"&&e.textContent.length>0)return`${t} — ${e.textContent.slice(0,24)}${n}`;return t+n}var D=null;function Hl(e){D=e}function vt(){return D}function Xu(e){if(!e||typeof e!=="object")return e;if(Array.isArray(e))return e.map((n)=>Xu(n));let t={};for(let[n,r]of Object.entries(e)){if(n.startsWith("on")&&rh(r))continue;if(n==="children")t.children=Array.isArray(r)?r.map((o)=>Xu(o)):Xu(r);else if(n==="cases"&&typeof r==="object"){let o={};for(let[i,s]of Object.entries(r))o[i]=Xu(s);t.cases=o}else if(n==="state"&&typeof r==="object"&&r!==null){let o={};for(let[i,s]of Object.entries(r)){if(s&&typeof s==="object"&&s.timing==="server")continue;o[i]=s}t.state=o}else if(n==="style"||n==="attributes"||n==="$media")t[n]=r;else t[n]=r}return t}var jx=null,Qu=null,lS=null,cS=null,Hx=null;function uI(){jx=document.querySelector("#activity-bar"),Qu=document.querySelector("#left-panel"),lS=document.querySelector("#right-panel"),cS=document.querySelector("#toolbar"),Hx=document.querySelector("#statusbar")}var Ep=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),dS=[":hover",":focus",":active",":focus-within",":focus-visible",":disabled",":first-child",":last-child","::before","::after","::placeholder"];function Bx(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}var u=new Map;function Ev(e,t,n){let r=t??Rm;return(...o)=>{clearTimeout(u.get(e)),u.set(e,setTimeout(()=>{u.delete(e),n(...o)},r))}}function hI(e){clearTimeout(u.get(e)),u.delete(e)}var p=new Map,f=0;function pI(){return f}function d(e,t){f+=1;let n=()=>{f-=1},r=null;try{let o=t();if(typeof o?.then==="function")r=o}catch(o){console.error(`Renderer "${e}" failed:`,o)}if(!r){n();return}r.then(n,(o)=>{console.error(`Renderer "${e}" failed:`,o),n()})}function eh(e,t){p.set(e,t)}function Po(){for(let[e,t]of p.entries())d(e,t)}function Ni(...e){for(let t of e){let n=p.get(t);if(!n)continue;d(t,n)}}function Lc(e,t){if(e){if(t.selection!==void 0)e.session.selection=t.selection;if(t.hover!==void 0)e.session.hover=t.hover;if(t.clipboard!==void 0)e.session.clipboard=t.clipboard;if(t.ui)for(let[n,r]of Object.entries(t.ui))e.session.ui[n]=r;if(t.canvas)for(let[n,r]of Object.entries(t.canvas))e.session.canvas[n]=r}}function qr(e,t,n){if(e)e.session.ui[t]=n}function fI(e,t){if(e)for(let[n,r]of Object.entries(t))e.session.canvas[n]=r}
|
|
2
|
+
export{Rm,Tc,dI,K,so,$m,ht,_n,aS,Xo,qa,Ad,Mo,D,Hl,vt,Xu,jx,Qu,lS,cS,Hx,uI,Ep,dS,Bx,Ev,hI,pI,eh,Po,Ni,Lc,qr,fI};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=F3BCCAE78F8C420864756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-153mwkyq.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{hn,sn,ne}from"./studio-sq1bn60g.js";import{f}from"./studio-jsv3s3s1.js";import{v}from"./studio-9rhmettf.js";import{ud,FE,Gf,w1,jE,ra,Qh}from"./studio-yh3nggx1.js";import{Sf,f_}from"./studio-7z69g1gx.js";import{Rs}from"./studio-pve0b2f2.js";import{rt,zt,T,R,Nn,Lt}from"./studio-zmecp6hq.js";import{D}from"./studio-73czgk6a.js";import{me}from"./studio-7gqyhjns.js";var P={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPublish",$description:"Publish: the one-click Cloudflare Pages flow, as a `jx-dialog` over the kit. Eight bodies, one at a time, because the reader is at exactly one point of a chain — a host that cannot reach Cloudflare at all, a question still in flight, a connection that lapsed, an invitation to connect, a stored token Cloudflare refused, a field to paste a replacement into, the create-and-connect form, and the connected status. `publish/publish-panel.ts` keeps every one of those decisions and the calls that settle them; this document knows only which of the eight it was told to draw. **The token is never painted.** The field below binds no `value` — it is written by the reader and read once, on its way to storage — so a stored secret cannot reach the attribute, the serialised HTML or the accessibility tree, which is `studio.md` §15 rule 1 written as a missing binding rather than as a rule somebody remembers.",tagName:"jx-dialog",$props:{headline:"Publish",confirmLabel:"",cancelLabel:"Close",size:"md"},attributes:{part:"publish"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"What the five `.publish-*` names carried, keyed on `part`, and most of them do not survive the move. `.publish-modal` and its `.new-project-modal` base were a fixed card, a scroll body, a border, a shadow and a `z-index: 1000` — a modal `<dialog>` is every one of those, and the top layer is what the z-index was climbing towards. `.publish-field` was a label stacked over a control, which is `jx-field`'s whole shape. What is left is the column gap between bodies, the two button rows, the hint and the refusal. Nothing here uses `--spectrum-*`: those custom properties resolve only inside `<sp-theme>`, and a document mounted in a layer host is outside it, so each would silently have taken its hard-coded fallback.",'& [part="body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="note"], & [part="status-line"], & [part="deployment"]':{margin:"0",lineHeight:"1.5"},'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="actions"]':{$description:'Wraps rather than overflows (studio-ui-guidelines.md §4.6): two buttons whose labels are whole phrases — "Verify & Connect", "Preferences › Accounts" — are wider than a narrow dialog at the sizes a reader may have set.',display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)"},'& [part="submit"]':{alignSelf:"flex-start"},'& [part="hint"]':{$description:"Publishing rides every commit, so the connected body's only job is to say what is already happening. Dim, because it is a standing fact rather than something to act on.",margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="failure"]':{$description:'`failure` and not `error`: `jx-textfield` and `jx-select` each draw a `[part="error"]` of their own inside this same tree, and the kit is light DOM — a scoped rule on that name would restyle the token field\'s refusal line too.',margin:"0",color:"var(--danger)",lineHeight:"1.5"},'& [part="link"], & [part="install-link"]':{color:"var(--accent)",textDecoration:"underline"},"& code":{fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)"}},children:[{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{unsupported:{tagName:"p",attributes:{part:"note"},children:["This platform cannot reach the Cloudflare API. Publish by committing and pushing — your host builds ",{tagName:"code",textContent:"bunx jx build"}," and serves ",{tagName:"code",textContent:"dist/"},"."]},loading:{tagName:"p",attributes:{part:"note"},textContent:"Checking Cloudflare connection…"},lapsed:{tagName:"div",attributes:{part:"lapsed",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Your Cloudflare connection has expired, so publishing cannot reach your account. Reconnect to restore it — this site's Pages project and its settings are untouched."},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"reconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"${state.connectLabel}"}]}]},hosted:{tagName:"div",attributes:{part:"hosted",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Connect your Cloudflare account to publish this site."},{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"connect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"Connect Cloudflare"}]}]},stored:{tagName:"div",attributes:{part:"stored",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"A Cloudflare API token is stored on this machine, and Cloudflare did not accept it. It may have been revoked, or it may be missing the Account Settings Read and Pages Read/Write permissions."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"replace"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[]}]},children:[{tagName:"span",textContent:"Replace token"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},token:{tagName:"div",attributes:{part:"token-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Paste a Cloudflare API token (permissions: Account Settings Read, Pages Read/Write). It is stored on this machine and only sent to the same-origin proxy — Studio never renders it back."},{tagName:"jx-field",$props:{span:!0,label:"API token"},attributes:{part:"token-row","data-field":"token"},children:[{tagName:"jx-textfield",$description:"No `value` binding, and its absence is the contract: a secret may pass through a field the reader typed it into and may never be painted into one they did not. The draft lives in the adapter's closure until Verify reads it, so nothing here — not the attribute, not the accessibility tree, not a DOM dump — has ever held it.",$props:{type:"password",placeholder:"cf_..."},attributes:{part:"token"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setToken"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"verify"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/verify"},value:[]}]},children:[{tagName:"span",textContent:"Verify & Connect"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},form:{tagName:"div",attributes:{part:"connect-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},children:["Create a Cloudflare Pages project connected to this repository. Every commit then builds and publishes automatically (",{tagName:"code",textContent:"bunx jx build"},")."]},{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Account"},attributes:{part:"row","data-field":"account"},children:[{tagName:"jx-select",$props:{options:{$ref:"#/state/accountOptions"},value:{$ref:"#/state/accountId"}},attributes:{part:"account"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAccount"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Pages project name"},attributes:{part:"row","data-field":"projectName"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/projectName"}},attributes:{part:"project-name"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setProjectName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub owner"},attributes:{part:"row","data-field":"owner"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/owner"}},attributes:{part:"owner"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub repository"},attributes:{part:"row","data-field":"repo"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/repo"}},attributes:{part:"repo"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRepo"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Production branch"},attributes:{part:"row","data-field":"branch"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/branch"}},attributes:{part:"branch"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBranch"},value:[{$ref:"event#/target/value"}]}]}}]}]},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"submit"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/submit"},value:[]}]},children:[{tagName:"span",textContent:"${state.submitLabel}"}]}]},status:{tagName:"div",attributes:{part:"status",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"status-line"},children:["Connected to Pages project ",{tagName:"strong",attributes:{part:"project-name"},textContent:"${state.deployProject}"},{tagName:"span",attributes:{part:"site-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProductionUrl"},cases:{true:{tagName:"span",children:[" — ",{tagName:"a",attributes:{part:"link",href:"${state.productionUrl}",target:"_blank",rel:"noreferrer"},textContent:"${state.productionUrl}"}]}}}]},{tagName:"div",attributes:{part:"deployment-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDeployment"},cases:{true:{tagName:"p",attributes:{part:"deployment"},children:["Latest deployment: ",{tagName:"strong",attributes:{part:"deployment-state"},textContent:"${state.deploymentState}"}," (${state.deploymentEnvironment}) — ",{tagName:"a",attributes:{part:"link",href:"${state.deploymentUrl}",target:"_blank",rel:"noreferrer"},textContent:"preview"}]},false:{tagName:"p",attributes:{part:"deployment"},textContent:"No deployments yet — the first commit after connecting triggers one."}}},{tagName:"p",attributes:{part:"hint"},textContent:"Publishing happens automatically on every commit."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]},children:[{tagName:"span",textContent:"Refresh"}]},{tagName:"jx-button",$props:{variant:"negative",disabled:{$ref:"#/state/busy"}},attributes:{part:"disconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/disconnect"},value:[]}]},children:[{tagName:"span",textContent:"Disconnect"}]}]}]}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFailure"},cases:{true:{tagName:"p",attributes:{part:"failure"},children:["${state.failure}",{tagName:"span",attributes:{part:"pages-app-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/needsPagesApp"},cases:{true:{tagName:"span",children:[" — if the Cloudflare Pages GitHub App is not installed on the repository, ",{tagName:"a",attributes:{part:"install-link",href:"${state.pagesAppUrl}",target:"_blank",rel:"noreferrer"},textContent:"install it"}," and retry."]}}}]}}}]}]};T("publish",P);var S="https://github.com/apps/cloudflare-pages/installations/new";function F(e){if(!e.supported)return"unsupported";if(e.loading)return"loading";if(e.connected&&e.lapsed)return"lapsed";if(!e.connected){if(e.hosted)return"hosted";return e.tokenStored&&!e.replacing?"stored":"token"}return e.deploy?"status":"form"}function w(e){let{error:t}=e;return{accountId:e.form.accountId,accountOptions:e.accounts,body:F(e),branch:e.form.branch,busy:e.busy,connectLabel:e.busy?"Reconnecting…":"Reconnect Cloudflare",deploymentEnvironment:e.deployment?.environment??"",deploymentState:e.deployment?`${e.deployment.stage}: ${e.deployment.status}`:"",deploymentUrl:e.deployment?.url??"",deployProject:e.deploy?.projectName??"",failure:t,hasDeployment:e.deployment!==null,hasFailure:t!=="",hasProductionUrl:(e.deploy?.productionUrl??"")!=="",needsPagesApp:/github/i.test(t)&&/app|install|source|repo/i.test(t),owner:e.form.owner,pagesAppUrl:S,productionUrl:e.deploy?.productionUrl??"",projectName:e.form.projectName,repo:e.form.repo,submitLabel:e.busy?"Connecting…":"Create & Connect"}}function C(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let l="",g=!1,N=()=>{if(g)return;g=!0,e.onClosed()},p=v({...w(e.view),closed:N,connect:()=>{e.onConnect()},disconnect:()=>{e.onDisconnect()},openAccounts:()=>{e.onOpenAccounts()},refresh:()=>{e.onRefresh()},replace:()=>{l="",e.onReplaceToken()},setAccount:(o)=>{p.accountId=o,e.onField("accountId",o)},setBranch:(o)=>{p.branch=o,e.onField("branch",o)},setOwner:(o)=>{p.owner=o,e.onField("owner",o)},setProjectName:(o)=>{p.projectName=o,e.onField("projectName",o)},setRepo:(o)=>{p.repo=o,e.onField("repo",o)},setToken:(o)=>{l=o},submit:()=>{e.onSubmit()},verify:()=>{let o=l;l="",e.onSaveToken(o)}}),b=null,k=R("publish",p,t).then(async(o)=>{b=o;let d=o.root;if(g)return o.dispose(),d;if(await Nn(d),g)return d;return(d.querySelector('dialog[part="dialog"]')??d).setAttribute(rt,zt("modal","publish")),hn(d),d});return{close(){let o=b?.root;if(o instanceof HTMLElement)sn(o);b?.dispose(),b=null,l="",t.remove(),N()},host:t,ready:k,update(o){Object.assign(p,w(o))}}}var u=null,s="loading",m=[],i=null,a="",c=!1,h=!1,n={accountId:"",branch:"main",owner:"",projectName:"",repo:""};function x(){return D?.projectConfig??null}function I(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-+|-+$/g,"").slice(0,58)||"site"}function H(){let e=f().projectRoot,t=/^([\w.-]+)\/([\w.-]+)(?:@.+)?$/.exec(e);return t?{owner:t[1],repo:t[2]}:{owner:"",repo:""}}function L(){let e=ra();return e?{productionUrl:e.productionUrl??"",projectName:e.projectName}:null}function j(){let e=ud(),t=s==="loading"?null:s;return{accounts:m.map((l)=>({label:l.name,value:l.id})),busy:c,connected:t?.connected===!0,deploy:L(),deployment:i?{environment:i.environment,stage:i.stage,status:i.status,url:i.url}:null,error:a,form:{...n},hosted:e&&typeof f().cfConnect==="function",lapsed:t?.connected===!0&&t.needsReconnect===!0,loading:s==="loading",replacing:h,supported:e,tokenStored:Sf()!==""}}function r(){if(u){u.update(j());return}u=C({layer:Lt("modal"),onClosed:V,onConnect:()=>{O()},onDisconnect:()=>{M()},onField:(e,t)=>{n={...n,[e]:t}},onOpenAccounts:E,onRefresh:()=>{y()},onReplaceToken:()=>{h=!0,a="",r()},onSaveToken:(e)=>{U(e)},onSubmit:()=>{_()},view:j()})}async function y(){s="loading",r();try{if(s=await f().cfConnection?.()??null,s?.connected&&!s.needsReconnect){m=await FE(),n={...n,accountId:s.accountId??m[0]?.id??""};let e=ra();if(e)i=await Gf(e),Qh(i)}}catch(e){s=null,a=e instanceof Error?e.message:String(e)}r()}async function U(e){let t=e.trim();if(!t){a="Paste a token, or use Preferences › Accounts to forget the stored one.",r();return}f_(t),h=!1,a="",await y()}function E(){ne()?.run("app.preferences",{section:"accounts"})}async function O(){c=!0,a="",r();try{let e=await f().cfConnect?.()??null;if(e?.status==="timeout")a="The Cloudflare window didn't finish. Sign in there, then reconnect — nothing was changed.";else if(e?.status==="connected"&&!e.connection.accountId){let{openCfAccountPicker:t}=await (me("gnm7xeqb"),import("./cf-account-picker-gnm7xeqb.js"));await t()}}catch(e){a=e instanceof Error?e.message:String(e)}c=!1,Rs(),await y()}async function _(){let e=x();if(!e)return;if(!n.projectName||!n.owner||!n.repo||!n.accountId){a="Account, project name, and the GitHub owner/repo are all required.",r();return}c=!0,a="",r();try{let t=await jE(e,{accountId:n.accountId,owner:n.owner,productionBranch:n.branch||"main",projectName:n.projectName,repo:n.repo});i=await Gf(t).catch(()=>null)}catch(t){a=t instanceof Error?t.message:String(t)}c=!1,r()}async function M(){let e=x();if(!e)return;c=!0,r();try{await w1(e,null),i=null}catch(t){a=t instanceof Error?t.message:String(t)}c=!1,r()}function V(){let e=u;u=null,e?.close()}function i_(e){s={accountId:e.accountId??"demo-account",connected:!0},m=[],i=e.deployment,Qh(e.deployment),a="",c=!1,h=!1,r()}function OR(){let e=x(),{owner:t,repo:l}=H();s="loading",m=[],i=null,a="",c=!1,h=!1,n={accountId:"",branch:"main",owner:t,projectName:ra()?.projectName??I(e?.name??""),repo:l},r(),y()}
|
|
2
|
-
export{
|
|
1
|
+
import{hn,sn,ne}from"./studio-dknr8m7b.js";import{p}from"./studio-6k1eswp9.js";import{Tr}from"./studio-28pz4s1k.js";import{v}from"./studio-0nm2skex.js";import{rt,zt,T,R,Nn,Ct}from"./studio-z1vdxq0e.js";import{gd,oT,em,j1,rT,ca,rp}from"./studio-sadckcpp.js";import{Df,D_}from"./studio-vz7b43ng.js";import{D}from"./studio-153mwkyq.js";import{me}from"./studio-09n3fyy0.js";var P={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPublish",$description:"Publish: the one-click Cloudflare Pages flow, as a `jx-dialog` over the kit. Eight bodies, one at a time, because the reader is at exactly one point of a chain — a host that cannot reach Cloudflare at all, a question still in flight, a connection that lapsed, an invitation to connect, a stored token Cloudflare refused, a field to paste a replacement into, the create-and-connect form, and the connected status. `publish/publish-panel.ts` keeps every one of those decisions and the calls that settle them; this document knows only which of the eight it was told to draw. **The token is never painted.** The field below binds no `value` — it is written by the reader and read once, on its way to storage — so a stored secret cannot reach the attribute, the serialised HTML or the accessibility tree, which is `studio.md` §15 rule 1 written as a missing binding rather than as a rule somebody remembers.",tagName:"jx-dialog",$props:{headline:"Publish",confirmLabel:"",cancelLabel:"Close",size:"md"},attributes:{part:"publish"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"What the five `.publish-*` names carried, keyed on `part`, and most of them do not survive the move. `.publish-modal` and its `.new-project-modal` base were a fixed card, a scroll body, a border, a shadow and a `z-index: 1000` — a modal `<dialog>` is every one of those, and the top layer is what the z-index was climbing towards. `.publish-field` was a label stacked over a control, which is `jx-field`'s whole shape. What is left is the column gap between bodies, the two button rows, the hint and the refusal. Nothing here uses `--spectrum-*`: those custom properties resolve only inside `<sp-theme>`, and a document mounted in a layer host is outside it, so each would silently have taken its hard-coded fallback.",'& [part="body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="note"], & [part="status-line"], & [part="deployment"]':{margin:"0",lineHeight:"1.5"},'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="actions"]':{$description:'Wraps rather than overflows (studio-ui-guidelines.md §4.6): two buttons whose labels are whole phrases — "Verify & Connect", "Preferences › Accounts" — are wider than a narrow dialog at the sizes a reader may have set.',display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)"},'& [part="submit"]':{alignSelf:"flex-start"},'& [part="hint"]':{$description:"Publishing rides every commit, so the connected body's only job is to say what is already happening. Dim, because it is a standing fact rather than something to act on.",margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="failure"]':{$description:'`failure` and not `error`: `jx-textfield` and `jx-select` each draw a `[part="error"]` of their own inside this same tree, and the kit is light DOM — a scoped rule on that name would restyle the token field\'s refusal line too.',margin:"0",color:"var(--danger)",lineHeight:"1.5"},'& [part="link"], & [part="install-link"]':{color:"var(--accent)",textDecoration:"underline"},"& code":{fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)"}},children:[{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{unsupported:{tagName:"p",attributes:{part:"note"},children:["This platform cannot reach the Cloudflare API. Publish by committing and pushing — your host builds ",{tagName:"code",textContent:"bunx jx build"}," and serves ",{tagName:"code",textContent:"dist/"},"."]},loading:{tagName:"p",attributes:{part:"note"},textContent:"Checking Cloudflare connection…"},lapsed:{tagName:"div",attributes:{part:"lapsed",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Your Cloudflare connection has expired, so publishing cannot reach your account. Reconnect to restore it — this site's Pages project and its settings are untouched."},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"reconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"${state.connectLabel}"}]}]},hosted:{tagName:"div",attributes:{part:"hosted",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Connect your Cloudflare account to publish this site."},{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"connect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"Connect Cloudflare"}]}]},stored:{tagName:"div",attributes:{part:"stored",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"A Cloudflare API token is stored on this machine, and Cloudflare did not accept it. It may have been revoked, or it may be missing the Account Settings Read and Pages Read/Write permissions."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"replace"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[]}]},children:[{tagName:"span",textContent:"Replace token"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},token:{tagName:"div",attributes:{part:"token-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Paste a Cloudflare API token (permissions: Account Settings Read, Pages Read/Write). It is stored on this machine and only sent to the same-origin proxy — Studio never renders it back."},{tagName:"jx-field",$props:{span:!0,label:"API token"},attributes:{part:"token-row","data-field":"token"},children:[{tagName:"jx-textfield",$description:"No `value` binding, and its absence is the contract: a secret may pass through a field the reader typed it into and may never be painted into one they did not. The draft lives in the adapter's closure until Verify reads it, so nothing here — not the attribute, not the accessibility tree, not a DOM dump — has ever held it.",$props:{type:"password",placeholder:"cf_..."},attributes:{part:"token"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setToken"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"verify"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/verify"},value:[]}]},children:[{tagName:"span",textContent:"Verify & Connect"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},form:{tagName:"div",attributes:{part:"connect-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},children:["Create a Cloudflare Pages project connected to this repository. Every commit then builds and publishes automatically (",{tagName:"code",textContent:"bunx jx build"},")."]},{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Account"},attributes:{part:"row","data-field":"account"},children:[{tagName:"jx-select",$props:{options:{$ref:"#/state/accountOptions"},value:{$ref:"#/state/accountId"}},attributes:{part:"account"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAccount"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Pages project name"},attributes:{part:"row","data-field":"projectName"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/projectName"}},attributes:{part:"project-name"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setProjectName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub owner"},attributes:{part:"row","data-field":"owner"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/owner"}},attributes:{part:"owner"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub repository"},attributes:{part:"row","data-field":"repo"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/repo"}},attributes:{part:"repo"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRepo"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Production branch"},attributes:{part:"row","data-field":"branch"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/branch"}},attributes:{part:"branch"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBranch"},value:[{$ref:"event#/target/value"}]}]}}]}]},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"submit"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/submit"},value:[]}]},children:[{tagName:"span",textContent:"${state.submitLabel}"}]}]},status:{tagName:"div",attributes:{part:"status",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"status-line"},children:["Connected to Pages project ",{tagName:"strong",attributes:{part:"project-name"},textContent:"${state.deployProject}"},{tagName:"span",attributes:{part:"site-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProductionUrl"},cases:{true:{tagName:"span",children:[" — ",{tagName:"a",attributes:{part:"link",href:"${state.productionUrl}",target:"_blank",rel:"noreferrer"},textContent:"${state.productionUrl}"}]}}}]},{tagName:"div",attributes:{part:"deployment-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDeployment"},cases:{true:{tagName:"p",attributes:{part:"deployment"},children:["Latest deployment: ",{tagName:"strong",attributes:{part:"deployment-state"},textContent:"${state.deploymentState}"}," (${state.deploymentEnvironment}) — ",{tagName:"a",attributes:{part:"link",href:"${state.deploymentUrl}",target:"_blank",rel:"noreferrer"},textContent:"preview"}]},false:{tagName:"p",attributes:{part:"deployment"},textContent:"No deployments yet — the first commit after connecting triggers one."}}},{tagName:"p",attributes:{part:"hint"},textContent:"Publishing happens automatically on every commit."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]},children:[{tagName:"span",textContent:"Refresh"}]},{tagName:"jx-button",$props:{variant:"negative",disabled:{$ref:"#/state/busy"}},attributes:{part:"disconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/disconnect"},value:[]}]},children:[{tagName:"span",textContent:"Disconnect"}]}]}]}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFailure"},cases:{true:{tagName:"p",attributes:{part:"failure"},children:["${state.failure}",{tagName:"span",attributes:{part:"pages-app-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/needsPagesApp"},cases:{true:{tagName:"span",children:[" — if the Cloudflare Pages GitHub App is not installed on the repository, ",{tagName:"a",attributes:{part:"install-link",href:"${state.pagesAppUrl}",target:"_blank",rel:"noreferrer"},textContent:"install it"}," and retry."]}}}]}}}]}]};T("publish",P);var S="https://github.com/apps/cloudflare-pages/installations/new";function F(e){if(!e.supported)return"unsupported";if(e.loading)return"loading";if(e.connected&&e.lapsed)return"lapsed";if(!e.connected){if(e.hosted)return"hosted";return e.tokenStored&&!e.replacing?"stored":"token"}return e.deploy?"status":"form"}function w(e){let{error:t}=e;return{accountId:e.form.accountId,accountOptions:e.accounts,body:F(e),branch:e.form.branch,busy:e.busy,connectLabel:e.busy?"Reconnecting…":"Reconnect Cloudflare",deploymentEnvironment:e.deployment?.environment??"",deploymentState:e.deployment?`${e.deployment.stage}: ${e.deployment.status}`:"",deploymentUrl:e.deployment?.url??"",deployProject:e.deploy?.projectName??"",failure:t,hasDeployment:e.deployment!==null,hasFailure:t!=="",hasProductionUrl:(e.deploy?.productionUrl??"")!=="",needsPagesApp:/github/i.test(t)&&/app|install|source|repo/i.test(t),owner:e.form.owner,pagesAppUrl:S,productionUrl:e.deploy?.productionUrl??"",projectName:e.form.projectName,repo:e.form.repo,submitLabel:e.busy?"Connecting…":"Create & Connect"}}function C(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let l="",g=!1,N=()=>{if(g)return;g=!0,e.onClosed()},d=v({...w(e.view),closed:N,connect:()=>{e.onConnect()},disconnect:()=>{e.onDisconnect()},openAccounts:()=>{e.onOpenAccounts()},refresh:()=>{e.onRefresh()},replace:()=>{l="",e.onReplaceToken()},setAccount:(o)=>{d.accountId=o,e.onField("accountId",o)},setBranch:(o)=>{d.branch=o,e.onField("branch",o)},setOwner:(o)=>{d.owner=o,e.onField("owner",o)},setProjectName:(o)=>{d.projectName=o,e.onField("projectName",o)},setRepo:(o)=>{d.repo=o,e.onField("repo",o)},setToken:(o)=>{l=o},submit:()=>{e.onSubmit()},verify:()=>{let o=l;l="",e.onSaveToken(o)}}),b=null,k=R("publish",d,t).then(async(o)=>{b=o;let u=o.root;if(g)return o.dispose(),u;if(await Nn(u),g)return u;return(u.querySelector('dialog[part="dialog"]')??u).setAttribute(rt,zt("modal","publish")),hn(u),u});return{close(){let o=b?.root;if(o instanceof HTMLElement)sn(o);b?.dispose(),b=null,l="",t.remove(),N()},host:t,ready:k,update(o){Object.assign(d,w(o))}}}var m=null,s="loading",f=[],i=null,a="",c=!1,h=!1,n={accountId:"",branch:"main",owner:"",projectName:"",repo:""};function x(){return D?.projectConfig??null}function I(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-+|-+$/g,"").slice(0,58)||"site"}function H(){let e=p().projectRoot,t=/^([\w.-]+)\/([\w.-]+)(?:@.+)?$/.exec(e);return t?{owner:t[1],repo:t[2]}:{owner:"",repo:""}}function L(){let e=ca();return e?{productionUrl:e.productionUrl??"",projectName:e.projectName}:null}function j(){let e=gd(),t=s==="loading"?null:s;return{accounts:f.map((l)=>({label:l.name,value:l.id})),busy:c,connected:t?.connected===!0,deploy:L(),deployment:i?{environment:i.environment,stage:i.stage,status:i.status,url:i.url}:null,error:a,form:{...n},hosted:e&&typeof p().cfConnect==="function",lapsed:t?.connected===!0&&t.needsReconnect===!0,loading:s==="loading",replacing:h,supported:e,tokenStored:Df()!==""}}function r(){if(m){m.update(j());return}m=C({layer:Ct("modal"),onClosed:V,onConnect:()=>{O()},onDisconnect:()=>{M()},onField:(e,t)=>{n={...n,[e]:t}},onOpenAccounts:E,onRefresh:()=>{y()},onReplaceToken:()=>{h=!0,a="",r()},onSaveToken:(e)=>{U(e)},onSubmit:()=>{_()},view:j()})}async function y(){s="loading",r();try{if(s=await p().cfConnection?.()??null,s?.connected&&!s.needsReconnect){f=await oT(),n={...n,accountId:s.accountId??f[0]?.id??""};let e=ca();if(e)i=await em(e),rp(i)}}catch(e){s=null,a=e instanceof Error?e.message:String(e)}r()}async function U(e){let t=e.trim();if(!t){a="Paste a token, or use Preferences › Accounts to forget the stored one.",r();return}D_(t),h=!1,a="",await y()}function E(){ne()?.run("app.preferences",{section:"accounts"})}async function O(){c=!0,a="",r();try{let e=await p().cfConnect?.()??null;if(e?.status==="timeout")a="The Cloudflare window didn't finish. Sign in there, then reconnect — nothing was changed.";else if(e?.status==="connected"&&!e.connection.accountId){let{openCfAccountPicker:t}=await (me("zfycs4k2"),import("./cf-account-picker-zfycs4k2.js"));await t()}}catch(e){a=e instanceof Error?e.message:String(e)}c=!1,Tr(),await y()}async function _(){let e=x();if(!e)return;if(!n.projectName||!n.owner||!n.repo||!n.accountId){a="Account, project name, and the GitHub owner/repo are all required.",r();return}c=!0,a="",r();try{let t=await rT(e,{accountId:n.accountId,owner:n.owner,productionBranch:n.branch||"main",projectName:n.projectName,repo:n.repo});i=await em(t).catch(()=>null)}catch(t){a=t instanceof Error?t.message:String(t)}c=!1,r()}async function M(){let e=x();if(!e)return;c=!0,r();try{await j1(e,null),i=null}catch(t){a=t instanceof Error?t.message:String(t)}c=!1,r()}function V(){let e=m;m=null,e?.close()}function C_(e){s={accountId:e.accountId??"demo-account",connected:!0},f=[],i=e.deployment,rp(e.deployment),a="",c=!1,h=!1,r()}function b$(){let e=x(),{owner:t,repo:l}=H();s="loading",f=[],i=null,a="",c=!1,h=!1,n={accountId:"",branch:"main",owner:t,projectName:ca()?.projectName??I(e?.name??""),repo:l},r(),y()}
|
|
2
|
+
export{C_,b$};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=F05E90D2B33A7F5064756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-1pxvgx1t.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{ge,Xa,Q,v,re,Bd,S}from"./studio-0nm2skex.js";import{kp}from"./studio-654fxcr0.js";import{p}from"./studio-6k1eswp9.js";import{wi,Zt,$r}from"./studio-ft8pfpp0.js";import{K,$m,ht,_n,Xo,qa,D}from"./studio-153mwkyq.js";import{Ae,Ic,Dm,uS}from"./studio-mm8x32gg.js";import{va,oh,rh}from"./studio-p6avneaq.js";import{me}from"./studio-09n3fyy0.js";function xm(e,t){return{success:!0,data:e,summary:t}}function oo(e){return{success:!1,error:e}}function Ki({name:e,description:t,parameters:n,strict:o=!0,llmStrict:r=!1,interactive:i,execute:s}){return{name:e,description:t,parameters:n,strict:o,llmStrict:r,...i===void 0?{}:{interactive:i},execute:s}}function se(e){let t=[];return{record(n){t.push(n),e?.(n)},writes:t}}function fp(e=null,t={}){let n=new Map(Object.entries(t));return{sessionId:e,get:(o)=>n.get(o),set:(o,r)=>{n.set(o,r)},toJSON:()=>Object.fromEntries(n)}}var wt=new AbortController().signal;function lv(e={}){let t=e.session??fp();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??se(),progress:e.progress??(()=>{}),session:t,signal:e.signal??wt}}function LL(e){let t=new AbortController;if(e.aborted)return t.abort(e.reason),{release:()=>{},signal:t.signal};let n=()=>{t.abort(e.reason)};return e.addEventListener("abort",n,{once:!0}),{release:()=>{e.removeEventListener("abort",n)},signal:t.signal}}function VC(){let e=new Map;return{register(t){if(e.has(t.name))console.warn(`Tool "${t.name}" is being re-registered.`);e.set(t.name,t)},list(){return[...e.values()]},listForLLM(){return[...e.values()].map((t)=>({type:"function",function:{name:t.name,description:t.description,parameters:t.parameters,...t.llmStrict===!0?{strict:!0}:{}}}))},getDefinition(t){return e.get(t)},validate(t,n){let o=e.get(t);if(!o)return{valid:!1,errors:[`Unknown tool: "${t}"`]};if(!o.strict)return{valid:!0};let r=o.parameters;if(!r||!r.properties)return{valid:!0};let i=[],s=r.properties,a=r.required||[],l=n;for(let c of a)if(!(c in n)||l[c]===void 0||l[c]===null)i.push(`Missing required argument: "${c}"`);for(let[c,d]of Object.entries(l)){let m=s[c];if(!m)continue;let y=m.type;if(!y)continue;let b=Array.isArray(d)?"array":typeof d;if(y==="number"||y==="integer"){if(b==="number")continue;if(b==="string"){if(!Number.isNaN(Number(d)))continue;i.push(`Argument "${c}" should be a number, got non-numeric string "${d}"`);continue}i.push(`Argument "${c}" should be a number, got ${b}`);continue}if(y==="string"&&b!=="string")i.push(`Argument "${c}" should be a string, got ${b}`);else if(y==="boolean"&&b!=="boolean")i.push(`Argument "${c}" should be a boolean, got ${b}`);else if(y==="array"&&b!=="array")i.push(`Argument "${c}" should be an array, got ${b}`);else if(y==="object"&&b!=="object")i.push(`Argument "${c}" should be an object, got ${b}`)}return i.length>0?{valid:!1,errors:i}:{valid:!0}},async execute(t,n,o=lv()){let r=e.get(t);if(!r)return oo(`Unknown tool: "${t}"`);let i=this.validate(t,n);if(!i.valid)return oo(`Validation failed: ${(i.errors||[]).join("; ")}`);try{return await r.execute(n,o)}catch(s){return oo(`Tool "${t}" execution error: ${s.message}`)}}}}var F=[],St=50;function IL(e){return Object.assign(se(),{turnId:e})}function RL(e,t){if(t.length===0)return[];let n={id:e,writes:[...t]};F.push(n);while(F.length>St)F.shift();return n.writes}function Tx(e){return F.find((t)=>t.id===e)?.writes??[]}function $L(e){let t=e.filter((a)=>a.ok),n=new Set(t.map((a)=>a.path)),o=e.length-t.length;if(n.size===0)return o>0?`${o} change${o===1?"":"s"} failed`:"";let r=`Changed ${n.size} file${n.size===1?"":"s"}`,i=new Set(t.filter((a)=>a.disk).map((a)=>a.path)),s=[r];if(i.size>0)s.push(`${i.size} written to disk — undo cannot reach ${i.size===1?"it":"them"}`);if(o>0)s.push(`${o} failed`);return s.join(" · ")}function Lx(){F.splice(0)}function UC(e,t){let n=null;for(let o=e.length-1;o>=0;o--){let r=e[o];if(r.id===t)return n;let i=r.role==="assistant"&&(r.content||(r.toolCalls?.length??0)>0);if(n===null&&i)n=r.id}return t===void 0?n:null}var Ct=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"]),kx="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function Jo(e){if(typeof e!=="string"||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function rv(e){return Jo(e)!==null}function SL(e){let t=Jo(e);if(t===null)return"ltr";let n=new Intl.Locale(t),o=n.script??n.maximize().script;return o!==void 0&&Ct.has(o)?"rtl":"ltr"}function un(e){let t=Jo(e);if(t===null)return typeof e==="string"?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var Rt="prefix-except-default";function Do(e){let t=e.i18n,n=[];if(!t||typeof t!=="object")return{errors:n,i18n:null};let o=Array.isArray(t.locales)?t.locales:[],r=[];for(let a of o){let l=Jo(a);if(l===null){n.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!r.includes(l))r.push(l)}let i=Jo(t.defaultLocale)??r[0]??null;if(t.defaultLocale!==void 0&&Jo(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(i===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};if(!r.includes(i))r.unshift(i);let s=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:Rt;return{errors:n,i18n:{defaultLocale:i,locales:r,routing:s}}}function Bu(e,t){let n=ae(W(e),t);if(n===-1||t===null)return null;return Jo(W(e)[n])}function kL(e,t){let n=Bu(e,t);if(n!==null||t===null||t.routing!=="prefix-except-default")return n;return W(e)[0]==="pages"?t.defaultLocale:null}function WC(e,t){let n=W(e),o=ae(n,t);return o===-1?n.join("/"):n.filter((r,i)=>i!==o).join("/")}function zu(e,t,n){if(n===null)return null;let o=Jo(t);if(o===null||!n.locales.includes(o))return null;let r=W(e),i=ae(r,n),s=i===-1?At(r):i;if(s===-1)return null;let a=i===-1?r:r.filter((l,c)=>c!==i);if(o===n.defaultLocale&&n.routing==="prefix-except-default")return a.join("/");return a.toSpliced(s,0,o.toLowerCase()).join("/")}function W(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function ae(e,t){if(t===null)return-1;return e.findIndex((n)=>{let o=Jo(n);return o!==null&&t.locales.includes(o)})}function At(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}var Dx="{locale}";function Je(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function B(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function Ie(e){return e??D?.projectConfig??null}function De(e){return e?.content??{}}function kt(e){let t=Do(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function Le(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function Me(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:$r()?.extensions[0]??".json",unresolvedFormat:null};let t=wi(e.format);return t?.extensions[0]===void 0?{ext:null,unresolvedFormat:e.format}:{ext:t.extensions[0],unresolvedFormat:null}}function Jt(e,t){let n=t===null?"[^/]+":`(?:${t.map((r)=>Je(r)).join("|")})`,o=B(e).split(Dx).map((r)=>Je(r)).join(n);return new RegExp(`^${o}(?:/|$)`,"i")}function jt(e,t,n){let o=Jt(e,n).exec(t);if(!o)return null;return o[0].replace(/\/$/,"")}function It(e){return B(e).replaceAll(Dx,"").length}function vp(e,t){if(e===null||e===void 0||e==="")return null;let n=Ie(t),o=kt(n),r=B(e),i=null,s=-1;for(let[a,l]of Object.entries(De(n))){let{source:c}=l;if(c===void 0||c===""||Le(c))continue;let d=It(c);if(d<=s)continue;let m=jt(c,r,o);if(m===null)continue;i={def:l,dir:r,fileBacked:!1,isSourceRoot:r.length===m.length,name:a,...Me(l)},s=d}return i}function Ax(e,t){if(e===null||e===void 0||e==="")return null;let n=Ie(t),o=B(e),r=o.toLowerCase();for(let[i,s]of Object.entries(De(n))){let{source:a}=s;if(a===void 0||a===""||!Le(a))continue;let l=B(a).toLowerCase();if(r===l||r.endsWith(`/${l}`))return{def:s,dir:o.includes("/")?o.slice(0,o.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:i,...Me(s)}}return vp(o.includes("/")?o.slice(0,o.lastIndexOf("/")):".",n)}function Ml(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function xv(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function _v(e){return e.replaceAll(/(^|-)(\w)/g,(t,n,o)=>(n?" ":"")+o.toUpperCase())}function Nx(e,t){return e?.$label||Ml(t)}function eI(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(n,o,r)=>(o?" ":"")+r.toUpperCase());return Ml(t)}function ma(e){return e==="image"||e==="uri-reference"}function Dd(e){if(e.$shorthand===!0)return"shorthand";if(e.$input==="button-group")return"button-group";if(e.$input==="media")return"media";if(e.format==="color")return"color";if(ma(e.format))return"media";if(e.$units!==void 0)return"number-unit";if(e.type==="number")return"number";if(Array.isArray(e.enum))return"select";if(Array.isArray(e.examples)||Array.isArray(e.presets))return"combobox";return"text"}function qu(e,t){if(!e||!t?.content)return null;let n=Ax(e,t);if(!n||!n.def.schema)return null;if(!n.fileBacked){let o=n.ext??$r()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(o.toLowerCase()))return null}return{name:n.name,schema:n.def.schema}}function Sm(e,t){let n=e.trim().toLowerCase().replaceAll(/[^a-z0-9\s-]/g,"").replaceAll(/\s+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(!n)return"";return`${t}${n}`}function Cv(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(n)=>n.toUpperCase())||e}function tI(e){if(!e)return{kind:"text"};let t=e.trim().replaceAll(/\s*\|\s*undefined\b/g,"").trim();if(t==="boolean")return{kind:"boolean"};if(t==="number")return{kind:"number"};if(t.match(/^'[^']*'(\s*\|\s*'[^']*')+$/))return{kind:"combobox",options:[...t.matchAll(/'([^']*)'/g)].map((r)=>r[1])};return{kind:"text"}}function No(e){return JSON.parse(JSON.stringify(e))}function Te(e){return e&&e.length>0?e.at(-1):null}function NL(e){return e&&e.length>0?e[0]:null}function dv(e,t){if(!t||!e)return!1;return e.some((n)=>Xo(n,t))}function ms(e){return L(e)}function L(e){let t=[];for(let n of e)t.push([...n]);return t}function uv(e,t){if(dv(e,t))return L(e.filter((n)=>!Xo(n,t)));return[...L(e),[...t]]}function OL(e,t,n){let o=e.findIndex((s)=>Xo(s,n)),r=t?e.findIndex((s)=>Xo(s,t)):-1;if(o===-1||r===-1)return[[...n]];let i=r<=o?e.slice(r,o+1):e.slice(o,r+1).toReversed();return L(i)}function Ee(e,t){return L(e.filter((n)=>!qa(t,n)))}function Dt(e,t){let n=Math.min(e.length,t.length);for(let o=0;o<n;o++){let r=e[o],i=t[o];if(r===i)continue;if(typeof r==="number"&&typeof i==="number")return r-i;return String(r)<String(i)?-1:1}return e.length-t.length}function Lt(e){return L(e.filter((t)=>!e.some((n)=>!Xo(n,t)&&qa(n,t))))}function Nl(e){return e.at(-2)==="children"&&typeof e.at(-1)==="number"}function hv(e){return Lt(e).filter((t)=>Nl(t)).toSorted((t,n)=>Dt(n,t))}function ML(e){let t=[];for(let n of e)if(!t.some((o)=>Xo(o,n)))t.push([...n]);return t}function gp(e){if(e.length===0)return{mixed:!1,value:void 0};let t=e[0],n=JSON.stringify(t??null);for(let o=1;o<e.length;o++)if(JSON.stringify(e[o]??null)!==n)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var $e=null;function PL(e){$e=e}function Ne(){return $e}var V=null,U=null,G=null,le=!0;function _e(){V=[],U=[],G=[],le=!0}function f(e){if(V)V.push(e)}function vi(e){if(U)U.push(e)}function Fe(e){if(G)G.push(e)}function We(){let e={docOps:U??[],fmOps:G??[],invertible:le,ops:V??[]};return V=null,U=null,G=null,le=!0,e}var Be=100,Mt=20;function H(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function P(e,t,n,o){return{forward:{key:t,op:"set-key",path:e,value:o},inverse:{key:t,op:"set-key",path:e,value:n}}}function Et(e,t,n,o,r){let i=e.length;if(!(i<t.length&&e.every((c,d)=>c===t[d]))||t[i]!=="children"||typeof t[i+1]!=="number")return t;let a=t[i+1];if(r?a<n:a<=n)return t;let l=[...t];return l[i+1]=a+o,l}var Ve=null;function Ke(e){Ve=e}var Ue=null;function Ge(e){Ue=e}function $t(e,t,n,o){for(let r=t.docOps.length-1;r>=0;r--)Dm(e.doc.document,re(t.docOps[r].inverse));for(let r=t.fmOps.length-1;r>=0;r--){let i=t.fmOps[r];fe(e,i.field,i.before)}e.doc.document={...re(e.doc.document)},e.session.selection=n,e.doc.dirty=o}function q(e,t,{skipHistory:n=!1,origin:o="user",coalesceKey:r=null}={}){if(!e)return!1;if(o!=="remote"&&Ue?.(e,o))return!1;let i=ms(e.session.selection),s=e.doc.dirty;_e();let a,l=null;try{t(e)}catch(b){l={error:b}}finally{a=We()}if(l)throw $t(e,a,i,s),l.error;let c=re(e.doc.document),d={...c},m=Ne(),y=m===null?{patchable:!1,reason:"no-patch-consumer"}:a.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:m.classify(e,a.ops);if(y.patchable)m.markConsumed(d,e);if(e.doc.document=d,y.patchable)try{m.apply(e,a.ops,a)}catch(b){m.escalate(`patch-apply-failed: ${b instanceof Error?b.message:String(b)}`,e)}if(!n&&!M)Nt(e,c,a,i,r);return e.doc.dirty=!0,Ve?.(e,a,o),!0}function Nt(e,t,n,o,r=null){let i=e.history.snapshots.slice(0,e.history.index+1),s=H()&&n.invertible&&(n.docOps.length>0||n.fmOps.length>0),a=i.at(-1);if(r&&s&&a&&a.coalesceKey===r&&a.inverseOps){if(a.forwardOps=[...a.forwardOps??[],...n.docOps.map((c)=>c.forward)],a.inverseOps=[...a.inverseOps,...n.docOps.map((c)=>c.inverse)],a.selection=ms(e.session.selection),a.document)a.document=No(t);e.history.snapshots=i,e.history.index=i.length-1;return}let l=!s||i.length%Mt===0;if(i.push({document:l?No(t):null,fmOps:s&&n.fmOps.length>0?n.fmOps:null,forwardOps:s?n.docOps.map((c)=>c.forward):null,inverseOps:s?n.docOps.map((c)=>c.inverse):null,coalesceKey:r,selection:ms(e.session.selection),selectionBefore:o}),i.length>Be){if(!i[1].document)i[1].document=ce(i,1);i.shift()}e.history.snapshots=i,e.history.index=i.length-1}function ce(e,t){let n=t;while(n>=0&&!e[n].document)n-=1;if(n<0)throw Error("history-missing-checkpoint");let o=No(e[n].document);for(let r=n+1;r<=t;r++)for(let i of e[r].forwardOps??[])Dm(o,i);return o}function js(e,t,n){return q(e,(o)=>t(o.doc.document),n)}function ue(e,t){q(e,(n)=>{for(let o of t)de(n,o)},{origin:"remote",skipHistory:!0})}var _t=new Set(["state","$media","$head","$elements","imports","$layout"]);function de(e,t){let n=t.op==="set-key"?K(e.doc.document,t.path)?.[t.key]:null;switch(Dm(e.doc.document,t),vi({forward:t,inverse:t}),t.op){case"set-key":{if(_t.has(t.key))f({key:t.key,op:"doc-meta"});else if(t.key==="style")f({op:"set-style",path:t.path});else if(t.key==="textContent")f({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")f({op:"replace",path:t.path});else{let o=t.key.startsWith("on")&&(rh(t.value)||rh(n));f({isEvent:o,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{f({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{f({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{f({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{f({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var M=null,He=null;function ze(e){He=e}function pv(e){M=e}function fv(){let e=M;if(e&&!j.has(e)){let t=re(e.doc.document),n={document:No(t),selection:ms(e.session.selection)},o=e.history.snapshots.slice(0,e.history.index+1);if(o.push(n),o.length>Be)o.shift();e.history.snapshots=o,e.history.index=o.length-1}if(M=null,e)He?.(e)}function Ix(){return M!==null}function FL(){return M}var j=new WeakMap;function _m(e,t){if(t)j.set(e,t);else j.delete(e)}function jL(e){let t=j.get(e);return t?t.canUndo(e):e.history.index>0}function HL(e){let t=j.get(e);return t?t.canRedo(e):e.history.index<e.history.snapshots.length-1}function Ye(e,t){let{snapshots:n}=e.history;e.doc.document=ce(n,t);let o=n[t];e.session.selection=ms(re(o.selection))}function Ze(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let n=JSON.stringify(ce(e.history.snapshots,t)),o=JSON.stringify(No(re(e.doc.document)));if(n!==o)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function Rx(e){let t=j.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let n=e.history.snapshots[e.history.index],o=H()?n.inverseOps:null,r=H()?n.fmOps:null;if(o&&o.length>0||r&&r.length>0){if(!q(e,(s)=>{if(o)for(let a=o.length-1;a>=0;a--)de(s,re(o[a]));if(r)for(let a=r.length-1;a>=0;a--){let l=re(r[a]);fe(s,l.field,l.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=ms(re(n.selectionBefore??[])),e.history.index-=1,Ze(e,e.history.index)}else e.history.index-=1,Ye(e,e.history.index);e.doc.dirty=!0}function BL(e){let t=j.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let n=e.history.snapshots[e.history.index+1],o=H()?n.forwardOps:null,r=H()?n.fmOps:null;if(o&&o.length>0||r&&r.length>0){if(!q(e,(s)=>{if(o)for(let a of o)de(s,re(a));if(r)for(let a of r){let l=re(a);fe(s,l.field,l.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=ms(re(n.selection)),e.history.index+=1,Ze(e,e.history.index)}else e.history.index+=1,Ye(e,e.history.index);e.doc.dirty=!0}function Ji(e,t,n,o){let r=K(e.doc.document,t);if(!r)return;Ic(r).splice(n,0,structuredClone(o)),f({index:n,op:"insert",parentPath:t}),vi({forward:{index:n,node:Ae(o),op:"insert-child",parentPath:t},inverse:{index:n,op:"remove-child",parentPath:t}})}function Vu(e,t){if(!t||!Nl(t))return;let n=ht(t),o=_n(t),[r]=K(e.doc.document,n).children.splice(o,1);f({op:"remove",path:t}),vi({forward:{index:o,op:"remove-child",parentPath:n},inverse:{index:o,node:Ae(r),op:"insert-child",parentPath:n}}),e.session.selection=Ee(e.session.selection,t)}function GC(e,t){if(!t||!Nl(t))return;let n=K(e.doc.document,t);if(!n)return;let o=ht(t),r=_n(t),i=structuredClone(re(n));K(e.doc.document,o).children.splice(r+1,0,i),f({index:r+1,op:"insert",parentPath:o}),vi({forward:{index:r+1,node:Ae(i),op:"insert-child",parentPath:o},inverse:{index:r+1,op:"remove-child",parentPath:o}}),e.session.selection=[[...o,"children",r+1]]}function bp(e,t){for(let n of hv(t))Vu(e,n)}function mv(e,t){let n=[];for(let o of hv(t)){let r=e.session.selection;GC(e,o);let i=Te(e.session.selection);if(!i||e.session.selection===r)continue;let s=ht(i),a=_n(i);n=n.map((l)=>Et(s,l,a,1,!0)),n.unshift(i)}if(n.length>0)e.session.selection=n}function zL(e,t,n="div"){if(!t||!Nl(t))return;let o=K(e.doc.document,t);if(!o)return;let r=ht(t),i=_n(t),s={children:[structuredClone(re(o))],tagName:n},a=Ae(o);K(e.doc.document,r).children.splice(i,1,s),f({op:"replace",path:t}),vi({forward:{index:i,node:Ae(s),op:"set-child",parentPath:r},inverse:{index:i,node:a,op:"set-child",parentPath:r}}),e.session.selection=[[...r,"children",i]]}function pa(e,t,n,o){let r=e.doc.document,i=ht(t),s=_n(t);if(!i||typeof s!=="number")return;let a=K(r,i),l=K(r,n);if(!a||!Array.isArray(a.children)||!l)return;if(a.children[s]===void 0)return;let c=o;if(a===l&&s<o)c-=1;let d={fromIndex:s,fromParentPath:i,op:"move-child",toIndex:c,toParentPath:n},m=uS(r,d),[y]=a.children.splice(s,1);if(Ic(l).splice(c,0,y),f({fromPath:t,op:"move",toIndex:c,toParentPath:n}),vi({forward:d,inverse:m}),Xo(Te(e.session.selection),t)){let b=o;if(i.length===n.length&&i.every((_,I)=>_===n[I])&&s<o)b=o-1;e.session.selection=[[...n,"children",b]]}}function qe(e,t,n,o){let r=K(e.doc.document,t);if(!r)return;let i=r[n],s=Ae(i);if(o===void 0||o===null||o==="")delete r[n];else r[n]=o;if(vi(P(t,n,s,Ae(r[n]))),n==="textContent")f({op:"set-text",path:t});else if(n==="style")f({op:"set-style",path:t});else{let a=o===void 0||o===null||o===""?i:o,l=n.startsWith("on")&&rh(a);f({isEvent:l,key:n,op:"set-prop",path:t})}}function Sc(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.style);if(!r.style)r.style={};if(o===void 0||o==="")delete r.style[n];else r.style[n]=o;if(Object.keys(r.style).length===0)delete r.style;vi(P(t,"style",i,Ae(r.style))),f({op:"set-style",path:t})}function Yo(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.attributes);if(!r.attributes)r.attributes={};if(o===void 0||o==="")delete r.attributes[n];else r.attributes[n]=o;if(Object.keys(r.attributes).length===0)delete r.attributes;vi(P(t,"attributes",i,Ae(r.attributes))),f({attr:n,op:"set-attr",path:t})}function WL(e,t,n,o,r){if(!n)return Sc(e,t,o,r);let i=K(e.doc.document,t),s=Ae(i.style);if(!i.style)i.style={};let a=`@${n}`,l=oh(i.style,a);if(r===void 0||r===""){if(delete l[o],Object.keys(l).length===0)delete i.style[a]}else l[o]=r;if(Object.keys(i.style).length===0)delete i.style;vi(P(t,"style",s,Ae(i.style))),f({op:"set-style",path:t})}function gv(e,t,n,o,r){let i=K(e.doc.document,t),s=Ae(i.style);if(!i.style)i.style={};let a=oh(i.style,n);if(r===void 0||r===""){if(delete a[o],Object.keys(a).length===0)delete i.style[n]}else a[o]=r;if(Object.keys(i.style).length===0)delete i.style;vi(P(t,"style",s,Ae(i.style))),f({op:"set-style",path:t})}function VL(e,t,n,o,r,i){let s=K(e.doc.document,t),a=Ae(s.style);if(!s.style)s.style={};let l=`@${n}`,c=oh(s.style,l),d=oh(c,o);if(i===void 0||i===""){if(delete d[r],Object.keys(d).length===0)delete c[o];if(Object.keys(c).length===0)delete s.style[l]}else d[r]=i;if(Object.keys(s.style).length===0)delete s.style;vi(P(t,"style",a,Ae(s.style))),f({op:"set-style",path:t})}function Xe(e,t){let n=[e];for(let o of t){let r=va(n.at(-1),o);if(!r)break;n.push(r)}for(let o=n.length-2;o>=0;o--){let r=n[o],i=t[o],s=va(r,i);if(s&&Object.keys(s).length===0)delete r[i]}}function bv(e,t,n,o,r){let i=K(e.doc.document,t),s=Ae(i.style);if(!i.style)i.style={};let a=i.style;for(let l of n)a=oh(a,l);if(r===void 0||r==="")delete a[o],Xe(i.style,n);else a[o]=r;if(Object.keys(i.style).length===0)delete i.style;vi(P(t,"style",s,Ae(i.style))),f({op:"set-style",path:t})}function UL(e,t,n,o,r,i){let s=K(e.doc.document,t),a=Ae(s.style);if(!s.style)s.style={};let l=`@${n}`,c=oh(s.style,l),d=c;for(let m of o)d=oh(d,m);if(i===void 0||i===""){if(delete d[r],Xe(c,o),Object.keys(c).length===0)delete s.style[l]}else d[r]=i;if(Object.keys(s.style).length===0)delete s.style;vi(P(t,"style",a,Ae(s.style))),f({op:"set-style",path:t})}function qL(e,t,n){let o=K(e.doc.document,t),r=Ae(o.style);if(n&&Object.keys(n).length>0)o.style=n;else delete o.style;vi(P(t,"style",r,Ae(o.style))),f({op:"set-style",path:t})}function Hs(e,t,n){let o=e.doc.document,r=Ae(o.state);if(!o.state)o.state={};o.state[t]=n,vi(P([],"state",r,Ae(o.state))),f({key:"state",op:"doc-meta"})}function vv(e,t){let n=e.doc.document;if(n.state){let o=Ae(n.state);if(delete n.state[t],Object.keys(n.state).length===0)delete n.state;vi(P([],"state",o,Ae(n.state))),f({key:"state",op:"doc-meta"})}}function mr(e,t,n){let o=e.doc.document,r=Ae(o.state);if(!o.state)o.state={};let i=o.state[t],s=i==null?{}:typeof i!=="object"||Array.isArray(i)?{default:i}:i;o.state[t]=s,Object.assign(s,n);for(let a of Object.keys(s))if(s[a]===void 0||s[a]===null)delete s[a];vi(P([],"state",r,Ae(o.state))),f({key:"state",op:"doc-meta"})}function GL(e,t,n){let o=e.doc.document;if(!o.state||!o.state[t])return;let r=Ae(o.state);o.state[n]=o.state[t],delete o.state[t],vi(P([],"state",r,Ae(o.state))),f({key:"state",op:"doc-meta"})}function Uu(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.$props);if(!r.$props)r.$props={};if(o===void 0||o===null||o==="")delete r.$props[n];else r.$props[n]=o;if(Object.keys(r.$props).length===0)delete r.$props;vi(P(t,"$props",i,Ae(r.$props))),f({op:"replace",path:t})}function KL(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.cases);if(!r.cases)r.cases={};r.cases[n]=o||{tagName:"div",textContent:n},vi(P(t,"cases",i,Ae(r.cases))),f({op:"replace",path:t})}function JL(e,t,n){let o=K(e.doc.document,t);if(o.cases){let r=Ae(o.cases);delete o.cases[n],vi(P(t,"cases",r,Ae(o.cases))),f({op:"replace",path:t})}}function YL(e,t,n,o){let r=K(e.doc.document,t);if(!r.cases||!r.cases[n])return;let i=Ae(r.cases);r.cases[o]=r.cases[n],delete r.cases[n],vi(P(t,"cases",i,Ae(r.cases))),f({op:"replace",path:t})}function Ol(e,t,n){let o=e.doc.content.frontmatter,r=Object.hasOwn(o,t)?Ae(o[t]):void 0,i=n===void 0||n===null||n==="";if(i)delete o[t];else o[t]=n;let s=i?void 0:Ae(n);Fe({after:s,before:r,field:t}),e.doc.dirty=!0}function fe(e,t,n){if(n===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=n}var Ft={design:"canvas",edit:"canvas",entry:"entry","git-diff":"diff",grid:"grid",manage:"library",media:"media",preview:"canvas",settings:"config",source:"code",stylebook:"config"},Wu={canvas:"Canvas",code:"Code",config:"Project Styles",diff:"Diff",entry:"Entry",grid:"Grid",media:"Media",library:"Library",none:"None"};function ha(e){return Ft[e]??"canvas"}var Wt={design:"design",edit:"edit",preview:"preview"};function EL(e){return Wt[e]??"design"}var sv=(e)=>e.editor.kind==="canvas",$d=(e)=>sv(e)&&e.selection.count>0,av=(e)=>$d(e)&&!e.selection.isRoot;function wm(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},document:{open:!1,dirty:!1,mode:"",canUndo:!1,canRedo:!1},editor:{kind:"none"},canvas:{view:"design"},pane:{count:1,derived:!1},selection:{count:0,paths:[],kind:"",isRoot:!1,isComponentInstance:!1,isLayoutNode:!1,isRepeater:!1},caret:{active:!1,inCanvas:!1},focus:{region:"pane"},modal:{open:!1},collab:{attached:!1,readOnly:!1,sourceCanonical:!1},ai:{configured:!1,streaming:!1,waiting:!1},capability:{gitClone:!1,importSite:!1,openProjectInNewWindow:!1,dataRows:!1,windowControls:!1,findReferences:!1,readFileBytes:!1}}}function Ex(e={}){let t=wm();for(let n of Object.keys(e)){let o=e[n];if(o)Object.assign(t[n],o)}return t}var Bt=["palette"],Vt=["caret","global"],Kt=["dock","global"],Ut=["canvas","global"],Gt=["grid","global"],Ht=["code","global"],Qe=["global"];function TL(e){if(e.modal.open)return Bt;if(e.caret.active)return Vt;if(e.focus.region!=="pane")return Kt;switch(e.editor.kind){case"grid":return Gt;case"code":return Ht;case"canvas":return e.canvas.view==="preview"?Qe:Ut;default:return Qe}}var ai="project.json";function qt(e,t=!1){return{activeMedia:null,activeSelector:null,openPopover:null,openDialog:null,canvasMode:e,editZoom:1,editingFormula:null,editingFunction:null,featureToggles:{},inspectorSections:{},pendingInlineEdit:null,preview:t,previewColorScheme:"auto",previewLocale:null,previewParams:{},previewProps:null,rightTab:"properties",showLayout:!0,styleFilter:"",styleSections:{},dataRows:{},dataLimits:{},styleShorthands:{},zoom:1}}var zt=["edit","design","preview","source","stylebook","git-diff"];function cv({id:e,documentPath:t=null,fileHandle:n=null,document:o,frontmatter:r,sourceFormat:i=null,capabilities:s,openedFrom:a=null,preview:l=!1,layout:c=null}){let d=ge();$m(o);let m=s?.modes??Yt(t,i),y=m.find((I)=>I!=="preview")??"edit",b=m[0]==="preview";return d.run(()=>({capabilities:{modes:m},doc:v({content:{frontmatter:r||{}},dirty:!1,document:o,handlersSource:null,layout:c,mode:Xt(t,i),sourceFormat:i}),documentPath:t,fileHandle:n,history:v({index:0,snapshots:[{document:structuredClone(o),selection:[]}]}),id:e,pinned:!1,preview:l,scope:d,session:v({canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:a,selection:[],ui:qt(y,b)})}))}function Yt(e,t){if(e===ai)return["stylebook","source"];let n=wi(t)??Zt(e);if(n)return n.studio?.modes??["edit","design","preview","source"];return zt}function Xt(e,t){let n=wi(t)??Zt(e);if(n)return n.studio?.documentMode?.default??"content";return"component"}function qC(e){return ha(e.session.ui.canvasMode)}function DL(e){let t=[];for(let n of e.capabilities.modes){if(n==="preview")continue;let o=ha(n);if(!t.includes(o))t.push(o)}return t}function AL(e,t){return e.capabilities.modes.find((n)=>n!=="preview"&&ha(n)===t)}function mp(e){e.scope.stop()}var et=new WeakMap,E=new Map;function on(e){let t=re(e),n=et.get(t);if(!n)n=v({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),et.set(t,n);return n}function tt(e){E.set(e,(E.get(e)??0)+1)}function nt(e){let t=E.get(e)??0;if(t<=1)E.delete(e);else E.set(e,t-1)}function Cm(e){return E.has(e.replaceAll("\\","/"))}var Qt=8000,en=800,tn=2500,rt=null;function nn(){return rt??=(me("2tf0m2ne"),import("./index-2tf0m2ne.js")),rt}function st(){try{return p()}catch{return null}}var N=null;function nI(e){N=e}var be=null;function iI(e){be=e}var at=()=>{};function oI(e){at=e??(()=>{})}var ye=new WeakMap;function lt(e){return re(e)}function R(e){return ye.get(lt(e))}function ve(e){let t=lt(e),n=ye.get(t);if(!n)n={attaching:null,generation:0,optedOut:v({value:!1}),session:null,watcherInstalled:!1},ye.set(t,n);return n}var it=!1;function rn(){if(it)return;it=!0,Ke(sn),ze(an),Ge((e)=>{if(R(e)?.session?.synced&&on(e).sourceCanonical)return at("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function sn(e,t,n){let o=R(e)?.session;if(!o||!o.synced)return;if(o.lastSeenRef=re(e.doc.document),n==="remote"){ee(o);return}if(o.canWrite)ln(o,t),ee(o)}function an(e){let t=R(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:n,batchNeedsDiff:o}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),o)z(t);else if(n.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,n,t.collab.LOCAL_ORIGIN)}catch{z(t)}t.undoManager?.stopCapturing()}function ln(e,t){let n=t.docOps.map((o)=>o.forward);if(Ix()){if(e.batchOps??=[],n.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...n);return}if(n.length===0){z(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,n,e.collab.LOCAL_ORIGIN)}catch{z(e)}}function z(e){let{collab:t,handle:n,tab:o}=e,r=t.yDocToJson(n.doc),i=No(re(o.doc.document)),s=t.diffDocs(r,i);if(s===null)t.replaceYStructure(n.doc,i,t.LOCAL_ORIGIN);else if(s.length>0)try{t.applyDocOpsToY(n.doc,s,t.LOCAL_ORIGIN)}catch{t.replaceYStructure(n.doc,i,t.LOCAL_ORIGIN)}}function pe(e){let t=e.collab.yDocToJson(e.handle.doc);q(e.tab,(n)=>{let o=n.doc.document;for(let r of Object.keys(o))if(!(r in t))delete o[r];Object.assign(o,t)},{origin:"remote",skipHistory:!0})}function cn(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,n=t.clientID;for(let[o,r]of t.getStates())if(r.canWrite!==!1&&o<n)n=o;return n===e.handle.awareness.clientID}function ee(e){if(!N||!cn(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=tn){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,he(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),he(e)},en)}async function he(e){if(!N||!e.synced)return;try{let t=await N(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function ct(e){if(!be||!e.synced||!e.canWrite)return;let{collab:t,handle:n,tab:o}=e,r=t.canonicalRevOf(n.doc),i=t.sourceText(n.doc).toString(),s;try{s=await be(o,i)}catch{return}if(!e.synced||t.canonicalRevOf(n.doc)!==r)return;let a=t.diffDocs(t.yDocToJson(n.doc),s.document);if(a===null)t.replaceYStructure(n.doc,s.document,t.MIRROR_ORIGIN);else if(a.length>0)try{t.applyDocOpsToY(n.doc,a,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(n.doc,s.document,t.MIRROR_ORIGIN)}let l=t.frontmatterMap(n.doc),c=s.frontmatter??{};n.doc.transact(()=>{let d=[...l.keys()];for(let m of d)if(!(m in c))l.delete(m);for(let[m,y]of Object.entries(c))if(!t.deepEqual(l.get(m),y))l.set(m,y)},t.MIRROR_ORIGIN)}function rI(e){let t=R(e)?.session;if(!t?.synced)return null;let{collab:n,handle:o}=t,r=null,i=()=>r!==null&&t.sourceLockOwner===r;return{awareness:o.awareness,enter:async()=>{r={},t.sourceLockOwner=r;let s=o.awareness.getLocalState();if(s)o.awareness.setLocalState({...s,mode:"source"});if(!t.canWrite)return;let a=null;if(N)try{a=await N(e)}catch{a=null}if(!i())return;n.acquireSourceCanonical(o.doc,a??n.sourceText(o.doc).toString(),n.LOCAL_ORIGIN)},leave:()=>{if(!i()){r=null;return}r=null,t.sourceLockOwner=null;let s=o.awareness.getLocalState();if(s)o.awareness.setLocalState({...s,mode:"structure"});if(!t.canWrite)return;if(n.otherSourceEditors(o.awareness,t.path,o.awareness.clientID).filter((l)=>o.awareness.getStates().get(l)?.canWrite!==!1).length===0)ct(t).then(()=>{n.releaseSourceCanonical(o.doc,n.LOCAL_ORIGIN)})},localOrigin:n.LOCAL_ORIGIN,readOnly:!t.canWrite,text:n.sourceText(o.doc)}}function km(e){let t=on(e);return t.active&&t.readOnly}async function YC(e){let t=R(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await he(t),await t.handle.flush(),!0}async function ZC(){for(let e of xe)if(R(e)?.session?.synced)await YC(e)}var xe=new Set;function Y(e){if(!st()?.collab||!e.documentPath||e.documentPath===ai)return;let n=ve(e);if(n.watcherInstalled)return;n.watcherInstalled=!0,rn(),xe.add(e),e.scope.run(()=>{Q(()=>{if(n.optedOut.value)te(e);else Pe(e)}),Xa(()=>{xe.delete(e),te(e)})})}function XC(e,t){let n=ve(e);if(n.optedOut.value===!t)return;if(n.optedOut.value=!t,!n.watcherInstalled&&t)Y(e)}function QC(e){return R(e)?.optedOut.value!==!0}function ut(e){if(!R(e)?.watcherInstalled){Y(e);return}te(e),Pe(e)}async function Pe(e){let t=ve(e);if(t.session||t.attaching)return;let{documentPath:n}=e,o=st();if(!n||!o?.collab){on(e).status="unavailable";return}let{generation:r}=t,i=on(e);i.status="connecting",i.attachError="";let s=(async()=>{try{let[a,l]=await Promise.all([nn(),o.collab(n)]);if(!l){i.status="detached";return}if(t.generation!==r){l.destroy();return}let c=null,d=new Promise((m,y)=>{c=setTimeout(()=>y(Error("collab-sync-timeout")),Qt)});try{await Promise.race([l.whenSynced,d])}finally{if(c)clearTimeout(c)}if(t.generation!==r){l.destroy();return}t.session=dn(e,n,a,l),i.active=!0,i.status="synced",i.readOnly=!t.session.canWrite,i.attachError="",tt(n)}catch(a){i.status="failed",i.active=!1,i.attachError=a instanceof Error?a.message:String(a),S.warn(`Live collaboration is not available for "${n}" — ${i.attachError}`,{key:`collab:${n}`,path:n,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=s,await s}function te(e){let t=R(e);if(!t)return;t.generation+=1;let{session:n}=t;t.session=null;let o=on(e);if(o.active=!1,o.status="detached",o.attachError="",o.peers=[],!n)return;if(nt(n.path),n.mirrorTimer)clearTimeout(n.mirrorTimer);if(n.sourceParseTimer)clearTimeout(n.sourceParseTimer);for(let r of n.disposers)try{r()}catch{}_m(e,null),e.history.snapshots=[{document:No(re(e.doc.document)),selection:ms(e.session.selection)}],e.history.index=0,n.undoManager?.destroy(),n.handle.destroy()}function dn(e,t,n,o){let r=o.identity(),i={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:r?r.permission!=="read":!0,collab:n,disposers:[],handle:o,lastSeenRef:re(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(n.metaMap(o.doc).get("structureSeeded")===!0){let h=n.yDocToJson(o.doc),x=No(re(e.doc.document));if(!n.deepEqual(h,x)){let w=n.diffDocs(x,h);if(w===null)i.synced=!0,pe(i),i.synced=!1;else if(w.length>0)ue(e,w)}i.applyingRemoteFrontmatter=!0;let T=n.frontmatterMap(o.doc);for(let[w,J]of T.entries())e.doc.content.frontmatter[w]=J;i.applyingRemoteFrontmatter=!1}else if(i.canWrite)n.seedStructure(o.doc,No(re(e.doc.document)),{frontmatter:No(re(e.doc.content.frontmatter)),origin:n.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});i.lastSeenRef=re(e.doc.document),i.disposers.push(o.onDirty((h)=>{e.doc.dirty=h})),o.awareness.setLocalState({canWrite:i.canWrite,focusedPath:t,structuralSelection:null,user:r?{avatarUrl:r.avatarUrl,color:r.color,login:r.login,name:r.name}:{color:n.colorForKey(String(o.awareness.clientID)),login:`guest-${o.awareness.clientID%1000}`}});let a=new n.UndoManager([n.structureMap(o.doc),n.frontmatterMap(o.doc)],{trackedOrigins:new Set([n.LOCAL_ORIGIN])});i.undoManager=a;let l=({stackItem:h})=>{h.meta.set("selection",ms(e.session.selection))},c=({stackItem:h})=>{let x=h.meta.get("selection");e.session.selection=ms(x??[])};a.on("stack-item-added",l),a.on("stack-item-popped",c),i.disposers.push(()=>{a.off("stack-item-added",l),a.off("stack-item-popped",c)}),_m(e,{canRedo:()=>a.canRedo(),canUndo:()=>a.canUndo(),redo:()=>{a.redo()},undo:()=>{a.undo()}});let d=n.structureMap(o.doc),m=(h,x)=>{if(x.origin===n.LOCAL_ORIGIN||!i.synced)return;let T=n.yEventsToDocOps(h);if(T===null){pe(i);return}if(T.length===0)return;try{ue(e,T)}catch{pe(i)}};d.observeDeep(m),i.disposers.push(()=>d.unobserveDeep(m));let y=on(e);y.sourceCanonical=n.canonicalOf(o.doc)==="source";let b=n.metaMap(o.doc),_=()=>{y.sourceCanonical=n.canonicalOf(o.doc)==="source"};b.observe(_),i.disposers.push(()=>b.unobserve(_));let I=n.sourceText(o.doc),Se=(h,x)=>{if(x.origin===n.MIRROR_ORIGIN||!i.synced)return;if(n.canonicalOf(o.doc)!=="source")return;if(!n.isSourceReconciler(o.awareness,i.path))return;if(i.sourceParseTimer)clearTimeout(i.sourceParseTimer);i.sourceParseTimer=setTimeout(()=>{i.sourceParseTimer=null,ct(i)},600)};I.observe(Se),i.disposers.push(()=>I.unobserve(Se));let k=n.frontmatterMap(o.doc),Ce=(h,x)=>{if(x.origin===n.LOCAL_ORIGIN||!i.synced)return;i.applyingRemoteFrontmatter=!0;try{for(let[T,w]of h.changes.keys)if(w.action==="delete")delete e.doc.content.frontmatter[T];else e.doc.content.frontmatter[T]=k.get(T)}finally{i.applyingRemoteFrontmatter=!1}};k.observe(Ce),i.disposers.push(()=>k.unobserve(Ce)),e.scope.run(()=>{let h=JSON.stringify(e.doc.content.frontmatter);Q(()=>{let x=JSON.stringify(e.doc.content.frontmatter);if(x===h)return;if(h=x,i.applyingRemoteFrontmatter||!i.synced||!i.canWrite)return;let T=JSON.parse(x);o.doc.transact(()=>{let w=[...k.keys()];for(let J of w)if(!(J in T))k.delete(J);for(let[J,Re]of Object.entries(T))if(!n.deepEqual(k.get(J),Re))k.set(J,Re)},n.LOCAL_ORIGIN),ee(i)}),Q(()=>{let x=e.session.selection.length>0?ms(e.session.selection):null,T=o.awareness.getLocalState();if(T)o.awareness.setLocalState({...T,structuralSelection:x})}),Q(()=>{let x=re(e.doc.document);queueMicrotask(()=>{if(R(e)?.session!==i||!i.synced||!i.canWrite)return;let w=re(e.doc.document);if(w!==x||w===i.lastSeenRef)return;i.lastSeenRef=w,z(i),ee(i)})})});let oe=on(e),ie=()=>{let h=[];for(let[x,T]of o.awareness.getStates())if(x!==o.awareness.clientID&&T.user)h.push({clientId:x,state:T});oe.peers=h};return ie(),o.awareness.on("change",ie),i.disposers.push(()=>o.awareness.off("change",ie),o.onStatus((h)=>{if(h==="offline"||h==="connecting")oe.status="offline";else if(i.synced)oe.status="synced"}),o.onReset(()=>{te(e),Pe(e)})),i.synced=!0,i}function C(e,t,n){return RangeError(`command "${e}" argument "${t}": ${n}`)}function O(e){if(e===void 0)return"missing";return typeof e==="string"?`"${e}"`:`${typeof e} ${JSON.stringify(e)}`}function ot(e,t,n){let o=t[n];if(typeof o!=="string"||o==="")throw C(e,n,`expected a non-empty string, got ${O(o)}`);return o}function Zo(e,t,n){if(t[n]===void 0)return;return ot(e,t,n)}function ft(e,t,n){let o=t[n];if(typeof o!=="number"||!Number.isFinite(o))throw C(e,n,`expected a finite number, got ${O(o)}`);return o}function dt(e,t,n){let o=t[n];if(typeof o!=="number"||!Number.isInteger(o))throw C(e,n,`expected an integer, got ${O(o)}`);return o}function yv(e,t,n,o,r){let i=ft(e,t,n);if(i<o||i>r)throw C(e,n,`${i} is outside the supported range ${o}–${r}`);return i}function yi(e,t,n){let o=t[n];if(typeof o!=="boolean")throw C(e,n,`expected a boolean, got ${O(o)}`);return o}function li(e,t,n,o){let r=t[n];if(typeof r!=="string"||!o.includes(r))throw C(e,n,`${O(r)} is not declared — declared: ${o.join(", ")||"none"}`);return r}function $x(e,t,n){let o=t[n];if(!Array.isArray(o)||!o.every((r)=>typeof r==="string"||typeof r==="number"))throw C(e,n,`expected an array of path segments (strings or numbers), got ${O(o)}`);return o}function ZL(e,t,n){if(t[n]===null)return null;return $x(e,t,n)}function KC(e,t,n){let o=t[n];if(!Array.isArray(o))throw C(e,n,`expected an array of document paths, got ${O(o)}`);return o.map((r,i)=>{if(!Array.isArray(r)||!r.every((s)=>typeof s==="string"||typeof s==="number"))throw C(e,n,`entry ${i} is not a document path — expected an array of segments, got ${O(r)}`);return r})}function ke(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function Ao(e,t){return{description:t,enum:[...e],type:"string"}}function fa(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function JC(e,t={}){return{description:e,type:"number",...t}}function ro(e){return{description:e,type:"boolean"}}function wv(e,t=!1){let n={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[n,{type:"null"}]}:{description:e,...n}}function XL(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function je(e){return{description:e,type:"string"}}function fn(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Oe(e){return Array.isArray(e)?e:[e]}function pt(e){let t=e;if("enum"in t)return"enum";if("const"in t)return"const";if(Array.isArray(t.oneOf))return"one-of";if(Array.isArray(t.type))return"typed";switch(t.type){case"boolean":return"boolean";case"number":case"integer":{if(t.minimum!==void 0&&t.maximum!==void 0)return"bounded-number";return t.type==="integer"?"integer":"number"}case"string":return"string";case"array":{let n=t.items?.type;if(Array.isArray(n))return fn(n)?"path":"pass-through";return n==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function mt(e,t){switch(e){case"null":return t===null;case"boolean":return typeof t==="boolean";case"string":return typeof t==="string";case"number":return typeof t==="number"&&Number.isFinite(t);case"integer":return typeof t==="number"&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return typeof t==="object"&&t!==null&&!Array.isArray(t);default:break}return!1}function gt(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function pn(e,t,n,o){let r=t[n];if(!o.some((i)=>mt(i,r)))throw C(e,n,`expected ${gt(o)}, got ${O(r)}`);return r}function bt(e){switch(pt(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>O(t)).join(" | ")}`;case"const":return`the constant ${O(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>bt(t)).join(" or ");case"typed":return gt(Oe(e.type??[]));case"boolean":return"a boolean";case"bounded-number":return`a number from ${e.minimum} to ${e.maximum}`;case"number":return"a finite number";case"integer":return"an integer";case"string":return"a non-empty string";case"path":return"a document path";case"path-list":return"a list of document paths";default:return"anything"}}function mn(e,t,n,o){let r=t[n],i=[];for(let s of o){if(s.type!==void 0&&!Oe(s.type).some((a)=>mt(a,r)))continue;try{return yt(e,t,n,s)}catch(a){i.push(a)}}if(i.length===1)throw i[0];throw C(e,n,`expected ${o.map((s)=>bt(s)).join(" or ")}, got ${O(r)}`)}function yt(e,t,n,o){switch(pt(o)){case"enum":return li(e,t,n,o.enum??[]);case"const":{let r=t[n];if(r!==o.const)throw C(e,n,`expected the constant ${O(o.const)}, got ${O(r)}`);return r}case"one-of":return mn(e,t,n,o.oneOf??[]);case"typed":return pn(e,t,n,Oe(o.type??[]));case"boolean":return yi(e,t,n);case"bounded-number":{if(o.type==="integer")dt(e,t,n);return yv(e,t,n,o.minimum,o.maximum)}case"number":return ft(e,t,n);case"integer":return dt(e,t,n);case"string":return ot(e,t,n);case"path":return $x(e,t,n);case"path-list":return KC(e,t,n);default:return t[n]}}function QL(e,t,n){let o=t,r=o.properties??{},i=Object.keys(r),s=o.required??[],a={};for(let[l,c]of Object.entries(n)){if(c===void 0||Object.hasOwn(r,l))continue;if(o.additionalProperties===!1)throw C(e,l,`not declared — declared: ${i.join(", ")||"none"}`);a[l]=c}for(let l of i){if(n[l]===void 0&&!s.includes(l))continue;a[l]=yt(e,n,l,r[l])}return a}var gn=20,An="primary",yp="secondary",eS=2,g=v({activePaneId:An,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:An,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Bs();return e.derived?.kind==="lens"?Bn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Bs().tabOrder}}),u=Bd(()=>g.activeTabId?g.tabs.get(g.activeTabId)??null:null);function Bs(){let{panes:e}=g;return e.find((t)=>t.id===g.activePaneId)??e[0]}function Bn(e){return g.panes.find((t)=>t.id===e)}function Gu(e){return g.panes.find((t)=>t.tabOrder.includes(e))}function Rr(e){let t=Bn(e);if(!t||t.id===g.activePaneId)return;g.activePaneId=t.id,A();let{activeTabId:n}=t;if(n){we(n);let o=g.tabs.get(n);if(o)Tt(o)}}function wp(e){return g.activePaneId===e}function Ox(e){let t=e??Bs().activeTabId,n=t?g.tabs.get(t):null;if(!t||!n)return null;let o=Gu(t);if(!o)return null;let r=Pl(o.id);return Cp(t),Ku(r,t),r.activeTabId=t,g.activePaneId=r.id,A(),we(t),r}function Mx(e){return g.panes.find((t)=>t.id!==e)??bn(yp)}function Pl(e){let t=Mx(e);if(t.derived)t.derived=null;return t}function bn(e){let t=Bn(e);if(t)return t;return g.panes=[...g.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],Bn(e)}function xp(e){if(g.panes.length<2)return;let t=e===An?g.panes.find((r)=>r.id!==An)?.id:e,n=t===void 0?void 0:Bn(t),o=g.panes.find((r)=>r.id!==t);if(!n||!o)return;for(let r of n.tabOrder)Ku(o,r);if(o.activeTabId=g.activePaneId===n.id?n.activeTabId??o.activeTabId:o.activeTabId??n.activeTabId,g.activePaneId=o.id,o.derived?.sourcePaneId===n.id)o.derived=null;g.panes=g.panes.filter((r)=>r.id!==n.id),A()}function _p(e){return e.tabOrder.length===0&&e.derived===null}function Cp(e){let t=[];for(let n of g.panes){if(!n.tabOrder.includes(e))continue;if(n.tabOrder=n.tabOrder.filter((o)=>o!==e),n.activeTabId===e)n.activeTabId=n.tabOrder.at(-1)??null;if(n.id!==An&&_p(n))t.push(n.id)}for(let n of t)xp(n)}function Ku(e,t,n){if(e.tabOrder.includes(t))return;let o=n??hn(e,t);e.tabOrder=[...e.tabOrder.slice(0,o),t,...e.tabOrder.slice(o)]}function yn(e){let t=0;for(let n of e.tabOrder){if(g.tabs.get(n)?.pinned!==!0)break;t+=1}return t}function hn(e,t){return g.tabs.get(t)?.pinned===!0?yn(e):e.tabOrder.length}function Ua(e,t=null){if(g.projectRoot&&e!==g.projectRoot)Lx();g.projectRoot=e,g.projectConfig=t}function Sp(e){let t=u.value;return e!==null&&t!==null&&re(t)===re(e)}function kc(e){if(!e)return!1;let t=g.tabs.get(e.id);return t!==void 0&&re(t)===re(e)}function we(e){g.mruOrder=[e,...g.mruOrder.filter((t)=>t!==e)]}var ne=null,Z=0;function A(){ne=null,Z=0}function Tt(e){if(D&&e.documentPath)D.selectedPath=e.documentPath}function X(e,t={}){let n=g.tabs.get(e),o=Gu(e);if(!n||!o)return;if(o.activeTabId=e,t.focus===!1)return;if(g.activePaneId=o.id,!t.cycling)A(),we(e);Tt(n)}function Oo(e){let t=g.tabs.get(e.id),n=e.preview===!0&&t?.pinned!==!0,o=cv({...e,preview:n}),r=(e.paneId===void 0?void 0:Bn(e.paneId))??Bs(),i;if(t)o.pinned=t.pinned,mp(t);else{if(n){let a=xt(r),l=a?g.tabs.get(a):null;if(l)kp(l);Px()}let s=n?xt(r):null;if(s)i=r.tabOrder.indexOf(s),Fx(s);Ku(r,o.id,i)}return g.tabs.set(o.id,o),X(o.id,{focus:e.focus!==!1}),Y(o),o}function xt(e){return e.tabOrder.find((t)=>g.tabs.get(t)?.preview===!0)??null}function Fl(e){let t=g.tabs.get(e);if(t?.preview===!0)t.preview=!1}function Px(){for(let[e,t]of g.tabs)if(t.preview&&t.doc.dirty)Fl(e)}function Sv(e,t){let n=g.tabs.get(e),o=Gu(e);if(!n||!o)return;if(n.pinned=t,t)n.preview=!1;let r=o.tabOrder.filter((s)=>s!==e),i=r.filter((s)=>g.tabs.get(s)?.pinned===!0).length;o.tabOrder=[...r.slice(0,i),e,...r.slice(i)]}function tS(e,t){let n=g.tabs.get(e),o=Gu(e);if(!n||!o)return;o.tabOrder=Pt(o,e,t)}function Pt(e,t,n){let o=g.tabs.get(t);if(!o)return e.tabOrder;let r=e.tabOrder.filter((c)=>c!==t),i=r.filter((c)=>g.tabs.get(c)?.pinned===!0).length,s=o.pinned?0:i,a=o.pinned?i:r.length,l=Math.min(Math.max(n,s),a);return[...r.slice(0,l),t,...r.slice(l)]}function Fx(e){let t=g.tabs.get(e);if(!t)return;let n=Gu(e),o=n?.activeTabId===e;if(xn(t),mp(t),g.tabs.delete(e),Cp(e),g.mruOrder=g.mruOrder.filter((s)=>s!==e),A(),n&&_p(n))xp(n.id);if(!o)return;let r=Bs(),i=g.mruOrder.find((s)=>r.tabOrder.includes(s))??r.tabOrder.at(-1)??null;if(i)X(i)}function nS(){let e=[...g.tabs.values()];g.tabs.clear(),Ot(),g.mruOrder=[],A();for(let t of e)mp(t)}function Ot(){g.panes=[{activeTabId:null,derived:null,id:An,tabOrder:[]}],g.activePaneId=An}function xn(e){if(!e.documentPath)return;let t=e.documentPath;g.closedTabs=[{documentPath:t},...g.closedTabs.filter((n)=>n.documentPath!==t)].slice(0,gn)}function vn(){let[e]=g.closedTabs;if(!e)return;return g.closedTabs=g.closedTabs.slice(1),e.documentPath}function vt(e){if(!ne)ne=g.mruOrder.filter((o)=>g.tabs.has(o)),Z=0;let t=ne;if(t.length<2)return;Z=((Z+e)%t.length+t.length)%t.length;let n=t[Z];return X(n,{cycling:!0}),n}function iS(e){let t=[...g.tabs.keys()],n=[...g.tabs.values()],o=cv(e);g.tabs.set(o.id,o),Ot(),g.panes[0].tabOrder=[o.id],g.mruOrder=[],A(),X(o.id),Y(o);for(let r of t){if(r===o.id)continue;g.tabs.delete(r)}for(let r of n)mp(r);return o}function ci(e,t={}){X(e,t)}function Em(e,t,n){let o=Bn(t);if(!o||!g.tabs.has(e))return null;if(o.tabOrder.includes(e)){if(n!==void 0)o.tabOrder=Pt(o,e,n);return o}return Cp(e),Ku(o,e,n),o}function kv(e,t,n){let o=g.tabs.get(e);if(!o)return;o.id=t,o.documentPath=n,g.tabs.delete(e),g.tabs.set(t,o);for(let r of g.panes)if(r.tabOrder=r.tabOrder.map((i)=>i===e?t:i),r.activeTabId===e)r.activeTabId=t;g.mruOrder=g.mruOrder.map((r)=>r===e?t:r),A(),ut(o)}function oS(e,t){e.registerAll([...Tn(t),...Pn(t)])}function Tn(e){let t=()=>g.tabs.size>1;return[{id:"document.nextTab",title:"Next Tab",category:"Document",level:"document",keybinding:["ctrl+tab","mod+tab"],menus:["palette"],group:"2_navigate",when:(n)=>n.document.open,enablement:t,requires:"a second open document",run:()=>{vt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(n)=>n.document.open,enablement:t,requires:"a second open document",run:()=>{vt(-1)}},{args:ke({path:je('Project-relative path of the file to open, e.g. "pages/about.json" or "components/nav-bar.json". It must exist.')}),id:"document.open",title:"Open Document",category:"Document",level:"project",menus:["palette"],group:"1_file",when:(n)=>n.project.open,requires:"an open project",aiTool:{description:"Open a project file as the active document; the document tools then operate on it. Use it when the user should SEE the page, or for iterative visual refinement after creating a page or component.",name:"open_document",report:({after:n,args:o})=>{let r=ot("document.open",o,"path"),i=u.value?.documentPath??null;if(i!==r)return`Opened "${r}", but the active document is ${i===null?"none":`"${i}"`}.`;let s=n.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${Wu[n.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${r}" is the active document, ${s}.`}},run:async(n,o)=>{let r=ot("document.open",o,"path");if(await e.openFile(r),![...g.tabs.values()].some((i)=>i.documentPath===r))throw RangeError(`command "document.open" argument "path": "${r}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:ke({file:je('Project-relative path of the file to open in the other pane, e.g. "pages/about.json". It must exist.')}),id:"document.openToSide",title:"Open to the Side",category:"Document",level:"project",menus:["context/file","palette"],group:"1_file",when:(n)=>n.project.open,requires:"an open project",undo:"none",run:async(n,o)=>{let r=ot("document.openToSide",o,"file"),i=Pl(Bs().id);if(await e.openFile(r,{paneId:i.id}),![...g.tabs.values()].some((s)=>s.documentPath===r)){if(_p(i)&&i.id!==An)xp(i.id);throw RangeError(`command "document.openToSide" argument "file": "${r}" could not be opened — it `+"does not exist, or no editor claims its format. Problems has the reason.")}}},{id:"document.reopenClosed",title:"Reopen Closed Document",category:"Document",level:"document",keybinding:"mod+shift+t",menus:["context/tab","palette"],group:"1_file",enablement:()=>g.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let n=vn();if(n)await e.openFile(n)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(n)=>n.document.open,requires:"an open document",run:()=>{let n=g.activeTabId,o=n?g.tabs.get(n):null;if(n&&o)Sv(n,!o.pinned)}},{args:ke({pinned:ro("True to pin the active document's tab, false to unpin it.")}),id:"document.setPinned",title:"Set Document Pinned",category:"Document",level:"document",menus:["palette"],group:"1_file",when:(n)=>n.document.open,requires:"an open document",run:(n,o)=>{let r=g.activeTabId;if(r&&g.tabs.get(r))Sv(r,yi("document.setPinned",o,"pinned"))}},{id:"document.keepOpen",title:"Keep Document Open",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(n)=>n.document.open,enablement:()=>{let n=g.activeTabId;return n!==null&&g.tabs.get(n)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let n=g.activeTabId;if(n)Fl(n)}}]}function Pn(e){let t=()=>g.panes.length>1;return[{id:"pane.splitRight",title:"Split Right",category:"View",level:"document",keybinding:"mod+\\",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(n)=>n.document.open,enablement:()=>g.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{Ox()}},{args:ke({path:je("Project-relative path of the document to open beside this one.")}),id:"pane.compareWith",title:"Compare With…",category:"View",level:"document",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(n)=>n.document.open,enablement:()=>g.activeTabId!==null,requires:"an open document",undo:"none",run:async(n,o)=>{let r=ot("pane.compareWith",o,"path"),i=Bs();if((i.activeTabId?g.tabs.get(i.activeTabId):null)?.documentPath===r)throw RangeError(`command "pane.compareWith" argument "path": "${r}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(Pl(i.id).id,r)}},{id:"pane.focusPrimary",title:"Focus Primary Pane",category:"View",level:"document",keybinding:"mod+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{Rr(An)}},{id:"pane.focusSecondary",title:"Focus Side Pane",category:"View",level:"document",keybinding:"mod+alt+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{Rr(yp)}},{id:"pane.unsplit",title:"Close Side Pane",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:t,requires:"a second pane",undo:"none",run:On}]}function On(){let e=g.panes.find((t)=>t.derived!==null);if(e?.id===An){if(e.derived=null,!_p(e))return}xp(e?.id??yp)}
|
|
2
|
+
export{kx,Jo,rv,SL,un,Do,Bu,kL,WC,zu,Wu,ha,EL,sv,$d,av,wm,Ex,TL,xm,oo,Ki,fp,lv,LL,VC,IL,RL,Tx,$L,Lx,UC,ai,cv,qC,DL,AL,mp,Te,NL,dv,ms,uv,OL,Nl,hv,ML,gp,PL,vi,q,js,pv,fv,Ix,FL,_m,jL,HL,Rx,BL,Ji,Vu,GC,bp,mv,zL,pa,qe,Sc,Yo,WL,gv,VL,bv,UL,qL,Hs,vv,mr,GL,Uu,KL,JL,YL,Ol,on,Cm,ot,Zo,yv,yi,li,$x,ZL,KC,ke,Ao,fa,JC,ro,wv,XL,je,QL,Dx,vp,Ax,Ml,xv,_v,Nx,eI,ma,Dd,qu,Sm,Cv,tI,No,nI,iI,oI,rI,km,YC,ZC,XC,QC,An,yp,eS,g,u,Bs,Bn,Gu,Rr,wp,Ox,Mx,Pl,xp,_p,Cp,Ku,Ua,Sp,kc,Oo,Fl,Px,Sv,tS,Fx,nS,iS,ci,Em,kv,oS};
|
|
3
|
+
|
|
4
|
+
//# debugId=6297725DE333B94D64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-27tc8q0h.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{p,We}from"./studio-6k1eswp9.js";import{_t,Lr,mL,ev,tv,Ur,bL,ju}from"./studio-tj28pxa1.js";import{S}from"./studio-0nm2skex.js";import{bs,Ct}from"./studio-z1vdxq0e.js";var s=null;async function bc(){if(!We()||typeof p().getAccountStatus!=="function"){s=null;return}try{s=await p().getAccountStatus?.()??null}catch{s=null}}function Ww(){return s}function Vw(){return s!==null&&s.installations.length===0&&Boolean(s.appInstallUrl)}function lT(){if(s===null)return null;let e=s.installations.flatMap((t)=>t.manageUrl?[{account:t.account??`Installation ${t.id}`,url:t.manageUrl}]:[]);if(e.length===0&&!s.appInstallUrl)return null;return{manage:e,...s.appInstallUrl?{installUrl:s.appInstallUrl}:{}}}function cT(){return s?.entries??[]}function H1(){return(s?.notices??[]).filter((e)=>e.display!=="toast")}var j=new Set;function I(){let e=(s?.notices??[]).filter((t)=>t.display==="toast"&&!j.has(t.id));for(let t of e)j.add(t.id);return e}var M="https://jxsuite.com/problems/";function tm(e){if(typeof e!=="string"||!e.startsWith("https://jxsuite.com/problems/"))return null;let t=e.slice(29);return t===""?null:t}function $o(e){if(typeof e==="string")return e.trim()===""?null:e;if(!e||typeof e!=="object")return null;let t=e;for(let o of[t.detail,t.error,t.title])if(typeof o==="string"&&o.trim()!=="")return o;return null}function Ps(e,t){return $o(e)??(t===void 0?"Request failed":`Request failed (${t})`)}var a=(e,t,o,r)=>({status:t,title:o,type:`${M}${e}`,...r===void 0?{}:{extensions:r}}),re={invalidRequest:a("invalid-request",400,"The request was malformed or incomplete"),notFound:a("not-found",404,"The requested resource does not exist"),methodNotAllowed:a("method-not-allowed",405,"That method is not allowed on this route"),conflict:a("conflict",409,"The request conflicts with the current state",["conflicts"]),payloadTooLarge:a("payload-too-large",413,"The request body is too large"),unauthorized:a("unauthorized",401,"Credentials are missing or not accepted"),forbidden:a("forbidden",403,"The request was refused"),needsInstallationAccess:a("needs-installation-access",403,"The GitHub App is not installed for that account",["installUrl"]),pathOutsideProject:a("path-outside-project",403,"The path resolves outside the active project"),actionRequired:a("action-required",403,"An action is required first",["actions","heading","retry"]),noActiveProject:a("no-active-project",409,"No project is active on this backend"),capabilityUnavailable:a("capability-unavailable",501,"This backend does not provide that capability"),upstreamFailure:a("upstream-failure",502,"An upstream service failed",["upstream"]),internalError:a("internal-error",500,"The backend failed to complete the request")};var Uw=".jx-loc-id",n=(e,t,o,r)=>({method:e,path:t,optional:r!==void 0,summary:o,...r===void 0?{}:{degradation:r}}),se={activate:n("POST","/__studio/activate","Bind the backend to a project root"),project:n("GET","/__studio/project","Root project metadata {name, root}"),projectInfo:n("GET","/__studio/project-info","Probe a directory: {isSiteProject, projectConfig?, directories?}"),resolveSite:n("GET","/__studio/resolve-site","Resolve the owning site of a file path {sitePath, projectConfig?, fileRelPath?}"),sites:n("GET","/__studio/sites","Enumerate site projects [{config, path}] (backs listProjects)","The welcome screen's Projects catalogue stays hidden."),findProject:n("GET","/__studio/find-project","Locate a project directory by name outside the root","openProject falls back to config-matching only."),locateDirectory:n("GET","/__studio/locate-directory","Resolve the absolute path of a showDirectoryPicker() folder by the id in its .jx-loc-id","Browse… reports that the folder could not be placed; the Location is typed by hand."),createProject:n("POST","/__studio/create-project","Scaffold a project at a caller-chosen destination → {root, config}"),starters:n("GET","/__studio/starters","Starter templates (StarterInfo[])","The New Project picker offers only blank/templates."),importSite:n("POST","/__studio/import-site","Clone a live website into a project; streams NDJSON progress","The New Project Import tab is unavailable."),files:n("GET","/__studio/files","List a directory (DirEntry[]) in stable path order; an entry may carry an opaque content `version` the backend vouches for; with ?glob=<pattern>, search matching files project-wide"),fileRead:n("GET","/__studio/file","Read a file's text content"),filesRead:n("POST","/__studio/files/read","Read many files' text content {paths} → ReadFilesResult {files: [path, {content} | "+"{error: {status, code?, message}}][], omitted}. At most READ_FILES_MAX_PATHS (200) paths and a backend byte budget per call: the excess is listed in `omitted` (never a 400) and the first path is always answered. Per-path errors: 404 missing/deleted, 415 binary, 413 too large, 502 upstream. Allowed for read-only sessions; keeps fileRead's server-side effects","Adapters fall back to one fileRead per path."),fileWrite:n("PUT","/__studio/file","Write a file's text content"),fileDelete:n("DELETE","/__studio/file","Delete a file"),fileUpload:n("POST","/__studio/file/upload","Upload binary content to a path → UploadResult {path, size?}. `path` is the answer, not an "+"echo: a store that de-duplicates, suffixes, or normalizes names reports what it really wrote"),fileBytes:n("GET","/__studio/file/bytes","A project file's raw bytes, undecoded — the read side of `fileUpload`, for a caller that must "+"not go through UTF-8","Studio can only read a project file as text, so any surface that must decode one stays hidden."),documentRaw:n("GET","/__studio/raw/","A project file as its own bytes, at its own URL — the mount a canvas renders against when "+"the editor origin does not serve the site's URL space. The project-relative path is appended to this prefix","The canvas cannot address project files by URL, so a host whose origin does not serve the site URL space renders no component $refs and no images."),fileRename:n("POST","/__studio/file/rename","Rename/move (+ refactor report). `from`/`to` are server-root-relative; every path in the "+"report is relative to the active project (specs/server.md §4.1)"),references:n("GET","/__studio/references","Where a file or a component tag is used (?path=&tag=, at least one) → ReferencesResult "+"{files, filesReferencing, refsTotal} — the read side of the rename refactor's own walker, "+"cached until the backend's watcher sees the tree move (backs findReferences). `?path=` is server-root-relative and every path in the answer is relative to the active project; a "+"target outside that project is a 400, never a zero-result 200 (specs/server.md §4.1)",'Usage counts are hidden: no "Used on N pages" in the inspector, no Selection: Find Usages, and delete/rename confirmations state no reference count.'),locate:n("POST","/__studio/locate","Find a file by name → {path | null}"),collab:n("GET","/__studio/collab","Realtime co-editing: a WebSocket upgrade speaking the @jxsuite/collab wire envelope (one socket per project, documents multiplexed by path; y-protocols sync + project-level "+"awareness in lib0 binary frames — see @jxsuite/collab/envelope for the frame layout and "+"the docEpoch/doc-reset lifecycle). A plain GET (no Upgrade) answers {collab, protocols, version} as the capability probe, and `protocols` is the subprotocol negotiation: the client offers one of them as Sec-WebSocket-Protocol and the server echoes it, or the "+"client offers none when the server advertises none, because RFC 6455 §4.1 fails a "+"connection whose offer went unechoed.","Realtime co-editing is unavailable; Studio edits solo with file-level saves"),components:n("GET","/__studio/components","Discover components (ComponentMeta[])"),cem:n("GET","/__studio/cem","Custom-elements manifest of an npm dependency","Dependency components lose prop/slot metadata."),formats:n("GET","/__studio/formats","The project's format registry entries plus a sibling `extensions` array — per enabled "+"extension its manifest identity and project-section contributions (ExtensionsInfo[]; backs listFormats and listExtensions).","Only .json documents open (backs listFormats); descriptor-contributed settings sections do not appear."),extensionCatalog:n("GET","/__studio/catalog","Extensions this backend can OFFER (ExtensionCatalogEntry[]) — the shipped first-party "+"catalogue plus any package in the project's own dependencies exporting a jx-extension.json, each marked with whether the host resolves it without a project install and whether the project has it installed. A capability rather than a constant: a Worker ships a fixed set "+"of extension packages (specs/extensions.md §5.5). Backs listExtensionCatalog.","The Extensions section offers no catalogue; adding an extension stays a typed package name."),projectSchemas:n("GET","/__studio/project-schemas","The project's generated entry documents (project.schema.json / document.schema.json), "+"PRE-BUNDLED into self-contained schemas — {project, document} (backs fetchProjectSchemas). "+"Regenerated on demand when missing or older than project.json.","The JSON editor falls back to the bundled core schemas (extension sections get no editor validation/completion)."),format:n("POST","/__studio/format","Dispatch a format capability {format, action: parse|serialize, source?|doc?}","Non-JSON documents cannot be parsed/serialized (backs formatAction)."),pluginSchema:n("GET","/__studio/plugin-schema","Extract a $studio schema from a class source","Plugin property panels fall back to generic JSON editing."),codeFormat:n("POST","/__studio/code/format","Format posted source {code, path?} → {code, errors}","Code editors skip format-on-open/save (codeService returns null)."),codeMinify:n("POST","/__studio/code/minify","Minify posted source {code} → {code}","Compiled-output minification is skipped."),codeLint:n("POST","/__studio/code/lint","Lint posted source {code, path?} → {diagnostics}","Code editors show no lint markers."),buildSite:n("POST","/__studio/build","Build or render the site → {routes, files, errors, mode?, url}","Build Site reports that this target cannot build."),previewSite:n("POST","/__studio/preview","Preview the working tree at a route → {routes, files, errors, mode, url, reused}","Open in Browser falls back to buildSite."),previewOverlay:n("POST","/__studio/preview/overlay","Publish (POST) or retract (DELETE) a document's unsaved bytes → 204","A live preview shows the last saved state instead of the editor's."),packages:n("GET","/__studio/packages","List dependencies (PackageInfo[])"),packagesAdd:n("POST","/__studio/packages/add","Add a dependency"),packagesRemove:n("POST","/__studio/packages/remove","Remove a dependency"),packagesInstall:n("POST","/__studio/packages/install","Run the package manager install","Install/reinstall affordances are hidden; manifest-only edits still work."),packagesNeedsInstall:n("GET","/__studio/packages/needs-install","Whether node_modules is stale","The install-on-open prompt never shows."),packagesVersions:n("GET","/__studio/packages/versions","Newest published version of each dependency (PackageVersionInfo[])","The Latest column stays empty and the update affordances are hidden."),packagesSetVersions:n("POST","/__studio/packages/set-versions","Rewrite dependency ranges and install","Bulk version updates are hidden."),gitStatus:n("GET","/__studio/git/status","Working-tree status (GitStatusResult)"),gitBranches:n("GET","/__studio/git/branches","Branch list (GitBranchesResult)"),gitLog:n("GET","/__studio/git/log","Recent commits (GitLogEntry[])"),gitStage:n("POST","/__studio/git/stage","Stage files"),gitUnstage:n("POST","/__studio/git/unstage","Unstage files"),gitCommit:n("POST","/__studio/git/commit","Commit staged (else all dirty) files"),gitPush:n("POST","/__studio/git/push","Push (cloud: sync check — commits land on push)"),gitPull:n("POST","/__studio/git/pull","Pull/fast-forward; 409 {conflicts} on overlap"),gitFetch:n("POST","/__studio/git/fetch","Refresh remote tracking state"),gitCheckout:n("POST","/__studio/git/checkout","Switch branches"),gitCreateBranch:n("POST","/__studio/git/create-branch","Create a branch"),gitDiff:n("GET","/__studio/git/diff","Unified diff of dirty files (or one path)"),gitShow:n("GET","/__studio/git/show","File content at a ref"),gitDiscard:n("POST","/__studio/git/discard","Discard working changes"),gitInit:n("POST","/__studio/git/init","Initialize a repository"),gitAddRemote:n("POST","/__studio/git/add-remote","Add a remote"),gitClone:n("POST","/__studio/git/clone","Clone a repository","The welcome screen hides Clone Git Repository."),gitPr:n("POST","/__studio/git/pr","Open a pull request → PullRequestInfo","Studio falls back to a direct GitHub API call with the user's token."),dataConnections:n("GET","/__studio/data/connections","Connector connections with configured/missingSecrets/isDefault state, reachable table names, and registry-descriptor provider metadata (DataConnectionsResponse; backs dataConnections)","The connections settings section shows no status, and data-domain actions stay hidden."),dataConnectionTest:n("POST","/__studio/data/connections/test","Probe a connection {connection} → DataConnectionTestResult (backs dataConnectionTest)","The Test Connection action is hidden."),dataPush:n("POST","/__studio/data/push","Additive schema push {connection?, dryRun?} → DataPushResult (plan of DataPushStep[], "+"applied, warnings/errors; backs dataPush)","The Push Schema action is hidden; schemas deploy via `jx db push` instead."),dataRows:n("GET","/__studio/data/rows","Page a table (DataRowsQuery params) → DataRowsResult {rows, total, columns} (backs dataRows)","The data grid is unavailable."),dataInsertRow:n("POST","/__studio/data/rows","Insert a row {table, connection?, values} → {row} (backs dataInsertRow)","The data grid hides its add-row footer."),dataUpdateRow:n("PUT","/__studio/data/rows","Update a row keyed on its primary key {table, connection?, pk, set} → {row} (backs "+"dataUpdateRow)","Data grid cells are read-only."),dataDeleteRow:n("DELETE","/__studio/data/rows","Delete a row (?table=&pk=&connection=) → {ok} (backs dataDeleteRow)","The data grid hides row deletion."),secretsList:n("GET","/__studio/secrets","Configured secret env-var NAMES, never values (SecretsListResponse; backs listSecrets)","Secret fields cannot show set/unset state."),secretsSet:n("PUT","/__studio/secrets","Write/remove secrets in the backend store (.dev.vars locally) {set?, remove?} → names "+"(backs setSecrets)","The secret form control renders disabled; secrets are edited in .dev.vars by hand."),aiChat:n("POST","/__studio/ai/chat","StreamEvent SSE chat proxy {messages, tools, systemPrompt, model}"),aiModels:n("GET","/__studio/ai/models","Model catalogue (AiModelsResponse)"),cfProxy:n("POST","/__studio/cf/proxy","Allowlisted Cloudflare API passthrough {path, method?, body?} (backs cfApi)","The Publish panel explains the git-push publishing path instead.")};var B1=200;var K=new Set(["reload","repeat","none"]);function $u(e){if(!Array.isArray(e))return[];return e.flatMap((t)=>{let o=t;if(!o||typeof o.id!=="string"||!o.id||typeof o.label!=="string"||!o.label)return[];return[{id:o.id,label:o.label,...typeof o.href==="string"&&o.href?{href:o.href}:{},...o.primary===!0?{primary:!0}:{}}]})}function qw(e){return typeof e==="string"&&K.has(e)?e:void 0}function H(e){return e.replaceAll("_","-")}function x(e){if(!e||typeof e!=="object")return{};let{actions:t,code:o,heading:r,installUrl:c,retry:m,type:u}=e,f=qw(m),i=tm(u)??(typeof o==="string"?H(o):null);return{...i===null?{}:{code:i},...typeof c==="string"?{installUrl:c}:{},...t===void 0?{}:{actions:$u(t)},...typeof r==="string"&&r?{heading:r}:{},...f===void 0?{}:{retry:f}}}function dT(e){let t=x(e);return t.code==="needs-installation-access"&&t.installUrl?t.installUrl:null}function uT(e){return x(e).code==="action-required"}function vc(){return Lr(_t.aiOpenAiKey)}function hT(e){Ur(_t.aiOpenAiKey,e||"")}function Eb(){return mL(_t.aiOpenAiKey)}function da(){return Lr(_t.aiBaseUrl)}function Tb(){return Lr(_t.aiModel)}function pT(e){Ur(_t.aiModel,e||"")}function fT(e){bL([[_t.aiOpenAiKey,e.apiKey],[_t.aiBaseUrl,e.baseUrl],[_t.aiModel,e.model]])}function mT(e){return!sp(_t.aiOpenAiKey,e.apiKey,vc())||!sp(_t.aiBaseUrl,e.baseUrl,da())||!sp(_t.aiModel,e.model,Tb())}function sp(e,t,o){return tv(e,t)===tv(e,o)}function gT(){ju([_t.aiOpenAiKey,_t.aiBaseUrl,_t.aiModel])}function Gw(){return{apiKey:vc(),baseUrl:da()}}function N(e){return`${e.apiKey}\x00${e.baseUrl}`}var g=null,R="",A=!1,_=!1,k="",T,v="",E=null,O=null,U=new Set,W=600000,b=0,L=!1;function Tr(){g=null,R="",A=!1,_=!1,k="",T=void 0,v="",E=null,O=null,b=0}var z=new Set([_t.aiOpenAiKey.key,_t.aiBaseUrl.key,_t.cfToken.key,_t.cfAccountId.key]);ev((e)=>{if(e.some((t)=>z.has(t)))Tr()});function z1(e){return g&&R===N(e)?g:null}function B(e){return g?.find((t)=>t.id===e)}function W1(e){return B(e)?.toolSupport}function bT(e){return B(e)?.contextWindow}function Lb(e){if(e)U.add(e);O??=bd({force:!0}).catch(()=>{}).then(()=>{b=Date.now();for(let t of U)t()})}function V(){if(!_||b===0||Date.now()-b<W)return!1;return O=null,b=0,Lb(),!0}function J(){if(typeof window>"u"||L)return;L=!0,window.addEventListener("focus",()=>{V()})}J();function nm(){return Eb()||Kw()}function Kw(){return A}function vT(){return _}function ap(){return T}function yT(){return v}function Jw(){return E}function Y(){return k}function Ba(){return Tb()||Y()||_t.aiModel.default}function X(e,t){let o;try{o=new URL(e,"http://jx.invalid")}catch{return e}return o.pathname=o.pathname.replace(/[^/]*$/,t),/^https?:/i.test(e)?o.href:`${o.pathname}${o.search}`}async function bd(e={}){let t=e.credentials??Gw(),o=N(t);if(g&&R===o&&!e.force)return g;let r=p(),c=await Promise.resolve(r.aiChatUrl()),m=X(c,"models"),u={};if(t.apiKey)u["X-Api-Key"]=t.apiKey;if(t.baseUrl)u["X-Api-Base-URL"]=t.baseUrl;let f=await fetch(m,{headers:u});if(!f.ok)throw Error(`HTTP ${f.status}`);let i=await f.json();return A=i.configured===!0,_=i.managed===!0,k=i.defaultModel??"",T=i.code,v=i.upstreamError!==void 0?i.upstreamMessage??"":"",E=i.code==="action_required"?{actions:$u(i.actions),...typeof i.detail==="string"&&i.detail?{detail:i.detail}:{}}:null,g=(i.models||[]).map((l)=>{let h={id:l.id,name:l.name||l.id};if(typeof l.contextWindow==="number")h.contextWindow=l.contextWindow;if(typeof l.toolSupport==="boolean")h.toolSupport=l.toolSupport;return h}),R=o,g}var w=new Set,C=null;function wT(e){if(w.size===0){C=e;return}for(let t of w)t(e)}function G(e){w.add(e);let t=C;if(C=null,t)e(t);return()=>{w.delete(e)}}function Yw(){return We()&&typeof p().performAction==="function"}function V1(e){let t=e.find((r)=>r.primary)??e[0];if(!t)return null;let o=e.find((r)=>r!==t);return o?{lead:t,other:o}:{lead:t}}var P=null,q=!1;function Zw(e){let t=V1(e.actions);if(!Yw()||!t)return Promise.resolve(!1);return P??=Q(e,t).finally(()=>{P=null}),P}async function lp(e){let t=x(e);if(t.code!=="action-required"||!t.actions?.length)return!1;return Zw({actions:t.actions,detail:e instanceof Error?e.message:void 0,heading:t.heading,retry:t.retry})}async function F(){Tr(),await bc(),U1()}function Q(e,t){let o=e.detail??"This needs one more step first.";return new Promise((r)=>{let c="offer",m=(y)=>{if(c==="done")return;c="done",h.close(),r(y)},u=(y)=>{c="offer",h.update({cancelLabel:"Not now",confirmLabel:t.lead.label,message:y,secondaryLabel:t.other?.label??""})},f=(y)=>{if(c!=="offer")return;c="waiting";let D;try{D=p().performAction(y)}catch(d){u(d instanceof Error?d.message:String(d));return}h.update({cancelLabel:"Cancel",confirmLabel:"Waiting…",message:"Finish in the window that opened. This closes by itself once it is done.",secondaryLabel:""}),D.then(async(d)=>{if(d?.status==="done"){await F(),m(!0);return}if(c!=="waiting"||!d||d.status==="redirect")return;bc(),u(o)},(d)=>{if(c==="waiting")u(d instanceof Error?d.message:String(d))})},{lead:i,other:l}=t,h=bs({cancelLabel:"Not now",confirmLabel:i.label,headline:e.heading??"One more step",layer:Ct("dialog"),message:o,onCancel:()=>{q=!0,m(!1)},onClosed:()=>{m(!1)},onConfirm:()=>{f(i)},region:"account/action",...l?{onSecondary:()=>{f(l)},secondaryLabel:l.label}:{}})})}function Z(e){if(e==="reload")location.reload();else if(e==="repeat")S.info("Done. Run that again now.",{key:"account.action.retry",source:"Account"})}function xT(){return G((e)=>{if(q||P)return;Zw(e).then((t)=>{if(t)Z(e.retry)})})}async function Ib(e){if(!Yw())return!1;let t=p().performAction(e),o;try{o=await t}catch(r){return S.error(r instanceof Error?r.message:String(r),{key:"account.action",source:"Account",tier:"toast"}),!1}if(o?.status==="done")return await F(),!0;if(o?.status!=="redirect")await bc();return!1}function U1(){for(let e of I()){let t={key:`account.notice.${e.id}`,source:"Account"};if(e.level==="warning")S.warn(e.message,t);else S.info(e.message,t)}}
|
|
2
|
+
export{bc,Ww,Vw,lT,cT,H1,tm,$o,Ps,Uw,B1,$u,qw,dT,uT,vc,hT,Eb,da,Tb,pT,fT,mT,sp,gT,Gw,Tr,z1,W1,bT,Lb,nm,Kw,vT,ap,yT,Jw,Ba,bd,wT,Yw,V1,Zw,lp,xT,Ib,U1};
|
|
3
|
+
|
|
4
|
+
//# debugId=6BE6D5ECC77DA6EF64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-28pz4s1k.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function a(t,n=[]){if(t?.tagName==="slot"){let e=t.attributes?.name;n.push(typeof e==="string"?e.trim():"")}if(Array.isArray(t?.children))for(let e of t.children)a(typeof e==="string"?void 0:e,n);return n}function
|
|
2
|
-
export{
|
|
1
|
+
function a(t,n=[]){if(t?.tagName==="slot"){let e=t.attributes?.name;n.push(typeof e==="string"?e.trim():"")}if(Array.isArray(t?.children))for(let e of t.children)a(typeof e==="string"?void 0:e,n);return n}function _b(t){let n=a(t),e=n.filter((s)=>s==="").length;if(e>1)return`Component has ${e} unnamed <slot> elements — only one default slot is allowed. Give extra slots a name attribute.`;let r=new Set;for(let s of n){if(s&&r.has(s))return`Duplicate slot name "${s}" — slot names must be unique within a component.`;r.add(s)}return null}
|
|
2
|
+
export{_b};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=27D12B5D71CFEEAD64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-36s6qjgq.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{p}from"./studio-6k1eswp9.js";import{v}from"./studio-0nm2skex.js";import{g}from"./studio-27tc8q0h.js";import{qt,wi,Zt,Ka,$r,Us}from"./studio-ft8pfpp0.js";import{Ms,mc}from"./studio-b5rxwkj2.js";import{ds,wb,xb,Ha,Er}from"./studio-eb5sty2k.js";import{D}from"./studio-153mwkyq.js";import{me}from"./studio-09n3fyy0.js";var fc="draft",bb="Marked a draft. Studio filters drafts out of its own lists; the build does not exclude them yet.";function Tu(e){return e?.[fc]===!0}function N(e){return e?.properties?.[fc]?.type==="boolean"}function Jf(e,t){return N(e)||Tu(t)}var E=v({includeDrafts:!1});function G(){return E.includeDrafts}function BE(e){E.includeDrafts=e}function K(e,t,r){return r?e:e.filter((o)=>!Tu(t(o)))}var b="__path";function vb(e){let r=(D?.projectConfig?.content??{})[e];if(!r?.source)return null;let o=r.source.replace(/^\.\//,"").replace(/\/$/,""),f=r.format==="json"?".json":wi(r.format)?.extensions[0]??$r()?.extensions[0]??".json";return{def:r,dir:o,ext:f,name:e}}function Pw(){let e=D?.projectConfig?.content??{};return Object.entries(e).filter(([,t])=>{let r=t.source?.replace(/^\.\//,"")??"";return r!==""&&!/\.[a-z0-9]+$/i.test(r)}).map(([t,r])=>({dir:r.source.replace(/^\.\//,"").replace(/\/$/,""),name:t}))}async function P(e,t){let r=p(),o=[],f=async(x)=>{let w;try{w=await r.listDirectory(x)}catch{return}for(let C of w)if(C.type==="directory")await f(C.path);else if(t.some((k)=>C.path.endsWith(k)))o.push(C.path)};return await f(e),o.toSorted()}async function I1(e){await qt().catch(()=>{});let t=vb(e);if(!t)return[];return(await P(t.dir,[t.ext])).map((o)=>{let f=o.split("/").pop()??o;return f.slice(0,f.length-t.ext.length)})}async function V(e,t,r){let o=Array.from({length:e.length}),f=0,x=Array.from({length:Math.min(t,e.length)},async()=>{while(f<e.length){let w=f;f+=1,o[w]=await r(e[w])}});return await Promise.all(x),o}function T(e){if(e===null||e===void 0)return null;if(typeof e==="string"||typeof e==="number"||typeof e==="boolean")return e;if(Array.isArray(e)&&e.every((t)=>typeof t!=="object"||t===null))return e.map(String);return JSON.stringify(e)}function I(e){for(let t of g.tabs.values())if(t.documentPath===e)return t;return null}function W(e,t){return e.every((r)=>{let o=r[t];return o===null||o===void 0||typeof o!=="string"?!0:!o.startsWith("{")&&!o.startsWith("[")})}var j=new WeakSet;async function R1(){let e=[];for(let t of g.tabs.values()){let r=Ha(t);if(r&&j.has(r.source))e.push(r.load())}await Promise.all(e)}function A(e){let t=M(e);if(e.drafts)j.add(t);return t}function M(e){let t=new Map,r=null,o=null,f=(l=!1)=>{if(!l&&r)return r;return r=(async()=>{await qt().catch(()=>{});let c=p(),a=await e.list();t.clear(),o=null;let u=await V(a,32,async(n)=>{try{let i=await c.readFile(n),s=await Er(n,i);return{document:s.document,formatName:s.format.name,frontmatter:s.frontmatter??{},rawText:i}}catch{return null}});for(let[n,i]of a.entries()){let s=u[n];if(s)t.set(i,s)}})(),r},x=()=>{if(o)return o;let l={editable:!1,field:b,insertOnly:!0,kind:"string",pk:!0,required:!0,title:"Path",widthHint:220},c=wb(e.schema()),a=new Set([b,...c.map((i)=>i.field)]),u=[...t.values()].map((i)=>{let s={};for(let[d,m]of Object.entries(i.frontmatter))if(!a.has(d)&&!d.startsWith("$"))s[d]=T(m);return s}),n=xb(u);for(let i of n)i.editable=i.kind!=="text"||W(u,i.field);if(e.priorityFields?.length){let i=(s)=>{let d=e.priorityFields.indexOf(s.field);return d===-1?e.priorityFields.length:d};n.sort((s,d)=>i(s)-i(d))}return o=C([l,...c,...n]),o},w=()=>{if(!e.drafts)return!1;let l=e.schema();return Jf(l)||[...t.values()].some((c)=>Jf(l,c.frontmatter))},C=(l)=>{let c=l.findIndex((u)=>u.field===fc);if(c<1||!w())return l;let a=l.filter((u)=>u.field!==fc);return[a[0],l[c],...a.slice(1)]},k=(l,c)=>{let a={[b]:l};for(let u of x()){if(u.field===b)continue;a[u.field]=T(c.frontmatter[u.field])}return{cells:a,fingerprint:c.rawText,key:l}},O=async(l,c,a)=>{let u=p(),n={...c.frontmatter};for(let m of a)if(m.value===null)delete n[m.field];else n[m.field]=m.value;let i=c.document,s={...n,...i,children:i.children??[]},d=await Us(c.formatName,s,{mode:"roundtrip"});Ms(l),await u.writeFile(l,d),t.set(l,{...c,frontmatter:n,rawText:d})};return{backingPaths:()=>new Map([...t.keys()].map((l)=>[l,l])),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return await f(),x()},async commit(l){await f();let c=p(),a={cells:[],deletes:[],inserts:[]},u=new Map;for(let n of l.cells){let i=u.get(n.rowKey)??[];i.push({field:n.field,value:n.value}),u.set(n.rowKey,i)}for(let[n,i]of u){let s=(h,F,R)=>{for(let S of i)a.cells.push({error:F,field:S.field,ok:h,rowKey:n,stale:R})},d=t.get(n);if(!d){s(!1,"Entry no longer loaded — refresh the grid");continue}let m=I(n);if(m?.doc.dirty){s(!1,"Open in a tab with unsaved changes — save or close it first");continue}let y=null;try{y=await c.readFile(n)}catch{y=null}if(y!==d.rawText&&!mc(n)){s(!1,"File changed on disk — refresh to reload",!0);continue}try{if(await O(n,d,i),s(!0),m){let{reloadFileInTab:h}=await (me("kb0epdxf"),import("./files-kb0epdxf.js"));h(n)}}catch(h){s(!1,h instanceof Error?h.message:String(h))}}for(let n of l.inserts){let i=n.cells[b];if(typeof i!=="string"||i.trim()===""){a.inserts.push({error:"Path is required",ok:!1,tempKey:n.tempKey});continue}let s=e.resolveInsertPath(i),d=t.has(s);if(!d)try{await c.readFile(s),d=!0}catch{d=!1}if(d){a.inserts.push({error:`${s} already exists`,ok:!1,tempKey:n.tempKey});continue}let m=e.insertFormatName(s);if(!m){a.inserts.push({error:`No format can serialize ${s}`,ok:!1,tempKey:n.tempKey});continue}try{let y={};for(let[R,S]of Object.entries(n.cells))if(R!==b&&S!==null)y[R]=S;let h=await Us(m,{...y,children:[]},{frontmatter:Object.keys(y).length>0,mode:"roundtrip"});Ms(s),await c.writeFile(s,h);let F=await Er(s,h);t.set(s,{document:F.document,formatName:F.format.name,frontmatter:F.frontmatter??{},rawText:h}),a.inserts.push({newKey:s,ok:!0,tempKey:n.tempKey})}catch(y){a.inserts.push({error:y instanceof Error?y.message:String(y),ok:!1,tempKey:n.tempKey})}}for(let n of l.deletes){if(I(n.rowKey)){a.deletes.push({error:"Open in a tab — close it first",ok:!1,rowKey:n.rowKey});continue}try{Ms(n.rowKey),await c.deleteFile(n.rowKey),t.delete(n.rowKey),a.deletes.push({ok:!0,rowKey:n.rowKey})}catch(i){a.deletes.push({error:i instanceof Error?i.message:String(i),ok:!1,rowKey:n.rowKey})}}return a},id:e.id,label:e.label,async refresh(){await f(!0)},async rows(){await f();let c=(e.drafts?K([...t.entries()],([,a])=>a.frontmatter,G()):[...t.entries()]).map(([a,u])=>k(a,u));return{rows:c,total:c.length}}}}function $1(e){let t=()=>{let r=vb(e);if(!r)throw Error(`No content collection named "${e}" in project.json`);return r};return A({drafts:!0,id:ds({kind:"collection",name:e}),insertFormatName:(r)=>{let o=t();return(o.def.format?wi(o.def.format)?.name:void 0)??Zt(r)?.name??$r()?.name??null},label:e,list:()=>{let r=t();return P(r.dir,[r.ext])},resolveInsertPath:(r)=>{let o=t(),f=r.trim().replace(/^\.\//,"").replace(/^\//,"");if(!f.includes("/"))f=`${o.dir}/${f}`;if(!f.endsWith(o.ext))f=`${f}${o.ext}`;return f},schema:()=>t().def.schema})}function D1(){let e=()=>{let t=Ka("page").filter((r)=>r!==".json");return t.length>0?t:[".md"]};return A({id:ds({kind:"pages"}),insertFormatName:(t)=>Zt(t)?.name??null,label:"Pages",list:()=>P("pages",e()),priorityFields:["title","description"],resolveInsertPath:(t)=>{let r=t.trim().replace(/^\.\//,"").replace(/^\//,"");if(!r.startsWith("pages/"))r=`pages/${r}`;if(!e().some((o)=>r.endsWith(o)))r=`${r}${e()[0]}`;return r},schema:()=>null})}
|
|
2
|
+
export{fc,bb,Tu,Jf,BE,vb,Pw,I1,R1,$1,D1};
|
|
3
|
+
|
|
4
|
+
//# debugId=381326752288D6F764756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-4yztve2t.js.map
|