@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,5 +0,0 @@
|
|
|
1
|
-
import{f,et}from"./studio-jsv3s3s1.js";import{ge,ee,re,S}from"./studio-9rhmettf.js";import{Ke,Ji,Wu,Nl}from"./studio-7jazdy6y.js";import{WT,Te,us,Xb,q,Ns,Ki,Fu,aa,Ue,ju,on,ot,sv,vi,li,ke,Do,xC,oo,je,An,g,u,Bn,Tr,fp}from"./studio-ks7cksh0.js";import{Id,yi}from"./studio-de3p1ktm.js";import{at,rm,gc}from"./studio-8r4y2x0z.js";import{vv,Cp,Lm,Fl,Vr,so,Ur,zs,Yu,qa,Rm,YL,Qo,$d,$m,ne}from"./studio-sq1bn60g.js";import{da,mr,Ps,Fs,hs}from"./studio-b4epb26c.js";import{Di,CT,Ab,ST,cs,El,Nb,kT,y,hC}from"./studio-cktcdsxz.js";import{am,ip,lm}from"./studio-nptx0dbs.js";import{K,ro,ht,_n,Zo,Ba,D,qu,Gu,Ai}from"./studio-73czgk6a.js";import{He,gv}from"./studio-cnspfke5.js";import{We,Tp}from"./studio-as65vbns.js";import{Lv}from"./studio-5n1km79v.js";function yt(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 Zn=null;function Aw(){return Zn}function Uo(){return Ji(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 qo(e){return Bn(e)?.derived??null}function Dw(e){if(!e)return[];let t=[];for(let n of g.panes)if(st(n.id)?.id===e.id)t.push(Ji(n.id));return t}function _(e){for(let t of Wu()){let n=t.panels.find((o)=>o.canvas===e);if(n)return{panel:n,surface:t}}return null}function bt(e){let t=e.canvas,n=t?_(t):null;return n?st(n.surface.paneId):null}function _l(e){let t=e?.session.ui,n=t?.canvasMode??"design";return t?.preview&&(n==="edit"||n==="design")?"preview":n}function xo(e){let t=qo(e);if(t?.kind==="lens"){let n=t.mode;return st(e)?.session.ui?.preview&&(n==="edit"||n==="design")?"preview":n}return _l(st(e))}function Tu(e){let t=qo(e);if(t?.kind==="lens"&&t.preset==="breakpoint")return t.media;return st(e)?.session.ui.activeMedia??null}function wb(e){return Nl(e)?.paneId??An}function Zf(e){return st(wb(e))}var ce=new Set(["img","video","source","iframe","audio"]),ue="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Xn="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",Yn=/(src|poster|image|bg|background|icon|logo|photo|avatar|thumbnail|cover|banner)$/i;function Qn(e){return Yn.test(e)}var eo=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"]),to=new Set(["div","section","article","aside","header","footer","main","nav","figure","figcaption","details","fieldset","form","ul","ol","dl","table"]);function no(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(eo.has(We(e.tagName)))return"empty-text-placeholder";if(to.has(We(e.tagName)))return"empty-container-placeholder";return null}function Ie(e){return e.replaceAll(/\$\{([^}]+)\}/g,"❪ $1 ❫")}function io(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 io(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(Qn(c))l[c]=Xn;else if(c==="href"||c==="action")l[c]="";else l[c]=Ie(d);else if(d&&typeof d==="object"&&d.$ref){let p=d.$ref,m=p.startsWith("#/state/")?p.slice(8):p;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,p]of Object.entries(l))if(d==="src"||d==="poster")if(typeof p==="string"&&p!==""&&!p.includes("${"))c[d]=p;else o=!0,c[d]=ue;else if(typeof p==="string"&&p.includes("${")){let m=d==="href"||d==="action";c[d]=m?"":Ie(p)}else if(p&&typeof p==="object"&&p.$ref){let m=p.$ref,b=m.startsWith("#/state/")?m.slice(8):m;c[d]=`{${b}}`}else c[d]=p;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?"":Ie(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=no(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 ao=/\[\.\.\.(\w+)\]|\[(\w+)\]/g;function lo(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function xt(e){let t=lo(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(ao,(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 xb(e){if(!e)return"/";return xt(e).urlPattern}function Cl(e){if(!e)return[];return xt(e).params}function GE(e){let t=e.document?.$paths,n=e.frontmatter?.$paths;return t??n??null}var pe=new Map;function KE(){pe.clear()}function JE(e,t){if(!t)return Promise.resolve({});let n=`${e??""}::${JSON.stringify(t)}`,o=pe.get(n);if(!o)o=co(t).catch((r)=>(pe.delete(n),console.warn("page-params: failed to enumerate $paths values:",r),{})),pe.set(n,o);return o}async function co(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 po(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 f().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 uo(){let e=await Id();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 po(e){let t={$prototype:"ContentCollection",$src:await uo(),contentType:e},n=f();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 wt(e,t,n){if(Object.keys(t).length===0)return e;let o=De(e,t);return o.state??={},o.state.$page={params:{...t},title:typeof o.title==="string"?o.title:"",url:xb(n)},o}function Ct(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 Pt(e,t,n){if(t.length===0)return;let o=f();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 De(e,t){let n=fo(e,t);if(n!==null)return n;if(!e||typeof e!=="object")return e;if(Array.isArray(e))return e.map((r)=>De(r,t));let o={};for(let[r,i]of Object.entries(e))o[r]=De(i,t);return o}function fo(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 Nw(e){return typeof e?.tagName==="string"&&e.tagName.includes("-")}function St(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 YE(e){let t=e?.state??{},n=[];for(let[o,r]of Object.entries(t)){if(Tp(o))continue;let i=St(r);if(!i)continue;let s=i==="signal"?r.default:r;n.push({name:o,value:s})}return n}function Et(e,t){let n={...e.state??{}},o=!1;for(let[r,i]of Object.entries(t)){let s=St(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 Tt(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=Tt(r,[...t,"children",o]);if(i)return i}}}return null}function Je(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;Je(r,t,[...n,"children",o])}if(Array.isArray(e.$elements)){for(let[o,r]of e.$elements.entries())if(typeof r!=="string")Je(r,t,[...n,"$elements",o])}}async function Mt(e,t,n=null){let o={documentPath:t?.documentPath,mode:t?.doc.mode},r=n??_l(t),i=r==="preview"?structuredClone(re(e)):A(qu(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=El(e.$layout);if(w){let v=await Nb(w);if(v){Je(v,w.replace(/^\.\//,""));let C=r==="preview"?structuredClone(re(e)):i,x=kT(v,C);i=r==="preview"?x:A(qu(x)),s=!0;let T=Tt(x);l=T?.prefix??null,c=T?.offset??0}}}let d=ip(D?.projectRoot),p=o.documentPath?new URL(o.documentPath,d).href:void 0,m=lm(o.documentPath,{fileBaseUrl:d,...et()?{space:f().assetSpace}:{}});if(a&&t){let{previewParams:w}=t.session.ui;if(w&&Object.keys(w).length>0){let v=Ct(e.state??null);i=wt(i,w,o.documentPath),await Pt(i,v,p)}}if(!a&&t&&Nw(i)){let{previewProps:w}=t.session.ui;if(w&&Object.keys(w).length>0)i=Et(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=Ab(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(We(C.tagName));if(Array.isArray(C.children)){for(let T of C.children)if(typeof T!=="string")for(let Gn of v(T))x.add(Gn)}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=gc(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=CT(i.imports);let O=Di(i.$media);if(O===void 0)delete i.$media;else i.$media=O;let U=ST(i.$head);if(U===void 0)delete i.$head;else i.$head=U;return{assets:m,docBase:p,mapperCtx:{arrayPaths:[...b],canvasMode:r,layoutWrapped:s,pageContentOffset:c,pageContentPrefix:l},renderDoc:i,siteStyle:D?.projectConfig?.style??null}}var ZE="fullRender",XE="mountCanvas",QE="patchBatch",Rt="prepareRender",_o={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=_o;var Nt=new Map;function Ot(){try{return typeof localStorage<"u"&&Boolean(localStorage.getItem("jx-canvas-debug"))}catch{return!1}}function kt(){return typeof performance<"u"&&typeof performance.now==="function"?performance.now():0}function At(e,t){if(Ot())console.debug(`[jx-canvas] ${e}`,t??"")}function _b(e){_o.escalations+=1,_o.lastEscalationReason=e,At("escalation",e)}function mo(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 ho(e,t){let n=Number.isFinite(t)&&t>0?t:0,o=Nt.get(e);if(!o)o=[],Nt.set(e,o);if(o.push(n),o.length>128)o.shift();let r=_o.timings[e],i={count:(r?.count??0)+1,lastMs:n,maxMs:Math.max(r?.maxMs??0,n),p95Ms:mo(o),totalMs:(r?.totalMs??0)+n};if(_o.timings[e]=i,e==="fullRender")_o.lastFullRenderMs=i.lastMs,_o.p95FullRenderMs=i.p95Ms;At(`span:${e}`,`${n.toFixed(2)}ms`)}function $t(e){let t=kt(),n=Ot(),o=`jx-${e}-start`;if(n)try{performance.mark(o)}catch{}let r=!1;return()=>{if(r)return _o.timings[e]?.lastMs??0;r=!0;let i=kt()-t;if(n)try{performance.measure(`jx-${e}`,o),performance.clearMarks(o)}catch{}return ho(e,i),i}}function Ow(e,t){let n=$t(e);try{return t()}finally{n()}}async function Mw(e,t){let n=$t(e);try{return await t()}finally{n()}}function gi(e){if(e==="--")return"Base";return e.replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(t)=>t.toUpperCase())||e}var It=new Set(["script","style","link","iframe","object","embed"]);function pd(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 Le(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=Le(s,Math.max(0,t-r),Math.min(n,l)-r);if(c.length>0)o.push(go(i,c))}r=l}return o}function go(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 Dt(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 Ht(e,t,n,o,r=""){return Dt([...Le(e,0,t),...r?[r]:[],...Le(n,o,Y(n))])}function _e(e){let t=Dt(e);if(t.length===0)return{textContent:""};if(t.length===1&&typeof t[0]==="string")return{textContent:t[0]};return{children:t}}function vo(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 Jt(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)Ue(s,t,"textContent");Ue(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)Ue(s,t,"children");Ue(s,t,"textContent",o)},{coalesceKey:r.coalesceKey??null})}}function Lt(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)=>{ju(s,t,n,o)}),!0}function _t(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(Ba(t,n)||Ba(n,t))return null;let i=j(r),s=j(o),a=Y(i),l=_e([...i,...s]);return q(e,(c)=>{if(l.children){if(r.textContent!=null)Ue(c,n,"textContent");Ue(c,n,"children",l.children)}else{if(r.children)Ue(c,n,"children");Ue(c,n,"textContent",l.textContent??"")}if(Fu(c,t),jt(c,ht(t)),fp(e))c.session.selection=[n]}),{offset:a,path:n}}function jt(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(Fu(e,n),!i)return;n=i}}function qt(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)Ue(l,t,"children"),Ue(l,t,"textContent",n.textContent);else if(n.children)Ue(l,t,"textContent"),Ue(l,t,"children",n.children);if(Ki(l,r,i+1,a),fp(e))l.session.selection=[s]}),s}function Ft(e,t,n,o){if(vo(o)){if(!e)return t;return q(e,(l)=>{Ue(l,t,"tagName",n.tag),Ue(l,t,"children");let c=pd(n.tag);if(c.textContent&&c.textContent!=="Paragraph text")Ue(l,t,"textContent",c.textContent);else Ue(l,t,"textContent");if(fp(e))l.session.selection=[t]}),t}let r=ht(t),i=_n(t),s=[...r,"children",i+1];if(!e)return s;let a=pd(n.tag);return q(e,(l)=>{if(o?.children)Ue(l,t,"textContent"),Ue(l,t,"children",o.children);else if(o?.textContent!=null)Ue(l,t,"children"),Ue(l,t,"textContent",o.textContent);if(Ki(l,r,i+1,structuredClone(a)),fp(e))l.session.selection=[s]}),s}function Wt(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(Ba(t.path,n.path)||Ba(n.path,t.path))return null;let a=_e(Ht(j(i),t.offset,j(s),n.offset,r)),l=[...o,n.path].toSorted(yo);return q(e,(c)=>{if(a.children){if(i.textContent!=null)Ue(c,t.path,"textContent");Ue(c,t.path,"children",a.children)}else{if(i.children)Ue(c,t.path,"children");Ue(c,t.path,"textContent",a.textContent??"")}for(let d of l)if(K(c.doc.document,d))Fu(c,d),jt(c,ht(d));if(fp(e))c.session.selection=[t.path]}),{offset:t.offset+r.length,path:t.path}}function yo(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 eT(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 Vt(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,p="inside")=>wo(i,d,p),setHover:(d)=>fe(r,d),setInsertZone:(d,p="center")=>bo(s,d,p),setReplaceTarget:(d)=>fe(a,d),setSuppressed:(d)=>{t.style.display=d?"none":""},setCoSelection:(d)=>{c.replaceChildren();for(let p of d){let m=e.createElement("div");m.className="overlay-box overlay-selection overlay-coselection",fe(m,p),c.append(m)}},setPresence:(d)=>{l.replaceChildren();for(let p 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 ${p.color};outline-offset:1px;left:${p.placement.left}px;top:${p.placement.top}px;width:${p.placement.width}px;height:${p.placement.height}px`;let b=e.createElement("div");b.className="overlay-presence-tag",b.textContent=p.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:${p.color}`,m.append(b),l.append(m)}},setSelection:(d,p=null)=>{if(fe(n,d),d&&p)o.textContent=p,o.style.display="block";else o.style.display="none"}}}function bo(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 wo(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 Sl(e){return JSON.stringify(e)}var fd={$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 Po=new Set(["pre"]),Xi=new Set(Object.entries(fd.$defs).filter(([e,t])=>!Po.has(e)&&(t.$inlineChildren?.length??0)>0).map(([e])=>e));var Bt=new Set(["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"]);function qe(e,t){if(!t)return Bt.has(e);let n=fd.$defs[t];if(!n||!n.$inlineChildren)return!1;return n.$inlineChildren.includes(e)}function tT(e){let t=fd.$defs[e];if(!t)return null;let n=t.$inlineActions;if(typeof n==="string")n=fd.$defs[n]?.$inlineActions??void 0;if(!Array.isArray(n))return null;return n}var So=null;function Pw(e,t){if(!e||typeof e!=="object")return!1;let n=(We(e.tagName)||"div").toLowerCase();if(t){let o=(We(t.tagName)||"div").toLowerCase();return qe(n,o)}return Bt.has(n)}function nT(){return So!==null}function me(e){return!e||e==="base"?null:e}function Cb(e){let t=e.panels;if(t.length===0)return null;if(t.length===1)return t[0];let n=Tu(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 zt(){return Cb(Uo())}function iT(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=(We(o.tagName)||"div").toLowerCase(),a=(We(i.tagName)||"div").toLowerCase();if(!qe(s,a))break;n=r}return n}function Sb(e){return vv(e)!==null}function Lu(e){return vv(e)}function ur(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 Eo(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 Kt(e,t){let n=Eo(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 oT(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 ep=240,rT=8,sT=16,he=new Map;function Fe(e){return ur(Di(e.doc.document?.$media))}function Fw(e){let{baseWidth:t,sizeBreakpoints:n}=Fe(e),o=e.session.ui.activeMedia;return n.find((r)=>r.name===o)?.width??t}function To(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 aT(e,t){let n=t?Fw(t):0;return To(e.paneId,t)??n}function jw(e){he.delete(e)}function lT(e){let{baseWidth:t,sizeBreakpoints:n}=Fe(e);return[t,...n.map((o)=>o.width)]}function Hw(e,t,n){let{sizeBreakpoints:o}=Fe(t),r=Kt(o,n);return t.session.ui.activeMedia=r,he.set(e,{media:r,tabId:t.id,width:n}),r}var Ve={invokerTags:$m,popoverTags:$d};function S1(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"&&zs(r,Ve))return o}return null}function Ut(e,t){let n=e.doc.document;if(!n)return null;if(t){let o=K(n,t);return o&&typeof o==="object"&&zs(o,Ve)?t:null}return S1(n,Te(e.session.selection))}function Gt(){let e=u.value?.doc.document;return e?YL(e,Ve):!1}var Zt=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],Be=new Set(["show-modal","close","request-close"]),ze=new Set(["toggle-popover","show-popover","hide-popover"]),Mo=["any","closerequest","none"],No=new Set(["button"]),I="See docs/framework/concepts/overlays.";function H(e){return so(e)==="dialog"}function Xt(e){return e.startsWith("--")}function ko(e){let t=[];for(let{node:n}of qa(e)){let o=Yu(n);if(H(n)&&o!==null&&!t.includes(o))t.push(o)}return t}function Yt(e){for(let{node:t}of qa(e))if(H(t))return!0;return!1}function Ro(e){let t=e.oncommand;return t!==void 0&&t!==null}function Oo(e,t){for(let{node:n}of qa(e)){if(n===e)continue;let o=so(n);if(o==="button"){let r=Vr(n,"command"),i=Vr(n,"commandfor");if(r!==null&&(r==="close"||r==="request-close")&&(i===null||i===t))return!0}if(o==="form"&&Vr(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function qE(e,t){let n=[...qa(e,[],null,t)],o=ko(e),r=Rm(e,t),i=o.length>0||r.length>0,s=new Map,a=new Map;for(let{node:c}of n){let d=Yu(c);if(d!==null&&!s.has(d))s.set(d,c);if(so(c)==="button"){let p=Vr(c,"commandfor"),m=Vr(c,"command");if(p!==null){let b=a.get(p)??new Set;b.add(m??""),a.set(p,b)}}}let l=[];for(let{node:c,path:d}of n)if(l.push(...Ao(c,d,s,o,r,i,t)),H(c))l.push(...$o(c,d,a));return l}function Ao(e,t,n,o,r,i,s){let a=[],l=so(e),c=s?.invokerTags?.has(l)??!1,d=Vr(e,"command"),p=Vr(e,"commandfor");if(!(d!==null||p!==null||("command"in Fl(e))||("commandfor"in Fl(e))))return a;let b=Ur(e,"the element");if(!No.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&&!Zt.includes(d)&&!Xt(d))return a.push({detail:`\`command\` is an enumerated attribute taking ${Zt.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(p!==null){let M=n.get(p),R=o.includes(p),O=r.includes(p);if(!M&&i){let U=[...o,...r].map((w)=>`"${w}"`).join(", ");return a.push({detail:`No element in this document has the id "${p}". The dialogs and popovers here are: ${U}. A commandfor that names nothing does nothing, silently. ${I}`,message:`commandfor="${p}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(d!==null&&M){if(Be.has(d)&&!H(M))a.push({detail:`\`${d}\` acts on a <dialog>, and "${p}" is ${O?"a popover":`a <${so(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 "${p}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(ze.has(d)&&!zs(M,s))a.push({detail:`\`${d}\` acts on a popover, and "${p}" is ${R?"a dialog":`a <${so(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 "${p}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(Xt(d)&&!Ro(M))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${p}" 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 "${p}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function $o(e,t,n){let o=[],r=Ur(e,"the dialog"),i=Yu(e),{style:s}=e,a=Vr(e,"closedby");if(a!==null&&!Mo.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(Qo(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=Vr(e,"open")!==null||Fl(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"&&!Oo(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 k1(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 Bw(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 k1(n,Te(e.session.selection))}function Qt(){let e=u.value?.doc.document;return e?Yt(e):!1}function V(e){return st(e.paneId)}function Q(e){let t=qo(e.paneId);if(t?.kind==="lens")return t.zoom;return V(e)?.session.ui.zoom??1}function zw(e=Uo()){return Q(e)}function ve(e,t){let n=qo(e.paneId);if(n?.kind==="lens"){n.zoom=t;return}let o=V(e);if(o)o.session.ui.zoom=t}function Iu(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 cT(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 dT(e,t){let n=e.find((r)=>r.item.key===t);if(!n)return;let o=bt(n.panel);if(o)o.session.ui.activeMedia=me(n.item.mediaAttr)}function Xe(e){if(!e.panzoomWrap)return;let t=e.wrap.clientWidth,n=e.panzoomWrap.scrollWidth,o=Q(e),r=n*o;e.panX=Math.max(16,(t-r)/2),e.panY=0}function kb(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}Xe(e),as(e)}),e.centerObserver.observe(e.panzoomWrap),Xe(e)}function as(e){if(!e.panzoomWrap)return;let t=Q(e);e.panzoomWrap.style.transform=`translate(${e.panX}px, ${e.panY}px) scale(${t})`,Ai("overlays")}var Ye=0.25,Qe=3;function nn(e){return Math.min(Qe,Math.max(Ye,e))}function md(e=Uo()){if(xo(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`}Ai("overlays")}function Ru(e,t=Uo()){let n=V(t);if(!n)return;n.session.ui.editZoom=nn(e),md(t)}var Ge=new Map;function uT(e,t=Uo()){let n=V(t);if(!n)return;if(n.session.ui.editZoom=nn(e),Ge.has(t.paneId))return;Ge.set(t.paneId,requestAnimationFrame(()=>{Ge.delete(t.paneId),md(t)}))}function rn(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=Q(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),as(e)}function hT({maxZoom:e=W,surface:t=Uo()}={}){te("page",t),rn(t,"page",e)}var F=0.05,W=5;function nt(e){return Math.min(W,Math.max(F,e))}var Io="page",tt=["width","page","none"];function Ho(e,t,n){let o=t[n];if(typeof o==="string"&&tt.includes(o))return o;if(typeof o==="number"&&o>=F&&o<=W)return o;throw RangeError(`command "${e}" argument "${n}": expected ${tt.map((r)=>`"${r}"`).join(" | ")} or a number in [${F}, ${W}], got ${JSON.stringify(o)}`)}var an=new Map;function sn(e){let t=V(e);if(!t)return null;let n=qo(e.paneId)?.kind==="lens"?`::${e.paneId}`:"";return`${t.id}::${t.documentPath??""}${n}`}function te(e,t){let n=sn(t);if(n)an.set(n,e)}function Ww(e=Uo()){let t=sn(e);return(t===null?void 0:an.get(t))??Io}function ln(e,t=Uo()){let n=e??Ww(t);if(n==="none"){as(t);return}if(typeof n==="number"){ve(t,nt(n)),as(t);return}rn(t,n,1)}function E1(e,t=Uo()){te(e,t),ln(e,t)}function pT(e=Uo()){te(nt(Q(e)),e)}function Vw(e,t=Uo()){if(!V(t))return;let o=nt(e);te(o,t),ve(t,o),as(t)}function Uw(e){if(e.wrap.clientWidth<=0){as(e);return}ln(Ww(e),e)}function fT(e=Uo()){if(te(1,e),!e.panzoomWrap)return;ve(e,1),Xe(e),as(e)}function Jo(e,t){let n=He(cn(e)??e.wrap),o=t.top+t.height/2-n.top;return n.height/2-o}function cn(e){return Cb(e)?.scrollContainer??null}function Lo(e,t,n){let o=cn(e);if(!o){jo(e,t);return}let r=o.scrollTop-t;if(n){o.scrollTo({behavior:"smooth",top:r});return}o.scrollTop=r}function Eb(e,t=Uo()){Lo(t,Jo(t,e),!1)}function jo(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,as(e),l<1)requestAnimationFrame(s)};requestAnimationFrame(s)}var Ze=["edit","design","preview","source","stylebook","grid","git-diff"],ye=new Set(["edit","design"]),Fo=["edit","design","preview"];function Wo(e){return Fo.filter((t)=>e.capabilities.modes.includes(t))}function mT(e){return Wo(e).filter((t)=>t!=="preview")}function T1(e){let t=e.session.ui.canvasMode;return ye.has(t)?t:null}function L1(e){return{available:e.capabilities.modes.includes("preview")&&ye.has(e.session.ui.canvasMode),on:e.session.ui.preview===!0}}function I1(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 en=new Set(["design","stylebook","git-diff"]),k=(e)=>e.document.open,tn=["auto","light","dark"];function Vo(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:Do(Ze,"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",Ze),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",Ze),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 p=c.session.ui.canvasMode;if(!ye.has(p))throw RangeError(`command "canvas.setMode" argument "mode": "preview" composes with the edit and design base modes; this pane is in "${p}"`);c.session.ui.preview=!0;return}c.session.ui.preview=!1,e.setCanvasMode(c,l)},title:"Set Canvas Mode"},{args:ke({zoom:xC("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:()=>en.has(e.getCanvasMode()),run:(s,a)=>{t("canvas.setZoom"),Vw(sv("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:[...tt],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:()=>en.has(e.getCanvasMode()),run:(s,a)=>{t("canvas.setFit"),E1(Ho("canvas.setFit",a,"fit"))},title:"Set Fit"},{args:ke({zoom:xC("Edit-mode content zoom, 1 = 100%.",{maximum:Qe,minimum:Ye})}),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"),Ru(sv("canvas.setEditZoom",a,"zoom",Ye,Qe))},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){jw(i(a)),r(a);return}Hw(i(a),l,sv("canvas.setEditWidth",a,"width",ep,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(Di(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:Do(tn,"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",tn),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=cs();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:oo("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=vi("canvas.setLayoutVisible",a,"visible"),r(a)},title:"Show Layout Elements"},{args:ke({...o,open:oo("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:()=>Gt(),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:vi("canvas.setPopoverOpen",a,"open");if(!d&&c.path===void 0){e.setOpenPopover(l,null);return}let p=Ut(l,c.path);if(p===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?p:null)},title:"Show Popover",when:k},{args:ke({...o,open:oo("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:()=>Qt(),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:vi("canvas.setDialogOpen",a,"open");if(!d&&c.path===void 0){e.setOpenDialog(l,null);return}let p=Bw(l,c.path);if(p===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?p: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||vi("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:p}=a,m={...l.session.ui.previewProps};if(p===null||p===void 0)delete m[c];else m[c]=p;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=Cl(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 gT(e,t){e.registerAll(Vo(t))}function Tb(e=Uo()){let t=Tu(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 Bo(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 R1(e,t,n,o=document){let r=Bo(o);r.textContent=e,r.style.left=`${t}px`,r.style.top=`${n}px`,r.style.display="block"}function qw(e,t){if(!J||J.style.display==="none")return;J.style.left=`${e}px`,J.style.top=`${t}px`}function gd(){if(J)J.style.display="none"}var un=function(){if(typeof window>"u")return null;var e=new Image;return e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",e}();function mc(e){var t=e.nativeSetDragImage;if(t&&un)t(un,0,0)}function dn(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 pn(e,t){if(e==null)return{};var n,o,r=dn(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 fn(){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 mn(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 hn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mn(Object(n),!0).forEach(function(o){da(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mn(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Ko(e){return{x:(e.right+e.left)/2,y:(e.bottom+e.top)/2}}function rt(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 Go(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=rt({borderBox:a,client:s});return{type:l,indentPerLevel:r,currentLevel:o}}var c=Ko(a);if(i==="expanded"){var d=rt({borderBox:a,client:s});return{type:d==="reorder-above"?d:"make-child",indentPerLevel:r,currentLevel:o}}var p=r*o;if(s.x<a.left+p){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:rt({borderBox:a,client:s}),indentPerLevel:r,currentLevel:o}}function gn(e,t){if(e.type!==t.type)return!1;if(e.type==="instruction-blocked"&&t.type==="instruction-blocked")return gn(e.desired,t.desired);return be(e,t)}var Xo=fn(gn);function Yo(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 Lb(e,t){var n=t.block,o=pn(t,zo),r=Go(o),i=Yo({desired:r,block:n}),s=Xo(i);return hn(hn({},e),{},da({},xe,s))}function $u(e){var t;return(t=e[xe])!==null&&t!==void 0?t:null}var xe=Symbol("tree-item-instruction");function it(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 er(e,t){let n=we(e);if(n)return n;return e.path?{$ref:gc(t,e.path)}:null}function $1(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(gc(n,t.path));return e.some((i)=>{let s=it(i);return s!==null&&G(s)===r})}function G(e){return e.replace(/^(?:\.\/)+/,"")}function Xf(e,t,n){let o=er(t,n);if(!o)return[...e];let i=we(t)&&t.modulePath?e.filter((s)=>s!==t.package):[...e];return $1(i,t,n)?i:[...i,o]}function D1(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(gc(n,t.path));return e.filter((i)=>{let s=it(i);return s===null||G(s)!==r})}function bT(e,t){return e.filter((n)=>typeof n!=="string"||!(n===t||n.startsWith(`${t}/`)))}function vT(e,t){let n=G(t);return e.filter((o)=>{let r=it(o);return r===null||G(r)!==n})}async function Gw(e){Cp(!0);try{if(e.source==="npm"){if(!customElements.get(e.tagName))return lt(e.tagName)}else{if(e.path&&!e.path.endsWith(".json"))return lt(e.tagName);let n=D?.projectRoot,o=`${location.origin}/${n?`${n}/`:""}${e.path}`;await Lm(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),lt(e.tagName)}}function lt(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 tr='[part="outline"]',ct='[part="row"]',nr='[part="verbs"]',Ce=null;function yT(){if(Ce!==null)cancelAnimationFrame(Ce);for(let e of Ke.dndCleanups)e();Ke.dndCleanups=[],Ce=requestAnimationFrame(()=>{Ce=null;let e=Gu?.querySelector(tr);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=mr(hs({canDrag({element:l,input:c}){if(gv(c.clientX,c.clientY)?.closest(nr))return!1;return!0},element:n,getInitialData(){return{path:o,type:"tree-node"}},onGenerateDragPreview({nativeSetDragImage:l}){mc({nativeSetDragImage:l})},onDragStart(){if(n.dataset.dragging="",Ke.layerDragSourceHeight=n.offsetHeight,s)or(n,e)},onDrop(){if(delete n.dataset.dragging,s)Ai("leftPanel")}}),Ps({element:n,canDrop({source:l}){let c=l.data.path;if(c&&Ba(c,o))return!1;return!0},getData({input:l,element:c}){return Lb({path:o},{block:i?["make-child"]:[],currentLevel:r,element:c,indentPerLevel:16,input:l,mode:s?"expanded":"standard"})},onDragEnter({self:l}){vn(n,l.data,e)},onDrag({self:l}){vn(n,l.data,e)},onDrop(){oe(e)}}));Ke.dndCleanups.push(a)}let t=Fs({onDrop({source:n,location:o}){oe(e);let[r]=o.current.dropTargets;if(!r)return;let i=$u(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(Qf(u.value,i,s,a),c){let d=u.value,p=Te(d?.session.selection);if(p)Ke._layersCollapsed||=new Set,Ke._layersCollapsed.add(p.join("/"))}},onDropTargetChange({location:n}){let[o]=n.current.dropTargets;if(o&&!$u(o.data))oe(e)}});Ke.dndCleanups.push(t)})}function wT(){requestAnimationFrame(()=>{let e=Gu?.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))Gw(o).then((a)=>{r.textContent="",r.append(a)});let i=rm(o),s=hs({element:t,getInitialData(){return{fragment:structuredClone(i),type:"block"}},onGenerateDragPreview({nativeSetDragImage:a}){mc({nativeSetDragImage:a})}});Ke.dndCleanups.push(s)}})}function xT(){requestAnimationFrame(()=>{let e=Gu?.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(It.has(n)?"span":n);s.textContent=n,o.append(s)}let r=pd(n),i=hs({element:t,getInitialData(){return{fragment:structuredClone(r),type:"block"}},onGenerateDragPreview({nativeSetDragImage:s}){mc({nativeSetDragImage:s})}});Ke.dndCleanups.push(i)}})}function or(e,t){let n=`${e.dataset.value}/`,o=t.querySelectorAll(ct);for(let r of o)if(r.dataset.value?.startsWith(n))r.style.display="none"}function vn(e,t,n){let o=$u(t);if(Ke._currentDropTargetRow&&Ke._currentDropTargetRow!==e)delete Ke._currentDropTargetRow.dataset.drop;if(!o||o.type==="instruction-blocked"){oe(n);return}if(o.type==="make-child"){oe(n),e.dataset.drop="",Ke._currentDropTargetRow=e;return}delete e.dataset.drop,Ke._currentDropTargetRow=e;let r=[...n.querySelectorAll(ct)],i=r.indexOf(e),s=Ke.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(Ke._currentDropTargetRow)delete Ke._currentDropTargetRow.dataset.drop,Ke._currentDropTargetRow=null;let t=e.querySelectorAll(ct);for(let n of t)n.style.transform="",n.style.display=""}function Qf(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)=>aa(l,i,s,a));break}case"reorder-below":{q(e,(l)=>aa(l,i,s,a+1));break}case"make-child":{let l=K(r,o),c=ro(l).length;q(e,(d)=>aa(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)=>Ki(c,i,s,structuredClone(n.fragment)));break}case"reorder-below":{q(e,(c)=>Ki(c,i,s+1,structuredClone(n.fragment)));break}case"make-child":{let c=K(r,o),d=ro(c).length;q(e,(p)=>Ki(p,o,d,structuredClone(n.fragment)));break}default:break}let l=n.fragment?.tagName;if(We(l).includes("-")){let c=at.find((m)=>m.tagName===l),d=e.doc.document?.$elements??[],p=c?Xf(d,c,e.documentPath??null):d;if(p.length!==d.length)Ns(e,(m)=>{m.$elements=p})}}}function yn(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,kn=-1,Rn=0,rr=600;function A1(e){return kn===e&&Date.now()-Rn<=rr}var bn=0,On=new Set;function ir(e,t){let n;try{n=new URL(e,t.iframe.src||am())}catch{return}if(!["http:","https:","mailto:","tel:"].includes(n.protocol))return;let o=n.href,r=Aw();if(r){r(o);return}window.open(o,"_blank","noopener,noreferrer")}function N1(e){On.add(e)}function ar(e){return On.delete(e)}var L=new Map,Z=new Map,se=new Map,sr=300;function O1(e,t,n,o=sr){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);bn+=1;let i=bn,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 xn=0,X=new Map,lr=250;function M1(e,t=lr){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){xn+=1;let c=xn;a.push(c),X.set(c,s),se.set(c,l),l.channel.post({kind:"flushEdits",reqId:c})}})}function P1(e){return Re.get(e)??null}function em(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 tm(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 Kw(){return z}function Pa(e){let t=He(e.iframe),n=e.iframe.clientWidth>0?t.width/e.iframe.clientWidth:1;return{rect:t,scale:n}}function $n(e){if(e.stylebook)return"stylebook";return e.tabId??"unbound"}function F1(){let e=[];for(let t of h){if(!t.iframe.isConnected){h.delete(t);continue}let n=`canvas[${$n(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 cr=500,dr=2,pr=40;function In(){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 fr(e,t){let{rect:n,scale:o}=Pa(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)},cr);e.pendingMeasures.set(o,(i)=>{clearTimeout(r);let[s]=i;n(s?fr(e,s.rect):null)}),e.channel.post({kind:"measure",paths:[[...t]],reqId:o})})}function j1(e){let t=In();return t?Oe(t,e):Promise.resolve(null)}function hr(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>=dr||r>=pr){t();return}requestAnimationFrame(i)};requestAnimationFrame(i)})}async function nm(e){let t=In();return t?ER(t,e):null}async function ER(e,t){let n=await Oe(e,t);if(!n)return null;let o=_(e.canvasEl)?.surface;return Eb({height:n.height,top:n.top},o),await hr(e),Oe(e,t)}function BR(e,t){let n=P1(e);return n?Oe(n,t):Promise.resolve(null)}function gr(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 Dn(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",gr(e)}function ft(e,t){if(e.preview=t,e.overlay.setSuppressed(t),t)e.pendingEnterEdit=null;Dn(e)}function H1(e,t){ft(gt(e),t)}function kl(e,t){if(!e.iframe.isConnected)return;e.channel.post(t)}function Ib(e){ae.delete(e)}function Rb(e){e.overlay.setDropIndicator(null)}var Hn=null;function B1(e){Hn=e}var vr=300,Jn=null;function z1(e){Jn=e}var mt=null;function W1(e){mt=e}function yr(e,t,n){if((t?br(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 wn(e){e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(null)}function br(e){return e==="img"||e==="video"||e==="source"}function xr(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(),mt?.(P(r),[...o],null,null)})}var Ee=null;function V1(e){Ee=e}var Me=null;function U1(e){Me=e}var Ln=null;function q1(e){Ln=e}function Cn(e,t){let n=[...t];for(;;){let o=e.get(Sl(n));if(o)return o;if(n.length<2)return null;n=n.slice(0,-2)}}var E=null;function G1(){let e=E;return Boolean(e?.editing&&e.iframe.isConnected)}var Ne=null;function K1(e){Ne=e}var pt=null;function J1(e){pt=e}var Pn=null,jn=null;function Y1(e){jn=e}function Z1(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 X1(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 Jw(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){_b("host-stage-unresolved");continue}let i=r.renderGeneration,s=Ae?.host===o?Ae.paths:void 0;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,wr=0;function Sn(e,t,n){Ae={host:e,paths:t};try{n()}finally{Ae=null}}var ut=null,dt=null;function Cr(e,t,n){return!e&&t===n}function Pr(e,t){let n=P(e);if(!n)return;let o=K(n.doc.document,t);if(!o)return;Jw([{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 Q1(e){return P(e)}function Pe(e){let t=_(e.canvasEl)?.surface.paneId;if(t)Tr(t)}var Sr=Object.freeze([]);function Er(){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 Mr(){if(Pn)return;let e=ge(!0);e.run(()=>{ee(()=>{let t=Er();y.stylebook.selection;for(let n of h)$e(n,(n.tabId?t.get(n.tabId):null)??Sr)})}),Pn={stop:()=>e.stop()}}var En=!1,Se=null;function Nr(){if(En)return;En=!0,ge(!0).run(()=>{ee(()=>{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)qn(t)},100)})})}function qn(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 $e(e,t){if(e.stylebook){kr(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=us(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 kr(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 Tn(){return Lv("../canvas.html")}var Rr="about:blank";function Fn(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 Or(){if(!et())return Tn();let e=f();if(e.canvasUrl)return e.canvasUrl;return e.canvasUrlDeferred?Rr:Tn()}function im(e){let t=0;for(let n of new Set(h))if(e.contains(n.canvasEl))Fn(n),t+=1;return t}function gt(e){let t=Or(),n=Re.get(e);if(n){if(n.canvasUrl===t)return n;Fn(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=Vt(document);e.replaceChildren(s,l.root),xr(e,()=>P1(e));let c=yt({acceptOrigin:i,source:window,target:{postMessage:(p,m)=>s.contentWindow?.postMessage(p,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,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",(p)=>Ir(d,p)),l.insertButton.addEventListener("mouseenter",()=>{d.insertHover=!0,le(d)}),l.insertButton.addEventListener("mouseleave",()=>{d.insertHover=!1,Vn(d)}),c.onMessage((p)=>Hr(d,p)),Re.set(e,d),h.add(d),Mr(),Nr(),d}function Ar(e,t){le(e),e.insertZone=t,e.overlay.setInsertZone(N(t.rect),t.edge)}function Wn(e){le(e),e.insertZone=null,e.insertHover=!1,e.overlay.setInsertZone(null)}function $r(e){let t=e.overlay.insertButton;return e.insertHover||typeof t.matches==="function"&&t.matches(":hover")}function Vn(e){le(e),e.insertHideTimer=setTimeout(()=>{if(e.insertHideTimer=null,$r(e))return;Wn(e)},vr)}function le(e){if(e.insertHideTimer!==null)clearTimeout(e.insertHideTimer),e.insertHideTimer=null}function Ir(e,t){t.stopPropagation(),t.preventDefault();let n=e.insertZone;if(!n)return;Jn?.(e.overlay.insertButton,n)}var Dr=new Set(["contextMenu","dragOver","dropResult","editCommit","editCommitProp","editInsert","editMerge","editRangeReplace","editSplit","editStart","fileDragOver","fileDrop","hit","hover","insertZones","layoutHit","nativeDragEnter"]);function Hr(e,t){if(e.preview&&Dr.has(t.kind))return;switch(t.kind){case"ready":{e.ready=!0;let n=vt?.();if(n)e.channel.post({chords:n.chords,kind:"keymap",mac:n.mac});if(e.pending)e.channel.post(e.pending),e.pending=null;$e(e,e.selectionPaths);return}case"paneFocus":{Pe(e),pt?.();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(!zs(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(Be.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),pt?.(),hC(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=Cn(e.stylebook.pathToTag,t.hit.path);if(Ln?.(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?Xb(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(),hC(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,Ai("rightPanel");return}case"hover":{if(e.stylebook){let n=t.hit?Cn(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}jr(e,t.hit);return}case"insertZones":{if(e.stylebook)return;let n=t.zones?.[0]??null;if(n)Ar(e,n);else Vn(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}=Pa(e);Eb({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);Mn(e,t.gen);return}case"patchComplete":{e.pendingPatches=Math.max(0,e.pendingPatches-1),Mn(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,Ai("leftPanel");S.error("The page could not be rendered.",{detail:t.message,key:`canvas.render:${$n(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;Ai("leftPanel");return}case"contentHeight":{e.contentHeight=t.height,e.contentFragment=t.fragment,Dn(e);return}case"dragOver":{if(t.dragSeq!==z)return;if(t.cursor)kn=t.dragSeq,Rn=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=Pa(e);qw(t.cursor.x*n.scale+n.rect.left,t.cursor.y*n.scale+n.rect.top)}return}case"nativeDragEnter":{if(e.stylebook)return;Hn?.(e);return}case"dragEnd":{e.overlay.setDropIndicator(null),gd(),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)Qf(P(e),{type:t.instruction},n,t.targetPath)}ae.delete(t.dragSeq),e.overlay.setDropIndicator(null),gd();return}case"fileDragOver":{if(e.stylebook)return;yr(e,t.hit,t.preview);return}case"fileDragLeave":{wn(e);return}case"fileDrop":{if(wn(e),e.stylebook)return;mt?.(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)jn?.(n.paneId);return}case"forwardKey":{_r(t.event);return}case"forwardWheel":{Lr(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&&dt===Sl(t.path))ie(e,t.path,void 0,t.prop);dt=null,wr+=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=()=>Jt(P(e),t.path,t.children,t.textContent);if(t.inPlace)Sn(e,[t.path],n);else n();return}case"editCommitProp":{let n=()=>Lt(P(e),t.path,t.prop,t.value);if(t.inPlace){Sn(e,[t.path],n),ut=Sl(t.path);return}let o=n();if(Cr(o,ut,Sl(t.path)))Pr(e,t.path);ut=null,dt=o?Sl(t.path):null;return}case"editMerge":{let n=_t(P(e),t.fromPath,t.intoPath);if(n)ie(e,n.path,n.offset);return}case"editRangeReplace":{let n=Wt(P(e),t.from,t.to,t.between,t.text);if(n)ie(e,n.path,n.offset);return}case"editSplit":{ie(e,qt(P(e),t.path,t.before,t.after));return}case"editInsert":{ie(e,Ft(P(e),t.path,t.cmd,t.commitData));return}case"slashShow":{let{rect:n,scale:o}=Pa(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":{ir(t.href,e);return}case"contextMenu":{if(e.stylebook)return;Pe(e);let{rect:n,scale:o}=Pa(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 Mn(e,t){if(e.lastRenderedGen=t,$e(e,e.selectionPaths),qn(e),Wn(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===Zf(e.canvasEl)?.id)Jr(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 Jr(e,t,n,o){e.channel.post({kind:"enterEdit",path:[...t],...n===void 0?{}:{offset:n},...o===void 0?{}:{prop:o}})}function Lr(e,t){let{rect:n,scale:o}=Pa(e),r=Nl(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 _r(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 jr(e,t){if(!t||Zo(t.path,e.selectionPath)){e.overlay.setHover(null);return}e.overlay.setHover(N(t.rect))}var qr=4,B=new Map;function Fr(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<=qr)break;B.delete(o)}return n}function Wr(e,t,n,o,r,i=null){let s=Fr(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=ar(r),d=Mw(Rt,async()=>{_o.renderPreparations+=1;let p=await Mt(t,o,i),m=JSON.parse(JSON.stringify(p.renderDoc)),b=JSON.parse(JSON.stringify(t)),M=n?g.tabs.get(n)??null:null,R=yi(M?.doc.sourceFormat)?.studio?.elements,O=R?yn(R):void 0;return{assets:p.assets,doc:m,docBase:p.docBase??`${am()}/`,mapperCtx:p.mapperCtx,mode:p.mapperCtx.canvasMode,shadowDoc:b,siteStyle:p.siteStyle,...O?{editableTags:O}:{},...c?{allowAutoRequests:!0}:{}}});return s.set(t,{mode:i,payload:d,tabId:n,viewTabId:a}),d}async function eC(e,t,n,o,r=null,i=Zf(n),s=null,a=null){let l=gt(n);l.pendingTabIds.set(e,r),l.stylebook=null,l.iframe.style.width=o?`${o}px`:"100%";let d={...await Wr(e,t,r,i,wb(n),s),colorScheme:Kn(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,ft(l,d.mode==="preview"),zn(l,d)}function zn(e,t){if(_o.hostRenderPosts+=1,e.ready)e.channel.post(t);else e.pending=t}function tC(e,t,n,o){let r=gt(n);r.pendingTabIds.set(e,null),r.stylebook={pathToTag:t.pathToTag,tagToCardPath:t.tagToCardPath},ft(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:Kn(Zf(n)),doc:i,docBase:`${am()}/`,gen:e,kind:"render",mapperCtx:{arrayPaths:[],canvasMode:"stylebook",layoutWrapped:!1,pageContentOffset:null,pageContentPrefix:null},mode:"stylebook",shadowDoc:s,siteStyle:null};zn(r,a)}function Kn(e){let t=e?.session.ui.previewColorScheme;return t==="light"||t==="dark"?t:null}function nC(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 iC(e,t){let n=WT(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 oC(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 $b(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,$e(o,o.selectionPaths)}return t}function sC(e){let t=Un();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 Fa(){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 vt=null;function aC(e,t){vt=e,t?.(()=>Nn()),Nn()}function Nn(){let e=vt?.();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 bd(e){let t=E;if(!t||!t.ready)return;t.channel.post({intent:e,kind:"applyFormat"})}function lC(){let e=E;if(!e||!e.ready)return;e.channel.post({kind:"openSlash"})}function Db(){let e=E;if(e?.editing&&e.ready&&e.iframe.isConnected)e.channel.post({kind:"endEdit"})}function Un(){let e=zt();return e?P1(e.canvas):null}function Yw(){let e=E,t=e??Un();if(!t)return null;let{rect:n,scale:o}=Pa(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{Uo,st,qo,Dw,_l,xo,Tu,wb,Zf,qE,Aw,xb,Cl,GE,KE,JE,Nw,YE,ZE,XE,QE,_o,_b,Ow,Mw,gi,pd,eT,Sl,fd,tT,Pw,nT,Cb,iT,Sb,Lu,ur,oT,ep,rT,sT,Fw,aT,jw,lT,Hw,S1,k1,Bw,zw,Iu,cT,dT,kb,as,md,Ru,uT,hT,Ww,E1,pT,Vw,Uw,fT,Eb,mT,T1,L1,I1,gT,Tb,R1,qw,gd,mc,Lb,$u,$1,Xf,D1,bT,vT,Gw,yT,wT,xT,Qf,A1,N1,O1,M1,P1,em,tm,Kw,Pa,F1,j1,nm,ER,BR,H1,kl,Ib,Rb,B1,z1,W1,V1,U1,q1,G1,K1,J1,Y1,Z1,X1,Jw,Q1,im,eC,tC,nC,iC,oC,rC,$b,sC,Fa,aC,bd,lC,Db,Yw};
|
|
3
|
-
|
|
4
|
-
//# debugId=F12F9317334CA6AD64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-vwz7rma2.js.map
|