@jxsuite/studio 10.4.0 → 10.5.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-7sx2vexa.js +4 -0
- package/dist/chunks/adapter-12dxr3z7.js +4 -0
- package/dist/chunks/{add-new-flow-v0pm96mr.js → add-new-flow-any4pw2q.js} +3 -3
- package/dist/chunks/{cf-account-picker-xb8vvt2h.js → cf-account-picker-ajh60k54.js} +3 -3
- package/dist/chunks/cf-settings-hbj16kh3.js +4 -0
- package/dist/chunks/{color-area-h8dbasp1.js → color-area-gbcftzh3.js} +2 -2
- package/dist/chunks/{color-field-qv5r2b16.js → color-field-85136598.js} +3 -3
- package/dist/chunks/{color-slider-nz2mrzky.js → color-slider-w1s3ndd8.js} +2 -2
- package/dist/chunks/color-thzpppyc.js +4 -0
- package/dist/chunks/{combobox-6hs00996.js → combobox-dk98wc5x.js} +3 -3
- package/dist/chunks/components-a98hzqw9.js +4 -0
- package/dist/chunks/content-source-jq3fjs3w.js +4 -0
- package/dist/chunks/{convert-to-repeater-r8sfxjjm.js → convert-to-repeater-g66r6qp1.js} +3 -3
- package/dist/chunks/editor-rth1rzj8.js +4 -0
- package/dist/chunks/entry-commands-02j0s19w.js +4 -0
- package/dist/chunks/{extension-sections-vjzw46xb.js → extension-sections-rqrs7dr0.js} +3 -3
- package/dist/chunks/file-ops-6a49er4c.js +4 -0
- package/dist/chunks/files-b2p9y0yz.js +4 -0
- package/dist/chunks/format-host-7xe57k1s.js +4 -0
- package/dist/chunks/fs-events-0xsy168g.js +4 -0
- package/dist/chunks/grid-open-h3q4fjy5.js +4 -0
- package/dist/chunks/{grid-view-2f03wcgw.js → grid-view-0v4hjspb.js} +17 -17
- package/dist/chunks/{icons-gb967qc8.js → icons-j9eksgew.js} +2 -2
- package/dist/chunks/{iframe-entry-btck0e9s.js → iframe-entry-4zqtn3ry.js} +4 -4
- package/dist/chunks/{iframe-entry-b5qgggyp.js → iframe-entry-54kwwhmg.js} +4 -4
- package/dist/chunks/{iframe-entry-42hpmwz5.js → iframe-entry-m24fza30.js} +4 -4
- package/dist/chunks/iframe-host-8jcmaktg.js +4 -0
- package/dist/chunks/{image-bake-4afr4y6a.js → image-bake-m8gzaan9.js} +3 -3
- package/dist/chunks/{image-editor-x7t8jbjn.js → image-editor-0afyws7c.js} +3 -3
- package/dist/chunks/{index-yjrfeks8.js → index-2q88g57p.js} +3 -3
- package/dist/chunks/index-7nj2375a.js +4 -0
- package/dist/chunks/{javascript-hy2mws8v.js → javascript-5sxtr1g7.js} +3 -3
- package/dist/chunks/jsonMode-m6sf47hq.js +13 -0
- package/dist/chunks/jx-validate-808zgbgy.js +4 -0
- package/dist/chunks/layers-0ffdtqjn.js +4 -0
- package/dist/chunks/layers-panel-rw62wtvf.js +4 -0
- package/dist/chunks/{listbox-7gka1h86.js → listbox-k5p41049.js} +2 -2
- package/dist/chunks/lit-html-9bz9rcfv.js +4 -0
- package/dist/chunks/media-library-2a5hdbek.js +4 -0
- package/dist/chunks/media-open-069kzhj4.js +4 -0
- package/dist/chunks/media-picker-4p4pd28y.js +4 -0
- package/dist/chunks/menu-26nez152.js +4 -0
- package/dist/chunks/{monaco-binding-a51py33c.js → monaco-binding-1s2b8snq.js} +3 -3
- package/dist/chunks/monaco-buffer-m9fd2dka.js +4 -0
- package/dist/chunks/monaco-setup-e0crh3v6.js +4 -0
- package/dist/chunks/notify-re3js157.js +4 -0
- package/dist/chunks/platform-rywy3tkg.js +4 -0
- package/dist/chunks/popover-fhdnt4be.js +4 -0
- package/dist/chunks/publish-panel-czkpg8m4.js +4 -0
- package/dist/chunks/{publish-quick-4fwngwrw.js → publish-quick-b9wbhqj6.js} +3 -3
- package/dist/chunks/publish-workspace-yy6d23b7.js +4 -0
- package/dist/chunks/quick-search-tp7pjnmv.js +4 -0
- package/dist/chunks/references-wd2yj8s1.js +4 -0
- package/dist/chunks/right-panel-x971k0zc.js +4 -0
- package/dist/chunks/source-control-k4p00hpe.js +4 -0
- package/dist/chunks/{split-m5rwn31z.js → split-qh21j2b0.js} +2 -2
- package/dist/chunks/{studio-v5wktj6f.js → studio-151kgn69.js} +4 -4
- package/dist/chunks/studio-15mfah02.js +10 -0
- package/dist/chunks/studio-1a7zshnv.js +5 -0
- package/dist/chunks/studio-1d8m5s38.js +16 -0
- package/dist/chunks/studio-35pmfjtx.js +5 -0
- package/dist/chunks/{studio-3na1r48j.js → studio-3yr1zdp9.js} +8 -8
- package/dist/chunks/studio-43pynnhz.js +5 -0
- package/dist/chunks/studio-44xqe0b7.js +4 -0
- package/dist/chunks/{studio-hh394phe.js → studio-48yzqzqr.js} +4 -4
- package/dist/chunks/{studio-9gr7xs9r.js → studio-4jy967rj.js} +5 -5
- package/dist/chunks/{studio-4bgvvzhv.js → studio-4ncxzw5m.js} +4 -4
- package/dist/chunks/{studio-pm17wdc4.js → studio-4s5bka8t.js} +4 -4
- package/dist/chunks/{studio-5tet77de.js → studio-4z0cdh16.js} +3 -3
- package/dist/chunks/studio-5rq3e4q5.js +5 -0
- package/dist/chunks/{studio-wmjmsw0p.js → studio-69g6a0jn.js} +4 -4
- package/dist/chunks/studio-6hcfm9q3.js +5 -0
- package/dist/chunks/studio-6mf31e16.js +5 -0
- package/dist/chunks/studio-6sxnqqw8.js +5 -0
- package/dist/chunks/{studio-0939t1q1.js → studio-7qqb7hb8.js} +4 -4
- package/dist/chunks/{studio-bg8pzprg.js → studio-7qr8k0v2.js} +4 -4
- package/dist/chunks/{studio-0x6f3nk9.js → studio-8ncm9zwx.js} +4 -4
- package/dist/chunks/studio-8w5pa88p.js +7 -0
- package/dist/chunks/{studio-3qr08sxq.js → studio-9f5vcb4w.js} +3 -3
- package/dist/chunks/studio-aaw7wxv8.js +5 -0
- package/dist/chunks/studio-afx9brsc.js +5 -0
- package/dist/chunks/studio-ajfq4fmr.js +5 -0
- package/dist/chunks/{studio-evq47j2z.js → studio-ber1dgte.js} +4 -4
- package/dist/chunks/{studio-sce30r7b.js → studio-bk0anq3b.js} +3 -3
- package/dist/chunks/{studio-0gvvqj3h.js → studio-bmwgj8ez.js} +4 -4
- package/dist/chunks/{studio-s24mhq0z.js → studio-bpzwhn88.js} +4 -4
- package/dist/chunks/{studio-g9brbewz.js → studio-c72v1kwc.js} +4 -4
- package/dist/chunks/{studio-tpxcryf2.js → studio-cv6gnjqd.js} +4 -4
- package/dist/chunks/{studio-90zkgne5.js → studio-czpmzs9r.js} +7 -7
- package/dist/chunks/{studio-2pk7kc7z.js → studio-d5f7sskn.js} +4 -4
- package/dist/chunks/studio-dmgh2rrj.js +5 -0
- package/dist/chunks/{studio-nwf0c32p.js → studio-dst8y8vh.js} +4 -4
- package/dist/chunks/studio-ehj3csbm.js +6 -0
- package/dist/chunks/{studio-hfqpfmpk.js → studio-ek4fb4eb.js} +4 -4
- package/dist/chunks/studio-ep1384t9.js +5 -0
- package/dist/chunks/{studio-abh9kfdh.js → studio-eq5vqn1q.js} +4 -4
- package/dist/chunks/studio-erjccagy.js +5 -0
- package/dist/chunks/studio-ex1644g2.js +5 -0
- package/dist/chunks/studio-f3awr5nc.js +12 -0
- package/dist/chunks/studio-f69wcajk.js +9 -0
- package/dist/chunks/{studio-jma2q8r9.js → studio-g65t6svn.js} +4 -4
- package/dist/chunks/{studio-r6mx7vm5.js → studio-gw83z798.js} +5 -5
- package/dist/chunks/{studio-2x972v58.js → studio-hy936516.js} +4 -4
- package/dist/chunks/studio-j3bq30yz.js +5 -0
- package/dist/chunks/studio-j52ks8q7.js +5 -0
- package/dist/chunks/{studio-g0hxtcga.js → studio-jqvke4ac.js} +4 -4
- package/dist/chunks/{studio-bnc50f9h.js → studio-k05g7efh.js} +4 -4
- package/dist/chunks/studio-kefs4sz4.js +5 -0
- package/dist/chunks/{studio-2e4hry72.js → studio-ketrgtph.js} +5 -5
- package/dist/chunks/studio-m3jrjfhy.js +14 -0
- package/dist/chunks/{studio-45mj4jqe.js → studio-m8hesdrw.js} +4 -4
- package/dist/chunks/{studio-k0xzrse2.js → studio-n271vdsg.js} +36 -36
- package/dist/chunks/studio-n4pnf0sw.js +5 -0
- package/dist/chunks/{studio-gnazwtv3.js → studio-ncwx602y.js} +4 -4
- package/dist/chunks/{studio-amaz545p.js → studio-nngc45ct.js} +4 -4
- package/dist/chunks/{studio-eqcddvc2.js → studio-nv5eq0f7.js} +173 -173
- package/dist/chunks/{studio-az3wvyh2.js → studio-nzp0sqjg.js} +4 -4
- package/dist/chunks/{studio-k2evngrj.js → studio-pgze9p34.js} +5 -5
- package/dist/chunks/studio-ph17an19.js +5 -0
- package/dist/chunks/studio-pte5w7rf.js +9 -0
- package/dist/chunks/studio-pv1ts08p.js +6 -0
- package/dist/chunks/studio-q509sqt8.js +5 -0
- package/dist/chunks/{studio-rr00ex23.js → studio-qarg1xf9.js} +6 -6
- package/dist/chunks/studio-r5g7fx7q.js +9 -0
- package/dist/chunks/studio-s49y6m5b.js +5 -0
- package/dist/chunks/studio-s4k1v7dt.js +7 -0
- package/dist/chunks/studio-t46rt6gx.js +5 -0
- package/dist/chunks/{studio-61rg2cz5.js → studio-td3h1644.js} +4 -4
- package/dist/chunks/{studio-v7a7yb5w.js → studio-thgexj3w.js} +7 -7
- package/dist/chunks/{studio-vpevkfxw.js → studio-veh91hjv.js} +4 -4
- package/dist/chunks/studio-vswmz40d.js +6 -0
- package/dist/chunks/{studio-daksw8kh.js → studio-w3aafbpk.js} +4 -4
- package/dist/chunks/studio-w4mfaaam.js +5 -0
- package/dist/chunks/{studio-4zd6an2b.js → studio-wn2cmf9q.js} +4 -4
- package/dist/chunks/studio-x5ffyssw.js +5 -0
- package/dist/chunks/{studio-swedpd82.js → studio-x5py815g.js} +4 -4
- package/dist/chunks/{studio-4fnb5648.js → studio-xh6rf05g.js} +4 -4
- package/dist/chunks/studio-z6s56dzz.js +5 -0
- package/dist/chunks/{studio-nvcn2ykc.js → studio-zav9hgb3.js} +4 -4
- package/dist/chunks/{studio-a88ej93p.js → studio-ze1sm147.js} +6 -6
- package/dist/chunks/{studio-pj216fmn.js → studio-zkkt13qd.js} +4 -4
- package/dist/chunks/studio-zn7ysyzb.js +5 -0
- package/dist/chunks/{studio-xx3r3sb0.js → studio-ztzf8mce.js} +4 -4
- package/dist/chunks/{studio-1410q5dw.js → studio-zzgp5yka.js} +4 -4
- package/dist/chunks/{tooltip-dj1pvgz7.js → tooltip-gtx40bjg.js} +3 -3
- package/dist/chunks/{tree-j0ebwr5s.js → tree-a19s1c05.js} +2 -2
- package/dist/chunks/tsMode-3f116hth.js +14 -0
- package/dist/chunks/workspace-home-61n1jz3q.js +4 -0
- package/dist/chunks/workspace-sheek6zw.js +4 -0
- package/dist/chunks/{ws-client-arz2qsy9.js → ws-client-cb49m87s.js} +3 -3
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +82 -82
- package/dist/studio.js +97 -96
- package/dist/workers/ts.worker.js +3 -3
- package/package.json +11 -11
- package/src/browse/library-layouts.ts +9 -12
- package/src/browse/library-pane.ts +22 -16
- package/src/browse/library-source.ts +3 -4
- package/src/canvas/canvas-live-render.ts +2 -5
- package/src/canvas/canvas-page-context.ts +5 -0
- package/src/content/entry-commands.ts +32 -27
- package/src/content/entry-editor.ts +46 -44
- package/src/content/entry-inspector.ts +15 -12
- package/src/content/entry-model.ts +3 -3
- package/src/content/entry-summaries.ts +5 -5
- package/src/content/hold-state.ts +172 -0
- package/src/content/page-summaries.ts +10 -14
- package/src/editor/inline-edit.ts +6 -1
- package/src/editor/repeater-scope.ts +333 -74
- package/src/grid/sources/content-source.ts +42 -66
- package/src/panels/block-action-bar.ts +3 -4
- package/src/panels/events-panel.ts +6 -2
- package/src/panels/formula-workspace.ts +9 -0
- package/src/panels/properties-panel.ts +127 -35
- package/src/panels/statement-editor.ts +4 -0
- package/src/panels/tab-strip.ts +29 -26
- package/src/services/ai-project-tools.ts +3 -3
- package/src/services/ai-tools.ts +5 -5
- package/src/services/ai-write-report.ts +22 -4
- package/src/services/context-manager.ts +110 -2
- package/src/services/document-assistant.ts +2 -2
- package/src/services/harness/chat-reducer.ts +9 -4
- package/src/services/render-critic.ts +234 -12
- package/src/services/tool-executor.ts +16 -8
- package/src/surfaces/collections-panel.json +1 -1
- package/src/surfaces/collections-panel.ts +1 -1
- package/src/surfaces/entry-editor.json +10 -10
- package/src/surfaces/entry-editor.ts +22 -19
- package/src/surfaces/entry-inspector.json +11 -11
- package/src/surfaces/entry-inspector.ts +17 -10
- package/src/surfaces/tab-strip.json +5 -5
- package/src/surfaces/tab-strip.ts +2 -2
- package/src/types.ts +2 -0
- package/src/ui/expression-editor.ts +10 -5
- package/src/ui/schema-form.ts +18 -1
- package/src/utils/edit-display.ts +27 -1
- package/dist/chunks/2020-906vx2dq.js +0 -4
- package/dist/chunks/adapter-hnvad61x.js +0 -4
- package/dist/chunks/cf-settings-mkbcz4z2.js +0 -4
- package/dist/chunks/color-04361ttk.js +0 -4
- package/dist/chunks/components-w5zqwva1.js +0 -4
- package/dist/chunks/content-source-g38w0d3f.js +0 -4
- package/dist/chunks/editor-wvf5e6j9.js +0 -4
- package/dist/chunks/entry-commands-t13dyw3c.js +0 -4
- package/dist/chunks/file-ops-1sghzgcr.js +0 -4
- package/dist/chunks/files-zrqtgt41.js +0 -4
- package/dist/chunks/format-host-9gy76erh.js +0 -4
- package/dist/chunks/fs-events-45rhg3me.js +0 -4
- package/dist/chunks/grid-open-t4fq6bbm.js +0 -4
- package/dist/chunks/iframe-host-9aq8ze3q.js +0 -4
- package/dist/chunks/index-f9qr7kzh.js +0 -4
- package/dist/chunks/jsonMode-vj30te2h.js +0 -13
- package/dist/chunks/jx-validate-r4ax11e3.js +0 -4
- package/dist/chunks/layers-m49nmwvx.js +0 -4
- package/dist/chunks/layers-panel-zr92pwdp.js +0 -4
- package/dist/chunks/lit-html-k2mb9k0r.js +0 -4
- package/dist/chunks/media-library-j74rt0w4.js +0 -4
- package/dist/chunks/media-open-mypr0k6b.js +0 -4
- package/dist/chunks/media-picker-pemtbsjv.js +0 -4
- package/dist/chunks/menu-d2jxpgma.js +0 -4
- package/dist/chunks/monaco-buffer-pa0g6ax7.js +0 -4
- package/dist/chunks/monaco-setup-0hw9f835.js +0 -4
- package/dist/chunks/notify-bwehrp7q.js +0 -4
- package/dist/chunks/platform-kv0k65cy.js +0 -4
- package/dist/chunks/popover-9tf4cjrk.js +0 -4
- package/dist/chunks/publish-panel-vg1n880b.js +0 -4
- package/dist/chunks/publish-workspace-jv4w2bx2.js +0 -4
- package/dist/chunks/quick-search-nh29rt8a.js +0 -4
- package/dist/chunks/references-vqyr5s9x.js +0 -4
- package/dist/chunks/right-panel-3ws9f2w0.js +0 -4
- package/dist/chunks/source-control-h3hcs5gy.js +0 -4
- package/dist/chunks/studio-0khd8xtx.js +0 -4
- package/dist/chunks/studio-1ctnw3xv.js +0 -5
- package/dist/chunks/studio-1ks5d9y4.js +0 -5
- package/dist/chunks/studio-1y9mab9m.js +0 -5
- package/dist/chunks/studio-2kpxm0eh.js +0 -7
- package/dist/chunks/studio-2zz4qbv9.js +0 -5
- package/dist/chunks/studio-3pz4t5a2.js +0 -5
- package/dist/chunks/studio-4f7thq0p.js +0 -5
- package/dist/chunks/studio-7rrdbvex.js +0 -5
- package/dist/chunks/studio-9dq7rwc7.js +0 -5
- package/dist/chunks/studio-acer0g8w.js +0 -5
- package/dist/chunks/studio-brh8d2pr.js +0 -5
- package/dist/chunks/studio-c2fa783p.js +0 -9
- package/dist/chunks/studio-cfnn70h1.js +0 -5
- package/dist/chunks/studio-cqxj4fcy.js +0 -5
- package/dist/chunks/studio-cw11h078.js +0 -5
- package/dist/chunks/studio-dn56z7sn.js +0 -5
- package/dist/chunks/studio-egnjpyde.js +0 -9
- package/dist/chunks/studio-ejrypvmq.js +0 -5
- package/dist/chunks/studio-frc16j8v.js +0 -10
- package/dist/chunks/studio-j0zf5x2x.js +0 -5
- package/dist/chunks/studio-j5fcp6gj.js +0 -5
- package/dist/chunks/studio-jd1qb1st.js +0 -7
- package/dist/chunks/studio-k1xqrgm5.js +0 -5
- package/dist/chunks/studio-k3we3kqb.js +0 -5
- package/dist/chunks/studio-knsjyx7n.js +0 -5
- package/dist/chunks/studio-mrjtnm62.js +0 -5
- package/dist/chunks/studio-n9qba0gx.js +0 -5
- package/dist/chunks/studio-nzemfbkk.js +0 -14
- package/dist/chunks/studio-pwctzka3.js +0 -16
- package/dist/chunks/studio-q80fg1d6.js +0 -12
- package/dist/chunks/studio-q9hx2qp0.js +0 -5
- package/dist/chunks/studio-qrzmfaf6.js +0 -5
- package/dist/chunks/studio-tmfcn347.js +0 -6
- package/dist/chunks/studio-wqfaqw4m.js +0 -5
- package/dist/chunks/studio-xpx91fby.js +0 -6
- package/dist/chunks/studio-xva3hzkv.js +0 -5
- package/dist/chunks/studio-z3fztxrp.js +0 -9
- package/dist/chunks/studio-z9453ypn.js +0 -6
- package/dist/chunks/tsMode-jg1dtphj.js +0 -14
- package/dist/chunks/workspace-6ztqcrsh.js +0 -4
- package/dist/chunks/workspace-home-rse9h8a0.js +0 -4
- package/src/content/draft-state.ts +0 -108
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{X}from"./studio-9c6cbq2c.js";import{p}from"./studio-4fnb5648.js";import{w}from"./studio-sce30r7b.js";import{ph,us,iI}from"./studio-4zd6an2b.js";import{Jt,Ut}from"./studio-nzemfbkk.js";import{sn,dt,Fn}from"./studio-tpxcryf2.js";import{m,h,eu}from"./studio-knsjyx7n.js";import{Kd}from"./studio-hh394phe.js";import{Jc,Ta,J$,RO,Y$,Nx,Ys,Ax,NO,AO,Ox,Mx,ov,nr,Vd,Yc,hh,fl,Px}from"./studio-61rg2cz5.js";import{oA,Qw,ex,Xu}from"./studio-3pz4t5a2.js";import{ET,Gu}from"./studio-4bgvvzhv.js";import{zt}from"./studio-daksw8kh.js";import{_L,SL,CL,kL,Zu,XS,QS,eC,tC}from"./studio-jma2q8r9.js";import{_p}from"./studio-z9453ypn.js";import{Ve,Ln,vt,E,R}from"./studio-9dq7rwc7.js";import{Me}from"./studio-0gvvqj3h.js";import{g}from"./studio-3qr08sxq.js";import{n,_}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";var H=[{key:"all",label:"All media"},{key:"image",label:"Images"},{key:"video",label:"Video"},{key:"audio",label:"Audio"},{key:"document",label:"Documents"},{key:"font",label:"Fonts"},{key:"unused",label:"Unused"}],lS=H.map((e)=>e.key);function re(e){return lS.some((t)=>t===e)}function T(e){return H.find((t)=>t.key===e)?.label??"All media"}var U=[{key:"newest",label:"Newest"},{key:"name",label:"Name"},{key:"size",label:"Size"}],Re=U.map((e)=>e.key);function ne(e){return Re.some((t)=>t===e)}function W(e,t,i){switch(t){case"all":return!0;case"unused":return i!==null&&i.has(e.file);default:return e.kind===t}}function A(e,t){let i=t.trim().toLowerCase();return i===""||e.name.toLowerCase().includes(i)}function q(e,t){return e.filter((a)=>W(a,t.filter,t.unused)&&A(a,t.query)).toSorted((a,r)=>Ae(t.sort,a,r)||a.file.localeCompare(r.file))}function Ae(e,t,i){switch(e){case"name":return t.name.localeCompare(i.name,void 0,{numeric:!0,sensitivity:"base"});case"size":return(i.bytes??-1)-(t.bytes??-1);default:return(i.modified??"").localeCompare(t.modified??"")}}function oe(e,t){let i={all:e.length,audio:0,document:0,font:0,image:0,unused:t===null?null:e.filter((a)=>t.has(a.file)).length,video:0};for(let a of e)i[a.kind]=(i[a.kind]??0)+1;return i}var Ie=132,ae=12;function le(e){return Math.max(1,Math.floor((e+ae)/(Ie+ae)))}function se(e,t,i,a,r=!1){if(a===0)return null;let o=Math.min(Math.max(e,0),a-1),l=o-o%i,c;switch(t){case"ArrowRight":{c=o+1;break}case"ArrowLeft":{c=o-1;break}case"ArrowDown":{c=o+i;break}case"ArrowUp":{c=o-i;break}case"Home":{c=r?0:l;break}case"End":{c=r?a-1:Math.min(l+i-1,a-1);break}default:return null}return c<0||c>=a?o:c}var de={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaLibrary",$description:"The Media workspace's library (`specs/studio.md` §22.6): the project's media as filters, a grid and the selected file's detail. ONE document in two modes. In `manage` it is the Media home tab, with Replace, Open in viewer, Rename, Duplicate and Delete under the detail; in `pick` it is the full-size picker inside a `jx-dialog` (`media-pick-dialog.json`), and the dialog's own footer answers Cancel or Use <file>. `media/media-library.ts` keeps every decision (which files a filter keeps, the sort, what a count may claim, where an arrow lands, what Replace writes) and hands this document strings and discriminants. **Unused is drawn with no number until the usage sweep has settled**, and Missing alt text and tags are not drawn at all: each needs a store that does not exist, and a filter that cannot be answered is not shipped as one that always answers nothing.",tagName:"div",attributes:{part:"media-library","data-jx-region":"${state.region}","data-mode":"${state.mode}","data-drop":"${state.dropActive}"},style:{$description:"Three columns over the whole stage: the filters, the grid with its toolbar, and the selected file's detail. Fills the pane's stage by its own geometry, as the workspace home does: the stage is `position: relative` (`pane-grid.json`). In pick mode the same columns fill the dialog's body instead, so the root's box is the only thing that differs between the two modes.",position:"absolute",inset:"0",display:"grid",gridTemplateColumns:"200px minmax(0, 1fr) 300px",boxSizing:"border-box",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",background:"var(--bg)",'&[data-mode="pick"]':{$description:"Inside a dialog there is no stage to fill: the box is the dialog body's, at a height the dialog can scroll within.",position:"relative",inset:"auto",height:"min(70vh, 620px)",gridTemplateColumns:"150px minmax(0, 1fr) 210px"},'&[data-drop="true"]':{$description:"The drop affordance is a STATE the flow holds, not a class a handler adds and forgets to take off.",outline:"2px dashed var(--accent)",outlineOffset:"-4px"},'& [part="filters"]':{display:"flex",flexDirection:"column",gap:"2px",padding:"var(--jx-space-3) var(--jx-space-2)",borderRight:"1px solid var(--border)",background:"var(--bg-panel)",overflowY:"auto"},'& [part="filters-heading"]':{margin:"0",padding:"var(--jx-space-2) var(--jx-space-2) var(--jx-space-1)",fontSize:"var(--jx-text-xs)",fontWeight:"600",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="filter"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",height:"30px",padding:"0 var(--jx-space-2)",border:"none",borderRadius:"var(--radius)",background:"none",color:"var(--fg)",font:"inherit",textAlign:"left",cursor:"pointer"},'& [part="filter"]:hover':{background:"var(--hover-bg)"},'& [part="filter"][aria-pressed="true"]':{background:"color-mix(in srgb, var(--accent) 16%, transparent)",color:"var(--fg)",fontWeight:"600"},'& [part="filter"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="filter-count"]':{marginLeft:"auto",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",fontWeight:"400"},'& [part="main"]':{display:"flex",flexDirection:"column",minWidth:"0",minHeight:"0"},'& [part="toolbar"]':{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)"},'& [part="title"]':{margin:"0 auto 0 0",fontSize:"var(--jx-text-lg)",fontWeight:"600"},'& [part="search"]':{width:"220px"},'& [part="sort"]':{width:"130px"},'& [part="upload"], & [part="empty-upload"]':{$description:"A LABEL around the file picker, not a button that clicks a hidden one: the picker is the control, so it takes focus, Enter opens it and a screen reader announces a file upload. A plain element because a label forwards a click to the input it contains and a custom element between the two would break that.",position:"relative",display:"inline-flex",alignItems:"center",gap:"6px",height:"28px",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",font:"inherit",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":has(:focus-visible)":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="upload-input"], & [part="replace-input"]':{$description:"Out of the way but still FOCUSABLE: `display: none` would take the control out of the tab order, and the label around it draws the focus ring for it.",position:"absolute",width:"1px",height:"1px",opacity:"0",pointerEvents:"none"},'& [part="upload-glyph"]':{"--jx-icon-size":"16px"},'& [part="body"]':{flex:"1",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-4)"},'& [part="grid"]':{$description:"auto-fill over a minimum tile width; `media/media-library-model.ts` `gridColumns` does the same arithmetic, so ArrowDown lands on the tile drawn under the current one. Keep the two numbers in step.",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(132px, 1fr))",gap:"12px",alignContent:"start"},'& [part="tile"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"4px",borderRadius:"var(--jx-radius-md, 6px)",border:"2px solid transparent",cursor:"pointer",minWidth:"0",outline:"none"},'& [part="tile"]:hover':{background:"var(--hover-bg)"},'& [part="tile"][aria-selected="true"]':{borderColor:"var(--accent)"},'& [part="tile"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"2px"},'& [part="thumb"]':{display:"flex",alignItems:"center",justifyContent:"center",aspectRatio:"4 / 3",borderRadius:"var(--radius)",background:"var(--bg-input)",overflow:"hidden",color:"var(--fg-dim)","--jx-icon-size":"28px"},'& [part="thumb-img"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="tile-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-sm)"},'& [part="tile-caption"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",minHeight:"1em"},'& [part="empty"]':{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",padding:"48px var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)","--jx-icon-size":"40px"},'& [part="empty-title"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="empty-detail"]':{margin:"0",maxWidth:"42ch",lineHeight:"1.5"},'& [part="detail"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-4)",borderLeft:"1px solid var(--border)",background:"var(--bg-panel)",overflowY:"auto",minWidth:"0"},'& [part="detail-hint"]':{margin:"auto 0",textAlign:"center",color:"var(--fg-dim)"},'& [part="detail-preview"]':{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"140px",maxHeight:"220px",borderRadius:"var(--radius)",background:"var(--bg-input)",overflow:"hidden",color:"var(--fg-dim)","--jx-icon-size":"40px"},'& [part="preview-img"], & [part="preview-video"]':{maxWidth:"100%",maxHeight:"220px",objectFit:"contain"},'& [part="preview-audio"]':{width:"100%"},'& [part="preview-specimen"]':{$description:"The viewer's specimen at a side pane's size. The face arrives as the `@font-face` the flow writes under a family name generated from the path (`media/media-pane.ts` `specimenOf`); the element carries only that name, as a custom property, and the fallback stack is a rule, here.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-4)",maxWidth:"100%",color:"var(--fg)",fontFamily:"var(--jx-specimen-family, system-ui), system-ui, sans-serif"},'& [part="specimen-line"]':{margin:"0",lineHeight:"1.3",overflowWrap:"anywhere"},'& [part="specimen-line"][data-size="32"]':{fontSize:"32px"},'& [part="specimen-line"][data-size="14"]':{fontSize:"var(--jx-text-md)"},'& [part="detail-name"]':{margin:"0",fontSize:"var(--jx-text-md)",fontWeight:"600",overflowWrap:"anywhere"},'& [part="facts"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="group-title"]':{margin:"0",fontSize:"var(--jx-text-xs)",fontWeight:"600",color:"var(--fg-dim)"},'& [part="url"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="url-value"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--jx-font-mono)",fontSize:"var(--jx-text-sm)"},'& [part="usage"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="usage-headline"]':{margin:"0",fontSize:"var(--jx-text-sm)"},'& [part="usage-list"]':{margin:"0",padding:"0",listStyle:"none",display:"flex",flexDirection:"column",gap:"2px"},'& [part="usage-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="usage-link"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",border:"none",background:"none",padding:"0",color:"var(--accent)",font:"inherit",fontSize:"var(--jx-text-sm)",textAlign:"left",cursor:"pointer",":hover":{textDecoration:"underline"},":focus-visible":{outline:"var(--jx-focus-ring)"}},'& [part="usage-count"]':{fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="actions"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)",marginTop:"var(--jx-space-2)"},'& [part="replace"]':{position:"relative",display:"inline-flex",alignItems:"center",height:"28px",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg)",color:"var(--fg)",font:"inherit",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":has(:focus-visible)":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}}},ondragover:{$prototype:"Function",body:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/dragOver"},value:[]}],description:"A file dropped ANYWHERE on the library uploads, to the destination the Upload label names before the drop: public/media/."},ondragleave:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dragOut"},value:[]}]},ondrop:{$prototype:"Function",body:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/drop"},value:[{$ref:"event#/dataTransfer/files"}]}]},children:[{tagName:"nav",attributes:{part:"filters","aria-label":"Media filters"},children:[{tagName:"h2",attributes:{part:"filters-heading"},textContent:"Library"},{$prototype:"Array",items:{$ref:"#/state/filters"},key:{$ref:"$map/item/key"},map:{tagName:"button",attributes:{part:"filter",type:"button","aria-pressed":"${$map.item.pressed}","data-filter":"${$map.item.key}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"filter-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"filter-count"},textContent:"${$map.item.count}"}]}}]},{tagName:"section",attributes:{part:"main","aria-labelledby":"${state.titleId}"},children:[{tagName:"header",attributes:{part:"toolbar"},children:[{tagName:"h2",attributes:{part:"title",id:"${state.titleId}"},textContent:"${state.title}"},{tagName:"jx-textfield",attributes:{part:"search"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search by name…",autocomplete:"off",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setQuery"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"sort"},$props:{label:"Sort",size:"sm",options:{$ref:"#/state/sortOptions"},value:{$ref:"#/state/sort"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSort"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"label",attributes:{part:"upload",title:"${state.uploadHint}"},children:[{tagName:"input",attributes:{part:"upload-input",type:"file",multiple:!0,accept:"${state.uploadAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"event#/target"}]}],description:"The picker itself, so the destination in the label's tooltip is visible BEFORE the files are chosen. The flow takes the element rather than the file list because a file input that is not cleared refuses the same file twice."}},{tagName:"jx-icon",attributes:{part:"upload-glyph","aria-hidden":"true"},$props:{name:"upload-simple"}},{tagName:"span",textContent:"Upload"}]}]},{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"grid-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/gridState"},cases:{loading:{tagName:"p",attributes:{part:"empty",role:"status"},textContent:"Reading the project's media…"},counting:{tagName:"p",attributes:{part:"empty",role:"status"},textContent:"${state.countingLabel}"},empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"jx-icon",attributes:{part:"empty-glyph","aria-hidden":"true"},$props:{name:"image"}},{tagName:"p",attributes:{part:"empty-title"},textContent:"${state.emptyTitle}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"},{tagName:"label",attributes:{part:"empty-upload",title:"${state.uploadHint}"},children:[{tagName:"input",attributes:{part:"upload-input",type:"file",multiple:!0,accept:"${state.uploadAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"event#/target"}]}],description:"The picker itself, so the destination in the label's tooltip is visible BEFORE the files are chosen. The flow takes the element rather than the file list because a file input that is not cleared refuses the same file twice."}},{tagName:"jx-icon",attributes:{part:"upload-glyph","aria-hidden":"true"},$props:{name:"upload-simple"}},{tagName:"span",textContent:"Upload"}]}]},nomatch:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"jx-icon",attributes:{part:"empty-glyph","aria-hidden":"true"},$props:{name:"image"}},{tagName:"p",attributes:{part:"empty-title"},textContent:"${state.emptyTitle}"},{tagName:"p",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"},value:[]}]},children:[{tagName:"span",textContent:"Show all media"}]}]},listed:{tagName:"div",attributes:{part:"grid",role:"listbox","aria-labelledby":"${state.titleId}"},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowRight:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowLeft:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],Home:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],End:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activateSelected"},value:[]}]}}],description:"The grid pattern: arrows move one tile, Home and End to the ends of the row, Ctrl+Home and Ctrl+End to the ends of the grid, and Enter opens the selected file (in pick mode, uses it). The flow computes where the move lands; the tile that receives it takes focus, so the roving tabindex follows the selection."},children:[{$prototype:"Array",items:{$ref:"#/state/tiles"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"tile",role:"option","aria-selected":"${$map.item.selected}",tabindex:"${$map.item.tabindex}","data-file":"${$map.item.file}",title:"${$map.item.name}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/file"}]}]},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/focusTile"},value:[{$ref:"$map/item/file"}]}],description:"Selection follows focus, the listbox pattern: a Tab onto the grid lands on the roving stop and selects it, so the first Enter opens (in pick mode, uses) the tile the focus ring is on rather than nothing."},ondblclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/file"}]}]},oncontextmenu:{$prototype:"Function",body:[{$switch:{$ref:"#/state/mode"},cases:{manage:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/file"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]}}],description:"Manage mode only: the detail pane's actions at the pointer. Pick mode's dialog is modal, and a menu in the popover layer outside it would be inert, so its right-click is left to the platform."},children:[{tagName:"div",attributes:{part:"thumb"},children:[{tagName:"div",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{image:{tagName:"img",attributes:{part:"thumb-img",src:"${$map.item.thumbSrc}",alt:"",draggable:"false"},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}},pending:{tagName:"span",attributes:{part:"thumb-pending","aria-hidden":"true"}},glyph:{tagName:"jx-icon",attributes:{part:"thumb-glyph","aria-hidden":"true"},$props:{name:{$ref:"$map/item/glyph"}}}},$description:"The thumbnail is asked for when the tile scrolls into view, not when the grid is built: `pending` until the flow's observer reports the tile, then the picture. A file the browser draws no picture of shows its kind's glyph."}]},{tagName:"span",attributes:{part:"tile-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"tile-caption"},textContent:"${$map.item.caption}"}]}}]}}}]}]},{tagName:"aside",attributes:{part:"detail","aria-label":"Details"},children:[{tagName:"div",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/detailState"},cases:{none:{tagName:"p",attributes:{part:"detail-hint"},textContent:"${state.detailHint}"},shown:{tagName:"div",attributes:{part:"detail-body",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"detail-preview"},children:[{tagName:"div",attributes:{part:"preview-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/previewKind"},cases:{image:{tagName:"img",attributes:{part:"preview-img",src:"${state.previewSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"#/state/selectedFile"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}},video:{tagName:"video",attributes:{part:"preview-video",src:"${state.previewSrc}",controls:!0}},audio:{tagName:"audio",attributes:{part:"preview-audio",src:"${state.previewSrc}",controls:!0}},font:{tagName:"div",attributes:{part:"preview-specimen",style:"${state.previewSpecimenFamily}"},children:[{tagName:"style",textContent:"${state.previewFontFace}"},{tagName:"p",attributes:{part:"specimen-line","data-size":"32"},textContent:"Aa"},{tagName:"p",attributes:{part:"specimen-line","data-size":"14"},textContent:"${state.previewSpecimen}"}]},glyph:{tagName:"jx-icon",attributes:{part:"preview-glyph","aria-hidden":"true"},$props:{name:{$ref:"#/state/previewGlyph"}}}}}]},{tagName:"h3",attributes:{part:"detail-name"},textContent:"${state.detailName}"},{tagName:"p",attributes:{part:"facts"},textContent:"${state.detailFacts}"},{tagName:"div",attributes:{part:"url-group"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"Site URL"},{tagName:"div",attributes:{part:"url"},children:[{tagName:"code",attributes:{part:"url-value"},textContent:"${state.detailRef}"},{tagName:"jx-action-button",attributes:{part:"copy"},$props:{size:"sm",quiet:!0,hint:"Copy the site URL"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/copyRef"},value:[]}]},children:[{tagName:"span",textContent:"Copy"}]}]}]},{tagName:"div",attributes:{part:"usage-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/usageState"},cases:{shown:{tagName:"div",attributes:{part:"usage"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"Used on"},{tagName:"p",attributes:{part:"usage-headline"},textContent:"${state.usageHeadline}"},{tagName:"div",attributes:{part:"usage-list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasUsageFiles"},cases:{true:{tagName:"ul",attributes:{part:"usage-list"},children:[{$prototype:"Array",items:{$ref:"#/state/usageFiles"},key:{$ref:"$map/item/path"},map:{tagName:"li",attributes:{part:"usage-row","data-usage":"${$map.item.path}"},children:[{tagName:"button",attributes:{part:"usage-link",type:"button",title:"Open ${$map.item.path}"},textContent:"${$map.item.path}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openDocument"},value:[{$ref:"$map/item/path"}]}]}},{tagName:"span",attributes:{part:"usage-count"},textContent:"${$map.item.count}"}]}}]}}}]}},$description:'Hidden on a host with no reference index, which is a different fact from "nothing uses it": a confident zero is the one answer this pane must never invent.'},{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{manage:{tagName:"div",attributes:{part:"actions"},children:[{tagName:"label",attributes:{part:"replace",title:"Replace ${state.detailName} everywhere it is used"},children:[{tagName:"input",attributes:{part:"replace-input",type:"file",accept:"${state.replaceAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[{$ref:"event#/target"}]}],description:"Replace writes the chosen file over this one's path, so every reference keeps resolving and now shows the new bytes (studio.md §9.3). The element rather than the list, so the input can be cleared."}},{tagName:"span",textContent:"Replace"}]},{tagName:"jx-button",attributes:{part:"open-viewer"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openViewer"},value:[]}]},children:[{tagName:"span",textContent:"Open in viewer"}]},{tagName:"div",attributes:{part:"edit-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editable"},cases:{yes:{tagName:"jx-button",attributes:{part:"edit-image"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editImage"},value:[]}],description:"Withheld, not disabled, for a file the editor cannot write: a refused format is not offered rather than offered and then refused (studio.md §9.5)."},children:[{tagName:"span",textContent:"Edit image"}]},no:{tagName:"span",attributes:{hidden:!0}}}},{tagName:"jx-button",attributes:{part:"rename"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/rename"},value:[]}]},children:[{tagName:"span",textContent:"Rename"}]},{tagName:"div",attributes:{part:"duplicate-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/duplicable"},cases:{yes:{tagName:"jx-button",attributes:{part:"duplicate"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/duplicate"},value:[]}],description:"Withheld, not disabled, on a backend that cannot read a file's raw bytes: a copy read as text would be a broken file (studio.md §9.3)."},children:[{tagName:"span",textContent:"Duplicate"}]},no:{tagName:"span",attributes:{hidden:!0}}}},{tagName:"jx-button",attributes:{part:"delete"},$props:{size:"sm",variant:"negative"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[]}]},children:[{tagName:"span",textContent:"Delete"}]}]}},$description:"Manage mode's actions. Pick mode has none here: its answer is the dialog's own footer, Cancel and Use <file>."}]}}}]}]};E("media-library",de);function Oe(){return{countingLabel:"",detailFacts:"",detailHint:"",detailName:"",detailRef:"",detailState:"none",dropActive:"false",emptyDetail:"",emptyTitle:"",filters:[],gridState:"loading",mode:"manage",previewFontFace:"",previewGlyph:"",previewKind:"glyph",previewSpecimen:"",previewSpecimenFamily:"",previewSrc:"",query:"",region:"",replaceAccept:"",editable:"no",duplicable:"no",selectedFile:"",sort:"",sortOptions:[],tiles:[],title:"",titleId:"",uploadAccept:"",uploadHint:"",usageFiles:[],usageHeadline:"",usageState:"hidden"}}function pe(e,t){Object.assign(e,t),e.hasUsageFiles=t.usageFiles.length>0}function Ke(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function ze(e){let t=e?.$map,i=_(t)&&"item"in t?t.item:void 0;return _(i)&&"file"in i&&n(i.file)?i.file:null}function V(e,t,i,a){if(a.clear)e.replaceChildren();let{tileHost:r,gridHost:o,inputHost:l,...c}=i,d=g({...Oe(),...c,hasUsageFiles:!1});pe(d,t);let f=null,b=!1,M=R("media-library",d,e,{onNodeCreated:(u,s,F,Ee)=>{if(b||!(u instanceof HTMLElement))return;let C=Ke(F);if(C==="tile"){let ie=ze(Ee);if(ie!==null)r(u,ie)}else if(C==="grid")o(u);else if(u instanceof HTMLInputElement&&C==="upload-input")l(u,"upload");else if(u instanceof HTMLInputElement&&C==="replace-input")l(u,"replace")}}).then((u)=>{if(b)u.dispose();else f=u;return u.root});return{attached:()=>{if(b)return!1;let u=f?.root;return u===void 0?!0:u instanceof HTMLElement&&e.contains(u)},dispose(){b=!0,f?.dispose(),f=null},ready:M,update:(u)=>pe(d,u)}}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaPickDialog",$description:"The full-size media picker (`specs/studio.md` §9.3): a `jx-dialog` whose body is the Media workspace's own library surface in pick mode, so the picker and the workspace are one surface at two sizes. The dialog owns modality, Escape, the backdrop and focus restoration, and its footer is the answer: Cancel, or Use <file>, disabled until a file is chosen. The body is an ISLAND: this document draws the slot and nothing in it, and `surfaces/media-pick-dialog.ts` mounts `media-library.json` there through `onNodeCreated`.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},confirmDisabled:{$ref:"#/state/blocked"},cancelLabel:"Cancel",dismissible:!0,size:"xl"},attributes:{part:"media-pick"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},children:[{tagName:"div",attributes:{part:"library-slot"},style:{$description:"The library's box in pick mode is its own (`media-library.json`, `data-mode=\"pick\"`); the slot only gives it the dialog body's width.",minWidth:"0"}}]};E("media-pick-dialog",ue);var B="media-picker";function Ue(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function fe(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ve,vt("dialog",B)),e.layer.append(t);let i=!1,a=()=>{if(i)return;i=!0,e.closed()},r=()=>i,o=g({...e.view,closed:a,confirm:e.confirm}),l=null,c=R("media-pick-dialog",o,t,{onNodeCreated:(d,f,b)=>{if(!r()&&d instanceof HTMLElement&&Ue(b)==="library-slot")e.body(d)}}).then(async(d)=>{l=d;let f=d.root;if(r())return d.dispose(),f;if(await sn(f),!r())Jt(f);return f});return{close(){let d=l?.root;if(d instanceof HTMLElement)Ut(d);l?.dispose(),l=null,t.remove(),a()},host:t,ready:c,update(d){Object.assign(o,d)}}}var uF="media-home",ve={audio:"play",document:"file-text",font:"text-aa",image:"image",video:"play"},We={audio:"Audio",document:"Document",font:"Font",image:"Image",video:"Video"},y={filter:"all",query:"",sort:"newest",selected:null},D=null,S=null,O=0,K=0,P=!1,Y=0;function J(){S=null,P=!1,O=0,K=0,Y+=1}function qe(){return[...L].some((e)=>!e.disposed&&e.choice.filter==="unused")}async function Be(e){if(P||S!==null||!ph())return;let t=Y;P=!0,O=0,K=e.length;let i=new Set;for(let a of e){let r=await Xu(a.file);if(t!==Y)return;if(!qe()){J();return}if(r.status==="ready"&&r.result.files.length===0)i.add(a.file);O+=1,x()}S=i,P=!1,x()}var L=new Set,k=new Map,Q=new Set,j=null;function we(){if(j!==null)return;let e=()=>{J(),x()},t=ET(e),i=iI(e);j=()=>{t(),i()}}function Ge(){if(L.size===0&&j)j(),j=null}function v(e){if(!e.disposed){if(e.handle?.update(ee(e)),e.onSelect?.(),Ye(e),e.focusOwed)queueMicrotask(()=>He(e));xe(e)}}function Ye(e){let t=e.reveal,i=t===null?void 0:e.tiles.get(t);if(i?.isConnected){if(e.reveal=null,i.scrollIntoView({block:"nearest"}),e.revealFocus)e.revealFocus=!1,i.focus()}}function xe(e){if(e.sweepTimer!==null||e.disposed)return;e.sweepTimer=setTimeout(()=>{e.sweepTimer=null,e.observer.releaseDetached();for(let[t,i]of e.tiles)if(!i.isConnected)e.tiles.delete(t);for(let t of[e.inputs.upload,e.inputs.replace])for(let i of t)if(!i.isConnected)t.delete(i)},0)}function $e(e){return[...e].find((t)=>t.isConnected)??null}function x(){for(let e of L)v(e)}function Z(e){if(e.disposed=!0,e.sweepTimer!==null)clearTimeout(e.sweepTimer),e.sweepTimer=null;e.inputs.upload.clear(),e.inputs.replace.clear(),e.observer.destroy(),e.handle?.dispose(),e.handle=null,e.tiles.clear(),L.delete(e),Ge()}function ke(e){let t=Gu(),i=t===null?null:e.images?t.filter((r)=>r.isImage):t;return{files:(i??[]).map((r)=>{let o=Yc(r.file);return{bytes:o?.bytes??null,file:r.file,kind:r.kind,modified:o?.modified??null,name:r.name}}),listed:i}}function Je(e){return H.filter((t)=>(t.key!=="unused"||ph())&&(!e.images||t.key==="image"||t.key==="unused"))}function wb(e){let{filter:t,query:i,selected:a}=e.choice;if(a===null)return null;let r=Gu()?.find((l)=>l.file===a)??null;if(r===null||e.images&&!r.isImage)return null;let o={bytes:null,file:r.file,kind:r.kind,modified:null,name:r.name};return W(o,t,S)&&A(o,i)?r:null}function Qe(e,t){if(t===0)return{emptyDetail:`Upload files or drop them anywhere here. They are saved under ${e.uploadDir}/, and anything already under public/ or a collection's images/ folder is listed here too.`,emptyTitle:e.images?"No images yet":"No media yet"};let{filter:i,query:a}=e.choice;if(a.trim()!=="")return{emptyDetail:`Nothing in ${T(i)} matches it.`,emptyTitle:`No matches for “${a.trim()}”`};if(i==="unused")return{emptyDetail:"Every file is referenced by at least one document.",emptyTitle:"No unused media"};return{emptyDetail:`${t} ${t===1?"file":"files"} in the project, none of them ${T(i).toLowerCase()}.`,emptyTitle:`No ${T(i).toLowerCase()}`}}function ee(e){let{choice:t}=e,{files:i,listed:a}=ke(e),r=oe(i,S),o=Je(e);if(!o.some((s)=>s.key===t.filter))t.filter=o[0]?.key??"all";let l=q(i,{filter:t.filter,query:t.query,sort:t.sort,unused:S}),c=Gu();if(t.filter==="unused"&&c!==null)Be(c);let d="listed";if(a===null)d="loading";else if(t.filter==="unused"&&S===null)d="counting";else if(i.length===0||l.length===0)d=i.length===0?"empty":"nomatch";let f=wb(e),b=l.some((s)=>s.file===t.selected)?t.selected:l[0]?.file??null,M=l.map((s)=>{let F=s.kind==="image";return{caption:Px(Yc(s.file))||We[s.kind],file:s.file,glyph:ve[s.kind],key:s.file,name:s.name,selected:s.file===t.selected?"true":"false",tabindex:s.file===b?"0":"-1",thumbSrc:F&&e.visible.has(s.file)?nr(s.file):"",thumbState:F?e.visible.has(s.file)?"image":"pending":"glyph"}}),u=e.images&&t.filter==="image"?"Images":T(t.filter);return{countingLabel:K>0?`Counting references… ${O} of ${K}`:"Counting references…",dropActive:e.dropActive?"true":"false",filters:o.map((s)=>{let F=r[s.key];return{count:F===null?"":String(F),key:s.key,label:e.images&&s.key==="image"?"All images":s.label,pressed:s.key===t.filter?"true":"false"}}),gridState:d,mode:e.mode,query:t.query,region:e.region,sort:t.sort,sortOptions:U.map((s)=>({label:s.label,value:s.key})),tiles:M,title:u,titleId:`media-library-title-${e.region.replaceAll(/[^\w-]/g,"-")}`,uploadAccept:e.images?"image/*":Jc(),uploadHint:`Upload into ${e.uploadDir}/`,...Qe(e,i.length),...Xe(e,f)}}function Xe(e,t){if(t===null)return{detailFacts:"",detailHint:e.mode==="pick"?"Choose a file to use it.":"Select a file to see its details.",detailName:"",detailRef:"",detailState:"none",previewFontFace:"",previewGlyph:"",previewKind:"glyph",previewSpecimen:"",previewSpecimenFamily:"",previewSrc:"",replaceAccept:"",editable:"no",duplicable:"no",selectedFile:"",usageFiles:[],usageHeadline:"",usageState:"hidden"};let i=Yc(t.file),a=ex(t.file);if(!Vd(t.file))hh(t.file).then(x);if(a===null||a.status==="pending")Xu(t.file).then(x);let r=_L(t.file),o=r==="image"||r==="video"||r==="audio"||r==="font"?r:"glyph",l=o==="font"?CL(t.file):{fontFace:"",specimen:"",specimenFamily:""};return{detailFacts:SL(t.file,i),detailHint:"",detailName:t.name,detailRef:t.ref,detailState:"shown",previewFontFace:l.fontFace,previewGlyph:ve[t.kind],previewKind:o,previewSpecimen:l.specimen,previewSpecimenFamily:l.specimenFamily,previewSrc:o==="glyph"?"":nr(t.file),replaceAccept:NO(t.file),editable:XS(t.file)?"yes":"no",duplicable:QS()?"yes":"no",selectedFile:t.file,...kL(a)}}var me=null,ge=null;function Se(){return me??=(ce("zrqtgt41"),import("./files-zrqtgt41.js")),me}function Fe(){return ge??=(ce("1sghzgcr"),import("./file-ops-1sghzgcr.js")),ge}function te(e){try{e.showPicker()}catch{e.focus()}}function N(e,t){e.choice.selected=t,v(e)}async function he(e,t){let i=await Ys([...t],{dir:e.uploadDir,only:e.images?"image":"media"}),[a]=i;if(!a)return;if(e.choice.filter!=="all"&&e.choice.filter!==a.kind)e.choice.filter=e.images?"image":"all";e.choice.query="",e.reveal=a.path,N(e,a.path)}async function eN(e){let t=e.split("/").pop()??e,{confirmFileDelete:i}=await Fe();if(!await i({name:t,path:e}))return!1;let{markLocalMutation:a}=await (ce("45rhg3me"),import("./fs-events-45rhg3me.js"));try{a(e),await p().deleteFile(e)}catch(l){return w.error(`Could not delete ${t}.`,{detail:X(l),path:e,source:"Media"}),!1}if(Kd([e]),us(),m.tabs.has(e))eu(e);for(let l of L)if(l.choice.selected===e)l.choice.selected=null;if(y.selected===e)y.selected=null;let r=ov(e),o=await Ze(r,a);return await Nx(o?ov(r):r),w.success(`Deleted ${t}`),!0}async function Ze(e,t){if(!RO(e))return!1;let i=p();try{if((await i.listDirectory(e)).length>0)return!1;return t(e),await i.deleteFile(e),!0}catch{return!1}}async function tN(e){if(eC(e,"renamed"))return null;let t=Mx(e),i=ov(e),{commitRename:a,listRenameSiblings:r,notifyMoveOutcome:o,renameStatus:l}=await Se(),c=await r(e,"Media");if(c===null)return null;let{renamePromptMessage:d}=await Fe(),f=await d(e),b=await Fn("Rename",{confirmLabel:"Rename",select:"stem",validate:(s)=>AO(e,s,c),value:t,...f!==void 0&&{message:f}});if(!b||b===t)return null;let M=Y$(i,b),u=Yc(e);try{let s=await a(e,M);if(y.selected===e)Le(M);if(await Nx(i),u?.width!=null&&u.height!=null)fl(M,u.width,u.height);return o(l(b,s),s,M),M}catch(s){return w.error(`Could not rename ${t}.`,{detail:X(s),path:e,source:"Media"}),null}}async function nN(e){if(eC(e,"duplicated"))return null;let t=await Ax(e);if(t===null)return null;return Le(t.path),x(),t.path}function Le(e){if(y.selected=e,!A({name:Mx(e)},y.query))y.query="";for(let{mount:t}of k.values())t.reveal=e,t.revealFocus=!0}function Ne(e){return{activate:(t)=>{N(e,t),ye(e,t)},activateSelected:()=>{let{selected:t}=e.choice;if(t!==null)ye(e,t)},contextMenu:(t,i,a)=>et(e,t,i,a),copyRef:()=>{let t=wb(e);if(t)Te(t)},dragOut:()=>{if(e.dropActive)e.dropActive=!1,v(e)},dragOver:()=>{if(!e.dropActive)e.dropActive=!0,v(e)},drop:(t)=>{if(e.dropActive=!1,v(e),t?.length)he(e,t)},focusTile:(t)=>{if(e.choice.selected!==t)N(e,t)},gridHost:(t)=>{e.grid=t},inputHost:(t,i)=>{e.inputs[i].add(t),xe(e);let a=D;if(e.mode==="manage"&&a?.role===i&&(i==="upload"||a.file===e.choice.selected))D=null,te(t)},key:(t,i)=>tt(e,t,i),measure:(t,i,a)=>{if(fl(t,i,a))x();else if(!Vd(t))hh(t).then(x)},openDocument:(t)=>{Se().then(({openFileInTab:i})=>i(t))},openViewer:()=>{let{selected:t}=e.choice;if(t!==null)Zu(t)},editImage:()=>{let{selected:t}=e.choice;if(t!==null)tC(t)},remove:()=>{let{selected:t}=e.choice;if(t!==null)eN(t)},rename:()=>{let{selected:t}=e.choice;if(t!==null)tN(t)},duplicate:()=>{let{selected:t}=e.choice;if(t!==null)nN(t)},replace:(t)=>{let[i]=t.files??[];t.value="";let{selected:a}=e.choice;if(i&&a!==null&&oA(a))Ox(a,i).then((r)=>{if(r)Qw(a);x()})},reset:()=>{e.choice.filter=e.images?"image":"all",e.choice.query="",v(e)},select:(t)=>N(e,t),setFilter:(t)=>{if(re(t))e.choice.filter=t,v(e)},setQuery:(t)=>{e.choice.query=t,v(e)},setSort:(t)=>{if(ne(t))e.choice.sort=t,v(e)},tileHost:(t,i)=>{e.tiles.set(i,t),je.set(t,i),e.observer.observe(t)},upload:(t)=>{let i=[...t.files??[]];if(t.value="",i.length>0)he(e,i)}}}function Te(e){if("clipboard"in navigator)navigator.clipboard.writeText(e.ref)}var I=null;function et(e,t,i,a){N(e,t);let r=wb(e);if(!r)return;I?.close();let o=(l,c,d,f={})=>({destructive:!1,disabled:!1,dividerAbove:!1,id:l,run:d,title:c,...f});I=zt({label:`${r.name} actions`,onClosed:(l)=>{if(I===l)I=null},origin:{x:i,y:a},region:"media-tile",rows:[o("open","Open in Viewer",()=>Zu(t)),...XS(t)?[o("edit","Edit Image",()=>tC(t))]:[],o("copy-url","Copy Site URL",()=>Te(r)),o("rename","Rename…",()=>{tN(t)},{dividerAbove:!0}),...QS()?[o("duplicate","Duplicate",()=>{nN(t)})]:[],o("replace","Replace…",()=>BP(t)),o("delete","Delete",()=>{eN(t)},{destructive:!0,dividerAbove:!0})]})}function ye(e,t){if(e.mode==="pick"){let i=wb(e);if(i)e.onPick?.(i);return}Zu(t)}function tt(e,t,i){let{files:a}=ke(e),r=q(a,{filter:e.choice.filter,query:e.choice.query,sort:e.choice.sort,unused:S}),o=r.findIndex((f)=>f.file===e.choice.selected),l=e.grid?le(Me(e.grid).width):1,c=o===-1?r.length>0?0:null:se(o,t,l,r.length,i),d=c===null?void 0:r[c];if(!d)return;N(e,d.file),e.tiles.get(d.file)?.focus()}var je=new WeakMap;function De(e,t,i,a,r,o){let l={choice:t,disposed:!1,dropActive:!1,grid:null,handle:null,images:r,inputs:{replace:new Set,upload:new Set},mode:e,observer:_p((c)=>{let d=je.get(c);if(d!==void 0&&!l.visible.has(d))l.visible.add(d),it(l)}),onPick:null,onSelect:null,paneId:a,reveal:null,revealFocus:!1,focusOwed:!1,region:i,sweepTimer:null,tiles:new Map,uploadDir:o,visible:new Set};return l}var G=new Set;function it(e){if(G.has(e))return;G.add(e),queueMicrotask(()=>{G.delete(e),v(e)})}function cS(e,t){let i=k.get(e);return i!==void 0&&i.tabId===t.id&&i.wrap.isConnected&&i.mount.handle!==null&&i.mount.handle.attached()}function vw(e){let t=k.get(e);if(!t)return;Z(t.mount),k.delete(e)}function JE(e,t){let{paneId:i,wrap:a}=e;if(cS(i,t))return;vw(i);let r=De("manage",y,Ln(i,"media-library"),i,!1,Ta);if(L.add(r),we(),r.handle=V(a,ee(r),Ne(r),{clear:!0}),k.set(i,{mount:r,tabId:t.id,wrap:a}),Q.delete(i))Ce(r)}async function Ce(e){await e.handle?.ready,He(e,!0)}function He(e,t=e.focusOwed){if(!t||e.disposed)return;let{selected:i}=e.choice,a=(i===null?void 0:e.tiles.get(i))??[...e.tiles.values()].find((r)=>r.getAttribute("tabindex")==="0");if(a?.isConnected){e.focusOwed=!1,a.focus();return}e.focusOwed=!0}function YE(e){let t=k.get(e);if(t?.wrap.isConnected&&t.mount.handle?.attached()===!0){Ce(t.mount);return}Q.add(e)}function HP(e){if(e.filter!==void 0)y.filter=e.filter;if(e.query!==void 0)y.query=e.query;if(e.select!==void 0){if(y.selected=e.select,y.filter!=="all")y.filter="all";y.query=""}x()}function hF(){let e=[...k.values()].map((t)=>$e(t.mount.inputs.upload)).find((t)=>t!==null)??null;if(e){te(e);return}D={file:null,role:"upload"}}function BP(e){HP({select:e});let t=null;for(let i of k.values())if(i.mount.choice.selected===e)t??=$e(i.mount.inputs.replace);if(t){te(t);return}D={file:e,role:"replace"}}var z=null;function be(e){let t=wb(e);return{blocked:t===null,confirmLabel:t?`Use ${t.name}`:e.images?"Use image":"Use file",headline:e.images?"Choose an image":"Choose media"}}function dS(){let e=z;if(z=null,e)Z(e.mount),e.dialog.close()}function pF(e){dS();let t={filter:e.images?"image":"all",query:"",selected:null,sort:"newest"},i=De("pick",t,`${vt("dialog",B)}/library`,null,e.images,J$(h.value?.documentPath??null)),a=(o)=>{dS(),e.onPick(o.ref)};i.onPick=a,L.add(i),we();let r=fe({body:(o)=>{i.handle=V(o,ee(i),Ne(i),{clear:!1})},closed:()=>{if(z?.mount===i)dS();else Z(i)},confirm:()=>{let o=wb(i);if(o)a(o)},layer:dt("dialog"),view:be(i)});i.onSelect=()=>r.update(be(i)),z={dialog:r,mount:i}}function ZE(){dS();for(let e of k.keys())vw(e);y.filter="all",y.query="",y.selected=null,y.sort="newest",D=null,Q.clear(),J()}
|
|
2
|
-
export{
|
|
1
|
+
import{X}from"./studio-9c6cbq2c.js";import{p}from"./studio-xh6rf05g.js";import{w}from"./studio-bk0anq3b.js";import{hh,hs,pR}from"./studio-wn2cmf9q.js";import{Jt,Ut}from"./studio-m3jrjfhy.js";import{sn,dt,Fn}from"./studio-cv6gnjqd.js";import{g,h,Qd}from"./studio-s49y6m5b.js";import{Kd}from"./studio-48yzqzqr.js";import{Jc,La,oR,VA,sR,Hx,Qs,Bx,zA,UA,Vx,Wx,cy,no,zd,Yc,uh,gl,zx}from"./studio-td3h1644.js";import{gO,sx,ax,Xu}from"./studio-j3bq30yz.js";import{PT,Ku}from"./studio-4ncxzw5m.js";import{Vt}from"./studio-w3aafbpk.js";import{N$,D$,O$,A$,Zu,oC,sC,aC,lC}from"./studio-g65t6svn.js";import{xp}from"./studio-vswmz40d.js";import{ze,$n,yt,E,I}from"./studio-1a7zshnv.js";import{Me}from"./studio-bmwgj8ez.js";import{b}from"./studio-9f5vcb4w.js";import{n,S}from"./studio-erjccagy.js";import{ce}from"./studio-7qqb7hb8.js";var R=[{key:"all",label:"All media"},{key:"image",label:"Images"},{key:"video",label:"Video"},{key:"audio",label:"Audio"},{key:"document",label:"Documents"},{key:"font",label:"Fonts"},{key:"unused",label:"Unused"}],f0=R.map((e)=>e.key);function re(e){return f0.some((t)=>t===e)}function j(e){return R.find((t)=>t.key===e)?.label??"All media"}var U=[{key:"newest",label:"Newest"},{key:"name",label:"Name"},{key:"size",label:"Size"}],Re=U.map((e)=>e.key);function ne(e){return Re.some((t)=>t===e)}function W(e,t,i){switch(t){case"all":return!0;case"unused":return i!==null&&i.has(e.file);default:return e.kind===t}}function A(e,t){let i=t.trim().toLowerCase();return i===""||e.name.toLowerCase().includes(i)}function q(e,t){return e.filter((a)=>W(a,t.filter,t.unused)&&A(a,t.query)).toSorted((a,r)=>Ae(t.sort,a,r)||a.file.localeCompare(r.file))}function Ae(e,t,i){switch(e){case"name":return t.name.localeCompare(i.name,void 0,{numeric:!0,sensitivity:"base"});case"size":return(i.bytes??-1)-(t.bytes??-1);default:return(i.modified??"").localeCompare(t.modified??"")}}function oe(e,t){let i={all:e.length,audio:0,document:0,font:0,image:0,unused:t===null?null:e.filter((a)=>t.has(a.file)).length,video:0};for(let a of e)i[a.kind]=(i[a.kind]??0)+1;return i}var Ie=132,ae=12;function le(e){return Math.max(1,Math.floor((e+ae)/(Ie+ae)))}function se(e,t,i,a,r=!1){if(a===0)return null;let o=Math.min(Math.max(e,0),a-1),l=o-o%i,c;switch(t){case"ArrowRight":{c=o+1;break}case"ArrowLeft":{c=o-1;break}case"ArrowDown":{c=o+i;break}case"ArrowUp":{c=o-i;break}case"Home":{c=r?0:l;break}case"End":{c=r?a-1:Math.min(l+i-1,a-1);break}default:return null}return c<0||c>=a?o:c}var de={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaLibrary",$description:"The Media workspace's library (`specs/studio.md` §22.6): the project's media as filters, a grid and the selected file's detail. ONE document in two modes. In `manage` it is the Media home tab, with Replace, Open in viewer, Rename, Duplicate and Delete under the detail; in `pick` it is the full-size picker inside a `jx-dialog` (`media-pick-dialog.json`), and the dialog's own footer answers Cancel or Use <file>. `media/media-library.ts` keeps every decision (which files a filter keeps, the sort, what a count may claim, where an arrow lands, what Replace writes) and hands this document strings and discriminants. **Unused is drawn with no number until the usage sweep has settled**, and Missing alt text and tags are not drawn at all: each needs a store that does not exist, and a filter that cannot be answered is not shipped as one that always answers nothing.",tagName:"div",attributes:{part:"media-library","data-jx-region":"${state.region}","data-mode":"${state.mode}","data-drop":"${state.dropActive}"},style:{$description:"Three columns over the whole stage: the filters, the grid with its toolbar, and the selected file's detail. Fills the pane's stage by its own geometry, as the workspace home does: the stage is `position: relative` (`pane-grid.json`). In pick mode the same columns fill the dialog's body instead, so the root's box is the only thing that differs between the two modes.",position:"absolute",inset:"0",display:"grid",gridTemplateColumns:"200px minmax(0, 1fr) 300px",boxSizing:"border-box",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",background:"var(--bg)",'&[data-mode="pick"]':{$description:"Inside a dialog there is no stage to fill: the box is the dialog body's, at a height the dialog can scroll within.",position:"relative",inset:"auto",height:"min(70vh, 620px)",gridTemplateColumns:"150px minmax(0, 1fr) 210px"},'&[data-drop="true"]':{$description:"The drop affordance is a STATE the flow holds, not a class a handler adds and forgets to take off.",outline:"2px dashed var(--accent)",outlineOffset:"-4px"},'& [part="filters"]':{display:"flex",flexDirection:"column",gap:"2px",padding:"var(--jx-space-3) var(--jx-space-2)",borderRight:"1px solid var(--border)",background:"var(--bg-panel)",overflowY:"auto"},'& [part="filters-heading"]':{margin:"0",padding:"var(--jx-space-2) var(--jx-space-2) var(--jx-space-1)",fontSize:"var(--jx-text-xs)",fontWeight:"600",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="filter"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",height:"30px",padding:"0 var(--jx-space-2)",border:"none",borderRadius:"var(--radius)",background:"none",color:"var(--fg)",font:"inherit",textAlign:"left",cursor:"pointer"},'& [part="filter"]:hover':{background:"var(--hover-bg)"},'& [part="filter"][aria-pressed="true"]':{background:"color-mix(in srgb, var(--accent) 16%, transparent)",color:"var(--fg)",fontWeight:"600"},'& [part="filter"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="filter-count"]':{marginLeft:"auto",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",fontWeight:"400"},'& [part="main"]':{display:"flex",flexDirection:"column",minWidth:"0",minHeight:"0"},'& [part="toolbar"]':{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)"},'& [part="title"]':{margin:"0 auto 0 0",fontSize:"var(--jx-text-lg)",fontWeight:"600"},'& [part="search"]':{width:"220px"},'& [part="sort"]':{width:"130px"},'& [part="upload"], & [part="empty-upload"]':{$description:"A LABEL around the file picker, not a button that clicks a hidden one: the picker is the control, so it takes focus, Enter opens it and a screen reader announces a file upload. A plain element because a label forwards a click to the input it contains and a custom element between the two would break that.",position:"relative",display:"inline-flex",alignItems:"center",gap:"6px",height:"28px",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",font:"inherit",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":has(:focus-visible)":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="upload-input"], & [part="replace-input"]':{$description:"Out of the way but still FOCUSABLE: `display: none` would take the control out of the tab order, and the label around it draws the focus ring for it.",position:"absolute",width:"1px",height:"1px",opacity:"0",pointerEvents:"none"},'& [part="upload-glyph"]':{"--jx-icon-size":"16px"},'& [part="body"]':{flex:"1",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-4)"},'& [part="grid"]':{$description:"auto-fill over a minimum tile width; `media/media-library-model.ts` `gridColumns` does the same arithmetic, so ArrowDown lands on the tile drawn under the current one. Keep the two numbers in step.",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(132px, 1fr))",gap:"12px",alignContent:"start"},'& [part="tile"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"4px",borderRadius:"var(--jx-radius-md, 6px)",border:"2px solid transparent",cursor:"pointer",minWidth:"0",outline:"none"},'& [part="tile"]:hover':{background:"var(--hover-bg)"},'& [part="tile"][aria-selected="true"]':{borderColor:"var(--accent)"},'& [part="tile"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"2px"},'& [part="thumb"]':{display:"flex",alignItems:"center",justifyContent:"center",aspectRatio:"4 / 3",borderRadius:"var(--radius)",background:"var(--bg-input)",overflow:"hidden",color:"var(--fg-dim)","--jx-icon-size":"28px"},'& [part="thumb-img"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="tile-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-sm)"},'& [part="tile-caption"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",minHeight:"1em"},'& [part="empty"]':{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",padding:"48px var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)","--jx-icon-size":"40px"},'& [part="empty-title"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="empty-detail"]':{margin:"0",maxWidth:"42ch",lineHeight:"1.5"},'& [part="detail"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-4)",borderLeft:"1px solid var(--border)",background:"var(--bg-panel)",overflowY:"auto",minWidth:"0"},'& [part="detail-hint"]':{margin:"auto 0",textAlign:"center",color:"var(--fg-dim)"},'& [part="detail-preview"]':{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"140px",maxHeight:"220px",borderRadius:"var(--radius)",background:"var(--bg-input)",overflow:"hidden",color:"var(--fg-dim)","--jx-icon-size":"40px"},'& [part="preview-img"], & [part="preview-video"]':{maxWidth:"100%",maxHeight:"220px",objectFit:"contain"},'& [part="preview-audio"]':{width:"100%"},'& [part="preview-specimen"]':{$description:"The viewer's specimen at a side pane's size. The face arrives as the `@font-face` the flow writes under a family name generated from the path (`media/media-pane.ts` `specimenOf`); the element carries only that name, as a custom property, and the fallback stack is a rule, here.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-4)",maxWidth:"100%",color:"var(--fg)",fontFamily:"var(--jx-specimen-family, system-ui), system-ui, sans-serif"},'& [part="specimen-line"]':{margin:"0",lineHeight:"1.3",overflowWrap:"anywhere"},'& [part="specimen-line"][data-size="32"]':{fontSize:"32px"},'& [part="specimen-line"][data-size="14"]':{fontSize:"var(--jx-text-md)"},'& [part="detail-name"]':{margin:"0",fontSize:"var(--jx-text-md)",fontWeight:"600",overflowWrap:"anywhere"},'& [part="facts"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="group-title"]':{margin:"0",fontSize:"var(--jx-text-xs)",fontWeight:"600",color:"var(--fg-dim)"},'& [part="url"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="url-value"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--jx-font-mono)",fontSize:"var(--jx-text-sm)"},'& [part="usage"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="usage-headline"]':{margin:"0",fontSize:"var(--jx-text-sm)"},'& [part="usage-list"]':{margin:"0",padding:"0",listStyle:"none",display:"flex",flexDirection:"column",gap:"2px"},'& [part="usage-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="usage-link"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",border:"none",background:"none",padding:"0",color:"var(--accent)",font:"inherit",fontSize:"var(--jx-text-sm)",textAlign:"left",cursor:"pointer",":hover":{textDecoration:"underline"},":focus-visible":{outline:"var(--jx-focus-ring)"}},'& [part="usage-count"]':{fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="actions"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)",marginTop:"var(--jx-space-2)"},'& [part="replace"]':{position:"relative",display:"inline-flex",alignItems:"center",height:"28px",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg)",color:"var(--fg)",font:"inherit",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":has(:focus-visible)":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}}},ondragover:{$prototype:"Function",body:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/dragOver"},value:[]}],description:"A file dropped ANYWHERE on the library uploads, to the destination the Upload label names before the drop: public/media/."},ondragleave:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dragOut"},value:[]}]},ondrop:{$prototype:"Function",body:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/drop"},value:[{$ref:"event#/dataTransfer/files"}]}]},children:[{tagName:"nav",attributes:{part:"filters","aria-label":"Media filters"},children:[{tagName:"h2",attributes:{part:"filters-heading"},textContent:"Library"},{$prototype:"Array",items:{$ref:"#/state/filters"},key:{$ref:"$map/item/key"},map:{tagName:"button",attributes:{part:"filter",type:"button","aria-pressed":"${$map.item.pressed}","data-filter":"${$map.item.key}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"filter-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"filter-count"},textContent:"${$map.item.count}"}]}}]},{tagName:"section",attributes:{part:"main","aria-labelledby":"${state.titleId}"},children:[{tagName:"header",attributes:{part:"toolbar"},children:[{tagName:"h2",attributes:{part:"title",id:"${state.titleId}"},textContent:"${state.title}"},{tagName:"jx-textfield",attributes:{part:"search"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search by name…",autocomplete:"off",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setQuery"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"sort"},$props:{label:"Sort",size:"sm",options:{$ref:"#/state/sortOptions"},value:{$ref:"#/state/sort"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSort"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"label",attributes:{part:"upload",title:"${state.uploadHint}"},children:[{tagName:"input",attributes:{part:"upload-input",type:"file",multiple:!0,accept:"${state.uploadAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"event#/target"}]}],description:"The picker itself, so the destination in the label's tooltip is visible BEFORE the files are chosen. The flow takes the element rather than the file list because a file input that is not cleared refuses the same file twice."}},{tagName:"jx-icon",attributes:{part:"upload-glyph","aria-hidden":"true"},$props:{name:"upload-simple"}},{tagName:"span",textContent:"Upload"}]}]},{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"grid-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/gridState"},cases:{loading:{tagName:"p",attributes:{part:"empty",role:"status"},textContent:"Reading the project's media…"},counting:{tagName:"p",attributes:{part:"empty",role:"status"},textContent:"${state.countingLabel}"},empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"jx-icon",attributes:{part:"empty-glyph","aria-hidden":"true"},$props:{name:"image"}},{tagName:"p",attributes:{part:"empty-title"},textContent:"${state.emptyTitle}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"},{tagName:"label",attributes:{part:"empty-upload",title:"${state.uploadHint}"},children:[{tagName:"input",attributes:{part:"upload-input",type:"file",multiple:!0,accept:"${state.uploadAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"event#/target"}]}],description:"The picker itself, so the destination in the label's tooltip is visible BEFORE the files are chosen. The flow takes the element rather than the file list because a file input that is not cleared refuses the same file twice."}},{tagName:"jx-icon",attributes:{part:"upload-glyph","aria-hidden":"true"},$props:{name:"upload-simple"}},{tagName:"span",textContent:"Upload"}]}]},nomatch:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"jx-icon",attributes:{part:"empty-glyph","aria-hidden":"true"},$props:{name:"image"}},{tagName:"p",attributes:{part:"empty-title"},textContent:"${state.emptyTitle}"},{tagName:"p",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"},value:[]}]},children:[{tagName:"span",textContent:"Show all media"}]}]},listed:{tagName:"div",attributes:{part:"grid",role:"listbox","aria-labelledby":"${state.titleId}"},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowRight:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowLeft:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],Home:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],End:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activateSelected"},value:[]}]}}],description:"The grid pattern: arrows move one tile, Home and End to the ends of the row, Ctrl+Home and Ctrl+End to the ends of the grid, and Enter opens the selected file (in pick mode, uses it). The flow computes where the move lands; the tile that receives it takes focus, so the roving tabindex follows the selection."},children:[{$prototype:"Array",items:{$ref:"#/state/tiles"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"tile",role:"option","aria-selected":"${$map.item.selected}",tabindex:"${$map.item.tabindex}","data-file":"${$map.item.file}",title:"${$map.item.name}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/file"}]}]},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/focusTile"},value:[{$ref:"$map/item/file"}]}],description:"Selection follows focus, the listbox pattern: a Tab onto the grid lands on the roving stop and selects it, so the first Enter opens (in pick mode, uses) the tile the focus ring is on rather than nothing."},ondblclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/file"}]}]},oncontextmenu:{$prototype:"Function",body:[{$switch:{$ref:"#/state/mode"},cases:{manage:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/file"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]}}],description:"Manage mode only: the detail pane's actions at the pointer. Pick mode's dialog is modal, and a menu in the popover layer outside it would be inert, so its right-click is left to the platform."},children:[{tagName:"div",attributes:{part:"thumb"},children:[{tagName:"div",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{image:{tagName:"img",attributes:{part:"thumb-img",src:"${$map.item.thumbSrc}",alt:"",draggable:"false"},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}},pending:{tagName:"span",attributes:{part:"thumb-pending","aria-hidden":"true"}},glyph:{tagName:"jx-icon",attributes:{part:"thumb-glyph","aria-hidden":"true"},$props:{name:{$ref:"$map/item/glyph"}}}},$description:"The thumbnail is asked for when the tile scrolls into view, not when the grid is built: `pending` until the flow's observer reports the tile, then the picture. A file the browser draws no picture of shows its kind's glyph."}]},{tagName:"span",attributes:{part:"tile-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"tile-caption"},textContent:"${$map.item.caption}"}]}}]}}}]}]},{tagName:"aside",attributes:{part:"detail","aria-label":"Details"},children:[{tagName:"div",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/detailState"},cases:{none:{tagName:"p",attributes:{part:"detail-hint"},textContent:"${state.detailHint}"},shown:{tagName:"div",attributes:{part:"detail-body",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"detail-preview"},children:[{tagName:"div",attributes:{part:"preview-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/previewKind"},cases:{image:{tagName:"img",attributes:{part:"preview-img",src:"${state.previewSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"#/state/selectedFile"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}},video:{tagName:"video",attributes:{part:"preview-video",src:"${state.previewSrc}",controls:!0}},audio:{tagName:"audio",attributes:{part:"preview-audio",src:"${state.previewSrc}",controls:!0}},font:{tagName:"div",attributes:{part:"preview-specimen",style:"${state.previewSpecimenFamily}"},children:[{tagName:"style",textContent:"${state.previewFontFace}"},{tagName:"p",attributes:{part:"specimen-line","data-size":"32"},textContent:"Aa"},{tagName:"p",attributes:{part:"specimen-line","data-size":"14"},textContent:"${state.previewSpecimen}"}]},glyph:{tagName:"jx-icon",attributes:{part:"preview-glyph","aria-hidden":"true"},$props:{name:{$ref:"#/state/previewGlyph"}}}}}]},{tagName:"h3",attributes:{part:"detail-name"},textContent:"${state.detailName}"},{tagName:"p",attributes:{part:"facts"},textContent:"${state.detailFacts}"},{tagName:"div",attributes:{part:"url-group"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"Site URL"},{tagName:"div",attributes:{part:"url"},children:[{tagName:"code",attributes:{part:"url-value"},textContent:"${state.detailRef}"},{tagName:"jx-action-button",attributes:{part:"copy"},$props:{size:"sm",quiet:!0,hint:"Copy the site URL"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/copyRef"},value:[]}]},children:[{tagName:"span",textContent:"Copy"}]}]}]},{tagName:"div",attributes:{part:"usage-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/usageState"},cases:{shown:{tagName:"div",attributes:{part:"usage"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"Used on"},{tagName:"p",attributes:{part:"usage-headline"},textContent:"${state.usageHeadline}"},{tagName:"div",attributes:{part:"usage-list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasUsageFiles"},cases:{true:{tagName:"ul",attributes:{part:"usage-list"},children:[{$prototype:"Array",items:{$ref:"#/state/usageFiles"},key:{$ref:"$map/item/path"},map:{tagName:"li",attributes:{part:"usage-row","data-usage":"${$map.item.path}"},children:[{tagName:"button",attributes:{part:"usage-link",type:"button",title:"Open ${$map.item.path}"},textContent:"${$map.item.path}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openDocument"},value:[{$ref:"$map/item/path"}]}]}},{tagName:"span",attributes:{part:"usage-count"},textContent:"${$map.item.count}"}]}}]}}}]}},$description:'Hidden on a host with no reference index, which is a different fact from "nothing uses it": a confident zero is the one answer this pane must never invent.'},{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{manage:{tagName:"div",attributes:{part:"actions"},children:[{tagName:"label",attributes:{part:"replace",title:"Replace ${state.detailName} everywhere it is used"},children:[{tagName:"input",attributes:{part:"replace-input",type:"file",accept:"${state.replaceAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[{$ref:"event#/target"}]}],description:"Replace writes the chosen file over this one's path, so every reference keeps resolving and now shows the new bytes (studio.md §9.3). The element rather than the list, so the input can be cleared."}},{tagName:"span",textContent:"Replace"}]},{tagName:"jx-button",attributes:{part:"open-viewer"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openViewer"},value:[]}]},children:[{tagName:"span",textContent:"Open in viewer"}]},{tagName:"div",attributes:{part:"edit-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editable"},cases:{yes:{tagName:"jx-button",attributes:{part:"edit-image"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editImage"},value:[]}],description:"Withheld, not disabled, for a file the editor cannot write: a refused format is not offered rather than offered and then refused (studio.md §9.5)."},children:[{tagName:"span",textContent:"Edit image"}]},no:{tagName:"span",attributes:{hidden:!0}}}},{tagName:"jx-button",attributes:{part:"rename"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/rename"},value:[]}]},children:[{tagName:"span",textContent:"Rename"}]},{tagName:"div",attributes:{part:"duplicate-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/duplicable"},cases:{yes:{tagName:"jx-button",attributes:{part:"duplicate"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/duplicate"},value:[]}],description:"Withheld, not disabled, on a backend that cannot read a file's raw bytes: a copy read as text would be a broken file (studio.md §9.3)."},children:[{tagName:"span",textContent:"Duplicate"}]},no:{tagName:"span",attributes:{hidden:!0}}}},{tagName:"jx-button",attributes:{part:"delete"},$props:{size:"sm",variant:"negative"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[]}]},children:[{tagName:"span",textContent:"Delete"}]}]}},$description:"Manage mode's actions. Pick mode has none here: its answer is the dialog's own footer, Cancel and Use <file>."}]}}}]}]};E("media-library",de);function Oe(){return{countingLabel:"",detailFacts:"",detailHint:"",detailName:"",detailRef:"",detailState:"none",dropActive:"false",emptyDetail:"",emptyTitle:"",filters:[],gridState:"loading",mode:"manage",previewFontFace:"",previewGlyph:"",previewKind:"glyph",previewSpecimen:"",previewSpecimenFamily:"",previewSrc:"",query:"",region:"",replaceAccept:"",editable:"no",duplicable:"no",selectedFile:"",sort:"",sortOptions:[],tiles:[],title:"",titleId:"",uploadAccept:"",uploadHint:"",usageFiles:[],usageHeadline:"",usageState:"hidden"}}function pe(e,t){Object.assign(e,t),e.hasUsageFiles=t.usageFiles.length>0}function Ke(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function _e(e){let t=e?.$map,i=S(t)&&"item"in t?t.item:void 0;return S(i)&&"file"in i&&n(i.file)?i.file:null}function V(e,t,i,a){if(a.clear)e.replaceChildren();let{tileHost:r,gridHost:o,inputHost:l,...c}=i,d=b({...Oe(),...c,hasUsageFiles:!1});pe(d,t);let f=null,y=!1,M=I("media-library",d,e,{onNodeCreated:(u,s,L,Ee)=>{if(y||!(u instanceof HTMLElement))return;let H=Ke(L);if(H==="tile"){let ie=_e(Ee);if(ie!==null)r(u,ie)}else if(H==="grid")o(u);else if(u instanceof HTMLInputElement&&H==="upload-input")l(u,"upload");else if(u instanceof HTMLInputElement&&H==="replace-input")l(u,"replace")}}).then((u)=>{if(y)u.dispose();else f=u;return u.root});return{attached:()=>{if(y)return!1;let u=f?.root;return u===void 0?!0:u instanceof HTMLElement&&e.contains(u)},dispose(){y=!0,f?.dispose(),f=null},ready:M,update:(u)=>pe(d,u)}}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaPickDialog",$description:"The full-size media picker (`specs/studio.md` §9.3): a `jx-dialog` whose body is the Media workspace's own library surface in pick mode, so the picker and the workspace are one surface at two sizes. The dialog owns modality, Escape, the backdrop and focus restoration, and its footer is the answer: Cancel, or Use <file>, disabled until a file is chosen. The body is an ISLAND: this document draws the slot and nothing in it, and `surfaces/media-pick-dialog.ts` mounts `media-library.json` there through `onNodeCreated`.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},confirmDisabled:{$ref:"#/state/blocked"},cancelLabel:"Cancel",dismissible:!0,size:"xl"},attributes:{part:"media-pick"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},children:[{tagName:"div",attributes:{part:"library-slot"},style:{$description:"The library's box in pick mode is its own (`media-library.json`, `data-mode=\"pick\"`); the slot only gives it the dialog body's width.",minWidth:"0"}}]};E("media-pick-dialog",ue);var B="media-picker";function We(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function fe(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(ze,yt("dialog",B)),e.layer.append(t);let i=!1,a=()=>{if(i)return;i=!0,e.closed()},r=()=>i,o=b({...e.view,closed:a,confirm:e.confirm}),l=null,c=I("media-pick-dialog",o,t,{onNodeCreated:(d,f,y)=>{if(!r()&&d instanceof HTMLElement&&We(y)==="library-slot")e.body(d)}}).then(async(d)=>{l=d;let f=d.root;if(r())return d.dispose(),f;if(await sn(f),!r())Jt(f);return f});return{close(){let d=l?.root;if(d instanceof HTMLElement)Ut(d);l?.dispose(),l=null,t.remove(),a()},host:t,ready:c,update(d){Object.assign(o,d)}}}var kF="media-home",ve={audio:"play",document:"file-text",font:"text-aa",image:"image",video:"play"},qe={audio:"Audio",document:"Document",font:"Font",image:"Image",video:"Video"},m={filter:"all",query:"",sort:"newest",selected:null},C=null,F=null,K=0,z=0,O=!1,Y=0;function J(){F=null,O=!1,K=0,z=0,Y+=1}function Ve(){return[...N].some((e)=>!e.disposed&&e.choice.filter==="unused")}async function Be(e){if(O||F!==null||!hh())return;let t=Y;O=!0,K=0,z=e.length;let i=new Set;for(let a of e){let r=await Xu(a.file);if(t!==Y)return;if(!Ve()){J();return}if(r.status==="ready"&&r.result.files.length===0)i.add(a.file);K+=1,x()}F=i,O=!1,x()}var N=new Set,k=new Map,Q=new Set,D=null;function we(){if(D!==null)return;let e=()=>{J(),x()},t=PT(e),i=pR(e);D=()=>{t(),i()}}function Ge(){if(N.size===0&&D)D(),D=null}function v(e){if(!e.disposed){if(e.handle?.update(ee(e)),e.onSelect?.(),Ye(e),e.focusOwed)queueMicrotask(()=>He(e));xe(e)}}function Ye(e){let t=e.reveal,i=t===null?void 0:e.tiles.get(t);if(i?.isConnected){if(e.reveal=null,i.scrollIntoView({block:"nearest"}),e.revealFocus)e.revealFocus=!1,i.focus()}}function xe(e){if(e.sweepTimer!==null||e.disposed)return;e.sweepTimer=setTimeout(()=>{e.sweepTimer=null,e.observer.releaseDetached();for(let[t,i]of e.tiles)if(!i.isConnected)e.tiles.delete(t);for(let t of[e.inputs.upload,e.inputs.replace])for(let i of t)if(!i.isConnected)t.delete(i)},0)}function $e(e){return[...e].find((t)=>t.isConnected)??null}function x(){for(let e of N)v(e)}function Z(e){if(e.disposed=!0,e.sweepTimer!==null)clearTimeout(e.sweepTimer),e.sweepTimer=null;e.inputs.upload.clear(),e.inputs.replace.clear(),e.observer.destroy(),e.handle?.dispose(),e.handle=null,e.tiles.clear(),N.delete(e),Ge()}function ke(e){let t=Ku(),i=t===null?null:e.images?t.filter((r)=>r.isImage):t;return{files:(i??[]).map((r)=>{let o=Yc(r.file);return{bytes:o?.bytes??null,file:r.file,kind:r.kind,modified:o?.modified??null,name:r.name}}),listed:i}}function Je(e){return R.filter((t)=>(t.key!=="unused"||hh())&&(!e.images||t.key==="image"||t.key==="unused"))}function Cb(e){let{filter:t,query:i,selected:a}=e.choice;if(a===null)return null;let r=Ku()?.find((l)=>l.file===a)??null;if(r===null||e.images&&!r.isImage)return null;let o={bytes:null,file:r.file,kind:r.kind,modified:null,name:r.name};return W(o,t,F)&&A(o,i)?r:null}function Qe(e,t){if(t===0)return{emptyDetail:`Upload files or drop them anywhere here. They are saved under ${e.uploadDir}/, and anything already under public/ or a collection's images/ folder is listed here too.`,emptyTitle:e.images?"No images yet":"No media yet"};let{filter:i,query:a}=e.choice;if(a.trim()!=="")return{emptyDetail:`Nothing in ${j(i)} matches it.`,emptyTitle:`No matches for “${a.trim()}”`};if(i==="unused")return{emptyDetail:"Every file is referenced by at least one document.",emptyTitle:"No unused media"};return{emptyDetail:`${t} ${t===1?"file":"files"} in the project, none of them ${j(i).toLowerCase()}.`,emptyTitle:`No ${j(i).toLowerCase()}`}}function ee(e){let{choice:t}=e,{files:i,listed:a}=ke(e),r=oe(i,F),o=Je(e);if(!o.some((s)=>s.key===t.filter))t.filter=o[0]?.key??"all";let l=q(i,{filter:t.filter,query:t.query,sort:t.sort,unused:F}),c=Ku();if(t.filter==="unused"&&c!==null)Be(c);let d="listed";if(a===null)d="loading";else if(t.filter==="unused"&&F===null)d="counting";else if(i.length===0||l.length===0)d=i.length===0?"empty":"nomatch";let f=Cb(e),y=l.some((s)=>s.file===t.selected)?t.selected:l[0]?.file??null,M=l.map((s)=>{let L=s.kind==="image";return{caption:zx(Yc(s.file))||qe[s.kind],file:s.file,glyph:ve[s.kind],key:s.file,name:s.name,selected:s.file===t.selected?"true":"false",tabindex:s.file===y?"0":"-1",thumbSrc:L&&e.visible.has(s.file)?no(s.file):"",thumbState:L?e.visible.has(s.file)?"image":"pending":"glyph"}}),u=e.images&&t.filter==="image"?"Images":j(t.filter);return{countingLabel:z>0?`Counting references… ${K} of ${z}`:"Counting references…",dropActive:e.dropActive?"true":"false",filters:o.map((s)=>{let L=r[s.key];return{count:L===null?"":String(L),key:s.key,label:e.images&&s.key==="image"?"All images":s.label,pressed:s.key===t.filter?"true":"false"}}),gridState:d,mode:e.mode,query:t.query,region:e.region,sort:t.sort,sortOptions:U.map((s)=>({label:s.label,value:s.key})),tiles:M,title:u,titleId:`media-library-title-${e.region.replaceAll(/[^\w-]/g,"-")}`,uploadAccept:e.images?"image/*":Jc(),uploadHint:`Upload into ${e.uploadDir}/`,...Qe(e,i.length),...Xe(e,f)}}function Xe(e,t){if(t===null)return{detailFacts:"",detailHint:e.mode==="pick"?"Choose a file to use it.":"Select a file to see its details.",detailName:"",detailRef:"",detailState:"none",previewFontFace:"",previewGlyph:"",previewKind:"glyph",previewSpecimen:"",previewSpecimenFamily:"",previewSrc:"",replaceAccept:"",editable:"no",duplicable:"no",selectedFile:"",usageFiles:[],usageHeadline:"",usageState:"hidden"};let i=Yc(t.file),a=ax(t.file);if(!zd(t.file))uh(t.file).then(x);if(a===null||a.status==="pending")Xu(t.file).then(x);let r=N$(t.file),o=r==="image"||r==="video"||r==="audio"||r==="font"?r:"glyph",l=o==="font"?O$(t.file):{fontFace:"",specimen:"",specimenFamily:""};return{detailFacts:D$(t.file,i),detailHint:"",detailName:t.name,detailRef:t.ref,detailState:"shown",previewFontFace:l.fontFace,previewGlyph:ve[t.kind],previewKind:o,previewSpecimen:l.specimen,previewSpecimenFamily:l.specimenFamily,previewSrc:o==="glyph"?"":no(t.file),replaceAccept:zA(t.file),editable:oC(t.file)?"yes":"no",duplicable:sC()?"yes":"no",selectedFile:t.file,...A$(a)}}var me=null,ge=null;function Se(){return me??=(ce("b2p9y0yz"),import("./files-b2p9y0yz.js")),me}function Fe(){return ge??=(ce("6a49er4c"),import("./file-ops-6a49er4c.js")),ge}function te(e){try{e.showPicker()}catch{e.focus()}}function T(e,t){e.choice.selected=t,v(e)}async function he(e,t){let i=await Qs([...t],{dir:e.uploadDir,only:e.images?"image":"media"}),[a]=i;if(!a)return;if(e.choice.filter!=="all"&&e.choice.filter!==a.kind)e.choice.filter=e.images?"image":"all";e.choice.query="",e.reveal=a.path,T(e,a.path)}async function uD(e){let t=e.split("/").pop()??e,{confirmFileDelete:i}=await Fe();if(!await i({name:t,path:e}))return!1;let{markLocalMutation:a}=await (ce("0xsy168g"),import("./fs-events-0xsy168g.js"));try{a(e),await p().deleteFile(e)}catch(l){return w.error(`Could not delete ${t}.`,{detail:X(l),path:e,source:"Media"}),!1}if(Kd([e]),hs(),g.tabs.has(e))Qd(e);for(let l of N)if(l.choice.selected===e)l.choice.selected=null;if(m.selected===e)m.selected=null;let r=cy(e),o=await Ze(r,a);return await Hx(o?cy(r):r),w.success(`Deleted ${t}`),!0}async function Ze(e,t){if(!VA(e))return!1;let i=p();try{if((await i.listDirectory(e)).length>0)return!1;return t(e),await i.deleteFile(e),!0}catch{return!1}}async function hD(e){if(aC(e,"renamed"))return null;let t=Wx(e),i=cy(e),{commitRename:a,listRenameSiblings:r,notifyMoveOutcome:o,renameStatus:l}=await Se(),c=await r(e,"Media");if(c===null)return null;let{renamePromptMessage:d}=await Fe(),f=await d(e),y=await Fn("Rename",{confirmLabel:"Rename",select:"stem",validate:(s)=>UA(e,s,c),value:t,...f!==void 0&&{message:f}});if(!y||y===t)return null;let M=sR(i,y),u=Yc(e);try{let s=await a(e,M);if(m.selected===e)Le(M);if(await Hx(i),u?.width!=null&&u.height!=null)gl(M,u.width,u.height);return o(l(y,s),s,M),M}catch(s){return w.error(`Could not rename ${t}.`,{detail:X(s),path:e,source:"Media"}),null}}async function pD(e){if(aC(e,"duplicated"))return null;let t=await Bx(e);if(t===null)return null;return Le(t.path),x(),t.path}function Le(e){if(m.selected=e,!A({name:Wx(e)},m.query))m.query="";for(let{mount:t}of k.values())t.reveal=e,t.revealFocus=!0}function Ne(e){return{activate:(t)=>{T(e,t),ye(e,t)},activateSelected:()=>{let{selected:t}=e.choice;if(t!==null)ye(e,t)},contextMenu:(t,i,a)=>et(e,t,i,a),copyRef:()=>{let t=Cb(e);if(t)Te(t)},dragOut:()=>{if(e.dropActive)e.dropActive=!1,v(e)},dragOver:()=>{if(!e.dropActive)e.dropActive=!0,v(e)},drop:(t)=>{if(e.dropActive=!1,v(e),t?.length)he(e,t)},focusTile:(t)=>{if(e.choice.selected!==t)T(e,t)},gridHost:(t)=>{e.grid=t},inputHost:(t,i)=>{e.inputs[i].add(t),xe(e);let a=C;if(e.mode==="manage"&&a?.role===i&&(i==="upload"||a.file===e.choice.selected))C=null,te(t)},key:(t,i)=>tt(e,t,i),measure:(t,i,a)=>{if(gl(t,i,a))x();else if(!zd(t))uh(t).then(x)},openDocument:(t)=>{Se().then(({openFileInTab:i})=>i(t))},openViewer:()=>{let{selected:t}=e.choice;if(t!==null)Zu(t)},editImage:()=>{let{selected:t}=e.choice;if(t!==null)lC(t)},remove:()=>{let{selected:t}=e.choice;if(t!==null)uD(t)},rename:()=>{let{selected:t}=e.choice;if(t!==null)hD(t)},duplicate:()=>{let{selected:t}=e.choice;if(t!==null)pD(t)},replace:(t)=>{let[i]=t.files??[];t.value="";let{selected:a}=e.choice;if(i&&a!==null&&gO(a))Vx(a,i).then((r)=>{if(r)sx(a);x()})},reset:()=>{e.choice.filter=e.images?"image":"all",e.choice.query="",v(e)},select:(t)=>T(e,t),setFilter:(t)=>{if(re(t))e.choice.filter=t,v(e)},setQuery:(t)=>{e.choice.query=t,v(e)},setSort:(t)=>{if(ne(t))e.choice.sort=t,v(e)},tileHost:(t,i)=>{e.tiles.set(i,t),je.set(t,i),e.observer.observe(t)},upload:(t)=>{let i=[...t.files??[]];if(t.value="",i.length>0)he(e,i)}}}function Te(e){if("clipboard"in navigator)navigator.clipboard.writeText(e.ref)}var P=null;function et(e,t,i,a){T(e,t);let r=Cb(e);if(!r)return;P?.close();let o=(l,c,d,f={})=>({destructive:!1,disabled:!1,dividerAbove:!1,id:l,run:d,title:c,...f});P=Vt({label:`${r.name} actions`,onClosed:(l)=>{if(P===l)P=null},origin:{x:i,y:a},region:"media-tile",rows:[o("open","Open in Viewer",()=>Zu(t)),...oC(t)?[o("edit","Edit Image",()=>lC(t))]:[],o("copy-url","Copy Site URL",()=>Te(r)),o("rename","Rename…",()=>{hD(t)},{dividerAbove:!0}),...sC()?[o("duplicate","Duplicate",()=>{pD(t)})]:[],o("replace","Replace…",()=>tF(t)),o("delete","Delete",()=>{uD(t)},{destructive:!0,dividerAbove:!0})]})}function ye(e,t){if(e.mode==="pick"){let i=Cb(e);if(i)e.onPick?.(i);return}Zu(t)}function tt(e,t,i){let{files:a}=ke(e),r=q(a,{filter:e.choice.filter,query:e.choice.query,sort:e.choice.sort,unused:F}),o=r.findIndex((f)=>f.file===e.choice.selected),l=e.grid?le(Me(e.grid).width):1,c=o===-1?r.length>0?0:null:se(o,t,l,r.length,i),d=c===null?void 0:r[c];if(!d)return;T(e,d.file),e.tiles.get(d.file)?.focus()}var je=new WeakMap;function De(e,t,i,a,r,o){let l={choice:t,disposed:!1,dropActive:!1,grid:null,handle:null,images:r,inputs:{replace:new Set,upload:new Set},mode:e,observer:xp((c)=>{let d=je.get(c);if(d!==void 0&&!l.visible.has(d))l.visible.add(d),it(l)}),onPick:null,onSelect:null,paneId:a,reveal:null,revealFocus:!1,focusOwed:!1,region:i,sweepTimer:null,tiles:new Map,uploadDir:o,visible:new Set};return l}var G=new Set;function it(e){if(G.has(e))return;G.add(e),queueMicrotask(()=>{G.delete(e),v(e)})}function m0(e,t){let i=k.get(e);return i!==void 0&&i.tabId===t.id&&i.wrap.isConnected&&i.mount.handle!==null&&i.mount.handle.attached()}function Cw(e){let t=k.get(e);if(!t)return;Z(t.mount),k.delete(e)}function oT(e,t){let{paneId:i,wrap:a}=e;if(m0(i,t))return;Cw(i);let r=De("manage",m,$n(i,"media-library"),i,!1,La);if(N.add(r),we(),r.handle=V(a,ee(r),Ne(r),{clear:!0}),k.set(i,{mount:r,tabId:t.id,wrap:a}),Q.delete(i))Ce(r)}async function Ce(e){await e.handle?.ready,He(e,!0)}function He(e,t=e.focusOwed){if(!t||e.disposed)return;let{selected:i}=e.choice,a=(i===null?void 0:e.tiles.get(i))??[...e.tiles.values()].find((r)=>r.getAttribute("tabindex")==="0");if(a?.isConnected){e.focusOwed=!1,a.focus();return}e.focusOwed=!0}function sT(e){let t=k.get(e);if(t?.wrap.isConnected&&t.mount.handle?.attached()===!0){Ce(t.mount);return}Q.add(e)}function eF(e){if(e.filter!==void 0)m.filter=e.filter;if(e.query!==void 0)m.query=e.query;if(e.select!==void 0){if(m.selected=e.select,m.filter!=="all")m.filter="all";m.query=""}x()}function EF(){let e=[...k.values()].map((t)=>$e(t.mount.inputs.upload)).find((t)=>t!==null)??null;if(e){te(e);return}C={file:null,role:"upload"}}function tF(e){eF({select:e});let t=null;for(let i of k.values())if(i.mount.choice.selected===e)t??=$e(i.mount.inputs.replace);if(t){te(t);return}C={file:e,role:"replace"}}var _=null;function be(e){let t=Cb(e);return{blocked:t===null,confirmLabel:t?`Use ${t.name}`:e.images?"Use image":"Use file",headline:e.images?"Choose an image":"Choose media"}}function g0(){let e=_;if(_=null,e)Z(e.mount),e.dialog.close()}function TF(e){g0();let t={filter:e.images?"image":"all",query:"",selected:null,sort:"newest"},i=De("pick",t,`${yt("dialog",B)}/library`,null,e.images,oR(h.value?.documentPath??null)),a=(o)=>{g0(),e.onPick(o.ref)};i.onPick=a,N.add(i),we();let r=fe({body:(o)=>{i.handle=V(o,ee(i),Ne(i),{clear:!1})},closed:()=>{if(_?.mount===i)g0();else Z(i)},confirm:()=>{let o=Cb(i);if(o)a(o)},layer:dt("dialog"),view:be(i)});i.onSelect=()=>r.update(be(i)),_={dialog:r,mount:i}}function aT(){g0();for(let e of k.keys())Cw(e);m.filter="all",m.query="",m.selected=null,m.sort="newest",C=null,Q.clear(),J()}
|
|
2
|
+
export{f0,kF,Cb,uD,hD,pD,m0,Cw,oT,sT,eF,EF,tF,g0,TF,aT};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=108798AFFF34AD9D64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-hy936516.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{mi}from"./studio-zav9hgb3.js";import{p,ve}from"./studio-xh6rf05g.js";import{ia,Yd,g,vl,RR}from"./studio-s49y6m5b.js";import{Eh,w}from"./studio-bk0anq3b.js";import{X}from"./studio-9c6cbq2c.js";import{qd,Ra,py}from"./studio-wn2cmf9q.js";import{Vx,gl,Km}from"./studio-td3h1644.js";import{sI,I1,C_,k_,aI,ad,N1,vf,Yy,E_,T_,Ph,Zy,mg,D1,lI,CM,kM,EM,cI,TM,dI,$_,$M,LM,RM}from"./studio-zzgp5yka.js";import{x}from"./studio-zn7ysyzb.js";import{$n}from"./studio-1a7zshnv.js";import{me,te,b,le}from"./studio-9f5vcb4w.js";import{J}from"./studio-erjccagy.js";import{ce}from"./studio-7qqb7hb8.js";var D={message:"no media file to look for",status:"failed"};function H(t){let e=mi(t);return e===""?null:{path:e}}function ax(t){let e=H(t);return e===null?null:qd(e)}async function Xu(t){let e=H(t);return e===null?D:Ra(e)}function bO(t){if(t===null)return"Counting references…";switch(t.status){case"unsupported":return null;case"pending":return"Counting references…";case"failed":return"Usage unknown";default:return py(t.result)}}var cs="image",B=[320,640,960,1280,1920],C=null,F=null;function W(){return C??=(ce("0afyws7c"),import("./image-editor-0afyws7c.js")),C}function _(){return F??=(ce("m8gzaan9"),import("./image-bake-m8gzaan9.js")),F}var A=new WeakMap;function U(t){return A.get(le(t))}function j(t){let e=le(t),r=A.get(e);if(!r){r=b({decoded:!1,generation:0,history:$_(),live:null,message:"Reading the image…",saving:!1,size:null,source:null,status:"loading",typed:!1}),A.set(e,r);let i=M(r);Yd(e,i),Yd(t,i)}return r}function M(t){return{canRedo:()=>!t.saving&&t.history.future.length>0,canUndo:()=>!t.saving&&t.history.past.length>0,redo:()=>{if(!t.saving)t.history=RM(t.history)},undo:()=>{if(!t.saving)t.history=LM(t.history)}}}function m(t){return t.live??t.history.present}function O(t,e,r){let i=t.source;if(t.source={bytes:e,url:URL.createObjectURL(new Blob([e],{type:r}))},t.status="ready",t.message="",i!==null)URL.revokeObjectURL(i.url)}function T(t){if(t.source!==null)URL.revokeObjectURL(t.source.url),t.source=null,t.status="loading"}async function R(t,e){if(t.source!==null)return;t.generation+=1;let{generation:r}=t;t.status="loading",t.message="Reading the image…";let i=ve()?p():null,u=i?.readFileBytes;if(u===void 0){t.status="refused",t.message="This backend cannot hand Studio a file's raw bytes, so it cannot edit one.";return}let o;try{o=new Uint8Array(await u.call(i,e))}catch(a){if(t.generation===r)t.status="refused",t.message=`Could not read ${e}: ${a instanceof Error?a.message:String(a)}`;return}if(t.generation!==r)return;let n=k_(e,o);if(n!==null){t.status="refused",t.message=n;return}t.size??=sI(o).size,O(t,o,I1(e)??"")}function ll(t){let e=U(t),r=e?.size;if(e===void 0||r===null||r===void 0)return!1;return e.typed||!N1(m(e),r)}function P(t,e){t.live=null,t.history=$M(t.history,e)}var v=new Map;function F$(t,e){let r=v.get(t);return r!==void 0&&le(r.tab)===le(e)&&r.wrap.isConnected&&(r.surface===null||r.surface.attached())}function ox(t){let e=v.get(t);if(!e)return;e.disposed=!0,e.scope.stop(),e.surface?.dispose(),v.delete(t);let r=U(e.tab);if(e.drag!==null&&r!==void 0)r.live=null;if(r!==void 0&&S(e.tab).length===0)r.typed=!1;if(S(e.tab).length===0&&r!==void 0&&!r.saving)T(r),r.generation+=1}function q(t){if(t.rows.length===0||t.rows.find((e)=>e.tabindex==="0")?.id!==t.active)t.rows=mg.map((e)=>({id:e,label:D1[e],tabindex:e===t.active?"0":"-1"}));return t.rows}function h(t){return`${Number(t.toFixed(4))}%`}function L(){let e=x?.projectConfig?.images?.widths;return Array.isArray(e)&&e.length>0&&e.every((r)=>J(r))?e:B}var N=aI.map(({id:t,label:e})=>({label:e,value:t}));function y(t,e){let r=t.tab.documentPath??"",i=r.split("/").pop()??r,u=m(e),o=e.size??{height:1,width:1},n=Ph(u.turns,o),a=Zy(ad(u,o),u,o),l=Yy(u,o),c=E_(u,o),s=dI(u,o,L()),f=I1(r)??"",d=e.source!==null&&e.decoded&&e.size!==null,I=d&&(e.typed||!N1(u,o)),k=vf(u.turns);return{alt:`${i}, being edited`,aspect:u.aspect,aspectOptions:N,brightness:String(u.brightness),busy:e.saving||!d,undecoded:!d,cannotFit:e.saving||!d||s===null||s===c.width,cannotRedo:e.saving||e.history.future.length===0,cannotSave:e.saving||!I||ia(t.tab),cannotUndo:e.saving||e.history.past.length===0,clean:e.saving||!I,contrast:String(u.contrast),cropH:h(a.height/n.height*100),cropW:h(a.width/n.width*100),cropX:h(a.x/n.width*100),cropY:h(a.y/n.height*100),facts:d?`Output ${c.width} × ${c.height} · crop ${l.width} × ${l.height} · source ${o.width} × ${o.height}`:"",filter:T_(u)||"none",fitHint:s===null?"Already no wider than the largest width the build derives.":"The largest of the project's image widths (images.widths, or the build's defaults) below this crop.",fitLabel:s===null?"Fit for web":`Fit for web (${s} px)`,handleHelpId:`${$n(t.paneId,"image")}/handle-help`,handles:q(t),imageHeight:k?h(o.height/n.height*100):"100%",imageTransform:`translate(-50%, -50%) scale(${u.flipH?-1:1}, ${u.flipV?-1:1}) rotate(${u.turns*90}deg)`,imageWidth:k?h(o.width/n.width*100):"100%",maxOutputWidth:String(l.width),maxWidth:`${n.width}px`,message:e.message,moveCursor:u.crop===null?"default":"move",name:i,quality:C_(f)?"shown":"hidden",qualityValue:String(u.quality),ratio:String(n.width/n.height),region:$n(t.paneId,"image"),saturation:String(u.saturation),saving:e.saving,src:e.source?.url??"",status:e.status,warning:`Save overwrites ${r} and keeps no backup. Source control is how to get the original back.`,width:String(c.width)}}function V(t,e,r){let i=Zy(ad(e,r),e,r);Eh(`${D1[t]}: crop ${i.width} × ${i.height} at ${i.x}, ${i.y}`)}function z(t){return mg.some((e)=>e===t)}function Y(t,e){let r=()=>e.source===null||!e.decoded?null:e.size,i=()=>t.surface?.syncFields(y(t,e)),u=M(e),o=(n)=>{let a=r();if(a!==null&&!e.saving)P(e,n(m(e),a))};return{cycleHandle:(n,a)=>{if(!z(n))return;let l=mg.indexOf(n),c=a<0?-1:1,s=mg[(l+c+mg.length)%mg.length];t.active=s,t.surface?.update(y(t,e)),t.surface?.focusHandle(s),Eh(D1[s])},fieldEdited:()=>{e.typed=!0},fitForWeb:()=>{o((n,a)=>{let l=dI(n,a,L());return l===null?n:cI(n,a,l)})},flip:(n)=>{o((a)=>EM(a,n==="v"?"v":"h"))},handleDown:(n,a,l,c,s)=>{let f=r(),d=t.surface?.frameRect();if(f===null||!z(n)||!d||d.width<=0||e.saving)return;s.setPointerCapture(a),t.active=n,t.drag={handle:n,pointerId:a,scale:Ph(m(e).turns,f).width/d.width,start:m(e),startX:l,startY:c}},handleFocused:(n)=>{if(z(n)&&t.active!==n)t.active=n,t.surface?.update(y(t,e))},handleMove:(n,a,l)=>{let{drag:c}=t,s=r();if(c===null||c.pointerId!==n||s===null||e.saving)return;e.live=lI(c.start,s,c.handle,(a-c.startX)*c.scale,(l-c.startY)*c.scale)},handleUp:(n)=>{let{drag:a}=t;if(a===null||a.pointerId!==n)return;if(t.drag=null,e.live!==null)P(e,e.live)},imageFailed:(n)=>{if(e.source?.url!==n)return;T(e),e.status="refused",e.message=`${t.tab.documentPath??"This file"} could not be decoded, so it cannot be edited.`},imageLoaded:(n,a)=>{if(e.source===null||!(n>0&&a>0))return;if(e.decoded=!0,e.size?.width!==n||e.size.height!==a)e.size={height:a,width:n};gl(t.tab.documentPath??"",n,a)},nudge:(n,a,l,c)=>{let s=r();if(s===null||!z(n)||e.saving)return;let f=c?10:1,d=lI(m(e),s,n,a*f,l*f);P(e,d),V(n,d,s)},redo:()=>{u.redo(t.tab)},reset:()=>{o(()=>$_().present)},rotate:(n)=>{o((a)=>kM(a,n<0?-1:1))},save:()=>{j$(t.tab)},setAspect:(n)=>{let a=aI.find((l)=>l.id===n);if(a)o((l,c)=>CM(l,c,a.id))},setValue:(n,a)=>{if(a.trim()!==""&&(n==="brightness"||n==="contrast"||n==="saturation"||n==="quality"))o((l)=>TM(l,n,Number(a)));e.typed=!1,i()},setWidth:(n)=>{o((a,l)=>cI(a,l,n.trim()===""?null:Number(n))),e.typed=!1,i()},undo:()=>{u.undo(t.tab)}}}function mO(t,e){let{paneId:r,wrap:i}=t;if(F$(r,e))return;ox(r);let u=j(e),o={active:"nw",disposed:!1,drag:null,paneId:r,rows:[],scope:me(),surface:null,tab:e,wrap:i};v.set(r,o),R(u,e.documentPath??""),W().then(({mountImageEditorSurface:n})=>{if(o.disposed)return;o.surface=n(i,y(o,u),Y(o,u)),o.scope.run(()=>{te(()=>{if(!o.disposed)o.surface?.update(y(o,u))})})})}async function Q(t,e){if(t.source===null)await R(t,e);if(t.source===null&&t.status==="loading")await R(t,e);return t.source}function S(t){let e=le(t);return[...v.values()].filter((r)=>le(r.tab)===e)}async function j$(t){let e=t.documentPath??"",r=e.split("/").pop()??e;if(ia(t))return w.warn(`You have read access to this session — the edit to ${r} stays in your browser and cannot be saved.`,{key:`image.readOnly:${e}`,path:e,source:"Collaboration"}),!1;let i=U(t);if(i===void 0||i.saving)return i===void 0;for(let u of S(t))u.surface?.flushFields(),u.drag=null;if(i.typed=!1,i.live!==null)P(i,i.live);i.saving=!0;try{let{size:u}=i,o=m(i);if(u===null||N1(o,u))return w.info(`${r} has no changes, so nothing was written.`,{key:`image.identity:${e}`}),!0;let n=(E)=>(w.error(`Could not save ${r}.`,{detail:E,path:e,source:"Image"}),!1),a=await Q(i,e);if(a===null)return n(i.message);let l=I1(e)??"",{bakeImage:c}=await _(),s;try{s=await c(o,a.bytes,l)}catch(E){return n(`The browser could not process this image: ${X(E)}`)}if(!s.ok)return n(s.reason);if(!vl(t))return!1;if(t.documentPath!==e)return n("It was renamed while saving, so the edit was not written to its old name.");let{blob:f}=s,d=Km(a.bytes.byteLength),I=f.size>a.bytes.byteLength?", so the file grew":"";if(!await Vx(e,new File([f],r,{type:l}),{note:`${s.size.width} × ${s.size.height}, ${Km(f.size)} (was ${d}${I})`}))return!1;return O(i,new Uint8Array(await f.arrayBuffer()),l),i.size=s.size,i.decoded=!0,gl(e,s.size.width,s.size.height),i.live=null,i.history=$_(),!0}finally{if(i.saving=!1,S(t).length===0)T(i),i.generation+=1}}function gO(t){let e=g.tabs.get(t);if(!e||!ll(e))return!0;let r=t.split("/").pop()??t;return w.warn(`${r} has an unsaved edit. Save or discard it before replacing the file.`,{key:`image.replaceDirty:${t}`,path:t,source:"Image"}),!1}function sx(t){let e=g.tabs.get(t),r=e&&U(e);if(!e||r===void 0||r.saving||ll(e))return;if(T(r),r.generation+=1,r.size=null,r.decoded=!1,r.live=null,r.history=$_(),S(e).length>0)R(r,t)}RR(ll);
|
|
2
|
+
export{cs,ll,F$,ox,mO,j$,gO,sx,ax,Xu,bO};
|
|
3
|
+
|
|
4
|
+
//# debugId=97BF6861F6A6FF8364756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-j3bq30yz.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{$$,L$,R$}from"./studio-pgze9p34.js";import{p,ve}from"./studio-xh6rf05g.js";import{mb,qE,KE}from"./studio-35pmfjtx.js";import{SO,lx,dl,Ea,NO,ds,Ql,ux}from"./studio-pv1ts08p.js";import{ce}from"./studio-7qqb7hb8.js";var t="checking",i=null;function bw(){return ve()&&Boolean(p().cfConnect)}async function fb(){if(!bw())return;i??=(async()=>{try{t=await p().cfConnection?.()??null}catch{t=null}i=null,hm()})(),await i}function BN(){if(bw()&&t==="checking"&&!i)fb()}function VN(){t="checking",i=null}async function d(){let n=await p().cfConnect?.();if(n?.status==="connected"&&!n.connection.accountId){let{openCfAccountPicker:e}=await (ce("ajh60k54"),import("./cf-account-picker-ajh60k54.js"));await e()}ds(),await fb()}function s(){let n={id:"disconnect",label:"Disconnect",run:async()=>{await p().cfDisconnect?.(),ds(),await fb()},variant:"negative"},e=(r)=>({id:r==="Connect"?"connect":"reconnect",label:r,run:d,variant:"accent"}),o={id:"cloudflare",label:"Cloudflare",revoke:()=>{}};if(t==="checking")return{...o,actions:[],connected:!1,detail:"Checking your connection…"};if(!t?.connected)return{...o,actions:[e("Connect")],connected:!1,detail:"Not connected. Connecting publishes this site and runs the assistant on Workers AI."};let c=()=>{n.run()};if(t.needsReconnect)return{...o,actions:[e("Reconnect"),n],connected:!0,detail:"Connection expired. Reconnect to keep publishing and the assistant working.",revoke:c};if(t.needsAccount||!t.accountId)return{...o,actions:[{id:"choose-account",label:"Choose account",run:async()=>{let{openCfAccountPicker:r}=await (ce("ajh60k54"),import("./cf-account-picker-ajh60k54.js"));if(await r())ds(),await fb()},variant:"accent"},n],connected:!0,detail:"Connected, but no account is chosen yet — publishing and the assistant need one.",revoke:c};return{...o,actions:[n],connected:!0,detail:`Connected — ${t.accountName??t.accountId}.`,revoke:c}}function l(){let n=mb(),e=qE();return{connected:Boolean(n),detail:n?`Connected${e?` — account ${e}`:""}.`:"Not connected. Publishing will ask when it needs it.",id:"cloudflare",label:"Cloudflare",revoke:KE}}function u(n){let e={id:n.id,label:n.label,run:async()=>{await ux(n)}};if(n.primary)e.variant="accent";return e}function f(n){return{actions:(n.actions??[]).map((e)=>u(e)),connected:n.connected??!1,detail:n.detail,id:`platform:${n.id}`,label:n.label,revoke:()=>{}}}function WE(){let n=$$(),e=Ql(),o=dl();return[{id:"github",label:"GitHub",detail:n?L$()==="desktop"?"Signed in — the token is in this app's config folder, readable only by you.":"Signed in — a device-flow token is stored in this browser.":"Not signed in. Cloning and pushing will ask when they need it.",connected:Boolean(n),revoke:R$},{id:"ai",label:"AI provider",detail:lx()?`${Ea()==="anthropic"?"Anthropic key":"Key"} stored. Model ${e}${o?` via ${o}`:""}.`:"No key stored. The Assistant section is where one is entered.",connected:lx(),revoke:NO},bw()?s():l(),...SO().map((c)=>f(c))]}function WN(n){let e=WE().find((o)=>o.id===n);if(!e)return!1;return e.revoke(),hm(),!0}var a=new Set;function zN(n){return a.add(n),()=>{a.delete(n)}}function hm(){for(let n of a)n()}
|
|
2
|
+
export{bw,fb,BN,VN,WE,WN,zN,hm};
|
|
3
|
+
|
|
4
|
+
//# debugId=B766CA9193D7322164756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-j52ks8q7.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Me}from"./studio-
|
|
2
|
-
export{
|
|
1
|
+
import{Me}from"./studio-bmwgj8ez.js";import{Q}from"./studio-erjccagy.js";var f=3;function p(e,t,n){return Math.min(n,Math.max(t,e))}function W0(e){let t=Math.max(0,Math.trunc(e.count)),n=Math.max(1,Math.trunc(e.columns??1)),o=Math.ceil(t/n);if(!(e.rowHeight>0)||!(e.viewportHeight>0))return{end:t,padBottom:0,padTop:0,start:0,totalRows:o};let r=Math.max(0,Math.trunc(e.overscanRows??f)),i=Math.max(0,e.scrollTop),m=Math.floor(i/e.rowHeight),w=Math.ceil(e.viewportHeight/e.rowHeight)+1,l=p(m-r,0,o),a=p(m+w+r,l,o);return{end:Math.min(t,a*n),padBottom:(o-a)*e.rowHeight,padTop:l*e.rowHeight,start:Math.min(t,l*n),totalRows:o}}function M(e,t){return e.start===t.start&&e.end===t.end&&e.totalRows===t.totalRows&&e.padTop===t.padTop&&e.padBottom===t.padBottom}function R(e){let{scroller:t,list:n,count:o,rowHeight:r,columns:i,onChange:m,overscanRows:w}=e,l={end:0,padBottom:0,padTop:0,start:0,totalRows:0},a=!1;function c(){if(a)return;let d=W0({columns:i?.()??1,count:o(),overscanRows:w??f,rowHeight:r(),scrollTop:n?H(t,n):t.scrollTop,viewportHeight:t.clientHeight}),b=!M(l,d);if(l=d,b)m(d)}t.addEventListener("scroll",c,{passive:!0});let u=0,T=()=>{if(u!==0)return;u=requestAnimationFrame(()=>{u=0,c()})},s=null;if(Q(globalThis.ResizeObserver)){if(s=new ResizeObserver(T),s.observe(t),n)s.observe(n)}return c(),{destroy(){if(a=!0,t.removeEventListener("scroll",c),s?.disconnect(),s=null,u!==0)cancelAnimationFrame(u),u=0},measure:c,range:()=>l}}function v(e){for(let t=e;t;t=t.parentElement){if(t.scrollHeight<=t.clientHeight)continue;let n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="overlay")return t}return null}function g(e){let t=h.get(e);if(t&&t.isConnected&&e.isConnected&&t.contains(e))return t;let n=L(e)??v(e);if(n)h.set(e,n);else h.delete(e);return n}var x="data-jx-scroller";function L(e){return e.isConnected?e.closest(`[${x}]`):null}function H(e,t){if(e===t)return Math.max(0,e.scrollTop);return Math.max(0,Me(e).top-Me(t).top)}function zw(e,t){let n=e?.isConnected===!0?g(e):null;if(!n||!e){let o=Math.max(0,Math.trunc(t.count));return{end:o,padBottom:0,padTop:0,start:0,totalRows:o}}return W0({columns:t.columns??1,count:t.count,overscanRows:t.overscanRows??f,rowHeight:t.rowHeight,scrollTop:H(n,e),viewportHeight:n.clientHeight})}function W(e){let t=e.listOffset+e.index*e.rowHeight,n=t+e.rowHeight;if(t<e.scrollTop)return Math.max(0,t);if(n>e.scrollTop+e.viewportHeight)return Math.max(0,n-e.viewportHeight);return null}function Uw(e,t,n){let o=e?.isConnected===!0?g(e):null;if(!o||!e||t<0||!(n>0))return!1;let{scrollTop:r}=o,i=W({index:t,listOffset:r-H(o,e),rowHeight:n,scrollTop:r,viewportHeight:o.clientHeight});if(i===null)return!1;return o.scrollTop=i,!0}function KD(e,t,n){let o=e?.querySelector(t);return o&&o.offsetHeight>0?o.offsetHeight:n}var h=new WeakMap;function qw(e,t,n){let o=g(t);if(e&&e.list===t&&e.scroller===o)return e;if(e?.window.destroy(),!o)return null;return{list:t,scroller:o,window:R({count:n.count,list:t,onChange:()=>n.onChange(),rowHeight:n.rowHeight,scroller:o})}}
|
|
2
|
+
export{W0,zw,Uw,KD,qw};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=DA9D7F883647F4C064756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-jqvke4ac.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p}from"./studio-
|
|
2
|
-
export{Wp,
|
|
1
|
+
import{p}from"./studio-xh6rf05g.js";import{hs}from"./studio-wn2cmf9q.js";import{Rs,Kd,gR}from"./studio-48yzqzqr.js";import{ky,g}from"./studio-s49y6m5b.js";import{x}from"./studio-zn7ysyzb.js";var P=/[.*+?^${}()|[\]\\]/;function v(e){return P.test(e)?`\\${e}`:e}function L(e){let t=e.length;while(t>0&&e[t-1]===" "){let n=0,r=t-2;while(r>=0&&e[r]==="\\")n+=1,r-=1;if(n%2===1)break;t-=1}return e.slice(0,t)}function T(e,t){let n=t+1;if(e[n]==="!")n+=1;if(e[n]==="]")n+=1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]==="]")return n;n+=1}return-1}function k(e){let t="",n=0;while(n<e.length){let r=e[n];if(r==="\\"){let o=e[n+1];if(o===void 0)t+=String.raw`\\`,n+=1;else t+=v(o),n+=2;continue}if(r==="*"){let o=0;while(e[n]==="*")o+=1,n+=1;let i=t===""||t.endsWith("/");if(o>=2&&i&&e[n]==="/")t+="(?:[^/]+/)*",n+=1;else if(o>=2&&i&&n>=e.length)t+=".*";else t+="[^/]*";continue}if(r==="?"){t+="[^/]",n+=1;continue}if(r==="["){let o=T(e,n);if(o===-1){t+=String.raw`\[`,n+=1;continue}let i=e.slice(n+1,o),s=i.startsWith("!"),a=s?i.slice(1):i;t+=`[${s?"^":""}${a.startsWith("]")?String.raw`\]${a.slice(1)}`:a}]`,n=o+1;continue}t+=v(r),n+=1}return t}function F(e){let t=L(e);if(t===""||t.startsWith("#"))return null;let n=!1;if(t.startsWith("!"))n=!0,t=t.slice(1);let r=!1;if(t.endsWith("/"))r=!0,t=t.slice(0,-1);let o=t.includes("/");if(t.startsWith("/"))t=t.slice(1),o=!0;if(t==="")return null;let i=k(t);return{dirOnly:r,negated:n,re:new RegExp(`^${o?"":"(?:.*/)?"}${i}$`),source:e}}function M(e){let t=[];for(let n of e.split(/\r?\n/)){let r=F(n);if(r)t.push(r)}return t}function b(e){let t=e.replaceAll("\\","/").replace(/^\.\/+/,"").replace(/\/+$/,"");return t==="."?"":t}function O(e,t){if(e==="")return t;return t.startsWith(`${e}/`)?t.slice(e.length+1):null}function w(e){let t=b(e),n=[""];if(t==="")return n;let r="";for(let o of t.split("/"))r=r===""?o:`${r}/${o}`,n.push(r);return n}function W(e,t,n){let r=!1;for(let o of e){let i=O(o.base,t);if(i===null||i==="")continue;for(let s of o.rules){if(s.dirOnly&&!n)continue;if(s.re.test(i))r=!s.negated}}return r}function N(e,t,n){let r=b(t);if(r==="")return!1;let o=r.split("/"),i="";for(let[s,a]of o.entries()){i=i===""?a:`${i}/${a}`;let u=s===o.length-1;if(W(e,i,u?n:!0))return!0}return!1}var d=new Map,y=new Map;function Wp(){d.clear(),y.clear()}async function C(e){try{let t=await p().readFile(e===""?".gitignore":`${e}/.gitignore`);return{base:e,rules:M(t)}}catch{return null}}function _(e){let t=d.get(e);if(t!==void 0)return Promise.resolve(t);let n=y.get(e);if(n)return n;let r=C(e).then((o)=>(d.set(e,o),y.delete(e),o));return y.set(e,r),r}async function E(){let e=[...d.keys()];y.clear();let t=await Promise.all(e.map((n)=>C(n)));d.clear();for(let[n,r]of e.entries())d.set(r,t[n]??null)}async function GA(e){await Promise.all(w(e).map((t)=>_(t)))}function A(e){let t=[];for(let n of w(e)){let r=d.get(n);if(r)t.push(r)}return t}function JA(e,t,n){return N(A(e),t,n)}function D(e){return e.some((t)=>b(t).split("/").pop()===".gitignore")}var U=1500,S={commit:0,open:1,reconnect:2},G=250,V=8,R=new Map,I=(e)=>e.replaceAll("\\","/");function Ls(...e){Kd(e,e);let t=Date.now()+U;for(let n of e)if(n)R.set(I(n),t)}function Ud(e){let t=I(e),n=R.get(t);if(n===void 0)return!1;if(Date.now()>n)return R.delete(t),!1;return!0}function Y(e){let t=e.lastIndexOf("/");return t===-1?".":e.slice(0,t)}function z(e){let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function B(e,t,n){let r=new Set;for(let o of n){let i=Y(o.path);if(o.type==="add"||o.type==="addDir"){let s=e.get(i);if(s&&!s.some((a)=>a.path===o.path))s.push({name:z(o.path),path:o.path,type:o.isDir?"directory":"file"}),r.add(i);if(o.type==="addDir"&&!e.has(o.path))e.set(o.path,[])}else if(o.type==="unlink"||o.type==="unlinkDir"){let s=e.get(i);if(s){let a=s.findIndex((u)=>u.path===o.path);if(a!==-1)s.splice(a,1),r.add(i)}if(o.type==="unlinkDir"){e.delete(o.path);let a=[];for(let c of e.keys())if(c.startsWith(`${o.path}/`))a.push(c);for(let c of a)e.delete(c);let u=[];for(let c of t)if(c===o.path||c.startsWith(`${o.path}/`))u.push(c);for(let c of u)t.delete(c)}}}return r}function j(e){let t=[],n=[];for(let r of e)if(r.type==="unlinkDir")n.push(r.path);else if(r.type!=="addDir")t.push(r.path);if(t.length>0||n.length>0)Kd(t,n)}function q(e,t){return e!==void 0&&e.length===t.length&&e.every((n,r)=>n===t[r])}var K=2;async function H(e,t){let n=[...e.keys()],r=0,o=async(s)=>{for(let a=0;a<K;a+=1){let u=e.get(s);if(!u)return;let c=[...u],l;try{l=await t(s)}catch{l=null}if(!e.has(s))return;if(!q(e.get(s),c))continue;if(l)e.set(s,l);else e.delete(s);return}},i=async()=>{while(r<n.length){let s=n[r];r+=1,await o(s)}};await Promise.all(Array.from({length:Math.min(V,n.length)},i))}var J=new Set(["media","grid"]);function Q(e){return e.some((t)=>J.has(t))||e.length>0&&e.every((t)=>t==="git-diff")}function X(){let e=new Set;for(let t of g.tabs.values()){let n=t.documentPath;if(n&&!t.doc.dirty&&!ky(n)&&!Q(t.capabilities.modes))e.add(n)}return[...e]}function uR(e){let t=p();if(!t.subscribeFileEvents)return()=>{};let n=[],r=null,o=null,i=null,s=()=>{r=null;let l=x,f=n.filter((h)=>!Ud(h.path));if(n=[],!l||f.length===0)return;let m=B(l.dirs,l.expanded,f);if(e.onContentChange){for(let h of f)if(h.type==="change")e.onContentChange(h.path)}if(m.size>0)e.renderLeftPanel()},a=async()=>{i=null;let l=o;o=null;let f=x;if(!f||!l)return;let m=H(f.dirs,(h)=>Rs(()=>t.listDirectory(h)));if(l==="reconnect")hs(),e.invalidateDerivedCaches?.(void 0,!0),await Promise.all([m,E()]);else await m;if(x!==f)return;if(l==="reconnect")e.onResyncContent?.(X());e.renderLeftPanel()},u=(l)=>{if(l!=="commit")gR();if(!o||S[l]>S[o])o=l;if(i)clearTimeout(i);i=setTimeout(()=>{a()},G)},c=t.subscribeFileEvents((l)=>{if(hs(),e.invalidateDerivedCaches?.(l.map((f)=>f.path),l.some((f)=>f.type!=="change")),j(l),D(l.map((f)=>f.path)))E().then(()=>e.renderLeftPanel());if(n.push(...l),r)clearTimeout(r);r=setTimeout(s,50)},{onResync:u});return()=>{if(i)clearTimeout(i),i=null;c()}}
|
|
2
|
+
export{Wp,GA,JA,Ls,Ud,uR};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=0F4BDBCF692D242964756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-k05g7efh.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{R_,I_}from"./studio-69g6a0jn.js";import{n,m}from"./studio-erjccagy.js";import{up,ce}from"./studio-7qqb7hb8.js";var a={document:R_,project:I_},i={...a},s={document:null,project:null},p=!1;function u(e){return s[e]??=(async()=>{try{let{default:t}=await (ce("7sx2vexa"),import("./2020-7sx2vexa.js").then((m)=>up(m.default,1))),{default:r}=await (ce("2q88g57p"),import("./index-2q88g57p.js").then((m)=>up(m.default,1))),o=new t({allErrors:!0,strict:!1,allowUnionTypes:!0});return r(o),o.compile(i[e])}catch(t){if(!p)p=!0,console.error(`[jx] ${e} schema validation is unavailable — the AI assistant's schema gate is a `+"no-op for this session:",t);return null}})(),s[e]}function j(e){return m(e)&&Object.keys(e).length>0}function LF(e){let t=e?.document,r=e?.project,o=j(t)?t:a.document,c=j(r)?r:a.project,d=o!==a.document||c!==a.project;if(o===i.document&&c===i.project)return d;return i.document=o,i.project=c,s.document=null,s.project=null,d}var f=["unevaluatedProperty","additionalProperty","missingProperty"];function l(e){return(e.errors||[]).map((t)=>{let r=f.find((c)=>n(t.params[c])),o=r?` (${String(t.params[r])})`:"";return`${t.instancePath||"(root)"}: ${t.message}${o}`})}async function Em(e){let t=await u("document");if(!t||t(e))return[];return l(t)}async function RF(e){let t=await u("document");if(!t)return null;return t(e)?[]:l(t)}async function Gu(e){let t=await u("project");if(!t||t(e))return[];return l(t)}
|
|
2
|
+
export{LF,Em,RF,Gu};
|
|
3
|
+
|
|
4
|
+
//# debugId=82C0FBEE6A61EFD364756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-kefs4sz4.js.map
|