@jxsuite/studio 8.0.1 → 9.0.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/dist/chunks/{2020-5wtzce5g.js → 2020-89fz3pfy.js} +3 -3
- package/dist/chunks/adapter-ay13gema.js +4 -0
- package/dist/chunks/add-new-flow-nmkqpjym.js +4 -0
- package/dist/chunks/cf-account-picker-2e06qxey.js +4 -0
- package/dist/chunks/cf-settings-5y04810c.js +4 -0
- package/dist/chunks/color-04361ttk.js +4 -0
- package/dist/chunks/{color-area-6rbra5dy.js → color-area-h8dbasp1.js} +2 -2
- package/dist/chunks/{color-field-gy56c94g.js → color-field-qv5r2b16.js} +3 -3
- package/dist/chunks/{color-slider-sqqdyf6c.js → color-slider-nz2mrzky.js} +2 -2
- package/dist/chunks/{combobox-72h32ejk.js → combobox-6hs00996.js} +2 -2
- package/dist/chunks/components-3vf75n83.js +4 -0
- package/dist/chunks/content-source-4f2raf4a.js +4 -0
- package/dist/chunks/{convert-to-repeater-he70fc2b.js → convert-to-repeater-j9hfcj4f.js} +3 -3
- package/dist/chunks/editor-645krvtz.js +4 -0
- package/dist/chunks/entry-commands-3qmv8wkr.js +4 -0
- package/dist/chunks/{extension-sections-0egb88dm.js → extension-sections-thfke054.js} +3 -3
- package/dist/chunks/file-ops-kkhp9ma7.js +4 -0
- package/dist/chunks/files-yswdhxrf.js +4 -0
- package/dist/chunks/format-host-4g8ex6bz.js +4 -0
- package/dist/chunks/fs-events-z9gpvc6t.js +4 -0
- package/dist/chunks/grid-open-fm4j183c.js +4 -0
- package/dist/chunks/{grid-view-qg1b5eqx.js → grid-view-7d2nx83y.js} +16 -15
- package/dist/chunks/{icons-63bjtbs7.js → icons-853n6qt3.js} +2 -2
- package/dist/chunks/{iframe-entry-pkgmcgp0.js → iframe-entry-2x9bn5ng.js} +4 -4
- package/dist/chunks/{iframe-entry-99nr5zfb.js → iframe-entry-42hpmwz5.js} +4 -4
- package/dist/chunks/{iframe-entry-76j8vwwx.js → iframe-entry-b5qgggyp.js} +2 -2
- package/dist/chunks/{iframe-entry-2zggzajv.js → iframe-entry-btck0e9s.js} +4 -4
- package/dist/chunks/iframe-host-q7fedsmr.js +4 -0
- package/dist/chunks/{index-32eqzv1k.js → index-jxmt7vh8.js} +3 -3
- package/dist/chunks/index-pt4wh98x.js +4 -0
- package/dist/chunks/{javascript-pjp734q4.js → javascript-vmqp56ke.js} +2 -2
- package/dist/chunks/{jsonMode-njkvsa02.js → jsonMode-n3wmpant.js} +5 -5
- package/dist/chunks/jx-validate-19y62knt.js +4 -0
- package/dist/chunks/layers-panel-1qvc83y9.js +4 -0
- package/dist/chunks/layers-qf0bc7ze.js +4 -0
- package/dist/chunks/{listbox-c421cf8c.js → listbox-7gka1h86.js} +2 -2
- package/dist/chunks/lit-html-wyqw04y2.js +4 -0
- package/dist/chunks/media-library-f9d5qcjb.js +4 -0
- package/dist/chunks/media-picker-rsb1fmk2.js +4 -0
- package/dist/chunks/{menu-bdpzbfvs.js → menu-d2jxpgma.js} +2 -2
- package/dist/chunks/{monaco-binding-vq1hgnn0.js → monaco-binding-wfhmz89d.js} +3 -3
- package/dist/chunks/monaco-buffer-ak0raadw.js +4 -0
- package/dist/chunks/{monaco-setup-xrd2cbkp.js → monaco-setup-fty7a8vg.js} +3 -3
- package/dist/chunks/notify-4qj70q0x.js +4 -0
- package/dist/chunks/parse-n8dfxnqf.js +4 -0
- package/dist/chunks/platform-ehg6t9vd.js +4 -0
- package/dist/chunks/{popover-b89sfej7.js → popover-9tf4cjrk.js} +2 -2
- package/dist/chunks/publish-panel-yhmda3cd.js +4 -0
- package/dist/chunks/{publish-quick-qx2455cj.js → publish-quick-12hh8926.js} +3 -3
- package/dist/chunks/publish-workspace-hx8qdv9p.js +4 -0
- package/dist/chunks/quick-search-r955m3q1.js +4 -0
- package/dist/chunks/references-8gxv0x7t.js +4 -0
- package/dist/chunks/right-panel-jarwqjpy.js +4 -0
- package/dist/chunks/source-control-84qt25m9.js +4 -0
- package/dist/chunks/{split-c9zfdgxf.js → split-m5rwn31z.js} +2 -2
- package/dist/chunks/studio-0nefxhar.js +7 -0
- package/dist/chunks/studio-0rg30pvs.js +5 -0
- package/dist/chunks/{studio-s32578pn.js → studio-14hh60j8.js} +4 -4
- package/dist/chunks/studio-1cfyd1ys.js +5 -0
- package/dist/chunks/studio-2bq7hheq.js +5 -0
- package/dist/chunks/{studio-zz9qe3rw.js → studio-32d8wyxq.js} +37 -37
- package/dist/chunks/studio-3hpcawh8.js +4 -0
- package/dist/chunks/{studio-svb7yyve.js → studio-4j35hgsw.js} +4 -4
- package/dist/chunks/{studio-x1x167jh.js → studio-4qg61g9j.js} +4 -4
- package/dist/chunks/studio-4rgem12q.js +5 -0
- package/dist/chunks/studio-6k9djnxw.js +5 -0
- package/dist/chunks/studio-6rbaedw2.js +9 -0
- package/dist/chunks/studio-732mw0g8.js +5 -0
- package/dist/chunks/studio-79r8msnr.js +7 -0
- package/dist/chunks/studio-7q6jdd4h.js +5 -0
- package/dist/chunks/{studio-r5qy30vx.js → studio-8hf8qcm1.js} +4 -4
- package/dist/chunks/{studio-8tr6cfrc.js → studio-8pne0rx4.js} +4 -4
- package/dist/chunks/{studio-y0n7yxea.js → studio-9179bsm7.js} +7 -7
- package/dist/chunks/{studio-pbxa5fpc.js → studio-9ff0vqff.js} +3 -3
- package/dist/chunks/studio-9gzvypw4.js +5 -0
- package/dist/chunks/studio-9ndgd55w.js +5 -0
- package/dist/chunks/studio-9ra9e7m4.js +5 -0
- package/dist/chunks/studio-a6e5fzve.js +5 -0
- package/dist/chunks/studio-a9k86nq6.js +5 -0
- package/dist/chunks/studio-ae7a69jc.js +6 -0
- package/dist/chunks/studio-aghsg0ds.js +7 -0
- package/dist/chunks/{studio-k3xxbagr.js → studio-ajw4k8hp.js} +3 -3
- package/dist/chunks/{studio-qmn1xc24.js → studio-apapy17g.js} +4 -4
- package/dist/chunks/{studio-8m0y2qe7.js → studio-by8x0jvc.js} +4 -4
- package/dist/chunks/{studio-wbcjbhy1.js → studio-c88gq88j.js} +5 -5
- package/dist/chunks/{studio-n0c5h6mf.js → studio-cg54vtet.js} +4 -4
- package/dist/chunks/studio-dvhxxxbd.js +5 -0
- package/dist/chunks/{studio-3q40e3rj.js → studio-e4rq6x0q.js} +4 -4
- package/dist/chunks/{studio-fbhxxc5f.js → studio-ekzbgnjp.js} +4 -4
- package/dist/chunks/studio-fg4fj9ec.js +10 -0
- package/dist/chunks/studio-fj6jzgxw.js +5 -0
- package/dist/chunks/{studio-nh6d342n.js → studio-g45r5vm8.js} +7 -7
- package/dist/chunks/{studio-a2bvaptz.js → studio-gczve8zf.js} +4 -4
- package/dist/chunks/studio-ge08zwpv.js +5 -0
- package/dist/chunks/studio-gk9yk8dj.js +12 -0
- package/dist/chunks/{studio-bbe4c90a.js → studio-gskkgfe3.js} +4 -4
- package/dist/chunks/{studio-83mk4bgg.js → studio-h4jbgne2.js} +8 -8
- package/dist/chunks/{studio-b7y5mr30.js → studio-hcy9zeac.js} +4 -4
- package/dist/chunks/studio-ht81xjkr.js +5 -0
- package/dist/chunks/{studio-jaaz8ce9.js → studio-jr30g4ae.js} +4 -4
- package/dist/chunks/{studio-qgh13jtz.js → studio-k5n4es74.js} +4 -4
- package/dist/chunks/{studio-ccv2svc6.js → studio-k6hbx2fc.js} +4 -4
- package/dist/chunks/{studio-9tmebf0s.js → studio-kqh7fxn6.js} +4 -4
- package/dist/chunks/{studio-q0mvbaq6.js → studio-kyw47pet.js} +4 -4
- package/dist/chunks/studio-mkw17ngg.js +5 -0
- package/dist/chunks/{studio-x9hsze61.js → studio-myb4mf0h.js} +4 -4
- package/dist/chunks/studio-n4qq1n57.js +5 -0
- package/dist/chunks/studio-nfmpmkqb.js +5 -0
- package/dist/chunks/studio-nfwacw31.js +5 -0
- package/dist/chunks/{studio-rthyg42z.js → studio-nm86874b.js} +172 -172
- package/dist/chunks/studio-nqexty8x.js +16 -0
- package/dist/chunks/studio-nr0kcqc6.js +5 -0
- package/dist/chunks/{studio-jsgf2q5k.js → studio-nvfa137z.js} +5 -5
- package/dist/chunks/studio-psh8mwnw.js +4 -0
- package/dist/chunks/studio-qd0cycm4.js +9 -0
- package/dist/chunks/{studio-tfkznv39.js → studio-qevf5z9d.js} +4 -4
- package/dist/chunks/studio-qs5fmhtj.js +14 -0
- package/dist/chunks/studio-ry4789ng.js +7 -0
- package/dist/chunks/studio-s4fq9jht.js +5 -0
- package/dist/chunks/studio-sc35ttdk.js +5 -0
- package/dist/chunks/studio-sm2f0sc6.js +6 -0
- package/dist/chunks/{studio-3qeh9t0h.js → studio-spza69tb.js} +5 -5
- package/dist/chunks/studio-t6dqnnft.js +5 -0
- package/dist/chunks/{studio-43sd2mam.js → studio-tfmhnwyr.js} +3 -3
- package/dist/chunks/studio-tn7v8gey.js +6 -0
- package/dist/chunks/{studio-tft6r105.js → studio-trcfer2b.js} +4 -4
- package/dist/chunks/studio-tyw7tk0x.js +5 -0
- package/dist/chunks/{studio-jcnsdaep.js → studio-tyzgte21.js} +4 -4
- package/dist/chunks/studio-vtey9w98.js +5 -0
- package/dist/chunks/studio-ws2r1d7e.js +5 -0
- package/dist/chunks/studio-x2trkhk5.js +5 -0
- package/dist/chunks/{studio-mn0476ag.js → studio-xzgp0cp7.js} +4 -4
- package/dist/chunks/studio-y47090vq.js +5 -0
- package/dist/chunks/{studio-5g0rprdt.js → studio-yjh9gddd.js} +5 -5
- package/dist/chunks/studio-ywf9y1e2.js +5 -0
- package/dist/chunks/{studio-k7evxqh4.js → studio-z1p91z5a.js} +4 -4
- package/dist/chunks/studio-ztppbam0.js +5 -0
- package/dist/chunks/{toast-host-1yg5ar8d.js → toast-host-g3r2s0kn.js} +2 -2
- package/dist/chunks/toast-w11qpkyz.js +4 -0
- package/dist/chunks/{tooltip-yypz28gq.js → tooltip-dj1pvgz7.js} +2 -2
- package/dist/chunks/{tree-9xa4hm7n.js → tree-j0ebwr5s.js} +2 -2
- package/dist/chunks/{tsMode-epyfz1hv.js → tsMode-byje4a01.js} +5 -5
- package/dist/chunks/workspace-7q4arnt3.js +4 -0
- package/dist/chunks/workspace-home-ge027kr6.js +4 -0
- package/dist/chunks/{ws-client-bv552sfx.js → ws-client-h09h6sqg.js} +3 -3
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +76 -76
- package/dist/studio.js +88 -88
- package/package.json +15 -16
- package/src/browse/component-examples.ts +15 -224
- package/src/browse/library-preview.ts +6 -13
- package/src/browse/preview-root.ts +7 -4
- package/src/canvas/canvas-utils.ts +18 -4
- package/src/canvas/iframe-editable-root.ts +13 -4
- package/src/canvas/iframe-entry.ts +3 -1
- package/src/canvas/iframe-interaction.ts +11 -2
- package/src/canvas/iframe-render.ts +25 -3
- package/src/canvas/preview-placeholder.ts +120 -0
- package/src/collab/collab-session.ts +6 -2
- package/src/commands/context.ts +4 -0
- package/src/commands/defaults.ts +2 -0
- package/src/commands/live-context.ts +2 -0
- package/src/editor/shortcuts.ts +3 -0
- package/src/files/files.ts +6 -3
- package/src/new-project/new-project-modal.ts +1 -4
- package/src/panels/ai-panel.ts +27 -34
- package/src/panels/component-preview.ts +5 -0
- package/src/panels/pane-context.ts +43 -18
- package/src/panels/site-model.ts +7 -19
- package/src/panels/site-panel.ts +2 -25
- package/src/panels/stylebook-doc.ts +2 -53
- package/src/platform.ts +20 -0
- package/src/platforms/devserver.ts +2 -120
- package/src/services/ai-ask.ts +29 -171
- package/src/services/ai-command-tools.ts +40 -50
- package/src/services/ai-import-tools.ts +4 -5
- package/src/services/ai-project-tools.ts +13 -3
- package/src/services/ai-tools.ts +26 -564
- package/src/services/ai-writes.ts +84 -2
- package/src/services/document-assistant.ts +29 -58
- package/src/services/harness/assistant-tools.ts +68 -0
- package/src/services/harness/interaction-store.ts +118 -0
- package/src/services/harness/studio-documents.ts +105 -0
- package/src/services/harness/turn-hooks.ts +1 -6
- package/src/services/project-adoption.ts +8 -16
- package/src/services/references.ts +0 -0
- package/src/services/tool-executor.ts +25 -22
- package/src/state.ts +3 -13
- package/src/style/stylebook-specimens.ts +11 -15
- package/src/surfaces/files-panel.json +12 -0
- package/src/surfaces/files-panel.ts +5 -2
- package/src/surfaces/pane-context.json +286 -265
- package/src/surfaces/pane-context.ts +17 -8
- package/src/surfaces/welcome.ts +4 -1
- package/src/tabs/selection.ts +14 -109
- package/src/tabs/tab.ts +15 -7
- package/src/tabs/transact.ts +316 -124
- package/src/types.ts +13 -8
- package/src/utils/geometry.ts +49 -2
- package/dist/chunks/adapter-5tphg7xe.js +0 -4
- package/dist/chunks/add-new-flow-psym14sn.js +0 -4
- package/dist/chunks/cf-account-picker-haqazq5r.js +0 -4
- package/dist/chunks/cf-settings-h2wrh6hq.js +0 -4
- package/dist/chunks/color-m7r1vk54.js +0 -4
- package/dist/chunks/components-r22xca09.js +0 -4
- package/dist/chunks/content-source-mmppmcyg.js +0 -4
- package/dist/chunks/editor-ccd9jwsa.js +0 -4
- package/dist/chunks/entry-commands-6qxz9e8p.js +0 -4
- package/dist/chunks/file-ops-qnab36ek.js +0 -4
- package/dist/chunks/files-rcn56qvm.js +0 -4
- package/dist/chunks/format-host-yxz0kjjs.js +0 -4
- package/dist/chunks/fs-events-d1qxq4z4.js +0 -4
- package/dist/chunks/grid-open-4z1g062t.js +0 -4
- package/dist/chunks/iframe-host-ssv7kyj0.js +0 -4
- package/dist/chunks/index-f0jn7nnp.js +0 -4
- package/dist/chunks/jx-validate-ttasrbh7.js +0 -4
- package/dist/chunks/layers-bgyr11tr.js +0 -4
- package/dist/chunks/layers-panel-7ez66zeq.js +0 -4
- package/dist/chunks/lit-html-v9gh687x.js +0 -4
- package/dist/chunks/media-library-sq468wts.js +0 -4
- package/dist/chunks/media-picker-shfe59pt.js +0 -4
- package/dist/chunks/monaco-buffer-3afgwvbp.js +0 -4
- package/dist/chunks/notify-kzrjr3fv.js +0 -4
- package/dist/chunks/parse-v77xtwv7.js +0 -4
- package/dist/chunks/platform-7v4rtd7m.js +0 -4
- package/dist/chunks/publish-panel-2z9gw8ee.js +0 -4
- package/dist/chunks/publish-workspace-wrc1dgwx.js +0 -4
- package/dist/chunks/quick-search-n0t0eqxb.js +0 -4
- package/dist/chunks/references-9547rg5s.js +0 -4
- package/dist/chunks/right-panel-wsgnr9pn.js +0 -4
- package/dist/chunks/source-control-kwktr9y6.js +0 -4
- package/dist/chunks/studio-03ct6yfv.js +0 -9
- package/dist/chunks/studio-07rcfje3.js +0 -5
- package/dist/chunks/studio-3e54qh39.js +0 -7
- package/dist/chunks/studio-3exxhz5g.js +0 -5
- package/dist/chunks/studio-3qqjeep5.js +0 -6
- package/dist/chunks/studio-4hp8pkyt.js +0 -5
- package/dist/chunks/studio-58xg6j2q.js +0 -9
- package/dist/chunks/studio-6m380wp7.js +0 -5
- package/dist/chunks/studio-80jyh1xh.js +0 -4
- package/dist/chunks/studio-8vcvfs7r.js +0 -6
- package/dist/chunks/studio-bavb31r0.js +0 -5
- package/dist/chunks/studio-c05wdnt3.js +0 -5
- package/dist/chunks/studio-d5grtb9e.js +0 -16
- package/dist/chunks/studio-df0baea9.js +0 -5
- package/dist/chunks/studio-dgk4dqtx.js +0 -7
- package/dist/chunks/studio-e1g64q43.js +0 -5
- package/dist/chunks/studio-ed1hp6zf.js +0 -6
- package/dist/chunks/studio-ed3xx40h.js +0 -7
- package/dist/chunks/studio-f14e1zdj.js +0 -5
- package/dist/chunks/studio-fyh0jc96.js +0 -5
- package/dist/chunks/studio-gcxk20n7.js +0 -5
- package/dist/chunks/studio-kt3pjkwd.js +0 -5
- package/dist/chunks/studio-m8g16bgz.js +0 -5
- package/dist/chunks/studio-mx1smyq0.js +0 -5
- package/dist/chunks/studio-nqxqf8p2.js +0 -4
- package/dist/chunks/studio-p4nrkvqr.js +0 -5
- package/dist/chunks/studio-pgmvdv7z.js +0 -7
- package/dist/chunks/studio-ph84avkf.js +0 -5
- package/dist/chunks/studio-q0tccd43.js +0 -5
- package/dist/chunks/studio-q7rtx6zq.js +0 -14
- package/dist/chunks/studio-qwdqwkj0.js +0 -5
- package/dist/chunks/studio-rj9eamf8.js +0 -5
- package/dist/chunks/studio-rptgsk96.js +0 -5
- package/dist/chunks/studio-s19tp1xr.js +0 -5
- package/dist/chunks/studio-syreb644.js +0 -5
- package/dist/chunks/studio-tf9jryb1.js +0 -10
- package/dist/chunks/studio-txf2kysx.js +0 -5
- package/dist/chunks/studio-v8867ddv.js +0 -12
- package/dist/chunks/studio-vxq7fcvv.js +0 -5
- package/dist/chunks/studio-w4rz9hdk.js +0 -5
- package/dist/chunks/studio-wc649wss.js +0 -5
- package/dist/chunks/studio-wys23mxz.js +0 -5
- package/dist/chunks/studio-y3ahhdpx.js +0 -5
- package/dist/chunks/studio-z97c48fk.js +0 -5
- package/dist/chunks/studio-zat62m0c.js +0 -5
- package/dist/chunks/studio-zcd2e7yz.js +0 -5
- package/dist/chunks/toast-1gv0h53h.js +0 -4
- package/dist/chunks/workspace-dz7nxfhv.js +0 -4
- package/dist/chunks/workspace-home-xsd7hkjw.js +0 -4
- package/src/services/directory-picker.ts +0 -187
- package/src/services/gated-registry.ts +0 -77
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{p,_e}from"./studio-w4rz9hdk.js";import{pt,Go,RA,Ap,px,Cr,NA,Op}from"./studio-s32578pn.js";import{C}from"./studio-43sd2mam.js";import{Zs,tt}from"./studio-x9hsze61.js";import{n,Z,Xe,te,v}from"./studio-vxq7fcvv.js";var l=null;async function Bd(){if(!_e()||!te(p().getAccountStatus)){l=null;return}try{l=await p().getAccountStatus?.()??null}catch{l=null}}function lC(){return l}function cC(){return l!==null&&l.installations.length===0&&Boolean(l.appInstallUrl)}function bA(){if(l===null)return null;let e=l.installations.flatMap((r)=>r.manageUrl?[{account:r.account??`Installation ${r.id}`,url:r.manageUrl}]:[]);if(e.length===0&&!l.appInstallUrl)return null;let t={manage:e};if(l.appInstallUrl)t.installUrl=l.appInstallUrl;return t}function vA(){return l?.entries??[]}function a$(){return(l?.notices??[]).filter((e)=>e.display!=="toast")}var L=new Set;function N(){let e=(l?.notices??[]).filter((t)=>t.display==="toast"&&!L.has(t.id));for(let t of e)L.add(t.id);return e}var G="https://jxsuite.com/problems/";function k(e){return typeof e==="string"}function X(e){return typeof e==="object"&&e!==null}function Bb(e){if(!k(e)||!e.startsWith("https://jxsuite.com/problems/"))return null;let t=e.slice(29);return t===""?null:t}function sr(e){if(k(e))return e.trim()===""?null:e;if(!X(e))return null;for(let t of[e.detail,e.error,e.title])if(k(t)&&t.trim()!=="")return t;return null}function ka(e,t){return sr(e)??(t===void 0?"Request failed":`Request failed (${t})`)}var d=(e,t,r,i)=>{let s={status:t,title:r,type:`${G}${e}`};if(i!==void 0)s.extensions=i;return s},me={invalidRequest:d("invalid-request",400,"The request was malformed or incomplete"),notFound:d("not-found",404,"The requested resource does not exist"),methodNotAllowed:d("method-not-allowed",405,"That method is not allowed on this route"),conflict:d("conflict",409,"The request conflicts with the current state",["conflicts"]),payloadTooLarge:d("payload-too-large",413,"The request body is too large"),unauthorized:d("unauthorized",401,"Credentials are missing or not accepted"),forbidden:d("forbidden",403,"The request was refused"),needsInstallationAccess:d("needs-installation-access",403,"The GitHub App is not installed for that account",["installUrl"]),pathOutsideProject:d("path-outside-project",403,"The path resolves outside the active project"),actionRequired:d("action-required",403,"An action is required first",["actions","heading","retry"]),noActiveProject:d("no-active-project",409,"No project is active on this backend"),capabilityUnavailable:d("capability-unavailable",501,"This backend does not provide that capability"),upstreamFailure:d("upstream-failure",502,"An upstream service failed",["upstream"]),internalError:d("internal-error",500,"The backend failed to complete the request")};var dC=".jx-loc-id",o=(e,t,r,i)=>{let s={method:e,path:t,optional:i!==void 0,summary:r};if(i!==void 0)s.degradation=i;return s},he={activate:o("POST","/__studio/activate","Bind the backend to a project root"),project:o("GET","/__studio/project","Root project metadata {name, root}"),projectInfo:o("GET","/__studio/project-info","Probe a directory: {isSiteProject, projectConfig?, directories?}"),resolveSite:o("GET","/__studio/resolve-site","Resolve the owning site of a file path {sitePath, projectConfig?, fileRelPath?}"),sites:o("GET","/__studio/sites","Enumerate site projects [{config, path}] (backs listProjects)","The welcome screen's Projects catalogue stays hidden."),findProject:o("GET","/__studio/find-project","Locate a project directory by name outside the root","openProject falls back to config-matching only."),locateDirectory:o("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:o("POST","/__studio/create-project","Scaffold a project at a caller-chosen destination → {root, config}"),starters:o("GET","/__studio/starters","Starter templates (StarterInfo[])","The New Project picker offers only blank/templates."),importSite:o("POST","/__studio/import-site","Clone a live website into a project; streams NDJSON progress","The New Project Import tab is unavailable."),files:o("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:o("GET","/__studio/file","Read a file's text content"),filesRead:o("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:o("PUT","/__studio/file","Write a file's text content"),fileDelete:o("DELETE","/__studio/file","Delete a file"),fileUpload:o("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:o("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:o("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:o("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:o("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:o("POST","/__studio/locate","Find a file by name → {path | null}"),collab:o("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:o("GET","/__studio/components","Discover components (ComponentMeta[])"),cem:o("GET","/__studio/cem","Custom-elements manifest of an npm dependency","Dependency components lose prop/slot metadata."),formats:o("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:o("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:o("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:o("POST","/__studio/format","Dispatch a format capability {format, action: parse|serialize, source?|doc?}","Non-JSON documents cannot be parsed/serialized (backs formatAction)."),pluginSchema:o("GET","/__studio/plugin-schema","Extract a $studio schema from a class source","Plugin property panels fall back to generic JSON editing."),codeFormat:o("POST","/__studio/code/format","Format posted source {code, path?} → {code, errors}","Code editors skip format-on-open/save (codeService returns null)."),codeMinify:o("POST","/__studio/code/minify","Minify posted source {code} → {code}","Compiled-output minification is skipped."),codeLint:o("POST","/__studio/code/lint","Lint posted source {code, path?} → {diagnostics}","Code editors show no lint markers."),buildSite:o("POST","/__studio/build","Build or render the site → {routes, files, errors, mode?, url}","Build Site reports that this target cannot build."),previewSite:o("POST","/__studio/preview","Preview the working tree at a route → {routes, files, errors, mode, url, reused}","Open in Browser falls back to buildSite."),previewOverlay:o("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:o("GET","/__studio/packages","List dependencies (PackageInfo[])"),packagesAdd:o("POST","/__studio/packages/add","Add a dependency"),packagesRemove:o("POST","/__studio/packages/remove","Remove a dependency"),packagesInstall:o("POST","/__studio/packages/install","Run the package manager install","Install/reinstall affordances are hidden; manifest-only edits still work."),packagesNeedsInstall:o("GET","/__studio/packages/needs-install","Whether node_modules is stale","The install-on-open prompt never shows."),packagesVersions:o("GET","/__studio/packages/versions","Newest published version of each dependency (PackageVersionInfo[])","The Latest column stays empty and the update affordances are hidden."),packagesSetVersions:o("POST","/__studio/packages/set-versions","Rewrite dependency ranges and install","Bulk version updates are hidden."),gitStatus:o("GET","/__studio/git/status","Working-tree status (GitStatusResult)"),gitBranches:o("GET","/__studio/git/branches","Branch list (GitBranchesResult)"),gitLog:o("GET","/__studio/git/log","Recent commits (GitLogEntry[])"),gitStage:o("POST","/__studio/git/stage","Stage files"),gitUnstage:o("POST","/__studio/git/unstage","Unstage files"),gitCommit:o("POST","/__studio/git/commit","Commit staged (else all dirty) files"),gitPush:o("POST","/__studio/git/push","Push (cloud: sync check — commits land on push)"),gitPull:o("POST","/__studio/git/pull","Pull/fast-forward; 409 {conflicts} on overlap"),gitFetch:o("POST","/__studio/git/fetch","Refresh remote tracking state"),gitCheckout:o("POST","/__studio/git/checkout","Switch branches"),gitCreateBranch:o("POST","/__studio/git/create-branch","Create a branch"),gitDiff:o("GET","/__studio/git/diff","Unified diff of dirty files (or one path)"),gitShow:o("GET","/__studio/git/show","File content at a ref"),gitDiscard:o("POST","/__studio/git/discard","Discard working changes"),gitInit:o("POST","/__studio/git/init","Initialize a repository"),gitAddRemote:o("POST","/__studio/git/add-remote","Add a remote"),gitClone:o("POST","/__studio/git/clone","Clone a repository","The welcome screen hides Clone Git Repository."),gitPr:o("POST","/__studio/git/pr","Open a pull request → PullRequestInfo","Studio falls back to a direct GitHub API call with the user's token."),dataConnections:o("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:o("POST","/__studio/data/connections/test","Probe a connection {connection} → DataConnectionTestResult (backs dataConnectionTest)","The Test Connection action is hidden."),dataPush:o("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:o("GET","/__studio/data/rows","Page a table (DataRowsQuery params) → DataRowsResult {rows, total, columns} (backs dataRows)","The data grid is unavailable."),dataInsertRow:o("POST","/__studio/data/rows","Insert a row {table, connection?, values} → {row} (backs dataInsertRow)","The data grid hides its add-row footer."),dataUpdateRow:o("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:o("DELETE","/__studio/data/rows","Delete a row (?table=&pk=&connection=) → {ok} (backs dataDeleteRow)","The data grid hides row deletion."),secretsList:o("GET","/__studio/secrets","Configured secret env-var NAMES, never values (SecretsListResponse; backs listSecrets)","Secret fields cannot show set/unset state."),secretsSet:o("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:o("POST","/__studio/ai/chat","StreamEvent SSE chat proxy {messages, tools, systemPrompt, model}"),aiModels:o("GET","/__studio/ai/models","Model catalogue (AiModelsResponse)"),cfProxy:o("POST","/__studio/cf/proxy","Allowlisted Cloudflare API passthrough {path, method?, body?} (backs cfApi)","The Publish panel explains the git-push publishing path instead.")};var l$=200,c$=100,d$=12;var Y=new Set(["reload","repeat","none"]);function Np(e){if(!Array.isArray(e))return[];return e.flatMap((r)=>{if(!v(r))return[];let{href:i,id:s,label:f,primary:m}=r;if(!n(s)||!s||!n(f)||!f)return[];let c={id:s,label:f};if(n(i)&&i)c.href=i;if(m===!0)c.primary=!0;return[c]})}function F(e){return n(e)&&Y.has(e)}function u$(e){return F(e)?e:void 0}function Q(e){return e.replaceAll("_","-")}function _(e){if(!v(e))return{};let{actions:t,code:r,heading:i,installUrl:s,retry:f,type:m}=e,c={},a=Bb(m)??(n(r)?Q(r):null);if(a!==null)c.code=a;if(n(s))c.installUrl=s;if(t!==void 0)c.actions=Np(t);if(n(i)&&i)c.heading=i;if(F(f))c.retry=f;return c}function yA(e){let t=_(e);return t.code==="needs-installation-access"&&t.installUrl?t.installUrl:null}function wA(e){return _(e).code==="action-required"}function zd(){return Go(pt.aiOpenAiKey)}function xA(e){Cr(pt.aiOpenAiKey,e||"")}function cx(){return RA(pt.aiOpenAiKey)}function sl(){return Go(pt.aiBaseUrl)}function dx(){return Go(pt.aiModel)}function _A(e){Cr(pt.aiModel,e||"")}function SA(e){NA([[pt.aiOpenAiKey,e.apiKey],[pt.aiBaseUrl,e.baseUrl],[pt.aiModel,e.model]])}function CA(e){return!Cm(pt.aiOpenAiKey,e.apiKey,zd())||!Cm(pt.aiBaseUrl,e.baseUrl,sl())||!Cm(pt.aiModel,e.model,dx())}function Cm(e,t,r){return px(e,t)===px(e,r)}function kA(){Op([pt.aiOpenAiKey,pt.aiBaseUrl,pt.aiModel])}function uC(){return{apiKey:zd(),baseUrl:sl()}}function V(e){return`${e.apiKey}\x00${e.baseUrl}`}var g=null,P="",j=!1,A=!1,D="",I,M="",R=null,U=null,q=new Set,ee=600000,S=0,J=!1;function us(){g=null,P="",j=!1,A=!1,D="",I=void 0,M="",R=null,U=null,S=0}var oe=new Set([pt.aiOpenAiKey.key,pt.aiBaseUrl.key,pt.cfToken.key,pt.cfAccountId.key]);Ap((e)=>{if(e.some((t)=>oe.has(t)))us()});function h$(e){return g&&P===V(e)?g:null}function K(e){return g?.find((t)=>t.id===e)}function p$(e){return K(e)?.toolSupport}function EA(e){return K(e)?.contextWindow}function ux(e){if(e)q.add(e);U??=lh({force:!0}).catch(()=>{}).then(()=>{S=Date.now();for(let t of q)t()})}function ne(){if(!A||S===0||Date.now()-S<ee)return!1;return U=null,S=0,ux(),!0}function re(){if(typeof window>"u"||J)return;J=!0,window.addEventListener("focus",()=>{ne()})}re();function zb(){return cx()||hC()}function hC(){return j}function TA(){return A}function km(){return I}function LA(){return M}function pC(){return R}function ie(){return D}function Yl(){return dx()||ie()||pt.aiModel.default}function se(e,t){let r;try{r=new URL(e,"http://jx.invalid")}catch{return e}return r.pathname=r.pathname.replace(/[^/]*$/,t),/^https?:/i.test(e)?r.href:`${r.pathname}${r.search}`}async function lh(e={}){let t=e.credentials??uC(),r=V(t);if(g&&P===r&&!e.force)return g;let i=p(),s=await Promise.resolve(i.aiChatUrl()),f=se(s,"models"),m={};if(t.apiKey)m["X-Api-Key"]=t.apiKey;if(t.baseUrl)m["X-Api-Base-URL"]=t.baseUrl;let c=await fetch(f,{headers:m});if(!c.ok)throw Error(`HTTP ${c.status}`);let a=await c.json();if(j=a.configured===!0,A=a.managed===!0,D=a.defaultModel??"",I=a.code,M=a.upstreamError!==void 0?a.upstreamMessage??"":"",R=null,a.code==="action_required"){let u={actions:Np(a.actions)};if(n(a.detail)&&a.detail)u.detail=a.detail;R=u}return g=(a.models||[]).map((u)=>{let h={id:u.id,name:u.name||u.id};if(Z(u.contextWindow))h.contextWindow=u.contextWindow;if(Xe(u.toolSupport))h.toolSupport=u.toolSupport;return h}),P=r,g}var T=new Set,B=null;function $A(e){if(T.size===0){B=e;return}for(let t of T)t(e)}function H(e){T.add(e);let t=B;if(B=null,t)e(t);return()=>{T.delete(e)}}function fC(){return _e()&&te(p().performAction)}function f$(e){let t=e.find((i)=>i.primary)??e[0];if(!t)return null;let r=e.find((i)=>i!==t);return r?{lead:t,other:r}:{lead:t}}var w=null,W=!1;function mC(e){let t=f$(e.actions);if(!fC()||!t)return Promise.resolve(!1);return w??=ae(e,t).finally(()=>{w=null}),w}async function Em(e){let t=_(e);if(t.code!=="action-required"||!t.actions?.length)return!1;return mC({actions:t.actions,detail:e instanceof Error?e.message:void 0,heading:t.heading,retry:t.retry})}async function z(){us(),await Bd(),m$()}function ae(e,t){let r=e.detail??"This needs one more step first.";return new Promise((i)=>{let s="offer",f=(y)=>{if(s==="done")return;s="done",E.close(),i(y)},m=(y)=>{s="offer",E.update({cancelLabel:"Not now",confirmLabel:t.lead.label,message:y,secondaryLabel:t.other?.label??""})},c=async(y)=>{let b;try{b=await y}catch(x){if(s==="waiting")m(x instanceof Error?x.message:String(x));return}if(b?.status==="done"){await z(),f(!0);return}if(s!=="waiting"||!b||b.status==="redirect")return;Bd(),m(r)},a=(y)=>{if(s!=="offer")return;s="waiting";let b;try{b=p().performAction(y)}catch(x){m(x instanceof Error?x.message:String(x));return}E.update({cancelLabel:"Cancel",confirmLabel:"Waiting…",message:"Finish in the window that opened. This closes by itself once it is done.",secondaryLabel:""}),c(b)},{lead:u,other:h}=t,O={cancelLabel:"Not now",confirmLabel:u.label,headline:e.heading??"One more step",layer:tt("dialog"),message:r,onCancel:()=>{W=!0,f(!1)},onClosed:()=>{f(!1)},onConfirm:()=>{a(u)},region:"account/action"};if(h)O.onSecondary=()=>{a(h)},O.secondaryLabel=h.label;let E=Zs(O)})}function ce(e){if(e==="reload")location.reload();else if(e==="repeat")C.info("Done. Run that again now.",{key:"account.action.retry",source:"Account"})}function IA(){return H((e)=>{if(W||w)return;mC(e).then((t)=>{if(t)ce(e.retry)})})}async function hx(e){if(!fC())return!1;let t=p().performAction(e),r;try{r=await t}catch(i){return C.error(i instanceof Error?i.message:String(i),{key:"account.action",source:"Account",tier:"toast"}),!1}if(r?.status==="done")return await z(),!0;if(r?.status!=="redirect")await Bd();return!1}function m$(){for(let e of N()){let t={key:`account.notice.${e.id}`,source:"Account"};if(e.level==="warning")C.warn(e.message,t);else C.info(e.message,t)}}
|
|
2
|
-
export{Bd,lC,cC,bA,vA,a$,Bb,sr,ka,dC,l$,c$,d$,Np,u$,yA,wA,zd,xA,cx,sl,dx,_A,SA,CA,Cm,kA,uC,us,h$,p$,EA,ux,zb,hC,TA,km,LA,pC,Yl,lh,$A,fC,f$,mC,Em,IA,hx,m$};
|
|
3
|
-
|
|
4
|
-
//# debugId=D99709F683E98F4E64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-4hp8pkyt.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{Pp}from"./studio-q7rtx6zq.js";import{Mm,Hx,u}from"./studio-c05wdnt3.js";import{g}from"./studio-43sd2mam.js";import{to,Sr,Xw,h}from"./studio-d5grtb9e.js";import{Ae}from"./studio-fbhxxc5f.js";import{T,R}from"./studio-x9hsze61.js";import{vt,nl,Di,Hc,Tp,Wr,Lb,OL,HL}from"./studio-rj9eamf8.js";import{fS,mS,RT,Sw}from"./studio-8vcvfs7r.js";import{x,dl}from"./studio-gcxk20n7.js";import{n,Z,S,Ie,Ni,rd}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";var Dy="Project Styles",Ru="stylebook",Gf="tokens",K="source",Bg={elements:Ru,variables:Gf,code:K},h_=["elements","variables","code"],ER=h_.map((e)=>Bg[e]),p_=[{id:"color",prefix:"--color-",title:"Colors"},{id:"font",prefix:"--font-",title:"Fonts"},{id:"size",prefix:"--size-",title:"Sizes & Spacing"},{id:"other",prefix:"--",title:"Other"}];function f_(e){if(e.startsWith("--color"))return"color";if(e.startsWith("--font"))return"font";if(e.startsWith("--size")||e.startsWith("--spacing")||e.startsWith("--radius"))return"size";return"other"}function Q(e){let o=f_(e);if(o==="other")return e;let{prefix:t}=p_.find((r)=>r.id===o);return Hx(e,t)}function X(e){if(!e)return[];let o=[];for(let[t,r]of Object.entries(e)){if(!t.startsWith("--"))continue;if(!n(r)&&!Z(r))continue;o.push({group:f_(t),label:Q(t),name:t,value:r})}return o}function m_(e){let o=X(e);return p_.map((t)=>({group:t,tokens:o.filter((r)=>r.group===t.id)}))}function g_(e){if(!e)return[];let{featureQueries:o,sizeBreakpoints:t}=Wr(e),r=[],a=[];for(let{name:s,query:c}of o){let y=Tp(c);if(y)r.push({key:`@${s}`,kind:"scheme",label:y==="dark"?"Dark":"Light",name:s,scheme:y});else a.push({key:`@${s}`,kind:"feature",label:`@${s}`,name:s})}let i=t.map(({name:s})=>({key:`@${s}`,kind:"size",label:`@${s}`,name:s}));return[...r,...i,...a]}function _(e,o){return Ni(e,o.key)}function Ny(e,o,t){let r=_(e,o)?.[t];return n(r)||Z(r)?r:void 0}function Pk(e,o,t,r){if(r){rd(e,o.key)[t]=r;return}let a=_(e,o);if(!a)return;if(delete a[t],Object.keys(a).length===0)delete e[o.key]}function TR(e,o,t,r=[]){let a=new Set(r.map((i)=>i.name));return o.filter((i)=>!a.has(i.name)&&Ny(e,i,t)===void 0)}var cp={$sections:[{label:"Headings",elements:[{tag:"h1",text:"Code Is Poetry"},{tag:"h2",text:"Code Is Poetry"},{tag:"h3",text:"Code Is Poetry"},{tag:"h4",text:"Code Is Poetry"},{tag:"h5",text:"Code Is Poetry"},{tag:"h6",text:"Code Is Poetry"}]},{label:"Paragraph",elements:[{tag:"p",text:"In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing."}]},{label:"List",elements:[{tag:"ul",children:[{tag:"li",text:"Alice."},{tag:"li",text:"The White Rabbit."},{tag:"li",text:"The Cheshire Cat."},{tag:"li",text:"The Mad Hatter."},{tag:"li",text:"The Queen of Hearts."}]},{tag:"ol",children:[{tag:"li",text:"First item"},{tag:"li",text:"Second item"},{tag:"li",text:"Third item"}]}]},{label:"Quote",elements:[{tag:"blockquote",children:[{tag:"p",text:"In quoting others, we cite ourselves.",style:"font-size:1.25em;font-style:italic"},{tag:"p",text:"— Julio Cortázar"}]}]},{label:"Code",elements:[{tag:"pre",children:[{tag:"code",text:`// A "block" is the abstract term used
|
|
2
|
-
// to describe units of markup that
|
|
3
|
-
// when composed together, form the
|
|
4
|
-
// content or layout of a page.
|
|
5
|
-
registerBlockType( name, settings );`}]}]},{label:"Inline",elements:[{tag:"a",text:"Visit the documentation",attributes:{href:"#"}},{tag:"strong",text:"Bold text emphasis"},{tag:"em",text:"Italic text emphasis"},{tag:"small",text:"Fine print and legal text"},{tag:"mark",text:"Highlighted text"},{tag:"code",text:"const x = 42;"},{tag:"abbr",text:"HTML",attributes:{title:"HyperText Markup Language"}},{tag:"sub",text:"subscript"},{tag:"sup",text:"superscript"}]},{label:"Form",elements:[{tag:"input",attributes:{type:"text",placeholder:"Enter text…"}},{tag:"button",text:"Click Me"},{tag:"select",children:[{tag:"option",text:"Option 1"},{tag:"option",text:"Option 2"},{tag:"option",text:"Option 3"}]},{tag:"textarea",attributes:{placeholder:"Enter longer text…",rows:"3"}}]},{label:"Table",elements:[{tag:"table",children:[{tag:"thead",children:[{tag:"tr",children:[{tag:"th",text:"Name"},{tag:"th",text:"Role"},{tag:"th",text:"Status"}]}]},{tag:"tbody",children:[{tag:"tr",children:[{tag:"td",text:"Alice"},{tag:"td",text:"Developer"},{tag:"td",text:"Active"}]},{tag:"tr",children:[{tag:"td",text:"Bob"},{tag:"td",text:"Designer"},{tag:"td",text:"Away"}]},{tag:"tr",children:[{tag:"td",text:"Carol"},{tag:"td",text:"Manager"},{tag:"td",text:"Active"}]}]}]}]},{label:"Interactive",elements:[{tag:"details",attributes:{open:""},children:[{tag:"summary",text:"Click to expand details"},{tag:"p",text:"Additional detail content revealed when the disclosure widget is toggled open."}]}]},{label:"Media",elements:[{tag:"img",attributes:{alt:"Placeholder image"},style:"width:100%;max-width:400px;height:200px;background:#e0e0e0;display:block;border-radius:4px"},{tag:"video",attributes:{controls:""},style:"width:100%;max-width:400px;height:200px;background:#e0e0e0;display:block;border-radius:4px"},{tag:"audio",attributes:{controls:""},style:"width:100%"}]}],$variables:{color:{label:"Color",prefix:"--color-",placeholder:"#007acc"},font:{label:"Font",prefix:"--font-",placeholder:"system-ui, sans-serif"},size:{label:"Size",prefix:"--size-",placeholder:"16px"},other:{label:"Other",prefix:"--",placeholder:"value"}}};var A={$schema:"https://jxsuite.com/schema/v1",$id:"StudioStylebookChrome",$description:"The bar across the top of the Project Styles canvas: the filter that narrows the specimen catalogue, and the toggle that reduces it to the elements this file has already styled. Both are shell state rather than document state — the adapter owns which — and the two names come in as values, because the surface is called Project Styles and the canvas view it draws is the wire word `stylebook`; nothing a reader sees here may be spelled from that. **The bar IS the kit's toolbar now.** It used to write `role=\"toolbar\"` and its own `aria-label` on a `<div>`, which is a role with none of the behaviour under it: two controls, two tab stops, and no arrow key between them. `jx-action-group` is not the element for it — that one roves `jx-action-button` and this bar's first control is a `jx-textfield` — so `jx-toolbar` is, and the field keeps its own arrows while its caret still has text to walk (ui.md §5.5).",tagName:"jx-toolbar",attributes:{part:"chrome"},$props:{label:{$ref:"#/state/title"}},style:{$description:'What `.sb-chrome` said in `styles/overlays.css`, plus the six inline declarations the template carried beside it, plus `.tb-toggle` — all three go dead with this conversion, and none of them is shared with another surface. Three repairs on the way. The bar is one element rather than a positioned box wrapping a `role="toolbar"` row that declared the same flex layout again. The flex layout is not declared here EITHER any more: `display: flex`, `align-items: center`, the `--jx-space-2` gap, the sans face and the foreground colour are all `jx-toolbar`\'s own, so what is left below is only what a positioned BAND is. And `.tb-toggle` read `var(--spectrum-font-size-50, 11px)`, which the kit spells `--jx-text-sm` at the same value; the rest of its drawing is a `jx-action-button` reaching in through `part="control"`, because what it has to look like is a small bordered chip and every fill and control height the kit draws would otherwise have to be taken back off.',position:"absolute",top:"0",left:"0",right:"0",zIndex:"15",flexShrink:"0",padding:"var(--jx-space-2) var(--jx-space-3)",background:"var(--bg-panel)",borderBottom:"1px solid var(--border)",'& [part="filter"]':{flex:"1",maxWidth:"200px"},'& [part="customized"] > [part="control"]':{$description:"Bordered, unfilled and dimmed until it is on, which is what says it is a filter rather than an action: the catalogue it narrows is the thing the reader is looking at, so the control has to be quieter than its subject.",padding:"3px var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"transparent",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",":hover":{background:"var(--hover-bg)"}},'& [part="customized"][data-selected] > [part="control"]':{$description:"`data-selected` and not `selected`: the kit reflects the pressed state as a data attribute (`jx-action-button.json`), and the property this document binds never reaches the attribute of the same name.",borderColor:"var(--accent)",background:"var(--accent-15)",color:"var(--accent)"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{size:"sm",type:"search",clearable:!0,label:{$ref:"#/state/filterLabel"},placeholder:"Filter…",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",$description:"`onchange` and not `onclick`: a `toggles` button owns its own pressed state and says so with `change` (`jx-action-button.json`), and an `onclick` written here would replace the element's own click handler on the same property — the toggle would stop flipping and stop announcing `aria-pressed`.",attributes:{part:"customized"},$props:{size:"sm",toggles:!0,selected:{$ref:"#/state/customizedOnly"},label:{$ref:"#/state/customizedLabel"},hint:{$ref:"#/state/customizedHint"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleCustomized"},value:[]}]},children:[{tagName:"span",textContent:"${state.customizedLabel}"}]}]};T("stylebook-chrome",A);function W(e,o){let t=document.createElement("div");t.style.display="contents";let r=g({...e,...o}),a=null,i=!1;function s(){i=!0,R("stylebook-chrome",r,t).then((c)=>{i=!1,a=c})}return s(),{host:t,update(c){if(Object.assign(r,c),i||a!==null&&t.contains(a.root))return;a?.dispose(),a=null,t.textContent="",s()}}}function L(e){return!e.startsWith(":")&&!e.startsWith(".")&&!e.startsWith("&")&&!e.startsWith("[")&&!e.startsWith("@")&&!e.startsWith("--")}function O(e){return S(e)&&!Array.isArray(e)}var B="& .element-card-preview";function Ay(e){let o={},t=(r)=>{let a={};for(let[i,s]of Object.entries(r))if(i!=="@--")a[i]=s;return a};for(let[r,a]of Object.entries(e)){if(!O(a)){o[r]=a;continue}if(r==="@--")continue;if(Pp(r)){o[r]=a;continue}if(r.startsWith("@")){let i={};for(let[s,c]of Object.entries(a))if(O(c)&&L(s))i[`${B} ${s}`]=t(c);else i[s]=c;o[r]=i;continue}if(L(r)){o[`${B} ${r}`]=t(a);continue}o[r]=a}return o}function H(e,o){let t=o.split(" "),r=e;for(let a of t){if(!O(r))return null;r=r[a]}return O(r)?r:null}function Oy(e,o){let t=H(e,o);if(t&&Object.keys(t).length>0)return!0;for(let[r,a]of Object.entries(e)){if(!r.startsWith("@")||!O(a))continue;let i=H(a,o);if(i&&Object.keys(i).length>0)return!0}return!1}function oe(e){if(!e)return null;return e.split(" ").pop()??null}function My(e,o){let t=oe(o),r=[],a=(i,s,c)=>{let y=c?`${c} ${i.tag}`:i.tag;r.push({depth:s,entry:i,path:y,selected:i.tag===t,tag:i.tag});let C=i.children?[...new Map(i.children.map((w)=>[w.tag,w])).values()]:[];for(let w of C)a(w,s+1,y)};for(let i of e)a(i,0,"");return r}function ne(e,o,t){let[r]=Array.isArray(e.children)?e.children:[];if(!S(r)||Array.isArray(r)||!Ie(r.items))return null;let{$ref:a}=r.items,i=a.startsWith("#/state/")?a.slice(8):"",s=e.state?.[i];if(!Array.isArray(s))return null;t[o]=s;for(let[y,C]of Object.entries(e.state??{}))if(y!==i&&!(y in t))t[y]=C;return{children:[{...r,items:{$ref:`#/state/${o}`}}],tagName:"div"}}function V(e){let o=new Map,t=new Map,r=e.filter.toLowerCase(),a=(l,d,f)=>{let p=l.tag===f?f:`${f} ${l.tag}`;o.set(Hc(d),p);let b=l.children??[];for(let[v,I]of b.entries())a(I,[...d,"children",v],f)},i=(l)=>{let d={...l.attributes};if(l.style)d.style=l.style;let f={tagName:l.tag};if(l.text)f.textContent=l.text;if(Object.keys(d).length>0)f.attributes=d;if(l.children)f.children=l.children.map(i);return f},s=(l,d,f,p,b)=>{o.set(Hc(p),l),o.set(Hc([...p,"children",0]),l);let v=[...p,"children",0,"children",0];if(b)a(b,v,l);else o.set(Hc(v),l);if(!t.has(l))t.set(l,p);return{attributes:{class:"element-card"},children:[{attributes:{class:"element-card-preview"},children:[f],tagName:"div"},{attributes:{class:"element-card-label"},tagName:"div",textContent:d}],tagName:"div"}},c=[],y=(l,d)=>({attributes:{class:"sb-section"},children:[{attributes:{class:"sb-label"},tagName:"div",textContent:l},{attributes:{class:"sb-body"},children:d,tagName:"div"}],tagName:"div"}),C=()=>["children",c.length,"children",1];for(let l of e.meta.$sections){let d=l.elements;if(r)d=d.filter((b)=>b.tag.includes(r)||l.label.toLowerCase().includes(r));if(e.customizedOnly)d=d.filter((b)=>Oy(e.effectiveStyle,b.tag));if(d.length===0)continue;let f=C(),p=d.map((b,v)=>s(b.tag,`<${b.tag}>`,i(b),[...f,"children",v],b));c.push(y(l.label,p))}let w=[],E={};{let l=e.components;if(r)l=l.filter((d)=>d.tagName.toLowerCase().includes(r));if(e.customizedOnly)l=l.filter((d)=>Oy(e.effectiveStyle,d.tagName));if(l.length>0){let d=C(),f=l.map((p,b)=>{let v=[...d,"children",b];if(p.source!=="npm"&&p.path?.endsWith(".json")){w.push({$ref:`/${e.projectRoot?`${e.projectRoot}/`:""}${p.path}`.replace(/^\/+/,"/")});let m=e.specimens?.get(p.tagName);if(m?.kind==="props"){let P={$props:m.props,tagName:p.tagName};return s(p.tagName,`<${p.tagName}>`,P,v,null)}if(m?.kind==="row"){let P=ne(m.sample.doc,`stylebookRow${b}`,E);if(P)return s(p.tagName,`<${p.tagName}>`,P,v,null)}if(m?.kind!=="none"){let P={};for(let N of p.props??[])if(N.default!==void 0&&N.default!=="false"&&N.default!=="''")P[N.name]=String(N.default).replaceAll(/^'|'$/g,"");let D={tagName:p.tagName};if(Object.keys(P).length>0)D.attributes=P;return s(p.tagName,`<${p.tagName}>`,D,v,null)}}let M={attributes:{class:"sb-fallback"},tagName:"div",textContent:`<${p.tagName}>`};return s(p.tagName,`<${p.tagName}>`,M,v,null)});c.push(y("Components",f))}}if(c.length===0)c.push({attributes:{class:"sb-empty"},tagName:"div",textContent:e.customizedOnly?"No customized elements":"No matching elements"});let k={};if(w.length>0)k.$elements=w;if(e.effectiveHead&&e.effectiveHead.length>0)k.$head=e.effectiveHead;if(k.$media=e.effectiveMedia,Object.keys(E).length>0)k.state=E;return k.attributes={class:"sb-root"},k.children=c,k.style=Ay(e.effectiveStyle),k.tagName="div",{doc:k,pathToTag:o,tagToCardPath:t}}var q=new WeakMap;async function re(e){let{path:o}=e;if(e.source==="npm"||!o?.endsWith(".json"))return{kind:"bare"};let t=await RT(o);if(!t)return{kind:"bare"};let r=await fS(t,o);if(r.size>0&&await Sw(t,o,r))return{kind:"props",props:Object.fromEntries(r)};let a=await mS(t,o);if(a&&await Lb(e))return{kind:"row",sample:a};return await Sw(t,o,new Map)?{kind:"bare"}:{kind:"none"}}async function F(e,o=re){let t=q.get(e);if(!t)t=new Map,q.set(e,t);let r=t,a=await Promise.all(e.map(async(i)=>{let s=i.path??i.tagName,c=r.get(s);if(!c)c=o(i).catch(()=>({kind:"bare"})),r.set(s,c);return[i.tagName,await c]}));return new Map(a)}var G=new WeakMap;function ae(e){let o={customizedHint:"Show only the elements this file has already styled",customizedLabel:"Customized",customizedOnly:h.stylebook.customizedOnly,filter:h.stylebook.filter,filterLabel:`Filter the ${Dy} catalogue`,title:Dy},t=G.get(e);if(t)return t.update(o),t.host;let r=W(o,{setFilter:(a)=>{h.stylebook.filter=a},toggleCustomized:()=>{h.stylebook.customizedOnly=!h.stylebook.customizedOnly}});return G.set(e,r),r.host}function ie(e,o){let t=e.filter((r)=>r.name===(o??"base"));return t.length>0?t:e.slice(0,1)}async function LR(e,o){let t=e.wrap,r=vt(e.paneId),a=h.stylebook.filter.toLowerCase(),{customizedOnly:i}=h.stylebook,s=e.renderGeneration,c=Ae,y=F(c),C=to(r?.doc.document?.$media),{sizeBreakpoints:w,baseWidth:E}=Wr(C),k=w.length>0,l=ae(e);t.style.overflow="hidden";let d=[];if(k){d.push({displayName:Di("--"),name:"base",width:E});for(let m of w)d.push({displayName:Di(m.name),name:m.name,width:m.width})}let f;if(!k){let m=C["--"],P=m?`${Di("--")} (${E}px)`:null;f=[o.canvasPanelEntry(m?"base":null,P,!m,m?E:void 0)]}else f=ie(d,nl(e.paneId)).map((m)=>o.canvasPanelEntry(m.name,`${m.displayName} (${m.width}px)`,!1,m.width));if(!await o.drawStage(e,{frame:"boards",framePart:"panzoom",frameVars:"--boards-inset:40px",handles:"hidden",hug:!1,innerPart:"boards",lead:"chrome",panels:f.map((m)=>m.item)},f))return;let b=o.stageHost(e,"chrome-host");if(b&&b.firstChild!==l)b.replaceChildren(l);let v=await y;if(e.renderGeneration!==s)return;let I=V({components:c,specimens:v,customizedOnly:Boolean(i),effectiveHead:Xw(r?.doc.document?.$head),effectiveMedia:C,effectiveStyle:Sr(r?.doc.document?.style),filter:a,meta:cp,projectRoot:x?.projectRoot??null}),{panels:M}=e;for(let{panel:m}of f)M.push(m),OL(e.renderGeneration,I,m.canvas,m._width);if(k)o.updateActivePanelHeaders(e);o.applyTransform(e),o.observeCenterUntilStable(e)}function Cd(e,o,{panCanvas:t=!1}={}){let r={activeSelector:e,rightTab:"style"};if(o!==void 0)r.activeMedia=o;if(dl(u.value,{selection:[],ui:r}),h.stylebook.selection=e,e&&t)HL(e)}var b_=[{id:"page",strip:"page",title:"Page"},{id:"properties",strip:"element",title:"Content"},{id:"style",strip:"element",title:"Style"},{id:"events",strip:"element",title:"Logic"},{id:"assistant",strip:"assistant",title:"Assistant"}],Fk=[{id:"page",title:"Page"},{id:"element",title:"Element"},{id:"assistant",title:"Assistant"}];function v_(){return{saveDocument:()=>{},undo:()=>{},redo:()=>{},openInBrowser:()=>{},buildSite:()=>{},closeDocument:()=>{},duplicateSelection:()=>{},deleteSelection:()=>{},selectParent:()=>{},toggleDock:()=>{},toggleZen:()=>{},openPalette:()=>{},openProject:()=>{},newWindow:()=>{},panelRoster:[],focusPanel:()=>{},focusInspectorTab:()=>{},cycleRegion:()=>{}}}var j=(e)=>e.document.open,J=(e)=>e.selection.count>0&&e.editor.kind==="canvas",z=(e)=>!e.selection.isRoot&&e.selection.paths.every((o)=>Mm(o)),U="an element selected on the canvas that has a sibling position: not the document root, a repeater's template or a switch case",Y=(e)=>e.map((o)=>`[${o.join(", ")}]`).join(" and ");function Kf(e){return[{id:"file.save",title:"Save",category:"File",level:"document",icon:"floppy-disk",keybinding:"mod+s",menus:["commandbar/primary","statusbar/document","palette"],group:"1_file",undo:"none",when:j,enablement:(t)=>t.document.dirty,requires:"unsaved changes",run:()=>e.saveDocument()},{id:"document.close",title:"Close Document",category:"Document",level:"document",keybinding:"mod+w",menus:["context/tab","palette"],group:"1_file",when:j,requires:"an open document",run:()=>e.closeDocument()},{id:"view.openInBrowser",title:"Open in Browser",category:"View",level:"document",icon:"arrow-square-out",keybinding:"mod+shift+o",menus:["commandbar/primary","statusbar/document","palette"],group:"2_output",when:(t)=>t.project.isSite,enablement:j,requires:"a page to preview",run:()=>e.openInBrowser()},{id:"project.buildSite",title:"Build Site",category:"Project",level:"project",menus:["commandbar/overflow","palette"],group:"2_output",when:(t)=>t.project.isSite,requires:"a site project",run:()=>e.buildSite()},{id:"edit.undo",title:"Undo",category:"Edit",level:"document",icon:"arrow-u-up-left",keybinding:"mod+z",menus:["commandbar/primary","palette"],group:"1_history",order:1,when:j,enablement:(t)=>t.document.canUndo,requires:"a change to undo",run:()=>e.undo()},{id:"edit.redo",title:"Redo",category:"Edit",level:"document",icon:"arrow-u-up-right",keybinding:["mod+shift+z","mod+y"],menus:["commandbar/primary","palette"],group:"1_history",order:2,when:j,enablement:(t)=>t.document.canRedo,requires:"a change to redo",run:()=>e.redo()},{id:"selection.duplicate",title:"Duplicate",category:"Selection",level:"selection",keyScope:"canvas",keybinding:"mod+d",menus:["blockbar","context/element","context/layer","outline/row","palette"],group:"3_structure",undo:"document",when:J,enablement:z,requires:U,aiTool:{name:"duplicate_node",description:"Duplicate elements in the document, inserting each copy after its original, as one undoable step. The copies become the selection.",report:({after:t})=>{let r=t.selection.paths.length;return`Duplicated ${r} element${r===1?"":"s"}; the ${r===1?"copy is":"copies are"} selected at ${Y(t.selection.paths)}.`}},run:()=>e.duplicateSelection()},{id:"selection.repeat",title:"Repeat...",category:"Selection",level:"selection",keyScope:"canvas",menus:["context/element","palette"],group:"3_structure",undo:"document",when:J,enablement:(t)=>z(t)&&!t.selection.isRepeater,requires:"an element with a sibling position that is not already a repeater",run:()=>{(le("he70fc2b"),import("./convert-to-repeater-he70fc2b.js")).then(({convertToRepeater:t})=>t())}},{id:"selection.delete",title:"Delete",category:"Selection",level:"selection",keyScope:"canvas",keybinding:["delete","backspace"],menus:["blockbar","context/element","context/layer","outline/row","palette"],group:"9_danger",destructive:!0,undo:"document",when:J,enablement:z,requires:U,aiTool:{name:"delete_node",description:"Delete elements from the document as one undoable step.",report:({before:t,after:r})=>{let a=t.selection.paths.length;return`Deleted ${a} element${a===1?"":"s"} at ${Y(t.selection.paths)} in one undo step; the selection is now ${r.selection.count===0?"empty":"elsewhere"}.`}},run:()=>e.deleteSelection()},{id:"selection.selectParent",title:"Select Parent",category:"Selection",level:"selection",keyScope:"canvas",keybinding:["escape","arrowleft"],menus:["palette"],group:"2_navigate",when:J,requires:"an element selection",run:()=>e.selectParent()},{id:"view.toggleNavigator",title:"Toggle Navigator Dock",category:"View",level:"application",keybinding:"mod+b",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>e.toggleDock("navigator")},{id:"view.toggleInspector",title:"Toggle Inspector Dock",category:"View",level:"application",keybinding:"mod+alt+b",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>e.toggleDock("inspector")},{id:"view.zen",title:"Zen Mode",category:"View",level:"application",keybinding:"mod+.",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>e.toggleZen()},{id:"palette.open",title:"Open Command Center",category:"View",level:"application",keybinding:"mod+k",menus:["palette"],group:"5_palette",run:()=>e.openPalette("picker")},{id:"palette.openFiles",title:"Go to File…",category:"File",level:"application",keybinding:"mod+p",menus:["palette"],group:"5_palette",run:()=>e.openPalette("files")},{id:"palette.openCommands",title:"Run Command…",category:"View",level:"application",keybinding:"mod+shift+p",menus:["palette"],group:"5_palette",run:()=>e.openPalette("commands")},{id:"palette.openNodes",title:"Go to Symbol in Document…",category:"Selection",level:"document",menus:["palette"],group:"5_palette",when:j,requires:"an open document",run:()=>e.openPalette("nodes")},{id:"project.open",title:"Open Project…",category:"Project",level:"project",keybinding:"mod+o",menus:["commandbar/overflow","statusbar/project","palette"],group:"1_file",run:()=>e.openProject()},{id:"view.newWindow",title:"New Window",category:"View",level:"application",keybinding:"mod+shift+n",menus:["commandbar/overflow","palette"],group:"1_file",when:(t)=>t.capability.windowControls,requires:"a host that can hold more than one window",run:()=>e.newWindow()},{id:"project.openRecent",title:"Open Recent…",category:"Project",level:"project",menus:["commandbar/overflow","statusbar/project","palette"],group:"1_file",run:()=>e.openPalette("projects")},...se(e),...ce(e),{id:"view.cycleRegion",title:"Focus Next Region",category:"View",level:"application",keybinding:"f6",menus:["palette"],group:"4_docks",run:()=>e.cycleRegion(1)},{id:"view.cycleRegionBack",title:"Focus Previous Region",category:"View",level:"application",keybinding:"shift+f6",menus:["palette"],group:"4_docks",run:()=>e.cycleRegion(-1)}]}function se(e){return e.panelRoster.map((o)=>({id:`panel.focus.${o.id}`,title:`Show ${o.title}`,category:"View",level:"application",menus:["palette"],group:"4_docks",requires:"an open project",when:(t)=>t.project.open&&(o.when?.(t)??!0),run:()=>e.focusPanel(o.id)}))}function ce(e){return b_.map((o,t)=>({id:`inspector.focus.${o.id}`,title:`Show ${o.title}`,category:"View",level:"document",keybinding:`mod+shift+${t+1}`,menus:["palette"],group:"4_docks",requires:"an open document",when:(a)=>a.document.open,run:()=>e.focusInspectorTab(o.id)}))}
|
|
6
|
-
export{Dy,Ru,Gf,Bg,h_,ER,p_,f_,m_,g_,Ny,Pk,TR,Ay,Oy,My,cp,LR,Cd,b_,Fk,v_,Kf};
|
|
7
|
-
|
|
8
|
-
//# debugId=96E67B117E07535A64756E2164756E21
|
|
9
|
-
//# sourceMappingURL=studio-58xg6j2q.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{Pt,Nt,ae}from"./studio-q7rtx6zq.js";import{p}from"./studio-w4rz9hdk.js";import{us}from"./studio-4hp8pkyt.js";import{g}from"./studio-43sd2mam.js";import{qe,ft,T,R,Jt,tt}from"./studio-x9hsze61.js";import{Wl,dN,wb,YT,uN,Ri,Pd}from"./studio-3e54qh39.js";import{sb,ME}from"./studio-zcd2e7yz.js";import{x}from"./studio-gcxk20n7.js";import{te}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";function Dl(e){let t=e.trim().replaceAll("\\","/").split("/").filter((n)=>n!=="");return t.some((n)=>n==="."||n==="..")?null:t.join("/")}var w={$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",w);var D="https://github.com/apps/cloudflare-pages/installations/new";function I(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 j(e){let{error:t}=e;return{accountId:e.form.accountId,accountOptions:e.accounts,body:I(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:D,productionUrl:e.deploy?.productionUrl??"",projectName:e.form.projectName,repo:e.form.repo,submitLabel:e.busy?"Connecting…":"Create & Connect"}}function k(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let n="",m=!1,P=()=>{if(m)return;m=!0,e.onClosed()},C=()=>m,d=g({...j(e.view),closed:P,connect:()=>{e.onConnect()},disconnect:()=>{e.onDisconnect()},openAccounts:()=>{e.onOpenAccounts()},refresh:()=>{e.onRefresh()},replace:()=>{n="",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)=>{n=o},submit:()=>{e.onSubmit()},verify:()=>{let o=n;n="",e.onSaveToken(o)}}),y=null,A=R("publish",d,t).then(async(o)=>{y=o;let u=o.root;if(C())return o.dispose(),u;if(await Jt(u),C())return u;return(u.querySelector('dialog[part="dialog"]')??u).setAttribute(qe,ft("modal","publish")),Pt(u),u});return{close(){let o=y?.root;if(o instanceof HTMLElement)Nt(o);y?.dispose(),y=null,n="",t.remove(),P()},host:t,ready:A,update(o){Object.assign(d,j(o))}}}var f=null,i="loading",h=[],l=null,r="",c=!1,b=!1,a={accountId:"",branch:"main",owner:"",projectName:"",repo:""};function N(){return x?.projectConfig??null}function O(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=/^[\w.-]+\/[\w.-]+@[^:]+:(.+)$/.exec(p().projectRoot)?.[1]??"";return Dl(e)??""}function U(){let e=Ri();return e?{productionUrl:e.productionUrl??"",projectName:e.projectName}:null}function S(){let e=Wl(),t=i==="loading"?null:i;return{accounts:h.map((n)=>({label:n.name,value:n.id})),busy:c,connected:t?.connected===!0,deploy:U(),deployment:l?{environment:l.environment,stage:l.stage,status:l.status,url:l.url}:null,error:r,form:{...a},hosted:e&&te(p().cfConnect),lapsed:t?.connected===!0&&t.needsReconnect===!0,loading:i==="loading",replacing:b,supported:e,tokenStored:sb()!==""}}function s(){if(f){f.update(S());return}f=k({layer:tt("modal"),onClosed:B,onConnect:()=>{M()},onDisconnect:()=>{z()},onField:(e,t)=>{a={...a,[e]:t}},onOpenAccounts:_,onRefresh:()=>{v()},onReplaceToken:()=>{b=!0,r="",s()},onSaveToken:(e)=>{E(e)},onSubmit:()=>{V()},view:S()})}async function v(){i="loading",s();try{if(i=await p().cfConnection?.()??null,i?.connected&&!i.needsReconnect){h=await dN(),a={...a,accountId:i.accountId??h[0]?.id??""};let e=Ri();if(e)l=await wb(e),Pd(l)}}catch(e){i=null,r=e instanceof Error?e.message:String(e)}s()}async function E(e){let t=e.trim();if(!t){r="Paste a token, or use Preferences › Accounts to forget the stored one.",s();return}ME(t),b=!1,r="",await v()}function _(){ae()?.run("app.preferences",{section:"accounts"})}async function M(){c=!0,r="",s();try{let e=await p().cfConnect?.()??null;if(e?.status==="timeout")r="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 (le("haqazq5r"),import("./cf-account-picker-haqazq5r.js"));await t()}}catch(e){r=e instanceof Error?e.message:String(e)}c=!1,us(),await v()}async function V(){let e=N();if(!e)return;if(!a.projectName||!a.owner||!a.repo||!a.accountId){r="Account, project name, and the GitHub owner/repo are all required.",s();return}c=!0,r="",s();try{let t=L(),n={accountId:a.accountId,owner:a.owner,productionBranch:a.branch||"main",projectName:a.projectName,repo:a.repo};if(t)n.rootDir=t;let m=await uN(e,n);l=await wb(m).catch(()=>null)}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}async function z(){let e=N();if(!e)return;c=!0,s();try{await YT(e,null),l=null}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}function B(){let e=f;f=null,e?.close()}function Ck(e){i={accountId:e.accountId??"demo-account",connected:!0},h=[],l=e.deployment,Pd(e.deployment),r="",c=!1,b=!1,s()}function q2(){let e=N(),{owner:t,repo:n}=H();i="loading",h=[],l=null,r="",c=!1,b=!1,a={accountId:"",branch:"main",owner:t,projectName:Ri()?.projectName??O(e?.name??""),repo:n},s(),v()}
|
|
2
|
-
export{Dl,Ck,q2};
|
|
3
|
-
|
|
4
|
-
//# debugId=7F93180A599560B064756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-6m380wp7.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{Sy,va,e_,ss,t_,as}from"./studio-83mk4bgg.js";import{$e}from"./studio-p4nrkvqr.js";import{n,Z,v}from"./studio-vxq7fcvv.js";var zI="meta",WI="frontmatter",VI="structure",UI="source",qI=2;function m(e){return v(e)}function _u(e){return e.getMap(zI)}function GI(e){return e.getMap(WI)}function Dg(e){return e.getMap(VI)}function KI(e){return e.getText(UI)}var Y=new Set(["textContent"]),h=new Set(["style","attributes","$props"]);function y(e,t){let o=e.toString();if(o===t)return!1;let r=0,s=Math.min(o.length,t.length);while(r<s&&o[r]===t[r])r+=1;let a=o.length,i=t.length;while(a>r&&i>r&&o[a-1]===t[i-1])a-=1,i-=1;if(a>r)e.delete(r,a-r);if(i>r)e.insert(r,t.slice(r,i));return!0}function f(e){let t=new ss;for(let[o,r]of Object.entries(e)){if(r===void 0)continue;t.set(o,m(r)?f(r):$e(r))}return t}function g(e,t){for(let o of[...e.keys()])if(!(o in t)||t[o]===void 0)e.delete(o);for(let[o,r]of Object.entries(t)){if(r===void 0)continue;let s=e.get(o);if(m(r))if(s instanceof ss)g(s,r);else e.set(o,f(r));else if(!b(s,r))e.set(o,$e(r))}}function b(e,t){if(e===t)return!0;if(e instanceof ss||e instanceof va||e instanceof as)return!1;return JSON.stringify(e??null)===JSON.stringify(t??null)}function d(e){return n(e)?new as(e):JI(e)}function Hf(e){let t=new va;return t.insert(0,e.map((o)=>d(o))),t}function JI(e){if(!m(e))throw TypeError("collab-schema: a document node must be a plain object");let t=new ss;for(let[o,r]of Object.entries(e)){if(r===void 0)continue;if(o==="children"&&Array.isArray(r))t.set(o,Hf(r));else if(Y.has(o)&&n(r))t.set(o,new as(r));else if(h.has(o)&&m(r))t.set(o,f(r));else t.set(o,$e(r))}return t}function S(e){return Object.fromEntries(Array.from(e.entries(),([t,o])=>[t,Bf(o)]))}function E(e){if(n(e))return e;return e instanceof as?e.toString():S(e)}function Bf(e){if(e instanceof ss)return S(e);if(e instanceof va)return e.toArray().map((t)=>Bf(t));if(e instanceof as)return e.toString();return e}function l2(e){return S(Dg(e))}function X0(e,t){let o=Dg(e);for(let r of t)if(o instanceof ss)o=o.get(String(r));else if(o instanceof va){let s=Number(r);if(!Number.isInteger(s)||s<0||s>=o.length)return;o=o.get(s)}else return;return o}function pk(e,t,o){let r=KI(e);if(r.toString()===t)return!1;return e.transact(()=>{y(r,t)},o),!0}function c2(e,t,o={}){let r=_u(e);if(r.get("structureSeeded")===!0)return!1;return e.transact(()=>{let s=Dg(e);for(let[i,c]of Object.entries(t)){if(c===void 0)continue;if(i==="children"&&Array.isArray(c))s.set(i,Hf(c));else s.set(i,$e(c))}let a=GI(e);for(let[i,c]of Object.entries(o.frontmatter??{}))if(c!==void 0)a.set(i,$e(c));r.set("schemaVersion",qI),r.set("canonical","structure"),r.set("canonicalRev",0),r.set("sourceFormat",o.sourceFormat??null),r.set("structureSeeded",!0)},o.origin),!0}var d2="jx-local",u2="jx-mirror",h2="jx-seed";class Su extends Error{constructor(e){super(`collab-path-unresolved:${e.join("/")}`);this.name="CollabPathError"}}function O(e,t){let o=X0(e,t);if(!(o instanceof ss))throw new Su(t);return o}function p(e,t,o){let r=O(e,t),s=r.get("children");if(s instanceof va)return s;if(o&&s===void 0){let a=new va;return r.set("children",a),a}throw new Su([...t,"children"])}function J(e,t,o){let r=e.get(t);if(t==="children"&&Array.isArray(o)){e.set(t,Hf(o));return}if(Y.has(t)&&n(o)){if(r instanceof as)y(r,o);else e.set(t,new as(o));return}if(h.has(t)&&v(o)){if(r instanceof ss)g(r,o);else e.set(t,f(o));return}e.set(t,$e(o))}function V(e,t){let{op:o}=t;switch(t.op){case"set-key":{let r=O(e,t.path);if(t.value===void 0)r.delete(t.key);else J(r,t.key,t.value);return}case"insert-child":{let r=p(e,t.parentPath,!0);if(t.index<0||t.index>r.length)throw new Su([...t.parentPath,"children",t.index]);r.insert(t.index,[d(t.node)]);return}case"remove-child":{let r=p(e,t.parentPath,!1);if(t.index<0||t.index>=r.length)throw new Su([...t.parentPath,"children",t.index]);r.delete(t.index,1);return}case"set-child":{let r=p(e,t.parentPath,!1);if(t.index<0||t.index>=r.length)throw new Su([...t.parentPath,"children",t.index]);let s=r.get(t.index);if(s instanceof as&&n(t.node)){y(s,t.node);return}r.delete(t.index,1),r.insert(t.index,[d(t.node)]);return}case"move-child":{let r=p(e,t.fromParentPath,!1),s=p(e,t.toParentPath,!0);if(t.fromIndex<0||t.fromIndex>=r.length)throw new Su([...t.fromParentPath,"children",t.fromIndex]);let a=Bf(r.get(t.fromIndex));if(r.delete(t.fromIndex,1),t.toIndex<0||t.toIndex>s.length)throw new Su([...t.toParentPath,"children",t.toIndex]);s.insert(t.toIndex,[d(a)]);return}default:throw Error(`unknown-doc-op:${o}`)}}function p2(e,t,o){e.transact(()=>{for(let r of t)V(e,r)},o)}function w(e){for(let t=0;t<e.length;t++){let o=e[t];if(!n(o))continue;if(h.has(o))return{key:o,nodePath:e.slice(0,t)};if(Y.has(o))return{key:o,nodePath:e.slice(0,t)}}return null}function P(e){return e instanceof as||e instanceof ss||n(e)}function C(e){return e.every((t)=>n(t)||Z(t))}function f2(e){if(e.length===0)return[];let t=e.map((s)=>s.path);if(!t.every((s)=>C(s)))return null;for(let s=0;s<t.length;s++)for(let a=0;a<t.length;a++){if(s===a)continue;let i=t[s],c=t[a];if(i.length<=c.length&&i.every((u,l)=>u===c[l]))return null}if(e.filter((s)=>s instanceof Sy).length>1)return null;let r=[];for(let s of e){let{path:a}=s,i=w(a);if(i){let{doc:c}=s.target;if(!c)return null;let u=X0(c,[...i.nodePath,i.key]);if(u===void 0)return null;r.push({key:i.key,op:"set-key",path:i.nodePath,value:Bf(u)});continue}if(s instanceof t_){let c=a.at(-1);if(a.at(-2)==="children"&&Z(c)){r.push({index:c,node:s.target.toString(),op:"set-child",parentPath:a.slice(0,-2)});continue}return null}if(s instanceof e_){let c=s.target;for(let[u,l]of s.changes.keys)if(l.action==="delete")r.push({key:u,op:"set-key",path:a});else r.push({key:u,op:"set-key",path:a,value:Bf(c.get(u))})}else if(s instanceof Sy){if(a.at(-1)!=="children")return null;let c=a.slice(0,-1),u=0;for(let l of s.changes.delta)if(l.retain!==void 0)u+=l.retain;else if(l.delete!==void 0)for(let x=0;x<l.delete;x++)r.push({index:u,op:"remove-child",parentPath:c});else if(l.insert!==void 0){let x=Array.isArray(l.insert)?l.insert:[l.insert];for(let D of x){if(!P(D))return null;r.push({index:u,node:E(D),op:"insert-child",parentPath:c}),u+=1}}}else return null}return r}function m2(e,t,o){e.transact(()=>{let r=Dg(e),s=[...r.keys()];for(let i of s)if(!(i in t)||t[i]===void 0)r.delete(i);for(let[i,c]of Object.entries(t)){if(c===void 0)continue;if(i==="children"&&Array.isArray(c))r.set(i,Hf(c));else r.set(i,$e(c))}let a=_u(e);a.set("canonicalRev",Number(a.get("canonicalRev")??0)+1)},o)}function fk(e){return _u(e).get("canonical")==="source"?"source":"structure"}function mk(e){return Number(_u(e).get("canonicalRev")??0)}function g2(e,t,o){if(fk(e)==="source")return!1;return e.transact(()=>{pk(e,t,o);let r=_u(e);r.set("canonical","source"),r.set("canonicalRev",mk(e)+1)},o),!0}function b2(e,t){if(fk(e)!=="source")return!1;return e.transact(()=>{let o=_u(e);o.set("canonical","structure"),o.set("canonicalRev",mk(e)+1)},t),!0}function v2(e,t,o){let r=[];for(let[s,a]of e.getStates()){let i=a;if(s!==o&&i.mode==="source"&&i.focusedPath===t)r.push(s)}return r}function y2(e,t){let o=e.clientID,r=e.getStates().get(o);if(r?.mode!=="source"||r.focusedPath!==t)return!1;let s=o;for(let[a,i]of e.getStates()){let c=i;if(c.mode==="source"&&c.focusedPath===t&&c.canWrite!==!1&&a<s)s=a}return s===o}var gk=["#4f9cf9","#e5484d","#30a46c","#f5a524","#8e4ec6","#00a2c7","#e93d82","#a8845c"];function w2(e){let t=5381;for(let r=0;r<e.length;r++)t=Math.imul(t,33)+(e.codePointAt(r)??0);let o=Math.abs(t)%gk.length;return gk[o]}export{zI,WI,VI,UI,qI,_u,GI,Dg,KI,Hf,JI,Bf,l2,X0,pk,c2,d2,u2,h2,Su,p2,f2,m2,fk,mk,g2,b2,v2,y2,gk,w2};
|
|
2
|
-
|
|
3
|
-
//# debugId=927469AD1BAD395664756E2164756E21
|
|
4
|
-
//# sourceMappingURL=studio-80jyh1xh.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{mx,Pp,Fp,jp,gx,Tm,Wd,qb,Hp,C$,ch,$m,qA,Ta}from"./studio-q7rtx6zq.js";import{p}from"./studio-w4rz9hdk.js";import{fh}from"./studio-8m0y2qe7.js";import{Qt,Hi,dv}from"./studio-c05wdnt3.js";import{Ot,cn}from"./studio-z97c48fk.js";import{Ae}from"./studio-fbhxxc5f.js";import{ar}from"./studio-fyh0jc96.js";import{ah,jb,Jl,Sm,Hb,Hd}from"./studio-ph84avkf.js";import{NS,OS,Tb,Lb}from"./studio-rj9eamf8.js";import{or}from"./studio-q0tccd43.js";import{x}from"./studio-gcxk20n7.js";import{n,te,S,v,Ie,_n,rc}from"./studio-vxq7fcvv.js";function R(e,t){return new URL(`/node_modules/${e}`,t).href}var L=4;function P(e){if(e===void 0)return!1;if(n(e))return!e.includes("${");if(Array.isArray(e))return e.every((t)=>P(t));if(v(e))return!("$ref"in e)&&!("$prototype"in e)&&!("$expression"in e)&&Object.values(e).every((t)=>P(t));return!0}function F(e){return new Set(Object.keys(e.state??{}).filter((t)=>!rc(t)))}function H(e){let t=new Map;for(let[s,r]of Object.entries(e.state??{})){if(rc(s)||!v(r)||!Array.isArray(r.examples))continue;let[o]=r.examples;if(P(o))t.set(s,o)}return t}function C(e,t){let s=(r,o)=>{if(Array.isArray(r)){for(let i of r)s(i,o);return}if(!_n(r))return;t(r,o),s(r.children,o),s(r.map,r.$prototype==="Array"?r:o);for(let i of Object.values(r.cases??{}))s(i,o)};s(e,null)}function V(e,t,s){let r=new Map;return C(e,(o)=>{if(o.tagName!==t||!v(o.$props))return;let i=new Map;for(let[l,u]of Object.entries(o.$props))if(s.has(l)&&P(u))i.set(l,u);if(i.size>r.size)r=i}),r}async function j(e){try{let t=await p().readFile(e);await Ot();let s;if(cn(e))s=(await or(e,t)).document;else if(e.endsWith(".json"))s=JSON.parse(t);else return null;return _n(s)?s:null}catch{return null}}async function E(e,t){let s=await ar({path:e,tagName:t});if(s.status!=="ready")return[];let{i18n:r}=Qt(x?.projectConfig??{}),o=(l)=>{let u=Hi(l,r);return u!==null&&u!==r?.defaultLocale},i=s.result.files.map((l)=>l.path);return[...i.filter((l)=>!o(l)),...i.filter((l)=>o(l))].slice(0,L)}async function fS(e,t){let s=F(e),r=n(e.tagName)?e.tagName:null,o=H(e);if(!r||s.size===0)return o;let i=new Map;for(let l of await E(t,r)){let u=V(await j(l),r,s);if(u.size>i.size)i=u}return new Map([...i,...o])}function J(e){let{items:t}=e;if(!Ie(t)||!t.$ref.startsWith("#/state/"))return null;let s=t.$ref.slice(8);return s!==""&&!s.includes("/")?s:null}async function mS(e,t){let s=n(e.tagName)?e.tagName:null;if(!s)return null;for(let r of await E(t,s)){let o=await j(r),i=[];C(o,(c,a)=>{if(c.tagName===s&&a&&J(a))i.push(a)});let[l]=i,u=l?J(l):null;if(!o||!l||!u)continue;let f=await OS(o,[u],new URL(r,Jl(x?.projectRoot)).href),y=f.state?.[u];if(!Array.isArray(y)||y.length===0)continue;let w=r.startsWith("pages/")?await NS({documentPath:r,isEntry:!1,lang:o.$lang,title:o.title},x?.projectConfig):null;return{doc:{children:[l],state:{...f.state,[u]:y.slice(0,1),...w},tagName:"div"},file:r}}return null}var W={body:"body",root:":root"};function k(e,t,s,r,o=W){let i=[],l=(c,a)=>{let h={mediaQueries:t,scope:a,transposeValue:s};if(r)h.resolveValue=(g,b)=>r(g,b,a);for(let g of Tm(c,h))i.push(g.text)},u={},f={},y=[],w=[];for(let[c,a]of Object.entries(e)){if(S(a)&&!Array.isArray(a)){if(c.startsWith("@"))y.push([c,a]);else if(!c.startsWith("--"))w.push([c,a]);continue}if(gx(c)||c.startsWith("@"))continue;if(c.startsWith("--")||c==="colorScheme"||c==="color-scheme")u[c]=a;else f[c]=a}l(u,o.root),l(f,o.body);for(let[c,a]of w)if(c.startsWith("&"))l({[c]:a},o.root);else l(a,c);for(let[c,a]of y){if(mx(c)||Pp(c)){l({[c]:a},null);continue}let h={},g={},b=[];for(let[m,d]of Object.entries(a)){if(S(d)&&!Array.isArray(d)){if(!m.startsWith("@"))b.push([m,d]);continue}if(m.startsWith("--"))h[m]=d;else g[m]=d}l({[c]:h},o.root),l({[c]:g},o.body);for(let[m,d]of b)l({[c]:d},m)}if(Object.values(t).some((c)=>jp(c)!==null)&&!("colorScheme"in e))i.push(`${o.root} { color-scheme: light dark }`,`${o.root}:where([${Fp}="light"]) { color-scheme: light }`,`${o.root}:where([${Fp}="dark"]) { color-scheme: dark }`);return i.join(`
|
|
2
|
-
`)}var _={body:":host",root:":host"},O=new WeakMap,D=new WeakMap;function U(e){let t=e.replaceAll(/:root\b/g,":host").replaceAll(/(^|[\s,>+~(])(?:html|body)(?![\w-])/g,"$1:host").replaceAll(/:host(?:\s*>?\s*:host)+/g,":host");return t===e?null:t}function M(e){for(let t=0;t<e.cssRules.length;t+=1){let s=e.cssRules[t],r=s instanceof CSSStyleRule?U(s.selectorText):null;if(s instanceof CSSStyleRule&&r!==null){let i=`${r}${s.cssText.slice(s.cssText.indexOf("{"))}`;try{e.insertRule(i,t),e.deleteRule(t+1)}catch{}}let o=e.cssRules[t];if(o instanceof CSSGroupingRule)M(o)}}function z(e){let t=[];for(let s of e??[]){if(!S(s)||String(s.tagName).toLowerCase()!=="link")continue;let{href:r,rel:o}=s.attributes??{};if(n(r)&&r!==""&&n(o)&&o.split(/\s+/).includes("stylesheet"))t.push(r)}return t}async function I(e){let t=Hb(e,"project.json");try{let s=await fetch(t);if(!s.ok)return null;let r=new URL(t,location.href).href,o=new CSSStyleSheet({baseURL:r});return o.replaceSync(await s.text()),M(o),o}catch{return null}}async function B(e){let s=(await Promise.all(z(e.$head).map((o)=>I(o)))).filter((o)=>o!==null),{style:r}=e;if(S(r)){let o=new CSSStyleSheet;o.replaceSync(k(r,e.$media??{},(i)=>i,void 0,_)),s.push(o)}return s}function N(){let e=x?.projectConfig;if(!e||!te(globalThis.CSSStyleSheet))return Promise.resolve([]);let t=O.get(e);if(!t)t=B(e).then((s)=>(D.set(e,s),s)),O.set(e,t);return t}function JD(){let e=x?.projectConfig;return(e&&D.get(e))??[]}var K=150;function _w(e=K){let t=new Map;function s(){for(let[r,o]of t){if(t.size<=e)break;t.delete(r),o.remove()}}return{clear(){for(let r of t.values())r.remove();t.clear()},get(r){let o=t.get(r);if(o!==void 0)t.delete(r),t.set(r,o);return o},has:(r)=>t.has(r),keys:()=>[...t.keys()],set(r,o){t.delete(r),t.set(r,o),s()},size:()=>t.size}}function A(e){let t=Jl(x?.projectRoot);return URL.canParse(t)?new URL(e,t).href:location.href}async function G(e){try{let t=await p().readFile(e);Wd(!0);let s=Sm(e,Hd());await Ot();let r;if(cn(e))r=(await or(e,t)).document;else r=JSON.parse(t);return await T(r,e,s)}catch{return null}}async function T(e,t,s=Sm(t,Hd())){Wd(!0),qb(jb());let r=await ch(e,{},A(t)),o=s&&{...s,versions:fh()};C$((i)=>dv(i,o));try{let i=Ta(e,r);return i instanceof HTMLElement?i:null}finally{C$(null)}}async function Y(e,t){let s=await RT(t);if(!s)return null;let r=await fS(s,t);if(r.size>0&&await Sw(s,t,r))return Tb(e,r);let o=await mS(s,t);if(o&&await Lb(e))return T(o.doc,o.file);return await Sw(s,t,r)?Tb(e,r):null}async function RT(e){try{let t=JSON.parse(await p().readFile(e));return S(t)&&!Array.isArray(t)?t:null}catch{return null}}async function Sw(e,t,s){let r=null;try{Wd(!0),qb(jb());let o=await ch(e,{},A(t));for(let[u,f]of s)o[u]=f;let i=!1;$m(()=>{i=!0});let{stop:l}=Hp(()=>Ta({...e,tagName:"div"},o));return r=l,!i}catch{return!1}finally{$m(null),r?.()}}function q(e){return e.source!=="npm"&&(e.path?.endsWith(".json")??!1)}async function Cw(e,t){let s=t.get(e);if(s)return s;let r;try{qA((i)=>R(i,`${ah()}/`)),await N();let o=Ae.find((i)=>i.path===e);if(o&&q(o))r=await Y(o,e);else r=o?await Tb(o):await G(e)}catch{return}if(!r)return;return t.set(e,r),r}function bp(e){if(!te(globalThis.IntersectionObserver))return{destroy(){},observe:(r)=>e(r),releaseDetached:()=>0};let t=new Set,s=new IntersectionObserver((r)=>{for(let o of r)if(o.isIntersecting)t.delete(o.target),s.unobserve(o.target),e(o.target)},{rootMargin:"200px"});return{destroy(){s.disconnect(),t.clear()},observe(r){if(t.has(r))return;t.add(r),s.observe(r)},releaseDetached(){let r=0;for(let o of t)if(!o.isConnected)t.delete(o),s.unobserve(o),r+=1;return r}}}
|
|
3
|
-
export{fS,mS,JD,_w,RT,Sw,Cw,bp};
|
|
4
|
-
|
|
5
|
-
//# debugId=3F6BD22739F96C3564756E2164756E21
|
|
6
|
-
//# sourceMappingURL=studio-8vcvfs7r.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{St,Xn,Se,We,yh,m,_i,Bt}from"./studio-c05wdnt3.js";import{g}from"./studio-43sd2mam.js";import{p}from"./studio-w4rz9hdk.js";import{Ot,cn}from"./studio-z97c48fk.js";import{T,R,Zs,tt}from"./studio-x9hsze61.js";import{$a,Vd}from"./studio-r5qy30vx.js";import{Md,HT,vS,zT,WT}from"./studio-tf9jryb1.js";import{bb,cs,zl,Iw,Rw,xp,nr,_p}from"./studio-q0tccd43.js";import{x}from"./studio-gcxk20n7.js";import{n,Z,te,of}from"./studio-vxq7fcvv.js";var j={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGridOpen",$description:"Every grid-able source a project has, grouped by where it comes from: the project's own pages and content collections first, then each connection's tables. It is the ISLAND of a confirm dialog rather than a dialog of its own — `ui/layers.ts`'s dialog owns the headline, the cancel button, modality and focus, and this document is only the list — because a second answer to \"what is a dialog\" is a defect (studio-ui-guidelines.md §12.5). Group headings are why it is not the kit menu: a menu row can carry a divider above it and cannot carry a name for the run it opens.",tagName:"div",attributes:{part:"sources"},style:{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",minWidth:"280px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="group-title"]':{margin:"0",fontSize:"var(--jx-text-xs)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)"},'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"1px",marginTop:"var(--jx-space-1)"},'& [part="source"]':{textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-2) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer"},'& [part="source"]:hover':{background:"var(--bg-hover)"},'& [part="source"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="group-empty"]':{margin:"0",padding:"var(--jx-space-2)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"}},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/key"},map:{$description:"One origin of grid-able sources. A connection with no tables says why it has none instead of drawing an empty box — an author who has not pushed a schema yet is exactly the reader who needs the sentence.",tagName:"section",attributes:{part:"group","data-group":"${$map.item.key}"},children:[{tagName:"h3",attributes:{part:"group-title"},textContent:"${$map.item.title}"},{tagName:"div",attributes:{part:"rows"},$switch:{$ref:"$map/item/state"},cases:{listed:{tagName:"div",attributes:{part:"rows-list",role:"none"},style:{display:"contents"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/id"},map:{tagName:"button",attributes:{part:"source",type:"button","data-source":"${$map.item.id}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/id"}]}]},textContent:"${$map.item.label}"}}]},empty:{tagName:"p",attributes:{part:"group-empty"},textContent:"${$map.item.emptyMessage}"}}}]}}]};T("grid-open",j);function I(e,r,t){let o=g({groups:r,open:t}),i=null,s=!1,c=R("grid-open",o,e).then((y)=>{let a=y.root;if(s)return y.dispose(),a;return i=y,a});return{dispose(){s=!0,i?.dispose(),i=null},ready:c}}function G(){try{return p()}catch{return null}}function nS(){return te(G()?.dataRows)}async function K(){let e=G();if(!te(e?.dataConnections))return null;return e.dataConnections()}async function zD(e){let r=G();if(!te(r?.dataConnectionTest))return{error:"Connection tests are not supported by this backend",ok:!1};try{return await r.dataConnectionTest(e)}catch(t){return{error:t instanceof Error?t.message:String(t),ok:!1}}}async function eT(e){let r=G();if(!te(r?.dataPush))return{applied:!1,errors:["Schema push is not supported by this backend"],plan:[]};try{return await r.dataPush(e)}catch(t){return{applied:!1,errors:[t instanceof Error?t.message:String(t)],plan:[]}}}function k(e){let t=G()?.[e];if(t===void 0)throw Error(`The ${String(e)} surface is not supported by this backend`);return t}function v(e){return k("dataRows")(e)}function M(e){return k("dataInsertRow")(e)}function E(e){return k("dataUpdateRow")(e)}function O(e){return k("dataDeleteRow")(e)}function WD(e,r,t){let o=(c)=>c.replaceAll(/([a-z0-9])([A-Z])/g,"$1_$2").replaceAll(/[^A-Za-z0-9]+/g,"_").replaceAll(/^_+|_+$/g,"").toUpperCase(),s=[r??e,t.replace(/Env$/,"")].flatMap((c)=>{let y=o(c);return y?[y]:[]}).join("_")||"SECRET";return/^\d/.test(s)?`JX_${s}`:s}var H=["id","sku","slug","Slug"];function L(e){let r=new Set;return e.map((t,o)=>{let i=t.trim()===""?`column${o+1}`:t;if(r.has(i))i=`${i}__${o+1}`;return r.add(i),i})}function Q(e,r){for(let t of H){let o=e.indexOf(t);if(o===-1)continue;let i=r.rows.map((s)=>s[o]??"");if(i.every((s)=>s!=="")&&new Set(i).size===i.length)return t}return null}function A(e,r){let t=Md(e),o=L(t.headers),i=Q(o,t),s=i?o.indexOf(i):-1,c=t.rows.map((d,u)=>s===-1?String(u):d[s]),y=new Map(c.map((d,u)=>[d,u])),a=yh(r,x?.projectConfig),l=a?.schema.properties??{},b=t.rows.slice(0,50).map((d)=>{let u={};for(let[S,C]of o.entries())u[C]=d[S]??"";return u}),f=new Map(Rw(b).map((d)=>[d.field,d])),w=new Map(Iw(a?.schema,{idField:i??void 0}).map((d)=>[d.field,d]));return{columns:o.map((d,u)=>{let C=(d in l?w.get(d):void 0)??f.get(d)??{editable:!0,field:d,kind:"string",title:t.headers[u]||d};return{...C,pk:d===i,title:t.headers[u]?.trim()||C.title}}),doc:t,fields:o,keys:c,keyToIndex:y,loadText:e}}function J(e,r){let t={},o=e.doc.rows[r]??[];for(let[i,s]of e.fields.entries()){let c=e.columns[i],y=o[i]??"";t[s]=c.kind==="string"||c.kind==="text"||c.kind==="readonly"?y:xp(y,c)}return t}function F(e,r){let t=e.doc.rows.map((s)=>[...s]),o=(s)=>e.fields.indexOf(s);for(let s of r.cells){let c=e.keyToIndex.get(s.rowKey),y=o(s.field);if(c===void 0||y===-1)continue;t[c][y]=nr(s.value)}for(let s of r.inserts){let c=e.fields.map((y)=>nr(s.cells[y]??null));t.push(c)}let i=r.deletes.map((s)=>e.keyToIndex.get(s.rowKey)).filter((s)=>s!==void 0).toSorted((s,c)=>c-s);for(let s of i)t.splice(s,1);return{...e.doc,rows:t}}function _(e,r){return{cells:e.cells.map((t)=>({field:t.field,rowKey:t.rowKey,...r})),deletes:e.deletes.map((t)=>({rowKey:t.rowKey,...r})),inserts:e.inserts.map((t)=>({error:r.error,ok:r.ok,tempKey:t.tempKey}))}}function iS(e){let r=null,t=(o=!1)=>{if(!o&&r)return r;return r=p().readFile(e).then((i)=>A(i,e)),r};return{backingPaths:()=>new Map([[e,"*"]]),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return(await t()).columns},async commit(o){let i=await t(),s=p(),c=null;try{c=await s.readFile(e)}catch{c=null}if(c!==i.loadText&&!Vd(e))return _(o,{error:"File changed on disk — refresh to reload",ok:!1,stale:!0});let y=F(i,o),a=HT(y);return $a(e),await s.writeFile(e,a),r=Promise.resolve(A(a,e)),_(o,{ok:!0})},id:e,label:e.split("/").pop()??e,async refresh(){await t(!0)},async rows(){let o=await t(),i=o.doc.rows.map((s,c)=>({cells:J(o,c),key:o.keys[c]}));return{rows:i,total:i.length}},async serializeForSource(o){let i=await t();return HT(F(i,o))}}}var z=50;function U(e){let r=e.toLowerCase();if(/(int|real|floa|doub|num|dec)/.test(r))return"number";if(r.includes("bool"))return"boolean";if(/(timestamp|datetime|date)/.test(r))return"date";return"string"}function q(e){return!e.pk&&e.name!=="created_at"&&e.name!=="updated_at"}function W(e){if(e===void 0)return null;if(of(e))return e;return JSON.stringify(e)}function N(e,r){let t=[],o="id",i=new Map,s=(a)=>{if(a.length>0)t=a,o=a.find((l)=>l.pk)?.name??"id"},c=(a)=>{let l={table:r};if(e)l.connection=e;if(l.limit=a?.limit??z,l.offset=a?.offset??0,a?.orderBy)l.dir=a.dir??"asc",l.orderBy=a.orderBy;return l},y=(a,l)=>{let b=a[o];if(n(b)||Z(b))return i.set(String(b),b),String(b);return`row-${l}`};return{capabilities:{delete:!0,insert:!0,remotePaging:!0,remoteSort:!0},async columns(){if(t.length===0){let a=await v(c({limit:1,offset:0}));s(a.columns)}return t.map((a)=>{let l=q(a)?U(a.type):"readonly";return{editable:l!=="readonly",field:a.name,kind:l,pk:a.pk===!0,title:a.name,widthHint:a.pk?80:void 0}})},async commit(a){let l={cells:[],deletes:[],inserts:[]},b=new Map;for(let f of a.cells){let w=b.get(f.rowKey)??[];w.push({field:f.field,value:f.value}),b.set(f.rowKey,w)}for(let[f,w]of b){let h=i.get(f),d=(u,S)=>{for(let C of w)l.cells.push({error:S,field:C.field,ok:u,rowKey:f})};if(h===void 0){d(!1,"Row has no primary key — refresh the grid");continue}try{let u={};for(let C of w)u[C.field]=C.value;let S={pk:h,set:u,table:r};if(e)S.connection=e;await E(S),d(!0)}catch(u){d(!1,u instanceof Error?u.message:String(u))}}for(let f of a.inserts)try{let w={};for(let[C,P]of Object.entries(f.cells))if(P!==null)w[C]=P;let h={table:r,values:w};if(e)h.connection=e;let{row:d}=await M(h),u=d[o],S;if(n(u)||Z(u))S=String(u),i.set(S,u);l.inserts.push({newKey:S,ok:!0,tempKey:f.tempKey})}catch(w){l.inserts.push({error:w instanceof Error?w.message:String(w),ok:!1,tempKey:f.tempKey})}for(let f of a.deletes){let w=i.get(f.rowKey);if(w===void 0){l.deletes.push({error:"Row has no primary key — refresh the grid",ok:!1,rowKey:f.rowKey});continue}try{let h={pk:w,table:r};if(e)h.connection=e;await O(h),l.deletes.push({ok:!0,rowKey:f.rowKey})}catch(h){l.deletes.push({error:h instanceof Error?h.message:String(h),ok:!1,rowKey:f.rowKey})}}return l},id:cs({connection:e??"default",kind:"data",table:r}),label:r,async refresh(){t=[],i.clear()},async rows(a){let l=await v(c(a));return s(l.columns),{rows:l.rows.map((f,w)=>{let h=y(f,w),d={};for(let u of t)d[u.name]=W(f[u.name]);return{cells:d,key:h}}),total:l.total}}}}async function tT(e,r={}){let t=m.tabs.get(e);if(t)return Bt(e,{focus:r.focus!==!1}),t;try{await Ot()}catch{}let o=iS(e),i=_i({capabilities:{modes:["grid","source"]},document:structuredClone(bb),documentPath:e,id:e,sourceFormat:cn(e)?.name??null,...r.paneId!==void 0&&{paneId:r.paneId},...r.preview===!0&&{preview:!0},...r.focus===!1&&{focus:!1}});return _p(i,o).load(),i}function D(e){let r=_i({capabilities:{modes:["grid"]},document:structuredClone(bb),documentPath:null,id:e.id});return _p(r,e).load(),r}function VD(e){let r=cs({kind:"collection",name:e}),t=m.tabs.get(r);if(t)return Bt(r),t;return D(zT(e))}function oS(){let e=cs({kind:"pages"}),r=m.tabs.get(e);if(r)return Bt(e),r;return D(WT())}function V(e,r){let t=cs({connection:e??"default",kind:"data",table:r}),o=m.tabs.get(t);if(o)return Bt(t),o;return D(N(e,r))}function X(e){let r=zl(e);if(r?.kind==="pages")oS();else if(r?.kind==="collection")VD(r.name);else if(r?.kind==="data")V(r.connection,r.table)}function Y(e,r){return[{emptyMessage:"",key:"project",rows:[{id:cs({kind:"pages"}),label:"Pages"},...e.map(({name:t})=>({id:cs({kind:"collection",name:t}),label:`Collection: ${t}`}))],state:"listed",title:"Project"},...r.map((t)=>({emptyMessage:"No tables — push a schema first.",key:`data:${t.name}`,rows:t.tables.map((o)=>({id:cs({connection:t.name,kind:"data",table:o}),label:o})),state:t.tables.length===0?"empty":"listed",title:`Data · ${t.name}`}))]}async function nT(){let e=vS(),r=[];if(nS())r=(await K().catch(()=>null))?.connections??[];let t=null,o=Zs({cancelLabel:"Cancel",confirmLabel:"",headline:"Open Grid",island:(i)=>{t=I(i,Y(e,r),(s)=>{o.close(),X(s)})},layer:tt("dialog"),onCancel:()=>o.close(),onClosed:()=>{t?.dispose(),t=null},onConfirm:()=>{},region:"grid/open"});o.ready}function ee(){return[{args:Se({name:We("The content collection's name, as project.json declares it.")}),category:"Project",id:"collection.editInGrid",level:"project",menus:["context/file","palette"],group:"5_data",requires:"a project that declares content collections",when:(e)=>e.project.open,run:(e,r)=>{let t=St("collection.editInGrid",r,"name"),o=vS().map((i)=>i.name);if(!o.includes(t))throw RangeError(`command "collection.editInGrid" argument "name": "${t}" is not a content `+"collection this project declares — it declares: "+`${o.length>0?o.join(", "):"none"}`);VD(t)},title:"Edit Collection in Grid"},{args:{additionalProperties:!1,properties:{connection:We('The connection name from project.json. Defaults to "default".'),table:We("The table to open.")},required:["table"],type:"object"},category:"Project",id:"data.openGrid",level:"project",menus:["palette"],group:"5_data",requires:"a platform that serves the data routes",when:(e)=>e.project.open,enablement:(e)=>e.capability.dataRows,run:(e,r)=>{let t=St("data.openGrid",r,"table");V(Xn("data.openGrid",r,"connection"),t)},title:"Open Data Grid"}]}function iT(e){e.registerAll(ee())}
|
|
2
|
-
export{nS,zD,eT,WD,iS,tT,VD,oS,nT,iT};
|
|
3
|
-
|
|
4
|
-
//# debugId=FACD3D7788EC49C464756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-bavb31r0.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{ge,ta,ne,g,he,Th,C}from"./studio-43sd2mam.js";import{Qd}from"./studio-kt3pjkwd.js";import{p}from"./studio-w4rz9hdk.js";import{Wi,cn,ur}from"./studio-z97c48fk.js";import{iI,BC,Io,JO,Ux,oI,rI,XO,wv}from"./studio-8tr6cfrc.js";import{bv,Y$,At,hi,$r,nc,x}from"./studio-gcxk20n7.js";import{$e,oe,vv,yv,nI}from"./studio-p4nrkvqr.js";import{n,Z,Xe,S,v,Yo,Ni,rd,rf}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";var be=g(new Set);function Nm(e){be.add(e)}function Cx(e){be.delete(e)}function CC(e){return be.has(e)}function rv(e,t){return{success:!0,data:e,summary:t}}function ho(e){return{success:!1,error:e}}function bo({name:e,description:t,parameters:o,strict:r=!0,llmStrict:i=!1,interactive:s,execute:a}){let l={name:e,description:t,parameters:o,strict:r,llmStrict:i,execute:a};if(s!==void 0)l.interactive=s;return l}function kx(e){let t=[];return{record(o){t.push(o),e?.(o)},writes:t}}function gh(e=null,t={}){let o=new Map(Object.entries(t));return{sessionId:e,get:(r)=>o.get(r),set:(r,i)=>{o.set(r,i)},toJSON:()=>Object.fromEntries(o)}}var Kt=new AbortController().signal;function Ex(e={}){let t=e.session??gh();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??kx(),progress:e.progress??(()=>{}),session:t,signal:e.signal??Kt}}function rO(e){let t=new AbortController;if(e.aborted)return t.abort(e.reason),{release:()=>{},signal:t.signal};let o=()=>{t.abort(e.reason)};return e.addEventListener("abort",o,{once:!0}),{release:()=>{e.removeEventListener("abort",o)},signal:t.signal}}function A$(){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)=>{let o={name:t.name,description:t.description,parameters:t.parameters};if(t.llmStrict===!0)o.strict=!0;return{type:"function",function:o}})},getDefinition(t){return e.get(t)},validate(t,o){let r=e.get(t);if(!r)return{valid:!1,errors:[`Unknown tool: "${t}"`]};if(!r.strict)return{valid:!0};let i=r.parameters;if(!i.properties)return{valid:!0};let s=[],a=i.properties,l=i.required||[];for(let c of l)if(!(c in o)||o[c]===void 0||o[c]===null)s.push(`Missing required argument: "${c}"`);for(let[c,d]of Object.entries(o)){let b=a[c];if(!b)continue;let y=b.type;if(!y)continue;let h=Ke(d);if(y==="number"||y==="integer"){if(xe(d,"number"))continue;if(xe(d,"string")){if(!Number.isNaN(Number(d)))continue;s.push(`Argument "${c}" should be a number, got non-numeric string "${d}"`);continue}s.push(`Argument "${c}" should be a number, got ${h}`);continue}if(y==="string"&&h!=="string")s.push(`Argument "${c}" should be a string, got ${h}`);else if(y==="boolean"&&h!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${h}`);else if(y==="array"&&h!=="array")s.push(`Argument "${c}" should be an array, got ${h}`);else if(y==="object"&&h!=="object")s.push(`Argument "${c}" should be an object, got ${h}`)}return s.length>0?{valid:!1,errors:s}:{valid:!0}},async execute(t,o,r=Ex()){let i=e.get(t);if(!i)return ho(`Unknown tool: "${t}"`);let s=this.validate(t,o);if(!s.valid)return ho(`Validation failed: ${(s.errors||[]).join("; ")}`);try{return await i.execute(o,r)}catch(a){return ho(`Tool "${t}" execution error: ${ye(a)}`)}}}}function Ut(e){return JSON.parse(JSON.stringify(e))}function ye(e){return e.message}var Ht=["string","number","boolean","undefined"];function xe(e,t){return typeof e===t}function Gt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ke(e){if(Array.isArray(e))return"array";return Ht.find((t)=>xe(e,t))??"object"}function zt(e){if(!e)return{};let t=JSON.parse(e);if(!Gt(t)){let o=t===null?"null":Ke(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function sO(e,t,o){let r=!1,i;try{let s=zt(t.argumentsText);r=!0,i=await e.execute(t.name,s,o)}catch(s){i=ho(`Failed to parse arguments: ${ye(s)}`)}try{return{status:"done",result:Ut(i),executed:r}}catch(s){let a=ye(s);return{status:"done",result:ho(`Tool "${t.name}" returned a result that cannot be serialized: ${a}`),executed:r}}}var G=[],Yt=50;function aO(e){return Object.assign(kx(),{turnId:e})}function lO(e,t){if(t.length===0)return[];let o={id:e,writes:[...t]};G.push(o);while(G.length>Yt)G.shift();return o.writes}function kC(e){return G.find((t)=>t.id===e)?.writes??[]}function cO(e){let t=e.filter((l)=>l.ok),o=new Set(t.map((l)=>l.path)),r=e.length-t.length;if(o.size===0)return r>0?`${r} change${r===1?"":"s"} failed`:"";let i=`Changed ${o.size} file${o.size===1?"":"s"}`,s=new Set(t.flatMap((l)=>l.disk?[l.path]:[])),a=[i];if(s.size>0)a.push(`${s.size} written to disk — undo cannot reach ${s.size===1?"it":"them"}`);if(r>0)a.push(`${r} failed`);return a.join(" · ")}function EC(){G.splice(0)}function dO(e,t){let o=null;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.id===t)return o;let s=i.role==="assistant"&&(i.content||(i.toolCalls?.length??0)>0);if(o===null&&s)o=i.id}return t===void 0?o:null}var qt=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"]),xC="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function Fn(e){if(!n(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function vx(e){return Fn(e)!==null}function Qb(e){let t=Fn(e);if(t===null)return"ltr";let o=new Intl.Locale(t),r=o.script??o.maximize().script;return r!==void 0&&qt.has(r)?"rtl":"ltr"}function Vt(e){let t=Fn(e);if(t===null)return n(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var Zt="prefix-except-default";function Qt(e){let t=e.i18n,o=[];if(!S(t))return{errors:o,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],i=[];for(let l of r){let c=Fn(l);if(c===null){o.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!i.includes(c))i.push(c)}let s=Fn(t.defaultLocale)??i[0]??null;if(t.defaultLocale!==void 0&&Fn(t.defaultLocale)===null)o.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(s===null)return o.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:o,i18n:null};if(!i.includes(s))i.unshift(s);let a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:Zt;return{errors:o,i18n:{defaultLocale:s,locales:i,routing:a}}}function Hi(e,t){let o=Te(z(e),t);if(o===-1||t===null)return null;return Fn(z(e)[o])}function yx(e,t){let o=Hi(e,t);if(o!==null||t===null||t.routing!=="prefix-except-default")return o;return z(e)[0]==="pages"?t.defaultLocale:null}function ev(e,t){let o=z(e),r=Te(o,t);return r===-1?o.join("/"):o.filter((i,s)=>s!==r).join("/")}function Xc(e,t,o){if(o===null)return null;let r=Fn(t);if(r===null||!o.locales.includes(r))return null;let i=z(e),s=Te(i,o),a=s===-1?Xt(i):s;if(a===-1)return null;let l=s===-1?i:i.filter((c,d)=>d!==s);if(r===o.defaultLocale&&o.routing==="prefix-except-default")return l.join("/");return l.toSpliced(a,0,r.toLowerCase()).join("/")}function z(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function Te(e,t){if(t===null)return-1;return e.findIndex((o)=>{let r=Fn(o);return r!==null&&t.locales.includes(r)})}function Xt(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function nO(e,t){if(t===null)return null;let o=e.split("/").find(Boolean);if(o===void 0)return t.defaultLocale;let r=Fn(o);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}function P$(e,t){if(!n(t)||t==="")return e;let o=e.indexOf("#"),r=o===-1?"":e.slice(o),i=o===-1?e:e.slice(0,o),s=i.indexOf("?"),a=s===-1?i:i.slice(0,s),c=(s===-1?[]:i.slice(s+1).split("&")).filter((d)=>d!==""&&!en(d));return c.push(`v=${encodeURIComponent(t)}`),`${a}?${c.join("&")}${r}`}function en(e){let t=e.indexOf("="),o=t===-1?e:e.slice(0,t);if(o==="v")return!0;if(!o.includes("%"))return!1;try{return decodeURIComponent(o)==="v"}catch{return!1}}function tn(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function cv(e,t,o=[]){if(!e||!t)return null;let r=e.replaceAll("\\","/").replace(/^\.\//,""),i=null,s=(a,l)=>{if(r.startsWith(`${a}/`)&&(!i||a.length>i.dir.length))i={dir:a,urlPrefix:l}};for(let[a,l]of Object.entries(t)){if(!l?.source||!BC.test(a))continue;let c=on(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(Io)){let d=nn(r,c,a,o);if(d)s(d.dir,d.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${iI}/${a}`)}return i}function nn(e,t,o,r){let i=t.indexOf(Io),s=t.slice(0,i),a=t.slice(i+Io.length);if(!e.startsWith(s))return null;let l=e.slice(s.length).split("/")[0]??"";if(l===""||!BC.test(l))return null;let c=r.find((b)=>b.toLowerCase()===l.toLowerCase());if(c===void 0||!BC.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${iI}/${o}/${c}`}}function on(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function dv(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let r=XO(e,t.documentDir,t.mounts,t.lanes);if(r===null)return null;let{suffix:i}=Ux(e);return P$(`${t.fileBaseUrl}${wv(r)}${i}`,tn(t.versions,r))}let[o]=t.mounts;return o?rn(e,t.documentDir,o):null}function rn(e,t,o){if(oI(e))return null;let{path:r,suffix:i}=Ux(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=rI(t,s);if(a===null)return null;let l=JO([o],a);if(!l)return null;return`${l}${i}`}function Ue(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function q(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function He(e){return e??x?.projectConfig??null}function Ge(e){return e?.content??{}}function sn(e){let t=Qt(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function ze(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function Ye(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:ur()?.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 an(e,t){let o=t===null?"[^/]+":`(?:${t.map((i)=>Ue(i)).join("|")})`,r=q(e).split(Io).map((i)=>Ue(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function un(e,t,o){let r=an(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function dn(e){return q(e).replaceAll(Io,"").length}function Jd(e,t){if(e===null||e===void 0||e==="")return null;let o=He(t),r=sn(o),i=q(e),s=null,a=-1;for(let[l,c]of Object.entries(Ge(o))){let{source:d}=c;if(d===void 0||d===""||ze(d))continue;let b=dn(d);if(b<=a)continue;let y=un(d,i,r);if(y===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===y.length,name:l,...Ye(c)},a=b}return s}function Un(e,t){if(e===null||e===void 0||e==="")return null;let o=He(t),r=q(e),i=r.toLowerCase();for(let[s,a]of Object.entries(Ge(o))){let{source:l}=a;if(l===void 0||l===""||!ze(l))continue;let c=q(l).toLowerCase();if(i===c||i.endsWith(`/${c}`))return{def:a,dir:r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:s,...Ye(a)}}return Jd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function ed(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function Fx(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,o)=>o?o.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function jx(e){return e.replaceAll(/(^|-)(\w)/g,(t,o,r)=>(o?" ":"")+r.toUpperCase())}function RC(e,t){return e?.$label||ed(t)}function NO(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(o,r,i)=>(r?" ":"")+i.toUpperCase());return ed(t)}function Ra(e){return e==="image"||e==="uri-reference"}function vh(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(Ra(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 yh(e,t){if(!e||!t?.content)return null;let o=Un(e,t);if(!o||!o.def.schema)return null;if(!o.fileBacked){let r=o.ext??ur()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(r.toLowerCase()))return null}return{name:o.name,schema:o.def.schema}}function uv(e,t){let o=e.trim().toLowerCase().replaceAll(/[^a-z0-9\s-]/g,"").replaceAll(/\s+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(!o)return"";return`${t}${o}`}function Hx(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())||e}function AO(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((i)=>i[1])};return{kind:"text"}}function Jo(e){return JSON.parse(JSON.stringify(e))}function Me(e){return e?.at(-1)??null}function pO(e){return e?.[0]??null}function Tx(e,t){if(!t||!e)return!1;return e.some((o)=>$r(o,t))}function ea(e){return _(e)}function _(e){let t=[];for(let o of e)t.push([...o]);return t}function Lx(e,t){if(Tx(e,t))return _(e.filter((o)=>!$r(o,t)));return[..._(e),[...t]]}function fO(e,t,o){let r=e.findIndex((a)=>$r(a,o)),i=t?e.findIndex((a)=>$r(a,t)):-1;if(r===-1||i===-1)return[[...o]];let s=i<=r?e.slice(i,r+1):e.slice(r,i+1).toReversed();return _(s)}function qe(e,t){return _(e.filter((o)=>!nc(t,o)))}function pn(e,t){let o=Math.min(e.length,t.length);for(let r=0;r<o;r++){let i=e[r],s=t[r];if(i===s)continue;if(Z(i)&&Z(s))return i-s;return String(i)<String(s)?-1:1}return e.length-t.length}function mn(e){return _(e.filter((t)=>!e.some((o)=>!$r(o,t)&&nc(o,t))))}function Mm(e){return V(e)!==null}function V(e){let t=e?.at(-1);return e&&e.at(-2)==="children"&&Z(t)?{index:t,parentPath:e.slice(0,-2)}:null}function $x(e){return mn(e).filter((t)=>Mm(t)).toSorted((t,o)=>pn(o,t))}function mO(e){let t=[];for(let o of e)if(!t.some((r)=>$r(r,o)))t.push([...o]);return t}function Pm(e){if(e.length===0)return{mixed:!1,value:void 0};let[t]=e,o=JSON.stringify(t??null);for(let r=1;r<e.length;r++)if(JSON.stringify(e[r]??null)!==o)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var Ze=null;function gO(e){Ze=e}function Qe(){return Ze}var X=null,Q=null,ee=null,ve=!0;function et(){X=[],Q=[],ee=[],ve=!0}function f(e){if(X)X.push(e)}function Bi(e){if(Q)Q.push(e)}function tt(e){if(ee)ee.push(e)}function nt(){let e={docOps:Q??[],fmOps:ee??[],invertible:ve,ops:X??[]};return X=null,Q=null,ee=null,ve=!0,e}var ot=100,gn=20;function te(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function R(e,t){let o=oe(e,t);if(!o)throw TypeError(`No node at path [${t.join(", ")}]`);return o}function w(e,t,o,r){return{forward:{key:t,op:"set-key",path:e,value:r},inverse:{key:t,op:"set-key",path:e,value:o}}}function bn(e,t,o,r,i){let s=e.length,a=s<t.length&&e.every((d,b)=>d===t[b]),l=t[s+1];if(!a||t[s]!=="children"||!Z(l))return t;if(i?l<o:l<=o)return t;let c=[...t];return c[s+1]=l+r,c}var rt=null;function it(e){rt=e}var st=null;function at(e){st=e}function yn(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)yv(e.doc.document,he(t.docOps[i].inverse));for(let i=t.fmOps.length-1;i>=0;i--){let s=t.fmOps[i];we(e,s.field,s.before)}e.doc.document={...he(e.doc.document)},e.session.selection=o,e.doc.dirty=r}function Y(e,t,{skipHistory:o=!1,origin:r="user",coalesceKey:i=null}={}){if(!e)return!1;if(r!=="remote"&&st?.(e,r))return!1;let s=ea(e.session.selection),a=e.doc.dirty;et();let l,c=null;try{t(e)}catch(J){c={error:J}}finally{l=nt()}if(c)throw yn(e,l,s,a),c.error;let d=he(e.doc.document),b={...d},y=Qe(),h=y===null?{patchable:!1,reason:"no-patch-consumer"}:l.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:y.classify(e,l.ops);if(h.patchable)y.markConsumed(b,e);if(e.doc.document=b,h.patchable)try{y.apply(e,l.ops,l)}catch(J){y.escalate(`patch-apply-failed: ${J instanceof Error?J.message:String(J)}`,e)}if(!o&&!W)hn(e,d,l,s,i);return e.doc.dirty=!0,rt?.(e,l,r),!0}function hn(e,t,o,r,i=null){let s=e.history.snapshots.slice(0,e.history.index+1),a=te()&&o.invertible&&(o.docOps.length>0||o.fmOps.length>0),l=s.at(-1);if(i&&a&&l&&l.coalesceKey===i&&l.inverseOps){if(l.forwardOps=[...l.forwardOps??[],...o.docOps.map((d)=>d.forward)],l.inverseOps=[...l.inverseOps,...o.docOps.map((d)=>d.inverse)],l.selection=ea(e.session.selection),l.document)l.document=Jo(t);e.history.snapshots=s,e.history.index=s.length-1;return}let c=!a||s.length%gn===0;if(s.push({document:c?Jo(t):null,fmOps:a&&o.fmOps.length>0?o.fmOps:null,forwardOps:a?o.docOps.map((d)=>d.forward):null,inverseOps:a?o.docOps.map((d)=>d.inverse):null,coalesceKey:i,selection:ea(e.session.selection),selectionBefore:r}),s.length>ot){if(!s[1].document)s[1].document=Oe(s,1);s.shift()}e.history.snapshots=s,e.history.index=s.length-1}function Oe(e,t){let o=t;while(o>=0&&!e[o].document)o-=1;let r=o<0?null:e[o].document;if(!r)throw Error("history-missing-checkpoint");let i=Jo(r);for(let s=o+1;s<=t;s++)for(let a of e[s].forwardOps??[])yv(i,a);return i}function qd(e,t,o){return Y(e,(r)=>t(r.doc.document),o)}function Pe(e,t){Y(e,(o)=>{for(let r of t)Ce(o,r)},{origin:"remote",skipHistory:!0})}var xn=new Set(["state","$media","$head","$elements","imports","$layout"]);function Ce(e,t){let o=null;if(t.op==="set-key")o=oe(e.doc.document,t.path)?.[t.key];switch(yv(e.doc.document,t),Bi({forward:t,inverse:t}),t.op){case"set-key":{if(xn.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 r=t.key.startsWith("on")&&(rf(t.value)||rf(o));f({isEvent:r,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 W=null,lt=null;function ct(e){lt=e}function Ix(e){W=e}function Rx(){let e=W;if(e&&!L.has(e)){let t=he(e.doc.document),o={document:Jo(t),selection:ea(e.session.selection)},r=e.history.snapshots.slice(0,e.history.index+1);if(r.push(o),r.length>ot)r.shift();e.history.snapshots=r,e.history.index=r.length-1}if(W=null,e)lt?.(e)}function LC(){return W!==null}function bO(){return W}var L=new WeakMap;function av(e,t){if(t)L.set(e,t);else L.delete(e)}function vO(e){let t=L.get(e);return t?t.canUndo(e):e.history.index>0}function yO(e){let t=L.get(e);return t?t.canRedo(e):e.history.index<e.history.snapshots.length-1}function ut(e,t){let{snapshots:o}=e.history;e.doc.document=Oe(o,t);let r=o[t];e.session.selection=ea(he(r.selection))}function dt(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let o=JSON.stringify(Oe(e.history.snapshots,t)),r=JSON.stringify(Jo(he(e.doc.document)));if(o!==r)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function $C(e){let t=L.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let o=e.history.snapshots[e.history.index],r=te()?o.inverseOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l=r.length-1;l>=0;l--)Ce(a,he(r[l]));if(i)for(let l=i.length-1;l>=0;l--){let c=he(i[l]);we(a,c.field,c.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=ea(he(o.selectionBefore??[])),e.history.index-=1,dt(e,e.history.index)}else e.history.index-=1,ut(e,e.history.index);e.doc.dirty=!0}function wO(e){let t=L.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let o=e.history.snapshots[e.history.index+1],r=te()?o.forwardOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l of r)Ce(a,he(l));if(i)for(let l of i){let c=he(l);we(a,c.field,c.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=ea(he(o.selection)),e.history.index+=1,dt(e,e.history.index)}else e.history.index+=1,ut(e,e.history.index);e.doc.dirty=!0}function Lo(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;vv(i).splice(o,0,structuredClone(r)),f({index:o,op:"insert",parentPath:t}),Bi({forward:{index:o,node:$e(r),op:"insert-child",parentPath:t},inverse:{index:o,op:"remove-child",parentPath:t}})}function bh(e,t){let o=V(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=R(e.doc.document,i).children.splice(r,1);f({op:"remove",path:t}),Bi({forward:{index:r,op:"remove-child",parentPath:i},inverse:{index:r,node:$e(s),op:"insert-child",parentPath:i}}),e.session.selection=qe(e.session.selection,t)}function M$(e,t){let o=V(t);if(!o)return;let r=oe(e.doc.document,t);if(!r)return;let{index:i,parentPath:s}=o,a=structuredClone(he(r));R(e.doc.document,s).children.splice(i+1,0,a),f({index:i+1,op:"insert",parentPath:s}),Bi({forward:{index:i+1,node:$e(a),op:"insert-child",parentPath:s},inverse:{index:i+1,op:"remove-child",parentPath:s}}),e.session.selection=[[...s,"children",i+1]]}function Fm(e,t){for(let o of $x(t))bh(e,o)}function Dx(e,t){let o=[];for(let r of $x(t)){let i=e.session.selection;M$(e,r);let s=Me(e.session.selection),a=V(s);if(!s||!a||e.session.selection===i)continue;o=o.map((l)=>bn(a.parentPath,l,a.index,1,!0)),o.unshift(s)}if(o.length>0)e.session.selection=o}function xO(e,t,o="div"){let r=V(t);if(!r)return;let i=oe(e.doc.document,t);if(!i)return;let{index:s,parentPath:a}=r,l={children:[structuredClone(he(i))],tagName:o},c=$e(i);R(e.doc.document,a).children.splice(s,1,l),f({op:"replace",path:t}),Bi({forward:{index:s,node:$e(l),op:"set-child",parentPath:a},inverse:{index:s,node:c,op:"set-child",parentPath:a}}),e.session.selection=[[...a,"children",s]]}function Qc(e,t,o,r){let i=e.doc.document,s=At(t),a=hi(t);if(!s||!Z(a))return;let l=oe(i,s),c=oe(i,o);if(!l||!Array.isArray(l.children)||!c)return;if(l.children[a]===void 0)return;let d=r;if(l===c&&a<r)d-=1;let b={fromIndex:a,fromParentPath:s,op:"move-child",toIndex:d,toParentPath:o},y=nI(i,b),[h]=l.children.splice(a,1);if(vv(c).splice(d,0,h),f({fromPath:t,op:"move",toIndex:d,toParentPath:o}),Bi({forward:b,inverse:y}),$r(Me(e.session.selection),t)){let J=r;if(s.length===o.length&&s.every((E,F)=>E===o[F])&&a<r)J=r-1;e.session.selection=[[...o,"children",J]]}}function Ve(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;let s=i[o],a=$e(s);if(r===void 0||r===null||r==="")delete i[o];else i[o]=r;if(Bi(w(t,o,a,$e(i[o]))),o==="textContent")f({op:"set-text",path:t});else if(o==="style")f({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&rf(l);f({isEvent:c,key:o,op:"set-prop",path:t})}}function Gd(e,t,o,r){let i=R(e.doc.document,t),s=$e(i.style);if(!i.style)i.style={};if(r===void 0||r==="")delete i.style[o];else i.style[o]=r;if(Object.keys(i.style).length===0)delete i.style;Bi(w(t,"style",s,$e(i.style))),f({op:"set-style",path:t})}function Tr(e,t,o,r){let i=R(e.doc.document,t),s=$e(i.attributes);if(!i.attributes)i.attributes={};if(r===void 0||r==="")delete i.attributes[o];else i.attributes[o]=r;if(Object.keys(i.attributes).length===0)delete i.attributes;Bi(w(t,"attributes",s,$e(i.attributes))),f({attr:o,op:"set-attr",path:t})}function _O(e,t,o,r,i){if(!o)return Gd(e,t,r,i);let s=R(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=`@${o}`,c=rd(s.style,l);if(i===void 0||i===""){if(delete c[r],Object.keys(c).length===0)delete s.style[l]}else c[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(w(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function Nx(e,t,o,r,i){let s=R(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=rd(s.style,o);if(i===void 0||i===""){if(delete l[r],Object.keys(l).length===0)delete s.style[o]}else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(w(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function SO(e,t,o,r,i,s){let a=R(e.doc.document,t),l=$e(a.style);if(!a.style)a.style={};let c=`@${o}`,d=rd(a.style,c),b=rd(d,r);if(s===void 0||s===""){if(delete b[i],Object.keys(b).length===0)delete d[r];if(Object.keys(d).length===0)delete a.style[c]}else b[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(w(t,"style",l,$e(a.style))),f({op:"set-style",path:t})}function ft(e,t){let o=[e];for(let r of t){let i=Ni(o.at(-1),r);if(!i)break;o.push(i)}for(let r=o.length-2;r>=0;r--){let i=o[r],s=t[r],a=Ni(i,s);if(a&&Object.keys(a).length===0)delete i[s]}}function Ax(e,t,o,r,i){let s=R(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=s.style;for(let c of o)l=rd(l,c);if(i===void 0||i==="")delete l[r],ft(s.style,o);else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(w(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function CO(e,t,o,r,i,s){let a=R(e.doc.document,t),l=$e(a.style);if(!a.style)a.style={};let c=`@${o}`,d=rd(a.style,c),b=d;for(let y of r)b=rd(b,y);if(s===void 0||s===""){if(delete b[i],ft(d,r),Object.keys(d).length===0)delete a.style[c]}else b[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(w(t,"style",l,$e(a.style))),f({op:"set-style",path:t})}function kO(e,t,o){let r=R(e.doc.document,t),i=$e(r.style);if(o&&Object.keys(o).length>0)r.style=o;else delete r.style;Bi(w(t,"style",i,$e(r.style))),f({op:"set-style",path:t})}function Ia(e,t,o){let r=e.doc.document,i=$e(r.state);if(!r.state)r.state={};r.state[t]=o,Bi(w([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function Ox(e,t){let o=e.doc.document;if(o.state){let r=$e(o.state);if(delete o.state[t],Object.keys(o.state).length===0)delete o.state;Bi(w([],"state",r,$e(o.state))),f({key:"state",op:"doc-meta"})}}function Gr(e,t,o){let r=e.doc.document,i=$e(r.state);if(!r.state)r.state={};let s=r.state[t],a=s==null?{}:!S(s)||Array.isArray(s)?{default:s}:s;r.state[t]=a,Object.assign(a,o);for(let l of Object.keys(a))if(a[l]===void 0||a[l]===null)delete a[l];Bi(w([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function EO(e,t,o){let r=e.doc.document;if(!r.state||!r.state[t])return;let i=$e(r.state);r.state[o]=r.state[t],delete r.state[t],Bi(w([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function Vp(e,t,o,r){let i=R(e.doc.document,t),s=$e(i.$props);if(!i.$props)i.$props={};if(r===void 0||r===null||r==="")delete i.$props[o];else i.$props[o]=r;if(Object.keys(i.$props).length===0)delete i.$props;Bi(w(t,"$props",s,$e(i.$props))),f({op:"replace",path:t})}function TO(e,t,o,r){let i=R(e.doc.document,t),s=$e(i.cases);if(!i.cases)i.cases={};i.cases[o]=r||{tagName:"div",textContent:o},Bi(w(t,"cases",s,$e(i.cases))),f({op:"replace",path:t})}function LO(e,t,o){let r=R(e.doc.document,t);if(r.cases){let i=$e(r.cases);delete r.cases[o],Bi(w(t,"cases",i,$e(r.cases))),f({op:"replace",path:t})}}function $O(e,t,o,r){let i=R(e.doc.document,t);if(!i.cases||!i.cases[o])return;let s=$e(i.cases);i.cases[r]=i.cases[o],delete i.cases[o],Bi(w(t,"cases",s,$e(i.cases))),f({op:"replace",path:t})}function Kd(e,t,o){let r=e.doc.content.frontmatter,i=Object.hasOwn(r,t)?$e(r[t]):void 0,s=o===void 0||o===null||o==="";if(s)delete r[t];else r[t]=o;let a=s?void 0:$e(o);tt({after:a,before:i,field:t}),e.doc.dirty=!0}function we(e,t,o){if(o===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=o}function Am(e){let t=new Set,o=new Set;return bv(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function uO(e,t){if(!t)return e;return Re(e,"",t)}function Re(e,t,o){if(Array.isArray(e)){let i=null;for(let[s,a]of e.entries()){let l=Re(a,`${t}/${s}`,o);if(l!==a)i??=[...e],i[s]=l}return i??e}if(!v(e))return e;let r=null;for(let[i,s]of Object.entries(e)){let a=Re(s,`${t}/${Y$(i)}`,o);if(i==="children"&&Array.isArray(a)&&a.length===1){let[l]=a;if(Yo(l)&&(o.pointers.has(t)||o.fingerprints.has(JSON.stringify(l))))a=l}if(a!==s)r??={...e},r[i]=a}return r??e}var _C=["design","content","media","styles","publish"],wx="design",tv=[{icon:"frame-corners",id:"design",title:"Design"},{icon:"file-text",id:"content",title:"Content"},{icon:"image",id:"media",title:"Media"},{icon:"paint-brush",id:"styles",title:"Styles"},{icon:"paper-plane-tilt",id:"publish",title:"Publish"}];function N$(e){return typeof e==="string"&&_C.some((t)=>t===e)}function nv(e){return tv.find((t)=>t.id===e)}var Ae="workspace://",xx={content:"content-home",media:"media-home",publish:"publish-home"};function Wp(e){return Object.hasOwn(xx,e)}function Xl(e){return`${Ae}${e}`}function ll(e){if(!e.startsWith(Ae))return null;let t=e.slice(Ae.length);return N$(t)&&Wp(t)?t:null}function iv(e){let t=ll(e);return t?nv(t).title:null}var Tn=new Map([["design","canvas"],["edit","canvas"],["entry","entry"],["git-diff","diff"],["grid","grid"],["content-home","home"],["media-home","home"],["publish-home","home"],["media","media"],["preview","canvas"],["source","code"],["stylebook","config"],["tokens","tokens"]]),Dm={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",media:"Media",none:"None",tokens:"Variables"};function Qs(e){return Tn.get(e)??"canvas"}var vn=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function iO(e){return vn.get(e)??"design"}var _x=(e)=>e.editor.kind==="canvas",mh=(e)=>_x(e)&&e.selection.count>0,Sx=(e)=>mh(e)&&!e.selection.isRoot;function ov(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},workspace:{id:wx},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,publish:!1}}}function SC(e={}){let t=ov();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var On=["palette"],Pn=["caret","global"],Sn=["dock","global"],Cn=["canvas","global"],wn=["grid","global"],Rn=["code","global"],pt=["global"];function oO(e){if(e.modal.open)return On;if(e.caret.active)return Pn;if(e.focus.region!=="pane")return Sn;switch(e.editor.kind){case"grid":return wn;case"code":return Rn;case"canvas":return e.canvas.view==="preview"?pt:Cn;default:return pt}}var ln="project.json";function An(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:"page",elementTab:"properties",showLayout:!0,styleFilter:"",styleSections:{},dataRows:{},dataLimits:{},styleShorthands:{},zoom:1}}var Jn=["edit","design","preview","source","stylebook","git-diff"];function sv({id:e,documentPath:t=null,fileHandle:o=null,document:r,frontmatter:i,sourceFormat:s=null,capabilities:a,openedFrom:l=null,preview:c=!1,layout:d=null,source:b=null,canvasMode:y}){let h=ge(),J=Am(r),E=a?.modes??In(t,s),F=y??E.find((T)=>T!=="preview")??"edit",ce=E[0]==="preview",j={bareRepeaters:J,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:d,mode:kn(t,s),source:b,sourceFormat:s},ue={index:0,snapshots:[{document:structuredClone(r),selection:[]}]},H={canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:l,selection:[],ui:An(F,ce)};return h.run(()=>({capabilities:{modes:E},doc:g(j),documentPath:t,fileHandle:o,history:g(ue),id:e,pinned:!1,preview:c,scope:h,session:g(H)}))}function In(e,t){if(e===ln)return["stylebook","tokens","source"];let o=Wi(t)??cn(e);if(o)return o.studio?.modes??["edit","design","preview","source"];return Jn}function kn(e,t){let o=Wi(t)??cn(e);if(o)return o.studio?.documentMode?.default??"content";return"component"}function TC(e){return Qs(e.session.ui.canvasMode)}function O$(e){let t=[];for(let o of e.capabilities.modes){if(o==="preview")continue;let r=Qs(o);if(!t.includes(r))t.push(r)}return t}function hO(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&Qs(o)===t)}function Om(e){e.scope.stop()}var mt=new WeakMap,B=new Map;function Ln(e){let t=he(e),o=mt.get(t);if(!o)o=g({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),mt.set(t,o);return o}function gt(e){B.set(e,(B.get(e)??0)+1)}function bt(e){let t=B.get(e)??0;if(t<=1)B.delete(e);else B.set(e,t-1)}function lv(e){return B.has(e.replaceAll("\\","/"))}var Dn=8000,jn=800,En=2500,yt=null;function Mn(){return yt??=(le("f0jn7nnp"),import("./index-f0jn7nnp.js")),yt}function xt(){try{return p()}catch{return null}}var K=null;function OO(e){K=e}var Ie=null;function MO(e){Ie=e}var Tt=()=>{};function PO(e){Tt=e??(()=>{})}var ke=new WeakMap;function vt(e){return he(e)}function De(e,t){return e.frontmatterMap(t)}function Nn(e){return e.synced}function D(e){return ke.get(vt(e))}function Ne(e){let t=vt(e),o=ke.get(t);if(!o)o={attaching:null,generation:0,optedOut:g({value:!1}),session:null,watcherInstalled:!1},ke.set(t,o);return o}var ht=!1;function $n(){if(ht)return;ht=!0,it(_n),ct(Wn),at((e)=>{if(D(e)?.session?.synced&&Ln(e).sourceCanonical)return Tt("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function _n(e,t,o){let r=D(e)?.session;if(!r||!r.synced)return;if(r.lastSeenRef=he(e.doc.document),o==="remote"){fe(r);return}if(r.canWrite)Bn(r,t),fe(r)}function Wn(e){let t=D(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:o,batchNeedsDiff:r}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),r)re(t);else if(o.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,o,t.collab.LOCAL_ORIGIN)}catch{re(t)}t.undoManager?.stopCapturing()}function Bn(e,t){let o=t.docOps.map((r)=>r.forward);if(LC()){if(e.batchOps??=[],o.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...o);return}if(o.length===0){re(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,o,e.collab.LOCAL_ORIGIN)}catch{re(e)}}function re(e){let{collab:t,handle:o,tab:r}=e,i=t.yDocToJson(o.doc),s=Jo(he(r.doc.document)),a=t.diffDocs(i,s);if(a===null)t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN);else if(a.length>0)try{t.applyDocOpsToY(o.doc,a,t.LOCAL_ORIGIN)}catch{t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN)}}function Je(e){let t=e.collab.yDocToJson(e.handle.doc);Y(e.tab,(o)=>{let r=o.doc.document;for(let i of Object.keys(r))if(!(i in t))delete r[i];Object.assign(r,t)},{origin:"remote",skipHistory:!0})}function Kn(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,o=t.clientID;for(let[r,i]of t.getStates())if(i.canWrite!==!1&&r<o)o=r;return o===e.handle.awareness.clientID}function fe(e){if(!K||!Kn(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=En){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,je(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),je(e)},jn)}async function je(e){if(!K||!e.synced)return;try{let t=await K(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function Ot(e){if(!Ie||!e.synced||!e.canWrite)return;let{collab:t,handle:o,tab:r}=e,i=t.canonicalRevOf(o.doc),s=t.sourceText(o.doc).toString(),a;try{a=await Ie(r,s)}catch{return}if(!Nn(e)||t.canonicalRevOf(o.doc)!==i)return;let l=t.diffDocs(t.yDocToJson(o.doc),a.document);if(l===null)t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN);else if(l.length>0)try{t.applyDocOpsToY(o.doc,l,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN)}let c=De(t,o.doc),d=a.frontmatter??{};o.doc.transact(()=>{let b=[...c.keys()];for(let y of b)if(!(y in d))c.delete(y);for(let[y,h]of Object.entries(d))if(!t.deepEqual(c.get(y),h))c.set(y,h)},t.MIRROR_ORIGIN)}function FO(e){let t=D(e)?.session;if(!t?.synced)return null;let{collab:o,handle:r}=t,i=null,s=()=>i!==null&&t.sourceLockOwner===i;return{awareness:r.awareness,enter:async()=>{i={},t.sourceLockOwner=i;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"source"});if(!t.canWrite)return;let l=null;if(K)try{l=await K(e)}catch{l=null}if(!s())return;o.acquireSourceCanonical(r.doc,l??o.sourceText(r.doc).toString(),o.LOCAL_ORIGIN)},leave:()=>{if(!s()){i=null;return}i=null,t.sourceLockOwner=null;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"structure"});if(!t.canWrite)return;if(o.otherSourceEditors(r.awareness,t.path,r.awareness.clientID).filter((c)=>r.awareness.getStates().get(c)?.canWrite!==!1).length===0)Ot(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function hv(e){let t=Ln(e);return t.active&&t.readOnly}async function H$(e){let t=D(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await je(t),await t.handle.flush(),!0}async function jO(){for(let e of Ee)if(D(e)?.session?.synced)await H$(e)}var Ee=new Set;function ie(e){if(!xt()?.collab||!e.documentPath||e.documentPath===ln)return;let o=Ne(e);if(o.watcherInstalled)return;o.watcherInstalled=!0,$n(),Ee.add(e),e.scope.run(()=>{ne(()=>{if(o.optedOut.value)pe(e);else Le(e)}),ta(()=>{Ee.delete(e),pe(e)})})}function B$(e,t){let o=Ne(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function z$(e){return D(e)?.optedOut.value!==!0}function Pt(e){if(!D(e)?.watcherInstalled){ie(e);return}pe(e),Le(e)}async function Le(e){let t=Ne(e);if(t.session||t.attaching)return;let{documentPath:o}=e,r=xt();if(!o||!r?.collab){Ln(e).status="unavailable";return}let{generation:i}=t,s=Ln(e);s.status="connecting",s.attachError="";let a=(async()=>{try{let[l,c]=await Promise.all([Mn(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let d,b=new Promise((y,h)=>{d=setTimeout(()=>h(Error("collab-sync-timeout")),Dn)});try{await Promise.race([c.whenSynced,b])}finally{clearTimeout(d)}if(t.generation!==i){c.destroy();return}t.session=Hn(e,o,l,c),s.active=!0,s.status="synced",s.readOnly=!t.session.canWrite,s.attachError="",gt(o)}catch(l){s.status="failed",s.active=!1,s.attachError=l instanceof Error?l.message:String(l),C.warn(`Live collaboration is not available for "${o}" — ${s.attachError}`,{key:`collab:${o}`,path:o,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=a,await a}function pe(e){let t=D(e);if(!t)return;t.generation+=1;let{session:o}=t;t.session=null;let r=Ln(e);if(r.active=!1,r.status="detached",r.attachError="",r.peers=[],!o)return;if(bt(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}av(e,null),e.history.snapshots=[{document:Jo(he(e.doc.document)),selection:ea(e.session.selection)}],e.history.index=0,o.undoManager?.destroy(),o.handle.destroy()}function Hn(e,t,o,r){let i=r.identity(),s={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:i?i.permission!=="read":!0,collab:o,disposers:[],handle:r,lastSeenRef:he(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(o.metaMap(r.doc).get("structureSeeded")===!0){let T=o.yDocToJson(r.doc),O=Jo(he(e.doc.document));if(!o.deepEqual(T,O)){let I=o.diffDocs(O,T);if(I===null)s.synced=!0,Je(s),s.synced=!1;else if(I.length>0)Pe(e,I)}s.applyingRemoteFrontmatter=!0;let P=De(o,r.doc);for(let[I,N]of P.entries())e.doc.content.frontmatter[I]=N;s.applyingRemoteFrontmatter=!1}else if(s.canWrite)o.seedStructure(r.doc,Jo(he(e.doc.document)),{frontmatter:Jo(he(e.doc.content.frontmatter)),origin:o.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});s.lastSeenRef=he(e.doc.document),s.disposers.push(r.onDirty((T)=>{e.doc.dirty=T})),r.awareness.setLocalState({canWrite:s.canWrite,focusedPath:t,structuralSelection:null,user:i?{avatarUrl:i.avatarUrl,color:i.color,login:i.login,name:i.name}:{color:o.colorForKey(String(r.awareness.clientID)),login:`guest-${r.awareness.clientID%1000}`}});let l=new o.UndoManager([o.structureMap(r.doc),o.frontmatterMap(r.doc)],{trackedOrigins:new Set([o.LOCAL_ORIGIN])});s.undoManager=l;let c=({stackItem:T})=>{T.meta.set("selection",ea(e.session.selection))},d=({stackItem:T})=>{let O=T.meta.get("selection");e.session.selection=ea(O??[])};l.on("stack-item-added",c),l.on("stack-item-popped",d),s.disposers.push(()=>{l.off("stack-item-added",c),l.off("stack-item-popped",d)}),av(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let b=o.structureMap(r.doc),y=(T,O)=>{if(O.origin===o.LOCAL_ORIGIN||!s.synced)return;let P=o.yEventsToDocOps(T);if(P===null){Je(s);return}if(P.length===0)return;try{Pe(e,P)}catch{Je(s)}};b.observeDeep(y),s.disposers.push(()=>b.unobserveDeep(y));let h=Ln(e);h.sourceCanonical=o.canonicalOf(r.doc)==="source";let J=o.metaMap(r.doc),E=()=>{h.sourceCanonical=o.canonicalOf(r.doc)==="source"};J.observe(E),s.disposers.push(()=>J.unobserve(E));let F=o.sourceText(r.doc),ce=(T,O)=>{if(O.origin===o.MIRROR_ORIGIN||!s.synced)return;if(o.canonicalOf(r.doc)!=="source")return;if(!o.isSourceReconciler(r.awareness,s.path))return;if(s.sourceParseTimer)clearTimeout(s.sourceParseTimer);s.sourceParseTimer=setTimeout(()=>{s.sourceParseTimer=null,Ot(s)},600)};F.observe(ce),s.disposers.push(()=>F.unobserve(ce));let j=De(o,r.doc),ue=(T,O)=>{if(O.origin===o.LOCAL_ORIGIN||!s.synced)return;s.applyingRemoteFrontmatter=!0;try{for(let[P,I]of T.changes.keys)if(I.action==="delete")delete e.doc.content.frontmatter[P];else e.doc.content.frontmatter[P]=j.get(P)}finally{s.applyingRemoteFrontmatter=!1}};j.observe(ue),s.disposers.push(()=>j.unobserve(ue)),e.scope.run(()=>{let T=JSON.stringify(e.doc.content.frontmatter);ne(()=>{let O=JSON.stringify(e.doc.content.frontmatter);if(O===T)return;if(T=O,s.applyingRemoteFrontmatter||!s.synced||!s.canWrite)return;let P=JSON.parse(O);r.doc.transact(()=>{let I=[...j.keys()];for(let N of I)if(!(N in P))j.delete(N);for(let[N,Be]of Object.entries(P))if(!o.deepEqual(j.get(N),Be))j.set(N,Be)},o.LOCAL_ORIGIN),fe(s)}),ne(()=>{let O=e.session.selection.length>0?ea(e.session.selection):null,P=r.awareness.getLocalState();if(P)r.awareness.setLocalState({...P,structuralSelection:O})}),ne(()=>{let O=he(e.doc.document);queueMicrotask(()=>{if(D(e)?.session!==s||!s.synced||!s.canWrite)return;let I=he(e.doc.document);if(I!==O||I===s.lastSeenRef)return;s.lastSeenRef=I,re(s),fe(s)})})});let H=Ln(e),de=()=>{let T=[];for(let[O,P]of r.awareness.getStates())if(O!==r.awareness.clientID&&P.user)T.push({clientId:O,state:P});H.peers=T};return de(),r.awareness.on("change",de),s.disposers.push(()=>r.awareness.off("change",de),r.onStatus((T)=>{if(T==="offline"||T==="connecting")H.status="offline";else if(s.synced)H.status="synced"}),r.onReset(()=>{pe(e),Le(e)})),s.synced=!0,s}function k(e,t,o){return RangeError(`command "${e}" argument "${t}": ${o}`)}function Gn(e){if(Z(e))return"number";if(Xe(e))return"boolean";return n(e)?"string":"object"}function A(e){if(e===void 0)return"missing";return n(e)?`"${e}"`:`${Gn(e)} ${JSON.stringify(e)}`}function wt(e){return Array.isArray(e)&&e.every((t)=>n(t)||Z(t))}function St(e,t,o){let r=t[o];if(!n(r)||r==="")throw k(e,o,`expected a non-empty string, got ${A(r)}`);return r}function Xn(e,t,o){if(t[o]===void 0)return;return St(e,t,o)}function Rt(e,t,o){let r=t[o];if(!Z(r)||!Number.isFinite(r))throw k(e,o,`expected a finite number, got ${A(r)}`);return r}function Ct(e,t,o){let r=t[o];if(!Z(r)||!Number.isInteger(r))throw k(e,o,`expected an integer, got ${A(r)}`);return r}function Mx(e,t,o,r,i){let s=Rt(e,t,o);if(s<r||s>i)throw k(e,o,`${s} is outside the supported range ${r}–${i}`);return s}function zi(e,t,o){let r=t[o];if(!Xe(r))throw k(e,o,`expected a boolean, got ${A(r)}`);return r}function Vn(e,t,o,r){let i=t[o],s=n(i)?r.find((a)=>a===i):void 0;if(s===void 0)throw k(e,o,`${A(i)} is not declared — declared: ${r.join(", ")||"none"}`);return s}function IC(e,t,o){let r=t[o];if(!wt(r))throw k(e,o,`expected an array of path segments (strings or numbers), got ${A(r)}`);return r}function IO(e,t,o){if(t[o]===null)return null;return IC(e,t,o)}function F$(e,t,o){let r=t[o];if(!Array.isArray(r))throw k(e,o,`expected an array of document paths, got ${A(r)}`);return r.map((i,s)=>{if(!wt(i))throw k(e,o,`entry ${s} is not a document path — expected an array of segments, got ${A(i)}`);return i})}function Se(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function di(e,t){return{description:t,enum:[...e],type:"string"}}function cl(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function j$(e,t={}){return{description:e,type:"number",...t}}function $o(e){return{description:e,type:"boolean"}}function Px(e,t=!1){let o={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[o,{type:"null"}]}:{description:e,...o}}function RO(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function We(e){return{description:e,type:"string"}}function zn(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Fe(e){return n(e)?[e]:e}function Jt(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 o=t.items?.type;if(Array.isArray(o))return zn(o)?"path":"pass-through";return o==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function It(e,t){switch(e){case"null":return t===null;case"boolean":return Xe(t);case"string":return n(t);case"number":return Z(t)&&Number.isFinite(t);case"integer":return Z(t)&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return S(t)&&!Array.isArray(t);default:break}return!1}function kt(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function Yn(e,t,o,r){let i=t[o];if(i===void 0||!r.some((s)=>It(s,i)))throw k(e,o,`expected ${kt(r)}, got ${A(i)}`);return i}function Dt(e){switch(Jt(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>A(t)).join(" | ")}`;case"const":return`the constant ${A(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>Dt(t)).join(" or ");case"typed":return kt(Fe(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 qn(e,t,o,r){let i=t[o],s=[];for(let a of r){if(a.type!==void 0&&!Fe(a.type).some((l)=>It(l,i)))continue;try{return jt(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw k(e,o,`expected ${r.map((a)=>Dt(a)).join(" or ")}, got ${A(i)}`)}function jt(e,t,o,r){switch(Jt(r)){case"enum":return Vn(e,t,o,r.enum??[]);case"const":{let i=t[o];if(i!==r.const)throw k(e,o,`expected the constant ${A(r.const)}, got ${A(i)}`);return i}case"one-of":return qn(e,t,o,r.oneOf??[]);case"typed":return Yn(e,t,o,Fe(r.type??[]));case"boolean":return zi(e,t,o);case"bounded-number":{if(r.type==="integer")Ct(e,t,o);return Mx(e,t,o,r.minimum,r.maximum)}case"number":return Rt(e,t,o);case"integer":return Ct(e,t,o);case"string":return St(e,t,o);case"path":return IC(e,t,o);case"path-list":return F$(e,t,o);default:return t[o]}}function DO(e,t,o){let r=t,i=r.properties??{},s=Object.keys(i),a=r.required??[],l={};for(let[c,d]of Object.entries(o)){if(d===void 0||Object.hasOwn(i,c))continue;if(r.additionalProperties===!1)throw k(e,c,`not declared — declared: ${s.join(", ")||"none"}`);l[c]=d}for(let c of s){if(o[c]===void 0&&!a.includes(c))continue;l[c]=jt(e,o,c,i[c])}return l}var Zn=20,ui="primary",jm="secondary",W$=2,m=g({activePaneId:ui,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:ui,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Kr();return e.derived?.kind==="lens"?fn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Kr().tabOrder}}),u=Th(()=>m.activeTabId?m.tabs.get(m.activeTabId)??null:null);function Kr(){let{panes:e}=m;return e.find((t)=>t.id===m.activePaneId)??e[0]}function fn(e){return m.panes.find((t)=>t.id===e)}function Ql(e){return m.panes.find((t)=>t.tabOrder.includes(e))}function Lr(e){let t=fn(e);if(!t||t.id===m.activePaneId)return;m.activePaneId=t.id,M();let{activeTabId:o}=t;if(o){_e(o);let r=m.tabs.get(o);if(r)Ft(r)}}function Hm(e){return m.activePaneId===e}function DC(e){let t=e??Kr().activeTabId,o=t?m.tabs.get(t):null;if(!t||!o)return null;let r=Ql(t);if(!r)return null;let i=ec(r.id);return Wm(t),wh(i,t),i.activeTabId=t,m.activePaneId=i.id,M(),_e(t),i}function NC(e){return m.panes.find((t)=>t.id!==e)??Qn(jm)}function ec(e){let t=NC(e);if(t.derived)t.derived=null;return t}function Qn(e){let t=fn(e);if(t)return t;return m.panes=[...m.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],fn(e)}function Bm(e){if(m.panes.length<2)return;let t=e===ui?m.panes.find((s)=>s.id!==ui)?.id:e,o=t===void 0?void 0:fn(t),r=m.panes.find((s)=>s.id!==t);if(!o||!r)return;for(let s of o.tabOrder)wh(r,s);let i=o.activeTabId!==null&&U(o.activeTabId)?o.activeTabId:null;if(r.activeTabId=m.activePaneId===o.id?i??r.activeTabId??o.activeTabId:r.activeTabId??o.activeTabId,m.activePaneId=r.id,r.derived?.sourcePaneId===o.id)r.derived=null;m.panes=m.panes.filter((s)=>s.id!==o.id),M()}function zm(e){return e.tabOrder.length===0&&e.derived===null}var U=()=>!0;function AC(e){U=e??(()=>!0)}var Nt=null;function OC(e){Nt=e}var $t=null;function MC(e){$t=e}function eo(){let e=0;for(let t of m.tabs.keys())if(U(t))e+=1;return e}function Lt(e){return e.tabOrder.findLast((t)=>U(t))??null}function Wm(e){let t=[];for(let o of m.panes){if(!o.tabOrder.includes(e))continue;if(o.tabOrder=o.tabOrder.filter((r)=>r!==e),o.activeTabId===e)o.activeTabId=Lt(o);if(o.id!==ui&&zm(o))t.push(o.id)}for(let o of t)Bm(o)}function wh(e,t,o){if(e.tabOrder.includes(t))return;let r=o??no(e,t);e.tabOrder=[...e.tabOrder.slice(0,r),t,...e.tabOrder.slice(r)]}function to(e){let t=0;for(let o of e.tabOrder){if(m.tabs.get(o)?.pinned!==!0)break;t+=1}return t}function no(e,t){return m.tabs.get(t)?.pinned===!0?to(e):e.tabOrder.length}function tc(e,t=null){if(m.projectRoot&&e!==m.projectRoot)EC();m.projectRoot=e,m.projectConfig=t}function Up(e){let t=u.value;return e!==null&&t!==null&&he(t)===he(e)}function Yd(e){if(!e)return!1;let t=m.tabs.get(e.id);return t!==void 0&&he(t)===he(e)}function _e(e){m.mruOrder=[e,...m.mruOrder.filter((t)=>t!==e)]}var me=null,se=0;function M(){me=null,se=0}function Ft(e){if(x&&e.documentPath)x.selectedPath=e.documentPath}function PC(e){let t=fn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=m.tabs.get(e),r=Ql(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(m.activePaneId=r.id,!t.cycling)M(),_e(e);Ft(o)}function _i(e){if(e.background===!0){let a=m.tabs.get(e.id);if(a)return a;let l=sv({...e,preview:!1}),c=(e.paneId===void 0?void 0:fn(e.paneId))??Kr();return wh(c,l.id),m.tabs.set(l.id,l),l}let t=m.tabs.get(e.id),o=e.preview===!0&&t?.pinned!==!0,r=sv({...e,preview:o}),i=(e.paneId===void 0?void 0:fn(e.paneId))??Kr(),s;if(t)r.pinned=t.pinned,Om(t);else{if(o){let l=Et(i),c=l?m.tabs.get(l):null;if(c)Qd(c);FC()}let a=o?Et(i):null;if(a)s=i.tabOrder.indexOf(a),Zd(a);wh(i,r.id,s)}return m.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Et(e){return e.tabOrder.find((t)=>m.tabs.get(t)?.preview===!0)??null}function td(e){let t=m.tabs.get(e);if(t?.preview===!0)t.preview=!1}function FC(){for(let[e,t]of m.tabs)if(t.preview&&t.doc.dirty)td(e)}function Bx(e,t){let o=m.tabs.get(e),r=Ql(e);if(!o||!r)return;if(o.pinned=t,t)o.preview=!1;let i=r.tabOrder.filter((a)=>a!==e),s=i.filter((a)=>m.tabs.get(a)?.pinned===!0).length;r.tabOrder=[...i.slice(0,s),e,...i.slice(s)]}function V$(e,t){let o=m.tabs.get(e),r=Ql(e);if(!o||!r)return;r.tabOrder=_t(r,e,t)}function _t(e,t,o){let r=m.tabs.get(t);if(!r)return e.tabOrder;let i=e.tabOrder.filter((d)=>d!==t),s=i.filter((d)=>m.tabs.get(d)?.pinned===!0).length,a=r.pinned?0:s,l=r.pinned?s:i.length,c=Math.min(Math.max(o,a),l);return[...i.slice(0,c),t,...i.slice(c)]}function Zd(e){let t=m.tabs.get(e);if(!t)return;let o=Ql(e),r=o?.activeTabId===e;if(oo(t),Om(t),m.tabs.delete(e),Cx(e),Wm(e),m.mruOrder=m.mruOrder.filter((l)=>l!==e),M(),o&&zm(o))Bm(o.id);if(!r)return;let i=Kr(),s=$t?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??m.mruOrder.find((l)=>i.tabOrder.includes(l)&&U(l))??Lt(i);if(a)ae(a);else Nt?.(i.id)}function U$(){let e=[...m.tabs.values()];m.tabs.clear(),Wt(),m.mruOrder=[],M();for(let t of e)Om(t)}function Wt(){m.panes=[{activeTabId:null,derived:null,id:ui,tabOrder:[]}],m.activePaneId=ui}function oo(e){if(!e.documentPath)return;let t=e.documentPath;m.closedTabs=[{documentPath:t},...m.closedTabs.filter((o)=>o.documentPath!==t)].slice(0,Zn)}function ro(){let[e]=m.closedTabs;if(!e)return;return m.closedTabs=m.closedTabs.slice(1),e.documentPath}function Mt(e){if(!me)me=m.mruOrder.filter((r)=>m.tabs.has(r)&&U(r)),se=0;let t=me;if(t.length<2)return;se=((se+e)%t.length+t.length)%t.length;let o=t[se];return ae(o,{cycling:!0}),o}function q$(e){let t=[...m.tabs.keys()],o=[...m.tabs.values()],r=sv(e);m.tabs.set(r.id,r),Wt(),m.panes[0].tabOrder=[r.id],m.mruOrder=[],M(),ae(r.id),ie(r);for(let i of t){if(i===r.id)continue;m.tabs.delete(i)}for(let i of o)Om(i);return r}function Bt(e,t={}){ae(e,t)}function pv(e,t,o){let r=fn(t);if(!r||!m.tabs.has(e))return null;if(r.tabOrder.includes(e)){if(o!==void 0)r.tabOrder=_t(r,e,o);return r}return Wm(e),wh(r,e,o),r}function zx(e,t,o){let r=m.tabs.get(e);if(!r)return;if(r.id=t,r.documentPath=o,CC(e))Cx(e),Nm(t);m.tabs.delete(e),m.tabs.set(t,r);for(let i of m.panes)if(i.tabOrder=i.tabOrder.map((s)=>s===e?t:s),i.activeTabId===e)i.activeTabId=t;m.mruOrder=m.mruOrder.map((i)=>i===e?t:i),M(),Pt(r)}function G$(e,t){e.registerAll([...io(t),...so(t)])}function io(e){let t=()=>eo()>1;return[{id:"document.nextTab",title:"Next Tab",category:"Document",level:"document",keybinding:["ctrl+tab","mod+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Mt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Mt(-1)}},{args:Se({path:We('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:(o)=>o.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:o,args:r})=>{let i=St("document.open",r,"path"),s=u.value?.documentPath??null;if(s!==i)return`Opened "${i}", but the active document is ${s===null?"none":`"${s}"`}.`;let a=o.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${Dm[o.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${i}" is the active document, ${a}.`}},run:async(o,r)=>{let i=St("document.open",r,"path");if(await e.openFile(i),![...m.tabs.values()].some((s)=>s.documentPath===i))throw RangeError(`command "document.open" argument "path": "${i}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:Se({file:We('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:(o)=>o.project.open,requires:"an open project",undo:"none",run:async(o,r)=>{let i=St("document.openToSide",r,"file"),s=ec(Kr().id);if(await e.openFile(i,{paneId:s.id}),![...m.tabs.values()].some((a)=>a.documentPath===i)){if(zm(s)&&s.id!==ui)Bm(s.id);throw RangeError(`command "document.openToSide" argument "file": "${i}" 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:()=>m.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let o=ro();if(o)await e.openFile(o)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:()=>{let o=m.activeTabId,r=o?m.tabs.get(o):null;if(o&&r)Bx(o,!r.pinned)}},{args:Se({pinned:$o("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:(o)=>o.document.open,requires:"an open document",run:(o,r)=>{let i=m.activeTabId;if(i&&m.tabs.get(i))Bx(i,zi("document.setPinned",r,"pinned"))}},{id:"document.keepOpen",title:"Keep Document Open",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,enablement:()=>{let o=m.activeTabId;return o!==null&&m.tabs.get(o)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let o=m.activeTabId;if(o)td(o)}}]}function so(e){let t=()=>m.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:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{DC()}},{args:Se({path:We("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:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:async(o,r)=>{let i=St("pane.compareWith",r,"path"),s=Kr();if((s.activeTabId?m.tabs.get(s.activeTabId):null)?.documentPath===i)throw RangeError(`command "pane.compareWith" argument "path": "${i}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(ec(s.id).id,i)}},{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:()=>{Lr(ui)}},{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:()=>{Lr(jm)}},{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:ao}]}function ao(){let e=m.panes.find((t)=>t.derived!==null);if(e?.id===ui){if(e.derived=null,!zm(e))return}Bm(e?.id??jm)}
|
|
2
|
-
export{xC,Fn,vx,Qb,Vt,Qt,Hi,yx,ev,Xc,nO,_C,wx,tv,N$,nv,xx,Wp,Xl,ll,iv,Dm,Qs,iO,_x,mh,Sx,ov,SC,oO,Nm,Cx,CC,rv,ho,bo,kx,gh,Ex,rO,A$,sO,aO,lO,kC,cO,EC,dO,Am,uO,ln,sv,TC,O$,hO,Om,Me,pO,Tx,ea,Lx,fO,Mm,$x,mO,Pm,gO,Bi,Y,qd,Ix,Rx,LC,bO,av,vO,yO,$C,wO,Lo,bh,M$,Fm,Dx,xO,Qc,Ve,Gd,Tr,_O,Nx,SO,Ax,CO,kO,Ia,Ox,Gr,EO,Vp,TO,LO,$O,Kd,Ln,lv,P$,cv,dv,St,Xn,Mx,zi,Vn,IC,IO,F$,Se,di,cl,j$,$o,Px,RO,We,DO,Jd,Un,ed,Fx,jx,RC,NO,Ra,vh,yh,uv,Hx,AO,Jo,OO,MO,PO,FO,hv,H$,jO,B$,z$,ui,jm,W$,m,u,Kr,fn,Ql,Lr,Hm,DC,NC,ec,Bm,zm,AC,OC,MC,Wm,wh,tc,Up,Yd,PC,_i,td,FC,Bx,V$,Zd,U$,q$,Bt,pv,zx,G$};
|
|
3
|
-
|
|
4
|
-
//# debugId=505DA9B0E78C771F64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-c05wdnt3.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{Q}from"./studio-nqxqf8p2.js";import{p}from"./studio-w4rz9hdk.js";import{ge,ne,Jr,Yr,g,he,tM,C}from"./studio-43sd2mam.js";import{Fn,vx,Qt,Hi,_C,wx,tv,N$,ln,sv,Om,Y,zi,Vn,Se,di,$o,ui,jm,m,Lr,tc,Bt}from"./studio-c05wdnt3.js";import{tf}from"./studio-z97c48fk.js";import{pt,Go,Cr}from"./studio-s32578pn.js";import{x,id,wn}from"./studio-gcxk20n7.js";import{n,Z,Xe,Lv,te,S,v}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";function F(e){return e.replaceAll("~","~0").replaceAll("/","~1")}var Ue=100;function H(e){let t={blankAfter:new Set,escaped:new Map,inline:new Map},o=0,r=()=>{let l=0;while(o<e.length&&(e[o]===" "||e[o]==="\t"||e[o]==="\r"||e[o]===`
|
|
2
|
-
`)){if(e[o]===`
|
|
3
|
-
`)l+=1;o+=1}return l},s=()=>{let l=o,u=new Set;o+=1;while(o<e.length&&e[o]!=='"')if(e[o]==="\\")if(e[o+1]==="u"){let d=Number.parseInt(e.slice(o+2,o+6),16);if(d>=128)u.add(d);o+=6}else o+=2;else o+=1;return o+=1,{escaped:u,raw:e.slice(l,o)}},i=(l,u)=>{let d=r();if(e[o]===u)return o+=1,!0;if(o+=1,d+=r(),d>=2)t.blankAfter.add(l);return!1},a=(l)=>{r();let u=e[o];if(u==="{"){o+=1;let d=r()>0;if(e[o]==="}"){o+=1;return}t.inline.set(l,!d);while(o<e.length){let c=JSON.parse(s().raw);r(),o+=1;let f=`${l}/${F(c)}`;if(a(f),i(f,"}"))return}}else if(u==="["){if(o+=1,r(),e[o]==="]"){o+=1;return}for(let d=0;o<e.length;d+=1){let c=`${l}/${d}`;if(a(c),i(c,"]"))return}}else if(u==='"'){let{escaped:d}=s();if(d.size>0)t.escaped.set(l,d)}else while(o<e.length&&!`,]} \r
|
|
4
|
-
`.includes(e[o]))o+=1};return a(""),t}function Es(e){return{document:JSON.parse(e),layout:H(e)}}var Ve=/[^\u0020-\u007E]/,He=/^[\p{Mn}\p{Me}\p{Cf}]$/u,Ge=/^\p{Emoji_Presentation}$/u;function Ke(e){return e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=12871&&e!==12351||e>=12880&&e<=19903||e>=19968&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=110592&&e<=110593||e>=127488&&e<=127569||e>=131072&&e<=262141)}function de(e){if(!Ve.test(e))return e.length;let t=0;for(let o of e){if(He.test(o))continue;t+=Ke(o.codePointAt(0))||Ge.test(o)?2:1}return t}function me(e){return e===void 0||te(e)||Lv(e)}function U(e){return Object.entries(e).filter(([,t])=>!me(t))}function M(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ze(e){if(e.length<2)return!1;let t=Array.isArray(e[0])?"array":M(e[0])?"object":null;if(t===null)return!1;return e.every((o)=>t==="array"?Array.isArray(o)&&o.length>1:M(o)&&U(o).length>1)}function qe(e){return e.length>1&&e.every((t)=>Z(t))}function V(e,t){let o=me(e)?"null":JSON.stringify(e);return t===void 0?o:o.replaceAll(/[\u0080-\uFFFF]/g,(r)=>{let s=r.codePointAt(0);return t.has(s)?`\\u${s.toString(16).padStart(4,"0")}`:r})}function ko(e,t,o=Ue){let r=t?.inline??new Map,s=t?.blankAfter??new Set,i=t?.escaped??new Map,a=(c,f)=>r.get(c)??f,l=(c,f,b)=>{if(Array.isArray(c)){if(c.length===0)return"[]";if(Ze(c))return null;let y=[];for(let[P,T]of c.entries()){let k=`${f}/${P}`,w=s.has(k)?null:l(T,k,b);if(w===null)return null;y.push(w)}return`[${y.join(", ")}]`}if(M(c)){let y=U(c);if(y.length===0)return"{}";if(!a(f,b))return null;let P=[];for(let[T,k]of y){let w=`${f}/${F(T)}`,E=s.has(w)?null:l(k,w,!0);if(E===null)return null;P.push(`${JSON.stringify(T)}: ${E}`)}return`{ ${P.join(", ")} }`}return V(c,i.get(f))},u=(c)=>c.map(({path:f,text:b},y)=>y===c.length-1?b:`${b},
|
|
5
|
-
${s.has(f)?`
|
|
6
|
-
`:""}`).join(""),d=(c,f,b,y,P,T)=>{if(!Array.isArray(c)&&!M(c))return V(c,i.get(f));let k=l(c,f,P);if(k!==null&&y+de(k)+T<=o)return k;let w=" ".repeat(b+2),E=`
|
|
7
|
-
${" ".repeat(b)}`;if(Array.isArray(c)){if(qe(c))return`[
|
|
8
|
-
${Ye(c,w,o,(A)=>s.has(`${f}/${A}`))}${E}]`;let L=c.map((R,A)=>{let O=`${f}/${A}`,J=A===c.length-1,z=d(R,O,b+2,w.length,P,J?0:1);return{path:O,text:`${w}${z}`}});return`[
|
|
9
|
-
${u(L)}${E}]`}let pe=U(c),Be=a(f,P),We=pe.map(([L,R],A)=>{let O=`${f}/${F(L)}`,J=`${JSON.stringify(L)}: `,z=A===pe.length-1,ze=w.length+de(J),Fe=d(R,O,b+2,ze,Be,z?0:1);return{path:O,text:`${w}${J}${Fe}`}});return`{
|
|
10
|
-
${u(We)}${E}}`};return`${d(e,"",0,0,!1,0)}
|
|
11
|
-
`}function Ye(e,t,o,r){let s=[],i="";for(let[a,l]of e.entries()){let u=`${V(l)}${a===e.length-1?"":","}`;if(i==="")i=`${t}${u}`;else if(i.length+1+u.length<=o)i=`${i} ${u}`;else s.push(i),i=`${t}${u}`;if(r(a)&&a<e.length-1)s.push(i,""),i=""}return s.push(i),s.join(`
|
|
12
|
-
`)}function wm(e){return ko(e,we())}var I=null,j=null,N=null,_=null;function we(){return ve()?.doc.layout??_}var G=null;function ve(){let e=m.tabs.get(ln);return e?he(e):null}function Qe(){if(j)Om(j),j=null;I=null,N=null,_=null,G=null}function xe(){return G??=(async()=>{try{let e=await p().readFile(ln),{document:t,layout:o}=Es(e);_=o,N=ko(t,we())}catch{N=null}})(),G}async function WL(e){if(await xe(),e.doc.layout===null&&_!==null)e.doc.layout=_}function et(e){let t=wn();if(t.projectConfig===e)return;id({...t,projectConfig:e}),tc(m.projectRoot,e)}function tt(){let e=x?.projectConfig;return e?he(e):null}function K(e){return he(e)}function Pe(e,t){for(let o of Object.keys(e))delete e[o];Object.assign(e,t)}function be(e){return I=e,e.scope.run(()=>{ne(()=>{let t=e.doc.document;if(I!==e||!x)return;et(K(t))})}),e}function eC(){let e=wn(),t=ve();if(I&&(I!==(t??j)||he(I.doc.document)!==e.projectConfig))Qe();if(I)return I;if(t)return be(t);return j=sv({document:e.projectConfig??{},documentPath:ln,id:ln}),be(j)}function ye(e){return JSON.stringify(e.extensions??null)}async function ot(){let{loadFormats:e,refreshExtensionUi:t,refreshFormats:o}=await (le("yxz0kjjs"),import("./format-host-yxz0kjjs.js"));o(),e(),t(p())}async function Kl(e){let t=tt(),o=eC();await WL(o);let r=K(o.doc.document),s=wm(r),i=t&&t!==r&&wm(t)!==s?t:null;if(i&&o.doc.dirty){let b=Error(`${ln} has unsaved changes in its editor tab`);return C.error(`Could not save ${ln} — the file is open with unsaved changes. Save or `+"revert that tab, then make the settings change again.",{key:`save:${ln}`,path:ln,source:"Settings"}),{error:b,ok:!1}}let a=i??r,l=e?{...a,...e}:a,u=wm(l);if(!i&&!o.doc.dirty&&u===N)return{ok:!0};let d=ye(r);Y(o,(b)=>{let y=b.doc.document;if(i)Pe(y,i);for(let[P,T]of Object.entries(e??{}))y[P]=T});let c=K(o.doc.document),f=wm(c);try{await p().writeFile(ln,f)}catch(b){return C.error(`Could not save ${ln} — ${Q(b)}`,{key:`save:${ln}`,path:ln,source:"Settings"}),{error:b,ok:!1}}if(N=f,o.doc.dirty=!1,ye(c)!==d)await ot();return{ok:!0}}async function XN(e,t){if(!x){tc(m.projectRoot,e);return}let o=eC();Y(o,(r)=>Pe(r.doc.document,e),{skipHistory:!0}),o.doc.dirty=!1,await xe(),_=H(t),o.doc.layout=_,N=wm(e)}function to(e){let t=x?.projectConfig?.$media;if(!t)return e||{};if(!e)return{...t};return{...t,...e}}function Sr(e){let t=x?.projectConfig?.style;if(!t)return e||{};if(!e)return{...t};let o={...t};for(let[r,s]of Object.entries(e)){let i=o[r];o[r]=S(s)&&S(i)?{...i,...s}:s}return o}function QN(e,t=[]){return{...VL(t),...x?.projectConfig?.imports,...e}}function VL(e){let t=e.flatMap((o)=>(o.classes??[]).filter((r)=>r.path.endsWith(".class.json")).map((r)=>[r.name,r.path]));return Object.fromEntries(t.toReversed())}function Zw(e){let t=x?.projectConfig?.$elements;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,r=[];for(let s of[...t,...e]){let i=n(s)?s:S(s)?s.$ref:void 0;if(i&&!o.has(i))o.add(i),r.push(s)}return r}function Xw(e){let t=x?.projectConfig?.$head;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,r=[];for(let s of[...t,...e]){let i=S(s)?s.attributes:void 0,a=String(i?.href||i?.src||"")||JSON.stringify(s);if(!o.has(a))o.add(a),r.push(s)}return r}function Ts(){let e=x?.projectConfig;return e?Qt(e).i18n:null}function Rp(e,t){let o=Ts();if(o===null)return null;let r=Fn(e);if(r!==null&&o.locales.includes(r))return r;return Hi(t??"",o)??o.defaultLocale}var q=new Map;function eA(){q.clear()}function ol(e){if(e===!1)return null;let t=x?.projectConfig?.defaults?.layout;return e||t||null}async function Qw(e){let t=e.replace(/^\.\//,""),o=q.get(t);if(o!==void 0)return structuredClone(o);try{let s=await p().readFile(t),i=JSON.parse(s);return q.set(t,i),structuredClone(i)}catch{return null}}function UL(e,t){let o=t.children??[],r=Array.isArray(o)?o:[],s=new Map,i=[];for(let a of r){let l=n(a)?void 0:a.attributes?.slot;if(!n(a)&&n(l)&&l){if(!s.has(l))s.set(l,[]);s.get(l).push(a)}else i.push(a)}if(Te(e,s,i),t.state)e.state={...e.state,...t.state};if(t.$media)e.$media={...e.$media,...t.$media};if(t.style)e.style={...e.style,...t.style};if(t.attributes)e.attributes={...e.attributes,...t.attributes};return e}function Te(e,t,o){if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(S(s)&&s.tagName==="slot"){let i=s.attributes?.name;if(n(i)&&i&&t.has(i))r.push(...t.get(i)),t.delete(i);else if(!i&&o.length>0)r.push(...o);else if(Array.isArray(s.children))r.push(...s.children)}else{if(S(s))Te(s,t,o);r.push(s)}e.children=r}async function no(e){let t=await Kl(e);if(!t.ok)throw t.error}var ke=new Set([ui,jm]),nt=new Set(["auto","light","dark"]);function rt(e){return n(e)&&nt.has(e)}function it(e){let{ui:t}=e.session;return{activeMedia:t.activeMedia,canvasMode:t.canvasMode,editZoom:t.editZoom,preview:t.preview,previewColorScheme:t.previewColorScheme,previewLocale:t.previewLocale,showLayout:t.showLayout,zoom:t.zoom}}function Ie(){let e={},t=[];for(let o of m.panes){if(o.derived)continue;let r=[];for(let i of o.tabOrder){let a=m.tabs.get(i);if(!a?.documentPath)continue;r.push(a.documentPath),e[a.documentPath]=it(a)}if(r.length===0)continue;let s=o.activeTabId?m.tabs.get(o.activeTabId):null;t.push({activeFile:s?.documentPath??null,files:r,id:o.id})}return{focusedPane:m.activePaneId,panes:t,ui:e}}function st(e){if(!v(e))return{};let t={};if(n(e.canvasMode))t.canvasMode=e.canvasMode;if(Xe(e.preview))t.preview=e.preview;if(Z(e.zoom)&&Number.isFinite(e.zoom))t.zoom=e.zoom;if(Z(e.editZoom)&&Number.isFinite(e.editZoom))t.editZoom=e.editZoom;if(e.activeMedia===null||n(e.activeMedia))t.activeMedia=e.activeMedia;if(rt(e.previewColorScheme))t.previewColorScheme=e.previewColorScheme;if(e.previewLocale===null||n(e.previewLocale)&&vx(e.previewLocale))t.previewLocale=e.previewLocale;if(Xe(e.showLayout))t.showLayout=e.showLayout;return t}function _e(e){if(!v(e)||!Array.isArray(e.panes))return null;let t=[];for(let r of e.panes){if(!v(r)||!n(r.id)||!ke.has(r.id))continue;let s=Array.isArray(r.files)?r.files.filter((i)=>n(i)&&i!==""):[];if(s.length===0)continue;t.push({activeFile:n(r.activeFile)&&s.includes(r.activeFile)?r.activeFile:null,files:s,id:r.id})}if(t.length===0)return null;let o={};if(S(e.ui))for(let[r,s]of Object.entries(e.ui))o[r]=st(s);return{focusedPane:n(e.focusedPane)&&ke.has(e.focusedPane)?e.focusedPane:ui,panes:t,ui:o}}async function tA(e,t){let o=0;if(e.panes.some((i)=>i.id===jm))t.ensureSecondPane();for(let i of e.panes)for(let a of i.files){try{await t.openFile(a,i.id)}catch{}if([...m.tabs.values()].some((l)=>l.documentPath===a))o+=1}if(o===0)return 0;for(let i of m.tabs.values()){let a=i.documentPath?e.ui[i.documentPath]:void 0;if(!a)continue;let{ui:l}=i.session;if(a.canvasMode&&i.capabilities.modes.includes(a.canvasMode))l.canvasMode=a.canvasMode;if(a.preview!==void 0)l.preview=a.preview;if(a.zoom!==void 0)l.zoom=a.zoom;if(a.editZoom!==void 0)l.editZoom=a.editZoom;if(a.activeMedia!==void 0)l.activeMedia=a.activeMedia;if(a.previewColorScheme!==void 0)l.previewColorScheme=a.previewColorScheme;if(a.previewLocale!==void 0)l.previewLocale=a.previewLocale;if(a.showLayout!==void 0)l.showLayout=a.showLayout}let r=m.panes.some((i)=>i.id===e.focusedPane)?e.focusedPane:null,s=null;for(let i of e.panes){let a=m.panes.find((u)=>u.id===i.id);if(!a||!i.activeFile)continue;let l=a.tabOrder.find((u)=>m.tabs.get(u)?.documentPath===i.activeFile);if(!l)continue;if(a.id===r)s=l;else Bt(l,{focus:!1})}if(s)Bt(s);else if(r)Lr(r);return o}var xm=["review","deploys","branches","hosting"],tC={branches:"Branches",deploys:"Deploys",hosting:"Hosting",review:"Review changes"},at=["live","review"],Ee="review",Ce="live",lt=new Set(xm),ct=new Set(at);function nA(e){return typeof e==="string"&<.has(e)}function ex(e){return typeof e==="string"&&ct.has(e)}var ut={default:{description:"Resume whatever was persisted — layout, recents, settings, chat history.",id:"default",reset:"none"},fresh:{description:"A first-run app: no layout, no recents, no settings, no history.",id:"fresh",reset:"app-state"}},Ae=new Map(Object.entries(ut)),ft="default",dt=/^jx[-._:]/;function mt(e){return dt.test(e)}function gt(){let e=typeof localStorage>"u"?void 0:localStorage;if(!e)return[];let t=[];try{for(let o=0;o<e.length;o++){let r=e.key(o);if(r&&mt(r))t.push(r)}for(let o of t)e.removeItem(o)}catch{}return t}function bt(e){let t=Ae.get(e);if(!t)throw RangeError(`unknown startup profile "${e}"; declared: ${[...Ae.keys()].join(", ")}`);if(t.reset==="app-state")gt();return t}var B=null;function je(e){if(B)return B;let t=new URLSearchParams(e??(typeof location>"u"?"":location.search)),o=bt(t.get("profile")??ft),r=t.get("clock");return B={clock:r===null?null:tM(r),profile:o},B}var W=["site","collections","styles","files","search","i18n","layers","data","packages","insert"],ht=new Set(["collections","styles"]);function Oe(e){return e&&!ht.has(e)?e:yt}var St=new Map([["blocks","insert"],["head","site"],["page","site"],["imports","packages"],["git","site"],["state","data"]]),yt="site";function nC(e,t){let o=W.find((r)=>r===e);if(o===void 0)throw Error(`${t}: "${e}" is not a declared Navigator panel id.`);return o}function se(e){if(!n(e))return null;let t=St.get(e);if(t)return t;return W.find((o)=>o===e)??null}var oe=["page","properties","style","events","assistant"],tx="page",wt=["properties","style","events"],iC="properties";function nx(e){return typeof e==="string"&&wt.some((t)=>t===e)}function qL(e){return typeof e==="string"&&oe.some((t)=>t===e)}var ix=["problems","logic","activity"],GL="problems";function KL(e){return typeof e==="string"&&ix.some((t)=>t===e)}var ox=["light","dark"],Vc={content:{id:"content",inspector:{open:!1,whileWriting:!0},navigator:{open:!0,panel:"collections"},rail:!1,tabStrip:!0},design:{id:"design",inspector:{open:!0},navigator:{initial:"site",open:!0},rail:!0,tabStrip:!0},media:{id:"media",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},publish:{id:"publish",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},styles:{id:"styles",inspector:{open:!1,tab:"style",whileWriting:!0},navigator:{open:!0,panel:"styles"},rail:!1,tabStrip:!1}},De="jx-studio-panel-widths",Le="jx-studio-project::",vt="dark";function JL(e){return typeof e==="string"&&ox.some((t)=>t===e)}function xt(){let e=Go(pt.theme);return JL(e)?e:vt}var rx=["left","right","bottom"],D={bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!1,size:280}},iA={bottom:D.bottom.size,left:D.left.size,right:D.right.size},Pt={bottom:"--dock-h-bottom",left:"--panel-w-left",right:"--panel-w-right"},Tt={bottom:"bottom-collapsed",left:"left-collapsed",right:"right-collapsed"},YL=0.5,oC=0.2,rC=0.8;function kt(e){return Z(e)&&e>=oC&&e<=rC?e:YL}function oA(e){h.paneSplit=Math.min(rC,Math.max(oC,e))}function It(){try{let e=JSON.parse(localStorage.getItem(De)||"{}");return v(e)?e:{}}catch{return{}}}function _t(e){return{left:e("left"),right:e("right"),bottom:e("bottom")}}function Re(){return{branches:null,commitMessage:"",diffState:null,error:null,lastUpdated:null,loading:!1,logEntries:null,rev:0,status:null}}function $e(){return{build:{for:"",state:"idle",text:""},deploys:{error:"",project:"",rows:[],state:"idle"},destination:Ce,review:{number:0,url:""},tab:Ee}}var Et="tokens";function Je(){return{customizedOnly:!1,filter:"",selection:null,variable:null,view:Et}}function Ct(){let e=It(),t=_t((o)=>{let r=e[o],s=e[`${o}Collapsed`];return{collapsed:Xe(s)?s:D[o].collapsed,size:Z(r)&&r>0?r:D[o].size}});return{bottomTab:KL(e.bottomTab)?e.bottomTab:GL,docks:t,focusRegion:"pane",paneSplit:kt(e.paneSplit),git:Re(),publish:$e(),layoutSelection:null,leftTab:Oe(se(e.leftTab)),stylebook:Je(),theme:xt(),workspace:wx}}je();var At=["jx-studio-doc-header-expanded"];function jt(){try{for(let e of At)localStorage.removeItem(e)}catch{}}jt();var h=g(Ct());function Fd(){try{localStorage.setItem(De,JSON.stringify({bottom:h.docks.bottom.size,bottomCollapsed:h.docks.bottom.collapsed,bottomTab:h.bottomTab,left:h.docks.left.size,leftCollapsed:h.docks.left.collapsed,leftTab:h.leftTab,paneSplit:h.paneSplit,right:h.docks.right.size,rightCollapsed:h.docks.right.collapsed}))}catch{}}var re,ae={};function ce(e){if(!e)return{};try{let t=JSON.parse(localStorage.getItem(`${Le}${e}`)||"{}");return v(t)?t:{}}catch{return{}}}function ZL(e){let t=ce(e).workspace;return N$(t)?t:wx}function rA(e){return _e(ce(e).session)}var ue=null;function sx(e){ue=e}function sA(){fe()}function fe(){let e=m.projectRoot;if(!e)return;try{localStorage.setItem(`${Le}${e}`,JSON.stringify({session:e===ue?Ie():ce(e).session,workspace:h.workspace}))}catch{}}function Nt(e){if(e===re)return;if(re=e,ae={},h.workspace=ZL(e),e===null){h.leftTab=Oe(se(h.leftTab));return}Jr();try{Me(h.workspace),Fd()}finally{Yr()}}function XL(e,t){let{inspector:o}=Vc[e];return o.open||o.whileWriting===!0&&t}function Me(e,t){let o=Vc[e],r=se(o.navigator.panel??ae[e]??o.navigator.initial??h.leftTab);if(r)h.leftTab=r;if(h.docks.left.collapsed=!o.navigator.open,h.docks.right.collapsed=!XL(e,t?.writingOnCanvas?.()===!0),o.inspector.tab&&t)t.setInspectorTab(o.inspector.tab)}function sC(e,t){if(h.workspace===e)return!1;if(!Vc[h.workspace].navigator.panel)ae[h.workspace]=h.leftTab;return h.workspace=e,Me(e,t),Fd(),fe(),!0}function _m(e=h.theme){return e==="light"?"vs":"vs-dark"}function Ot(){document.documentElement.dataset.theme=h.theme,tf()?.editor.setTheme(_m())}var Dt="rail-hidden",Lt="tabs-hidden";function Ob(e=h.workspace){return Vc[e].tabStrip}function Rt(){let e=document.documentElement;for(let o of rx)e.style.setProperty(Pt[o],`${h.docks[o].size}px`);let t=document.querySelector("#app");if(!t)return;for(let o of rx)t.classList.toggle(Tt[o],h.docks[o].collapsed);t.classList.toggle(Dt,!Vc[h.workspace].rail),t.classList.toggle(Lt,!Vc[h.workspace].tabStrip)}var X=null,ie=[];function Mb(e){if(!ie.includes(e))ie.push(e)}function aA(){if(X)return;for(let e of ie)e.mount();X=ge(),X.run(()=>{ne(()=>{Rt()}),ne(()=>{Ot()}),ne(()=>{Nt(m.projectRoot)}),ne(()=>{let e=m.projectRoot;m.activePaneId;for(let t of m.panes)t.id,t.activeTabId,t.tabOrder.join("\x00");if(e)fe()})})}function Eo(e,t){if(h.docks[e].collapsed===t){Fd();return}h.docks[e].collapsed=t,Fd()}function $t(e){Eo(e,!h.docks[e].collapsed)}function lA(e,t){h.docks[e].size=t}function Uc(e){h.leftTab=e,Eo("left",!1),Fd()}function sh(e){h.bottomTab=e,Eo("bottom",!1),Fd()}function QL(e){if(h.theme===e)return;h.theme=e,Cr(pt.theme,e)}function cA(e){if(e===h.leftTab&&!h.docks.left.collapsed){Eo("left",!0);return}Uc(e)}function e$(e){h.layoutSelection=e}function ax(){Object.assign(h.git,Re()),Object.assign(h.publish,$e()),Object.assign(h.stylebook,Je()),h.layoutSelection=null,ue=null,re=void 0}function Ne(e,t){if(t.showWorkspace){t.showWorkspace(e);return}sC(e,t)}var ee=(e)=>e.project.open;function Jt(e){return[{args:Se({tab:di(W,"Which Navigator panel to show.")}),category:"View",id:"view.setActivity",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",requires:"an open project",when:ee,run:(t,o)=>{let r=Vn("view.setActivity",o,"tab",W);if(e.panelAvailable&&!e.panelAvailable(r))throw RangeError(`command "view.setActivity" argument "tab": "${r}" names a panel that is registered but not available right now, so showing it would persist a Navigator tab nothing can draw`);Uc(r)},title:"Show Navigator Panel"},{args:Se({tab:di(oe,"Which Inspector tab to show.")}),category:"View",id:"view.setRightTab",level:"document",menus:["palette"],group:"4_docks",requires:"an open document",when:(t)=>t.document.open,run:(t,o)=>{e.setInspectorTab(Vn("view.setRightTab",o,"tab",oe))},title:"Show Inspector Tab"},{args:Se({open:$o("True to show the Navigator dock, false to collapse it.")}),category:"View",id:"view.setNavigator",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{Eo("left",!zi("view.setNavigator",o,"open"))},title:"Show Navigator Dock"},{args:Se({open:$o("True to show the Inspector dock, false to collapse it.")}),category:"View",id:"view.setRightPanel",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{Eo("right",!zi("view.setRightPanel",o,"open"))},title:"Show Inspector Dock"},{args:Se({open:$o("True to show the Bottom dock, false to collapse it.")}),category:"View",id:"view.setBottomDock",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{Eo("bottom",!zi("view.setBottomDock",o,"open"))},title:"Show Bottom Dock"},{category:"View",id:"view.toggleBottomDock",keybinding:"mod+j",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>{$t("bottom")},title:"Toggle Bottom Dock"},{args:Se({tab:di(ix,"Which Bottom dock tab to show.")}),category:"View",id:"view.setBottomTab",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{let r=Vn("view.setBottomTab",o,"tab",ix);if(e.panelAvailable&&!e.panelAvailable(r))throw RangeError(`command "view.setBottomTab" argument "tab": "${r}" names a panel that is registered but not available right now, so showing it would persist a Bottom dock tab nothing can draw`);sh(r)},title:"Show Bottom Dock Tab"},{args:Se({open:$o("True to show the Assistant tab, false to step off it.")}),category:"View",id:"view.setAssistant",level:"application",menus:["never"],group:"4_docks",run:(t,o)=>{if(zi("view.setAssistant",o,"open")){Eo("right",!1),e.setInspectorTab("assistant");return}if(e.inspectorTab()==="assistant")e.setInspectorTab(e.restingInspectorTab?.()??tx)},title:"Show Assistant"},{args:Se({workspace:di(_C,"Which workspace to show.")}),category:"View",id:"view.setWorkspace",level:"application",menus:["never"],group:"4_workspaces",requires:"an open project",when:ee,run:(t,o)=>{Ne(Vn("view.setWorkspace",o,"workspace",_C),e)},title:"Switch Workspace"},...tv.map((t,o)=>({category:"View",id:`workspace.focus.${t.id}`,keybinding:`mod+${o+1}`,level:"application",menus:["palette"],group:"4_workspaces",requires:"an open project",when:ee,run:()=>{Ne(t.id,e)},title:`Go to ${t.title}`})),{args:Se({color:di(ox,"The Studio chrome's theme.")}),category:"View",id:"view.setTheme",level:"application",menus:["palette"],group:"6_appearance",run:(t,o)=>{QL(Vn("view.setTheme",o,"color",ox))},title:"Set Theme"}]}function dA(e,t){e.registerAll(Jt(t))}
|
|
13
|
-
export{Es,ko,wm,WL,eC,Kl,XN,to,Sr,QN,VL,Zw,Xw,Ts,Rp,eA,ol,Qw,UL,no,tA,xm,tC,nA,ex,nC,tx,iC,nx,qL,ix,GL,KL,ox,Vc,JL,rx,iA,YL,oC,rC,oA,h,Fd,ZL,rA,sx,sA,XL,sC,_m,Ob,Mb,aA,Eo,lA,Uc,sh,QL,cA,e$,ax,dA};
|
|
14
|
-
|
|
15
|
-
//# debugId=4E96D1FA4E6D2FBE64756E2164756E21
|
|
16
|
-
//# sourceMappingURL=studio-d5grtb9e.js.map
|