@jxsuite/studio 5.5.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/chunks/{2020-g8mwpbkq.js → 2020-zvax9fmb.js} +3 -3
- package/dist/chunks/adapter-6zhjbpmd.js +4 -0
- package/dist/chunks/cf-account-picker-zfycs4k2.js +4 -0
- package/dist/chunks/cf-settings-fpa485q3.js +4 -0
- package/dist/chunks/components-b0vh4sq8.js +4 -0
- package/dist/chunks/content-source-z5t0d0h9.js +4 -0
- package/dist/chunks/convert-to-repeater-x19jr6c7.js +4 -0
- package/dist/chunks/editor-7e23n4a8.js +4 -0
- package/dist/chunks/entry-commands-5cm6aba2.js +4 -0
- package/dist/chunks/extension-sections-y90sa0n4.js +4 -0
- package/dist/chunks/file-ops-hv7gf757.js +4 -0
- package/dist/chunks/files-kb0epdxf.js +4 -0
- package/dist/chunks/format-host-eg1wy2bp.js +4 -0
- package/dist/chunks/fs-events-ky3vxfmh.js +4 -0
- package/dist/chunks/git-panel-yyg3bzp2.js +4 -0
- package/dist/chunks/grid-view-5mqv1cbd.css +1 -0
- package/dist/chunks/grid-view-d9mybhn0.js +51 -0
- package/dist/chunks/iframe-host-9wdf0hes.js +4 -0
- package/dist/chunks/index-2tf0m2ne.js +4 -0
- package/dist/chunks/{index-arg188jq.js → index-vnwy9d44.js} +3 -3
- package/dist/chunks/{javascript-zcdmye2k.js → javascript-f0nrbdjb.js} +2 -2
- package/dist/chunks/{jsonMode-6x5e1nbf.js → jsonMode-nfa90dtf.js} +5 -5
- package/dist/chunks/jx-validate-7w11db9v.js +4 -0
- package/dist/chunks/layers-7zasrpse.js +4 -0
- package/dist/chunks/layers-panel-9nzc4fdq.js +4 -0
- package/dist/chunks/lit-html-5qr7nbng.js +4 -0
- package/dist/chunks/media-picker-maevn9d4.js +4 -0
- package/dist/chunks/menu-wq6q0v3y.js +4 -0
- package/dist/chunks/{monaco-binding-4az2kh5p.js → monaco-binding-antn79jf.js} +3 -3
- package/dist/chunks/monaco-buffer-9ry2rn5x.js +4 -0
- package/dist/chunks/{monaco-setup-d7mwkcx3.js → monaco-setup-k8s40vwg.js} +3 -3
- package/dist/chunks/notify-g91gjd6w.js +4 -0
- package/dist/chunks/platform-jdwjp2vt.js +4 -0
- package/dist/chunks/publish-panel-8yym447p.js +4 -0
- package/dist/chunks/quick-search-9bzm9kh3.js +4 -0
- package/dist/chunks/references-znssfqvq.js +4 -0
- package/dist/chunks/right-panel-czbzktm8.js +4 -0
- package/dist/chunks/section-registry-0rtq73qs.js +4 -0
- package/dist/chunks/studio-011em5cf.js +5 -0
- package/dist/chunks/studio-02y9cb4h.js +6 -0
- package/dist/chunks/{studio-7gqyhjns.js → studio-09n3fyy0.js} +4 -4
- package/dist/chunks/{studio-xcng8nx7.js → studio-0c3fpdqj.js} +5 -5
- package/dist/chunks/studio-0mm38y62.js +5 -0
- package/dist/chunks/studio-0nm2skex.js +4 -0
- package/dist/chunks/{studio-73czgk6a.js → studio-153mwkyq.js} +4 -4
- package/dist/chunks/{studio-f8jyp45j.js → studio-1pxvgx1t.js} +4 -4
- package/dist/chunks/studio-27tc8q0h.js +5 -0
- package/dist/chunks/studio-28pz4s1k.js +5 -0
- package/dist/chunks/{studio-x5esgzct.js → studio-36s6qjgq.js} +4 -4
- package/dist/chunks/studio-4yztve2t.js +5 -0
- package/dist/chunks/{studio-x9sagq2d.js → studio-5fc0728f.js} +7 -7
- package/dist/chunks/{studio-7jazdy6y.js → studio-654fxcr0.js} +4 -4
- package/dist/chunks/studio-6exg5z4x.js +4 -0
- package/dist/chunks/studio-6k1eswp9.js +5 -0
- package/dist/chunks/{studio-5wfrgee9.js → studio-6zyt56ek.js} +4 -4
- package/dist/chunks/studio-7djymzt2.js +5 -0
- package/dist/chunks/{studio-b4epb26c.js → studio-7w04zw8h.js} +7 -7
- package/dist/chunks/studio-805fwp9k.js +5 -0
- package/dist/chunks/{studio-k1eaqyzm.js → studio-81twpmzj.js} +4 -4
- package/dist/chunks/studio-891t1tv9.js +5 -0
- package/dist/chunks/{studio-5n1km79v.js → studio-9n2j9nqk.js} +4 -4
- package/dist/chunks/{studio-he2fhrgp.js → studio-9tkaykt5.js} +4 -4
- package/dist/chunks/studio-ant1zbp3.js +5 -0
- package/dist/chunks/studio-b29h7g7s.js +5 -0
- package/dist/chunks/studio-b5rxwkj2.js +5 -0
- package/dist/chunks/studio-d007j0z3.js +7 -0
- package/dist/chunks/studio-dknr8m7b.js +14 -0
- package/dist/chunks/{studio-eq27rrr0.js → studio-dmymvk2j.js} +3 -3
- package/dist/chunks/studio-dtmdjmqb.js +5 -0
- package/dist/chunks/studio-eb5sty2k.js +5 -0
- package/dist/chunks/{studio-hc9q4j24.js → studio-ebt49j3c.js} +5 -5
- package/dist/chunks/studio-eegyf5vg.js +5 -0
- package/dist/chunks/studio-frv7vjhw.js +5 -0
- package/dist/chunks/studio-ft8pfpp0.js +5 -0
- package/dist/chunks/{studio-mhhc9btt.js → studio-gj4j9e7k.js} +4 -4
- package/dist/chunks/{studio-hf4qdjc8.js → studio-gxna6yta.js} +4 -4
- package/dist/chunks/studio-je15p5v8.js +6 -0
- package/dist/chunks/{studio-21enxdr8.js → studio-jsr14n1s.js} +4 -4
- package/dist/chunks/studio-k9pwvmz8.js +5 -0
- package/dist/chunks/{studio-p1eggxcf.js → studio-ks0ecgjx.js} +3 -3
- package/dist/chunks/studio-mb8jhtr4.js +64 -0
- package/dist/chunks/studio-mf41717j.js +5 -0
- package/dist/chunks/{studio-625ezz59.js → studio-mm8x32gg.js} +4 -4
- package/dist/chunks/{studio-pkkw32j0.js → studio-n2e133d6.js} +4 -4
- package/dist/chunks/{studio-c4pnt1c6.js → studio-njmg0e73.js} +5 -5
- package/dist/chunks/studio-nvykrgbj.js +4 -0
- package/dist/chunks/studio-nw4q9sdn.js +5 -0
- package/dist/chunks/studio-p6avneaq.js +5 -0
- package/dist/chunks/studio-pvj970st.js +5 -0
- package/dist/chunks/studio-r7yeeqc4.js +5 -0
- package/dist/chunks/studio-s85vah66.js +6 -0
- package/dist/chunks/studio-sadckcpp.js +7 -0
- package/dist/chunks/studio-sgzss898.js +9 -0
- package/dist/chunks/{studio-7by9a93k.js → studio-t0v47dpc.js} +4 -4
- package/dist/chunks/{studio-jnb285we.js → studio-tj28pxa1.js} +4 -4
- package/dist/chunks/{studio-6j2jn55a.js → studio-tzs6njnb.js} +8 -8
- package/dist/chunks/studio-vz7b43ng.js +5 -0
- package/dist/chunks/studio-w8w9frjy.js +16 -0
- package/dist/chunks/{studio-xc8ebsts.js → studio-wr0pq67n.js} +4 -4
- package/dist/chunks/{studio-8r4y2x0z.js → studio-y164brht.js} +4 -4
- package/dist/chunks/studio-y17505ge.js +928 -0
- package/dist/chunks/studio-ymsjnvp9.js +5 -0
- package/dist/chunks/studio-z1vdxq0e.js +5 -0
- package/dist/chunks/studio-z47mm077.js +10 -0
- package/dist/chunks/studio-zkkdbbvd.js +9 -0
- package/dist/chunks/{studio-awqghqxv.js → studio-zkvyd3ev.js} +4 -4
- package/dist/chunks/{tsMode-rtwt7w1a.js → tsMode-eq26t9gs.js} +5 -5
- package/dist/chunks/workspace-emt8454d.js +4 -0
- package/dist/chunks/ws-client-3gxqp06s.js +4 -0
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +62 -59
- package/dist/studio.css +1 -1
- package/dist/studio.js +115 -117
- package/package.json +5 -5
- package/src/account/action-flow.ts +294 -0
- package/src/account/action-required.ts +68 -0
- package/src/account-status.ts +29 -1
- package/src/browse/library-model.ts +3 -1
- package/src/browse/library-preview.ts +6 -2
- package/src/canvas/asset-refs.ts +3 -1
- package/src/canvas/asset-resolve.ts +79 -1
- package/src/canvas/iframe-entry.ts +38 -1
- package/src/canvas/iframe-host.ts +85 -0
- package/src/canvas/iframe-protocol.ts +13 -0
- package/src/files/asset-versions.ts +294 -0
- package/src/files/files.ts +61 -9
- package/src/files/fs-events.ts +279 -28
- package/src/files/media-meta.ts +2 -1
- package/src/files/media-paths.ts +5 -2
- package/src/files/media-upload.ts +5 -1
- package/src/new-project/add-repo-modal.ts +12 -1
- package/src/new-project/new-project-modal.ts +12 -1
- package/src/panels/git-panel.ts +25 -2
- package/src/platform-errors.ts +61 -1
- package/src/platforms/cloud.ts +389 -50
- package/src/platforms/devserver.ts +17 -1
- package/src/publish/pages-service.ts +17 -7
- package/src/services/ai-models.ts +30 -6
- package/src/services/ai-system-prompt.ts +81 -51
- package/src/settings/preferences-accounts.ts +42 -3
- package/src/settings/preferences-dialog.ts +8 -1
- package/src/studio.ts +18 -1
- package/src/surfaces/dialog.ts +5 -0
- package/src/surfaces/welcome.json +86 -1
- package/src/surfaces/welcome.ts +61 -2
- package/src/types.ts +84 -2
- package/src/ui/ai-managed-connect.ts +41 -4
- package/src/ui/media-picker.ts +2 -1
- package/dist/chunks/adapter-bsbs78x9.js +0 -4
- package/dist/chunks/cf-account-picker-gnm7xeqb.js +0 -4
- package/dist/chunks/cf-settings-9y6jyscp.js +0 -4
- package/dist/chunks/components-s51h3b7c.js +0 -4
- package/dist/chunks/content-source-ty3be0qg.js +0 -4
- package/dist/chunks/convert-to-repeater-c3e7q61z.js +0 -4
- package/dist/chunks/editor-t002b41m.js +0 -4
- package/dist/chunks/entry-commands-sb72e9gy.js +0 -4
- package/dist/chunks/extension-sections-ktn2ntnj.js +0 -4
- package/dist/chunks/file-ops-78zeytkm.js +0 -4
- package/dist/chunks/files-gatzrz8v.js +0 -4
- package/dist/chunks/format-host-r59b1651.js +0 -4
- package/dist/chunks/fs-events-f8h91ndt.js +0 -4
- package/dist/chunks/git-panel-y12zf7nj.js +0 -4
- package/dist/chunks/grid-view-rfd8b2pg.js +0 -51
- package/dist/chunks/grid-view-tafenfm2.css +0 -1
- package/dist/chunks/iframe-host-vsrsj20g.js +0 -4
- package/dist/chunks/index-5aghyrfh.js +0 -4
- package/dist/chunks/jx-validate-653krkrf.js +0 -4
- package/dist/chunks/layers-32p8gtae.js +0 -4
- package/dist/chunks/layers-panel-rs58m105.js +0 -4
- package/dist/chunks/lit-html-54bmkwz3.js +0 -4
- package/dist/chunks/media-picker-5bb04wct.js +0 -4
- package/dist/chunks/menu-cbha7w2e.js +0 -4
- package/dist/chunks/monaco-buffer-9vbbyfr1.js +0 -4
- package/dist/chunks/notify-dc1nz5ar.js +0 -4
- package/dist/chunks/platform-2m49s1zf.js +0 -4
- package/dist/chunks/publish-panel-nx3ycmma.js +0 -4
- package/dist/chunks/quick-search-yzrzh9x3.js +0 -4
- package/dist/chunks/references-vx7mbj9f.js +0 -4
- package/dist/chunks/right-panel-7jzpbxja.js +0 -4
- package/dist/chunks/section-registry-gjryse41.js +0 -4
- package/dist/chunks/studio-3znfhcxg.js +0 -5
- package/dist/chunks/studio-58qam27v.js +0 -4
- package/dist/chunks/studio-6j59fwaw.js +0 -5
- package/dist/chunks/studio-7z69g1gx.js +0 -5
- package/dist/chunks/studio-93j3v6zx.js +0 -5
- package/dist/chunks/studio-9gf6v8zy.js +0 -5
- package/dist/chunks/studio-9rhmettf.js +0 -4
- package/dist/chunks/studio-ac5aq677.js +0 -10
- package/dist/chunks/studio-as65vbns.js +0 -5
- package/dist/chunks/studio-bkv0sga4.js +0 -6
- package/dist/chunks/studio-bttmqef4.js +0 -5
- package/dist/chunks/studio-c3y9d41k.js +0 -5
- package/dist/chunks/studio-ccegp7gz.js +0 -9
- package/dist/chunks/studio-chxabn98.js +0 -6
- package/dist/chunks/studio-cktcdsxz.js +0 -16
- package/dist/chunks/studio-cnspfke5.js +0 -5
- package/dist/chunks/studio-de3p1ktm.js +0 -5
- package/dist/chunks/studio-fsbcn530.js +0 -928
- package/dist/chunks/studio-gftga7a3.js +0 -64
- package/dist/chunks/studio-hf1rpcq0.js +0 -4
- package/dist/chunks/studio-hz02hq70.js +0 -5
- package/dist/chunks/studio-jsv3s3s1.js +0 -5
- package/dist/chunks/studio-ks7cksh0.js +0 -5
- package/dist/chunks/studio-nptx0dbs.js +0 -5
- package/dist/chunks/studio-pg0z7k98.js +0 -5
- package/dist/chunks/studio-pve0b2f2.js +0 -5
- package/dist/chunks/studio-q7zmjv3b.js +0 -6
- package/dist/chunks/studio-rpmvw7kj.js +0 -5
- package/dist/chunks/studio-rwhss52s.js +0 -5
- package/dist/chunks/studio-sbg3g3h0.js +0 -5
- package/dist/chunks/studio-sq1bn60g.js +0 -14
- package/dist/chunks/studio-vwz7rma2.js +0 -5
- package/dist/chunks/studio-wa55e8gf.js +0 -5
- package/dist/chunks/studio-x0mzdha2.js +0 -5
- package/dist/chunks/studio-xrgpakvc.js +0 -9
- package/dist/chunks/studio-xt3djk1w.js +0 -7
- package/dist/chunks/studio-yh3nggx1.js +0 -7
- package/dist/chunks/studio-zmecp6hq.js +0 -5
- package/dist/chunks/workspace-g6dvaete.js +0 -4
- package/dist/chunks/ws-client-shf41j5p.js +0 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Do,wm,u}from"./studio-27tc8q0h.js";import{y}from"./studio-w8w9frjy.js";import{D}from"./studio-153mwkyq.js";var im=["application","project","document","selection"],_T=["global","canvas","caret","grid","code","dock","palette"],CT=["File","Edit","Selection","Insert","View","Document","Project","Source Control","Publish","Assistant","Collaborate","Help"],d=["commandbar/primary","commandbar/overflow","statusbar/project","statusbar/document","statusbar/selection","context/element","context/file","context/layer","context/tab","context/pane","blockbar","blockbar/format","outline/row","settings/menu","palette","never"],m={"commandbar/primary":{admits:["application","document"],note:"document only for Save / Undo / Redo / Open in Browser, by frequency; ≤5 total"},"commandbar/overflow":{admits:["application","project","document"],note:"never selection — the Command Bar is not a selection surface"},"statusbar/project":{admits:["project"],note:"the status bar's left field"},"statusbar/document":{admits:["document"],note:"the status bar's centre field"},"statusbar/selection":{admits:["selection"],note:"the status bar's right field"},"context/element":{admits:["selection"],note:"the canvas element menu acts on a selection"},"context/file":{admits:["project"],note:"a file row addresses the project's file set"},"context/layer":{admits:["selection"],note:"an outline row IS a selection"},"context/tab":{admits:["document"],note:"a tab addresses one document"},"context/pane":{admits:["document"],note:"a pane hosts one document"},blockbar:{admits:["selection"],note:"the floating bar owns selection-scoped verbs"},"blockbar/format":{admits:["selection"],note:"the bar's inline-format cluster — a range inside the selection is still the selection"},"outline/row":{admits:["selection"],note:"row actions act on the row's node"},"settings/menu":{admits:["application","project"],note:"the rail foot's gear menu — the settings family. It is a MENU, not a pinned slot, so it "+"may host two levels for the reason commandbar/overflow does: a menu prints each row's own name, chord and gate, and draws a divider where the level changes. The rail's PINNED groups stay single-level, in PANEL_PLACEMENT_MATRIX"},palette:{admits:["application","project","document","selection"],note:"the level-agnostic surface; it groups rows by level"},never:{admits:["application","project","document","selection"],note:"keyboard- and API-only; no rendered surface to be misplaced in"}},p=["rail/project","rail/document","navigator","inspector","dock.bottom"],f={"rail/project":{admits:["project"],note:"the rail's upper group — Files, Search, Source Control, Problems"},"rail/document":{admits:["document"],note:"the rail's lower group — Outline, Page, Data, Packages"},navigator:{admits:["project","document"],note:"whichever level the hosted panel declares; the panel header prints it"},inspector:{admits:["selection"],note:"the Inspector's tabs are selection surfaces"},"dock.bottom":{admits:["project","document"],note:"the panel header states which"}};function g(e){return e==="bottom"?"dock.bottom":e}function P(e){let t=[g(e.dock)];if(e.rail!==!1)t.push(`rail/${e.level}`);return t}function v(e){return p.includes(e)}function r(e){let t=[];if(!i(e.level))return t.push({panelId:e.id,placement:"—",level:String(e.level),message:`declares unknown level "${String(e.level)}" (expected one of: ${im.join(", ")})`}),t;for(let n of P(e)){if(!v(n)){t.push({panelId:e.id,placement:n,level:e.level,message:`is level "${e.level}" and would render in "${n}", which is not a panel `+"placement — the rail has a group for project and one for document, and nothing else"});continue}let o=f[n];if(!o.admits.includes(e.level))t.push({panelId:e.id,placement:n,level:e.level,message:`is level "${e.level}" but "${n}" admits only ${o.admits.join(", ")} — ${o.note}`})}return t}function b(e){return d.includes(e)}function i(e){return im.includes(e)}function ST(e){let t=[];if(!i(e.level))return t.push({commandId:e.id,placement:"—",level:String(e.level),message:`declares unknown level "${String(e.level)}" (expected one of: ${im.join(", ")})`}),t;for(let n of e.menus??[]){if(!b(n)){t.push({commandId:e.id,placement:String(n),level:e.level,message:`declares unknown placement "${String(n)}"`});continue}let o=m[n];if(!o.admits.includes(e.level))t.push({commandId:e.id,placement:n,level:e.level,message:`is level "${e.level}" but "${n}" admits only ${o.admits.join(", ")} — ${o.note}`})}return t}function vd(){let e=wm();return e.project.open=D!==null,e.project.isMultilingual=(Do(D?.projectConfig??{}).i18n?.locales.length??0)>1,e.git.dirtyCount=y.git.status?.files?.length??0,e.document.open=u.value!==null,e}var h=/^[a-z][\w-]*$/,a=new Map;function Gn(e){if(!h.test(e.id))throw Error(`Panel id "${e.id}" is malformed — expected /^[a-z][\\w-]*$/, because the id is also `+`the region "navigator/panel:${e.id}" and the value view.setActivity accepts.`);if(a.has(e.id))throw Error(`Panel "${e.id}" is already registered — a second definition site is the defect this `+"registry exists to prevent.");let t=r({id:e.id,level:e.level,dock:e.dock,rail:e.rail});if(t.length>0){let n=t.map((o)=>` ✗ ${e.id} ${o.message}`).join(`
|
|
2
2
|
`);throw Error(`Panel "${e.id}" violates the level × placement matrix:
|
|
3
|
-
${n}`)}if(e.railLabel!==void 0&&(e.railLabel.trim()===""||!e.title.startsWith(e.railLabel)))throw Error(`Panel "${e.id}" declares railLabel "${e.railLabel}", which is not a leading part of its title "${e.title}": the rail button's accessible name is the title, and the words on screen must be inside it (WCAG 2.5.3, Label in Name).`);a.set(e.id,e)}function
|
|
4
|
-
export{
|
|
3
|
+
${n}`)}if(e.railLabel!==void 0&&(e.railLabel.trim()===""||!e.title.startsWith(e.railLabel)))throw Error(`Panel "${e.id}" declares railLabel "${e.railLabel}", which is not a leading part of its title "${e.title}": the rail button's accessible name is the title, and the words on screen must be inside it (WCAG 2.5.3, Label in Name).`);a.set(e.id,e)}function Du(e){return a.get(e)}function Rb(e){let t=[...a.values()];return e?t.filter((n)=>n.dock===e):t}function $b(e,t){return e.when?e.when(t):!0}var s=[{level:"project",label:"Project"},{level:"document",label:"Document"}];function c(){return Rb().filter((e)=>e.rail!==!1)}function q1(e){let t=c();return s.map(({level:n,label:o})=>({level:n,label:o,panels:t.filter((l)=>l.level===n&&$b(l,e))})).filter((n)=>n.panels.length>0)}function kT(){let e=c();return s.flatMap(({level:t})=>e.filter((n)=>n.level===t))}
|
|
4
|
+
export{im,_T,CT,ST,vd,Gn,Du,Rb,$b,q1,kT};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
7
|
-
//# sourceMappingURL=studio-
|
|
6
|
+
//# debugId=2F2674CE42F955BD64756E2164756E21
|
|
7
|
+
//# sourceMappingURL=studio-njmg0e73.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var e=new Map,r=new Set;function o(){for(let t of r)t()}function ja(){o()}function hb(t){return r.add(t),()=>{r.delete(t)}}function cs(t){e.set(t.key,t),o()}function _1(t){if(e.delete(t))o()}function qf(){return[...e.values()].toSorted((t,s)=>t.order-s.order)}function Tw(){return qf().map((t)=>t.key)}function Lw(t){return e.get(t)}var i=null,n="overview";function pb(){if(i!==null&&e.has(i))return n=i,i=null,n;if(e.has(n))return n;return Tw()[0]??n}function fb(t){if(e.has(t))n=t,i=null;else i=t;o()}export{ja,hb,cs,_1,qf,Tw,Lw,pb,fb};
|
|
2
|
+
|
|
3
|
+
//# debugId=B69FC474EC86204764756E2164756E21
|
|
4
|
+
//# sourceMappingURL=studio-nvykrgbj.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
function nt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ot(e){return nt(e)&&typeof e.$ref==="string"}function Za(e){return nt(e)&&e.$prototype==="Function"}function ba(e){return nt(e)&&nt(e.$expression)}function Ov(e){return ba(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function RS(e){return Za(e)&&Array.isArray(e.body)}function $S(e){return nt(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function DS(e){return nt(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Ux(e){return nt(e)&&e.$prototype==="Array"}function Ks(e){return typeof e==="string"&&e.includes("${")}function AS(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(e)}function ih(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function va(e,n){let t=e?.[n];return ih(t)?t:void 0}function oh(e,n){let t=e[n];if(ih(t))return t;let r={};return e[n]=r,r}function rh(e){return Ot(e)||Za(e)||ba(e)}function Mp(e,n){let t=e[n];return rh(t)?t:void 0}function Mv(e){if(!e)return[];return e.map((n)=>typeof n==="string"?n:n.name)}function jd(e){if(!nt(e)||!nt(e.$expression))return!1;let n=e.$expression;if(n.operator==="?:")return typeof n.value==="string"&&typeof n.initial==="string";if(n.operator==="switch")return nt(n.cases)&&Object.values(n.cases).every((t)=>typeof t==="string")&&typeof n.default==="string";return!1}function NS(e){if(typeof e==="string")return[e];if(!jd(e))return[];let n=e.$expression;if(n.operator==="?:")return[...new Set([n.value,n.initial])];return[...new Set([...Object.values(n.cases),n.default])]}function Ve(e){return typeof e==="string"?e:NS(e).join("|")}function Pp(e){return e.startsWith("#")}
|
|
2
|
+
export{nt,Ot,Za,ba,Ov,RS,$S,DS,Ux,Ks,AS,ih,va,oh,rh,Mp,Mv,jd,NS,Ve,Pp};
|
|
3
|
+
|
|
4
|
+
//# debugId=BCFC9EADE4D1518264756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-p6avneaq.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{p,We}from"./studio-6k1eswp9.js";import{ge,Q,re,S}from"./studio-0nm2skex.js";import{Je,Yi,Ju,jl}from"./studio-654fxcr0.js";import{SL,Te,ms,uv,q,js,Ji,Vu,pa,qe,Uu,on,ot,yv,yi,li,ke,Ao,JC,ro,je,An,g,u,Bn,Rr,Sp}from"./studio-27tc8q0h.js";import{Md,wi}from"./studio-ft8pfpp0.js";import{at,fm,xc}from"./studio-y164brht.js";import{BC,Rd}from"./studio-k9pwvmz8.js";import{$v,Dp,jm,Wl,Gr,ao,Kr,Gs,nh,Ya,Bm,EI,er,Fd,zm,ne}from"./studio-dknr8m7b.js";import{ga,gr,zs,Ws,gs}from"./studio-7w04zw8h.js";import{Ai,iL,qb,oL,ps,$l,Gb,rL,y,PC}from"./studio-w8w9frjy.js";import{gm,hp,bm}from"./studio-011em5cf.js";import{K,so,ht,_n,Xo,qa,D,Xu,Qu,Ni}from"./studio-153mwkyq.js";import{He,Iv}from"./studio-nw4q9sdn.js";import{Ve,Pp}from"./studio-p6avneaq.js";import{Bv}from"./studio-9n2j9nqk.js";function xt(e){let{target:t,source:n,targetOrigin:o,acceptOrigin:r,token:i}=e,s=new Set,a=(l)=>{if(r!=="*"&&l.origin!==r)return;let c=l.data;if(!c||typeof c!=="object"||c["jx:canvas"]!==i)return;for(let d of s)d(c.payload)};return n.addEventListener("message",a),{dispose(){s.clear(),n.removeEventListener("message",a)},onMessage(l){return s.add(l),()=>s.delete(l)},post(l){t.postMessage({["jx:canvas"]:i,payload:l},o)}}}var Qn=null;function Qw(){return Qn}function qo(){return Yi(g.activePaneId)}function st(e){let t=Bn(e),n=t?.derived,o=n?.kind==="lens"?Bn(n.sourcePaneId)?.activeTabId:t?.activeTabId;return o?g.tabs.get(o)??null:null}function Go(e){return Bn(e)?.derived??null}function Xw(e){if(!e)return[];let t=[];for(let n of g.panes)if(st(n.id)?.id===e.id)t.push(Yi(n.id));return t}function _(e){for(let t of Ju()){let n=t.panels.find((o)=>o.canvas===e);if(n)return{panel:n,surface:t}}return null}function wt(e){let t=e.canvas,n=t?_(t):null;return n?st(n.surface.paneId):null}function Tl(e){let t=e?.session.ui,n=t?.canvasMode??"design";return t?.preview&&(n==="edit"||n==="design")?"preview":n}function _o(e){let t=Go(e);if(t?.kind==="lens"){let n=t.mode;return st(e)?.session.ui?.preview&&(n==="edit"||n==="design")?"preview":n}return Tl(st(e))}function Au(e){let t=Go(e);if(t?.kind==="lens"&&t.preset==="breakpoint")return t.media;return st(e)?.session.ui.activeMedia??null}function Ab(e){return jl(e)?.paneId??An}function sm(e){return st(Ab(e))}var ce=new Set(["img","video","source","iframe","audio"]),ue="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",eo="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32'%3E%3Crect%20width='32'%20height='32'%20fill='%23d0d0d0'/%3E%3C/svg%3E",to=/(src|poster|image|bg|background|icon|logo|photo|avatar|thumbnail|cover|banner)$/i;function no(e){return to.test(e)}var oo=new Set(["p","h1","h2","h3","h4","h5","h6","blockquote","li","dt","dd","th","td","span","strong","em","small","mark","code","abbr","q","sub","sup","time","a","button","label","legend","caption","summary","pre","option"]),io=new Set(["div","section","article","aside","header","footer","main","nav","figure","figcaption","details","fieldset","form","ul","ol","dl","table"]);function lo(e){if(!e.tagName||e.textContent||e.innerHTML)return null;if(e.$__layout)return null;if(Array.isArray(e.children)&&e.children.length>0)return null;if(oo.has(Ve(e.tagName)))return"empty-text-placeholder";if(io.has(Ve(e.tagName)))return"empty-container-placeholder";return null}function De(e){return e.replaceAll(/\$\{([^}]+)\}/g,"❪ $1 ❫")}function co(e){let t=e.map;return{children:t&&typeof t==="object"?[A(t)]:[],className:"repeater-perimeter",tagName:"div"}}function A(e){if(!e||typeof e!=="object")return e;if(Array.isArray(e))return e.map((s)=>A(s));if(e.$prototype==="Array")return co(e);let t=e,n={},o=!1,r=ce.has(t.tagName||"");if(r){let{attributes:s,src:a}=t,l=s?.src,c=t.poster,d=s?.poster;if(!(a&&a!==""||l&&l!=="")&&!(c&&c!==""||d&&d!==""))o=!0}for(let[s,a]of Object.entries(t))if(s==="state"||s==="$media"||s==="$elements")n[s]=a;else if(s==="$props"&&a&&typeof a==="object"){let l={};for(let[c,d]of Object.entries(a))if(typeof d==="string"&&d.includes("${"))if(no(c))l[c]=eo;else if(c==="href"||c==="action")l[c]="";else l[c]=De(d);else if(d&&typeof d==="object"&&d.$ref){let f=d.$ref,m=f.startsWith("#/state/")?f.slice(8):f;l[c]=`{${m}}`}else l[c]=d;n[s]=l}else if(s==="children")if(Array.isArray(a))n.children=a.map((l)=>A(l));else if(a&&typeof a==="object"&&a.$prototype==="Array")n.children=[A(a)];else n.children=A(a);else if(s==="cases"&&t.$switch&&a&&typeof a==="object"){let l=Object.keys(a);if(l.length>0){let c=a[l[0]];n.children=c&&typeof c==="object"&&!c.$ref?[A(c)]:[{style:{background:"color-mix(in srgb, var(--danger) 8%, transparent)",border:"1px dashed color-mix(in srgb, var(--danger) 40%, transparent)",borderRadius:"4px",color:"var(--danger)",fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', monospace",fontSize:"11px",fontStyle:"italic",padding:"6px 10px"},tagName:"div",textContent:`[$switch: ${l.join(" | ")}]`}]}}else if(s==="attributes"&&r&&a&&typeof a==="object"){let l=a,c={};for(let[d,f]of Object.entries(l))if(d==="src"||d==="poster")if(typeof f==="string"&&f!==""&&!f.includes("${"))c[d]=f;else o=!0,c[d]=ue;else if(typeof f==="string"&&f.includes("${")){let m=d==="href"||d==="action";c[d]=m?"":De(f)}else if(f&&typeof f==="object"&&f.$ref){let m=f.$ref,b=m.startsWith("#/state/")?m.slice(8):m;c[d]=`{${b}}`}else c[d]=f;n.attributes=c}else if(s==="style")if(a&&typeof a==="object"){let l={};for(let[c,d]of Object.entries(a))if(typeof d!=="string"||!d.includes("${"))l[c]=d;n.style=l}else n.style=a;else if(typeof a==="string"&&a.includes("${"))if((s==="src"||s==="poster")&&ce.has(t.tagName||""))o=!0,n[s]=ue;else{let c=s==="src"||s==="href"||s==="poster"||s==="action";n[s]=c?"":De(a)}else if(a&&typeof a==="object"&&a.$ref){let l=a.$ref,c=l.startsWith("#/state/")?l.slice(8):l;if((s==="src"||s==="poster")&&ce.has(t.tagName||""))o=!0,n[s]=ue;else n[s]=`{${c}}`}else if((s==="src"||s==="poster")&&a===""&&ce.has(t.tagName||""))o=!0,n[s]=ue;else n[s]=A(a);let i=lo(n);if(i)n.className=n.className?`${n.className} ${i}`:i;if(o){let s=n.className||"";if(!s.includes("empty-media-placeholder"))n.className=s?`${s} empty-media-placeholder`:"empty-media-placeholder"}return n}var uo=/\[\.\.\.(\w+)\]|\[(\w+)\]/g;function po(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function Ct(e){let t=po(e),n=t.slice(t.lastIndexOf("/")+1),o=n.lastIndexOf(".");if(o>0)t=t.slice(0,t.length-(n.length-o));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let r=[],i=!1,s=!1,a=t.replaceAll(uo,(l,c,d)=>{if(i=!0,c)return s=!0,r.push(c),"*";return r.push(d),`:${d}`});return{isCatchAll:s,isDynamic:i,params:r,urlPattern:a}}function Nb(e){if(!e)return"/";return Ct(e).urlPattern}function Ll(e){if(!e)return[];return Ct(e).params}function TT(e){let t=e.document?.$paths,n=e.frontmatter?.$paths;return t??n??null}var pe=new Map;function LT(){pe.clear()}function IT(e,t){if(!t)return Promise.resolve({});let n=`${e??""}::${JSON.stringify(t)}`,o=pe.get(n);if(!o)o=fo(t).catch((r)=>(pe.delete(n),console.warn("page-params: failed to enumerate $paths values:",r),{})),pe.set(n,o);return o}async function fo(e){if(Array.isArray(e)){let t={};for(let n of e)for(let[o,r]of Object.entries(n))de(t,o,r);return t}if("contentType"in e&&typeof e.contentType==="string"&&e.contentType){let t=e.param??"slug",n=e.field??"id",o=await ho(e.contentType),r={[t]:[]};if(!Array.isArray(o))return r;for(let i of o)de(r,t,n==="id"?i.id:i.data?.[n]??i.id);return r}if("values"in e&&Array.isArray(e.values)){let t=e.param??"value",n={[t]:[]};for(let o of e.values)de(n,t,o);return n}if("$ref"in e&&typeof e.$ref==="string"&&e.$ref){let t=e.param??"id",n=e.field??"id",o=await p().readFile(e.$ref.replace(/^\.\//,"")),r=JSON.parse(o),i={[t]:[]};if(!Array.isArray(r))return i;for(let s of r)de(i,t,s?.[n]??s?.id??s);return i}return{}}async function mo(){let e=await Md();for(let t of e){let n=t.classes?.find((o)=>o.name==="ContentCollection");if(n)return n.path}return"@jxsuite/parser/ContentCollection.class.json"}async function ho(e){let t={$prototype:"ContentCollection",$src:await mo(),contentType:e},n=p();if(n.resolveClass)return n.resolveClass(t);return fetch("/__jx_resolve__",{body:JSON.stringify(t),headers:{"content-type":"application/json"},method:"POST"}).then((o)=>{if(!o.ok)throw Error(`Class resolution failed: ${o.status}`);return o.json()})}function de(e,t,n){if(n===null||n===void 0||n==="")return;let o=String(n);e[t]??=[];let r=e[t];if(!r.includes(o))r.push(o)}function Pt(e,t,n){if(Object.keys(t).length===0)return e;let o=Le(e,t);return o.state??={},o.state.$page={params:{...t},title:typeof o.title==="string"?o.title:"",url:Nb(n)},o}function St(e){if(!e)return[];return Object.keys(e).filter((t)=>{let n=e[t];return n&&typeof n==="object"&&typeof n.$prototype==="string"&&typeof n.$src==="string"&&JSON.stringify(n).includes('"#/$params/')})}async function Et(e,t,n){if(t.length===0)return;let o=p();if(!o.resolveClass)return;let{state:r}=e;if(!r)return;await Promise.all(t.map(async(i)=>{let s=r[i];if(!s||typeof s!=="object")return;try{r[i]=await o.resolveClass({...s,...n?{$base:n}:{}})}catch(a){console.warn(`page-params: failed to resolve state.${i} for preview:`,a)}}))}function Le(e,t){let n=go(e,t);if(n!==null)return n;if(!e||typeof e!=="object")return e;if(Array.isArray(e))return e.map((r)=>Le(r,t));let o={};for(let[r,i]of Object.entries(e))o[r]=Le(i,t);return o}function go(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return null;let n=e.$ref;if(typeof n!=="string"||!n.startsWith("#/$params/"))return null;return t[n.slice(10)]??null}function ex(e){return typeof e?.tagName==="string"&&e.tagName.includes("-")}function Tt(e){if(e===null||typeof e==="number"||typeof e==="boolean")return"literal";if(typeof e==="string")return e.includes("${")?null:"literal";if(Array.isArray(e))return"literal";if(typeof e==="object"){let t=e;if(t.$expression||t.$compute||t.$prototype||t.$handler)return null;return"default"in t||"type"in t?"signal":"literal"}return null}function RT(e){let t=e?.state??{},n=[];for(let[o,r]of Object.entries(t)){if(Pp(o))continue;let i=Tt(r);if(!i)continue;let s=i==="signal"?r.default:r;n.push({name:o,value:s})}return n}function Mt(e,t){let n={...e.state??{}},o=!1;for(let[r,i]of Object.entries(t)){let s=Tt(n[r]);if(!s)continue;n[r]=s==="signal"?{...n[r],default:i}:i,o=!0}if(!o)return e;return{...e,state:n}}function Nt(e,t=[]){if(!e||typeof e!=="object")return null;if(Array.isArray(e.children)){let n=e.children.findIndex((o)=>o&&typeof o==="object"&&!o.$__layout);if(n!==-1)return{offset:n,prefix:[...t,"children"]};for(let o=0;o<e.children.length;o++){let r=e.children[o];if(r&&typeof r==="object"&&r.$__layout){let i=Nt(r,[...t,"children",o]);if(i)return i}}}return null}function _e(e,t,n=[]){if(!e||typeof e!=="object")return;if(e.$__layout={file:t,path:n},Array.isArray(e.children))for(let[o,r]of e.children.entries()){if(typeof r==="string")continue;_e(r,t,[...n,"children",o])}if(Array.isArray(e.$elements)){for(let[o,r]of e.$elements.entries())if(typeof r!=="string")_e(r,t,[...n,"$elements",o])}}async function kt(e,t,n=null){let o={documentPath:t?.documentPath,mode:t?.doc.mode},r=n??Tl(t),i=r==="preview"?structuredClone(re(e)):A(Xu(e)),s=!1,a=o.documentPath&&D?.isSiteProject&&(o.documentPath.startsWith("pages/")||o.documentPath.startsWith("./pages/")),l=null,c=0;if(a&&t?.session.ui.showLayout!==!1){let w=$l(e.$layout);if(w){let v=await Gb(w);if(v){_e(v,w.replace(/^\.\//,""));let C=r==="preview"?structuredClone(re(e)):i,x=rL(v,C);i=r==="preview"?x:A(Xu(x)),s=!0;let T=Nt(x);l=T?.prefix??null,c=T?.offset??0}}}let d=hp(D?.projectRoot),f=o.documentPath?new URL(o.documentPath,d).href:void 0,m=bm(o.documentPath,{fileBaseUrl:d,...We()?{space:p().assetSpace}:{}});if(a&&t){let{previewParams:w}=t.session.ui;if(w&&Object.keys(w).length>0){let v=St(e.state??null);i=Pt(i,w,o.documentPath),await Et(i,v,f)}}if(!a&&t&&ex(i)){let{previewProps:w}=t.session.ui;if(w&&Object.keys(w).length>0)i=Mt(i,w)}let b=new Set;if(r!=="preview")(function w(v,C){if(!v||typeof v!=="object")return;if(v.$prototype==="Array"){b.add(C.join("/"));let x=v.map;if(x&&typeof x==="object")w(x,[...C,"map"]);return}if(Array.isArray(v.children))for(let x=0;x<v.children.length;x++){let T=v.children[x];if(typeof T==="string")continue;w(T,[...C,"children",x])}else if(v.children&&typeof v.children==="object"&&v.children.$prototype==="Array")w(v.children,[...C,"children"]);if(v.$switch&&v.cases)for(let[x,T]of Object.entries(v.cases))w(T,[...C,"cases",x])})(e,[]);let M=o.documentPath!=null&&(o.documentPath.startsWith("layouts/")||o.documentPath.startsWith("./layouts/")),R=qb(i.$elements);if((o.mode==="content"||s||M)&&at.length>0){let w=new Set(R.map((C)=>typeof C==="string"?C:C?.$ref)),v=(C)=>{let x=new Set;if(!C||typeof C!=="object")return x;if(C.tagName)x.add(Ve(C.tagName));if(Array.isArray(C.children)){for(let T of C.children)if(typeof T!=="string")for(let Yn of v(T))x.add(Yn)}return x};for(let C of v(i)){let x=at.find((T)=>T.tagName===C);if(x&&x.source!=="npm"&&x.path){let T=xc(o.documentPath??null,x.path);if(!w.has(T))R.push({$ref:T}),w.add(T)}}}if(R.length>0)i.$elements=R;i.imports=iL(i.imports);let O=Ai(i.$media);if(O===void 0)delete i.$media;else i.$media=O;let U=oL(i.$head);if(U===void 0)delete i.$head;else i.$head=U;return{assets:m,docBase:f,mapperCtx:{arrayPaths:[...b],canvasMode:r,layoutWrapped:s,pageContentOffset:c,pageContentPrefix:l},renderDoc:i,siteStyle:D?.projectConfig?.style??null}}var $T="fullRender",DT="mountCanvas",AT="patchBatch",At="prepareRender",Co={derivedResolves:0,derivedRetargets:0,escalations:0,fullRenders:0,hostRenderPosts:0,lastEscalationReason:"",lastFullRenderMs:0,p95FullRenderMs:0,panelRenders:0,patchedOps:0,renderPreparations:0,skippedFullRenders:0,timings:{}};globalThis.__jxCanvasPerf=Co;var Rt=new Map;function $t(){try{return typeof localStorage<"u"&&Boolean(localStorage.getItem("jx-canvas-debug"))}catch{return!1}}function Ot(){return typeof performance<"u"&&typeof performance.now==="function"?performance.now():0}function It(e,t){if($t())console.debug(`[jx-canvas] ${e}`,t??"")}function Ob(e){Co.escalations+=1,Co.lastEscalationReason=e,It("escalation",e)}function vo(e){if(e.length===0)return 0;let t=e.toSorted((o,r)=>o-r),n=Math.min(t.length-1,Math.ceil(t.length*0.95)-1);return t[Math.max(0,n)]??0}function yo(e,t){let n=Number.isFinite(t)&&t>0?t:0,o=Rt.get(e);if(!o)o=[],Rt.set(e,o);if(o.push(n),o.length>128)o.shift();let r=Co.timings[e],i={count:(r?.count??0)+1,lastMs:n,maxMs:Math.max(r?.maxMs??0,n),p95Ms:vo(o),totalMs:(r?.totalMs??0)+n};if(Co.timings[e]=i,e==="fullRender")Co.lastFullRenderMs=i.lastMs,Co.p95FullRenderMs=i.p95Ms;It(`span:${e}`,`${n.toFixed(2)}ms`)}function Dt(e){let t=Ot(),n=$t(),o=`jx-${e}-start`;if(n)try{performance.mark(o)}catch{}let r=!1;return()=>{if(r)return Co.timings[e]?.lastMs??0;r=!0;let i=Ot()-t;if(n)try{performance.measure(`jx-${e}`,o),performance.clearMarks(o)}catch{}return yo(e,i),i}}function tx(e,t){let n=Dt(e);try{return t()}finally{n()}}async function nx(e,t){let n=Dt(e);try{return await t()}finally{n()}}function bi(e){if(e==="--")return"Base";return e.replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(t)=>t.toUpperCase())||e}var Ht=new Set(["script","style","link","iframe","object","embed"]);function yd(e){let t={tagName:e};if(/^h[1-6]$/.test(e))t.textContent="Heading";else if(e==="p")t.textContent="Paragraph text";else if(e==="span"||e==="strong"||e==="em"||e==="small"||e==="mark"||e==="code"||e==="abbr"||e==="q"||e==="sub"||e==="sup"||e==="time")t.textContent="Text";else if(e==="a")t.textContent="Link",t.attributes={href:"#"};else if(e==="button")t.textContent="Button";else if(e==="label")t.textContent="Label";else if(e==="legend")t.textContent="Legend";else if(e==="caption")t.textContent="Caption";else if(e==="summary")t.textContent="Summary";else if(e==="li"||e==="dt"||e==="dd"||e==="th"||e==="td"||e==="option")t.textContent="Item";else if(e==="blockquote")t.textContent="Quote";else if(e==="pre")t.textContent="Preformatted text";else if(e==="input")t.attributes={placeholder:"Enter text...",type:"text"};else if(e==="img")t.attributes={alt:"Image"};else if(e==="iframe")t.attributes={src:""};else if(e==="slot")t.children=[{tagName:"p",textContent:"Slot content"}];else if(e==="select")t.children=[{tagName:"option",textContent:"Option 1"}];else if(e==="ul"||e==="ol")t.children=[{tagName:"li",textContent:"Item"}];else if(e==="dl")t.children=[{tagName:"dt",textContent:"Term"},{tagName:"dd",textContent:"Definition"}];else if(e==="table")t.children=[{children:[{children:[{tagName:"th",textContent:"Header"}],tagName:"tr"}],tagName:"thead"},{children:[{children:[{tagName:"td",textContent:"Cell"}],tagName:"tr"}],tagName:"tbody"}];else if(e==="details")t.children=[{tagName:"summary",textContent:"Summary"},{tagName:"p",textContent:"Detail content"}];return t}function j(e){if(!e)return[];if(Array.isArray(e.children))return e.children;return typeof e.textContent==="string"&&e.textContent.length>0?[e.textContent]:[]}function Y(e){let t=0;for(let n of e)t+=typeof n==="string"?n.length:Y(j(n));return t}function Fe(e,t,n){let o=[],r=0;for(let i of e){if(r>=n)break;if(typeof i==="string"){let c=r+i.length;if(c>t){let d=i.slice(Math.max(0,t-r),Math.max(0,Math.min(n,c)-r));if(d)o.push(d)}r=c;continue}let s=j(i),a=Y(s),l=r+a;if(a===0){if(r>=t&&r<n)o.push({...i})}else if(l>t){let c=Fe(s,Math.max(0,t-r),Math.min(n,l)-r);if(c.length>0)o.push(bo(i,c))}r=l}return o}function bo(e,t){let{children:n,textContent:o,...r}=e;if(t.length===0)return{...r,textContent:""};if(t.length===1&&typeof t[0]==="string")return{...r,textContent:t[0]};return{...r,children:t}}function Jt(e){let t=[];for(let n of e){if(typeof n==="string"){if(n.length===0)continue;let o=t.at(-1);if(typeof o==="string"){t[t.length-1]=o+n;continue}}t.push(n)}return t}function Lt(e,t,n,o,r=""){return Jt([...Fe(e,0,t),...r?[r]:[],...Fe(n,o,Y(n))])}function Be(e){let t=Jt(e);if(t.length===0)return{textContent:""};if(t.length===1&&typeof t[0]==="string")return{textContent:t[0]};return{children:t}}function xo(e){if(!e)return!0;if(e.textContent!=null&&e.textContent.trim()==="")return!0;let t=e.children;if(!t)return!1;if(t.length===0)return!0;if(t.length===1&&typeof t[0]==="string"&&t[0].trim()==="")return!0;return t.length===1&&typeof t[0]==="object"&&t[0]?.tagName==="br"}function _t(e,t,n,o,r={}){if(!e)return;let i=K(e.doc.document,t);if(n){if(i&&JSON.stringify(i.children)===JSON.stringify(n))return;q(e,(s)=>{if(i?.textContent!=null)qe(s,t,"textContent");qe(s,t,"children",n)},{coalesceKey:r.coalesceKey??null})}else if(o!=null){if(i&&i.textContent===o&&!i.children)return;q(e,(s)=>{if(i?.children)qe(s,t,"children");qe(s,t,"textContent",o)},{coalesceKey:r.coalesceKey??null})}}function jt(e,t,n,o){if(!e)return!1;let r=K(e.doc.document,t);if(!r)return!1;if(`${r.$props?.[n]??""}`===o)return!1;return q(e,(s)=>{Uu(s,t,n,o)}),!0}function qt(e,t,n){if(!e)return null;let o=K(e.doc.document,t),r=K(e.doc.document,n);if(!o||!r)return null;if(qa(t,n)||qa(n,t))return null;let i=j(r),s=j(o),a=Y(i),l=Be([...i,...s]);return q(e,(c)=>{if(l.children){if(r.textContent!=null)qe(c,n,"textContent");qe(c,n,"children",l.children)}else{if(r.children)qe(c,n,"children");qe(c,n,"textContent",l.textContent??"")}if(Vu(c,t),Ft(c,ht(t)),Sp(e))c.session.selection=[n]}),{offset:a,path:n}}function Ft(e,t){let n=t;while(n.length>0){let o=K(e.doc.document,n),r=o?.children;if(!o||!Array.isArray(r)||r.length>0)return;let i=ht(n);if(Vu(e,n),!i)return;n=i}}function Wt(e,t,n,o){let r=ht(t),i=_n(t),s=[...r,"children",i+1];if(!e)return s;let a={tagName:"p"};if(o.textContent!=null)a.textContent=o.textContent;else if(o.children)a.children=o.children;else a.textContent="";return q(e,(l)=>{if(n.textContent!=null)qe(l,t,"children"),qe(l,t,"textContent",n.textContent);else if(n.children)qe(l,t,"textContent"),qe(l,t,"children",n.children);if(Ji(l,r,i+1,a),Sp(e))l.session.selection=[s]}),s}function Vt(e,t,n,o){if(xo(o)){if(!e)return t;return q(e,(l)=>{qe(l,t,"tagName",n.tag),qe(l,t,"children");let c=yd(n.tag);if(c.textContent&&c.textContent!=="Paragraph text")qe(l,t,"textContent",c.textContent);else qe(l,t,"textContent");if(Sp(e))l.session.selection=[t]}),t}let r=ht(t),i=_n(t),s=[...r,"children",i+1];if(!e)return s;let a=yd(n.tag);return q(e,(l)=>{if(o?.children)qe(l,t,"textContent"),qe(l,t,"children",o.children);else if(o?.textContent!=null)qe(l,t,"children"),qe(l,t,"textContent",o.textContent);if(Ji(l,r,i+1,structuredClone(a)),Sp(e))l.session.selection=[s]}),s}function Bt(e,t,n,o,r){if(!e)return null;let i=K(e.doc.document,t.path),s=K(e.doc.document,n.path);if(!i||!s)return null;if(qa(t.path,n.path)||qa(n.path,t.path))return null;let a=Be(Lt(j(i),t.offset,j(s),n.offset,r)),l=[...o,n.path].toSorted(wo);return q(e,(c)=>{if(a.children){if(i.textContent!=null)qe(c,t.path,"textContent");qe(c,t.path,"children",a.children)}else{if(i.children)qe(c,t.path,"children");qe(c,t.path,"textContent",a.textContent??"")}for(let d of l)if(K(c.doc.document,d))Vu(c,d),Ft(c,ht(d));if(Sp(e))c.session.selection=[t.path]}),{offset:t.offset+r.length,path:t.path}}function wo(e,t){let n=Math.min(e.length,t.length);for(let o=0;o<n;o++){let r=e[o],i=t[o];if(r===i)continue;if(typeof r==="number"&&typeof i==="number")return i-r;return String(i).localeCompare(String(r))}return t.length-e.length}function N(e,t=1){return{height:e.height*t,left:e.x*t,top:e.y*t,width:e.width*t}}function NT(e,t,n=1){return{x:(e.x-t.left)/n,y:(e.y-t.top)/n}}function fe(e,t){if(!t){e.style.display="none";return}e.style.display="block",e.style.left=`${t.left}px`,e.style.top=`${t.top}px`,e.style.width=`${t.width}px`,e.style.height=`${t.height}px`}function zt(e=document){let t=e.createElement("div");t.className="jx-canvas-iframe-overlay",t.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:2";let n=e.createElement("div");n.className="overlay-box overlay-selection",n.style.display="none";let o=e.createElement("div");o.className="overlay-label",o.style.display="none",n.append(o);let r=e.createElement("div");r.className="overlay-box overlay-hover",r.style.display="none";let i=e.createElement("div");i.className="canvas-drop-indicator",i.style.display="none";let s=e.createElement("button");s.className="insertion-helper",s.textContent="+",s.style.pointerEvents="auto",s.style.display="none";let a=e.createElement("div");a.className="canvas-replace-target",a.style.display="none";let l=e.createElement("div");l.className="overlay-presence-group";let c=e.createElement("div");return c.className="overlay-coselection-group",t.append(r,n,c,i,a,s,l),{dispose:()=>t.remove(),insertButton:s,root:t,setDropIndicator:(d,f="inside")=>So(i,d,f),setHover:(d)=>fe(r,d),setInsertZone:(d,f="center")=>Po(s,d,f),setReplaceTarget:(d)=>fe(a,d),setSuppressed:(d)=>{t.style.display=d?"none":""},setCoSelection:(d)=>{c.replaceChildren();for(let f of d){let m=e.createElement("div");m.className="overlay-box overlay-selection overlay-coselection",fe(m,f),c.append(m)}},setPresence:(d)=>{l.replaceChildren();for(let f of d){let m=e.createElement("div");m.className="overlay-box overlay-presence",m.style.cssText=`position:absolute;display:block;pointer-events:none;outline:1.5px solid ${f.color};outline-offset:1px;left:${f.placement.left}px;top:${f.placement.top}px;width:${f.placement.width}px;height:${f.placement.height}px`;let b=e.createElement("div");b.className="overlay-presence-tag",b.textContent=f.label,b.style.cssText=`position:absolute;top:-18px;left:-2px;padding:1px 5px;border-radius:3px;font:10px/1.4 sans-serif;color:#fff;white-space:nowrap;background:${f.color}`,m.append(b),l.append(m)}},setSelection:(d,f=null)=>{if(fe(n,d),d&&f)o.textContent=f,o.style.display="block";else o.style.display="none"}}}function Po(e,t,n){if(!t){e.style.display="none",e.classList.remove("visible");return}e.dataset.edge=n,e.classList.add("visible"),e.style.display="grid",e.style.left=`${t.left+t.width/2}px`,e.style.top=`${t.top+t.height/2}px`,e.style.translate="-50% -50%"}function So(e,t,n){if(!t){e.style.display="none";return}if(e.style.display="block",e.style.left=`${t.left}px`,e.style.width=`${t.width}px`,n==="inside"){e.className="canvas-drop-indicator inside",e.style.top=`${t.top}px`,e.style.height=`${t.height}px`;return}e.className="canvas-drop-indicator line",e.style.height="",e.style.top=`${n==="top"?t.top:t.top+t.height}px`}function Il(e){return JSON.stringify(e)}var wd={$id:"elements-meta",title:"HTML Element Metadata",description:"Inline scoping and inline toolbar action metadata for HTML elements.",$convertGroups:{text:["p","h1","h2","h3","h4","h5","h6","blockquote"],container:["div","section","article","aside","main","header","footer","nav","search"],list:["ul","ol"]},$defs:{p:{$convertTo:"text",$convertToWhenEmpty:["text","container"],$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"u",label:"Underline",command:"underline"},{tag:"del",label:"Strikethrough",command:"strikethrough"},{tag:"sup",label:"Superscript",command:"superscript"},{tag:"sub",label:"Subscript",command:"subscript"},{tag:"code",label:"Code",command:"code"},{tag:"a",label:"Link",command:"link"}]},h1:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"code",label:"Code",command:"code"},{tag:"a",label:"Link",command:"link"}]},h2:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h3:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h4:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h5:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h6:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},li:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},td:{$inlineChildren:["em","strong","del","code","a","span","br","b","i","u","sub","sup","s"],$inlineActions:"p"},th:{$inlineChildren:["em","strong","del","code","a","span","br","b","i","u","sub","sup","s"],$inlineActions:"p"},blockquote:{$convertTo:"text",$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},figcaption:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},caption:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},summary:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},dt:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},dd:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},label:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},a:{$inlineChildren:["em","strong","code","span","br","b","i","u","sub","sup"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"code",label:"Code",command:"code"}]},span:{$inlineChildren:["em","strong","del","code","a","br","b","i","u","sub","sup","s"],$inlineActions:"p"},div:{$convertTo:"container",$convertToWhenEmpty:["container","text"],$inlineChildren:[]},section:{$convertTo:"container",$inlineChildren:[]},article:{$convertTo:"container",$inlineChildren:[]},nav:{$convertTo:"container",$inlineChildren:[]},main:{$convertTo:"container",$inlineChildren:[]},header:{$convertTo:"container",$inlineChildren:[]},footer:{$convertTo:"container",$inlineChildren:[]},aside:{$convertTo:"container",$inlineChildren:[]},ul:{$convertTo:"list",$inlineChildren:[]},ol:{$convertTo:"list",$inlineChildren:[]},pre:{$inlineChildren:["code"]},table:{$inlineChildren:[]},thead:{$inlineChildren:[]},tbody:{$inlineChildren:[]},tr:{$inlineChildren:[]}}};var To=new Set(["pre"]),na=new Set(Object.entries(wd.$defs).filter(([e,t])=>!To.has(e)&&(t.$inlineChildren?.length??0)>0).map(([e])=>e));var Kt=new Set(["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"]);function ze(e,t){if(!t)return Kt.has(e);let n=wd.$defs[t];if(!n||!n.$inlineChildren)return!1;return n.$inlineChildren.includes(e)}function OT(e){let t=wd.$defs[e];if(!t)return null;let n=t.$inlineActions;if(typeof n==="string")n=wd.$defs[n]?.$inlineActions??void 0;if(!Array.isArray(n))return null;return n}var Mo=null;function ix(e,t){if(!e||typeof e!=="object")return!1;let n=(Ve(e.tagName)||"div").toLowerCase();if(t){let o=(Ve(t.tagName)||"div").toLowerCase();return ze(n,o)}return Kt.has(n)}function MT(){return Mo!==null}function me(e){return!e||e==="base"?null:e}function Mb(e){let t=e.panels;if(t.length===0)return null;if(t.length===1)return t[0];let n=Au(e.paneId);for(let o of t){if(n===null&&(o.mediaName==="base"||o.mediaName===null))return o;if(o.mediaName===n)return o}return t[0]}function Ut(){return Mb(qo())}function PT(e,t){if(!e)return t;let n=t;while(n.length>=2){let o=K(e,n),r=ht(n),i=r?K(e,r):null;if(!o||!i)break;let s=(Ve(o.tagName)||"div").toLowerCase(),a=(Ve(i.tagName)||"div").toLowerCase();if(!ze(s,a))break;n=r}return n}function Pb(e){return $v(e)!==null}function Nu(e){return $v(e)}function hr(e){if(!e)return{baseWidth:320,featureQueries:[],sizeBreakpoints:[]};let t=[],n=[],o=320;for(let[r,i]of Object.entries(e)){if(r==="--"){let l=String(i).match(/^(\d+)\s*px$/);o=l?Number(l[1]):320;continue}let s=i.match(/min-width:\s*([\d.]+)px/),a=i.match(/max-width:\s*([\d.]+)px/);if(s)n.push({name:r,query:i,type:"min",width:Number(s[1])});else if(a)n.push({name:r,query:i,type:"max",width:Number(a[1])});else t.push({name:r,query:i})}return n.sort((r,i)=>r.type==="min"?r.width-i.width:i.width-r.width),{baseWidth:o,featureQueries:t,sizeBreakpoints:n}}function No(e,t){let n=new Set;for(let o of e)if(o.type==="min"&&t>=o.width)n.add(o.name);else if(o.type==="max"&&t<=o.width)n.add(o.name);return n}function Gt(e,t){let n=No(e,t),o=null;for(let r of e){if(!n.has(r.name))continue;let i=Math.abs(r.width-t);if(o===null){o=r;continue}let s=Math.abs(o.width-t);if(i<s||i===s&&r.width<o.width)o=r}return o?.name??null}function FT(e,t,n=8){let o=null;for(let r of t){let i=Math.abs(r-e);if(i>n)continue;if(o===null||i<Math.abs(o-e))o=r}return o??e}var cp=240,jT=8,HT=16,he=new Map;function Ke(e){return hr(Ai(e.doc.document?.$media))}function ox(e){let{baseWidth:t,sizeBreakpoints:n}=Ke(e),o=e.session.ui.activeMedia;return n.find((r)=>r.name===o)?.width??t}function ko(e,t){let n=he.get(e);if(!n)return null;if(!t||n.tabId!==t.id||n.media!==t.session.ui.activeMedia)return he.delete(e),null;return n.width}function BT(e,t){let n=t?ox(t):0;return ko(e.paneId,t)??n}function rx(e){he.delete(e)}function zT(e){let{baseWidth:t,sizeBreakpoints:n}=Ke(e);return[t,...n.map((o)=>o.width)]}function sx(e,t,n){let{sizeBreakpoints:o}=Ke(t),r=Gt(o,n);return t.session.ui.activeMedia=r,he.set(e,{media:r,tabId:t.id,width:n}),r}var Ue={invokerTags:zm,popoverTags:Fd};function J1(e,t){if(!e||!t)return null;for(let n=t.length;n>=0;n-=1){let o=t.slice(0,n),r=K(e,o);if(r&&typeof r==="object"&&Gs(r,Ue))return o}return null}function Zt(e,t){let n=e.doc.document;if(!n)return null;if(t){let o=K(n,t);return o&&typeof o==="object"&&Gs(o,Ue)?t:null}return J1(n,Te(e.session.selection))}function Xt(){let e=u.value?.doc.document;return e?EI(e,Ue):!1}var Yt=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],Ge=new Set(["show-modal","close","request-close"]),Ze=new Set(["toggle-popover","show-popover","hide-popover"]),Ro=["any","closerequest","none"],Oo=new Set(["button"]),I="See docs/framework/concepts/overlays.";function H(e){return ao(e)==="dialog"}function Qt(e){return e.startsWith("--")}function $o(e){let t=[];for(let{node:n}of Ya(e)){let o=nh(n);if(H(n)&&o!==null&&!t.includes(o))t.push(o)}return t}function en(e){for(let{node:t}of Ya(e))if(H(t))return!0;return!1}function Io(e){let t=e.oncommand;return t!==void 0&&t!==null}function Do(e,t){for(let{node:n}of Ya(e)){if(n===e)continue;let o=ao(n);if(o==="button"){let r=Gr(n,"command"),i=Gr(n,"commandfor");if(r!==null&&(r==="close"||r==="request-close")&&(i===null||i===t))return!0}if(o==="form"&&Gr(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function ET(e,t){let n=[...Ya(e,[],null,t)],o=$o(e),r=Bm(e,t),i=o.length>0||r.length>0,s=new Map,a=new Map;for(let{node:c}of n){let d=nh(c);if(d!==null&&!s.has(d))s.set(d,c);if(ao(c)==="button"){let f=Gr(c,"commandfor"),m=Gr(c,"command");if(f!==null){let b=a.get(f)??new Set;b.add(m??""),a.set(f,b)}}}let l=[];for(let{node:c,path:d}of n)if(l.push(...Ho(c,d,s,o,r,i,t)),H(c))l.push(...Jo(c,d,a));return l}function Ho(e,t,n,o,r,i,s){let a=[],l=ao(e),c=s?.invokerTags?.has(l)??!1,d=Gr(e,"command"),f=Gr(e,"commandfor");if(!(d!==null||f!==null||("command"in Wl(e))||("commandfor"in Wl(e))))return a;let b=Kr(e,"the element");if(!Oo.has(l)&&!c)return a.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${I}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(d!==null&&!Yt.includes(d)&&!Qt(d))return a.push({detail:`\`command\` is an enumerated attribute taking ${Yt.map((M)=>`\`${M}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${I}`,message:`${b} declares command="${d}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(f!==null){let M=n.get(f),R=o.includes(f),O=r.includes(f);if(!M&&i){let U=[...o,...r].map((w)=>`"${w}"`).join(", ");return a.push({detail:`No element in this document has the id "${f}". The dialogs and popovers here are: ${U}. A commandfor that names nothing does nothing, silently. ${I}`,message:`commandfor="${f}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(d!==null&&M){if(Ge.has(d)&&!H(M))a.push({detail:`\`${d}\` acts on a <dialog>, and "${f}" is ${O?"a popover":`a <${ao(M)||"element"}>`}. The click is ignored. ${O?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${I}`,message:`${b} sends ${d} to "${f}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(Ze.has(d)&&!Gs(M,s))a.push({detail:`\`${d}\` acts on a popover, and "${f}" is ${R?"a dialog":`a <${ao(M)||"element"}>`} that declares no \`popover\`. The click is ignored. ${R?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${I}`,message:`${b} sends ${d} to "${f}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(Qt(d)&&!Io(M))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${f}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${I}`,message:`${b} sends ${d} to "${f}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function Jo(e,t,n){let o=[],r=Kr(e,"the dialog"),i=nh(e),{style:s}=e,a=Gr(e,"closedby");if(a!==null&&!Ro.includes(a))o.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${I}`,message:`${r} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(er(s,"display")!==null)o.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${I}`,fix:"display",message:`${r} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=i===null?void 0:n.get(i),c=Gr(e,"open")!==null||Wl(e).open===!0||e.open===!0;if(i!==null&&!l?.has("show-modal")&&!c)o.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${I}`,message:`${r} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!Do(e,i))o.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${I}`,message:`${r} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return o}function Y1(e,t){if(!e||!t)return null;for(let n=t.length;n>=0;n-=1){let o=t.slice(0,n),r=K(e,o);if(r&&typeof r==="object"&&H(r))return o}return null}function ax(e,t){let n=e.doc.document;if(!n)return null;if(t){let o=K(n,t);return o&&typeof o==="object"&&H(o)?t:null}return Y1(n,Te(e.session.selection))}function tn(){let e=u.value?.doc.document;return e?en(e):!1}function V(e){return st(e.paneId)}function ee(e){let t=Go(e.paneId);if(t?.kind==="lens")return t.zoom;return V(e)?.session.ui.zoom??1}function lx(e=qo()){return ee(e)}function ve(e,t){let n=Go(e.paneId);if(n?.kind==="lens"){n.zoom=t;return}let o=V(e);if(o)o.session.ui.zoom=t}function Ou(e,t,n,o=null){let r={_width:o||null,canvas:null,element:null,mediaName:e||"",ready:!1,renderScope:null,scrollContainer:null,viewport:null},i=[];if(o&&!n)i.push(`--panel-viewport-w:${o}px`);if(o)i.push(`--panel-canvas-w:${o}px`);return{item:{fullWidth:n,header:t?"shown":"hidden",key:e??"",label:t??"",mediaAttr:e,widthVars:i.join(";")},panel:r}}function WT(e,t){for(let{item:n,panel:o}of e)o.element=t.panelNode(n.key,"panel"),o.viewport=t.panelNode(n.key,"panel-viewport"),o.canvas=t.panelNode(n.key,"panel-canvas")}function VT(e,t){let n=e.find((r)=>r.item.key===t);if(!n)return;let o=wt(n.panel);if(o)o.session.ui.activeMedia=me(n.item.mediaAttr)}function Qe(e){if(!e.panzoomWrap)return;let t=e.wrap.clientWidth,n=e.panzoomWrap.scrollWidth,o=ee(e),r=n*o;e.panX=Math.max(16,(t-r)/2),e.panY=0}function Fb(e){if(e.centerObserver)e.centerObserver.disconnect(),e.centerObserver=null;if(!e.panzoomWrap)return;e.needsCenter=!0,e.centerObserver=new ResizeObserver(()=>{if(!e.needsCenter){e.centerObserver?.disconnect(),e.centerObserver=null;return}Qe(e),us(e)}),e.centerObserver.observe(e.panzoomWrap),Qe(e)}function us(e){if(!e.panzoomWrap)return;let t=ee(e);e.panzoomWrap.style.transform=`translate(${e.panX}px, ${e.panY}px) scale(${t})`,Ni("overlays")}var et=0.25,tt=3;function an(e){return Math.min(tt,Math.max(et,e))}function xd(e=qo()){if(_o(e.paneId)!=="edit")return;let[t]=e.panels;if(!t?.canvas||!t.viewport)return;let n=t.canvas,o=n.querySelector("iframe"),r=V(e)?.session.ui.editZoom??1;if(r===1){if(t._width=null,n.style.width="",n.style.transform="",n.style.transformOrigin="",o)o.style.width="100%";t.viewport.style.height=""}else{let i=e.wrap.querySelector('[part="edit-column"]');if(!i)return;let s=He(i).width;if(s<=0)return;let a=s/r;if(t._width=a,n.style.width=`${a}px`,n.style.transform=`scale(${r})`,n.style.transformOrigin="top left",o)o.style.width=`${a}px`,t.viewport.style.height=`${o.offsetHeight*r}px`}Ni("overlays")}function Mu(e,t=qo()){let n=V(t);if(!n)return;n.session.ui.editZoom=an(e),xd(t)}var Xe=new Map;function UT(e,t=qo()){let n=V(t);if(!n)return;if(n.session.ui.editZoom=an(e),Xe.has(t.paneId))return;Xe.set(t.paneId,requestAnimationFrame(()=>{Xe.delete(t.paneId),xd(t)}))}function sn(e,t,n){if(!e.panzoomWrap)return;let o=e.wrap.clientWidth,r=e.wrap.clientHeight,i=24,s=32,a=0,{panels:l}=e;for(let v of l)a+=v._width||800;a+=i*Math.max(0,l.length-1)+s;let c=ee(e),m=He(e.panzoomWrap).height/c+s,b=o/a,M=r/m,R=t==="width"?b:Math.min(b,M),O=Math.min(n,Math.max(F,R));ve(e,O);let U=a*O,w=m*O;e.panX=Math.max(0,(o-U)/2),e.panY=Math.max(0,(r-w)/2),us(e)}function qT({maxZoom:e=W,surface:t=qo()}={}){te("page",t),sn(t,"page",e)}var F=0.05,W=5;function rt(e){return Math.min(W,Math.max(F,e))}var Lo="page",nt=["width","page","none"];function jo(e,t,n){let o=t[n];if(typeof o==="string"&&nt.includes(o))return o;if(typeof o==="number"&&o>=F&&o<=W)return o;throw RangeError(`command "${e}" argument "${n}": expected ${nt.map((r)=>`"${r}"`).join(" | ")} or a number in [${F}, ${W}], got ${JSON.stringify(o)}`)}var ln=new Map;function cn(e){let t=V(e);if(!t)return null;let n=Go(e.paneId)?.kind==="lens"?`::${e.paneId}`:"";return`${t.id}::${t.documentPath??""}${n}`}function te(e,t){let n=cn(t);if(n)ln.set(n,e)}function cx(e=qo()){let t=cn(e);return(t===null?void 0:ln.get(t))??Lo}function un(e,t=qo()){let n=e??cx(t);if(n==="none"){us(t);return}if(typeof n==="number"){ve(t,rt(n)),us(t);return}sn(t,n,1)}function Z1(e,t=qo()){te(e,t),un(e,t)}function GT(e=qo()){te(rt(ee(e)),e)}function dx(e,t=qo()){if(!V(t))return;let o=rt(e);te(o,t),ve(t,o),us(t)}function ux(e){if(e.wrap.clientWidth<=0){us(e);return}un(cx(e),e)}function KT(e=qo()){if(te(1,e),!e.panzoomWrap)return;ve(e,1),Qe(e),us(e)}function Fo(e,t){let n=He(dn(e)??e.wrap),o=t.top+t.height/2-n.top;return n.height/2-o}function dn(e){return Mb(e)?.scrollContainer??null}function Wo(e,t,n){let o=dn(e);if(!o){Vo(e,t);return}let r=o.scrollTop-t;if(n){o.scrollTo({behavior:"smooth",top:r});return}o.scrollTop=r}function jb(e,t=qo()){Wo(t,Fo(t,e),!1)}function Vo(e,t){let n=e.panY,o=n+t,r=performance.now(),i=250,s=(a)=>{let l=Math.min((a-r)/250,1),c=l*(2-l);if(e.panY=n+(o-n)*c,us(e),l<1)requestAnimationFrame(s)};requestAnimationFrame(s)}var Ye=["edit","design","preview","source","stylebook","grid","git-diff"],ye=new Set(["edit","design"]),Bo=["edit","design","preview"];function zo(e){return Bo.filter((t)=>e.capabilities.modes.includes(t))}function JT(e){return zo(e).filter((t)=>t!=="preview")}function X1(e){let t=e.session.ui.canvasMode;return ye.has(t)?t:null}function Q1(e){return{available:e.capabilities.modes.includes("preview")&&ye.has(e.session.ui.canvasMode),on:e.session.ui.preview===!0}}function eC(e,t,n){if(t==="preview"){if(ye.has(e.session.ui.canvasMode))e.session.ui.preview=!0;return}if(e.session.ui.preview=!1,e.session.ui.canvasMode!==t)n(e,t)}var nn=new Set(["design","stylebook","git-diff"]),k=(e)=>e.document.open,rn=["auto","light","dark"];function Ko(e){function t(s){let a=u.value;if(!a)throw RangeError(`command "${s}" needs an open document; no tab is active`);return a}function n(s,a){let{pane:l}=a;if(l===void 0)return t(s);let c=ot(s,a,"pane"),d=st(c);if(!d)throw RangeError(`command "${s}" argument "pane": "${c}" has no open document`);return d}let o={pane:je("Which pane to render this way. Defaults to the focused one.")};function r(s){e.renderPane(i(s))}function i(s){let{pane:a}=s;return typeof a==="string"?a:g.activePaneId}return[{args:ke({mode:Ao(Ye,"The canvas mode to switch the active pane to.")}),category:"View",id:"canvas.setMode",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:k,aiTool:{description:"Switch the active document's editor mode. edit and design put its element tree on the canvas, where the document tools work; preview renders it as a visitor sees it; source shows the JSON; stylebook, grid and git-diff open other editors. Use it to return a document to edit or design when the tree tools are refused.",name:"set_canvas_mode",report:({after:s,args:a})=>{let l=li("canvas.setMode",a,"mode",Ye),c=s.editor.kind==="canvas"?"the document tools address its element tree":"the tree-editing tools are unavailable until it returns to edit or design";return`The active document is in ${l} mode; ${c}.`}},run:(s,a)=>{let l=li("canvas.setMode",a,"mode",Ye),c=t("canvas.setMode"),{modes:d}=c.capabilities;if(!d.includes(l))throw RangeError(`command "canvas.setMode" argument "mode": "${l}" is not a mode this document `+`supports — it declares: ${d.join(", ")}`);if(l==="preview"){let f=c.session.ui.canvasMode;if(!ye.has(f))throw RangeError(`command "canvas.setMode" argument "mode": "preview" composes with the edit and design base modes; this pane is in "${f}"`);c.session.ui.preview=!0;return}c.session.ui.preview=!1,e.setCanvasMode(c,l)},title:"Set Canvas Mode"},{args:ke({zoom:JC("Pan-zoom scale, 1 = 100%.",{maximum:W,minimum:F})}),category:"View",id:"canvas.setZoom",level:"document",menus:["palette"],group:"3_canvas",requires:"a document on the pan-zoom surface",when:k,enablement:()=>nn.has(e.getCanvasMode()),run:(s,a)=>{t("canvas.setZoom"),dx(yv("canvas.setZoom",a,"zoom",F,W))},title:"Set Zoom"},{args:ke({fit:{description:'How the document is framed: "width" | "page" | "none", or a numeric pan-zoom scale.',oneOf:[{enum:[...nt],type:"string"},{maximum:W,minimum:F,type:"number"}]}}),category:"View",id:"canvas.setFit",level:"document",menus:["palette"],group:"3_canvas",requires:"a document on the pan-zoom surface",when:k,enablement:()=>nn.has(e.getCanvasMode()),run:(s,a)=>{t("canvas.setFit"),Z1(jo("canvas.setFit",a,"fit"))},title:"Set Fit"},{args:ke({zoom:JC("Edit-mode content zoom, 1 = 100%.",{maximum:tt,minimum:et})}),category:"View",id:"canvas.setEditZoom",level:"document",menus:["palette"],group:"3_canvas",requires:"a document in edit mode",when:k,enablement:()=>e.getCanvasMode()==="edit",run:(s,a)=>{t("canvas.setEditZoom"),Mu(yv("canvas.setEditZoom",a,"zoom",et,tt))},title:"Set Edit Zoom"},{args:{additionalProperties:!1,properties:{...o,width:{description:"How wide the Edit column should render, in CSS pixels, or null to go back to the chosen breakpoint's own width.",type:["number","null"]}},required:["width"],type:"object"},category:"View",id:"canvas.setEditWidth",level:"document",menus:["palette"],group:"3_canvas",requires:"a document in edit mode",when:k,enablement:()=>e.getCanvasMode()==="edit",run:(s,a)=>{let l=n("canvas.setEditWidth",a),{width:c}=a;if(c===null){rx(i(a)),r(a);return}sx(i(a),l,yv("canvas.setEditWidth",a,"width",cp,1e4)),r(a)},title:"Set Edit Width"},{args:{additionalProperties:!1,properties:{...o,media:{description:"A breakpoint key the document renders under, or null for the base rendering.",type:["string","null"]}},required:["media"],type:"object"},category:"View",id:"canvas.setBreakpoint",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:k,run:(s,a)=>{let l=n("canvas.setBreakpoint",a),{media:c}=a;if(c!==null&&typeof c!=="string")throw RangeError('command "canvas.setBreakpoint" argument "media": expected a breakpoint key or null');let d=Object.keys(Ai(l.doc.document?.$media));if(c!==null&&!d.includes(c))throw RangeError(`command "canvas.setBreakpoint" argument "media": "${c}" is not a breakpoint this `+`document defines — it defines: ${d.length>0?d.join(", "):"nothing"}`);l.session.ui.activeMedia=c,r(a)},title:"Set Breakpoint"},{args:ke({...o,scheme:Ao(rn,"Which color scheme the canvas renders in.")},["scheme"]),category:"View",id:"canvas.setColorScheme",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:k,run:(s,a)=>{let l=n("canvas.setColorScheme",a);l.session.ui.previewColorScheme=li("canvas.setColorScheme",a,"scheme",rn),r(a)},title:"Set Color Scheme"},{args:ke({...o,locale:je("BCP 47 tag this pane renders as.")},["locale"]),category:"View",id:"i18n.switchLocale",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document in a project that declares more than one locale",when:(s)=>s.document.open&&s.project.isMultilingual,run:(s,a)=>{let l=n("i18n.switchLocale",a),c=ot("i18n.switchLocale",a,"locale"),d=ps();if(d===null||!d.locales.includes(c))throw RangeError(`command "i18n.switchLocale" argument "locale": "${c}" is not a locale this `+`project declares — it declares: ${d===null?"nothing":d.locales.join(", ")}`);l.session.ui.previewLocale=c,r(a)},title:"Set Rendering Language"},{args:ke({...o,visible:ro("True to draw the page's layout elements, false to hide them.")},["visible"]),category:"View",id:"canvas.setLayoutVisible",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:k,run:(s,a)=>{let l=n("canvas.setLayoutVisible",a);l.session.ui.showLayout=yi("canvas.setLayoutVisible",a,"visible"),r(a)},title:"Show Layout Elements"},{args:ke({...o,open:ro("True to draw the popover open, false to close it."),path:{description:"Document path of the popover. Defaults to the popover the selection is in or at.",items:{type:["string","number"]},type:"array"}},[]),category:"View",enablement:()=>Xt(),group:"3_canvas",id:"canvas.setPopoverOpen",level:"document",menus:["palette"],requires:"a popover in the open document",run:(s,a)=>{let l=n("canvas.setPopoverOpen",a),c=a??{},d=c.open===void 0?!0:yi("canvas.setPopoverOpen",a,"open");if(!d&&c.path===void 0){e.setOpenPopover(l,null);return}let f=Zt(l,c.path);if(f===null)throw RangeError('command "canvas.setPopoverOpen" argument "path": names no popover in this document — '+"a popover is an element with a `popover` attribute, and <dialog> is not one");e.setOpenPopover(l,d?f:null)},title:"Show Popover",when:k},{args:ke({...o,open:ro("True to draw the dialog open, false to close it."),path:{description:"Document path of the dialog. Defaults to the dialog the selection is in or at.",items:{type:["string","number"]},type:"array"}},[]),category:"View",enablement:()=>tn(),group:"3_canvas",id:"canvas.setDialogOpen",level:"document",menus:["palette"],requires:"a dialog in the open document",run:(s,a)=>{let l=n("canvas.setDialogOpen",a),c=a??{},d=c.open===void 0?!0:yi("canvas.setDialogOpen",a,"open");if(!d&&c.path===void 0){e.setOpenDialog(l,null);return}let f=ax(l,c.path);if(f===null)throw RangeError('command "canvas.setDialogOpen" argument "path": names no dialog in this document — '+"a dialog is a <dialog> element, and a popover is not one");e.setOpenDialog(l,d?f:null)},title:"Show Dialog",when:k},{args:{additionalProperties:!1,properties:{...o,open:{default:!0,description:"True to open the resolving-with popover, false to close it.",type:"boolean"}},required:[],type:"object"},category:"View",id:"canvas.setResolvingOpen",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:k,run:(s,a)=>{n("canvas.setResolvingOpen",a);let{open:l,pane:c}=a;e.setResolvingOpen(typeof c==="string"?c:g.activePaneId,l===void 0||yi("canvas.setResolvingOpen",a,"open"))},title:"Show Resolving Values"},{args:{additionalProperties:!1,properties:{...o,name:je("The prop's name, as the component's state declares it."),value:{description:"The test value — any JSON. Null clears it and the prop returns to its default.",type:["string","number","boolean","array","object","null"]}},required:["name"],type:"object"},category:"View",id:"canvas.setTestProp",level:"document",menus:["palette"],group:"3_canvas",requires:"an open component document",when:k,run:(s,a)=>{let l=n("canvas.setTestProp",a),c=ot("canvas.setTestProp",a,"name"),d=Object.keys(l.doc.document?.state??{});if(!d.includes(c))throw RangeError(`command "canvas.setTestProp" argument "name": "${c}" is not a prop this component `+`declares — it declares: ${d.length>0?d.join(", "):"nothing"}`);let{value:f}=a,m={...l.session.ui.previewProps};if(f===null||f===void 0)delete m[c];else m[c]=f;l.session.ui.previewProps=Object.keys(m).length>0?m:null,r(a)},title:"Set Test Value"},{args:{additionalProperties:!1,properties:{...o,name:je("The route parameter's name, without brackets."),value:je("The value to preview the route with. Empty clears it.")},required:["name","value"],type:"object"},category:"View",id:"canvas.setRouteParam",level:"document",menus:["palette"],group:"3_canvas",requires:"an open page with a dynamic route",when:k,run:(s,a)=>{let l=n("canvas.setRouteParam",a),c=ot("canvas.setRouteParam",a,"name"),d=Ll(l.documentPath);if(!d.includes(c))throw RangeError(`command "canvas.setRouteParam" argument "name": "${c}" is not a parameter of this `+`route — it has: ${d.length>0?d.join(", "):"none"}`);l.session.ui.previewParams={...l.session.ui.previewParams,[c]:ot("canvas.setRouteParam",a,"value")},r(a)},title:"Set Route Parameter"}]}function YT(e,t){e.registerAll(Ko(t))}function Hb(e=qo()){let t=Au(e.paneId);for(let n of e.panels){let o=n.element?.querySelector('[part="panel-header"]');if(o){let r=t===null&&n.mediaName==="base"||t===null&&n.mediaName===null||t===n.mediaName;o.toggleAttribute("data-active",r)}}}var J=null;function Uo(e){if(J?.isConnected)return J;let t=e.createElement("div");return t.className="jx-drag-ghost",t.style.cssText="position:fixed;left:0;top:0;z-index:9999;pointer-events:none;display:none;padding:2px 8px;border-radius:4px;font-size:12px;line-height:1.4;white-space:nowrap;background:var(--accent,#3b82f6);color:var(--accent-fg,#fff);box-shadow:0 2px 8px rgba(0,0,0,0.25);transform:translate(8px,8px)",e.body.append(t),J=t,t}function tC(e,t,n,o=document){let r=Uo(o);r.textContent=e,r.style.left=`${t}px`,r.style.top=`${n}px`,r.style.display="block"}function hx(e,t){if(!J||J.style.display==="none")return;J.style.left=`${e}px`,J.style.top=`${t}px`}function _d(){if(J)J.style.display="none"}var pn=function(){if(typeof window>"u")return null;var e=new Image;return e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",e}();function wc(e){var t=e.nativeSetDragImage;if(t&&pn)t(pn,0,0)}function fn(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.indexOf(o)!==-1)continue;n[o]=e[o]}return n}function mn(e,t){if(e==null)return{};var n,o,r=fn(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function be(e,t){var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;return n.every(function(r){return Object.is(e[r],t[r])})}function hn(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:be,t=null;return function(n){if(t&&e(t.value,n))return t.value;return t={value:n},t.value}}var Zo=["block"];function gn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function vn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gn(Object(n),!0).forEach(function(o){ga(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gn(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Yo(e){return{x:(e.right+e.left)/2,y:(e.bottom+e.top)/2}}function it(e){var{client:t,borderBox:n}=e,o=n.height/4;if(t.y<=n.top+o)return"reorder-above";if(t.y>=n.bottom-o)return"reorder-below";return"make-child"}function Qo(e){var{element:t,input:n,currentLevel:o,indentPerLevel:r,mode:i}=e,s={x:n.clientX,y:n.clientY},a=t.getBoundingClientRect();if(i==="standard"){var l=it({borderBox:a,client:s});return{type:l,indentPerLevel:r,currentLevel:o}}var c=Yo(a);if(i==="expanded"){var d=it({borderBox:a,client:s});return{type:d==="reorder-above"?d:"make-child",indentPerLevel:r,currentLevel:o}}var f=r*o;if(s.x<a.left+f){if(s.y<c.y)return{type:"reorder-above",indentPerLevel:r,currentLevel:o};var m=(s.x-a.left)/r,b=Math.max(Math.floor(m),0);return{type:"reparent",desiredLevel:b,indentPerLevel:r,currentLevel:o}}return{type:it({borderBox:a,client:s}),indentPerLevel:r,currentLevel:o}}function yn(e,t){if(e.type!==t.type)return!1;if(e.type==="instruction-blocked"&&t.type==="instruction-blocked")return yn(e.desired,t.desired);return be(e,t)}var tr=hn(yn);function nr(e){var{desired:t,block:n}=e;if(n!==null&&n!==void 0&&n.includes(t.type)&&t.type!=="instruction-blocked"){var o={type:"instruction-blocked",desired:t};return o}return t}function Bb(e,t){var n=t.block,o=mn(t,Zo),r=Qo(o),i=nr({desired:r,block:n}),s=tr(i);return vn(vn({},e),{},ga({},xe,s))}function Pu(e){var t;return(t=e[xe])!==null&&t!==void 0?t:null}var xe=Symbol("tree-item-instruction");function lt(e){return typeof e==="object"&&e!==null&&typeof e.$ref==="string"?e.$ref:null}function we(e){if(e.source!=="npm"||!e.package)return null;return e.modulePath?`${e.package}/${e.modulePath}`:e.package}function or(e,t){let n=we(e);if(n)return n;return e.path?{$ref:xc(t,e.path)}:null}function nC(e,t,n){let o=we(t);if(o)return e.some((i)=>typeof i==="string"&&(i===o||i===t.package));if(!t.path)return!1;let r=G(xc(n,t.path));return e.some((i)=>{let s=lt(i);return s!==null&&G(s)===r})}function G(e){return e.replace(/^(?:\.\/)+/,"")}function am(e,t,n){let o=or(t,n);if(!o)return[...e];let i=we(t)&&t.modulePath?e.filter((s)=>s!==t.package):[...e];return nC(i,t,n)?i:[...i,o]}function iC(e,t,n){let o=we(t);if(o)return e.filter((i)=>!(typeof i==="string"&&(i===o||i===t.package)));if(!t.path)return[...e];let r=G(xc(n,t.path));return e.filter((i)=>{let s=lt(i);return s===null||G(s)!==r})}function ZT(e,t){return e.filter((n)=>typeof n!=="string"||!(n===t||n.startsWith(`${t}/`)))}function XT(e,t){let n=G(t);return e.filter((o)=>{let r=lt(o);return r===null||G(r)!==n})}async function px(e){Dp(!0);try{if(e.source==="npm"){if(!customElements.get(e.tagName))return ct(e.tagName)}else{if(e.path&&!e.path.endsWith(".json"))return ct(e.tagName);let n=D?.projectRoot,o=`${location.origin}/${n?`${n}/`:""}${e.path}`;await jm(o)}let t=document.createElement(e.tagName);for(let n of e.props||[])if(n.default!==void 0&&n.default!=="false"&&n.default!=="''"){let o=String(n.default).replaceAll(/^'|'$/g,"");t.setAttribute(n.name,o)}return t}catch(t){return console.warn("Component preview failed:",e.tagName,t),ct(e.tagName)}}function ct(e){let t=document.createElement("div");return t.style.cssText="padding:12px;border:1px dashed var(--border);border-radius:var(--radius);color:var(--fg-dim)",t.textContent=`<${e}>`,t}var rr='[part="outline"]',ut='[part="row"]',ir='[part="verbs"]',Ce=null;function QT(){if(Ce!==null)cancelAnimationFrame(Ce);for(let e of Je.dndCleanups)e();Je.dndCleanups=[],Ce=requestAnimationFrame(()=>{Ce=null;let e=Qu?.querySelector(rr);if(!e)return;for(let n of e.querySelectorAll("[data-dnd-row]")){let o=n.dataset.value.split("/").map((l)=>/^\d+$/.test(l)?Math.trunc(Number(l)):l),r=Math.trunc(Number(n.dataset.dndDepth))||0,i=Object.hasOwn(n.dataset,"dndVoid"),s=Object.hasOwn(n.dataset,"dndExpanded"),a=gr(gs({canDrag({element:l,input:c}){if(Iv(c.clientX,c.clientY)?.closest(ir))return!1;return!0},element:n,getInitialData(){return{path:o,type:"tree-node"}},onGenerateDragPreview({nativeSetDragImage:l}){wc({nativeSetDragImage:l})},onDragStart(){if(n.dataset.dragging="",Je.layerDragSourceHeight=n.offsetHeight,s)ar(n,e)},onDrop(){if(delete n.dataset.dragging,s)Ni("leftPanel")}}),zs({element:n,canDrop({source:l}){let c=l.data.path;if(c&&qa(c,o))return!1;return!0},getData({input:l,element:c}){return Bb({path:o},{block:i?["make-child"]:[],currentLevel:r,element:c,indentPerLevel:16,input:l,mode:s?"expanded":"standard"})},onDragEnter({self:l}){bn(n,l.data,e)},onDrag({self:l}){bn(n,l.data,e)},onDrop(){oe(e)}}));Je.dndCleanups.push(a)}let t=Ws({onDrop({source:n,location:o}){oe(e);let[r]=o.current.dropTargets;if(!r)return;let i=Pu(r.data);if(!i||i.type==="instruction-blocked")return;let s=n.data,a=r.data.path,l=s.type==="tree-node"&&n.element,c=l&&Object.hasOwn(l.dataset,"dndExpanded");if(lm(u.value,i,s,a),c){let d=u.value,f=Te(d?.session.selection);if(f)Je._layersCollapsed||=new Set,Je._layersCollapsed.add(f.join("/"))}},onDropTargetChange({location:n}){let[o]=n.current.dropTargets;if(o&&!Pu(o.data))oe(e)}});Je.dndCleanups.push(t)})}function eL(){requestAnimationFrame(()=>{let e=Qu?.querySelector(".components-section");if(!e)return;for(let t of e.querySelectorAll("[data-component-tag]")){let n=t.dataset.componentTag;if(!n)continue;let o=at.find((a)=>a.tagName===n);if(!o)continue;let r=t.querySelector(".element-card-preview");if(r&&!r.querySelector(n))px(o).then((a)=>{r.textContent="",r.append(a)});let i=fm(o),s=gs({element:t,getInitialData(){return{fragment:structuredClone(i),type:"block"}},onGenerateDragPreview({nativeSetDragImage:a}){wc({nativeSetDragImage:a})}});Je.dndCleanups.push(s)}})}function tL(){requestAnimationFrame(()=>{let e=Qu?.querySelector('[part="content"]');if(!e)return;for(let t of e.querySelectorAll("[data-block-tag]")){let n=t.dataset.blockTag,o=t.querySelector(".element-card-preview");if(o&&!o.firstChild){let s=document.createElement(Ht.has(n)?"span":n);s.textContent=n,o.append(s)}let r=yd(n),i=gs({element:t,getInitialData(){return{fragment:structuredClone(r),type:"block"}},onGenerateDragPreview({nativeSetDragImage:s}){wc({nativeSetDragImage:s})}});Je.dndCleanups.push(i)}})}function ar(e,t){let n=`${e.dataset.value}/`,o=t.querySelectorAll(ut);for(let r of o)if(r.dataset.value?.startsWith(n))r.style.display="none"}function bn(e,t,n){let o=Pu(t);if(Je._currentDropTargetRow&&Je._currentDropTargetRow!==e)delete Je._currentDropTargetRow.dataset.drop;if(!o||o.type==="instruction-blocked"){oe(n);return}if(o.type==="make-child"){oe(n),e.dataset.drop="",Je._currentDropTargetRow=e;return}delete e.dataset.drop,Je._currentDropTargetRow=e;let r=[...n.querySelectorAll(ut)],i=r.indexOf(e),s=Je.layerDragSourceHeight;for(let a=0;a<r.length;a++){if(r[a].dataset.dragging!==void 0)continue;if(o.type==="reorder-above")r[a].style.transform=a>=i?`translateY(${s}px)`:"";else r[a].style.transform=a>i?`translateY(${s}px)`:""}}function oe(e){if(Je._currentDropTargetRow)delete Je._currentDropTargetRow.dataset.drop,Je._currentDropTargetRow=null;let t=e.querySelectorAll(ut);for(let n of t)n.style.transform="",n.style.display=""}function lm(e,t,n,o){if(!e)return;let r=e.doc.document;if(n.type==="tree-node"){let i=n.path,s=ht(o),a=_n(o);if(t.type!=="make-child"&&(!s||typeof a!=="number"))return;switch(t.type){case"reorder-above":{q(e,(l)=>pa(l,i,s,a));break}case"reorder-below":{q(e,(l)=>pa(l,i,s,a+1));break}case"make-child":{let l=K(r,o),c=so(l).length;q(e,(d)=>pa(d,i,o,c));break}default:break}}else if(n.type==="block"){let i=ht(o),s=_n(o);if(t.type!=="make-child"&&(!i||typeof s!=="number"))return;switch(t.type){case"reorder-above":{q(e,(c)=>Ji(c,i,s,structuredClone(n.fragment)));break}case"reorder-below":{q(e,(c)=>Ji(c,i,s+1,structuredClone(n.fragment)));break}case"make-child":{let c=K(r,o),d=so(c).length;q(e,(f)=>Ji(f,o,d,structuredClone(n.fragment)));break}default:break}let l=n.fragment?.tagName;if(Ve(l).includes("-")){let c=at.find((m)=>m.tagName===l),d=e.doc.document?.$elements??[],f=c?am(d,c,e.documentPath??null):d;if(f.length!==d.length)js(e,(m)=>{m.$elements=f})}}}function xn(e){let t={};for(let[n,o]of Object.entries(e?.nesting??{}))if(n!=="_root")t[n]=o?.inline===!0;for(let n of e?.inline??[])t[n]=!1;return t}var Re=new WeakMap,h=new Set,z=0,ae=new Map,$n=-1,In=0,sr=600;function oC(e){return $n===e&&Date.now()-In<=sr}var wn=0,Dn=new Set;function lr(e,t){let n;try{n=new URL(e,t.iframe.src||gm())}catch{return}if(!["http:","https:","mailto:","tel:"].includes(n.protocol))return;let o=n.href,r=Qw();if(r){r(o);return}window.open(o,"_blank","noopener,noreferrer")}function rC(e){Dn.add(e)}function cr(e){return Dn.delete(e)}var L=new Map,Z=new Map,se=new Map,ur=300;function sC(e,t,n,o=ur){let r=null;for(let a of h){if(!a.iframe.isConnected){h.delete(a);continue}if(a.ready&&!a.stylebook&&e!==null&&a.tabId===e){r=a;break}}if(!r)return Promise.resolve(null);wn+=1;let i=wn,s=JSON.parse(JSON.stringify(t));return r.channel.post({contextPath:n?[...n]:null,exprs:s,gen:r.lastRenderedGen,kind:"evalExpr",reqId:i}),new Promise((a)=>{let l=setTimeout(()=>{L.delete(i),Z.delete(i),a(null)},o);Z.set(i,r),L.set(i,(c)=>{clearTimeout(l),Z.delete(i),a(c)})})}var Cn=0,X=new Map,dr=250;function aC(e,t=dr){let n=[];for(let o of h){if(!o.iframe.isConnected){h.delete(o);continue}if(o.ready&&!o.stylebook&&e!==null&&o.tabId===e)n.push(o)}if(n.length===0)return Promise.resolve();return new Promise((o)=>{let r=n.length,i=setTimeout(()=>{for(let l of a)X.delete(l),se.delete(l);o()},t),s=()=>{if(r-=1,r===0)clearTimeout(i),o()},a=[];for(let l of n){Cn+=1;let c=Cn;a.push(c),X.set(c,s),se.set(c,l),l.channel.post({kind:"flushEdits",reqId:c})}})}function lC(e){return Re.get(e)??null}function cm(e){for(let t of h){if(!t.iframe.isConnected)continue;let n=He(t.iframe);if(e.x>=n.left&&e.x<=n.right&&e.y>=n.top&&e.y<=n.bottom)return t}return null}function dm(e,t,n){z+=1,ae.set(z,n);let o=t.type==="tree-node"?{path:[...t.path],type:"tree-node"}:{type:t.type};return e.channel.post({dragSeq:z,gen:e.lastRenderedGen,kind:"dragStart",src:o}),z}function fx(){return z}function za(e){let t=He(e.iframe),n=e.iframe.clientWidth>0?t.width/e.iframe.clientWidth:1;return{rect:t,scale:n}}function Hn(e){if(e.stylebook)return"stylebook";return e.tabId??"unbound"}function cC(){let e=[];for(let t of h){if(!t.iframe.isConnected){h.delete(t);continue}let n=`canvas[${Hn(t)}]`;if(!t.ready){e.push(`${n}: frame has not handshaked`);continue}let o=[...t.pendingTabIds.keys()];if(o.length>0)e.push(`${n}: gen ${o.join(", ")} unacked`);if(t.pendingPatches>0)e.push(`${n}: ${t.pendingPatches} unacked patch(es)`);if(t.pendingMeasures.size>0)e.push(`${n}: ${t.pendingMeasures.size} measure(s) in flight`);let{idle:r}=t;if(!r){e.push(`${n}: no quiescence report yet`);continue}if(r.gen!==t.lastRenderedGen)e.push(`${n}: quiescence is for gen ${r.gen}, DOM is gen ${t.lastRenderedGen}`);if(!r.fonts)e.push(`${n}: fonts still loading`);if(r.animations>0)e.push(`${n}: ${r.animations} running animation(s)`);if(r.images>0)e.push(`${n}: ${r.images} pending image retry(ies)`)}if(L.size>0)e.push(`canvas: ${L.size} expression eval(s) in flight`);return e}var pr=500,fr=2,mr=40;function Jn(){let e=u.value?.id??null,t=null;for(let n of h){if(!n.iframe.isConnected){h.delete(n);continue}if(!n.ready||n.stylebook)continue;if(n.tabId===e)return n;t??=n}return t}function vr(e,t){let{rect:n,scale:o}=za(e),r=n.left+t.x*o,i=n.top+t.y*o,s=t.width*o,a=t.height*o;return{height:a,left:r,top:i,width:s,x:r+s/2,y:i+a/2}}function Oe(e,t){return new Promise((n)=>{e.selReqId+=1;let o=e.selReqId,r=setTimeout(()=>{e.pendingMeasures.delete(o),n(null)},pr);e.pendingMeasures.set(o,(i)=>{clearTimeout(r);let[s]=i;n(s?vr(e,s.rect):null)}),e.channel.post({kind:"measure",paths:[[...t]],reqId:o})})}function dC(e){let t=Jn();return t?Oe(t,e):Promise.resolve(null)}function yr(e){return new Promise((t)=>{let n=Number.NaN,o=0,r=0,i=()=>{let{top:s}=He(e.iframe);if(o=s===n?o+1:0,n=s,r+=1,o>=fr||r>=mr){t();return}requestAnimationFrame(i)};requestAnimationFrame(i)})}async function um(e){let t=Jn();return t?l$(t,e):null}async function l$(e,t){let n=await Oe(e,t);if(!n)return null;let o=_(e.canvasEl)?.surface;return jb({height:n.height,top:n.top},o),await yr(e),Oe(e,t)}function C$(e,t){let n=lC(e);return n?Oe(n,t):Promise.resolve(null)}function br(e){let t=e.canvasEl.parentElement;if(!t)return;let n=/scale\(([\d.]+)\)/.exec(e.canvasEl.style.transform),o=n?Number(n[1]):1;t.style.height=o===1?"":`${e.iframe.offsetHeight*o}px`}function Ln(e){if(e.preview){e.iframe.style.height="100%",e.iframe.style.minHeight="0px";return}if(e.contentHeight===null)return;e.iframe.style.height=`${e.contentHeight}px`,e.iframe.style.minHeight=e.contentFragment?"0px":"480px",br(e)}function gt(e,t){if(e.preview=t,e.overlay.setSuppressed(t),t)e.pendingEnterEdit=null;Ln(e)}function uC(e,t){gt(yt(e),t)}function Rl(e,t){if(!e.iframe.isConnected)return;e.channel.post(t)}function zb(e){ae.delete(e)}function Wb(e){e.overlay.setDropIndicator(null)}var jn=null;function hC(e){jn=e}var xr=300,qn=null;function pC(e){qn=e}var vt=null;function fC(e){vt=e}function wr(e,t,n){if((t?Cr(t.tagName):!1)&&t){e.overlay.setDropIndicator(null),e.overlay.setReplaceTarget(N(t.rect));return}e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(n?N(n.referenceRect):null,n?.edge)}function Pn(e){e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(null)}function Cr(e){return e==="img"||e==="video"||e==="source"}function Pr(e,t){if(e.dataset.jxGutterDrop==="1")return;e.dataset.jxGutterDrop="1",e.addEventListener("dragover",(n)=>{if(![...n.dataTransfer?.types??[]].includes("Files"))return;if(n.preventDefault(),n.dataTransfer)n.dataTransfer.dropEffect="copy"}),e.addEventListener("drop",(n)=>{let o=n.dataTransfer?.files,r=t();if(!o?.length||!r||r.stylebook)return;n.preventDefault(),vt?.(P(r),[...o],null,null)})}var Ee=null;function mC(e){Ee=e}var Me=null;function gC(e){Me=e}var Fn=null;function bC(e){Fn=e}function Sn(e,t){let n=[...t];for(;;){let o=e.get(Il(n));if(o)return o;if(n.length<2)return null;n=n.slice(0,-2)}}var E=null;function vC(){let e=E;return Boolean(e?.editing&&e.iframe.isConnected)}var Ne=null;function yC(e){Ne=e}var mt=null;function wC(e){mt=e}var En=null,Wn=null;function xC(e){Wn=e}function _C(e,t){for(let n of h){if(!n.iframe.isConnected){h.delete(n);continue}if(n.ready&&n.tabId===e.id&&!n.preview)n.popoverOpen=t,n.channel.post({kind:"setPopoverOpen",path:t})}}function CC(e,t){for(let n of h){if(!n.iframe.isConnected){h.delete(n);continue}if(n.ready&&n.tabId===e.id&&!n.preview)n.dialogOpen=t,n.channel.post({kind:"setDialogOpen",path:t})}}function mx(e,t){let n=0;for(let o of h){if(!o.iframe.isConnected){h.delete(o);continue}if(o.ready&&o.tabId===t){let r=_(o.canvasEl)?.surface;if(!r){Ob("host-stage-unresolved");continue}let i=r.renderGeneration,s=Ae?.host===o?Ae.paths:void 0;$e(o),o.channel.post(s?{echoPaths:s,forwardOps:e,gen:i,kind:"patch"}:{forwardOps:e,gen:i,kind:"patch"}),o.pendingPatches+=1,n+=1}}return n}var Ae=null,Sr=0;function Tn(e,t,n){Ae={host:e,paths:t};try{n()}finally{Ae=null}}var dt=null,pt=null;function Er(e,t,n){return!e&&t===n}function Tr(e,t){let n=P(e);if(!n)return;let o=K(n.doc.document,t);if(!o)return;mx([{key:"$props",op:"set-key",path:t,value:o.$props}],n.id)}function P(e){return e.tabId?g.tabs.get(e.tabId)??null:null}function SC(e){return P(e)}function Pe(e){let t=_(e.canvasEl)?.surface.paneId;if(t)Rr(t)}var Mr=Object.freeze([]);function Nr(){let e=new Map;for(let t of g.panes){let n=t.activeTabId?g.tabs.get(t.activeTabId):null;if(!n)continue;let o=n.session.selection??[];o.map((r)=>r.join("/")).join("|"),e.set(n.id,o)}return e}function kr(){if(En)return;let e=ge(!0);e.run(()=>{Q(()=>{let t=Nr();y.stylebook.selection;for(let n of h)Ie(n,(n.tabId?t.get(n.tabId):null)??Mr)})}),En={stop:()=>e.stop()}}function $e(e){if(!e.ready)return;let t=Rd();if(t===e.postedVersions)return;if(e.postedVersions===null&&Object.keys(t).length===0){e.postedVersions=t;return}e.postedVersions=t,e.channel.post({kind:"assetVersions",versions:t})}var Mn=!1,ft=!1;function Or(){if(Mn)return;Mn=!0,ge(!0).run(()=>{Q(()=>{if(BC.value,ft)return;ft=!0,queueMicrotask(()=>{ft=!1,Ar()})})})}function Ar(){for(let e of h){if(!e.iframe.isConnected){h.delete(e);continue}$e(e)}}var Nn=!1,Se=null;function $r(){if(Nn)return;Nn=!0,ge(!0).run(()=>{Q(()=>{for(let t of g.panes){let n=t.activeTabId?g.tabs.get(t.activeTabId):null;if(!n)continue;let{peers:o}=on(n);o.map((r)=>JSON.stringify(r.state.structuralSelection??null)).join("|")}if(Se)clearTimeout(Se);Se=setTimeout(()=>{Se=null;for(let t of h)Vn(t)},100)})})}function Vn(e){if(e.stylebook||!e.ready||!e.iframe.isConnected)return;let t=P(e),n=t?on(t).peers:[];e.presenceMeta.clear();let o=[];for(let r of n){let{structuralSelection:i}=r.state;if(!i||r.state.focusedPath!==t?.documentPath)continue;for(let s of i){let a=[...s];o.push(a),e.presenceMeta.set(JSON.stringify(a),{color:r.state.user.color,label:r.state.user.name??r.state.user.login})}}if(o.length===0){e.presenceReqId=-1,e.overlay.setPresence([]);return}e.selReqId+=1,e.presenceReqId=e.selReqId,e.channel.post({kind:"measure",paths:o,reqId:e.presenceReqId})}function Ie(e,t){if(e.stylebook){Ir(e);return}let n=Te(t);if(e.selectionPath=n,e.selectionPaths=t,!e.iframe.isConnected){h.delete(e);return}if(!n){e.coSelectionKeys.clear(),e.overlay.setSelection(null),e.overlay.setCoSelection([]);return}if(!e.ready)return;let o=ms(t.slice(0,-1));e.coSelectionKeys=new Set(o.map((r)=>JSON.stringify(r))),e.selReqId+=1,e.channel.post({kind:"measure",paths:[[...n],...o],reqId:e.selReqId})}function Ir(e){if(!e.iframe.isConnected){h.delete(e);return}let t=y.stylebook.selection,n=t?e.stylebook?.tagToCardPath.get(t):void 0;if(!t||!n){e.overlay.setSelection(null);return}if(!e.ready)return;e.selReqId+=1,e.channel.post({kind:"measure",paths:[[...n]],reqId:e.selReqId})}function kn(){return Bv("../canvas.html")}var Dr="about:blank";function zn(e){e.channel.dispose();for(let[t,n]of L)if(Z.get(t)===e)L.delete(t),Z.delete(t),n(null);for(let[t,n]of X)if(se.get(t)===e)X.delete(t),se.delete(t),n();for(let[,t]of e.pendingMeasures)t([]);if(e.pendingMeasures.clear(),e.pendingTabIds.clear(),le(e),E===e)E=null;e.overlay.root.remove(),e.iframe.remove(),Re.delete(e.canvasEl),h.delete(e)}function Hr(){if(!We())return kn();let e=p();if(e.canvasUrl)return e.canvasUrl;return e.canvasUrlDeferred?Dr:kn()}function hm(e){let t=0;for(let n of new Set(h))if(e.contains(n.canvasEl))zn(n),t+=1;return t}function yt(e){let t=Hr(),n=Re.get(e);if(n){if(n.canvasUrl===t)return n;zn(n)}let o=location.origin,r=crypto.randomUUID(),i=new URL(t,location.href).origin,s=document.createElement("iframe");s.className="jx-canvas-iframe",s.title="Canvas — live page render",s.style.cssText="width:100%;min-height:480px;height:100%;border:0;display:block;background:#fff";let a=new URL(t,location.href);if(a.searchParams.set("token",r),location.protocol==="http:"||location.protocol==="https:")a.searchParams.set("parentOrigin",o);if(s.src=i===o?`${a.pathname}${a.search}`:a.href,!e.style.position)e.style.position="relative";let l=zt(document);e.replaceChildren(s,l.root),Pr(e,()=>lC(e));let c=xt({acceptOrigin:i,source:window,target:{postMessage:(f,m)=>s.contentWindow?.postMessage(f,m)},targetOrigin:i,token:r}),d={canvasEl:e,canvasUrl:t,channel:c,contentFragment:!1,contentHeight:null,hiddenPaths:new Set,popoverOpen:null,dialogOpen:null,editing:!1,editingProp:null,iframe:s,insertHideTimer:null,insertHover:!1,coSelectionKeys:new Set,insertZone:null,lastRenderedGen:-1,lastSelectionRect:null,lastSnapshotSeq:0,overlay:l,panReqId:-1,pending:null,postedVersions:null,idle:null,pendingEnterEdit:null,pendingMeasures:new Map,pendingPatches:0,pendingTabIds:new Map,presenceMeta:new Map,presenceReqId:-1,preview:!1,ready:!1,selectionPath:null,selectionPaths:[],selReqId:0,snapshot:null,stylebook:null,tabId:null};return l.insertButton.addEventListener("click",(f)=>_r(d,f)),l.insertButton.addEventListener("mouseenter",()=>{d.insertHover=!0,le(d)}),l.insertButton.addEventListener("mouseleave",()=>{d.insertHover=!1,Un(d)}),c.onMessage((f)=>qr(d,f)),Re.set(e,d),h.add(d),kr(),$r(),Or(),d}function Jr(e,t){le(e),e.insertZone=t,e.overlay.setInsertZone(N(t.rect),t.edge)}function Kn(e){le(e),e.insertZone=null,e.insertHover=!1,e.overlay.setInsertZone(null)}function Lr(e){let t=e.overlay.insertButton;return e.insertHover||typeof t.matches==="function"&&t.matches(":hover")}function Un(e){le(e),e.insertHideTimer=setTimeout(()=>{if(e.insertHideTimer=null,Lr(e))return;Kn(e)},xr)}function le(e){if(e.insertHideTimer!==null)clearTimeout(e.insertHideTimer),e.insertHideTimer=null}function _r(e,t){t.stopPropagation(),t.preventDefault();let n=e.insertZone;if(!n)return;qn?.(e.overlay.insertButton,n)}var jr=new Set(["contextMenu","dragOver","dropResult","editCommit","editCommitProp","editInsert","editMerge","editRangeReplace","editSplit","editStart","fileDragOver","fileDrop","hit","hover","insertZones","layoutHit","nativeDragEnter"]);function qr(e,t){if(e.preview&&jr.has(t.kind))return;switch(t.kind){case"ready":{e.ready=!0;let n=bt?.();if(n)e.channel.post({chords:n.chords,kind:"keymap",mac:n.mac});if(e.postedVersions=null,$e(e),e.pending)e.channel.post(e.pending),e.pending=null;Ie(e,e.selectionPaths);return}case"paneFocus":{Pe(e),mt?.();return}case"popoverTargetClick":{let n=P(e);if(!n||e.preview)return;let o=JSON.stringify(n.session.ui.openPopover)===JSON.stringify(t.targetPath),r=t.action==="show"||t.action==="toggle"&&!o;if(r||o)ne()?.run("canvas.setPopoverOpen",{open:r,path:t.targetPath});return}case"commandTargetClick":{let n=P(e);if(!n||e.preview)return;let o=(i)=>JSON.stringify(i)===JSON.stringify(t.targetPath),r=K(n.doc.document,t.targetPath);if(!r||typeof r!=="object")return;if(Ze.has(t.command)){if(!Gs(r))return;let i=t.command==="show-popover"||t.command==="toggle-popover"&&!o(n.session.ui.openPopover);if(i||o(n.session.ui.openPopover))ne()?.run("canvas.setPopoverOpen",{open:i,path:t.targetPath})}else if(Ge.has(t.command)){if(!H(r))return;let i=t.command==="show-modal";if(i||o(n.session.ui.openDialog))ne()?.run("canvas.setDialogOpen",{open:i,path:t.targetPath})}return}case"hit":{Pe(e),mt?.(),PC(null);let n=null,o=_(e.canvasEl)?.panel;if(o?.mediaName&&!o.mediaName.startsWith("git-diff")){n=me(o.mediaName);let i=P(e);if(i)i.session.ui.activeMedia=n}if(Me?.dismiss(),e.stylebook){let i=Sn(e.stylebook.pathToTag,t.hit.path);if(Fn?.(i,n),i){let s=N(t.hit.rect);e.overlay.setSelection(s,`<${i}>`),e.lastSelectionRect=s}else e.overlay.setSelection(null);return}e.selectionPath=t.hit.path,e.selectionPaths=[t.hit.path];let r=P(e);if(r)r.session.selection=t.additive?uv(r.session.selection,t.hit.path):[t.hit.path];{let i=N(t.hit.rect);e.overlay.setSelection(i),e.lastSelectionRect=i}return}case"layoutHit":{if(e.stylebook)return;Pe(e),Me?.dismiss(),PC(t.hit),e.selectionPath=null,e.selectionPaths=[];let n=P(e);if(n)n.session.selection=[];let o=N(t.hit.rect);e.overlay.setSelection(o,`LAYOUT · ${t.hit.layoutFile}`),e.lastSelectionRect=o,Ni("rightPanel");return}case"hover":{if(e.stylebook){let n=t.hit?Sn(e.stylebook.pathToTag,t.hit.path):null,o=y.stylebook.selection;if(t.hit&&n&&n!==o)e.overlay.setHover(N(t.hit.rect));else e.overlay.setHover(null);return}Br(e,t.hit);return}case"insertZones":{if(e.stylebook)return;let n=t.zones?.[0]??null;if(n)Jr(e,n);else Un(e);return}case"geometry":{let n=e.pendingMeasures.get(t.reqId);if(n){e.pendingMeasures.delete(t.reqId),n(t.hits);return}if(t.reqId===e.presenceReqId){e.presenceReqId=-1;let o=[];for(let r of t.hits){let i=e.presenceMeta.get(JSON.stringify(r.path));if(i)o.push({...i,placement:N(r.rect)})}e.overlay.setPresence(o);return}if(t.reqId===e.panReqId){e.panReqId=-1;let[o]=t.hits;if(o){let{rect:r,scale:i}=za(e);jb({height:o.rect.height*i,top:o.rect.y*i+r.top})}return}if(t.reqId===e.selReqId){let o=JSON.stringify(e.selectionPath),r=[],i=null;if(e.stylebook){let[a]=t.hits;i=a?N(a.rect):null}else for(let a of t.hits){let l=JSON.stringify(a.path);if(l===o)i=N(a.rect);else if(e.coSelectionKeys.has(l))r.push(N(a.rect))}let s=e.stylebook?y.stylebook.selection:null;e.overlay.setSelection(i,s?`<${s}>`:null),e.overlay.setCoSelection(r),e.lastSelectionRect=i,e.hiddenPaths=new Set((t.hidden??[]).map((a)=>JSON.stringify(a)))}return}case"evalResult":{let n=L.get(t.reqId);if(!n)return;L.delete(t.reqId),Z.delete(t.reqId),n(t.gen===e.lastRenderedGen?t.results:null);return}case"renderComplete":{if(e.pendingTabIds.has(t.gen))e.tabId=e.pendingTabIds.get(t.gen)??null;for(let n of e.pendingTabIds.keys())if(n<=t.gen)e.pendingTabIds.delete(n);Rn(e,t.gen);return}case"patchComplete":{e.pendingPatches=Math.max(0,e.pendingPatches-1),Rn(e,t.gen);return}case"idle":{e.idle={animations:t.animations,fonts:t.fonts,gen:t.gen,images:t.images};return}case"renderError":{e.pendingTabIds.delete(t.gen);let n=P(e);if(n)n.session.canvas.refreshing=!1,Ni("leftPanel");S.error("The page could not be rendered.",{detail:t.message,key:`canvas.render:${Hn(e)}`,source:"Canvas"});return}case"dataScope":{if(t.gen!==e.lastRenderedGen)return;let n=P(e);if(n)n.session.canvas.scope=t.scope,n.session.canvas.refreshing=!1;Ni("leftPanel");return}case"contentHeight":{e.contentHeight=t.height,e.contentFragment=t.fragment,Ln(e);return}case"dragOver":{if(t.dragSeq!==z)return;if(t.cursor)$n=t.dragSeq,In=Date.now();if(t.gen!==e.lastRenderedGen)return;if(t.preview)e.overlay.setDropIndicator(N(t.preview.referenceRect),t.preview.edge);else e.overlay.setDropIndicator(null);if(t.cursor){let n=za(e);hx(t.cursor.x*n.scale+n.rect.left,t.cursor.y*n.scale+n.rect.top)}return}case"nativeDragEnter":{if(e.stylebook)return;jn?.(e);return}case"dragEnd":{e.overlay.setDropIndicator(null),_d(),ae.delete(t.dragSeq);return}case"dropResult":{if(t.dragSeq!==z||t.gen!==e.lastRenderedGen)return;if(t.instruction&&t.targetPath){let n=ae.get(t.dragSeq);if(n)lm(P(e),{type:t.instruction},n,t.targetPath)}ae.delete(t.dragSeq),e.overlay.setDropIndicator(null),_d();return}case"fileDragOver":{if(e.stylebook)return;wr(e,t.hit,t.preview);return}case"fileDragLeave":{Pn(e);return}case"fileDrop":{if(Pn(e),e.stylebook)return;vt?.(P(e),t.files,t.hit,t.preview);return}case"patchError":{e.pendingPatches=Math.max(0,e.pendingPatches-1);let n=_(e.canvasEl)?.surface;if(n)Wn?.(n.paneId);return}case"forwardKey":{Vr(t.event);return}case"forwardWheel":{Wr(e,t);return}case"editStart":{if(E&&E!==e)E.editing=!1,E.editingProp=null,E.snapshot=null;if(E=e,t.prop!==void 0&&pt===Il(t.path))ie(e,t.path,void 0,t.prop);pt=null,Sr+=1,e.editing=!0,e.editingProp=t.prop??null,e.snapshot=null,e.lastSnapshotSeq=0,Ne?.();return}case"selectionChanged":{if(t.seq<=e.lastSnapshotSeq)return;if(e.lastSnapshotSeq=t.seq,e.snapshot=t,!e.editing)e.editing=!0,E=e;Ne?.();return}case"flushComplete":{let n=X.get(t.reqId);if(n)X.delete(t.reqId),se.delete(t.reqId),n();return}case"editCommit":{let n=()=>_t(P(e),t.path,t.children,t.textContent);if(t.inPlace)Tn(e,[t.path],n);else n();return}case"editCommitProp":{let n=()=>jt(P(e),t.path,t.prop,t.value);if(t.inPlace){Tn(e,[t.path],n),dt=Il(t.path);return}let o=n();if(Er(o,dt,Il(t.path)))Tr(e,t.path);dt=null,pt=o?Il(t.path):null;return}case"editMerge":{let n=qt(P(e),t.fromPath,t.intoPath);if(n)ie(e,n.path,n.offset);return}case"editRangeReplace":{let n=Bt(P(e),t.from,t.to,t.between,t.text);if(n)ie(e,n.path,n.offset);return}case"editSplit":{ie(e,Wt(P(e),t.path,t.before,t.after));return}case"editInsert":{ie(e,Vt(P(e),t.path,t.cmd,t.commitData));return}case"slashShow":{let{rect:n,scale:o}=za(e),r=t.rect.x*o+n.left,i=t.rect.y*o+n.top;Ee?.show({filter:t.filter,...t.showFilter===!0?{showFilter:!0}:{},onDismiss:()=>e.channel.post({kind:"slashDismissed"}),onSelect:(s)=>e.channel.post({cmd:{...s},kind:"slashSelect"}),rect:{bottom:i+t.rect.height*o,height:t.rect.height*o,left:r,top:i,width:t.rect.width*o}});return}case"slashNav":{Ee?.nav(t.key);return}case"slashDismiss":{Ee?.dismiss();return}case"previewNavigate":{lr(t.href,e);return}case"contextMenu":{if(e.stylebook)return;Pe(e);let{rect:n,scale:o}=za(e);Me?.show({clientX:t.x*o+n.left,clientY:t.y*o+n.top,path:t.path?[...t.path]:null});return}case"editEnd":{if(!e.editing)return;if(e.editing=!1,e.editingProp=null,e.snapshot=null,E===e)E=null;Ne?.();break}default:break}}function Rn(e,t){if(e.lastRenderedGen=t,Ie(e,e.selectionPaths),Vn(e),Kn(e),e.pendingEnterEdit&&t>=e.pendingEnterEdit.minGen){let{offset:n,path:o,prop:r}=e.pendingEnterEdit;if(e.pendingEnterEdit=null,e.tabId!==null&&e.tabId===sm(e.canvasEl)?.id)Fr(e,o,n,r)}}function ie(e,t,n,o){e.pendingEnterEdit={minGen:e.lastRenderedGen,path:[...t],...n===void 0?{}:{offset:n},...o===void 0?{}:{prop:o}}}function Fr(e,t,n,o){e.channel.post({kind:"enterEdit",path:[...t],...n===void 0?{}:{offset:n},...o===void 0?{}:{prop:o}})}function Wr(e,t){let{rect:n,scale:o}=za(e),r=jl(e.canvasEl)?.wrap;if(!r)return;r.dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:n.left+t.x*o,clientY:n.top+t.y*o,ctrlKey:t.ctrlKey,deltaX:t.deltaX,deltaY:t.deltaY,metaKey:t.metaKey,shiftKey:t.shiftKey}))}function Vr(e){document.dispatchEvent(new KeyboardEvent("keydown",{altKey:e.altKey,bubbles:!0,cancelable:!0,code:e.code,ctrlKey:e.ctrlKey,key:e.key,metaKey:e.metaKey,shiftKey:e.shiftKey}))}function Br(e,t){if(!t||Xo(t.path,e.selectionPath)){e.overlay.setHover(null);return}e.overlay.setHover(N(t.rect))}var zr=4,B=new Map;function Ur(e){let t=B.get(e);if(t)return B.delete(e),B.set(e,t),t;let n=new Map;B.set(e,n);for(let o of B.keys()){if(B.size<=zr)break;B.delete(o)}return n}function Zr(e,t,n,o,r,i=null){let s=Ur(e),a=o?.id??null,l=s.get(t);if(l&&l.tabId===n&&l.viewTabId===a&&l.mode===i)return l.payload;let c=cr(r),d=nx(At,async()=>{Co.renderPreparations+=1;let f=await kt(t,o,i),m=JSON.parse(JSON.stringify(f.renderDoc)),b=JSON.parse(JSON.stringify(t)),M=n?g.tabs.get(n)??null:null,R=wi(M?.doc.sourceFormat)?.studio?.elements,O=R?xn(R):void 0;return{assets:f.assets,doc:m,docBase:f.docBase??`${gm()}/`,mapperCtx:f.mapperCtx,mode:f.mapperCtx.canvasMode,shadowDoc:b,siteStyle:f.siteStyle,...O?{editableTags:O}:{},...c?{allowAutoRequests:!0}:{}}});return s.set(t,{mode:i,payload:d,tabId:n,viewTabId:a}),d}async function kC(e,t,n,o,r=null,i=sm(n),s=null,a=null){let l=yt(n);l.pendingTabIds.set(e,r),l.stylebook=null,l.iframe.style.width=o?`${o}px`:"100%";let d={...await Zr(e,t,r,i,Ab(n),s),colorScheme:Zn(i),...a?{diffMarks:a}:{},gen:e,kind:"render",popoverOpen:i?.session.ui.openPopover??null,dialogOpen:i?.session.ui.openDialog??null};l.popoverOpen=d.popoverOpen??null,l.dialogOpen=d.dialogOpen??null,gt(l,d.mode==="preview"),Gn(l,d)}function Gn(e,t){if(Co.hostRenderPosts+=1,e.ready)$e(e),e.channel.post(t);else e.pending=t}function EC(e,t,n,o){let r=yt(n);r.pendingTabIds.set(e,null),r.stylebook={pathToTag:t.pathToTag,tagToCardPath:t.tagToCardPath},gt(r,!1),r.pendingEnterEdit=null,r.iframe.style.width=o?`${o}px`:"100%";let i=JSON.parse(JSON.stringify(t.doc)),s=JSON.parse(JSON.stringify(t.doc)),a={assets:null,colorScheme:Zn(sm(n)),doc:i,docBase:`${gm()}/`,gen:e,kind:"render",mapperCtx:{arrayPaths:[],canvasMode:"stylebook",layoutWrapped:!1,pageContentOffset:null,pageContentPrefix:null},mode:"stylebook",shadowDoc:s,siteStyle:null};Gn(r,a)}function Zn(e){let t=e?.session.ui.previewColorScheme;return t==="light"||t==="dark"?t:null}function TC(e,t){for(let n of h){if(!n.iframe.isConnected){h.delete(n);continue}if(t&&!t.contains(n.iframe))continue;if(n.ready)n.channel.post({kind:"setColorScheme",scheme:e})}}function LC(e,t){let n=SL(e);for(let o of h){if(!o.iframe.isConnected){h.delete(o);continue}if(t&&!t.contains(o.iframe))continue;if(o.ready)o.channel.post({dir:n,kind:"setLocale",locale:e})}}function IC(e,t){let n=JSON.parse(JSON.stringify(e)),o=0;for(let r of h){if(!r.iframe.isConnected){h.delete(r);continue}if(r.ready)r.channel.post({base:t,doc:n,kind:"redefineElement"}),o+=1}return o}function RC(){let e=D?.projectConfig;if(!e)return;let t=JSON.parse(JSON.stringify(e.style??null)),n=JSON.parse(JSON.stringify(e.$media??{}));for(let o of h){if(!o.iframe.isConnected){h.delete(o);continue}if(o.ready&&!o.stylebook)o.channel.post({kind:"siteStyleUpdate",media:n,siteStyle:t})}}function Vb(e){let t=0,n=JSON.parse(JSON.stringify(e));for(let o of h){if(!o.iframe.isConnected){h.delete(o);continue}if(o.ready&&o.stylebook)o.channel.post({gen:o.lastRenderedGen,kind:"styleUpdate",style:n}),t+=1,Ie(o,o.selectionPaths)}return t}function $C(e){let t=Xn();if(!t?.stylebook||!t.ready)return;let n=t.stylebook.tagToCardPath.get(e);if(!n)return;t.selReqId+=1,t.panReqId=t.selReqId,t.channel.post({kind:"measure",paths:[[...n]],reqId:t.selReqId})}function Wa(){let e=E;if(!e||!e.iframe.isConnected)return{editing:!1,editingProp:null,snapshot:null};return{editing:e.editing,editingProp:e.editingProp,snapshot:e.snapshot}}var bt=null;function DC(e,t){bt=e,t?.(()=>On()),On()}function On(){let e=bt?.();if(!e)return;for(let t of h){if(!t.iframe.isConnected){h.delete(t);continue}if(t.ready)t.channel.post({chords:e.chords,kind:"keymap",mac:e.mac})}}function Cd(e){let t=E;if(!t||!t.ready)return;t.channel.post({intent:e,kind:"applyFormat"})}function AC(){let e=E;if(!e||!e.ready)return;e.channel.post({kind:"openSlash"})}function Ub(){let e=E;if(e?.editing&&e.ready&&e.iframe.isConnected)e.channel.post({kind:"endEdit"})}function Xn(){let e=Ut();return e?lC(e.canvas):null}function gx(){let e=E,t=e??Xn();if(!t)return null;let{rect:n,scale:o}=za(t),r=t===e?t.snapshot?.rect:null;if(r)return{height:r.height*o,left:r.x*o+n.left,top:r.y*o+n.top,width:r.width*o};if(t.lastSelectionRect)return{height:t.lastSelectionRect.height*o,left:t.lastSelectionRect.left*o+n.left,top:t.lastSelectionRect.top*o+n.top,width:t.lastSelectionRect.width*o};return null}
|
|
2
|
+
export{qo,st,Go,Xw,Tl,_o,Au,Ab,sm,ET,Qw,Nb,Ll,TT,LT,IT,ex,RT,$T,DT,AT,Co,Ob,tx,nx,bi,yd,NT,Il,wd,OT,ix,MT,Mb,PT,Pb,Nu,hr,FT,cp,jT,HT,ox,BT,rx,zT,sx,J1,Y1,ax,lx,Ou,WT,VT,Fb,us,xd,Mu,UT,qT,cx,Z1,GT,dx,ux,KT,jb,JT,X1,Q1,eC,YT,Hb,tC,hx,_d,wc,Bb,Pu,nC,am,iC,ZT,XT,px,QT,eL,tL,lm,oC,rC,sC,aC,lC,cm,dm,fx,za,cC,dC,um,l$,C$,uC,Rl,zb,Wb,hC,pC,fC,mC,gC,bC,vC,yC,wC,xC,_C,CC,mx,SC,hm,kC,EC,TC,LC,IC,RC,Vb,$C,Wa,DC,Cd,AC,Ub,gx};
|
|
3
|
+
|
|
4
|
+
//# debugId=F4B7A69DC158D16C64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-pvj970st.js.map
|