@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,7 +0,0 @@
|
|
|
1
|
-
import{mt}from"./studio-k3xxbagr.js";import{Q}from"./studio-nqxqf8p2.js";import{ae}from"./studio-q7rtx6zq.js";import{T,R,Tn,rt,xi}from"./studio-x9hsze61.js";import{g,dr,C}from"./studio-43sd2mam.js";import{p,_e}from"./studio-w4rz9hdk.js";import{Ot,$h,ic,tu,Aa,nf,cn,hl}from"./studio-z97c48fk.js";import{Er}from"./studio-fyh0jc96.js";import{hs,Rm}from"./studio-8m0y2qe7.js";import{Vt,Qt,Hi,Am,lv,Jd,Un,ui,m,Ql,ec,tc,_i,q$,Bt,pv,zx}from"./studio-c05wdnt3.js";import{zp,QA,eO,$a}from"./studio-r5qy30vx.js";import{pt,Go,Cr}from"./studio-s32578pn.js";import{Es,tA,ZL,rA,sx,ax}from"./studio-d5grtb9e.js";import{tl}from"./studio-y0n7yxea.js";import{Zn}from"./studio-5g0rprdt.js";import{_a}from"./studio-fbhxxc5f.js";import{Dp}from"./studio-ph84avkf.js";import{Vr,Gs,Ks,Ur}from"./studio-nh6d342n.js";import{bw,um,hm,pb}from"./studio-syreb644.js";import{qc,Ca}from"./studio-3exxhz5g.js";import{tT,oS}from"./studio-bavb31r0.js";import{iN,or,vb,yb}from"./studio-q0tccd43.js";import{Tw,fb}from"./studio-x1x167jh.js";import{Xt}from"./studio-pbxa5fpc.js";import{pw,fw,mw}from"./studio-wys23mxz.js";import{Ac}from"./studio-mx1smyq0.js";import{tS,XE,QE,db}from"./studio-tft6r105.js";import{Ws}from"./studio-tfkznv39.js";import{x,id,wn}from"./studio-gcxk20n7.js";import{n,S}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";async function ab(){if(bw(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let o=tl({status:"Running bun install…",title:"Installing dependencies"});try{let r=await e.installDependencies();if(r.ok)return o.done(),!0;o.fail(r.log??"bun install failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}return!1}var Le=["page","component"],Me={components:"component",pages:"page"};function M(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ae(e){let t=M(e).toLowerCase();for(let[o,r]of Object.entries(Me))if(t.startsWith(`${o}/`))return r;return null}function Y(e){return Le.some((t)=>e.includes(t))}function He(e){let t=x?.projectConfig?.layout;if(!n(t))return!1;return M(t).toLowerCase()===M(e).toLowerCase()}function K_(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let o of hl(e)){let r=Aa(o,"parse");if(r&&Aa(o,"serialize"))t.push({ext:o,label:`${r.name} (${o})`})}return t}function ie(){return new Set([".json",...tu().flatMap((e)=>e.extensions)])}function J_(e){if(e===null||e===void 0||e==="")return[];let t=Ae(e);if(t===null||He(e)||Un(e))return[];let o=cn(e);if(!(o?Boolean(o.capabilities.parse)&&Y(o.documentKinds):M(e).toLowerCase().endsWith(".json")))return[];let a=[];if(o)a.push({ext:".json",label:"JSON (.json)"});for(let i of hl()){let s=Aa(i,"serialize");if(!s||s.name===o?.name||!Y(s.documentKinds)||!s.documentKinds.includes(t))continue;a.push({ext:i,label:`${s.name} (${i})`})}return a}function ND(){let e=new Set([".json"]);for(let t of tu()){if(!t.capabilities.serialize||!Y(t.documentKinds))continue;for(let o of t.extensions)e.add(o)}return[...e].toSorted()}var X="jx-studio-recent-projects",ce="jx-studio-recent-files",se=8,We=10,D=[];function A(){if(!_e())return null;let e=p();return ze(e)?e:null}function ze(e){return Boolean(e.getRecentProjects&&e.saveRecentProjects)}function Ve(){try{let e=localStorage.getItem(X);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Z(){return A()?D:Ve()}function de(e){D=e;let t=A();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(X,JSON.stringify(e))}catch{}}async function AD(){let e=A();if(!e)return;try{D=await e.getRecentProjects()}catch{D=[]}}function dw(){return Z().toSorted((e,t)=>t.timestamp-e.timestamp)}function uw(e,t){let o=Z().filter((r)=>r.root!==t);if(o.unshift({name:e,root:t,timestamp:dr()}),o.length>se)o.length=se;de(o)}function Y_(e){de(Z().filter((t)=>t.root!==e))}function OD(){D=[];let e=A();if(e)e.saveRecentProjects([]);else localStorage.removeItem(X)}function pe(){try{let e=localStorage.getItem(ce);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function MD(e){let t=pe().toSorted((o,r)=>r.timestamp-o.timestamp);return e==null?t:t.filter((o)=>o.root===e)}function lb(e){let t=pe().filter((a)=>!(a.root===e.root&&a.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:dr()});let o=new Map,r=[];for(let a of t.toSorted((i,s)=>s.timestamp-i.timestamp)){let i=(o.get(a.root)??0)+1;if(o.set(a.root,i),i<=We)r.push(a)}localStorage.setItem(ce,JSON.stringify(r))}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};T("files-panel",ue);function fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function H(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function qe(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function Be(e){let t=e?.$map,o=S(t)&&"item"in t?t.item:void 0;if(!S(o)||!("path"in o)||!n(o.path)||!("type"in o)||!n(o.type))return null;return{path:o.path,type:o.type}}function me(e,t,o){let r=g({...H(),...o});fe(r,t);let a=null,i=!1,s=R("files-panel",r,e,{onNodeCreated:(l,c,u,d)=>{if(i||!(l instanceof HTMLElement))return;let b=qe(u);if(b==="tree"){o.treeHost(l);return}if(b!=="row")return;let v=Be(d);if(v)o.rowHost(l,v.path,v.type)}}).then((l)=>{if(i){l.dispose();return}a=l});return{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>{fe(r,l)}}}async function zs(e){if(!x)return;try{let t=p(),[o]=await Promise.all([hs(()=>t.listDirectory(e)),QA(e)]);x.dirs.set(e,o)}catch{x.dirs.set(e,[])}}var he=new Set(["pages","layouts","components","content","data","public","styles"]);async function cm(){if(!x)return;await zs(".");let e=[];for(let t of x.dirs.get(".")??[])if(t.type==="directory"&&he.has(t.name))e.push(t.name),x.expanded.add(t.path||t.name),await zs(t.path||t.name);x.projectDirs=e}async function jE(e){let t=new Set(x?.projectDirs);if(!e.some((r)=>{let a=r.replaceAll("\\","/").replace(/^\.\//,"").split("/")[0]??"";return r.includes("/")&&he.has(a)&&!t.has(a)}))return!1;return await cm(),!0}function HE(){return Go(pt.showIgnoredFiles)==="true"}function C2(e){Cr(pt.showIgnoredFiles,e?"true":"")}async function BE(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:o,info:r}=t;if($h(),Ot(),ic(e),zp(),Rm(),id({dirs:new Map,expanded:new Set,isSiteProject:r.isSiteProject,name:r.isSiteProject?r.projectConfig?.name||o.name:o.name,projectConfig:(r.isSiteProject?r.projectConfig:null)||null,projectDirs:r.directories||[],projectRoot:".",root:o.root,searchQuery:"",selectedPath:null}),r.isSiteProject)tc(o.root||".",r.projectConfig||null);if(r.isSiteProject){if(uw(wn().name,o.root),await hm(),await ab())$h(),await Ot(),ic(e);await cm(),await _a(),await cb(),um(o.root)}}catch{}}async function zE({renderLeftPanel:e,resetProjectCaches:t}){try{let o=p(),r=await o.openProject();if(!r)return!1;let{config:a,handle:i}=r;if(q$({document:{children:[],tagName:"div"},id:"initial"}),iN(),$h(),Ot(),ic(o),zp(),Rm(),id({...x,dirs:new Map,expanded:new Set,isSiteProject:!0,name:a.name||i.name,projectConfig:a,projectRoot:i.root,searchQuery:"",selectedPath:null}),tc(i.root,a),await hm(),await ab())$h(),await Ot(),ic(o);return await cm(),await _a(),pb(),ax(),t?.(),uw(wn().name,wn().projectRoot),e(),await cb(),um(wn().projectRoot),!0}catch(o){return C.error("Could not open the project.",{detail:Q(o),source:"Open Project"}),!1}}async function WE(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),C.success("Initialized a git repository for this project."),!0}catch(o){return C.warn("Could not initialize a git repository — the project itself was written.",{detail:Q(o),source:"Source Control"}),!1}}async function Z_(){await Ot();let e=[...hl("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let o=new Set(t.filter((r)=>r.type==="file").map((r)=>r.name));for(let r of e)if(o.has(`index${r}`))return`pages/index${r}`;return null}async function k2(){let e=await Z_();if(e)await yi(e)}async function cb(){let e=rA(m.projectRoot),t=ZL(m.projectRoot),o=await Ue(e);return ge?.(t),o}var ge=null;function VE(e){ge=e}async function Ue(e){if(sx(m.projectRoot),e){if(await tA(e,{ensureSecondPane:()=>{ec(ui)},openFile:(o,r)=>yi(o,{focus:!1,paneId:r})})>0)return!0}return await k2(),!1}function Ge(e,t,o){if(t==="directory")return o?"folder-open":"folder";let r=e.split(".").pop()?.toLowerCase();switch(r){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return r!==void 0&&Dp(r)?"image":"file"}}var E2=24,f=[],E=null,j=new Map,_=null,we=null;function ne(){for(let e of j.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return E2}function Ke(){for(let[e,t]of j)if(!t.isConnected)j.delete(e),$e(t)}function ve(e){let t=j.get(e);return t?.isConnected===!0?t:null}function U(e){return f.find((t)=>!t.loading&&t.path===e)}function ye(e,t,o,r){let a=wn().dirs.get(e);if(!a){zs(e).then(()=>h()),o.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let i=[...a].toSorted((u,d)=>{if(u.type==="directory"&&d.type!=="directory")return-1;if(u.type!=="directory"&&d.type==="directory")return 1;return u.name.localeCompare(d.name)}),s=HE()?i:i.filter((u)=>!eO(e,u.path,u.type==="directory")),l=wn().searchQuery.toLowerCase(),c=l?s.filter((u)=>u.type==="directory"||u.name.toLowerCase().includes(l)):s;for(let[u,d]of c.entries()){let v=d.type==="directory"&&wn().expanded.has(d.path);if(o.push({depth:t,expanded:v,key:d.path,loading:!1,name:d.name,path:d.path,locale:Hi(d.path,r)??void 0,posInSet:u+1,setSize:c.length,type:d.type}),v)ye(d.path,t+1,o,r)}}function be(e){return e===void 0?-1:f.findIndex((t)=>!t.loading&&t.path===e)}function W(e,t){for(let o=e+t;o>=0&&o<f.length;o+=t)if(!f[o].loading)return o;return-1}function Ye(e){let t=f[e];if(!t)return-1;for(let o=e-1;o>=0;o--){let r=f[o];if(!r.loading&&r.depth<t.depth)return o}return-1}function Qe(){if(E?.isConnected!==!0||k!=="")return;queueMicrotask(h)}function te(){let e=E;if(e===null)return;_=mw(_,e,{count:()=>f.length,onChange:Qe,rowHeight:ne})}function Xe(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:Ge(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":Vt(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function Ze(){if(Ke(),!x){f=[];let l={...H(),view:"none"};return y=l,l}if(!x.isSiteProject&&x.projectRoot==="."){f=[];let l={...H(),view:"welcome"};return y=l,l}let e=wn();f=[];let{i18n:t}=Qt(e.projectConfig??{});ye(".",0,f,t);let o=pw(E,{count:f.length,rowHeight:ne()}),r=f.slice(o.start,o.end),a=(e.selectedPath!==null&&U(e.selectedPath)?e.selectedPath:"")||r.find((l)=>!l.loading)?.path||"",i=HE(),s={currentPath:a,dragPath:k,dropPath:O,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:i?"eye":"eye-slash",ignoredLabel:i?"Hide ignored files":"Show ignored files",ignoredSelected:i,padBottom:o.padBottom,padTop:o.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:G,rows:r.map((l)=>Xe(l)),selectedPath:e.selectedPath??"",view:"tree"};return y=s,s}function oe(){if(!w||!y)return;y={...y,dragPath:k,dropPath:O,rootDrop:G},w.handle.update(y)}function h(){we?.()}async function et(){let e=wn();e.dirs.clear(),zp(),await zs(".");for(let t of e.expanded)await zs(t);h()}function tt(e){let t=U(e);if(!t)return;if(t.type==="directory"){Fe(e).then(()=>h());return}yi(e)}function ot(e,t){let o=wn();if(U(e)?.type!=="directory"||o.expanded.has(e)===t)return;if(!t){o.expanded.delete(e),h();return}Fe(e).then(()=>h())}function xe(e){if(!x||wn().selectedPath===e)return;wn().selectedPath=e,h()}function nt(e,t){let o=be(e),r;switch(t){case"Home":{r=W(-1,1);break}case"End":{r=W(f.length,-1);break}case"ArrowUp":{r=W(o,-1);break}case"ArrowLeft":{r=Ye(o);break}case"ArrowDown":case"ArrowRight":{r=W(o,1);break}default:return}Pe(r)}function at(e,t){let o=be(e),r=f.length;for(let a=1;a<=r;a++){let i=(o+a+r)%r,s=f[i];if(s&&!s.loading&&s.name.trim().toLowerCase().startsWith(t)){Pe(i);return}}}function Pe(e){let t=f[e];if(!t)return;if(xe(t.path),ve(t.path))return;fw(E,e,ne()),h()}async function Fe(e){let t=wn();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await zs(e)}var I=new Map,V=null,k="",J="",O="",q=!1,G="";function T2(e){return[...e.dataTransfer?.types??[]].includes("Files")}function je(e,t,o){let r=(s)=>{if(!T2(s))return;if(s.preventDefault(),s.stopPropagation(),s.dataTransfer)s.dataTransfer.dropEffect="copy";o(!0)},a=()=>o(!1),i=(s)=>{o(!1);let l=s.dataTransfer?.files;if(!l?.length)return;s.preventDefault(),s.stopPropagation(),PD(l,t,h)};return e.addEventListener("dragover",r),e.addEventListener("dragleave",a),e.addEventListener("drop",i),()=>{e.removeEventListener("dragover",r),e.removeEventListener("dragleave",a),e.removeEventListener("drop",i)}}function UE(e,t){let o=e.replaceAll("\\","/"),r=t.replaceAll("\\","/");if(!o||o===r)return!1;if(o.startsWith(`${r}/`)||r.startsWith(`${o}/`))return!1;return B(o)!==r}function ee(e,t,o){let r=e.data.path;return o==="directory"&&n(r)&&UE(r,t)}function F(e,t){let o=t?e:"";if(J===e&&O===o)return;J=e,O=o,Se()}function z(e){if(q===e)return;q=e,Se()}function Se(){G=q&&J===""?"true":"",oe()}async function PD(e,t,o){if((await Ca([...e],{dir:t})).length===0)return;if(t!==".")wn().expanded.add(t);o()}function L2(e,t){let o=document.createElement("input");o.type="file",o.multiple=!0,o.accept=qc(),o.addEventListener("change",()=>{if(o.files?.length)PD(o.files,e,t)}),o.click()}function it(e,t,o){$e(e),j.set(t,e);let r=[Ur({element:e,getInitialData(){return{entryType:o,path:t,type:"file-tree"}},onDragStart(){k=t,oe()},onDrop(){k="",F("",!1),oe()}}),je(e,o==="directory"?t:B(t),(a)=>{F(a?t:"",a)}),Gs({canDrop({source:a}){return a.data.type==="file-tree"},element:e,getData({source:a}){return ee(a,t,o)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:a}){F(t,ee(a,t,o))},onDragEnter({source:a}){F(t,ee(a,t,o))},onDragLeave(){F("",!1)},onDrop(){F("",!1)}})];I.set(e,Vr(...r))}function $e(e){let t=I.get(e);if(t)t(),I.delete(e)}function st(e){if(V?.element===e)return;Re(),E=e;let t=Gs({canDrop({source:r}){let a=r.data.path;return r.data.type==="file-tree"&&n(a)&&UE(a,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){z(!0)},onDragLeave(){z(!1)},onDrop(){z(!1)}}),o=Ks({onDrop({source:r,location:a}){let[i]=a.current.dropTargets;if(!i)return;if(r.data.type!=="file-tree")return;if(i.data.type!=="file-tree-target")return;let s=r.data.path,l=i.data.targetDir;if(!n(s)||!n(l)||!UE(s,l))return;let c=s.split("/").pop(),u=l==="."?c:`${l}/${c}`;lt(s,u,h)}});V={cleanup:Vr(t,o,je(e,".",z)),element:e},te()}function Re(){V?.cleanup(),V=null;for(let e of I.values())e();I.clear(),_?.window.destroy(),_=null,E=null,k="",J="",O="",q=!1,G=""}async function lt(e,t,o){let r=p();$a(e,t);try{let a=await r.renameFile(e,t);Er();for(let[l]of m.tabs.entries())if(l===e)zx(e,t,t);else if(l.startsWith(`${e}/`)){let c=t+l.slice(e.length);zx(l,c,c)}let i=B(e),s=B(t);if(await zs(i),s!==i)await zs(s);if(s!==".")wn().expanded.add(s);Te(a,t),o(),FD(`Moved to ${t}`,a,t)}catch(a){C.error(`Could not move ${e}.`,{detail:Q(a),path:e,source:"Files"})}}function B(e){let t=e.replaceAll("\\","/"),o=t.lastIndexOf("/");return o===-1?".":t.slice(0,o)}var N=null;function ke(){N?.close(),N=null}function ct(e){let t={};if(e.type==="directory"){let o=Jd(e.path);if(o?.isSourceRoot===!0&&!o.fileBacked)t.name=o.name;return t}if(t.file=e.path,Ac(e.path))t.path=e.path;if(J_(e.path).length>0)t.source=e.path;return t}function P(e,t,o,r={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:o,title:t,...r}}function dt(e){let t=ae();if(!t)return[];let o=ct(e),r=[];for(let a of t.forPlacement("context/file")){let i=a.args;if(!(i?.required??[]).every((c)=>(c in o)))continue;let s={};for(let c of Object.keys(i?.properties??{}))if(c in o)s[c]=o[c];let l=t.disabledReason(a.id);r.push(l===void 0?P(a.id,a.title,()=>{Tn(t,a.id,s,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:a.id,requires:l,title:a.title})}return r}function ut(e){let t=e.type==="directory",o=[];if(t){if(o.push(P("files.newFile","New File…",()=>{Ee(e.path,h)}),P("files.upload","Upload Files…",()=>{L2(e.path,h)})),e.path==="pages"||e.path.endsWith("/pages"))o.push(P("files.pagesGrid","Edit Pages in Grid",()=>{oS()}))}else o.push(P("files.open","Open",()=>{yi(e.path)}));return o.push(...dt(e),P("files.rename","Rename…",()=>{bt(e,h)},{dividerAbove:!0}),P("files.delete","Delete",()=>{xt(e,h)},{destructive:!0})),o}function ft(e,t,o){let r=U(e);if(!r)return;ke();let a=ve(e);N=Xt({label:"File actions",onClosed:(i)=>{if(N===i)N=null},opener:a,origin:{x:t,y:o},region:"files",rows:ut({name:r.name,path:r.path,type:r.type})})}var ht=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2);function gt(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Aa(e.ext)?.name??e.ext} (${e.ext})`}]:K_(e.docKind)).map((o)=>({label:o.label,value:o.ext})),{dividerBefore:!0,label:"Other…",value:tS}]}function wt(e,t,o){let r=e.kind==="choose"?e.defaultExt:e.ext;if(r!==void 0&&t.some((i)=>i.value===r))return r;let a=XE(o);if(a!==""&&t.some((i)=>i.value===a))return a;return t[0]?.value??tS}async function $2(e){let{dir:t,format:o,source:r="Files"}=e;await Ot();let a=await hw(t),i=o!==void 0&&o.kind!=="fixed"?o:null,s=i===null?null:gt(i),l=i===null||s===null?"":wt(i,s,e.suggestedName??""),c={choice:o,dir:t,known:ie(),rows:s,taken:a},u=(K,Oe)=>db(K,Oe,c),d=l,b={confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,select:s===null?"stem":"all",validate:u,value:e.suggestedName??"untitled.json"};if(s!==null)b.choice={initial:l,label:"Format",onChange:(K)=>{d=K},options:()=>s};if(e.suggestedName!==void 0)b.placeholder=e.suggestedName;let v=await xi(e.title??"New File",b);if(!v)return null;let L=QE(v,d,o),De=t==="."?L:`${t}/${L}`,re=cn(L),Ne=e.content,Ce=o!==void 0&&d!==tS,Ie=Ne??re?.studio?.newFileTemplate??(re?"":L.toLowerCase().endsWith(".json")?Ce?ht:`{}
|
|
2
|
-
`:"");return X_(De,Ie,{dir:t,source:r})}async function hw(e){try{let t=await p().listDirectory(e);return new Set(t.map((o)=>o.name.toLowerCase()))}catch{return new Set}}async function X_(e,t,o={}){let r=o.dir??(e.includes("/")?e.slice(0,e.lastIndexOf("/")):".");$a(e);try{if(await p().writeFile(e,t),await zs(r),o.quiet!==!0)C.success(`Created ${e}`);return e}catch(a){return C.error(`Could not create ${e}.`,{detail:Q(a),path:e,source:o.source??"Files"}),null}}async function Ee(e,t){await Ot();let o=Jd(e);if(o?.unresolvedFormat!=null)C.error(`New files in ${e}/ cannot be constrained to the collection's format.`,{detail:`The "${o.name}" content type declares format "${o.unresolvedFormat}", which no installed extension provides. Install the extension that supplies it, or correct `+"the name in Project Settings › Content Types.",path:e,source:"Files"});let r=o?.ext!=null&&o.unresolvedFormat===null,a=r&&o.isSourceRoot&&o.def.schema!==void 0,i;if(a){let{createEntry:s}=await (le("6qxz9e8p"),import("./entry-commands-6qxz9e8p.js"));i=await s(o.name,{dir:e})}else i=await $2({dir:e,format:r&&o.ext!==null?{because:`${o.name} entries are ${o.ext} files, so a document of another format here would not be one.`,ext:o.ext,kind:"locked"}:{defaultExt:".json",kind:"choose"},suggestedName:"untitled"});if(i!==null)t()}async function vt(e,t){let o=await yb(t),r={confirmLabel:"Rename",select:"stem",validate:(a)=>a.trim()?"":"Enter a file name.",value:e};if(o!==void 0)r.message=o;return xi("Rename",r)}function yt(e,t){let o=t.references,r=t.tag?`; tag → <${t.tag.to}> (${t.tag.refsUpdated})`:"";if(o&&o.refsUpdated>0)return`Renamed to ${e}; updated ${o.refsUpdated} reference(s) in ${o.filesChanged} file(s)${r}`;if(r)return`Renamed to ${e}${r}`;return`Renamed to ${e}`}function FD(e,t,o){let r=t.errors??[];if(r.length===0){C.success(e);return}let a=r.length===1?"1 file":`${r.length} files`;C.warn(`${e} — references in ${a} could not be updated`,{detail:r.map((i)=>`${i.path}: ${i.error}`).join(`
|
|
3
|
-
`),path:o,source:"Files"})}function Te(e,t){for(let o of e.references?.files??[])if(o.path!==t&&m.tabs.has(o.path))dm(o.path)}function qE(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}async function I2(e,t,o){Er();let r=qE(e),a=qE(t);if(await zs(r),a!==r)await zs(a);if(wn().selectedPath===e)wn().selectedPath=t;Te(o,t)}async function bt(e,t){let o=await vt(e.name,e.path);if(!o||o===e.name)return;let r=qE(e.path),a=r==="."?o:`${r}/${o}`;$a(e.path,a);try{let s=await p().renameFile(e.path,a);if(m.tabs.has(e.path))zx(e.path,a,a);await I2(e.path,a,s),t(),FD(yt(o,s),s,a)}catch(i){C.error(`Could not rename ${e.name}.`,{detail:Q(i),path:e.path,source:"Files"})}}async function xt(e,t){if(!await vb(e))return;try{let r=p();$a(e.path),await r.deleteFile(e.path),Er();let a=e.path.replaceAll("\\","/"),i=a.includes("/")?a.slice(0,a.lastIndexOf("/")):".";if(await zs(i),wn().selectedPath===e.path)wn().selectedPath=null;t(),C.success(`Deleted ${e.name}`)}catch(r){C.error(`Could not delete ${e.name}.`,{detail:Q(r),path:e.path,source:"Files"})}}function Pt(e,t){let o=t.paneId,r=Ql(e);if(o!==void 0&&r){if(r.activeTabId===e&&t.focus===!1)return;pv(e,o)}Bt(e,{focus:t.focus!==!1})}async function yi(e,t={}){let o=t.focus!==!1;for(let[a,i]of m.tabs.entries())if(i.documentPath===e){if(t.canvasMode!==void 0)i.session.ui.canvasMode=t.canvasMode;if(Pt(a,t),o)wn().selectedPath=e;return}if(Tw(e)){if(fb(e,t),o)wn().selectedPath=e;lb({name:e.split("/").pop()||e,path:e,root:wn().projectRoot});return}if(e.toLowerCase().endsWith(".csv")){try{if(await tT(e,t),o)wn().selectedPath=e;lb({name:e.split("/").pop()||e,path:e,root:wn().projectRoot})}catch(a){C.error(`Could not open ${e}.`,{detail:Q(a),path:e,source:"Open File"})}return}let r=p();try{let a=await r.readFile(e);if(!a){if(await Ot(),!cn(e)&&!e.toLowerCase().endsWith(".json"))throw nf(e);return}await Ot();let i,s,l=null,c=cn(e);if(c){let d=await or(e,a);({document:i}=d),{frontmatter:s}=d}else if(e.endsWith(".json"))({document:i,layout:l}=Es(a));else throw nf(e);if(_i({id:e,documentPath:e,document:i,...s!=null&&{frontmatter:s},layout:l,source:c?a:null,sourceFormat:c?.name??null,...t.paneId!==void 0&&{paneId:t.paneId},...t.preview===!0&&{preview:!0},...t.focus===!1&&{focus:!1},...t.canvasMode!==void 0&&{canvasMode:t.canvasMode}}),o)wn().selectedPath=e;lb({name:e.split("/").pop()||e,path:e,root:wn().projectRoot})}catch(a){C.error(`Could not open ${e}.`,{detail:Q(a),path:e,source:"Open File"})}}async function Q_(e,t){await yi(t,{focus:!1,paneId:e,preview:!0})}function GE(e){if(lv(e))return;for(let[,t]of m.tabs.entries())if(t.documentPath===e&&!t.doc.dirty){dm(e);return}}function KE(e){for(let t of e)dm(t,{onlyIfChanged:!0})}async function dm(e,t={}){for(let[,o]of m.tabs.entries())if(o.documentPath===e){let r=p(),a=o.doc.dirty,i=()=>!a&&o.doc.dirty||lv(e);try{let s=await r.readFile(e);if(!s)return;if(await Ot(),i())return;if(cn(e)){let{document:l,frontmatter:c}=await or(e,s);if(i())return;if(t.onlyIfChanged&&Ws(l,o.doc.document)&&Ws(c,o.doc.content.frontmatter))return;o.doc.document=l,o.doc.content.frontmatter=c,o.doc.source=s}else if(e.endsWith(".json")){let l=Es(s);o.doc.layout=l.layout;let c=l.document;if(o.doc.bareRepeaters=Am(c),t.onlyIfChanged&&Ws(c,o.doc.document))return;o.doc.document=c}o.doc.dirty=!1}catch(s){C.error(`Could not reload ${e} after it changed on disk.`,{detail:Q(s),key:`reload:${e}`,path:e,source:"Files"})}return}}function JE(){Zn({id:"files",title:"Files",level:"project",dock:"navigator",icon:"folder",rail:"developer",render:()=>mt,afterRender:(e,t)=>{R2(t,e.rerender)}})}var Ft={activate:tt,contextMenu:ft,expand:ot,move:nt,newFile:()=>{Ee(".",h)},openProject:()=>{rt("project.open",void 0,"Files")},refresh:()=>{et()},rowHost:it,search:(e)=>{wn().searchQuery=e,h()},select:xe,toggleIgnored:()=>{C2(!HE()),h()},treeHost:st,typeahead:at},w=null,y=null;function R2(e,t){let o=e.querySelector(".panel-content")??e;if(we=t,w&&(w.host!==o||!w.handle.connected()))D2();let r=Ze();if(w)w.handle.update(r);else{let a=me(o,r,Ft);w={handle:a,host:o},a.ready.then(te)}queueMicrotask(te)}function D2(){ke(),w?.handle.dispose(),w=null,y=null,Re(),j.clear(),f=[]}
|
|
4
|
-
export{ab,K_,J_,ND,AD,dw,uw,Y_,OD,MD,lb,zs,cm,jE,HE,C2,BE,zE,WE,Z_,k2,cb,VE,E2,T2,UE,PD,L2,$2,hw,X_,FD,qE,I2,yi,Q_,GE,KE,dm,JE,R2,D2};
|
|
5
|
-
|
|
6
|
-
//# debugId=11E3B7C052805D3664756E2164756E21
|
|
7
|
-
//# sourceMappingURL=studio-ed3xx40h.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{Ot,Wi,cn,ur,Oa}from"./studio-z97c48fk.js";import{C}from"./studio-43sd2mam.js";import{Fn,Xc,St,zi,Se,$o,We,Jd,u}from"./studio-c05wdnt3.js";import{Io}from"./studio-8tr6cfrc.js";import{Q}from"./studio-nqxqf8p2.js";import{om}from"./studio-df0baea9.js";import{Sa}from"./studio-3exxhz5g.js";import{QD,BT}from"./studio-tf9jryb1.js";import{ko}from"./studio-d5grtb9e.js";import{_r,Qu}from"./studio-rj9eamf8.js";import{sw,ob}from"./studio-ccv2svc6.js";import{ib}from"./studio-03ct6yfv.js";import{Pl}from"./studio-txf2kysx.js";import{wa,Ac,ZE}from"./studio-mx1smyq0.js";import{ls,db}from"./studio-tft6r105.js";import{v}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";var Xg=["page","collection","template","component","media","entry"],ew={collection:{cta:"Create collection",hint:"Posts, products, team… with a page each",icon:"stack",id:"collection",label:"Collection",nameLabel:"Collection name",placeholder:"Recipes"},component:{cta:"Create component",hint:"A reusable block for any page",icon:"cube",id:"component",label:"Component",nameLabel:"Component name",placeholder:"Pricing table"},entry:{cta:"Create entry",hint:"A new item in a collection",icon:"file-text",id:"entry",label:"Entry",nameLabel:"Entry name",placeholder:"My first post"},media:{cta:"Upload",hint:"Images, video, documents",icon:"image",id:"media",label:"Media",nameLabel:"",placeholder:""},page:{cta:"Create page",hint:"A new URL on your site",icon:"file",id:"page",label:"Page",nameLabel:"Page name",placeholder:"Pricing"},template:{cta:"Create template",hint:"Shared frame that pages sit inside",icon:"frame-corners",id:"template",label:"Template",nameLabel:"Template name",placeholder:"Landing"}},Bs="blank",Nc="article",F_="selection",nm="copy",tw=["title","image","richText","date","tags","number","link"],j_={date:{key:"date",label:"Date",schema:{format:"date",type:"string"}},image:{key:"cover",label:"Image",schema:{format:"image",type:"string"}},link:{key:"link",label:"Link",schema:{format:"uri",type:"string"}},number:{key:"number",label:"Number",schema:{type:"number"}},richText:{key:null,label:"Rich text",schema:null},tags:{key:"tags",label:"Tags",schema:{items:{type:"string"},type:"array"}},title:{key:"title",label:"Title",schema:{type:"string"}}},gE=["title","image","richText"];function p(e,n){return e==="."||e===""?n:`${e}/${n}`}function el(e){return e.replace(/^\.\//,"")}function H_(e,n){let t=n.defaultLayout;if(e===Bs||e==="")return t?!1:void 0;if(t&&el(t)===el(e))return;return e}function Fu(e){let n=e.defaultLayout;if(n)return e.layouts.find((r)=>el(r.ref)===el(n))?.ref??n;return e.layouts[0]?.ref??Bs}function B_(e,n){let t=Fn(n??"");if(t!==null){let r=e.layouts.find((o)=>el(o.ref).replace(/\.json$/i,"").split("/").some((l)=>Fn(l)===t));if(r)return r.ref}return Fu(e)}function R(e){return e.trim().replaceAll("\\","/").split("/").map((n)=>ls(n)).filter((n)=>n!=="")}function I(e){let n={};for(let r of tw){let o=j_[r];if(e.includes(r)&&o.key!==null&&o.schema!==null)n[o.key]={...o.schema}}let t={properties:n,type:"object"};if(e.includes("title"))t.required=["title"];return t}function uD(e,n){let t=e?.properties??{};return tw.filter((r)=>{let{key:o}=j_[r];return o===null?n:Object.hasOwn(t,o)})}function w(e,n){let t=ZE(e.schema);if(n!==void 0&&n!==""&&e.schema?.properties?.title!==void 0)t.title=n;if(e.ext===".json"||e.formatName===null)return{doc:t,format:null};return{doc:{...t,children:[]},format:e.formatName,frontmatter:Object.keys(t).length>0}}function bE(e,n,t,r){let o=[];if(n.includes("title"))o.push({tagName:"h1",textContent:"${state.entry.data.title}"});if(n.includes("image"))o.push({attributes:{alt:n.includes("title")?"${state.entry.data.title}":"",loading:"lazy",src:"${state.entry.data.cover}"},tagName:"img"});if(n.includes("richText")&&r.contentFormat!==null)o.push({children:"${state.entry.$children}",tagName:"div"});let i={};if(t!==void 0)i.$layout=t;return i.$paths={contentType:e,field:"id",param:"slug"},i.title=n.includes("title")?"${state.entry.data.title}":Qu(e),i.state={entry:{$prototype:"ContentEntry",$src:"@jxsuite/parser/ContentEntry.class.json",contentType:e,field:"id",id:{$ref:"#/$params/slug"}}},i.tagName="article",i.children=o,i}function im(e,n){let t=n.i18n??null,r=Fn(e);return t!==null&&r!==null&&t.locales.includes(r)?r:null}function Qg(e){return e.dir.includes(Io)}function _(e,n){return e.localeDirs?.[n]??e.dir.replace(Io,n.toLowerCase())}function E(e,n,t){let r=t.i18n??null;if(n===null||r===null)return e;return Xc(e,n,{...r,locales:[...r.locales]})??e}function J(e){let n=e.lastIndexOf("/");return n===-1?[".",e]:[e.slice(0,n),e.slice(n+1)]}function W(e,n,t){if(n.startFrom===nm&&n.copyOf!==void 0){let r=t.componentDocs?.get(n.copyOf);if(r){let o=JSON.parse(JSON.stringify(r));return delete o.$id,o.tagName=e,o}}return{children:[],tagName:e}}function B(e,n,t){let r=n.startFrom??Fu(t),o=r===Nc&&t.article!==null?t.article:null,i=o?.ext??".json",l=n.url===void 0?[ls(e)].filter((m)=>m!==""):R(n.url),a=l.length===0?n.url===void 0?"":"index":l.at(-1),s=["pages",...l.slice(0,-1)].join("/"),c=a===""?"":`${a}${i}`,f=im(n.locale,t),d=c===""?p(s,c):E(p(s,c),f,t),b=c===""?s:J(d)[0],g=e.trim(),y;if(o)y={doc:{children:[{tagName:"h1",textContent:g}],title:g},format:o.name,frontmatter:!0};else{let m={},h=H_(r===Nc?Bs:r,t);if(h!==void 0)m.$layout=h;m.title=g,m.tagName="main",m.children=[{tagName:"h1",textContent:g}],y={doc:m,format:null}}let N=c===""?"":_r(d).urlPattern;return{content:y,dir:b,ext:i,extraWrites:[],fileName:c,kind:"page",path:d,route:N,saved:c===""?"":`Saved as ${d} · opens at ${N}`}}function K(e,n,t){let r=ls(e),o=n.fields??gE,i=t.i18n??null,l=i!==null&&n.localized!==!1,a=`content/${r}`,s=l?`${a}/${i.defaultLocale.toLowerCase()}`:a,c=t.contentFormat,f=c?.ext??".json",d=Qu(r),b=r===""?"":`first-${d.replaceAll(" ","-")}${f}`,g=I(o),y=structuredClone(g),N={format:c?.name??"json",schema:v(y)?y:{},source:l?`./${a}/${Io}`:`./${a}`},m=w({ext:f,formatName:c?.name??null,schema:g},`First ${d}`),h=[],k,L="";if(n.ownPage!==!1&&r!==""){let j=n.pageTemplate??Fu(t),D=l?[i.defaultLocale,...i.locales.filter((x)=>x!==i.defaultLocale)]:[null],T=[];for(let x of D){let O=E(`pages/${r}/[slug].json`,x,t),A=x===null||j!==Fu(t)?j:B_(t,x);k??=_r(O).urlPattern,h.push({body:{doc:bE(r,o,H_(A,t),t),format:null},path:O}),T.push(O)}L=T.length===1?`, and ${T[0]} at ${k}`:`, and a page in each language (${T.join(", ")})`}let P={config:{entry:N,name:r},content:m,dir:s,ext:f,extraWrites:h,fileName:b,kind:"collection",path:p(s,b),saved:r===""?"":l?`Adds a “${r}” collection to project.json with one folder per language under ${a}/, a first entry in ${s}/${L}.`:`Adds a “${r}” collection to project.json, a ${s}/ folder with a first entry${L}.`};if(k!==void 0)P.route=k;return P}function M(e,n){let t=ls(e),r=t===""?"":`${t}.json`,o=p("layouts",r),i={},l=n.startFrom??"";if(l!==""&&l!==Bs)i.$layout=l;return i.tagName="div",i.children=[{children:[{tagName:"slot"}],tagName:"main"}],{content:{doc:i,format:null},dir:"layouts",ext:".json",extraWrites:[],fileName:r,kind:"template",path:o,saved:r===""?"":`Saved as ${o} with one slot.`}}function z(e,n,t){let r=ob(e),o=r===""?"":`${r}.json`,i=p("components",o);return{content:{doc:W(r,n,t),format:null},dir:"components",ext:".json",extraWrites:[],fileName:o,kind:"component",path:i,saved:o===""?"":`Saved as ${i} with tag <${r}>.`,tag:r}}function U(e,n,t){let r=t.collections.find((d)=>d.name===n.collection)??null,o=ls(e),i=r?.ext??".json",l=im(n.locale,t),a=r!==null&&Qg(r)&&l===null,s=r===null?"content":Qg(r)&&l!==null?_(r,l):r.dir,c=o===""||r===null||a?"":`${o}${i}`,f=p(s,c);return{content:r?w(r,e.trim()):{doc:{},format:null},dir:s,ext:i,extraWrites:[],fileName:c,kind:"entry",path:f,saved:c===""?"":`Saved as ${f} in ${r.name}.`}}function vE(e,n,t,r){switch(e){case"page":return B(n,t,r);case"collection":return K(n,t,r);case"template":return M(n,t);case"component":return z(n,t,r);case"entry":return U(n,t,r);default:{let o=t.files??0;return{content:{doc:{},format:null},dir:Sa,ext:"",extraWrites:[],fileName:"",kind:e,path:Sa,saved:o===0?`Saved under ${Sa}/. No folder to choose.`:`${o===1?"1 file":`${o} files`} will be saved under ${Sa}/.`}}}}function q(e,n){let t=e.lastIndexOf("/"),r=t===-1?".":e.slice(0,t),o=n(r);return db(e.slice(t+1),"",{dir:r,taken:o??new Set})}function S(e){if(e.kind!=="page"||e.fileName==="")return[];let n=e.fileName.slice(0,e.fileName.length-e.ext.length);if(n!=="index")return[{dir:e.dir,stem:n},{dir:p(e.dir,n),stem:"index"}];let t=e.dir.lastIndexOf("/");if(t===-1)return[{dir:e.dir,stem:n}];return[{dir:e.dir,stem:n},{dir:e.dir.slice(0,t),stem:e.dir.slice(t+1)}]}function V(e,n){let t=e.fileName.toLowerCase();for(let{dir:r,stem:o}of S(e)){let i=`${o.toLowerCase()}.`;for(let l of n(r)??[])if(l.startsWith(i)&&!(r===e.dir&&l===t))return p(r,l)}return null}function H(e){return db(e,"",{choice:{ext:"",kind:"fixed"},dir:".",taken:new Set})}function yE(e,n,t,r,o){if(e.kind==="media")return(t.files??0)===0?"Drop files here, or browse for them.":"";let i=H(n);if(i!=="")return i;switch(e.kind){case"page":{if(t.url!==void 0){if(t.url.replaceAll("\\","/").split("/").includes(".."))return"A URL cannot step outside the site.";if(!t.url.trim().startsWith("/"))return"A URL starts with a slash, such as /pricing."}let a=V(e,o);if(a!==null)return`${a} already opens at ${e.route??"/"}.`;break}case"component":{let a=e.tag??"",s=sw(a);if(s!=="")return s;if(r.componentTags.includes(a))return`A component named <${a}> already exists.`;if(t.startFrom===F_&&r.hasSelection!==!0)return"Select an element on the canvas to make a component from it.";if(t.startFrom===nm&&(t.copyOf===void 0||r.componentDocs?.get(t.copyOf)===void 0))return"Choose the component to copy.";break}case"collection":{let a=e.config?.name??"";if(r.declaredContent.includes(a))return`A collection named “${a}” already exists.`;if(o("content")?.has(a)===!0)return`content/${a}/ already exists.`;break}case"entry":{let a=r.collections.find((s)=>s.name===t.collection);if(!a)return"Choose the collection this entry belongs to.";if(Qg(a)&&im(t.locale,r)===null)return`Choose the language this ${Qu(a.name)} is written in.`;break}default:break}let l=[...e.kind==="collection"?[]:[e.path],...e.extraWrites.map((a)=>a.path)];for(let a of l){let s=q(a,o);if(s!=="")return s}return""}function wE(e){let n=new Set,t=(r)=>{let o=r.lastIndexOf("/");n.add(o===-1?".":r.slice(0,o))};if(e.kind==="media")return[];if(e.kind==="collection")n.add("content");else if(e.fileName!=="")t(e.path);for(let r of e.extraWrites)t(r.path);for(let{dir:r}of S(e))n.add(r);return[...n]}function hD(e){let n=(r)=>r==="."?0:r.split("/").length,t=new Map;for(let r of e){let o=n(r);t.set(o,[...t.get(o)??[],r])}return[...t.entries()].toSorted(([r],[o])=>r-o).map(([,r])=>r)}function pD(e,n){if(e===".")return!1;let t=e.lastIndexOf("/"),r=n.get(t===-1?".":e.slice(0,t));return r!==void 0&&!r.has(e.slice(t+1).toLowerCase())}function z_(e){if(e.ext===".json")return null;return(e.def.format?Wi(e.def.format)?.name:void 0)??cn(`untitled${e.ext}`)?.name??ur()?.name??null}async function G(e){let n=w({ext:e.ext,formatName:z_(e),schema:e.schema});if(n.format===null)return ko(n.doc,null);return Oa(n.format,n.doc,{frontmatter:n.frontmatter??!1,mode:"roundtrip"})}async function K2(e,n={}){let t=wa(e);if(!t)return C.error(`No content collection named "${e}" to create an entry in.`,{detail:"A collection needs a `content` entry in project.json whose `source` is a directory. A collection whose source names a single file (a CSV catalogue) has rows, not entry files.",source:"Content"}),null;await Ot().catch(()=>{});let r;try{r=await G(t)}catch(s){return C.error(`Could not prepare a new ${t.name} entry.`,{detail:Q(s),path:t.dir,source:"Content"}),null}let o=n.dir,i=o!==void 0&&Jd(o)?.name===t.name?o:t.dir;if(i.includes(Io))return C.error(`"${t.name}" is a localized collection.`,{detail:`Its entries live in one directory per language (${t.dir}). Open the folder for the language you are writing in and create the entry there.`,path:t.dir,source:"Content"}),null;let{createFileIn:l}=await (le("rcn56qvm"),import("./files-rcn56qvm.js")),a=await l({content:r,dir:i,format:{ext:t.ext,kind:"fixed"},source:"Content",suggestedName:"untitled",title:`New ${t.name} entry`});if(a===null)return null;return om(t.name),await Pl(a),a}function F(){let e=u.value;return e&&Ac(e.documentPath)?e:null}function Y(){return[{args:Se({path:We("Project-relative path of the entry file to open.")}),category:"File",id:"content.openEntry",level:"project",menus:["context/file","palette"],group:"1_file",requires:"an open project",when:(e)=>e.project.open,run:async(e,n)=>{await Pl(St("content.openEntry",n,"path"))},title:"Open Entry"},{args:Se({draft:$o("True marks the open entry a draft; false marks it published. Written as a `draft` field on the entry.")}),category:"Document",id:"content.setDraft",level:"document",menus:["context/tab","palette"],group:"3_document",requires:"a content entry open",when:(e)=>e.document.open,enablement:()=>F()!==null,undo:"document",run:(e,n)=>{let t=F();if(!t)throw Error("content.setDraft: the active document is not a content entry");ib(t,zi("content.setDraft",n,"draft"))},title:"Set Draft"},{args:Se({include:$o("True lists entries marked `draft: true` alongside the rest.")}),category:"View",id:"content.setIncludeDrafts",level:"project",menus:["palette"],group:"2_view",requires:"an open project",when:(e)=>e.project.open,run:async(e,n)=>{QD(zi("content.setIncludeDrafts",n,"include")),await BT()},title:"Include Drafts"}]}function xE(e){e.registerAll(Y())}
|
|
2
|
-
export{Xg,ew,Bs,Nc,F_,nm,tw,j_,gE,el,H_,Fu,B_,uD,bE,im,Qg,vE,yE,wE,hD,pD,z_,K2,xE};
|
|
3
|
-
|
|
4
|
-
//# debugId=B1DDB98C27645B8564756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-f14e1zdj.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{p,_e}from"./studio-w4rz9hdk.js";import{Q}from"./studio-nqxqf8p2.js";import{te}from"./studio-vxq7fcvv.js";function ph(){return _e()&&te(p().findReferences)}function u(e){return`${e.path??""}\x00${e.tagName??""}`}var i=new Map,o=new Map;function al(e){if(!ph())return{status:"unsupported"};return i.get(u(e))??(o.has(u(e))?{status:"pending"}:null)}async function ar(e){if(!ph())return{status:"unsupported"};if(!e.path&&!e.tagName)return{status:"failed",message:"no target to look for"};let t=u(e),s=i.get(t);if(s)return s;let r=o.get(t);if(r)return r;let n={};if(e.path!==void 0)n.path=e.path;if(e.tagName!==void 0)n.tagName=e.tagName;let a=(async()=>{try{return{result:await p().findReferences(n),status:"ready"}}catch(c){return{message:Q(c),status:"failed"}}})();o.set(t,a);let d=f,l=await a;if(o.get(t)===a)o.delete(t);if(d!==f)return l;return i.set(t,l),l}function $$(e){return i.delete(u(e)),ar(e)}var f=0,g=new Set;function Er(){f+=1,i.clear(),o.clear();for(let e of g)e()}function Yb(e){return g.add(e),()=>{g.delete(e)}}function wC(e){let t=0;for(let s of e.files)if(s.path.startsWith("pages/"))t+=1;return{others:e.files.length-t,pages:t}}function Zb(e){let{others:t,pages:s}=wC(e);if(s===0&&t===0)return"Not used yet";let r=t===1?"file":"files";if(s===0)return`Used in ${t} ${r}`;let n=`Used on ${s} page${s===1?"":"s"}`;return t===0?n:`${n} and ${t} other ${r}`}function I$(e,t){if(e.status==="unsupported")return null;if(e.status==="pending")return"Counting references…";if(e.status==="failed")return`References could not be counted (${e.message}) — this may break more than it appears to.`;let{files:s,refsTotal:r}=e.result;if(s.length===0)return t==="delete"?"Nothing else in this project refers to it.":"Nothing else in this project refers to it, so nothing needs updating.";let n=`${r} reference${r===1?"":"s"} in ${s.length} file${s.length===1?"":"s"}`,a=e.result.errors.length>0?" (at least — some documents could not be read)":"";if(t==="delete")return`${n}${a} will break. Those files stay on disk; the references in them stop resolving.`;if(t==="convert")return`${n}${a} will be updated automatically to point at the new file.`;return`${n}${a} will be updated automatically. Nothing else changes.`}function Xb(e){return e.files.toSorted((t,s)=>s.count-t.count||t.path.localeCompare(s.path))}
|
|
2
|
-
export{ph,al,ar,$$,Er,Yb,wC,Zb,I$,Xb};
|
|
3
|
-
|
|
4
|
-
//# debugId=39E7419F0667812364756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-fyh0jc96.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{n,Z,Xe,te,S,v,Ie,Yo,_n,rf,it}from"./studio-vxq7fcvv.js";var gv=400;var Yp=350,jC=300,VO=30000;function lr(e){return Array.isArray(e?.children)?e.children:[]}function bv(e,t,i=""){if(!S(e))return e;if(Array.isArray(e)){for(let[l,s]of e.entries())bv(s,t,`${i}/${l}`);return e}let r=e,{children:o}=r;if(Yo(o)){let l=o;t?.(i,l),r.children=[l]}if(Array.isArray(r.children))for(let[l,s]of r.children.entries())bv(s,t,`${i}/children/${l}`);if(r.$prototype==="Array"&&S(r.map))bv(r.map,t,`${i}/map`);if(S(r.cases))for(let[l,s]of Object.entries(r.cases))bv(s,t,`${i}/cases/${Y$(l)}`);return e}function Y$(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function At(e){return e.length>=2?e.slice(0,-2):null}function hi(e){return e.at(-1)}function Z$(e){return e.join("/")}function $r(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;return e.every((i,r)=>i===t[r])}function nc(e,t){if(e.length>t.length)return!1;return e.every((i,r)=>i===t[r])}function _h(e,t=[],i=0){let r=[];return u(e,t,i,r,!1),r}function u(e,t,i,r,o){if(n(e)||Z(e)||Xe(e)){if(!o)r.push({depth:i,node:e,nodeType:"text",path:t});return}if(e.$prototype==="Array"){if(!o)r.push({depth:i,node:e,nodeType:"map",path:t});let s=e.map;if(S(s))u(s,[...t,"map"],i+1,r,!1);return}if(!o)r.push({depth:i,node:e,nodeType:"element",path:t});if(e.$props&&it(e.tagName).includes("-")&&!Array.isArray(e.children))return;let{children:l}=e;if(Array.isArray(l))for(let s=0;s<l.length;s++){let a=[...t,"children",s];u(l[s],a,i+1,r,!1)}else if(Yo(l))u(l,[...t,"children"],i+1,r,!1);if(e.$switch&&S(e.cases))for(let[s,a]of Object.entries(e.cases)){let p=[...t,"cases",s];if(S(a)&&a.$ref)r.push({depth:i+1,node:a,nodeType:"case-ref",path:p});else if(S(a))r.push({depth:i+1,node:a,nodeType:"case",path:p}),u(a,p,i+2,r,!0)}}function Ir(e){if(!e)return"?";if(e.$prototype==="Array"){let{items:r}=e;return`Repeater → ${(Ie(r)?r.$ref:void 0)||"items"}`}if(e.$title)return e.$title;if(e.$id)return e.$id;if(e.tagName==="slot"){let r=e.attributes?.name;return n(r)&&r.trim()?`slot: ${r.trim()}`:"slot"}let t=it(e.tagName)||"div",i=e.$switch?" ⇆":"";if(n(e.textContent)&&e.textContent.length>0)return`${t} — ${e.textContent.slice(0,24)}${i}`;return t+i}var x=null;function id(e){x=e}function wn(){return x}function Sh(e){return S(e)}function Zp(e){if(Array.isArray(e))return e.map((i)=>Zp(i));if(!_n(e))return e;let t={};for(let[i,r]of Object.entries(e)){if(i.startsWith("on")&&rf(r))continue;if(i==="children")t.children=Array.isArray(r)?r.map((o)=>Zp(o)):Zp(r);else if(i==="cases"&&Sh(r)){let o={};for(let[l,s]of Object.entries(r))o[l]=Zp(s);t.cases=o}else if(i==="state"&&Sh(r)){let o={};for(let[l,s]of Object.entries(r)){if(v(s)&&s.timing==="server")continue;o[l]=s}t.state=o}else t[i]=r}return t}var HC=null,Ch=null,X$=null,Q$=null,eI=null;function c(e){let t=document.querySelector(`#${e}`);return t instanceof HTMLElement?t:null}function UO(){HC=c("activity-bar"),Ch=c("left-panel"),X$=c("right-panel"),Q$=c("toolbar"),eI=c("statusbar")}function Xp(e,t){if(!e)throw TypeError(`#${t} is not in the shell yet; initShellRefs() has not found it`);return e}var Vm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),tI=[":hover",":focus",":active",":focus-within",":focus-visible",":disabled",":first-child",":last-child","::before","::after","::placeholder"];function Wx(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}var f=new Map;function Vx(e,t,i){let r=t??gv;return(...o)=>{clearTimeout(f.get(e)),f.set(e,setTimeout(()=>{f.delete(e),i(...o)},r))}}function qO(e){clearTimeout(f.get(e)),f.delete(e)}var m=new Map;function y(e){return(S(e)||te(e))&&"then"in e&&te(e.then)}var d=0;function GO(){return d}function h(e,t){d+=1;let i=()=>{d-=1},r=null;try{let o=t();if(y(o))r=o}catch(o){console.error(`Renderer "${e}" failed:`,o)}if(!r){i();return}r.then(i,(o)=>{console.error(`Renderer "${e}" failed:`,o),i()})}function Um(e,t){m.set(e,t)}function cr(){for(let[e,t]of m.entries())h(e,t)}function xn(...e){for(let t of e){let i=m.get(t);if(!i)continue;h(t,i)}}function dl(e,t){if(e){if(t.selection!==void 0)e.session.selection=t.selection;if(t.hover!==void 0)e.session.hover=t.hover;if(t.clipboard!==void 0)e.session.clipboard=t.clipboard;if(t.ui)Object.assign(e.session.ui,t.ui);if(t.canvas)Object.assign(e.session.canvas,t.canvas)}}function Da(e,t,i){if(e)e.session.ui[t]=i}function KO(e,t){if(e)Object.assign(e.session.canvas,t)}
|
|
2
|
-
export{gv,Yp,jC,VO,lr,bv,Y$,At,hi,Z$,$r,nc,_h,Ir,x,id,wn,Sh,Zp,HC,Ch,X$,Q$,eI,UO,Xp,Vm,tI,Wx,Vx,qO,GO,Um,cr,xn,dl,Da,KO};
|
|
3
|
-
|
|
4
|
-
//# debugId=4062451AE00E330A64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-gcxk20n7.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{he,C}from"./studio-43sd2mam.js";import{te,S}from"./studio-vxq7fcvv.js";var st={functionEditor:null,blockActionBarEl:null,selDragCleanup:null,dndCleanups:[],elementsCollapsed:new Set,elementsFilter:"",_currentDropTargetRow:null,layerDragSourceHeight:0,_completionRegistered:!1,_layersCollapsed:null};var m=0;function HO(){return m+=1,m}var l=new Map;function vo(e){let r=l.get(e);if(!r)r=v(e),l.set(e,r);return r}function v(e){return{centerObserver:null,monacoDiffEditor:null,monacoEditor:null,needsCenter:!0,panX:0,panY:0,panels:[],paneId:e,panzoomWrap:null,stage:null,prevCanvasMode:null,prevStylebookCustomizedOnly:null,prevStylebookFilter:null,renderGeneration:0,sourceCollabCleanup:null,stageScrollbar:null,wrap:null}}function xh(e){return e.wrap}function qp(){return[...l.values()]}function nd(e){if(!e)return null;for(let r of l.values())if(xh(r)?.contains(e))return r;return null}function g(e){for(let r of e.panels)r.renderScope?.stop(),r.renderScope=null;e.panels.length=0,e.prevCanvasMode=null}function BO(e,r){let t=vo(e);return t.wrap=r,g(t),t}function zO(e){if(l.get(e))K$(e);let t=v(e);return l.set(e,t),t}var b=null;function WO(e){b=e}function K$(e){let r=l.get(e);if(!r)return;b?.(r),g(r),T(e)}function T(e){l.delete(e)}var Gp="commit";function h(e){return S(e)&&te(e.then)}function fv(e){let r=new Map,t=new Map,o=new Map,a=!1,u=!1,c=!1;function f(n,i){if(!h(i))return i;let s=i.finally(()=>{if(o.get(n)===s)o.delete(n)});return o.set(n,s),s}let d={arm(n,i,s){clearTimeout(r.get(n)),t.set(n,s),r.set(n,setTimeout(()=>{r.delete(n),t.delete(n),f(n,s())},i))},cancel(){for(let n of r.values())clearTimeout(n);r.clear(),t.clear()},flush(n){let i=t.get(n);if(!i)return o.get(n);return clearTimeout(r.get(n)),r.delete(n),t.delete(n),f(n,i())},ahead:()=>a,markAhead(){a=!0},typed:()=>u,markTyped(){a=!0,u=!0},markSettled(){a=!1,u=!1},shared:()=>c,markShared(){c=!0}};return e._writes=d,d}var M={logic:{holds:"The handler you were typing",reached:"written into",source:"Logic"},source:{holds:"The source you were typing",reached:"parsed into",source:"Editor"}};function p(e,r,t){if(e._writes?.typed()!==!0)return!0;let a=e._editingTab??null,u=a?.documentPath??"Untitled",{holds:c,reached:f,source:d}=M[r],n=t?{detail:w(t.error)}:{};if(n.key=`buffer-discarded:${r}:${a?.id??"none"}`,n.source=d,a?.documentPath)n.path=a.documentPath;return C.warn(`${c} was discarded — it was never ${f} "${u}".`,n),!1}function w(e){return e instanceof Error?e.stack??e.message:String(e)}function mv(e,r){let t=e?._writes;if(!e||!t)return!0;let o;try{o=t.flush(Gp)}catch(a){return t.cancel(),p(e,r,{error:a})}if(t.cancel(),h(o))return o.then(()=>p(e,r,null),(a)=>p(e,r,{error:a})),!0;return p(e,r,null)}function J$(e){e?._writes?.cancel()}function Xd(e){return Boolean(e?.getModel())}function Kp(e,r){if(!Xd(e)||e.hasTextFocus()||e._writes?.ahead()||e._writes?.shared())return!0;return r!==void 0&&e.getValue()!==r}function y(e){let r=he(e);return[...qp().map((o)=>o.monacoEditor),st.functionEditor].filter((o)=>o!=null&&o._editingTab!=null&&he(o._editingTab)===r&&Xd(o))}async function Qd(e){for(let r of y(e)){if(!Xd(r))continue;try{await r._writes?.flush(Gp)}catch(t){let o={detail:w(t),key:`buffer-commit:${e.id}`,source:"Editor"};if(e.documentPath)o.path=e.documentPath;C.error(`Could not save the editor's contents into "${e.documentPath??"Untitled"}".`,o)}}}function Jp(e){return y(e).some((r)=>r._writes?.typed()===!0)}
|
|
2
|
-
export{st,HO,vo,xh,qp,nd,BO,zO,WO,K$,Gp,fv,mv,J$,Xd,Kp,Qd,Jp};
|
|
3
|
-
|
|
4
|
-
//# debugId=35D0755B3E69539A64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-kt3pjkwd.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{xx,Xl,ll,m,_i,Bt}from"./studio-c05wdnt3.js";import{hS,xw,LT}from"./studio-qwdqwkj0.js";import{eE,tE,QR}from"./studio-pgmvdv7z.js";import{o_,r_,Ek}from"./studio-a2bvaptz.js";var n={children:[],tagName:"div"},_2=new Set(Object.values(xx));function n_(e){return _2.has(e)}function xk(e){let o=Xl(e),r=m.tabs.get(o);if(r)return Bt(o),r;return _i({capabilities:{modes:[xx[e]]},document:structuredClone(n),documentPath:null,id:o})}function _k(e,o){_i({background:!0,capabilities:{modes:[xx[e]]},document:structuredClone(n),documentPath:null,id:Xl(e),paneId:o})}function i_(e,o){let r=ll(o.id);if(r==="media")return hS(e,o);if(r==="content")return eE(e,o);return o_(e,o)}function Og(e){xw(e),tE(e),r_(e)}function Sk(e,o){let{paneId:r}=e;if(i_(r,o))return;Og(r);let t=ll(o.id);if(t==="media"){LT(e,o);return}if(t==="content"){QR(e,o);return}Ek(e,o)}
|
|
2
|
-
export{_2,n_,xk,_k,i_,Og,Sk};
|
|
3
|
-
|
|
4
|
-
//# debugId=8DED0E14628C946464756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-m8g16bgz.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{yh}from"./studio-c05wdnt3.js";import{mb}from"./studio-tf9jryb1.js";import{x}from"./studio-gcxk20n7.js";import{n,S}from"./studio-vxq7fcvv.js";function YE(){return Object.keys(x?.projectConfig?.content??{})}function wa(e){let t=mb(e);if(!t)return null;if(/\.[a-z\d]+$/i.test(t.dir))return null;return{def:t.def,dir:t.dir,ext:t.ext,name:t.name,schema:t.def.schema??null}}function gw(){return YE().map((e)=>wa(e)).filter((e)=>e!==null)}function Ac(e){let t=yh(e??null,x?.projectConfig);return t?wa(t.name):null}function HD(e){let t=yh(e??null,x?.projectConfig),r=t?mb(t.name):null;if(!t||!r)return null;return{def:r.def,dir:r.dir,ext:r.ext,name:r.name,schema:t.schema}}function c(e){if(e===null||!S(e))return e;return JSON.parse(JSON.stringify(e))}function u(e){if(n(e.$ref))return"";switch(e.type){case"boolean":return!1;case"integer":case"number":return 0;case"array":return[];case"object":return ZE(e);default:return""}}function ZE(e){let t=e?.properties;if(!t)return{};let r=new Set(Array.isArray(e.required)?e.required:[]),o={};for(let[i,l]of Object.entries(t))if(l.default!==void 0)o[i]=c(l.default);else if(r.has(i))o[i]=u(l);return o}function BD(e,t){return(Array.isArray(e?.required)?e.required:[]).filter((o)=>t[o]===void 0)}
|
|
2
|
-
export{YE,wa,gw,Ac,HD,ZE,BD};
|
|
3
|
-
|
|
4
|
-
//# debugId=EF9BEB41768252A764756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-mx1smyq0.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{Z,S}from"./studio-vxq7fcvv.js";function p(t){return JSON.parse(JSON.stringify(t))}function $e(t){return t===void 0||t===null?t:p(t)}function oe(t,e){let n=t;for(let r of e){if(n==null)return;n=n[r]}return n}function vv(t){if(Array.isArray(t))throw TypeError("Cannot insert into a children array; parentPath must point at a node");if(!t.children)t.children=[];if(!Array.isArray(t.children))throw TypeError("Cannot insert into mapped-array children; edit the map template instead");return t.children}function yv(t,e){let{op:n}=e;switch(e.op){case"set-key":{let r=oe(t,e.path);if(!r)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);if(e.value===void 0)delete r[e.key];else r[e.key]=$e(e.value);return}case"insert-child":{i(t,e.parentPath).splice(e.index,0,$e(e.node));return}case"remove-child":{i(t,e.parentPath).splice(e.index,1);return}case"set-child":{i(t,e.parentPath).splice(e.index,1,$e(e.node));return}case"move-child":{x(e);let r=i(t,e.fromParentPath),o=i(t,e.toParentPath),[a]=r.splice(e.fromIndex,1);o.splice(e.toIndex,0,a);return}default:break}throw Error(`unknown-doc-op:${n}`)}function i(t,e){let n=oe(t,e);if(n==null)throw TypeError(`doc-op-node-not-found:${e.join("/")}`);return vv(n)}function h(t,e,n,r,o){let a=t.length,m=a<e.length&&t.every((J,b)=>J===e[b]),d=e[a+1];if(!m||e[a]!=="children"||!Z(d))return e;if(o?d<n:d<=n)return e;let c=[...e];return c[a+1]=d+r,c}function x(t){let e=[...t.fromParentPath,"children",t.fromIndex],n=t.toParentPath;if(n.length>=e.length&&e.every((r,o)=>r===n[o]))throw Error(`doc-op-move-into-self:${n.join("/")}`)}function u(t,e){return t<0?Math.max(e+t,0):Math.min(t,e)}function nI(t,e){let{op:n}=e;switch(e.op){case"set-key":{let r=oe(t,e.path);if(!r)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);let o=$e(r[e.key]);return o===void 0?{key:e.key,op:"set-key",path:e.path}:{key:e.key,op:"set-key",path:e.path,value:o}}case"insert-child":{let{length:r}=l(t,e.parentPath);return{index:u(e.index,r),op:"remove-child",parentPath:e.parentPath}}case"remove-child":{let r=s(t,e.parentPath,e.index);return{index:e.index,node:r,op:"insert-child",parentPath:e.parentPath}}case"set-child":{let r=s(t,e.parentPath,e.index);return{index:e.index,node:r,op:"set-child",parentPath:e.parentPath}}case"move-child":{x(e);let r=f(t,e.fromParentPath);P(r,e.fromParentPath,e.fromIndex);let o=l(t,e.toParentPath),a=u(e.toIndex,o.length-(o===r?1:0));return{fromIndex:a,fromParentPath:h(e.fromParentPath,e.toParentPath,e.fromIndex,-1,!1),op:"move-child",toIndex:e.fromIndex,toParentPath:h(e.toParentPath,e.fromParentPath,a,1,!0)}}default:break}throw Error(`unknown-doc-op:${n}`)}function f(t,e){let n=oe(t,e);return n&&Array.isArray(n.children)?n.children:null}function P(t,e,n){if(!t||n<0||n>=t.length)throw Error(`doc-op-node-not-found:${[...e,"children",n].join("/")}`)}function s(t,e,n){let r=f(t,e);return P(r,e,n),$e(r[n])}function l(t,e){let n=oe(t,e);if(!S(n)||Array.isArray(n))throw Error(`doc-op-node-not-found:${e.join("/")}`);if(n.children===void 0)return[];if(!Array.isArray(n.children))throw TypeError(`doc-op-mapped-children:${e.join("/")}`);return n.children}
|
|
2
|
-
export{$e,oe,vv,yv,nI};
|
|
3
|
-
|
|
4
|
-
//# debugId=41400A1B304443BF64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-p4nrkvqr.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{p,_e}from"./studio-w4rz9hdk.js";import{ks}from"./studio-tf9jryb1.js";import{Q}from"./studio-nqxqf8p2.js";import{ge,ne,g,C}from"./studio-43sd2mam.js";import{wi,T,R,rt,xi}from"./studio-x9hsze61.js";import{Vt,Qt,Hi,ev}from"./studio-c05wdnt3.js";import{Us}from"./studio-y0n7yxea.js";import{Xt}from"./studio-pbxa5fpc.js";import{Er}from"./studio-fyh0jc96.js";import{Dp}from"./studio-ph84avkf.js";import{rr}from"./studio-3exxhz5g.js";import{_r,Xu,ES,wN,Cb,ci,Fw,CN,Vl,IS,th,EN,kp}from"./studio-rj9eamf8.js";import{vb,yb}from"./studio-q0tccd43.js";import{yi}from"./studio-ed3xx40h.js";import{pp,U_,SE,tb,CE,nw,iw,mD,EE,sm,ow,vD,TE,nb,yD,wD,xD,_D,SD,LE,CD}from"./studio-03ct6yfv.js";import{Pl}from"./studio-txf2kysx.js";import{eS}from"./studio-wys23mxz.js";import{wa}from"./studio-mx1smyq0.js";import{JD,_w,Cw,bp}from"./studio-8vcvfs7r.js";import{vp}from"./studio-e1g64q43.js";import{x,xn}from"./studio-gcxk20n7.js";import{n,te,S,v}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";function ee(e){return{contentType:null,draft:!1,layout:void 0,path:e}}function ue(e,t,a){let{contentType:r,layout:o}=IS(t,a),i=a?.[ks]===!0||t?.[ks]===!0;return{contentType:r,draft:i,layout:o,path:e}}async function De(e){try{let t=await p().readFile(e);if(e.endsWith(".json")){let o=JSON.parse(t);return S(o)&&!Array.isArray(o)?ue(e,o,null):ee(e)}let{parseSourceForPath:a}=await (le("qnab36ek"),import("./file-ops-qnab36ek.js")),r=await a(e,t);return ue(e,r.document,r.frontmatter)}catch{return ee(e)}}var Ie=300,q=null,z=null,ae=0,re=new Set;function me(e){let t=e.join(`
|
|
2
|
-
`);if(q?.key===t)return q.pages;if(!_e())return new Map(e.map((a)=>[a,ee(a)]));if(z?.key!==t){let a=ae,r=Promise.all(e.slice(0,Ie).map((o)=>De(o))).then((o)=>{if(a!==ae||z?.read!==r)return;z=null,q={key:t,pages:new Map(o.map((i)=>[i.path,i]))};for(let i of re)i()});z={key:t,read:r}}return null}function qg(){ae+=1,q=null,z=null}function fe(e){return re.add(e),()=>{re.delete(e)}}function zy(e){return e?"true":"false"}function JR(e){return e.trim().toLowerCase()}function Gg(e,...t){return e===""||t.some((a)=>a.toLowerCase().includes(e))}function Td(e){let t=e.replaceAll(/[-_]+/g," ").trim();return t===""?e:t.charAt(0).toUpperCase()+t.slice(1)}function ie(e){let t=Td(e);if(/ies$/i.test(t))return`${t.slice(0,-3)}y`;if(/[^s]s$/i.test(t))return t.slice(0,-1);return t}function oe(e){let t=e.slice(e.lastIndexOf("/")+1),a=t.lastIndexOf(".");return a>0?t.slice(0,a):t}function Y(e,t,a){let r=Hi(t,a);return r===null?e:`${e} (${r})`}function U(e,t,a=null){if(Hi(t,a)!==null){let c=ev(t,a);return Y(U(_r(c),c),t,a)}if(e.urlPattern==="/")return"Home";let r=e.urlPattern.split("/").filter((c)=>c!==""),o=(c)=>c==="*"||c.startsWith(":"),i=r.at(-1)??oe(t);if(!o(i))return Td(i);let l=r.findLast((c)=>!o(c));return Td(l??oe(t).replaceAll(/[[\].]/g,""))}function YR(e,t,a,r={}){let o=r.i18n??null,i=e.flatMap((u)=>Xu(u.path,r.extensions)?[{fact:u,route:_r(u.path)}]:[]).toSorted((u,m)=>ES(u.route,m.route)||u.fact.path.localeCompare(m.fact.path)),l=[],c=(u,m,f,L)=>({detail:m.urlPattern,key:u.path,kind:f,label:L,path:u.path,selected:zy(u.path===a)}),d=new Map;for(let u of i){let m=u.fact.contentType;if(m!==null&&t.has(m))d.set(m,[...d.get(m)??[],u])}let s=new Set;for(let{fact:u,route:m}of i){let f=u.contentType,L=f===null?void 0:d.get(f);if(f===null||L===void 0){l.push(c(u,m,"page",U(m,u.path,o)));continue}if(s.has(f))continue;s.add(f),l.push({detail:Ve(t.get(f)??null),key:`collection:${f}`,kind:"collection",label:Td(f),path:"",selected:"false"});let H=`${ie(f)} page`;for(let D of L){let N=Y(H,D.fact.path,o);l.push(c(D.fact,D.route,"entry-page",N))}}return l}function Ve(e){if(e===null)return"";return`${e} ${e===1?"entry":"entries"}`}function ZR(e,t){if(t==="")return[...e];let a=[],r=null,o=!1;for(let i of e){if(i.kind==="collection"){if(r=i,o=Gg(t,i.label),o)a.push(i);continue}if(i.kind==="page")r=null;if(i.kind==="entry-page"&&o||Gg(t,i.label,i.detail,i.path)){if(r&&!o)a.push(r),o=!0;a.push(i)}}return a}function ze(e){if(e===null)return"";if(e===0)return"not used yet";return`used by ${e} ${e===1?"page":"pages"}`}function Yk(e,t,a,r,o=null){return e.filter((i)=>i.endsWith(".json")).toSorted((i,l)=>i.localeCompare(l)).flatMap((i)=>{let l=Td(oe(i));if(!Gg(r,l,i))return[];return[{detail:i===o?"default layout":ze(t(i)),key:i,label:l,path:i,selected:zy(i===a)}]})}var Be='img:not([src]), img[src=""] { visibility: hidden; }',he=new WeakMap;function We(e){let t=he.get(e);if(t)return t;let a=e.defaultView?.CSSStyleSheet;if(!te(a))return null;let r=new a;return r.replaceSync(Be),he.set(e,r),r}function Wy(e,t){let a=e.shadowRoot??e.attachShadow({mode:"open"}),r=We(e.ownerDocument);a.adoptedStyleSheets=[...JD(),...e.ownerDocument.adoptedStyleSheets,...r?[r]:[]],a.replaceChildren(t)}function Vy(e){return e.shadowRoot?.firstElementChild??null}function B(e,t){if(e===void 0||e.trim()==="")return[];if(!t)return[e];return e.split(",").map((a)=>a.trim()).filter((a)=>a!=="")}var He=12;function be(e,t,a){let r=e.find((o)=>t.has(o.name));if(r)return{...r,order:t.get(r.name)};for(let o of e){if(o.measure)continue;let i=a.flatMap((c)=>B(c?.fields?.[o.name],o.list)),l=new Set(i).size;if(l>=2&&l<i.length&&l<=He)return{...o,order:[]}}return null}function j(e){return(t)=>e.get(t.path)}var we=j(new Map),de={board:{itemWidth:0,rowHeight:0,windowed:!1},calendar:{itemWidth:0,rowHeight:0,windowed:!1},cards:{itemWidth:200,rowHeight:194,windowed:!0},table:{itemWidth:0,rowHeight:32,windowed:!0}},Ge=60,se=25;function ve(e,t){let a=de[e];if(a.itemWidth<=0||t<=0)return 1;return Math.max(1,Math.floor(t/a.itemWidth))}function qe(e){if(e===void 0||!Number.isFinite(e))return"";if(e<1024)return`${e} B`;let t=["KB","MB","GB"],a=e/1024,r=0;while(a>=1024&&r<t.length-1)a/=1024,r+=1;return`${a<10?a.toFixed(1):Math.round(a)} ${t[r]}`}function Ye(e){return e?vp(new Date(e)):""}function Ue(e,t,a){switch(t){case"date":return a?.date??"";case"status":return a?.status??"";case"template":return a?.template??"";case"title":return a?.title??e.name;case"locale":return e.locale?Vt(e.locale):"";case"modified":return Ye(e.modified);case"name":return e.name;case"path":return e.record?.source??e.path;case"size":return qe(e.size);case"type":return e.type;case"url":return e.collection===ci?_r(e.path).urlPattern:"";default:{let r=_D(t);return r===null?"":a?.fields?.[r]??""}}}function xe(e,t,a,r){let o=Dp(e.ext),i=r?.thumb??"";return{art:o||i!==""?"image":a&&e.collection!==null&&!e.record?"doc":"glyph",cells:t.map((l)=>({field:l.field,text:Ue(e,l.field,r)})),meta:e.type,name:r?.title??e.name,path:e.path,src:o?rr(e.path):i}}function ce(e,t){return{art:"glyph",cells:[],meta:e.type,name:t?.title??e.name,path:e.path,src:""}}function $e(e,t=we){let{days:a,undated:r}=wD(e,(c)=>t(c)?.date||TE(c)),o=a.slice(0,Ge),i=a.length-o.length,l=o.map((c)=>({count:"",files:c.files.map((d)=>ce(d,t(d))),id:c.date,note:"",noteState:"hidden",title:c.date,undated:"false"}));if(r.length>0)l.push({count:"",files:r.slice(0,se).map((c)=>ce(c,t(c))),id:"__undated",note:`${r.length} file${r.length===1?"":"s"} with no dated name and no modification time.`,noteState:"shown",title:"No date",undated:"true"});return{groups:l,truncated:i>0?`${i} older ${i===1?"day is":"days are"} not shown — filter, or switch to Table.`:""}}var ye=["Draft","Published"];function Je(e,t){let a=new Map;for(let o of e){let i=t(o)?.status||"No status",l=a.get(i);if(l)l.push(o);else a.set(i,[o])}let r=(o)=>{let i=ye.indexOf(o);return i===-1?ye.length:i};return[...a.entries()].map(([o,i])=>({files:i,group:o})).toSorted((o,i)=>r(o.group)-r(i.group)||o.group.localeCompare(i.group))}function Ke(e,t,a){let r=`No ${a.title.toLowerCase()}`,o=new Map;for(let l of e){let c=B(t(l)?.fields?.[a.name],a.list);for(let d of c.length===0?[r]:new Set(c)){let s=o.get(d);if(s)s.push(l);else o.set(d,[l])}}let i=(l)=>{if(l===r)return Number.MAX_SAFE_INTEGER;let c=a.order.indexOf(l);return c===-1?a.order.length:c};return[...o.entries()].map(([l,c])=>({files:c,group:l})).toSorted((l,c)=>i(l.group)-i(c.group)||l.group.localeCompare(c.group))}function Se(e,t=we,a=null){return(e.some((i)=>(t(i)?.status??"")!=="")?Je(e,t):a?Ke(e,t,a):xD(e)).map((i)=>{let l=i.files.length-se;return{count:String(i.files.length),files:i.files.slice(0,se).map((c)=>ce(c,t(c))),id:i.group,note:l>0?`${l} more — switch to Table to see them.`:"",noteState:l>0?"shown":"hidden",title:i.group,undated:"false"}})}var Le={$schema:"https://jxsuite.com/schema/v1",$id:"StudioLibraryPane",$description:"The Content home (studio.md §22.5): one collection, browsed, as a Jx document over the kit. The adapter (`browse/library-pane.ts`) keeps every decision — which collection is shown, which of its files the filter kept, which of them the window renders, where the collection is published, and what a row's context menu offers — and hands this document one projection: a discriminant naming which of eight things to draw, the view switch already marked, a header line that is one of four states, and rows that are already strings. Nothing here asks what a file is, how big the viewport is, or whether the scan finished. The eight cases of `view` are the four honest empty states the Manage view collapsed into “No files found” — a scan still running, a scan that could not finish, a collection with nothing in it, and a filter that matched nothing — followed by the four views, so “what is on screen” has exactly one source. A card's live preview is an ISLAND: the document renders `doc-preview` and nothing inside it, and the adapter fills it through `onNodeCreated` when the card comes into view.",tagName:"div",attributes:{part:"library","data-jx-region":"${state.region}"},style:{$description:"What the fifty-two `.library*` rules in `styles/overlays.css` said, keyed on `part` and re-pointed at the studio token layer. Every one of them was this surface's alone, so the block goes with the conversion rather than being copied. Three sets of names could not come with the declarations. Ten `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px: a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, and `styles/spectrum.css` is deleted whole with the last Spectrum component, so a document that reads one is a document whose colours change when a component it does not use is removed. `--spectrum-gray-100` and `--spectrum-gray-200` are the studio's own `--bg-input` and `--hover-bg`; `--spectrum-blue-600` — the card's hover border and the drop outline — is `--accent`, which is what a Spectrum blue was standing in for; and `--spectrum-orange-100`, the incomplete-scan banner's ground, is mixed from `--warning` so the banner follows the chrome theme instead of being a dark-only hex. Nine names that were handles rather than styling stop being names at all: `.library-grid-cards`, `.library-grid-media`, `.library-day-undated`, `.library-drop-active`, `.library-upload-input` and the four `data-field` widths are `data-` attributes on a part here, because a part is the handle now.",display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="banner-slot"], & [part="locale-slot"], & [part="filter-slot"], & [part="fields-slot"], & [part="new-slot"], & [part="page-slot"], & [part="view-slot"], & [part="art-slot"], & [part="note-slot"], & [part="truncated-slot"]':{$description:"A `$switch` renders its own container, and none of these six is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"},'& [part="head"]':{$description:"The collection's title over its toolbar: the Content-Collection and Content-Pages boards' heading row. It does not scroll with the list.",display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-3)",background:"var(--bg-panel)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="heading"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="title"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="subtitle"]':{margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="subtitle"]:empty':{$description:"Only Pages carries a line under its title; a collection's own line is the header bar below the toolbar.",display:"none"},'& [part="toolbar"]':{$description:"It wraps rather than scrolls: the view switch, the search, the language facet, Fields and New are all equally reachable, and a toolbar that hid half of them behind an overflow would put the collection's own state somewhere the reader has to go looking for it.",display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"0",flexShrink:"0",flexWrap:"wrap"},'& [part="search"]':{width:"220px"},'& [part="locale"]':{$description:"Narrow on purpose: it holds one language name, and the toolbar wraps before it grows.",width:"160px"},'& [part="filter"]':{$description:"Narrow like the language facet: it holds one value of one field.",width:"160px"},'& [part="spacer"]':{flex:"1"},'& [part="layouts"]':{flexShrink:"0"},'& [part="banner"]':{$description:"The banner an INCOMPLETE listing carries. The Problem in the dock is the durable record; this is the same fact on the surface it is about, because a reader looking at a short list needs to know it is short for a reason without going anywhere to find out.",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--jx-space-4)",padding:"var(--jx-space-3) var(--jx-space-5)",background:"color-mix(in srgb, var(--warning) 18%, var(--bg-panel))",borderBottom:"1px solid var(--border)",color:"var(--fg)",fontSize:"var(--jx-text-md)"},'& [part="body"]':{flex:"1",minHeight:"0",overflow:"auto",position:"relative"},'& [part="empty"]':{padding:"48px var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)"},'& [part="empty"] p':{margin:"0"},'& [part="empty-detail"]':{fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="truncated"]':{$description:"What a capped layout did not draw, stated. A grouped list cannot window — a window over one either breaks the groups or needs variable-height measurement — so Calendar and Board cap instead, and a layout that truncated in silence would be the same class of lie as “No files found”.",margin:"var(--jx-space-3) 0 0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="grid"]':{$description:"Cards and Media, the two windowed grids. The item sizes here are the ones `library-layouts.ts`'s LAYOUT_METRICS counts rows in; change one and change both.",display:"grid",gap:"var(--jx-space-4)",padding:"var(--jx-space-4) var(--jx-space-5)",alignItems:"start"},'& [part="grid"][data-layout="cards"]':{gridTemplateColumns:"repeat(auto-fill, minmax(188px, 1fr))"},'& [part="card"], & [part="tile"]':{cursor:"pointer",overflow:"hidden",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg-panel)"},'& [part="card"]:hover, & [part="tile"]:hover':{borderColor:"var(--accent)"},'& [part="card-art"], & [part="tile-art"]':{aspectRatio:"4 / 3",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",background:"var(--bg-input)",pointerEvents:"none"},'& [part="file-glyph"]':{"--jx-icon-size":"32px",color:"var(--fg-dim)"},'& [part="doc-preview"]':{$description:"The island. The document renders this box and nothing inside it; the adapter mounts a real runtime render of the file into a shadow root of the island's own when the card comes into view (`mountPreview` in `browse/library-preview.ts`, which keeps the document's ids out of Studio's), and the zoom is what makes a page-sized document readable as a thumbnail without rendering it at thumbnail size: the render is laid out in a box two and a half times as wide and drawn at 0.4. It is `inert`, so a page's own links and buttons are neither focusable nor named inside the card.",width:"100%",height:"100%",zoom:"0.4",overflow:"hidden"},'& [part="thumb"]':{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"},'& [part="card-label"], & [part="tile-label"]':{padding:"6px var(--jx-space-3) 0",fontSize:"var(--jx-text-md)",color:"var(--fg)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},'& [part="card-meta"]':{padding:"0 var(--jx-space-3) 6px",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="table"]':{$description:"A windowed list rather than a table component: the rows have to be sliceable, and every table widget wants the whole set.",display:"flex",flexDirection:"column",minWidth:"min-content",padding:"0 var(--jx-space-5) var(--jx-space-5)"},'& [part="table-head"], & [part="table-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",height:"32px",borderBottom:"1px solid var(--border)"},'& [part="table-head"]':{position:"sticky",top:"0",zIndex:"1",background:"var(--bg-panel)",fontWeight:"600",fontSize:"var(--jx-text-md)"},'& [part="table-row"]':{cursor:"pointer"},'& [part="table-row"]:hover':{background:"var(--hover-bg)"},'& [part="cell"]':{$description:"Every column keeps a floor: with a collection's six field columns beside the file facts, a cell that may shrink to nothing is a column of ellipses. When the floors outgrow the pane, the table scrolls sideways instead. Each cell's text is kept out of its intrinsic width (`contain: inline-size`), so the table's `min-content` is the sum of those floors rather than of every full title.",flex:"1",minWidth:"80px",contain:"inline-size",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-md)"},'& [part="cell"][data-field="name"], & [part="cell"][data-field="title"]':{$description:"What a row is called keeps a readable width however many field columns stand beside it.",flex:"3",minWidth:"220px",fontWeight:"500"},'& [part="cell"][data-field="path"]':{flex:"2",color:"var(--fg-dim)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)"},'& [part="cell"][data-field="size"], & [part="cell"][data-field="modified"]':{flex:"0 0 96px"},'& [part="cell"][data-field="locale"]':{$description:"Fixed, like size and modified: a language name is short and never earns width from Name. Without this it inherits the `flex: 1` above and the Name column loses a quarter of itself in every multilingual project.",flex:"0 0 90px",color:"var(--fg-dim)"},'& [part="calendar"]':{padding:"var(--jx-space-4) var(--jx-space-5)"},'& [part="day"]':{marginBottom:"var(--jx-space-5)"},'& [part="day-date"]':{margin:"0 0 var(--jx-space-2)",fontSize:"var(--jx-text-md)",fontWeight:"600",color:"var(--fg)"},'& [part="day"][data-undated="true"] [part="day-date"]':{$description:"A file with no dated name and no modification time is set apart rather than parked on today. A calendar that invents dates is worse than one that says which files it could not place.",color:"var(--fg-dim)"},'& [part="note"]':{margin:"0 0 var(--jx-space-2)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="board"]':{display:"flex",gap:"var(--jx-space-4)",padding:"var(--jx-space-4) var(--jx-space-5)",alignItems:"flex-start",overflowX:"auto"},'& [part="column"]':{flex:"0 0 220px",border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"var(--jx-space-3)",background:"var(--bg-panel)"},'& [part="column-title"]':{margin:"0 0 6px",fontSize:"var(--jx-text-md)",fontWeight:"600",display:"flex",justifyContent:"space-between"},'& [part="count"]':{color:"var(--fg-dim)",fontWeight:"400"},'& [part="list"]':{listStyle:"none",margin:"0",padding:"0"},'& [part="list-item"]':{padding:"3px var(--jx-space-2)",borderRadius:"var(--radius)",cursor:"pointer",fontSize:"var(--jx-text-md)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},'& [part="list-item"]:hover':{background:"var(--hover-bg)"},'& [part="page-line"]':{$description:"One line saying where the collection's entries are published, the Content-Collection board's bar under the toolbar. Its action is quiet: it opens another workspace, and it must not compete with New.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-5)",background:"var(--bg-panel)",borderBottom:"1px solid var(--border)",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)",flexShrink:"0"},'& [part="page-pattern"]':{fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",color:"var(--fg)"},'& [part="design-page"], & [part="add-page"]':{marginLeft:"auto"},'& [part="card"]:focus-visible, & [part="table-row"]:focus-visible, & [part="list-item"]:focus-visible':{$description:"Rows and cards open on Enter or Space as well as a click, so the keyboard reaches an entry; the ring says which one it is on.",outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"div",attributes:{part:"heading"},children:[{tagName:"h2",attributes:{part:"title"},textContent:"${state.title}"},{tagName:"p",attributes:{part:"subtitle"},textContent:"${state.subtitle}"}]},{tagName:"div",attributes:{part:"toolbar"},children:[{tagName:"jx-action-group",attributes:{part:"layouts"},$props:{selects:"single",compact:!0,label:"View"},children:[{$prototype:"Array",items:{$ref:"#/state/layouts"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"layout","data-layout":"${$map.item.key}"},$props:{size:"sm",hint:"${$map.item.label}",checked:{$ref:"$map/item/checked"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setLayout"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"${state.searchLabel}",placeholder:"${state.searchLabel}…",size:"sm",value:{$ref:"#/state/query"},type:"search"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"locale-slot",role:"none"},$switch:{$ref:"#/state/localeState"},cases:{shown:{tagName:"jx-select",attributes:{part:"locale"},$props:{label:"Language",size:"sm",options:{$ref:"#/state/localeOptions"},value:{$ref:"#/state/localeValue"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setLocale"},value:[{$ref:"event#/target/value"}]}],description:"The facet's options come from ALL scanned files, never from the filtered ones: a picker whose choices collapse to the choice just made cannot be used to make another."}}}},{tagName:"div",attributes:{part:"filter-slot",role:"none"},$switch:{$ref:"#/state/filterState"},cases:{shown:{$description:"The Filter: one value of what groups the entries, their status or the field the Board groups by, so it offers exactly the Board's columns.",tagName:"jx-select",attributes:{part:"filter"},$props:{label:"Filter",size:"sm",options:{$ref:"#/state/filterOptions"},value:{$ref:"#/state/filterValue"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"span",attributes:{part:"spacer"}},{tagName:"div",attributes:{part:"grid-slot",role:"none"},$switch:{$ref:"#/state/fieldsState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"edit-grid"},$props:{size:"sm",icon:"rows",hint:"Edit every entry of this collection in a grid"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openGrid"},value:[]}],description:"The collection's grid (`collection.editInGrid { name }`): the one visible door to it, since the palette cannot prompt for a free-text name."},children:[{tagName:"span",textContent:"Edit in grid"}]}}},{tagName:"div",attributes:{part:"fields-slot",role:"none"},$switch:{$ref:"#/state/fieldsState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"fields"},$props:{size:"sm",icon:"sliders-horizontal",hint:"Edit this collection's fields in Project Settings",haspopup:"dialog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFields"},value:[]}],description:'Project Settings › Content types, on this collection (`settings.open { section: "content", entry }`).'},children:[{tagName:"span",textContent:"Fields"}]}}},{tagName:"div",attributes:{part:"new-slot",role:"none"},$switch:{$ref:"#/state/newState"},cases:{shown:{tagName:"jx-button",attributes:{part:"new"},$props:{size:"sm",variant:"accent"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}],description:"Creation is somebody else's flow: `file.new` opens Add new on this collection's kind, a page for Pages and an entry for a collection."},children:[{tagName:"span",textContent:"${state.newLabel}"}]}}}]}]},{$description:"The header line: where this collection's entries are published, derived from the page whose `$paths.contentType` names it. Pages draw nothing here.",tagName:"div",attributes:{part:"page-slot",role:"none"},$switch:{$ref:"#/state/page/state"},cases:{loading:{tagName:"div",attributes:{part:"page-line"},children:[{tagName:"span",attributes:{part:"page-text"},textContent:"${state.page.text}"}]},page:{tagName:"div",attributes:{part:"page-line","data-state":"page"},children:[{tagName:"span",attributes:{part:"page-text"},textContent:"${state.page.text}"},{tagName:"code",attributes:{part:"page-pattern"},textContent:"${state.page.pattern}"},{tagName:"span",attributes:{part:"page-template"},textContent:"${state.page.template}"},{tagName:"jx-action-button",attributes:{part:"design-page"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/designPage"},value:[]}],description:"Opening the page is activating it, which enters Design (studio.md §22.1)."},children:[{tagName:"span",textContent:"${state.page.designLabel}"}]}]},none:{tagName:"div",attributes:{part:"page-line","data-state":"none"},children:[{tagName:"span",attributes:{part:"page-text"},textContent:"${state.page.text}"},{tagName:"jx-action-button",attributes:{part:"add-page"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addPage"},value:[]}],description:"Writes the collection's page exactly as Add new's own-page option does."},children:[{tagName:"span",textContent:"Add one"}]}]}}},{tagName:"div",attributes:{part:"banner-slot",role:"none"},$switch:{$ref:"#/state/bannerState"},cases:{shown:{tagName:"div",attributes:{part:"banner",role:"status"},children:[{tagName:"span",textContent:"${state.bannerText}"},{tagName:"jx-button",attributes:{part:"retry"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/retry"}}]},children:[{tagName:"span",textContent:"Retry"}]}]}}},{tagName:"div",attributes:{part:"body"},onscroll:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/scrolled"}}],description:"The rendered item count is proportional to the VIEWPORT, not to the project: a scroll recomputes the window from the box the adapter measures here, and never re-reads the scan."},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{loading:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Scanning the project…"}]},incomplete:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Nothing to show, and the scan did not finish."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"},{tagName:"jx-button",attributes:{part:"retry"},$props:{size:"sm",variant:"primary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/retry"}}]},children:[{tagName:"span",textContent:"Retry"}]}]},empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"${state.emptyMessage}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"}]},nomatch:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",children:[{tagName:"span",textContent:"${state.emptyMessage}"},{tagName:"span",attributes:{part:"empty-detail"},textContent:" ${state.emptyDetail}"}]},{tagName:"jx-button",attributes:{part:"reset"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reset"}}],description:"Both facets in one clause and one button, so a reader who filtered twice is told about both rather than sent to clear one and find the list still empty."},children:[{tagName:"span",textContent:"Clear filters"}]}]},cards:{tagName:"div",attributes:{part:"grid","data-layout":"cards",style:"${state.pad}"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/path"},map:{tagName:"div",attributes:{part:"card","data-path":"${$map.item.path}",tabindex:"0",role:"button"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]," ":[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]}}]},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"div",attributes:{part:"card-art"},children:[{tagName:"div",attributes:{part:"art-slot",role:"none"},$switch:{$ref:"$map/item/art"},cases:{image:{tagName:"img",attributes:{part:"thumb",loading:"lazy",src:"${$map.item.src}",alt:""}},doc:{tagName:"div",attributes:{part:"doc-preview","data-path":"${$map.item.path}",inert:""}},glyph:{tagName:"jx-icon",attributes:{part:"file-glyph"},$props:{name:"file-text"}}}}]},{tagName:"div",attributes:{part:"card-label",title:"${$map.item.path}"},textContent:"${$map.item.name}"},{tagName:"div",attributes:{part:"card-meta"},textContent:"${$map.item.meta}"}]}}]},table:{tagName:"div",attributes:{part:"table",role:"table","aria-label":"${state.title}"},children:[{tagName:"div",attributes:{part:"table-head",role:"row"},children:[{$prototype:"Array",items:{$ref:"#/state/columns"},key:{$ref:"$map/item/field"},map:{tagName:"div",attributes:{part:"cell",role:"columnheader","data-field":"${$map.item.field}"},textContent:"${$map.item.title}"}}]},{tagName:"div",attributes:{part:"pad",style:"${state.padTop}"}},{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/path"},map:{tagName:"div",attributes:{part:"table-row",role:"row","data-path":"${$map.item.path}",tabindex:"0"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]," ":[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]}}]},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{$prototype:"Array",items:{$ref:"$map/item/cells"},key:{$ref:"$map/item/field"},map:{tagName:"div",attributes:{part:"cell",role:"cell","data-field":"${$map.item.field}"},textContent:"${$map.item.text}"}}]}},{tagName:"div",attributes:{part:"pad",style:"${state.padBottom}"}}]},calendar:{tagName:"div",attributes:{part:"calendar"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"section",attributes:{part:"day","data-undated":"${$map.item.undated}"},children:[{tagName:"h3",attributes:{part:"day-date"},textContent:"${$map.item.title}"},{tagName:"div",attributes:{part:"note-slot",role:"none"},$switch:{$ref:"$map/item/noteState"},cases:{shown:{tagName:"p",attributes:{part:"note"},textContent:"${$map.item.note}"}}},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"$map/item/files"},key:{$ref:"$map/item/path"},map:{tagName:"li",attributes:{part:"list-item","data-path":"${$map.item.path}",title:"${$map.item.path}",tabindex:"0"},textContent:"${$map.item.name}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]," ":[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]}}]},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]}}}]}]}},{tagName:"div",attributes:{part:"truncated-slot",role:"none"},$switch:{$ref:"#/state/truncatedState"},cases:{shown:{tagName:"p",attributes:{part:"truncated"},textContent:"${state.truncated}"}}}]},board:{tagName:"div",attributes:{part:"board"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"section",attributes:{part:"column"},children:[{tagName:"h3",attributes:{part:"column-title"},children:[{tagName:"span",textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"count"},textContent:"${$map.item.count}"}]},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"$map/item/files"},key:{$ref:"$map/item/path"},map:{tagName:"li",attributes:{part:"list-item","data-path":"${$map.item.path}",title:"${$map.item.path}",tabindex:"0"},textContent:"${$map.item.name}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]," ":[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]}}]},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]}}}]},{tagName:"div",attributes:{part:"note-slot",role:"none"},$switch:{$ref:"$map/item/noteState"},cases:{shown:{tagName:"p",attributes:{part:"truncated"},textContent:"${$map.item.note}"}}}]}}]}}}]}]};T("library-pane",Le);function Fe(e,t){e.region=t.region,e.view=t.view,e.title=t.title,e.subtitle=t.subtitle,e.searchLabel=t.searchLabel,e.newLabel=t.newLabel,e.newState=t.newState,e.fieldsState=t.fieldsState,e.page=t.page,e.layouts=t.layouts,e.filterState=t.filterState,e.filterOptions=t.filterOptions,e.filterValue=t.filterValue,e.localeState=t.localeState,e.localeOptions=t.localeOptions,e.localeValue=t.localeValue,e.query=t.query,e.bannerState=t.bannerState,e.bannerText=t.bannerText,e.emptyMessage=t.emptyMessage,e.emptyDetail=t.emptyDetail,e.pad=t.pad,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.columns=t.columns,e.groups=t.groups,e.truncated=t.truncated,e.truncatedState=t.truncatedState}function Qe(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function Ze(e){let t=e?.$map,a=v(t)?t.item:void 0,r=v(a)?a.path:void 0;return n(r)?r:""}function Ce(e,t,a){e.replaceChildren();let r=new AbortController;wN(e,r.signal);let o=g({addPage:a.addPage,bannerState:"hidden",bannerText:"",columns:[],contextMenu:a.contextMenu,designPage:a.designPage,emptyDetail:"",emptyMessage:"",fieldsState:"hidden",groups:[],layouts:[],filterOptions:[],filterState:"hidden",filterValue:"",localeOptions:[],localeState:"hidden",localeValue:"",newLabel:"",newState:"hidden",openFields:a.openFields,openGrid:a.openGrid,openFile:a.openFile,openNew:a.openNew,pad:"",padBottom:"",padTop:"",previewSlot:a.previewSlot,query:"",region:"",reset:a.reset,retry:a.retry,page:{designLabel:"",pattern:"",state:"hidden",template:"",text:""},rows:[],scrolled:a.scrolled,scroller:a.scroller,search:a.search,searchLabel:"",setLayout:a.setLayout,setFilter:a.setFilter,setLocale:a.setLocale,subtitle:"",title:"",truncated:"",truncatedState:"hidden",view:"loading"});Fe(o,t);let i=null,l=!1,c=R("library-pane",o,e,{onNodeCreated:(d,s,u,m)=>{let f=Qe(u);if(f===""||!(d instanceof HTMLElement))return;if(f==="body"){a.scroller(d);return}if(f==="doc-preview"){let L=Ze(m);if(L)a.previewSlot(d,L)}}}).then((d)=>{let s=d.root;if(l)return d.dispose(),s;return i=d,s});return{attached:()=>{if(l)return!1;let d=i?.root;return d===void 0?!0:d instanceof HTMLElement&&e.contains(d)},dispose(){l=!0,r.abort(),i?.dispose(),i=null},ready:c,update:(d)=>Fe(o,d)}}var et="table",y=g({collection:ci,loading:!1,revision:0,views:{}});function Qa(e=Au()){let t=y.views[e];if(t)return t;let a={filter:"",layout:et,locale:"",query:""};return y.views[e]=a,y.views[e]??a}function M(){return Vl(y.collection)??{fileBacked:!1,item:"page",key:ci,kind:"pages",title:"Pages"}}function Au(){return M().key}var E=null,O=!1;function P(){if(E?.stale()===!0){E=null,O=!1;for(let e of A.values())e.cache.clear()}return E??=CD(),E}function w(){y.revision+=1}function XR(e){y.collection=e,Qa(e),w(),xn("leftPanel")}function Zk(e,t=Au()){Qa(t).layout=e,w()}function I_(e,t=Au()){Qa(t).query=e,w()}function tt(e,t=Au()){Qa(t).filter=e,w()}function R_(e,t=Au()){Qa(t).locale=e,w()}function Ld(){E=null,O=!1;for(let e of A.values())e.cache.clear();w()}function Xk(){let e=P();if(!O&&!y.loading)V();if(!e.scanned())return null;let t=new Map;for(let a of e.files())if(a.collection!==null)t.set(a.collection,(t.get(a.collection)??0)+1);return t}var at=600,ke="content.scan",F="Content";async function V(){let e=P();O=!0,y.loading=!0,w();let t={handle:null},a=setTimeout(()=>{t.handle=Us({source:F,status:"Reading the project's directories…",title:"Scan project files"})},at);try{await e.rows();let r=e.failures();if(r.length>0){let o=r.map((l)=>`${l.dir} — ${l.error}`).join(`
|
|
3
|
-
`),i=`Could not read ${r.length} project ${r.length===1?"directory":"directories"} — this list is incomplete.`;C.error(i,{action:"content.refresh",detail:o,key:ke,path:r[0].dir,source:F,tier:"problem"}),t.handle?.setStatus(i)}t.handle?.done(`${e.files().length} file(s)`)}catch(r){if(t.handle)t.handle.fail("Could not scan the project's files.");else C.error("Could not scan the project's files.",{action:"content.refresh",detail:Q(r),key:ke,source:F,tier:"problem"})}finally{clearTimeout(a),y.loading=!1,w(),xn("leftPanel")}}async function Qk(){E=null,O=!1;for(let e of A.values())e.cache.clear();await V()}var A=new Map;function W(e){return A.get(e)??null}function eE(e,t){let a=W(e);return a!==null&&a.tabId===t.id&&a.wrap.isConnected&&a.surface.attached()}function tE(e){let t=A.get(e);if(!t)return;if(t.settleTimer!==null)clearTimeout(t.settleTimer),t.settleTimer=null;t.unlisten(),t.observer.destroy(),t.cache.clear(),t.slots.clear(),t.pendingPaths.clear(),t.scope.stop(),t.surface.dispose(),A.delete(e)}function nt(e,t,a){let r=de[t],o=e?.scroller??null;if(!r.windowed||!o)return{end:a,padBottom:0,padTop:0,start:0,totalRows:a};return eS({columns:ve(t,o.clientWidth),count:a,rowHeight:r.rowHeight,scrollTop:o.scrollTop,viewportHeight:o.clientHeight})}async function ot(e,t){e.pendingPaths.add(t);try{let a=await Cw(t,e.cache);if(!a||W(e.paneId)!==e)return;let r=e.slots.get(t);if(r?.isConnected&&!Vy(r))Wy(r,a)}finally{e.pendingPaths.delete(t)}}function Te(e,t,a){let r=e.cache.get(a);if(Vy(t))return;if(r){Wy(t,r);return}if(e.pendingPaths.has(a))return;e.pending.set(t,a),e.observer.observe(t)}function it(e,t,a){e.slots.set(a,t),Te(e,t,a)}function lt(e){if(e.settleTimer!==null)return;e.settleTimer=setTimeout(()=>{if(e.settleTimer=null,W(e.paneId)!==e)return;e.observer.releaseDetached();let t=vD.has(Qa().layout);for(let[a,r]of e.slots){if(!r.isConnected){e.slots.delete(a);continue}if(t)Te(e,r,a)}},0)}function je(e){if(e.record)mD(e.record.source,e.record.row);else if(e.collection===null||e.collection===ci)yi(e.path);else Pl(e.path)}var _=null;function st(){_?.close(),_=null}function Re(e){return P().files().find((t)=>t.path===e)??null}function ct(e,t,a){let r=Re(e);if(!r||r.record)return;st();let o=(i,l,c,d={})=>({destructive:!1,disabled:!1,dividerAbove:!1,id:i,run:c,title:l,...d});_=Xt({label:"File actions",onClosed:(i)=>{if(_===i)_=null},origin:{x:t,y:a},region:"content",rows:[o("open","Open",()=>{je(r)}),o("rename","Rename…",()=>{dt(r)},{dividerAbove:!0}),o("duplicate","Duplicate",()=>{pt(r)}),o("delete","Delete",()=>{ut(r)},{destructive:!0,dividerAbove:!0})]})}async function dt(e){let t=await yb(e.path),a={confirmLabel:"Rename",select:"stem",validate:(c)=>c.trim()?"":"Enter a file name.",value:e.name};if(t!==void 0)a.message=t;let r=await xi("Rename",a);if(!r||r===e.name)return;let o=e.path.replaceAll("\\","/"),i=o.includes("/")?o.slice(0,o.lastIndexOf("/")):".",l=i==="."?r:`${i}/${r}`;try{await p().renameFile(e.path,l),Er(),Ld(),await V(),C.success(`Renamed to ${r}`)}catch(c){C.error(`Could not rename ${e.name}.`,{detail:Q(c),path:e.path,source:F})}}async function pt(e){let t=e.path.replaceAll("\\","/"),a=t.includes("/")?t.slice(0,t.lastIndexOf("/")):".",o=`${e.name.replace(/(\.[^.]+)$/,"")}-copy${e.ext||""}`,i=a==="."?o:`${a}/${o}`;try{let l=p(),c=await l.readFile(e.path);await l.writeFile(i,c),Ld(),await V(),C.success(`Duplicated as ${o}`)}catch(l){C.error(`Could not duplicate ${e.name}.`,{detail:Q(l),path:e.path,source:F})}}async function ut(e){if(!await vb(e))return;try{await p().deleteFile(e.path),Er(),Ld(),await V(),C.success(`Deleted ${e.name}`)}catch(a){C.error(`Could not delete ${e.name}.`,{detail:Q(a),path:e.path,source:F})}}function Pe(e,t){if(e.layout===!1)return"with no template";let a=e.layout??t;return a?`using ${Cb(a)}`:"with no template"}function mt(e,t,a,r=[]){let o={designLabel:"",pattern:"",state:"hidden",template:"",text:""};if(e.kind==="pages")return o;if(t===void 0)return{...o,state:"loading",text:"Finding where these entries are published…"};if(t===null)return{...o,state:"none",text:"Entries have no page of their own"};let i=nb(),l=(d)=>{let s=d===null?-1:i.indexOf(d);return s===-1?i.length:s},c=r.filter((d)=>d.locale!==null).toSorted((d,s)=>l(d.locale)-l(s.locale));if(c.length>1){let d=new Set(c.map((s)=>Pe(s,a)));return{designLabel:`Design the ${e.item} page`,pattern:c.map((s)=>`${s.pattern} (${s.locale})`).join(", "),state:"page",template:d.size===1?[...d][0]:"using a template per language",text:`Each ${e.item} has a page in each language at`}}return{designLabel:`Design the ${e.item} page`,pattern:t.pattern,state:"page",template:Pe(t,a),text:`Each ${e.item} has a page at`}}function ft(e){let t=th(e,Qa(e).locale);if(t)yi(t.path)}async function gt(e){let{addCollectionPage:t}=await (le("psym14sn"),import("./add-new-flow-psym14sn.js"));await t(e)}function ht(e,t,a){return{checked:a?"true":"false",key:e,label:t}}function yt(e,t){let a=`${t.locale===""?"":` in ${Vt(t.locale)}`}${t.filter===""?"":` filtered to ${t.filter}`}`,r=t.query.trim();return`No ${e.kind==="pages"?"pages":e.title.toLowerCase()} match${r?` “${r}”`:""}${a}.`}function bt(e,t,a,r){if(a>0)return t;if(y.loading||!e.scanned())return"loading";if(e.failures().length>0)return"incomplete";return r===0?"empty":"nomatch"}function D_(e){return P().files().filter((t)=>t.collection===e).map((t)=>t.path)}function wt(e,t){if(e.kind==="pages")return P().scanned()?vt(t==="table"):j(new Map);if(e.fileBacked){let o=Me(e.key),i=P().files().filter((l)=>l.collection===e.key&&l.record);return j(new Map(i.map((l)=>{let{fields:c}=l.record,d=U_(o,c),s=d===null?"":tb(c[d]??""),u=CE(l.record.source,c,o);return[l.path,{date:s,fields:c,status:"",thumb:u,title:l.name}]})))}if(!P().scanned())return j(new Map);let a=nw(e.key,D_(e.key)),r=new Map((a??[]).map((o)=>[o.path,{date:o.date,fields:o.fields,status:o.status,thumb:o.thumb,title:o.title}]));return j(r)}function vt(e){let t=D_(ci),a=e?me(t):null,r=new Set(Object.keys(x?.projectConfig?.content??{})),o=Ee(),{i18n:i}=Qt(x?.projectConfig??{}),l=[...a?.values()??[]].some((d)=>d.draft),c=new Map(t.map((d)=>{let s=a?.get(d),u=s?.contentType??null,m=s===void 0?void 0:s.layout??o??!1;return[d,{date:"",status:s===void 0||!l?"":s.draft?"Draft":"Published",template:m===void 0?"":m===!1?"None":Cb(m),title:u!==null&&r.has(u)?Y(`${ie(u)} page`,d,i):U(_r(d),d,i)}]}));return j(c)}function xt(e){return e.map((t)=>({file:t,route:_r(t.path)})).toSorted((t,a)=>ES(t.route,a.route)||t.file.path.localeCompare(a.file.path)).map(({file:t})=>t)}function Me(e){return wa(e)?.schema??CN(e)}function $t(e){let t=new Set,a=pp(e),r=SE(e);for(let o of[a,r])if(o!==null)t.add(o);return t}function St(e){let t=new Map;for(let[a,r]of Object.entries(e?.properties??{}))if(Array.isArray(r.enum))t.set(a,r.enum.filter((o)=>n(o)));return t}function Lt(e,t){let a=[...new Set(e.flatMap((i)=>i?.status?[i.status]:[]))];if(a.length>0)return{matches:(i,l)=>(i?.status??"")===l,title:"Status",values:a.toSorted((i,l)=>i==="Draft"?-1:l==="Draft"?1:i.localeCompare(l))};if(!t)return null;let r=new Set(e.flatMap((i)=>B(i?.fields?.[t.name],t.list))),o=t.order.length>0?[...t.order,...[...r].filter((i)=>!t.order.includes(i)).toSorted()]:[...r].toSorted((i,l)=>i.localeCompare(l));return{matches:(i,l)=>B(i?.fields?.[t.name],t.list).includes(l),title:t.title,values:o}}function Ne(e,t){let a=P(),r=M(),o=Qa(r.key),{layout:i}=o,l=EE(a.files(),{collection:r.key,query:""}),c=wt(r,i),d=l.map((h)=>c(h)),s=r.kind==="collection"?Me(r.key):null,u=SD(s,$t(s)),m=be(u,St(s),d),f=r.kind==="collection"?Lt(d,m):null,L=f!==null&&f.values.includes(o.filter)?o.filter:"",H=EE(a.files(),{collection:r.key,locale:o.locale,query:o.query}),D=f===null||L===""?H:H.filter((h)=>f.matches(c(h),L)),N=r.kind==="pages"?xt(D):D,J=l.length,b=bt(a,i,N.length,J),I=nt(e,i,N.length),Ae=N.slice(I.start,I.end),k=a.failures(),K=yD(l),pe=LE(r.key,{date:SE(s)!==null||d.some((h)=>(h?.date??"")!==""),fields:u,locale:K.length>1,status:d.some((h)=>(h?.status??"")!=="")}),Oe=b==="cards",X=b==="calendar"?$e(N,c):{groups:[],truncated:""},G=r.kind==="pages",Z=G?"pages":r.title.toLowerCase();return{bannerState:k.length>0?"shown":"hidden",bannerText:k.length===0?"":`This list is incomplete — ${k.length} ${k.length===1?"directory":"directories"} could not be read (${k[0].dir}${k.length>1?", …":""}).`,columns:b==="table"?pe.map((h)=>({field:h.field,title:h.title})):[],emptyDetail:b==="incomplete"?`${k.length} ${k.length===1?"directory":"directories"} could not be read, so this is not the same as an empty collection.`:b==="nomatch"?`${J} ${J===1?r.item:Z} in all.`:b==="empty"?`New ${r.item} adds the first one.`:"",emptyMessage:b==="nomatch"?yt(r,o):b==="empty"?`No ${Z} yet.`:"",fieldsState:r.kind==="collection"?"shown":"hidden",groups:b==="board"?Se(N,c,m):X.groups,layouts:sm.map((h)=>ht(h,ow[h],i===h)),localeOptions:[{label:"All languages",value:"all"},...K.map((h)=>({label:Vt(h),value:h}))],filterOptions:f===null?[]:[{label:`Any ${f.title.toLowerCase()}`,value:"all"},...f.values.map((h)=>({label:h,value:h}))],filterState:f!==null&&f.values.length>1?"shown":"hidden",filterValue:L===""?"all":L,localeState:K.length<2?"hidden":"shown",localeValue:o.locale===""?"all":o.locale,newLabel:`New ${r.item}`,newState:r.fileBacked?"hidden":"shown",pad:`padding-top:calc(var(--jx-space-4) + ${I.padTop}px);padding-bottom:calc(var(--jx-space-4) + ${I.padBottom}px)`,padBottom:`height:${I.padBottom}px`,padTop:`height:${I.padTop}px`,page:mt(r,G?null:th(r.key,o.locale),Ee(),G||o.locale!==""?[]:EN(r.key)??[]),query:o.query,region:wi(t,"content"),rows:b==="cards"||b==="table"?Ae.map((h)=>xe(h,b==="table"?pe:[],Oe,c(h))):[],searchLabel:`Search ${Z}`,subtitle:G?"Every URL on your site.":"",title:r.title,truncated:X.truncated,truncatedState:X.truncated===""?"hidden":"shown",view:b}}function Ee(){return x?.projectConfig?.defaults?.layout??null}function QR(e,t){let{paneId:a,wrap:r}=e;if(eE(a,t))return;tE(a);let o=null,i=bp((s)=>{let u=o;if(!u)return;let m=u.pending.get(s);if(m!==void 0)u.pending.delete(s),ot(u,m)}),l=()=>{if(o!==null&&W(a)===o)o.surface.update(Ne(o,a)),lt(o)},c=Ce(r,Ne(null,a),{addPage:()=>{gt(M().key)},contextMenu:(s,u,m)=>ct(s,u,m),designPage:()=>{ft(M().key)},openFields:()=>{rt("settings.open",{entry:M().key,section:"content"},F)},openGrid:()=>{let s=M(),u=s.fileBacked?Fw(s.key):null;if(u){yi(u);return}rt("collection.editInGrid",{name:s.key},F)},openFile:(s)=>{je(Re(s)??{collection:Au(),path:s})},openNew:()=>{let s=M(),{locale:u}=Qa(s.key),m=s.kind==="pages"?{kind:"page"}:{collection:s.key,kind:"entry"};if(u!=="")m.locale=u;rt("file.new",m,F)},previewSlot:(s,u)=>{if(o)it(o,s,u)},reset:()=>{I_(""),R_("")},retry:()=>{Qk()},scrolled:()=>w(),scroller:(s)=>{if(o)o.scroller=s},search:(s)=>I_(s),setLayout:(s)=>Zk(s),setFilter:(s)=>tt(s==="all"?"":s),setLocale:(s)=>R_(s==="all"?"":s)}),d=ge();o={cache:_w(),observer:i,paneId:a,pending:new WeakMap,pendingPaths:new Set,scope:d,scroller:null,settleTimer:null,slots:new Map,surface:c,tabId:t.id,unlisten:(()=>{let s=kp(()=>w()),u=iw(()=>w()),m=fe(()=>w());return()=>{s(),u(),m()}})(),wrap:r},A.set(a,o),d.run(()=>{ne(()=>{if(W(a)!==o)return;y.revision,y.collection,y.loading;let s=Qa(Au());if(s.layout,s.query,s.locale,l(),!O&&!y.loading)V()})})}function eD(){y.collection=ci,y.views={},y.loading=!1,E=null,O=!1,w()}
|
|
4
|
-
export{qg,zy,JR,Gg,Td,YR,ZR,Yk,Wy,Vy,Qa,Au,XR,Zk,I_,R_,Ld,Xk,Qk,eE,tE,D_,QR,eD};
|
|
5
|
-
|
|
6
|
-
//# debugId=3FF5F7453ADEE45864756E2164756E21
|
|
7
|
-
//# sourceMappingURL=studio-pgmvdv7z.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{p,_e}from"./studio-w4rz9hdk.js";import{YO,ZO}from"./studio-8tr6cfrc.js";import{fh}from"./studio-8m0y2qe7.js";import{Qt,cv,dv,u}from"./studio-c05wdnt3.js";import{x}from"./studio-gcxk20n7.js";function ze(t){return t.getBoundingClientRect()}function lx(t,e,n=document){return n.elementFromPoint(t,e)}var Js=new Set([".jpg",".jpeg",".png",".gif",".svg",".webp",".avif",".ico"]),o$=new Set([".mp4",".webm",".mov",".m4v"]),r$=new Set([".mp3",".wav",".ogg",".m4a",".flac"]),Ys=new Set([...Js,...o$,...r$,".pdf",".woff",".woff2",".ttf",".otf"]);function on(t){let e=t.lastIndexOf(".");return e>0?t.slice(e).toLowerCase():""}function Dp(t){return Js.has(t.startsWith(".")?t.toLowerCase():`.${t.toLowerCase()}`)}function ah(){let t=_e()?p().canvasUrl:void 0;if(t)return new URL(t,location.href).origin;return location.origin}function jb(){let t=_e()?p().canvasUrl:void 0;if(!t)return null;let e=new URL(t,location.href);return e.origin===location.origin?e.searchParams.get("rpcToken"):null}function Jl(t){let e=ah(),n=_e()?p().documentBaseUrl:void 0;if(n){let r=n.endsWith("/")?n:`${n}/`;return new URL(r,`${e}/`).href}let o=t||"";return`${e}/${o?`${o}/`:""}`}function aC(t){if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http")||t.startsWith("views://"))return t;let e=ah();if((e.startsWith("http:")||e.startsWith("https:"))&&e!==location.origin)return`${e}/${t.replace(/^\.?\//,"")}`;return t}function s$(){return Qt(x?.projectConfig??{}).i18n?.locales??[]}function Sm(t,e){let n=e?.space??"site",o=cv(t,x?.projectConfig?.content,s$());if(n==="site"&&!o)return null;let r={documentDir:ZO(t??""),lanes:YO,mounts:o?[o]:[],space:n};if(e?.fileBaseUrl!==void 0)r.fileBaseUrl=e.fileBaseUrl;return r}function Kc(t){return Hb(t,u.value?.documentPath)}function Hb(t,e){if(!t)return t;let n=Sm(e,Hd()),o=n&&{...n,versions:fh()};return aC(dv(t,o)??t)}function Hd(){let t={fileBaseUrl:Jl(x?.projectRoot)};if(_e())t.space=p().assetSpace;return t}
|
|
2
|
-
export{ze,lx,Js,o$,r$,Ys,on,Dp,ah,jb,Jl,aC,s$,Sm,Kc,Hb,Hd};
|
|
3
|
-
|
|
4
|
-
//# debugId=2F95F555EBF5D14A64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-ph84avkf.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{p,_e}from"./studio-w4rz9hdk.js";import{Q}from"./studio-nqxqf8p2.js";import{ar,I$}from"./studio-fyh0jc96.js";import{ge,ta,ne,g,he,C,ul,ef}from"./studio-43sd2mam.js";import{uO,Y,av,Gd,Tr,Nx,Ax,Ra,hv,H$,m,u,_i}from"./studio-c05wdnt3.js";import{Ot,tu,Wi,nf,cn,ur,sI,Oa,aI}from"./studio-z97c48fk.js";import{jd}from"./studio-3exxhz5g.js";import{T$,JA,YA,hh,Jb}from"./studio-q7rtx6zq.js";import{Ko}from"./studio-x9hsze61.js";import{yN,gL}from"./studio-rj9eamf8.js";import{Vd}from"./studio-r5qy30vx.js";import{Es,ko}from"./studio-d5grtb9e.js";import{tl,Ju}from"./studio-y0n7yxea.js";import{rN}from"./studio-3qeh9t0h.js";import{oe}from"./studio-p4nrkvqr.js";import{n,Z,Xe,S,v}from"./studio-vxq7fcvv.js";function ie(e,o=[]){if(e?.tagName==="slot"){let s=e.attributes?.name;o.push(n(s)?s.trim():"")}if(Array.isArray(e?.children))for(let s of e.children)ie(n(s)?void 0:s,o);return o}function xS(e){let o=ie(e),s=o.filter((r)=>r==="").length;if(s>1)return`Component has ${s} unnamed <slot> elements — only one default slot is allowed. Give extra slots a name attribute.`;let l=new Set;for(let r of o){if(r&&l.has(r))return`Duplicate slot name "${r}" — slot names must be unique within a component.`;l.add(r)}return null}var se={invokerTags:Jb,popoverTags:hh},N="Popover",ke={display:"document.repairPopoverDisplay","open-display":"document.repairPopoverDisplay",invoker:"document.repairPopoverInvoker",mode:"document.repairPopoverMode"};function ae(e,o,s,l){let r=`${o}.${s}.${l.join("/")}`,d=e.get(r)??0;return e.set(r,d+1),d===0?r:`${r}#${d}`}function W(e,o){ul((d)=>d.source===N);let s=new Map,l=JA(e,se);for(let d of l){let c=d.fix===void 0?void 0:ke[d.fix],b={detail:d.detail,key:ae(s,"popover",d.rule,d.path),source:N,tier:"problem"};if(c!==void 0)b.action=c,b.actionArgs={path:d.path};if(o!==void 0)b.path=o;C(d.severity,d.message,b)}let r=yN(e,se);for(let d of r){let c={detail:d.detail,key:ae(s,"dialog",d.rule,d.path),source:N,tier:"problem"};if(o!==void 0)c.path=o;C(d.severity,d.message,c)}return l.length+r.length}function z(e,o){let s=o?.path;if(!Array.isArray(s))throw RangeError(`command "${e}" needs a "path" argument naming the popover`);return s}function J(e){let o=u.value;if(!o)throw RangeError(`command "${e}" needs an open document`);return o}function Se(){return[{category:"Document",group:"2_document",id:"document.checkPopovers",level:"document",menus:["palette"],requires:"an open document",run:()=>{let e=J("document.checkPopovers"),o=W(e.doc.document,e.documentPath??void 0);C.success(o===0?"No popover problems found in this document.":`${o} popover problem(s) filed.`,{key:"popover.run",source:N})},title:"Check Popovers",when:(e)=>e.document.open,aiTool:{description:"Check the open document for popover defects an author can fix — a base-rule `display` "+"that defeats the browser's own hiding of a closed popover, `popovertarget` on an "+"element that cannot invoke, a target naming no popover, a cut exit animation — and "+"file each as a Problem. The findings come back as data.",name:"check_popovers",report:()=>{let e=ef(N),o=e.length;return{data:e,summary:o===0?"No popover problems found in this document.":`Filed ${o} popover problem${o===1?"":"s"} in Problems.`}}}},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverDisplay",level:"document",menus:[],requires:"a popover whose base rule sets display",run:(e,o)=>{let l=J("document.repairPopoverDisplay"),r=z("document.repairPopoverDisplay",o),d=oe(l.doc.document,r),c=YA(d?.style);if(!c)throw RangeError(`command "${"document.repairPopoverDisplay"}": nothing to move — this popover sets no display`);Y(l,(b)=>{for(let w of c.base)Gd(b,r,w,"");for(let w of c.breakpoints)Ax(b,r,[w],"display","");if(c.openDisplay!==null)Nx(b,r,":popover-open","display",c.openDisplay)}),C.success("Moved `display` into `:popover-open`.",{key:"popover.repaired.display",source:N})},title:"Move display into :popover-open",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverInvoker",level:"document",menus:[],requires:"an element carrying popovertarget that cannot invoke",run:(e,o)=>{let l=J("document.repairPopoverInvoker"),r=z("document.repairPopoverInvoker",o);Y(l,(d)=>{Tr(d,r,"popovertarget"),Tr(d,r,"popovertargetaction")}),C.success("Removed the attributes, which did nothing on this element.",{key:"popover.repaired.invoker",source:N})},title:"Remove the inert popover attributes",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverMode",level:"document",menus:[],requires:"a popover whose mode is not one of the three keywords",run:(e,o)=>{let l=J("document.repairPopoverMode"),r=z("document.repairPopoverMode",o);Y(l,(d)=>{Tr(d,r,"popover",T$)}),C.success(`Set \`popover\` to "${T$}".`,{key:"popover.repaired.mode",source:N})},title:"Set popover to auto",when:(e)=>e.document.open}]}function eN(e){e.registerAll(Se())}function $w(e,o){if(e===o)return!0;if(Array.isArray(e)&&Array.isArray(o))return e.length===o.length&&e.every((s,l)=>s===o[l]);if(S(e)&&S(o)&&!Array.isArray(e)&&!Array.isArray(o))return e.$ref===o.$ref;return!1}var A="grid://",bb={children:[],tagName:"div"};function cs(e){switch(e.kind){case"pages":return`${A}pages`;case"collection":return`${A}collection/${encodeURIComponent(e.name)}`;default:return`${A}data/${encodeURIComponent(e.connection)}/${encodeURIComponent(e.table)}`}}function xe(e){return e.startsWith(A)}function zl(e){if(!xe(e))return null;let o=e.slice(A.length).split("/");if(o[0]==="pages"&&o.length===1)return{kind:"pages"};if(o[0]==="collection"&&o.length===2&&o[1])return{kind:"collection",name:decodeURIComponent(o[1])};if(o[0]==="data"&&o.length===3&&o[1]&&o[2])return{connection:decodeURIComponent(o[1]),kind:"data",table:decodeURIComponent(o[2])};return null}function fm(e){let o=zl(e);if(!o)return null;switch(o.kind){case"pages":return"Pages · grid";case"collection":return`${o.name} · grid`;default:return`${o.table} @ ${o.connection} · grid`}}var le=0;function ce(e){let o=e.coalesceMs??800,s=e.now??(()=>Date.now()),r=g({deletes:new Set,errors:new Map,inserts:new Map,pending:new Map,redoStack:[],stale:new Set,undoStack:[]}),d=null,c=(t,i,a)=>{let f=r.errors.get(t);if(f)f.set(i,a);else r.errors.set(t,new Map([[i,a]]))},b=(t,i)=>{let a=r.errors.get(t);if(a?.delete(i),a?.size===0)r.errors.delete(t)},w=(t)=>{if(r.redoStack.length=0,d){d.push(t);return}let i=r.undoStack.at(-1);if(t.kind==="cell"&&i?.kind==="cell"&&i.rowKey===t.rowKey&&i.field===t.field&&t.at-i.at<=o){i.after=t.after,i.at=t.at;return}r.undoStack.push(t)},k=(t,i,a)=>{let f=r.inserts.get(t);if(f){if(a===null)delete f[i];else f[i]=a;return}if($w(a,e.resolveBaseline(t,i))){let y=r.pending.get(t);if(y?.delete(i),y?.size===0)r.pending.delete(t);return}let h=r.pending.get(t);if(h)h.set(i,{value:a});else r.pending.set(t,new Map([[i,{value:a}]]))},G=(t,i)=>{let a=r.inserts.get(t);if(a)return a[i]??null;let f=r.pending.get(t)?.get(i);return f?f.value:e.resolveBaseline(t,i)},M=(t,i)=>{let a=r.errors.get(t);return a?.get(i)??a?.get("*")??null},F=(t,i)=>{switch(t.kind){case"cell":{k(t.rowKey,t.field,i==="undo"?t.before:t.after);break}case"insert":{if(i==="undo")r.inserts.delete(t.tempKey);else r.inserts.set(t.tempKey,{...t.cells});break}case"drop-insert":{if(i==="undo")r.inserts.set(t.tempKey,{...t.cells});else r.inserts.delete(t.tempKey);break}case"delete":{if(i==="undo")r.deletes.delete(t.rowKey);else r.deletes.add(t.rowKey);break}default:{let a=i==="undo"?t.ops.toReversed():t.ops;for(let f of a)F(f,i);break}}},D=()=>{if(d)throw Error("edit-buffer: groups may not nest");d=[]},P=()=>{let t=d;if(d=null,!t)return;if(t.length===1)r.undoStack.push(t[0]);else if(t.length>1)r.undoStack.push({kind:"group",ops:t})},T=(t)=>{let i=(a)=>{switch(a.kind){case"cell":return t(a.rowKey)?null:a;case"insert":case"drop-insert":return t(a.tempKey)?null:a;case"delete":return t(a.rowKey)?null:a;default:{let f=a.ops.map((h)=>i(h)).filter((h)=>h!==null);return f.length>0?{kind:"group",ops:f}:null}}};r.undoStack=r.undoStack.map(i).filter((a)=>a!==null),r.redoStack=r.redoStack.map(i).filter((a)=>a!==null)};return{applyCommitResult(t){let i=new Set;for(let a of t.cells)if(a.ok){let f=r.pending.get(a.rowKey);if(f?.delete(a.field),f?.size===0)r.pending.delete(a.rowKey);b(a.rowKey,a.field)}else if(c(a.rowKey,a.field,a.error??"Save failed"),a.stale)r.stale.add(a.rowKey);for(let a of t.inserts)if(a.ok)r.inserts.delete(a.tempKey),r.errors.delete(a.tempKey),i.add(a.tempKey);else c(a.tempKey,"*",a.error??"Insert failed");for(let a of t.deletes)if(a.ok)r.deletes.delete(a.rowKey),r.pending.delete(a.rowKey),r.errors.delete(a.rowKey),i.add(a.rowKey);else if(c(a.rowKey,"*",a.error??"Delete failed"),a.stale)r.stale.add(a.rowKey);for(let a of i)r.stale.delete(a);if(i.size>0)T((a)=>i.has(a))},buildBatch(){let t=[];for(let[i,a]of r.pending){if(r.deletes.has(i))continue;for(let[f,h]of a)t.push({baseline:e.resolveBaseline(i,f),field:f,rowKey:i,value:h.value})}return{cells:t,deletes:[...r.deletes].map((i)=>({rowKey:i})),inserts:[...r.inserts].map(([i,a])=>({cells:{...a},tempKey:i}))}},canRedo:()=>r.redoStack.length>0,canUndo:()=>r.undoStack.length>0,cellError:M,cellState(t,i){if(M(t,i)!==null)return"error";if(r.stale.has(t))return"stale";if(r.inserts.has(t)||r.pending.get(t)?.has(i))return"dirty";return"clean"},deleteRow(t){if(r.deletes.has(t))return;let i=r.inserts.get(t);if(i){let a={...i};r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),w({cells:a,kind:"drop-insert",tempKey:t});return}r.deletes.add(t),w({kind:"delete",rowKey:t})},dirtyCount(){let t=r.inserts.size+r.deletes.size;for(let[i,a]of r.pending)if(!r.deletes.has(i))t+=a.size;return t},discardRow(t){r.pending.delete(t),r.deletes.delete(t),r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),T((i)=>i===t)},effectiveValue:G,beginGroup:D,endGroup:P,group(t){D();try{t()}finally{P()}},insertRow(t={}){le+=1;let i=`__new-${le}`;return r.inserts.set(i,{...t}),w({cells:{...t},kind:"insert",tempKey:i}),i},isDirty:()=>r.pending.size>0||r.inserts.size>0||r.deletes.size>0,isInsertKey:(t)=>r.inserts.has(t),markStale(t){for(let i of t)r.stale.add(i)},redo(){let t=r.redoStack.pop();if(!t)return!1;return F(t,"redo"),r.undoStack.push(t),!0},reset(){r.pending.clear(),r.inserts.clear(),r.deletes.clear(),r.errors.clear(),r.stale.clear(),r.undoStack.length=0,r.redoStack.length=0},rowState(t){if(r.deletes.has(t))return"pending-delete";if(r.inserts.has(t))return"pending-insert";if(r.stale.has(t))return"stale";if(r.pending.has(t)||r.errors.has(t))return"dirty";return"clean"},setCell(t,i,a){let f=G(t,i);if($w(f,a))return;k(t,i,a),w({after:a,at:s(),before:f,field:i,kind:"cell",rowKey:t})},state:r,undo(){let t=r.undoStack.pop();if(!t)return!1;return F(t,"undo"),r.redoStack.push(t),!0}}}var de={array:220,boolean:70,date:130,enum:140,image:180,number:110,readonly:200,reference:200,string:180,text:340};function ue(e){return Math.min(340,Math.max(90,Math.round(e*7.5)))}function Pe(e){if(e.$ref)return"reference";if(e.enum!==void 0&&Array.isArray(e.enum))return"enum";let o=e.type==="array"?void 0:e.format;if(Ra(o))return"image";if(o==="date"||o==="date-time")return"date";switch(e.type){case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"readonly";default:return(e.maxLength??0)>200||e.format==="markdown"?"text":"string"}}function fe(e){let o=e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[_-]+/g," ").trim();return o.charAt(0).toUpperCase()+o.slice(1)}function Iw(e,o={}){let s=Object.entries(e?.properties??{}),l=new Set(e?.required),r=new Set(o.readonlyFields),d=s.map(([c,b])=>{let w=r.has(c)?"readonly":Pe(b),k=Array.isArray(b.enum)?Math.max(...b.enum.map((G)=>String(G).length),4):0;return{editable:w!=="readonly",field:c,kind:w,pk:c===o.idField,required:l.has(c),schema:b,title:fe(c),widthHint:w==="enum"?ue(k+3):de[w]}});return d.sort((c,b)=>{let w=(G)=>G.pk?0:G.required?1:2,k=w(c)-w(b);return k===0?0:k}),d}function Rw(e,o=50){let s=e.slice(0,o),l=[];for(let r of s)for(let d of Object.keys(r))if(!l.includes(d))l.push(d);return l.map((r)=>{let d=s.flatMap((w)=>{let k=w[r];return k===null||k===void 0||k===""?[]:[k]}),c=Ge(d),b=Math.max(...d.map((w)=>nr(w).length),r.length,4);return{editable:!0,field:r,kind:c,title:fe(r),widthHint:c==="string"||c==="text"?ue(b):de[c]}})}function Ge(e){if(e.length===0)return"string";if(e.some((s)=>Array.isArray(s)))return"array";let o=e.map(String);if(e.every((s)=>Xe(s))||o.every((s)=>/^(true|false)$/i.test(s)))return"boolean";if(e.every((s)=>Z(s))||o.every((s)=>s.trim()!==""&&!Number.isNaN(Number(s.replaceAll(/[$€£¥,\s]/g,"")))))return"number";if(o.every((s)=>/^\d{4}-\d{2}-\d{2}([T ].*)?$/.test(s)))return"date";if(o.some((s)=>s.length>200))return"text";return"string"}function xp(e,o){if(e===null||e===void 0)return null;switch(o.kind){case"number":{if(Z(e))return Number.isNaN(e)?null:e;let s=String(e).trim().replaceAll(/[$€£¥,\s]/g,"");if(s==="")return null;let l=Number(s);return Number.isNaN(l)?null:l}case"boolean":{if(Xe(e))return e;return String(e).trim().toLowerCase()==="true"}case"array":{if(Array.isArray(e))return e.map(String);let s=String(e).trim();return s===""?[]:s.split(",").map((l)=>l.trim()).filter(Boolean)}case"reference":{if(v(e)&&"$ref"in e){let l=e.$ref;return n(l)&&l!==""?l:null}let s=String(e).trim();return s===""?null:s}default:{let s=String(e);return s===""?null:s}}}function nr(e){if(e===null||e===void 0)return"";if(Array.isArray(e))return e.join(", ");if(S(e))return e.$ref;return String(e)}var wS="__key",H=new WeakMap;function ir(e){return e?H.get(he(e))??null:null}function _p(e,o){let l=g({columns:[],error:null,grouping:null,loading:!1,query:{},rows:[],saving:!1,total:0}),r=new Map,d=(t)=>{r=new Map(t.map((i)=>[i.key,i]))},c=ce({resolveBaseline:(t,i)=>r.get(t)?.cells[i]??null}),b=async()=>{let t=await o.rows(l.query);d(t.rows),l.rows=t.rows,l.total=t.total},w=(t)=>{let i=l.columns.filter((h)=>h.required&&h.editable);if(i.length===0)return null;let a=t.cells.filter((h)=>h.value===null&&i.some((y)=>y.field===h.field)).map((h)=>({error:"Required",field:h.field,ok:!1,rowKey:h.rowKey})),f=t.inserts.filter((h)=>i.some((y)=>h.cells[y.field]===null||h.cells[y.field]===void 0)).map((h)=>({error:`Missing required: ${i.filter((R)=>h.cells[R.field]===null||h.cells[R.field]===void 0).map((R)=>R.field).join(", ")}`,ok:!1,tempKey:h.tempKey}));if(a.length===0&&f.length===0)return null;return{cells:a,deletes:[],inserts:f}},k=(t)=>t===null||t===""||Array.isArray(t)&&t.length===0,G=(t,i,a)=>{if(a==="number")return(Z(t)?t:0)-(Z(i)?i:0);if(a==="boolean")return(t===!0?1:0)-(i===!0?1:0);return nr(t).localeCompare(nr(i))},M=()=>{let t=l.rows.map((f)=>f.key),{dir:i,orderBy:a}=l.query;if(a&&!o.capabilities.remoteSort){let f=l.columns.find((y)=>y.field===a)?.kind,h=i==="desc"?-1:1;t=t.toSorted((y,R)=>{let E=c.effectiveValue(y,a),U=c.effectiveValue(R,a);if(k(E)!==k(U))return k(E)?1:-1;return h*G(E,U,f)})}return l.grouping?[...F(t).values()].flat():t},F=(t)=>{let i=new Map;for(let a of t){let f=nr(c.effectiveValue(a,l.grouping)),h=i.get(f);if(h)h.push(a);else i.set(f,[a])}return i},D=null,P=()=>D?.refreshData(),T={addRow(t={}){let i=c.insertRow(t);return P(),i},bindView(t){D=t},buffer:c,deleteRows(t){if(t.length===0)return;c.group(()=>{for(let i of t)c.deleteRow(i)}),P()},discardRow(t){c.discardRow(t),P()},replaceAll(t,i){if(t==="")return 0;let a=l.columns.filter((y)=>y.editable&&(y.kind==="string"||y.kind==="text")),f=[...l.rows.map((y)=>y.key),...c.state.inserts.keys()],h=0;if(c.group(()=>{for(let y of f){if(c.rowState(y)==="pending-delete")continue;for(let R of a){let E=c.effectiveValue(y,R.field);if(n(E)&&E.includes(t))c.setCell(y,R.field,E.replaceAll(t,i)),h+=1}}}),h>0)P();return h},effectiveRows(){let t=(f)=>Array.isArray(f)?[...f]:S(f)?{$ref:f.$ref}:f,i=(f)=>{let h=[[wS,f]];for(let y of l.columns)h.push([y.field,t(c.effectiveValue(f,y.field))]);return Object.fromEntries(h)},a=M().map((f)=>i(f));for(let[f]of c.state.inserts)a.push(i(f));return a},groups(){if(!l.grouping)return[];return[...F(M())].map(([t,i])=>({count:i.length,value:t}))},async load(){l.loading=!0,l.error=null;try{l.columns=await o.columns(),await b()}catch(t){l.error=Q(t)}finally{l.loading=!1}P()},async refresh(){if(c.isDirty()){if(!await Ko("Refresh Grid",`Discard ${c.dirtyCount()} pending change(s) and reload?`,{confirmLabel:"Discard & Reload",destructive:!0}))return}c.reset(),await o.refresh?.(),await this.load()},async save(){if(l.saving)return;let t=c.buildBatch(),i=t.cells.length+t.inserts.length+t.deletes.length;if(i===0){C.info("No grid changes to save.",{key:"grid.save"});return}let a=w(t);if(a){c.applyCommitResult(a),C.warn("Required cells are empty — fix the marked rows, then save again.",{key:"grid.save",source:"Data",tier:"problem"});return}if(t.deletes.length>0){if(!await Ko("Delete Rows",`Save will permanently delete ${t.deletes.length} row(s). Continue?`,{confirmLabel:"Delete & Save",destructive:!0}))return}let h=new Set(t.cells.map((y)=>y.rowKey)).size+t.inserts.length+t.deletes.length>5?tl({title:"Saving grid"}):null;l.saving=!0;try{let y=await o.commit(t),R=(x,j)=>`${x}\x00${j}`,E=new Map(t.cells.map((x)=>[R(x.rowKey,x.field),x]));for(let x of y.cells){let j=E.get(R(x.rowKey,x.field));if(x.ok&&j){let re=r.get(x.rowKey);if(re)re.cells[x.field]=j.value}}if(c.applyCommitResult(y),y.inserts.some((x)=>x.ok)||y.deletes.some((x)=>x.ok))await b();let L=y.cells.filter((x)=>x.ok).length+y.inserts.filter((x)=>x.ok).length+y.deletes.filter((x)=>x.ok).length,ee=i-L,te=y.cells.filter((x)=>x.stale).length+y.deletes.filter((x)=>x.stale).length;if(ee===0)C.success(`Saved ${L} change(s).`,{key:"grid.save"});else C.error(`Saved ${L} · ${ee} failed${te?` (${te} stale)`:""} — kept pending.`,{action:"file.save",key:"grid.save",source:"Data"})}catch(y){C.error("Could not save the grid.",{action:"file.save",detail:Q(y),key:"grid.save",source:"Data"})}finally{l.saving=!1,h?.done(),P()}},serializeForSource(){if(!o.serializeForSource)return null;return o.serializeForSource(c.buildBatch())},async setQuery(t){l.query=t,l.loading=!0;try{await b()}catch(i){l.error=Q(i)}finally{l.loading=!1}P()},setGrouping(t){l.grouping=t,P()},async setSort(t){let i={...l.query};if(t)i.orderBy=t.field,i.dir=t.dir;else delete i.orderBy,delete i.dir;if(!o.capabilities.remoteSort){l.query=i,P();return}await this.setQuery(i)},source:o,state:l,tab:e};return e.scope.run(()=>{ne(()=>{e.doc.dirty=c.isDirty()}),av(e,{canRedo:()=>c.canRedo(),canUndo:()=>c.canUndo(),redo:()=>{c.redo(),P()},undo:()=>{c.undo(),P()}});let t=p();if(t.subscribeFileEvents&&o.backingPaths){let i=t.subscribeFileEvents((a)=>{let f=o.backingPaths(),h=new Set;for(let y of a){if(y.isDir)continue;let R=y.path.replaceAll("\\","/"),E=f.get(R);if(E!==void 0&&!Vd(R))h.add(E)}if(h.size===0)return;if(c.isDirty()){let y=h.has("*")?l.rows.map((R)=>R.key):[...h];c.markStale(y),C.warn("Grid rows changed on disk — marked stale; refresh to reload.",{key:"grid.stale",source:"Data"}),P()}else T.refresh()});ta(i)}ta(()=>{av(e,null),H.delete(he(e)),o.dispose?.()})}),H.set(he(e),T),T}async function Gu(e){let s=ir(e)?.serializeForSource();if(s)return s;await Ot();let l=Wi(e.doc.sourceFormat);if(l?.capabilities.serialize){let r=e.doc.content.frontmatter,d=e.doc.document,c={...r,...d,children:d.children??[]};return Oa(l.name,c,{mode:"roundtrip",...e.doc.source!==null&&{source:e.doc.source}})}if(e.doc.mode==="content"){let r=ur();if(r){let d=e.doc.content.frontmatter,c=Object.keys(d).length>0,b={...d,...e.doc.document};return Oa(r.name,b,{frontmatter:c,mode:"roundtrip"})}}return ko(uO(e.doc.document,e.doc.bareRepeaters??null),e.doc.layout??null)}var Re=200,Ee=500,Te=2097152,B=new Map,K=!1,I=null,O=null,V=null,X=null;function Oe(){let e=[];for(let o of m.tabs.values())if(o.doc.dirty&&o.documentPath)e.push(o);return e}async function me(){if(!_e())return;let e=p();if(!e.setPreviewOverlay||!e.clearPreviewOverlay)return;let o=new Set;for(let s of Oe()){let l=s.documentPath.replace(/^\.\//,""),r;try{r=await Gu(s)}catch{continue}if(r.length>Te)continue;if(o.add(l),B.get(l)===r)continue;B.set(l,r),await e.setPreviewOverlay(l,r)}for(let s of B.keys())if(!o.has(s))B.delete(s),await e.clearPreviewOverlay(s)}function pe(){if(!K)return;let e=Date.now();if(V??=e,O)clearTimeout(O);let o=e-V,s=Math.max(0,Math.min(Re,Ee-o));O=setTimeout(()=>{O=null,V=null,X=me().finally(()=>{X=null})},s)}function tN(){pe()}function nN(){if(K)return;K=!0,I=ge(),I.run(()=>{ne(()=>{for(let e of m.tabs.values())e.doc.dirty,e.doc.document;pe()})})}function iN(){if(K=!1,O)clearTimeout(O),O=null;V=null,I?.stop(),I=null,B.clear()}async function _S(){if(!K)return;if(O)clearTimeout(O),O=null,V=null;await X,await me()}var ye=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,Me=new Set(["vnd","prs","x"]);function $e(e){if(!n(e))return null;let[o,...s]=e.split(";"),l=(o??"").indexOf("/");if(l===-1)return null;let r=(o??"").slice(0,l).trim().toLowerCase(),d=(o??"").slice(l+1).trim().toLowerCase();if(!ye.test(r)||!ye.test(d))return null;let c=d.lastIndexOf("+"),b=c===-1?null:d.slice(c+1),w=c===-1?d:d.slice(0,c);if(b==="")return null;let k=w.indexOf("."),G=k===-1?null:w.slice(0,k),M=G!==null&&Me.has(G)?G:null,F=M===null?w:w.slice(M.length+1);if(F==="")return null;let D={};for(let P of s){let T=P.indexOf("=");if(T===-1)return null;let t=P.slice(0,T).trim().toLowerCase(),i=P.slice(T+1).trim();if(t==="")return null;if(i.startsWith('"')&&i.endsWith('"')&&i.length>=2)i=i.slice(1,-1);D[t]=i}return{parameters:D,subtype:F,suffix:b,tree:M,type:r}}function Dw(e){let o=$e(e);if(o===null)return null;let s=o.tree===null?"":`${o.tree}.`,l=o.suffix===null?"":`+${o.suffix}`;return`${o.type}/${s}${o.subtype}${l}`}var we="text/markdown; variant=GFM",be="application/yaml",Tt={".markdown":`${we}; charset=utf-8`,".md":`${we}; charset=utf-8`,".yaml":`${be}; charset=utf-8`,".yml":`${be}; charset=utf-8`};async function oN(e,o){let s=await sI(e.name,o);return aI(e,s)}async function or(e,o){await Ot();let s=cn(e);if(!s||!s.capabilities.parse)throw nf(e);return{...await oN(s,o),format:s}}var VT=async(e,o)=>{if(e.documentPath&&cn(e.documentPath)){let l=await or(e.documentPath,o);return e.doc.source=o,{document:l.document,frontmatter:l.frontmatter}}let s=Es(o);return e.doc.layout=s.layout,{document:s.document}};function Fe(e){return"showOpenFilePicker"in e}function De(e){return"showSaveFilePicker"in e}function q(e,o){if(e.documentPath!==null)o.path=e.documentPath;return o}async function iP(){try{await Ot();let e=tu(),o=[{accept:{"application/json":[".json"]},description:"Jx Component"},...e.filter((r)=>r.capabilities.parse).map((r)=>({accept:{[Dw(r.mediaType)??"text/plain"]:r.extensions},description:r.name}))],s=[".json",...e.flatMap((r)=>r.extensions)].join(","),l=async(r,d,c=null)=>{let b=c?await rN(r):null,w=cn(r);if(w){let{document:k,frontmatter:G}=await oN(w,d);_i({document:k,documentPath:b,fileHandle:c,frontmatter:G,id:r,source:d,sourceFormat:w.name})}else if(r.endsWith(".json")){let{document:k,layout:G}=Es(d);_i({document:k,documentPath:b,fileHandle:c,id:r,layout:G})}else throw nf(r)};if(Fe(window)){let[r]=await window.showOpenFilePicker({types:o}),d=await r.getFile();await l(r.name,await d.text(),r)}else{let r=document.createElement("input");r.type="file",r.accept=s,r.addEventListener("change",async()=>{let d=r.files?.[0];if(!d)return;await l(d.name,await d.text())}),r.click()}}catch(e){if(!(e instanceof Error&&e.name==="AbortError"))C.error("Could not open the file.",{detail:Q(e),source:"Open File"})}}var ve=()=>{};function UT(e){ve=e}function _(e){let o=e.doc.document;ve(e.documentPath,o,e);let s=n(o.tagName)&&o.tagName.includes("-")?xS(o):null;if(s)C.warn(s,q(e,{key:`slots:${e.documentPath??e.id}`,source:"Components",tier:"problem"}));W(o,e.documentPath??void 0)}function Ne(e){return!jd(e.documentPath??"")}async function Sp(e=u.value){if(!e)return!1;if(await gL(e.id),hv(e))return C.warn(`You have read access to this session — changes to ${e.documentPath??"this document"} stay in your browser and cannot be saved.`,q(e,{action:"file.save",key:`save.readOnly:${e.documentPath??e.id}`,source:"Collaboration"})),!1;if(!Ne(e))return C.warn(`${e.documentPath??"This file"} is a media file, so there is no document for Save to write.`,q(e,{key:`save.notADocument:${e.documentPath??e.id}`,source:"Save"})),!1;let o=ir(e);if(o)return await o.save(),!e.doc.dirty;try{if(await H$(e))return _(e),!0;let s=await Gu(e);if(e.documentPath){if(await p().writeFile(e.documentPath,s),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return _S(),_(e),!0}if(e.fileHandle&&"createWritable"in e.fileHandle){let l=await e.fileHandle.createWritable();if(await l.write(s),await l.close(),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return _(e),!0}C.warn("This document has no save target — use Export.",{key:"save.noTarget"})}catch(s){if(!(s instanceof Error&&s.name==="AbortError"))C.error(`Could not save ${e.documentPath??e.id}.`,q(e,{action:"file.save",detail:Q(s),key:`save:${e.documentPath??e.id}`,source:"Save"}))}return!1}function Ae(e){return Wi(e.doc.sourceFormat)??(e.doc.mode==="content"?ur():void 0)}async function qT(){let e=u.value;if(!e)return;try{await Ot();let o=Ae(e),s=await Gu(e),l=o?Dw(o.mediaType)??"text/plain":"application/json",r=o?o.extensions[0]:".json",d=o?o.name:"Jx Component",c=o?`content${r}`:"component.json";if(De(window)){let b=e.documentPath?e.documentPath.split("/").pop():c,w=await window.showSaveFilePicker({suggestedName:b,types:[{accept:{[l]:[r]},description:d}]}),k=await w.createWritable();await k.write(s),await k.close(),e.doc.dirty=!1,_(e),C.success(`Exported as ${w.name}.`)}else{let b=new Blob([s],{type:l}),w=URL.createObjectURL(b),k=document.createElement("a");k.href=w,k.download=c,k.click(),URL.revokeObjectURL(w),e.doc.dirty=!1,_(e),C.success(`Downloaded ${c}.`)}}catch(o){if(!(o instanceof Error&&o.name==="AbortError"))C.error("Could not export the document.",{detail:Q(o),source:"Export"})}}async function Ce(e,o){let s=jd(e)?await Ju(e):await ar({path:e});return I$(s,o)??""}async function vb(e){let o=await Ce(e.path,"delete"),s=`Delete ${e.name}? This cannot be undone.`;return Boolean(await Ko("Delete File",o===""?s:`${s} ${o}`,{confirmLabel:"Delete",destructive:!0}))}async function yb(e,o="rename"){let s=await Ce(e,o);return s===""?void 0:s}
|
|
2
|
-
export{$w,bb,cs,zl,fm,Iw,Rw,xp,nr,wS,ir,_p,xS,eN,Gu,tN,nN,iN,_S,Dw,oN,or,VT,iP,UT,Sp,qT,vb,yb};
|
|
3
|
-
|
|
4
|
-
//# debugId=0AA46BFC0227A79464756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-q0tccd43.js.map
|