@jxsuite/studio 6.0.0 → 6.1.1

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.
Files changed (208) hide show
  1. package/dist/chunks/2020-va2wwra4.js +4 -0
  2. package/dist/chunks/adapter-f93pafd7.js +4 -0
  3. package/dist/chunks/{cf-account-picker-bb2yq946.js → cf-account-picker-af1h381v.js} +3 -3
  4. package/dist/chunks/cf-settings-125tdm0w.js +4 -0
  5. package/dist/chunks/components-ax2f1fnn.js +4 -0
  6. package/dist/chunks/content-source-108aqtk1.js +4 -0
  7. package/dist/chunks/{convert-to-repeater-vqkt7s3s.js → convert-to-repeater-ry5rmppr.js} +3 -3
  8. package/dist/chunks/editor-pfgdmkb0.js +4 -0
  9. package/dist/chunks/entry-commands-t0k1q0kx.js +4 -0
  10. package/dist/chunks/{extension-sections-8beq9ac3.js → extension-sections-6mwh2hf8.js} +3 -3
  11. package/dist/chunks/file-ops-meej5mqf.js +4 -0
  12. package/dist/chunks/files-44vp8a2s.js +4 -0
  13. package/dist/chunks/format-host-7q1petb9.js +4 -0
  14. package/dist/chunks/fs-events-h2mwnxaz.js +4 -0
  15. package/dist/chunks/git-panel-zngbymvd.js +4 -0
  16. package/dist/chunks/{grid-view-ca10def6.js → grid-view-sx9vynsp.js} +15 -15
  17. package/dist/chunks/icons-p44xhjf0.js +4 -0
  18. package/dist/chunks/iframe-host-qk3ycq87.js +4 -0
  19. package/dist/chunks/{index-9ydfe04y.js → index-2veqmnhr.js} +3 -3
  20. package/dist/chunks/index-wkyfjeqz.js +4 -0
  21. package/dist/chunks/{javascript-d9pqgc2p.js → javascript-8nbvs12s.js} +3 -3
  22. package/dist/chunks/jsonMode-s8kt9dsj.js +13 -0
  23. package/dist/chunks/jx-validate-psgd7vsx.js +4 -0
  24. package/dist/chunks/layers-panel-1kq2jyfk.js +4 -0
  25. package/dist/chunks/layers-xd92fg8d.js +4 -0
  26. package/dist/chunks/lit-html-ac4cwwr4.js +4 -0
  27. package/dist/chunks/media-picker-0svzkdyb.js +4 -0
  28. package/dist/chunks/menu-5c55ea3d.js +4 -0
  29. package/dist/chunks/{monaco-binding-62dtmgbf.js → monaco-binding-z6r70pdt.js} +3 -3
  30. package/dist/chunks/monaco-buffer-fz6gq5y7.js +4 -0
  31. package/dist/chunks/monaco-setup-q4axkgj7.js +4 -0
  32. package/dist/chunks/notify-0xgtn8q1.js +4 -0
  33. package/dist/chunks/platform-v1qctbe6.js +4 -0
  34. package/dist/chunks/publish-panel-ym1fmgq5.js +4 -0
  35. package/dist/chunks/quick-search-a54e6t5n.js +4 -0
  36. package/dist/chunks/references-gmqp82fs.js +4 -0
  37. package/dist/chunks/right-panel-v7t9awbk.js +4 -0
  38. package/dist/chunks/section-registry-vhyf3zsr.js +4 -0
  39. package/dist/chunks/studio-0bhx5hz6.js +5 -0
  40. package/dist/chunks/studio-0k1ddnyy.js +6 -0
  41. package/dist/chunks/studio-1b04pd0j.js +64 -0
  42. package/dist/chunks/{studio-sxc0zvpt.js → studio-1q1sh2ax.js} +3 -3
  43. package/dist/chunks/studio-4dwbj6gb.js +5 -0
  44. package/dist/chunks/studio-4tanh828.js +5 -0
  45. package/dist/chunks/{studio-fqq890ap.js → studio-55h4mstj.js} +3 -3
  46. package/dist/chunks/studio-5tnvjkz4.js +5 -0
  47. package/dist/chunks/studio-60dqgb0c.js +5 -0
  48. package/dist/chunks/studio-61dp09qg.js +9 -0
  49. package/dist/chunks/studio-63epcrj2.js +5 -0
  50. package/dist/chunks/studio-74k29dy9.js +5 -0
  51. package/dist/chunks/{studio-qa73881a.js → studio-7vg6jcd3.js} +4 -4
  52. package/dist/chunks/studio-7zx31knw.js +9 -0
  53. package/dist/chunks/studio-8bxk97km.js +5 -0
  54. package/dist/chunks/{studio-edbtvcd1.js → studio-8grwxtqk.js} +4 -4
  55. package/dist/chunks/studio-933e30n4.js +5 -0
  56. package/dist/chunks/{studio-rr4xkv81.js → studio-98wnwhbg.js} +4 -4
  57. package/dist/chunks/studio-9mccjwjh.js +14 -0
  58. package/dist/chunks/studio-a2ke1e4t.js +5 -0
  59. package/dist/chunks/studio-e3a2a6v3.js +4 -0
  60. package/dist/chunks/{studio-pwqfmt4p.js → studio-e81q1vb9.js} +4 -4
  61. package/dist/chunks/{studio-7pgy3xaf.js → studio-epgrmqqm.js} +4 -4
  62. package/dist/chunks/studio-g1shz58g.js +5 -0
  63. package/dist/chunks/studio-gf0fz03c.js +5 -0
  64. package/dist/chunks/studio-gjtpe62q.js +6 -0
  65. package/dist/chunks/{studio-tzegmy4w.js → studio-gkskhg7m.js} +4 -4
  66. package/dist/chunks/studio-gx4dnjzd.js +5 -0
  67. package/dist/chunks/{studio-8xcwewjq.js → studio-h46vtzk8.js} +4 -4
  68. package/dist/chunks/studio-j03zga3y.js +9 -0
  69. package/dist/chunks/{studio-4r0sjtx8.js → studio-jhpxeckz.js} +4 -4
  70. package/dist/chunks/{studio-zd4kayn2.js → studio-k01r7ykp.js} +4 -4
  71. package/dist/chunks/{studio-03wwfvyt.js → studio-kggey1jt.js} +4 -4
  72. package/dist/chunks/{studio-hnvnfbdv.js → studio-kk7h30ne.js} +6 -6
  73. package/dist/chunks/{studio-01qza1n3.js → studio-kt1zqney.js} +4 -4
  74. package/dist/chunks/{studio-r3kaka4d.js → studio-m3cwhvye.js} +4 -4
  75. package/dist/chunks/{studio-evwgp1ym.js → studio-mcayt6hz.js} +4 -4
  76. package/dist/chunks/{studio-5vy2wfm5.js → studio-myjcghv3.js} +4 -4
  77. package/dist/chunks/studio-n8bxwc3y.js +4 -0
  78. package/dist/chunks/{studio-ztvcxm3w.js → studio-ngm8gvpb.js} +4 -4
  79. package/dist/chunks/{studio-01kbbqg3.js → studio-nj5a01jy.js} +196 -196
  80. package/dist/chunks/{studio-xkfs0dp2.js → studio-pcgz8heb.js} +4 -4
  81. package/dist/chunks/{studio-0bbxhhce.js → studio-pre0skq6.js} +4 -4
  82. package/dist/chunks/{studio-n78gjfy8.js → studio-qcsq0t15.js} +4 -4
  83. package/dist/chunks/studio-qkstvve9.js +5 -0
  84. package/dist/chunks/studio-qv1pwd3c.js +5 -0
  85. package/dist/chunks/{studio-rmn2dz59.js → studio-rc6dvxjb.js} +5 -5
  86. package/dist/chunks/{studio-st75kn99.js → studio-rv11kfwa.js} +7 -7
  87. package/dist/chunks/studio-s8dmmz66.js +5 -0
  88. package/dist/chunks/studio-sp5xzbj4.js +6 -0
  89. package/dist/chunks/{studio-tmeq6mjb.js → studio-szsjbj0g.js} +4 -4
  90. package/dist/chunks/studio-t1xzawhr.js +16 -0
  91. package/dist/chunks/{studio-mk00zd5d.js → studio-t6b6qe31.js} +4 -4
  92. package/dist/chunks/{studio-bftp4n4b.js → studio-tdcprbqb.js} +4 -4
  93. package/dist/chunks/{studio-ge5fqjth.js → studio-vrmcjf9g.js} +5 -5
  94. package/dist/chunks/studio-vyc0b4he.js +10 -0
  95. package/dist/chunks/{studio-semd1s8s.js → studio-w0cgf6jg.js} +4 -4
  96. package/dist/chunks/{studio-gp02nqnw.js → studio-w3hskzqk.js} +4 -4
  97. package/dist/chunks/{studio-1wvfxkyy.js → studio-wszjyh0j.js} +4 -4
  98. package/dist/chunks/studio-xgrgcdyh.js +9 -0
  99. package/dist/chunks/{studio-y7jehjrp.js → studio-xz2yxfcb.js} +4 -4
  100. package/dist/chunks/{studio-aje966s9.js → studio-y6n42tgs.js} +4 -4
  101. package/dist/chunks/{studio-yr04mv2j.js → studio-yb560vxr.js} +4 -4
  102. package/dist/chunks/{studio-tp642n5g.js → studio-yn9f8vtx.js} +4 -4
  103. package/dist/chunks/studio-yw05w8f0.js +7 -0
  104. package/dist/chunks/{studio-cbr9czkn.js → studio-z16sgavc.js} +4 -4
  105. package/dist/chunks/studio-zey7zsdw.js +12 -0
  106. package/dist/chunks/{studio-1q6amtph.js → studio-zyqn40w4.js} +4 -4
  107. package/dist/chunks/tsMode-2frah6h1.js +14 -0
  108. package/dist/chunks/workspace-zt81g1ms.js +4 -0
  109. package/dist/chunks/ws-client-n2bh4hkf.js +4 -0
  110. package/dist/iframe-entry.js +13 -13
  111. package/dist/manifest.json +62 -62
  112. package/dist/studio.js +87 -87
  113. package/dist/workers/ts.worker.js +3 -3
  114. package/package.json +10 -10
  115. package/src/canvas/canvas-render.ts +4 -1
  116. package/src/canvas/canvas-utils.ts +73 -15
  117. package/src/canvas/iframe-host.ts +67 -21
  118. package/src/canvas/iframe-inline-edit.ts +22 -4
  119. package/src/canvas/iframe-interaction.ts +7 -1
  120. package/src/canvas/iframe-protocol.ts +3 -0
  121. package/src/canvas/iframe-render.ts +5 -2
  122. package/src/commands/defaults.ts +4 -1
  123. package/src/commands/live-context.ts +3 -1
  124. package/src/editor/shortcuts.ts +55 -27
  125. package/src/files/media-paths.ts +3 -1
  126. package/src/new-project/add-repo-modal.ts +459 -59
  127. package/src/panels/editors.ts +3 -1
  128. package/src/panels/style-panel.ts +36 -11
  129. package/src/platforms/cloud.ts +95 -18
  130. package/src/platforms/devserver.ts +47 -12
  131. package/src/publish/pages-service.ts +7 -0
  132. package/src/publish/publish-panel.ts +16 -2
  133. package/src/studio.ts +14 -2
  134. package/src/surfaces/add-repo.json +721 -224
  135. package/src/surfaces/add-repo.ts +196 -31
  136. package/src/surfaces/library-pane.ts +6 -0
  137. package/src/surfaces/rail.json +126 -73
  138. package/src/surfaces/rail.ts +31 -5
  139. package/src/tabs/typing.ts +31 -0
  140. package/src/types.ts +42 -3
  141. package/src/utils/edit-display.ts +30 -1
  142. package/src/utils/project-dir.ts +24 -0
  143. package/src/workspace/workspace.ts +7 -0
  144. package/dist/chunks/2020-cs2sb9t1.js +0 -4
  145. package/dist/chunks/adapter-y5gdq19c.js +0 -4
  146. package/dist/chunks/cf-settings-20dznc3j.js +0 -4
  147. package/dist/chunks/components-q037dya7.js +0 -4
  148. package/dist/chunks/content-source-t0q184js.js +0 -4
  149. package/dist/chunks/editor-j5sq149q.js +0 -4
  150. package/dist/chunks/entry-commands-fxzgcc4k.js +0 -4
  151. package/dist/chunks/file-ops-2n77759h.js +0 -4
  152. package/dist/chunks/files-fjy7zpxt.js +0 -4
  153. package/dist/chunks/format-host-wj3mf3n8.js +0 -4
  154. package/dist/chunks/fs-events-7kcgn4e9.js +0 -4
  155. package/dist/chunks/git-panel-7z2mpt2d.js +0 -4
  156. package/dist/chunks/icons-qbh8akb1.js +0 -4
  157. package/dist/chunks/iframe-host-a0zjd6xp.js +0 -4
  158. package/dist/chunks/index-m0x5ztax.js +0 -4
  159. package/dist/chunks/jsonMode-800yvbem.js +0 -13
  160. package/dist/chunks/jx-validate-zc9zp77s.js +0 -4
  161. package/dist/chunks/layers-p677nrh5.js +0 -4
  162. package/dist/chunks/layers-panel-y4w1dq90.js +0 -4
  163. package/dist/chunks/lit-html-cfn61dn7.js +0 -4
  164. package/dist/chunks/media-picker-xg7yjpz9.js +0 -4
  165. package/dist/chunks/menu-fpekzj6w.js +0 -4
  166. package/dist/chunks/monaco-buffer-nn4dtx27.js +0 -4
  167. package/dist/chunks/monaco-setup-tj13ndtm.js +0 -4
  168. package/dist/chunks/notify-ahs57a2z.js +0 -4
  169. package/dist/chunks/platform-v9xyfkbx.js +0 -4
  170. package/dist/chunks/publish-panel-xtbfgg2r.js +0 -4
  171. package/dist/chunks/quick-search-d3a6m7j3.js +0 -4
  172. package/dist/chunks/references-99ws0b0m.js +0 -4
  173. package/dist/chunks/right-panel-31vbk5xp.js +0 -4
  174. package/dist/chunks/section-registry-b2yzp9sw.js +0 -4
  175. package/dist/chunks/studio-1a99w39s.js +0 -5
  176. package/dist/chunks/studio-3ck2a5c4.js +0 -10
  177. package/dist/chunks/studio-4fde4a0x.js +0 -5
  178. package/dist/chunks/studio-4jj9gme2.js +0 -6
  179. package/dist/chunks/studio-4m50vh74.js +0 -16
  180. package/dist/chunks/studio-4xppwncr.js +0 -4
  181. package/dist/chunks/studio-5d7wfmnp.js +0 -5
  182. package/dist/chunks/studio-5e9zsamh.js +0 -9
  183. package/dist/chunks/studio-5gs9th4b.js +0 -5
  184. package/dist/chunks/studio-7qvs7v0m.js +0 -5
  185. package/dist/chunks/studio-84rtc120.js +0 -5
  186. package/dist/chunks/studio-aekhcdzw.js +0 -7
  187. package/dist/chunks/studio-aqmph6k4.js +0 -5
  188. package/dist/chunks/studio-c6zdm25z.js +0 -9
  189. package/dist/chunks/studio-capk0583.js +0 -9
  190. package/dist/chunks/studio-chdmwwzw.js +0 -5
  191. package/dist/chunks/studio-cp1gbff9.js +0 -14
  192. package/dist/chunks/studio-cqmtbg2p.js +0 -5
  193. package/dist/chunks/studio-e47215hh.js +0 -5
  194. package/dist/chunks/studio-fbx6twps.js +0 -6
  195. package/dist/chunks/studio-fthwn4kf.js +0 -5
  196. package/dist/chunks/studio-g8dsj3d2.js +0 -6
  197. package/dist/chunks/studio-gjknvzam.js +0 -9
  198. package/dist/chunks/studio-hjbg8d5y.js +0 -12
  199. package/dist/chunks/studio-nbxqcgvf.js +0 -5
  200. package/dist/chunks/studio-t1eedsyx.js +0 -4
  201. package/dist/chunks/studio-vavmwshr.js +0 -5
  202. package/dist/chunks/studio-x5g1xk77.js +0 -5
  203. package/dist/chunks/studio-x92tgnee.js +0 -64
  204. package/dist/chunks/studio-xg1942as.js +0 -5
  205. package/dist/chunks/studio-zev8ssp1.js +0 -5
  206. package/dist/chunks/tsMode-k9s9fcag.js +0 -14
  207. package/dist/chunks/workspace-5vmgsagj.js +0 -4
  208. package/dist/chunks/ws-client-0ja08haa.js +0 -4
@@ -1,5 +0,0 @@
1
- import{p,We}from"./studio-y7jehjrp.js";import{ge,Q,re,k}from"./studio-fqq890ap.js";import{Je,Yi,Ju,jl}from"./studio-7pgy3xaf.js";import{gL,Le,ms,uv,q,Hs,Ji,Vu,pa,Ue,Uu,xn,ot,yv,yi,li,Se,Do,qC,oo,He,Qn,m,u,Hn,$r,Cp}from"./studio-x5g1xk77.js";import{Pd,wi}from"./studio-cqmtbg2p.js";import{st,um,xc}from"./studio-pwqfmt4p.js";import{jC,Rd}from"./studio-xkfs0dp2.js";import{Dv,$p,Mm,Wl,Kr,ro,Jr,Gs,nh,Ya,Fm,wI,Qo,jd,jm,ne}from"./studio-cp1gbff9.js";import{ga,gr,zs,Ws,gs}from"./studio-st75kn99.js";import{Di,JT,Vb,YT,ps,$l,Ub,ZT,y,OC}from"./studio-4m50vh74.js";import{pm,hp,fm}from"./studio-5d7wfmnp.js";import{K,_o,ht,_n,Yo,qa,D,Xu,Qu,Ai}from"./studio-tp642n5g.js";import{Oe,Rv}from"./studio-vavmwshr.js";import{qe,Mp}from"./studio-nbxqcgvf.js";import{zv}from"./studio-edbtvcd1.js";function xt(e){let{target:t,source:n,targetOrigin:o,acceptOrigin:r,token:i}=e,s=new Set,a=(l)=>{if(r!=="*"&&l.origin!==r)return;let c=l.data;if(!c||typeof c!=="object"||c["jx:canvas"]!==i)return;for(let d of s)d(c.payload)};return n.addEventListener("message",a),{dispose(){s.clear(),n.removeEventListener("message",a)},onMessage(l){return s.add(l),()=>s.delete(l)},post(l){t.postMessage({["jx:canvas"]:i,payload:l},o)}}}var Yn=null;function Qw(){return Yn}function Uo(){return Yi(m.activePaneId)}function lt(e){let t=Hn(e),n=t?.derived,o=n?.kind==="lens"?Hn(n.sourcePaneId)?.activeTabId:t?.activeTabId;return o?m.tabs.get(o)??null:null}function ur(e){return Hn(e)?.derived??null}function Xw(e){if(!e)return[];let t=[];for(let n of m.panes)if(lt(n.id)?.id===e.id)t.push(Yi(n.id));return t}function _(e){for(let t of Ju()){let n=t.panels.find((o)=>o.canvas===e);if(n)return{panel:n,surface:t}}return null}function wt(e){let t=e.canvas,n=t?_(t):null;return n?lt(n.surface.paneId):null}function Tl(e){let t=e?.session.ui,n=t?.canvasMode??"design";return t?.preview&&(n==="edit"||n==="design")?"preview":n}function wo(e){let t=ur(e);if(t?.kind==="lens"){let n=t.mode;return lt(e)?.session.ui?.preview&&(n==="edit"||n==="design")?"preview":n}return Tl(lt(e))}function Nu(e){let t=ur(e);if(t?.kind==="lens"&&t.preset==="breakpoint")return t.media;return lt(e)?.session.ui.activeMedia??null}function $b(e){return jl(e)?.paneId??Qn}function im(e){return lt($b(e))}var ce=new Set(["img","video","source","iframe","audio"]),ue="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",eo="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32'%3E%3Crect%20width='32'%20height='32'%20fill='%23d0d0d0'/%3E%3C/svg%3E",to=/(src|poster|image|bg|background|icon|logo|photo|avatar|thumbnail|cover|banner)$/i;function no(e){return to.test(e)}var io=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"]),ao=new Set(["div","section","article","aside","header","footer","main","nav","figure","figcaption","details","fieldset","form","ul","ol","dl","table"]);function so(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(io.has(qe(e.tagName)))return"empty-text-placeholder";if(ao.has(qe(e.tagName)))return"empty-container-placeholder";return null}function De(e){return e.replaceAll(/\$\{([^}]+)\}/g,"❪ $1 ❫")}function lo(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 lo(e);let t=e,n={},o=!1,r=ce.has(t.tagName||"");if(r){let{attributes:s,src:a}=t,l=s?.src,c=t.poster,d=s?.poster;if(!(a&&a!==""||l&&l!=="")&&!(c&&c!==""||d&&d!==""))o=!0}for(let[s,a]of Object.entries(t))if(s==="state"||s==="$media"||s==="$elements")n[s]=a;else if(s==="$props"&&a&&typeof a==="object"){let l={};for(let[c,d]of Object.entries(a))if(typeof d==="string"&&d.includes("${"))if(no(c))l[c]=eo;else if(c==="href"||c==="action")l[c]="";else l[c]=De(d);else if(d&&typeof d==="object"&&d.$ref){let f=d.$ref,h=f.startsWith("#/state/")?f.slice(8):f;l[c]=`{${h}}`}else l[c]=d;n[s]=l}else if(s==="children")if(Array.isArray(a))n.children=a.map((l)=>A(l));else if(a&&typeof a==="object"&&a.$prototype==="Array")n.children=[A(a)];else n.children=A(a);else if(s==="cases"&&t.$switch&&a&&typeof a==="object"){let l=Object.keys(a);if(l.length>0){let c=a[l[0]];n.children=c&&typeof c==="object"&&!c.$ref?[A(c)]:[{style:{background:"color-mix(in srgb, var(--danger) 8%, transparent)",border:"1px dashed color-mix(in srgb, var(--danger) 40%, transparent)",borderRadius:"4px",color:"var(--danger)",fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', monospace",fontSize:"11px",fontStyle:"italic",padding:"6px 10px"},tagName:"div",textContent:`[$switch: ${l.join(" | ")}]`}]}}else if(s==="attributes"&&r&&a&&typeof a==="object"){let l=a,c={};for(let[d,f]of Object.entries(l))if(d==="src"||d==="poster")if(typeof f==="string"&&f!==""&&!f.includes("${"))c[d]=f;else o=!0,c[d]=ue;else if(typeof f==="string"&&f.includes("${")){let h=d==="href"||d==="action";c[d]=h?"":De(f)}else if(f&&typeof f==="object"&&f.$ref){let h=f.$ref,b=h.startsWith("#/state/")?h.slice(8):h;c[d]=`{${b}}`}else c[d]=f;n.attributes=c}else if(s==="style")if(a&&typeof a==="object"){let l={};for(let[c,d]of Object.entries(a))if(typeof d!=="string"||!d.includes("${"))l[c]=d;n.style=l}else n.style=a;else if(typeof a==="string"&&a.includes("${"))if((s==="src"||s==="poster")&&ce.has(t.tagName||""))o=!0,n[s]=ue;else{let c=s==="src"||s==="href"||s==="poster"||s==="action";n[s]=c?"":De(a)}else if(a&&typeof a==="object"&&a.$ref){let l=a.$ref,c=l.startsWith("#/state/")?l.slice(8):l;if((s==="src"||s==="poster")&&ce.has(t.tagName||""))o=!0,n[s]=ue;else n[s]=`{${c}}`}else if((s==="src"||s==="poster")&&a===""&&ce.has(t.tagName||""))o=!0,n[s]=ue;else n[s]=A(a);let i=so(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 co=/\[\.\.\.(\w+)\]|\[(\w+)\]/g;function uo(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function Ct(e){let t=uo(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(co,(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 Db(e){if(!e)return"/";return Ct(e).urlPattern}function Ll(e){if(!e)return[];return Ct(e).params}function yT(e){let t=e.document?.$paths,n=e.frontmatter?.$paths;return t??n??null}var pe=new Map;function wT(){pe.clear()}function xT(e,t){if(!t)return Promise.resolve({});let n=`${e??""}::${JSON.stringify(t)}`,o=pe.get(n);if(!o)o=po(t).catch((r)=>(pe.delete(n),console.warn("page-params: failed to enumerate $paths values:",r),{})),pe.set(n,o);return o}async function po(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 mo(e.contentType),r={[t]:[]};if(!Array.isArray(o))return r;for(let i of o)de(r,t,n==="id"?i.id:i.data?.[n]??i.id);return r}if("values"in e&&Array.isArray(e.values)){let t=e.param??"value",n={[t]:[]};for(let o of e.values)de(n,t,o);return n}if("$ref"in e&&typeof e.$ref==="string"&&e.$ref){let t=e.param??"id",n=e.field??"id",o=await p().readFile(e.$ref.replace(/^\.\//,"")),r=JSON.parse(o),i={[t]:[]};if(!Array.isArray(r))return i;for(let s of r)de(i,t,s?.[n]??s?.id??s);return i}return{}}async function fo(){let e=await Pd();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 mo(e){let t={$prototype:"ContentCollection",$src:await fo(),contentType:e},n=p();if(n.resolveClass)return n.resolveClass(t);return fetch("/__jx_resolve__",{body:JSON.stringify(t),headers:{"content-type":"application/json"},method:"POST"}).then((o)=>{if(!o.ok)throw Error(`Class resolution failed: ${o.status}`);return o.json()})}function de(e,t,n){if(n===null||n===void 0||n==="")return;let o=String(n);e[t]??=[];let r=e[t];if(!r.includes(o))r.push(o)}function Pt(e,t,n){if(Object.keys(t).length===0)return e;let o=_e(e,t);return o.state??={},o.state.$page={params:{...t},title:typeof o.title==="string"?o.title:"",url:Db(n)},o}function St(e){if(!e)return[];return Object.keys(e).filter((t)=>{let n=e[t];return n&&typeof n==="object"&&typeof n.$prototype==="string"&&typeof n.$src==="string"&&JSON.stringify(n).includes('"#/$params/')})}async function Et(e,t,n){if(t.length===0)return;let o=p();if(!o.resolveClass)return;let{state:r}=e;if(!r)return;await Promise.all(t.map(async(i)=>{let s=r[i];if(!s||typeof s!=="object")return;try{r[i]=await o.resolveClass({...s,...n?{$base:n}:{}})}catch(a){console.warn(`page-params: failed to resolve state.${i} for preview:`,a)}}))}function _e(e,t){let n=ho(e,t);if(n!==null)return n;if(!e||typeof e!=="object")return e;if(Array.isArray(e))return e.map((r)=>_e(r,t));let o={};for(let[r,i]of Object.entries(e))o[r]=_e(i,t);return o}function ho(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return null;let n=e.$ref;if(typeof n!=="string"||!n.startsWith("#/$params/"))return null;return t[n.slice(10)]??null}function ex(e){return typeof e?.tagName==="string"&&e.tagName.includes("-")}function Tt(e){if(e===null||typeof e==="number"||typeof e==="boolean")return"literal";if(typeof e==="string")return e.includes("${")?null:"literal";if(Array.isArray(e))return"literal";if(typeof e==="object"){let t=e;if(t.$expression||t.$compute||t.$prototype||t.$handler)return null;return"default"in t||"type"in t?"signal":"literal"}return null}function _T(e){let t=e?.state??{},n=[];for(let[o,r]of Object.entries(t)){if(Mp(o))continue;let i=Tt(r);if(!i)continue;let s=i==="signal"?r.default:r;n.push({name:o,value:s})}return n}function Mt(e,t){let n={...e.state??{}},o=!1;for(let[r,i]of Object.entries(t)){let s=Tt(n[r]);if(!s)continue;n[r]=s==="signal"?{...n[r],default:i}:i,o=!0}if(!o)return e;return{...e,state:n}}function Nt(e,t=[]){if(!e||typeof e!=="object")return null;if(Array.isArray(e.children)){let n=e.children.findIndex((o)=>o&&typeof o==="object"&&!o.$__layout);if(n!==-1)return{offset:n,prefix:[...t,"children"]};for(let o=0;o<e.children.length;o++){let r=e.children[o];if(r&&typeof r==="object"&&r.$__layout){let i=Nt(r,[...t,"children",o]);if(i)return i}}}return null}function 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 kt(e,t,n=null){let o={documentPath:t?.documentPath,mode:t?.doc.mode},r=n??Tl(t),i=r==="preview"?structuredClone(re(e)):A(Xu(e)),s=!1,a=o.documentPath&&D?.isSiteProject&&(o.documentPath.startsWith("pages/")||o.documentPath.startsWith("./pages/")),l=null,c=0;if(a&&t?.session.ui.showLayout!==!1){let w=$l(e.$layout);if(w){let v=await Ub(w);if(v){je(v,w.replace(/^\.\//,""));let C=r==="preview"?structuredClone(re(e)):i,x=ZT(v,C);i=r==="preview"?x:A(Xu(x)),s=!0;let E=Nt(x);l=E?.prefix??null,c=E?.offset??0}}}let d=hp(D?.projectRoot),f=o.documentPath?new URL(o.documentPath,d).href:void 0,h=fm(o.documentPath,{fileBaseUrl:d,...We()?{space:p().assetSpace}:{}});if(a&&t){let{previewParams:w}=t.session.ui;if(w&&Object.keys(w).length>0){let v=St(e.state??null);i=Pt(i,w,o.documentPath),await Et(i,v,f)}}if(!a&&t&&ex(i)){let{previewProps:w}=t.session.ui;if(w&&Object.keys(w).length>0)i=Mt(i,w)}let b=new Set;if(r!=="preview")(function w(v,C){if(!v||typeof v!=="object")return;if(v.$prototype==="Array"){b.add(C.join("/"));let x=v.map;if(x&&typeof x==="object")w(x,[...C,"map"]);return}if(Array.isArray(v.children))for(let x=0;x<v.children.length;x++){let E=v.children[x];if(typeof E==="string")continue;w(E,[...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,E]of Object.entries(v.cases))w(E,[...C,"cases",x])})(e,[]);let T=o.documentPath!=null&&(o.documentPath.startsWith("layouts/")||o.documentPath.startsWith("./layouts/")),R=Vb(i.$elements);if((o.mode==="content"||s||T)&&st.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(qe(C.tagName));if(Array.isArray(C.children)){for(let E of C.children)if(typeof E!=="string")for(let Xn of v(E))x.add(Xn)}return x};for(let C of v(i)){let x=st.find((E)=>E.tagName===C);if(x&&x.source!=="npm"&&x.path){let E=xc(o.documentPath??null,x.path);if(!w.has(E))R.push({$ref:E}),w.add(E)}}}if(R.length>0)i.$elements=R;i.imports=JT(i.imports);let O=Di(i.$media);if(O===void 0)delete i.$media;else i.$media=O;let U=YT(i.$head);if(U===void 0)delete i.$head;else i.$head=U;return{assets:h,docBase:f,mapperCtx:{arrayPaths:[...b],canvasMode:r,layoutWrapped:s,pageContentOffset:c,pageContentPrefix:l},renderDoc:i,siteStyle:D?.projectConfig?.style??null}}var CT="fullRender",kT="mountCanvas",ST="patchBatch",At="prepareRender",xo={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=xo;var Rt=new Map;function $t(){try{return typeof localStorage<"u"&&Boolean(localStorage.getItem("jx-canvas-debug"))}catch{return!1}}function Ot(){return typeof performance<"u"&&typeof performance.now==="function"?performance.now():0}function It(e,t){if($t())console.debug(`[jx-canvas] ${e}`,t??"")}function Ab(e){xo.escalations+=1,xo.lastEscalationReason=e,It("escalation",e)}function go(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 vo(e,t){let n=Number.isFinite(t)&&t>0?t:0,o=Rt.get(e);if(!o)o=[],Rt.set(e,o);if(o.push(n),o.length>128)o.shift();let r=xo.timings[e],i={count:(r?.count??0)+1,lastMs:n,maxMs:Math.max(r?.maxMs??0,n),p95Ms:go(o),totalMs:(r?.totalMs??0)+n};if(xo.timings[e]=i,e==="fullRender")xo.lastFullRenderMs=i.lastMs,xo.p95FullRenderMs=i.p95Ms;It(`span:${e}`,`${n.toFixed(2)}ms`)}function Dt(e){let t=Ot(),n=$t(),o=`jx-${e}-start`;if(n)try{performance.mark(o)}catch{}let r=!1;return()=>{if(r)return xo.timings[e]?.lastMs??0;r=!0;let i=Ot()-t;if(n)try{performance.measure(`jx-${e}`,o),performance.clearMarks(o)}catch{}return vo(e,i),i}}function tx(e,t){let n=Dt(e);try{return t()}finally{n()}}async function nx(e,t){let n=Dt(e);try{return await t()}finally{n()}}function bi(e){if(e==="--")return"Base";return e.replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(t)=>t.toUpperCase())||e}var Ht=new Set(["script","style","link","iframe","object","embed"]);function yd(e){let t={tagName:e};if(/^h[1-6]$/.test(e))t.textContent="Heading";else if(e==="p")t.textContent="Paragraph text";else if(e==="span"||e==="strong"||e==="em"||e==="small"||e==="mark"||e==="code"||e==="abbr"||e==="q"||e==="sub"||e==="sup"||e==="time")t.textContent="Text";else if(e==="a")t.textContent="Link",t.attributes={href:"#"};else if(e==="button")t.textContent="Button";else if(e==="label")t.textContent="Label";else if(e==="legend")t.textContent="Legend";else if(e==="caption")t.textContent="Caption";else if(e==="summary")t.textContent="Summary";else if(e==="li"||e==="dt"||e==="dd"||e==="th"||e==="td"||e==="option")t.textContent="Item";else if(e==="blockquote")t.textContent="Quote";else if(e==="pre")t.textContent="Preformatted text";else if(e==="input")t.attributes={placeholder:"Enter text...",type:"text"};else if(e==="img")t.attributes={alt:"Image"};else if(e==="iframe")t.attributes={src:""};else if(e==="slot")t.children=[{tagName:"p",textContent:"Slot content"}];else if(e==="select")t.children=[{tagName:"option",textContent:"Option 1"}];else if(e==="ul"||e==="ol")t.children=[{tagName:"li",textContent:"Item"}];else if(e==="dl")t.children=[{tagName:"dt",textContent:"Term"},{tagName:"dd",textContent:"Definition"}];else if(e==="table")t.children=[{children:[{children:[{tagName:"th",textContent:"Header"}],tagName:"tr"}],tagName:"thead"},{children:[{children:[{tagName:"td",textContent:"Cell"}],tagName:"tr"}],tagName:"tbody"}];else if(e==="details")t.children=[{tagName:"summary",textContent:"Summary"},{tagName:"p",textContent:"Detail content"}];return t}function j(e){if(!e)return[];if(Array.isArray(e.children))return e.children;return typeof e.textContent==="string"&&e.textContent.length>0?[e.textContent]:[]}function Y(e){let t=0;for(let n of e)t+=typeof n==="string"?n.length:Y(j(n));return t}function Fe(e,t,n){let o=[],r=0;for(let i of e){if(r>=n)break;if(typeof i==="string"){let c=r+i.length;if(c>t){let d=i.slice(Math.max(0,t-r),Math.max(0,Math.min(n,c)-r));if(d)o.push(d)}r=c;continue}let s=j(i),a=Y(s),l=r+a;if(a===0){if(r>=t&&r<n)o.push({...i})}else if(l>t){let c=Fe(s,Math.max(0,t-r),Math.min(n,l)-r);if(c.length>0)o.push(yo(i,c))}r=l}return o}function yo(e,t){let{children:n,textContent:o,...r}=e;if(t.length===0)return{...r,textContent:""};if(t.length===1&&typeof t[0]==="string")return{...r,textContent:t[0]};return{...r,children:t}}function Jt(e){let t=[];for(let n of e){if(typeof n==="string"){if(n.length===0)continue;let o=t.at(-1);if(typeof o==="string"){t[t.length-1]=o+n;continue}}t.push(n)}return t}function Lt(e,t,n,o,r=""){return Jt([...Fe(e,0,t),...r?[r]:[],...Fe(n,o,Y(n))])}function Ve(e){let t=Jt(e);if(t.length===0)return{textContent:""};if(t.length===1&&typeof t[0]==="string")return{textContent:t[0]};return{children:t}}function bo(e){if(!e)return!0;if(e.textContent!=null&&e.textContent.trim()==="")return!0;let t=e.children;if(!t)return!1;if(t.length===0)return!0;if(t.length===1&&typeof t[0]==="string"&&t[0].trim()==="")return!0;return t.length===1&&typeof t[0]==="object"&&t[0]?.tagName==="br"}function _t(e,t,n,o,r={}){if(!e)return;let i=K(e.doc.document,t);if(n){if(i&&JSON.stringify(i.children)===JSON.stringify(n))return;q(e,(s)=>{if(i?.textContent!=null)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 jt(e,t,n,o){if(!e)return!1;let r=K(e.doc.document,t);if(!r)return!1;if(`${r.$props?.[n]??""}`===o)return!1;return q(e,(s)=>{Uu(s,t,n,o)}),!0}function qt(e,t,n){if(!e)return null;let o=K(e.doc.document,t),r=K(e.doc.document,n);if(!o||!r)return null;if(qa(t,n)||qa(n,t))return null;let i=j(r),s=j(o),a=Y(i),l=Ve([...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(Vu(c,t),Ft(c,ht(t)),Cp(e))c.session.selection=[n]}),{offset:a,path:n}}function Ft(e,t){let n=t;while(n.length>0){let o=K(e.doc.document,n),r=o?.children;if(!o||!Array.isArray(r)||r.length>0)return;let i=ht(n);if(Vu(e,n),!i)return;n=i}}function Wt(e,t,n,o){let r=ht(t),i=_n(t),s=[...r,"children",i+1];if(!e)return s;let a={tagName:"p"};if(o.textContent!=null)a.textContent=o.textContent;else if(o.children)a.children=o.children;else a.textContent="";return q(e,(l)=>{if(n.textContent!=null)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(Ji(l,r,i+1,a),Cp(e))l.session.selection=[s]}),s}function Vt(e,t,n,o){if(bo(o)){if(!e)return t;return q(e,(l)=>{Ue(l,t,"tagName",n.tag),Ue(l,t,"children");let c=yd(n.tag);if(c.textContent&&c.textContent!=="Paragraph text")Ue(l,t,"textContent",c.textContent);else Ue(l,t,"textContent");if(Cp(e))l.session.selection=[t]}),t}let r=ht(t),i=_n(t),s=[...r,"children",i+1];if(!e)return s;let a=yd(n.tag);return q(e,(l)=>{if(o?.children)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(Ji(l,r,i+1,structuredClone(a)),Cp(e))l.session.selection=[s]}),s}function Bt(e,t,n,o,r){if(!e)return null;let i=K(e.doc.document,t.path),s=K(e.doc.document,n.path);if(!i||!s)return null;if(qa(t.path,n.path)||qa(n.path,t.path))return null;let a=Ve(Lt(j(i),t.offset,j(s),n.offset,r)),l=[...o,n.path].toSorted(Co);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))Vu(c,d),Ft(c,ht(d));if(Cp(e))c.session.selection=[t.path]}),{offset:t.offset+r.length,path:t.path}}function Co(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 M(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 zt(e=document){let t=e.createElement("div");t.className="jx-canvas-iframe-overlay",t.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:2";let n=e.createElement("div");n.className="overlay-box overlay-selection",n.style.display="none";let o=e.createElement("div");o.className="overlay-label",o.style.display="none",n.append(o);let r=e.createElement("div");r.className="overlay-box overlay-hover",r.style.display="none";let i=e.createElement("div");i.className="canvas-drop-indicator",i.style.display="none";let s=e.createElement("button");s.className="insertion-helper",s.textContent="+",s.style.pointerEvents="auto",s.style.display="none";let a=e.createElement("div");a.className="canvas-replace-target",a.style.display="none";let l=e.createElement("div");l.className="overlay-presence-group";let c=e.createElement("div");return c.className="overlay-coselection-group",t.append(r,n,c,i,a,s,l),{dispose:()=>t.remove(),insertButton:s,root:t,setDropIndicator:(d,f="inside")=>So(i,d,f),setHover:(d)=>fe(r,d),setInsertZone:(d,f="center")=>Po(s,d,f),setReplaceTarget:(d)=>fe(a,d),setSuppressed:(d)=>{t.style.display=d?"none":""},setCoSelection:(d)=>{c.replaceChildren();for(let f of d){let h=e.createElement("div");h.className="overlay-box overlay-selection overlay-coselection",fe(h,f),c.append(h)}},setPresence:(d)=>{l.replaceChildren();for(let f of d){let h=e.createElement("div");h.className="overlay-box overlay-presence",h.style.cssText=`position:absolute;display:block;pointer-events:none;outline:1.5px solid ${f.color};outline-offset:1px;left:${f.placement.left}px;top:${f.placement.top}px;width:${f.placement.width}px;height:${f.placement.height}px`;let b=e.createElement("div");b.className="overlay-presence-tag",b.textContent=f.label,b.style.cssText=`position:absolute;top:-18px;left:-2px;padding:1px 5px;border-radius:3px;font:10px/1.4 sans-serif;color:#fff;white-space:nowrap;background:${f.color}`,h.append(b),l.append(h)}},setSelection:(d,f=null)=>{if(fe(n,d),d&&f)o.textContent=f,o.style.display="block";else o.style.display="none"}}}function Po(e,t,n){if(!t){e.style.display="none",e.classList.remove("visible");return}e.dataset.edge=n,e.classList.add("visible"),e.style.display="grid",e.style.left=`${t.left+t.width/2}px`,e.style.top=`${t.top+t.height/2}px`,e.style.translate="-50% -50%"}function So(e,t,n){if(!t){e.style.display="none";return}if(e.style.display="block",e.style.left=`${t.left}px`,e.style.width=`${t.width}px`,n==="inside"){e.className="canvas-drop-indicator inside",e.style.top=`${t.top}px`,e.style.height=`${t.height}px`;return}e.className="canvas-drop-indicator line",e.style.height="",e.style.top=`${n==="top"?t.top:t.top+t.height}px`}function Il(e){return JSON.stringify(e)}var wd={$id:"elements-meta",title:"HTML Element Metadata",description:"Inline scoping and inline toolbar action metadata for HTML elements.",$convertGroups:{text:["p","h1","h2","h3","h4","h5","h6","blockquote"],container:["div","section","article","aside","main","header","footer","nav","search"],list:["ul","ol"]},$defs:{p:{$convertTo:"text",$convertToWhenEmpty:["text","container"],$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"u",label:"Underline",command:"underline"},{tag:"del",label:"Strikethrough",command:"strikethrough"},{tag:"sup",label:"Superscript",command:"superscript"},{tag:"sub",label:"Subscript",command:"subscript"},{tag:"code",label:"Code",command:"code"},{tag:"a",label:"Link",command:"link"}]},h1:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"code",label:"Code",command:"code"},{tag:"a",label:"Link",command:"link"}]},h2:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h3:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h4:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h5:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h6:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},li:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},td:{$inlineChildren:["em","strong","del","code","a","span","br","b","i","u","sub","sup","s"],$inlineActions:"p"},th:{$inlineChildren:["em","strong","del","code","a","span","br","b","i","u","sub","sup","s"],$inlineActions:"p"},blockquote:{$convertTo:"text",$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},figcaption:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},caption:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},summary:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},dt:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},dd:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},label:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},a:{$inlineChildren:["em","strong","code","span","br","b","i","u","sub","sup"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"code",label:"Code",command:"code"}]},span:{$inlineChildren:["em","strong","del","code","a","br","b","i","u","sub","sup","s"],$inlineActions:"p"},div:{$convertTo:"container",$convertToWhenEmpty:["container","text"],$inlineChildren:[]},section:{$convertTo:"container",$inlineChildren:[]},article:{$convertTo:"container",$inlineChildren:[]},nav:{$convertTo:"container",$inlineChildren:[]},main:{$convertTo:"container",$inlineChildren:[]},header:{$convertTo:"container",$inlineChildren:[]},footer:{$convertTo:"container",$inlineChildren:[]},aside:{$convertTo:"container",$inlineChildren:[]},ul:{$convertTo:"list",$inlineChildren:[]},ol:{$convertTo:"list",$inlineChildren:[]},pre:{$inlineChildren:["code"]},table:{$inlineChildren:[]},thead:{$inlineChildren:[]},tbody:{$inlineChildren:[]},tr:{$inlineChildren:[]}}};var To=new Set(["pre"]),na=new Set(Object.entries(wd.$defs).filter(([e,t])=>!To.has(e)&&(t.$inlineChildren?.length??0)>0).map(([e])=>e));var Kt=new Set(["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"]);function Be(e,t){if(!t)return Kt.has(e);let n=wd.$defs[t];if(!n||!n.$inlineChildren)return!1;return n.$inlineChildren.includes(e)}function TT(e){let t=wd.$defs[e];if(!t)return null;let n=t.$inlineActions;if(typeof n==="string")n=wd.$defs[n]?.$inlineActions??void 0;if(!Array.isArray(n))return null;return n}var Mo=null;function ix(e,t){if(!e||typeof e!=="object")return!1;let n=(qe(e.tagName)||"div").toLowerCase();if(t){let o=(qe(t.tagName)||"div").toLowerCase();return Be(n,o)}return Kt.has(n)}function LT(){return Mo!==null}function me(e){return!e||e==="base"?null:e}function Nb(e){let t=e.panels;if(t.length===0)return null;if(t.length===1)return t[0];let n=Nu(e.paneId);for(let o of t){if(n===null&&(o.mediaName==="base"||o.mediaName===null))return o;if(o.mediaName===n)return o}return t[0]}function Ut(){return Nb(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=(qe(o.tagName)||"div").toLowerCase(),a=(qe(i.tagName)||"div").toLowerCase();if(!Be(s,a))break;n=r}return n}function Ob(e){return Dv(e)!==null}function Ou(e){return Dv(e)}function hr(e){if(!e)return{baseWidth:320,featureQueries:[],sizeBreakpoints:[]};let t=[],n=[],o=320;for(let[r,i]of Object.entries(e)){if(r==="--"){let l=String(i).match(/^(\d+)\s*px$/);o=l?Number(l[1]):320;continue}let s=i.match(/min-width:\s*([\d.]+)px/),a=i.match(/max-width:\s*([\d.]+)px/);if(s)n.push({name:r,query:i,type:"min",width:Number(s[1])});else if(a)n.push({name:r,query:i,type:"max",width:Number(a[1])});else t.push({name:r,query:i})}return n.sort((r,i)=>r.type==="min"?r.width-i.width:i.width-r.width),{baseWidth:o,featureQueries:t,sizeBreakpoints:n}}function No(e,t){let n=new Set;for(let o of e)if(o.type==="min"&&t>=o.width)n.add(o.name);else if(o.type==="max"&&t<=o.width)n.add(o.name);return n}function Gt(e,t){let n=No(e,t),o=null;for(let r of e){if(!n.has(r.name))continue;let i=Math.abs(r.width-t);if(o===null){o=r;continue}let s=Math.abs(o.width-t);if(i<s||i===s&&r.width<o.width)o=r}return o?.name??null}function RT(e,t,n=8){let o=null;for(let r of t){let i=Math.abs(r-e);if(i>n)continue;if(o===null||i<Math.abs(o-e))o=r}return o??e}var cp=240,$T=8,DT=16,he=new Map;function ze(e){return hr(Di(e.doc.document?.$media))}function ox(e){let{baseWidth:t,sizeBreakpoints:n}=ze(e),o=e.session.ui.activeMedia;return n.find((r)=>r.name===o)?.width??t}function ko(e,t){let n=he.get(e);if(!n)return null;if(!t||n.tabId!==t.id||n.media!==t.session.ui.activeMedia)return he.delete(e),null;return n.width}function AT(e,t){let n=t?ox(t):0;return ko(e.paneId,t)??n}function rx(e){he.delete(e)}function NT(e){let{baseWidth:t,sizeBreakpoints:n}=ze(e);return[t,...n.map((o)=>o.width)]}function sx(e,t,n){let{sizeBreakpoints:o}=ze(t),r=Gt(o,n);return t.session.ui.activeMedia=r,he.set(e,{media:r,tabId:t.id,width:n}),r}var Ke={invokerTags:jm,popoverTags:jd};function G1(e,t){if(!e||!t)return null;for(let n=t.length;n>=0;n-=1){let o=t.slice(0,n),r=K(e,o);if(r&&typeof r==="object"&&Gs(r,Ke))return o}return null}function Zt(e,t){let n=e.doc.document;if(!n)return null;if(t){let o=K(n,t);return o&&typeof o==="object"&&Gs(o,Ke)?t:null}return G1(n,Le(e.session.selection))}function Xt(){let e=u.value?.doc.document;return e?wI(e,Ke):!1}var Yt=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],Ge=new Set(["show-modal","close","request-close"]),Ze=new Set(["toggle-popover","show-popover","hide-popover"]),Ro=["any","closerequest","none"],Oo=new Set(["button"]),I="See docs/framework/concepts/overlays.";function H(e){return ro(e)==="dialog"}function Qt(e){return e.startsWith("--")}function Ao(e){let t=[];for(let{node:n}of Ya(e)){let o=nh(n);if(H(n)&&o!==null&&!t.includes(o))t.push(o)}return t}function en(e){for(let{node:t}of Ya(e))if(H(t))return!0;return!1}function $o(e){let t=e.oncommand;return t!==void 0&&t!==null}function Io(e,t){for(let{node:n}of Ya(e)){if(n===e)continue;let o=ro(n);if(o==="button"){let r=Kr(n,"command"),i=Kr(n,"commandfor");if(r!==null&&(r==="close"||r==="request-close")&&(i===null||i===t))return!0}if(o==="form"&&Kr(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function vT(e,t){let n=[...Ya(e,[],null,t)],o=Ao(e),r=Fm(e,t),i=o.length>0||r.length>0,s=new Map,a=new Map;for(let{node:c}of n){let d=nh(c);if(d!==null&&!s.has(d))s.set(d,c);if(ro(c)==="button"){let f=Kr(c,"commandfor"),h=Kr(c,"command");if(f!==null){let b=a.get(f)??new Set;b.add(h??""),a.set(f,b)}}}let l=[];for(let{node:c,path:d}of n)if(l.push(...Ho(c,d,s,o,r,i,t)),H(c))l.push(...Jo(c,d,a));return l}function Ho(e,t,n,o,r,i,s){let a=[],l=ro(e),c=s?.invokerTags?.has(l)??!1,d=Kr(e,"command"),f=Kr(e,"commandfor");if(!(d!==null||f!==null||("command"in Wl(e))||("commandfor"in Wl(e))))return a;let b=Jr(e,"the element");if(!Oo.has(l)&&!c)return a.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${I}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(d!==null&&!Yt.includes(d)&&!Qt(d))return a.push({detail:`\`command\` is an enumerated attribute taking ${Yt.map((T)=>`\`${T}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${I}`,message:`${b} declares command="${d}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(f!==null){let T=n.get(f),R=o.includes(f),O=r.includes(f);if(!T&&i){let U=[...o,...r].map((w)=>`"${w}"`).join(", ");return a.push({detail:`No element in this document has the id "${f}". The dialogs and popovers here are: ${U}. A commandfor that names nothing does nothing, silently. ${I}`,message:`commandfor="${f}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(d!==null&&T){if(Ge.has(d)&&!H(T))a.push({detail:`\`${d}\` acts on a <dialog>, and "${f}" is ${O?"a popover":`a <${ro(T)||"element"}>`}. The click is ignored. ${O?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${I}`,message:`${b} sends ${d} to "${f}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(Ze.has(d)&&!Gs(T,s))a.push({detail:`\`${d}\` acts on a popover, and "${f}" is ${R?"a dialog":`a <${ro(T)||"element"}>`} that declares no \`popover\`. The click is ignored. ${R?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${I}`,message:`${b} sends ${d} to "${f}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(Qt(d)&&!$o(T))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${f}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${I}`,message:`${b} sends ${d} to "${f}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function Jo(e,t,n){let o=[],r=Jr(e,"the dialog"),i=nh(e),{style:s}=e,a=Kr(e,"closedby");if(a!==null&&!Ro.includes(a))o.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${I}`,message:`${r} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(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=Kr(e,"open")!==null||Wl(e).open===!0||e.open===!0;if(i!==null&&!l?.has("show-modal")&&!c)o.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${I}`,message:`${r} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!Io(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 ax(e,t){let n=e.doc.document;if(!n)return null;if(t){let o=K(n,t);return o&&typeof o==="object"&&H(o)?t:null}return K1(n,Le(e.session.selection))}function tn(){let e=u.value?.doc.document;return e?en(e):!1}function V(e){return lt(e.paneId)}function ee(e){let t=ur(e.paneId);if(t?.kind==="lens")return t.zoom;return V(e)?.session.ui.zoom??1}function lx(e=Uo()){return ee(e)}function ve(e,t){let n=ur(e.paneId);if(n?.kind==="lens"){n.zoom=t;return}let o=V(e);if(o)o.session.ui.zoom=t}function Mu(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 OT(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 MT(e,t){let n=e.find((r)=>r.item.key===t);if(!n)return;let o=wt(n.panel);if(o)o.session.ui.activeMedia=me(n.item.mediaAttr)}function Qe(e){if(!e.panzoomWrap)return;let t=e.wrap.clientWidth,n=e.panzoomWrap.scrollWidth,o=ee(e),r=n*o;e.panX=Math.max(16,(t-r)/2),e.panY=0}function Mb(e){if(e.centerObserver)e.centerObserver.disconnect(),e.centerObserver=null;if(!e.panzoomWrap)return;e.needsCenter=!0,e.centerObserver=new ResizeObserver(()=>{if(!e.needsCenter){e.centerObserver?.disconnect(),e.centerObserver=null;return}Qe(e),us(e)}),e.centerObserver.observe(e.panzoomWrap),Qe(e)}function us(e){if(!e.panzoomWrap)return;let t=ee(e);e.panzoomWrap.style.transform=`translate(${e.panX}px, ${e.panY}px) scale(${t})`,Ai("overlays")}var et=0.25,tt=3;function rn(e){return Math.min(tt,Math.max(et,e))}function xd(e=Uo()){if(wo(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=Oe(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 Pu(e,t=Uo()){let n=V(t);if(!n)return;n.session.ui.editZoom=rn(e),xd(t)}var Xe=new Map;function PT(e,t=Uo()){let n=V(t);if(!n)return;if(n.session.ui.editZoom=rn(e),Xe.has(t.paneId))return;Xe.set(t.paneId,requestAnimationFrame(()=>{Xe.delete(t.paneId),xd(t)}))}function an(e,t,n){if(!e.panzoomWrap)return;let o=e.wrap.clientWidth,r=e.wrap.clientHeight,i=24,s=32,a=0,{panels:l}=e;for(let v of l)a+=v._width||800;a+=i*Math.max(0,l.length-1)+s;let c=ee(e),h=Oe(e.panzoomWrap).height/c+s,b=o/a,T=r/h,R=t==="width"?b:Math.min(b,T),O=Math.min(n,Math.max(F,R));ve(e,O);let U=a*O,w=h*O;e.panX=Math.max(0,(o-U)/2),e.panY=Math.max(0,(r-w)/2),us(e)}function FT({maxZoom:e=W,surface:t=Uo()}={}){te("page",t),an(t,"page",e)}var F=0.05,W=5;function rt(e){return Math.min(W,Math.max(F,e))}var Lo="page",nt=["width","page","none"];function jo(e,t,n){let o=t[n];if(typeof o==="string"&&nt.includes(o))return o;if(typeof o==="number"&&o>=F&&o<=W)return o;throw RangeError(`command "${e}" argument "${n}": expected ${nt.map((r)=>`"${r}"`).join(" | ")} or a number in [${F}, ${W}], got ${JSON.stringify(o)}`)}var sn=new Map;function ln(e){let t=V(e);if(!t)return null;let n=ur(e.paneId)?.kind==="lens"?`::${e.paneId}`:"";return`${t.id}::${t.documentPath??""}${n}`}function te(e,t){let n=ln(t);if(n)sn.set(n,e)}function cx(e=Uo()){let t=ln(e);return(t===null?void 0:sn.get(t))??Lo}function cn(e,t=Uo()){let n=e??cx(t);if(n==="none"){us(t);return}if(typeof n==="number"){ve(t,rt(n)),us(t);return}an(t,n,1)}function J1(e,t=Uo()){te(e,t),cn(e,t)}function jT(e=Uo()){te(rt(ee(e)),e)}function dx(e,t=Uo()){if(!V(t))return;let o=rt(e);te(o,t),ve(t,o),us(t)}function ux(e){if(e.wrap.clientWidth<=0){us(e);return}cn(cx(e),e)}function HT(e=Uo()){if(te(1,e),!e.panzoomWrap)return;ve(e,1),Qe(e),us(e)}function qo(e,t){let n=Oe(un(e)??e.wrap),o=t.top+t.height/2-n.top;return n.height/2-o}function un(e){return Nb(e)?.scrollContainer??null}function Fo(e,t,n){let o=un(e);if(!o){Wo(e,t);return}let r=o.scrollTop-t;if(n){o.scrollTo({behavior:"smooth",top:r});return}o.scrollTop=r}function Pb(e,t=Uo()){Fo(t,qo(t,e),!1)}function Wo(e,t){let n=e.panY,o=n+t,r=performance.now(),i=250,s=(a)=>{let l=Math.min((a-r)/250,1),c=l*(2-l);if(e.panY=n+(o-n)*c,us(e),l<1)requestAnimationFrame(s)};requestAnimationFrame(s)}var Ye=["edit","design","preview","source","stylebook","grid","git-diff"],ye=new Set(["edit","design"]),Vo=["edit","design","preview"];function Bo(e){return Vo.filter((t)=>e.capabilities.modes.includes(t))}function BT(e){return Bo(e).filter((t)=>t!=="preview")}function Y1(e){let t=e.session.ui.canvasMode;return ye.has(t)?t:null}function Z1(e){return{available:e.capabilities.modes.includes("preview")&&ye.has(e.session.ui.canvasMode),on:e.session.ui.preview===!0}}function X1(e,t,n){if(t==="preview"){if(ye.has(e.session.ui.canvasMode))e.session.ui.preview=!0;return}if(e.session.ui.preview=!1,e.session.ui.canvasMode!==t)n(e,t)}var nn=new Set(["design","stylebook","git-diff"]),N=(e)=>e.document.open,on=["auto","light","dark"];function zo(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=lt(c);if(!d)throw RangeError(`command "${s}" argument "pane": "${c}" has no open document`);return d}let o={pane:He("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:m.activePaneId}return[{args:Se({mode:Do(Ye,"The canvas mode to switch the active pane to.")}),category:"View",id:"canvas.setMode",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:N,aiTool:{description:"Switch the active document's editor mode. edit and design put its element tree on the canvas, where the document tools work; preview renders it as a visitor sees it; source shows the JSON; stylebook, grid and git-diff open other editors. Use it to return a document to edit or design when the tree tools are refused.",name:"set_canvas_mode",report:({after:s,args:a})=>{let l=li("canvas.setMode",a,"mode",Ye),c=s.editor.kind==="canvas"?"the document tools address its element tree":"the tree-editing tools are unavailable until it returns to edit or design";return`The active document is in ${l} mode; ${c}.`}},run:(s,a)=>{let l=li("canvas.setMode",a,"mode",Ye),c=t("canvas.setMode"),{modes:d}=c.capabilities;if(!d.includes(l))throw RangeError(`command "canvas.setMode" argument "mode": "${l}" is not a mode this document `+`supports — it declares: ${d.join(", ")}`);if(l==="preview"){let f=c.session.ui.canvasMode;if(!ye.has(f))throw RangeError(`command "canvas.setMode" argument "mode": "preview" composes with the edit and design base modes; this pane is in "${f}"`);c.session.ui.preview=!0;return}c.session.ui.preview=!1,e.setCanvasMode(c,l)},title:"Set Canvas Mode"},{args:Se({zoom:qC("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:N,enablement:()=>nn.has(e.getCanvasMode()),run:(s,a)=>{t("canvas.setZoom"),dx(yv("canvas.setZoom",a,"zoom",F,W))},title:"Set Zoom"},{args:Se({fit:{description:'How the document is framed: "width" | "page" | "none", or a numeric pan-zoom scale.',oneOf:[{enum:[...nt],type:"string"},{maximum:W,minimum:F,type:"number"}]}}),category:"View",id:"canvas.setFit",level:"document",menus:["palette"],group:"3_canvas",requires:"a document on the pan-zoom surface",when:N,enablement:()=>nn.has(e.getCanvasMode()),run:(s,a)=>{t("canvas.setFit"),J1(jo("canvas.setFit",a,"fit"))},title:"Set Fit"},{args:Se({zoom:qC("Edit-mode content zoom, 1 = 100%.",{maximum:tt,minimum:et})}),category:"View",id:"canvas.setEditZoom",level:"document",menus:["palette"],group:"3_canvas",requires:"a document in edit mode",when:N,enablement:()=>e.getCanvasMode()==="edit",run:(s,a)=>{t("canvas.setEditZoom"),Pu(yv("canvas.setEditZoom",a,"zoom",et,tt))},title:"Set Edit Zoom"},{args:{additionalProperties:!1,properties:{...o,width:{description:"How wide the Edit column should render, in CSS pixels, or null to go back to the chosen breakpoint's own width.",type:["number","null"]}},required:["width"],type:"object"},category:"View",id:"canvas.setEditWidth",level:"document",menus:["palette"],group:"3_canvas",requires:"a document in edit mode",when:N,enablement:()=>e.getCanvasMode()==="edit",run:(s,a)=>{let l=n("canvas.setEditWidth",a),{width:c}=a;if(c===null){rx(i(a)),r(a);return}sx(i(a),l,yv("canvas.setEditWidth",a,"width",cp,1e4)),r(a)},title:"Set Edit Width"},{args:{additionalProperties:!1,properties:{...o,media:{description:"A breakpoint key the document renders under, or null for the base rendering.",type:["string","null"]}},required:["media"],type:"object"},category:"View",id:"canvas.setBreakpoint",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:N,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:Se({...o,scheme:Do(on,"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:N,run:(s,a)=>{let l=n("canvas.setColorScheme",a);l.session.ui.previewColorScheme=li("canvas.setColorScheme",a,"scheme",on),r(a)},title:"Set Color Scheme"},{args:Se({...o,locale:He("BCP 47 tag this pane renders as.")},["locale"]),category:"View",id:"i18n.switchLocale",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document in a project that declares more than one locale",when:(s)=>s.document.open&&s.project.isMultilingual,run:(s,a)=>{let l=n("i18n.switchLocale",a),c=ot("i18n.switchLocale",a,"locale"),d=ps();if(d===null||!d.locales.includes(c))throw RangeError(`command "i18n.switchLocale" argument "locale": "${c}" is not a locale this `+`project declares — it declares: ${d===null?"nothing":d.locales.join(", ")}`);l.session.ui.previewLocale=c,r(a)},title:"Set Rendering Language"},{args:Se({...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:N,run:(s,a)=>{let l=n("canvas.setLayoutVisible",a);l.session.ui.showLayout=yi("canvas.setLayoutVisible",a,"visible"),r(a)},title:"Show Layout Elements"},{args:Se({...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:()=>Xt(),group:"3_canvas",id:"canvas.setPopoverOpen",level:"document",menus:["palette"],requires:"a popover in the open document",run:(s,a)=>{let l=n("canvas.setPopoverOpen",a),c=a??{},d=c.open===void 0?!0:yi("canvas.setPopoverOpen",a,"open");if(!d&&c.path===void 0){e.setOpenPopover(l,null);return}let f=Zt(l,c.path);if(f===null)throw RangeError('command "canvas.setPopoverOpen" argument "path": names no popover in this document — '+"a popover is an element with a `popover` attribute, and <dialog> is not one");e.setOpenPopover(l,d?f:null)},title:"Show Popover",when:N},{args:Se({...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:()=>tn(),group:"3_canvas",id:"canvas.setDialogOpen",level:"document",menus:["palette"],requires:"a dialog in the open document",run:(s,a)=>{let l=n("canvas.setDialogOpen",a),c=a??{},d=c.open===void 0?!0:yi("canvas.setDialogOpen",a,"open");if(!d&&c.path===void 0){e.setOpenDialog(l,null);return}let f=ax(l,c.path);if(f===null)throw RangeError('command "canvas.setDialogOpen" argument "path": names no dialog in this document — '+"a dialog is a <dialog> element, and a popover is not one");e.setOpenDialog(l,d?f:null)},title:"Show Dialog",when:N},{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:N,run:(s,a)=>{n("canvas.setResolvingOpen",a);let{open:l,pane:c}=a;e.setResolvingOpen(typeof c==="string"?c:m.activePaneId,l===void 0||yi("canvas.setResolvingOpen",a,"open"))},title:"Show Resolving Values"},{args:{additionalProperties:!1,properties:{...o,name:He("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:N,run:(s,a)=>{let l=n("canvas.setTestProp",a),c=ot("canvas.setTestProp",a,"name"),d=Object.keys(l.doc.document?.state??{});if(!d.includes(c))throw RangeError(`command "canvas.setTestProp" argument "name": "${c}" is not a prop this component `+`declares — it declares: ${d.length>0?d.join(", "):"nothing"}`);let{value:f}=a,h={...l.session.ui.previewProps};if(f===null||f===void 0)delete h[c];else h[c]=f;l.session.ui.previewProps=Object.keys(h).length>0?h:null,r(a)},title:"Set Test Value"},{args:{additionalProperties:!1,properties:{...o,name:He("The route parameter's name, without brackets."),value:He("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:N,run:(s,a)=>{let l=n("canvas.setRouteParam",a),c=ot("canvas.setRouteParam",a,"name"),d=Ll(l.documentPath);if(!d.includes(c))throw RangeError(`command "canvas.setRouteParam" argument "name": "${c}" is not a parameter of this `+`route — it has: ${d.length>0?d.join(", "):"none"}`);l.session.ui.previewParams={...l.session.ui.previewParams,[c]:ot("canvas.setRouteParam",a,"value")},r(a)},title:"Set Route Parameter"}]}function zT(e,t){e.registerAll(zo(t))}function Fb(e=Uo()){let t=Nu(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 Ko(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 Q1(e,t,n,o=document){let r=Ko(o);r.textContent=e,r.style.left=`${t}px`,r.style.top=`${n}px`,r.style.display="block"}function hx(e,t){if(!J||J.style.display==="none")return;J.style.left=`${e}px`,J.style.top=`${t}px`}function _d(){if(J)J.style.display="none"}var dn=function(){if(typeof window>"u")return null;var e=new Image;return e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",e}();function wc(e){var t=e.nativeSetDragImage;if(t&&dn)t(dn,0,0)}function pn(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 fn(e,t){if(e==null)return{};var n,o,r=pn(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 mn(){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 Go=["block"];function hn(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 gn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hn(Object(n),!0).forEach(function(o){ga(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hn(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Zo(e){return{x:(e.right+e.left)/2,y:(e.bottom+e.top)/2}}function it(e){var{client:t,borderBox:n}=e,o=n.height/4;if(t.y<=n.top+o)return"reorder-above";if(t.y>=n.bottom-o)return"reorder-below";return"make-child"}function Xo(e){var{element:t,input:n,currentLevel:o,indentPerLevel:r,mode:i}=e,s={x:n.clientX,y:n.clientY},a=t.getBoundingClientRect();if(i==="standard"){var l=it({borderBox:a,client:s});return{type:l,indentPerLevel:r,currentLevel:o}}var c=Zo(a);if(i==="expanded"){var d=it({borderBox:a,client:s});return{type:d==="reorder-above"?d:"make-child",indentPerLevel:r,currentLevel:o}}var f=r*o;if(s.x<a.left+f){if(s.y<c.y)return{type:"reorder-above",indentPerLevel:r,currentLevel:o};var h=(s.x-a.left)/r,b=Math.max(Math.floor(h),0);return{type:"reparent",desiredLevel:b,indentPerLevel:r,currentLevel:o}}return{type:it({borderBox:a,client:s}),indentPerLevel:r,currentLevel:o}}function vn(e,t){if(e.type!==t.type)return!1;if(e.type==="instruction-blocked"&&t.type==="instruction-blocked")return vn(e.desired,t.desired);return be(e,t)}var er=mn(vn);function tr(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 jb(e,t){var n=t.block,o=fn(t,Go),r=Xo(o),i=tr({desired:r,block:n}),s=er(i);return gn(gn({},e),{},ga({},xe,s))}function Fu(e){var t;return(t=e[xe])!==null&&t!==void 0?t:null}var xe=Symbol("tree-item-instruction");function at(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 nr(e,t){let n=we(e);if(n)return n;return e.path?{$ref:xc(t,e.path)}:null}function eC(e,t,n){let o=we(t);if(o)return e.some((i)=>typeof i==="string"&&(i===o||i===t.package));if(!t.path)return!1;let r=G(xc(n,t.path));return e.some((i)=>{let s=at(i);return s!==null&&G(s)===r})}function G(e){return e.replace(/^(?:\.\/)+/,"")}function om(e,t,n){let o=nr(t,n);if(!o)return[...e];let i=we(t)&&t.modulePath?e.filter((s)=>s!==t.package):[...e];return eC(i,t,n)?i:[...i,o]}function tC(e,t,n){let o=we(t);if(o)return e.filter((i)=>!(typeof i==="string"&&(i===o||i===t.package)));if(!t.path)return[...e];let r=G(xc(n,t.path));return e.filter((i)=>{let s=at(i);return s===null||G(s)!==r})}function WT(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=at(o);return r===null||G(r)!==n})}async function px(e){$p(!0);try{if(e.source==="npm"){if(!customElements.get(e.tagName))return ct(e.tagName)}else{if(e.path&&!e.path.endsWith(".json"))return ct(e.tagName);let n=D?.projectRoot,o=`${location.origin}/${n?`${n}/`:""}${e.path}`;await Mm(o)}let t=document.createElement(e.tagName);for(let n of e.props||[])if(n.default!==void 0&&n.default!=="false"&&n.default!=="''"){let o=String(n.default).replaceAll(/^'|'$/g,"");t.setAttribute(n.name,o)}return t}catch(t){return console.warn("Component preview failed:",e.tagName,t),ct(e.tagName)}}function ct(e){let t=document.createElement("div");return t.style.cssText="padding:12px;border:1px dashed var(--border);border-radius:var(--radius);color:var(--fg-dim)",t.textContent=`<${e}>`,t}var or='[part="outline"]',ut='[part="row"]',rr='[part="verbs"]',Ce=null;function UT(){if(Ce!==null)cancelAnimationFrame(Ce);for(let e of Je.dndCleanups)e();Je.dndCleanups=[],Ce=requestAnimationFrame(()=>{Ce=null;let e=Qu?.querySelector(or);if(!e)return;for(let n of e.querySelectorAll("[data-dnd-row]")){let o=n.dataset.value.split("/").map((l)=>/^\d+$/.test(l)?Math.trunc(Number(l)):l),r=Math.trunc(Number(n.dataset.dndDepth))||0,i=Object.hasOwn(n.dataset,"dndVoid"),s=Object.hasOwn(n.dataset,"dndExpanded"),a=gr(gs({canDrag({element:l,input:c}){if(Rv(c.clientX,c.clientY)?.closest(rr))return!1;return!0},element:n,getInitialData(){return{path:o,type:"tree-node"}},onGenerateDragPreview({nativeSetDragImage:l}){wc({nativeSetDragImage:l})},onDragStart(){if(n.dataset.dragging="",Je.layerDragSourceHeight=n.offsetHeight,s)ir(n,e)},onDrop(){if(delete n.dataset.dragging,s)Ai("leftPanel")}}),zs({element:n,canDrop({source:l}){let c=l.data.path;if(c&&qa(c,o))return!1;return!0},getData({input:l,element:c}){return jb({path:o},{block:i?["make-child"]:[],currentLevel:r,element:c,indentPerLevel:16,input:l,mode:s?"expanded":"standard"})},onDragEnter({self:l}){yn(n,l.data,e)},onDrag({self:l}){yn(n,l.data,e)},onDrop(){oe(e)}}));Je.dndCleanups.push(a)}let t=Ws({onDrop({source:n,location:o}){oe(e);let[r]=o.current.dropTargets;if(!r)return;let i=Fu(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(rm(u.value,i,s,a),c){let d=u.value,f=Le(d?.session.selection);if(f)Je._layersCollapsed||=new Set,Je._layersCollapsed.add(f.join("/"))}},onDropTargetChange({location:n}){let[o]=n.current.dropTargets;if(o&&!Fu(o.data))oe(e)}});Je.dndCleanups.push(t)})}function qT(){requestAnimationFrame(()=>{let e=Qu?.querySelector(".components-section");if(!e)return;for(let t of e.querySelectorAll("[data-component-tag]")){let n=t.dataset.componentTag;if(!n)continue;let o=st.find((a)=>a.tagName===n);if(!o)continue;let r=t.querySelector(".element-card-preview");if(r&&!r.querySelector(n))px(o).then((a)=>{r.textContent="",r.append(a)});let i=um(o),s=gs({element:t,getInitialData(){return{fragment:structuredClone(i),type:"block"}},onGenerateDragPreview({nativeSetDragImage:a}){wc({nativeSetDragImage:a})}});Je.dndCleanups.push(s)}})}function GT(){requestAnimationFrame(()=>{let e=Qu?.querySelector('[part="content"]');if(!e)return;for(let t of e.querySelectorAll("[data-block-tag]")){let n=t.dataset.blockTag,o=t.querySelector(".element-card-preview");if(o&&!o.firstChild){let s=document.createElement(Ht.has(n)?"span":n);s.textContent=n,o.append(s)}let r=yd(n),i=gs({element:t,getInitialData(){return{fragment:structuredClone(r),type:"block"}},onGenerateDragPreview({nativeSetDragImage:s}){wc({nativeSetDragImage:s})}});Je.dndCleanups.push(i)}})}function ir(e,t){let n=`${e.dataset.value}/`,o=t.querySelectorAll(ut);for(let r of o)if(r.dataset.value?.startsWith(n))r.style.display="none"}function yn(e,t,n){let o=Fu(t);if(Je._currentDropTargetRow&&Je._currentDropTargetRow!==e)delete Je._currentDropTargetRow.dataset.drop;if(!o||o.type==="instruction-blocked"){oe(n);return}if(o.type==="make-child"){oe(n),e.dataset.drop="",Je._currentDropTargetRow=e;return}delete e.dataset.drop,Je._currentDropTargetRow=e;let r=[...n.querySelectorAll(ut)],i=r.indexOf(e),s=Je.layerDragSourceHeight;for(let a=0;a<r.length;a++){if(r[a].dataset.dragging!==void 0)continue;if(o.type==="reorder-above")r[a].style.transform=a>=i?`translateY(${s}px)`:"";else r[a].style.transform=a>i?`translateY(${s}px)`:""}}function oe(e){if(Je._currentDropTargetRow)delete Je._currentDropTargetRow.dataset.drop,Je._currentDropTargetRow=null;let t=e.querySelectorAll(ut);for(let n of t)n.style.transform="",n.style.display=""}function rm(e,t,n,o){if(!e)return;let r=e.doc.document;if(n.type==="tree-node"){let i=n.path,s=ht(o),a=_n(o);if(t.type!=="make-child"&&(!s||typeof a!=="number"))return;switch(t.type){case"reorder-above":{q(e,(l)=>pa(l,i,s,a));break}case"reorder-below":{q(e,(l)=>pa(l,i,s,a+1));break}case"make-child":{let l=K(r,o),c=_o(l).length;q(e,(d)=>pa(d,i,o,c));break}default:break}}else if(n.type==="block"){let i=ht(o),s=_n(o);if(t.type!=="make-child"&&(!i||typeof s!=="number"))return;switch(t.type){case"reorder-above":{q(e,(c)=>Ji(c,i,s,structuredClone(n.fragment)));break}case"reorder-below":{q(e,(c)=>Ji(c,i,s+1,structuredClone(n.fragment)));break}case"make-child":{let c=K(r,o),d=_o(c).length;q(e,(f)=>Ji(f,o,d,structuredClone(n.fragment)));break}default:break}let l=n.fragment?.tagName;if(qe(l).includes("-")){let c=st.find((h)=>h.tagName===l),d=e.doc.document?.$elements??[],f=c?om(d,c,e.documentPath??null):d;if(f.length!==d.length)Hs(e,(h)=>{h.$elements=f})}}}function bn(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 ke=new WeakMap,g=new Set,z=0,ae=new Map,An=-1,$n=0,ar=600;function nC(e){return An===e&&Date.now()-$n<=ar}var wn=0,In=new Set;function sr(e,t){let n;try{n=new URL(e,t.iframe.src||pm())}catch{return}if(!["http:","https:","mailto:","tel:"].includes(n.protocol))return;let o=n.href,r=Qw();if(r){r(o);return}window.open(o,"_blank","noopener,noreferrer")}function iC(e){In.add(e)}function lr(e){return In.delete(e)}var L=new Map,Z=new Map,se=new Map,cr=300;function oC(e,t,n,o=cr){let r=null;for(let a of g){if(!a.iframe.isConnected){g.delete(a);continue}if(a.ready&&!a.stylebook&&e!==null&&a.tabId===e){r=a;break}}if(!r)return Promise.resolve(null);wn+=1;let i=wn,s=JSON.parse(JSON.stringify(t));return r.channel.post({contextPath:n?[...n]:null,exprs:s,gen:r.lastRenderedGen,kind:"evalExpr",reqId:i}),new Promise((a)=>{let l=setTimeout(()=>{L.delete(i),Z.delete(i),a(null)},o);Z.set(i,r),L.set(i,(c)=>{clearTimeout(l),Z.delete(i),a(c)})})}var Cn=0,X=new Map,dr=250;function rC(e,t=dr){let n=[];for(let o of g){if(!o.iframe.isConnected){g.delete(o);continue}if(o.ready&&!o.stylebook&&e!==null&&o.tabId===e)n.push(o)}if(n.length===0)return Promise.resolve();return new Promise((o)=>{let r=n.length,i=setTimeout(()=>{for(let l of a)X.delete(l),se.delete(l);o()},t),s=()=>{if(r-=1,r===0)clearTimeout(i),o()},a=[];for(let l of n){Cn+=1;let c=Cn;a.push(c),X.set(c,s),se.set(c,l),l.channel.post({kind:"flushEdits",reqId:c})}})}function sC(e){return ke.get(e)??null}function sm(e){for(let t of g){if(!t.iframe.isConnected)continue;let n=Oe(t.iframe);if(e.x>=n.left&&e.x<=n.right&&e.y>=n.top&&e.y<=n.bottom)return t}return null}function am(e,t,n){z+=1,ae.set(z,n);let o=t.type==="tree-node"?{path:[...t.path],type:"tree-node"}:{type:t.type};return e.channel.post({dragSeq:z,gen:e.lastRenderedGen,kind:"dragStart",src:o}),z}function fx(){return z}function za(e){let t=Oe(e.iframe),n=e.iframe.clientWidth>0?t.width/e.iframe.clientWidth:1;return{rect:t,scale:n}}function Dn(e){if(e.stylebook)return"stylebook";return e.tabId??"unbound"}function aC(){let e=[];for(let t of g){if(!t.iframe.isConnected){g.delete(t);continue}let n=`canvas[${Dn(t)}]`;if(!t.ready){e.push(`${n}: frame has not handshaked`);continue}let o=[...t.pendingTabIds.keys()];if(o.length>0)e.push(`${n}: gen ${o.join(", ")} unacked`);if(t.pendingPatches>0)e.push(`${n}: ${t.pendingPatches} unacked patch(es)`);if(t.pendingMeasures.size>0)e.push(`${n}: ${t.pendingMeasures.size} measure(s) in flight`);let{idle:r}=t;if(!r){e.push(`${n}: no quiescence report yet`);continue}if(r.gen!==t.lastRenderedGen)e.push(`${n}: quiescence is for gen ${r.gen}, DOM is gen ${t.lastRenderedGen}`);if(!r.fonts)e.push(`${n}: fonts still loading`);if(r.animations>0)e.push(`${n}: ${r.animations} running animation(s)`);if(r.images>0)e.push(`${n}: ${r.images} pending image retry(ies)`)}if(L.size>0)e.push(`canvas: ${L.size} expression eval(s) in flight`);return e}var pr=500,fr=2,mr=40;function Jn(){let e=u.value?.id??null,t=null;for(let n of g){if(!n.iframe.isConnected){g.delete(n);continue}if(!n.ready||n.stylebook)continue;if(n.tabId===e)return n;t??=n}return t}function vr(e,t){let{rect:n,scale:o}=za(e),r=n.left+t.x*o,i=n.top+t.y*o,s=t.width*o,a=t.height*o;return{height:a,left:r,top:i,width:s,x:r+s/2,y:i+a/2}}function Re(e,t){return new Promise((n)=>{e.selReqId+=1;let o=e.selReqId,r=setTimeout(()=>{e.pendingMeasures.delete(o),n(null)},pr);e.pendingMeasures.set(o,(i)=>{clearTimeout(r);let[s]=i;n(s?vr(e,s.rect):null)}),e.channel.post({kind:"measure",paths:[[...t]],reqId:o})})}function lC(e){let t=Jn();return t?Re(t,e):Promise.resolve(null)}function yr(e){return new Promise((t)=>{let n=Number.NaN,o=0,r=0,i=()=>{let{top:s}=Oe(e.iframe);if(o=s===n?o+1:0,n=s,r+=1,o>=fr||r>=mr){t();return}requestAnimationFrame(i)};requestAnimationFrame(i)})}async function lm(e){let t=Jn();return t?n$(t,e):null}async function n$(e,t){let n=await Re(e,t);if(!n)return null;let o=_(e.canvasEl)?.surface;return Pb({height:n.height,top:n.top},o),await yr(e),Re(e,t)}function b$(e,t){let n=sC(e);return n?Re(n,t):Promise.resolve(null)}function br(e){let t=e.canvasEl.parentElement;if(!t)return;let n=/scale\(([\d.]+)\)/.exec(e.canvasEl.style.transform),o=n?Number(n[1]):1;t.style.height=o===1?"":`${e.iframe.offsetHeight*o}px`}function Ln(e){if(e.preview){e.iframe.style.height="100%",e.iframe.style.minHeight="0px";return}if(e.contentHeight===null)return;e.iframe.style.height=`${e.contentHeight}px`,e.iframe.style.minHeight=e.contentFragment?"0px":"480px",br(e)}function gt(e,t){if(e.preview=t,e.overlay.setSuppressed(t),t)e.pendingEnterEdit=null;Ln(e)}function cC(e,t){gt(yt(e),t)}function Rl(e,t){if(!e.iframe.isConnected)return;e.channel.post(t)}function Hb(e){ae.delete(e)}function Bb(e){e.overlay.setDropIndicator(null)}var jn=null;function dC(e){jn=e}var xr=300,qn=null;function uC(e){qn=e}var vt=null;function hC(e){vt=e}function wr(e,t,n){if((t?Cr(t.tagName):!1)&&t){e.overlay.setDropIndicator(null),e.overlay.setReplaceTarget(M(t.rect));return}e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(n?M(n.referenceRect):null,n?.edge)}function Pn(e){e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(null)}function Cr(e){return e==="img"||e==="video"||e==="source"}function Pr(e,t){if(e.dataset.jxGutterDrop==="1")return;e.dataset.jxGutterDrop="1",e.addEventListener("dragover",(n)=>{if(![...n.dataTransfer?.types??[]].includes("Files"))return;if(n.preventDefault(),n.dataTransfer)n.dataTransfer.dropEffect="copy"}),e.addEventListener("drop",(n)=>{let o=n.dataTransfer?.files,r=t();if(!o?.length||!r||r.stylebook)return;n.preventDefault(),vt?.(P(r),[...o],null,null)})}var Te=null;function pC(e){Te=e}var Me=null;function fC(e){Me=e}var Fn=null;function mC(e){Fn=e}function Sn(e,t){let n=[...t];for(;;){let o=e.get(Il(n));if(o)return o;if(n.length<2)return null;n=n.slice(0,-2)}}var S=null;function gC(){let e=S;return Boolean(e?.editing&&e.iframe.isConnected)}var Ne=null;function bC(e){Ne=e}var mt=null;function vC(e){mt=e}var En=null,Wn=null;function yC(e){Wn=e}function wC(e,t){for(let n of g){if(!n.iframe.isConnected){g.delete(n);continue}if(n.ready&&n.tabId===e.id&&!n.preview)n.popoverOpen=t,n.channel.post({kind:"setPopoverOpen",path:t})}}function xC(e,t){for(let n of g){if(!n.iframe.isConnected){g.delete(n);continue}if(n.ready&&n.tabId===e.id&&!n.preview)n.dialogOpen=t,n.channel.post({kind:"setDialogOpen",path:t})}}function mx(e,t){let n=0;for(let o of g){if(!o.iframe.isConnected){g.delete(o);continue}if(o.ready&&o.tabId===t){let r=_(o.canvasEl)?.surface;if(!r){Ab("host-stage-unresolved");continue}let i=r.renderGeneration,s=Ae?.host===o?Ae.paths:void 0;$e(o),o.channel.post(s?{echoPaths:s,forwardOps:e,gen:i,kind:"patch"}:{forwardOps:e,gen:i,kind:"patch"}),o.pendingPatches+=1,n+=1}}return n}var Ae=null,Sr=0;function Tn(e,t,n){Ae={host:e,paths:t};try{n()}finally{Ae=null}}var dt=null,pt=null;function Er(e,t,n){return!e&&t===n}function Tr(e,t){let n=P(e);if(!n)return;let o=K(n.doc.document,t);if(!o)return;mx([{key:"$props",op:"set-key",path:t,value:o.$props}],n.id)}function P(e){return e.tabId?m.tabs.get(e.tabId)??null:null}function _C(e){return P(e)}function Pe(e){let t=_(e.canvasEl)?.surface.paneId;if(t)$r(t)}var Mr=Object.freeze([]);function Nr(){let e=new Map;for(let t of m.panes){let n=t.activeTabId?m.tabs.get(t.activeTabId):null;if(!n)continue;let o=n.session.selection??[];o.map((r)=>r.join("/")).join("|"),e.set(n.id,o)}return e}function kr(){if(En)return;let e=ge(!0);e.run(()=>{Q(()=>{let t=Nr();y.stylebook.selection;for(let n of g)Ie(n,(n.tabId?t.get(n.tabId):null)??Mr)})}),En={stop:()=>e.stop()}}function $e(e){if(!e.ready)return;let t=Rd();if(t===e.postedVersions)return;if(e.postedVersions===null&&Object.keys(t).length===0){e.postedVersions=t;return}e.postedVersions=t,e.channel.post({kind:"assetVersions",versions:t})}var Mn=!1,ft=!1;function Rr(){if(Mn)return;Mn=!0,ge(!0).run(()=>{Q(()=>{if(jC.value,ft)return;ft=!0,queueMicrotask(()=>{ft=!1,Or()})})})}function Or(){for(let e of g){if(!e.iframe.isConnected){g.delete(e);continue}$e(e)}}var Nn=!1,Ee=null;function Ar(){if(Nn)return;Nn=!0,ge(!0).run(()=>{Q(()=>{for(let t of m.panes){let n=t.activeTabId?m.tabs.get(t.activeTabId):null;if(!n)continue;let{peers:o}=xn(n);o.map((r)=>JSON.stringify(r.state.structuralSelection??null)).join("|")}if(Ee)clearTimeout(Ee);Ee=setTimeout(()=>{Ee=null;for(let t of g)Vn(t)},100)})})}function Vn(e){if(e.stylebook||!e.ready||!e.iframe.isConnected)return;let t=P(e),n=t?xn(t).peers:[];e.presenceMeta.clear();let o=[];for(let r of n){let{structuralSelection:i}=r.state;if(!i||r.state.focusedPath!==t?.documentPath)continue;for(let s of i){let a=[...s];o.push(a),e.presenceMeta.set(JSON.stringify(a),{color:r.state.user.color,label:r.state.user.name??r.state.user.login})}}if(o.length===0){e.presenceReqId=-1,e.overlay.setPresence([]);return}e.selReqId+=1,e.presenceReqId=e.selReqId,e.channel.post({kind:"measure",paths:o,reqId:e.presenceReqId})}function Ie(e,t){if(e.stylebook){Ir(e);return}let n=Le(t);if(e.selectionPath=n,e.selectionPaths=t,!e.iframe.isConnected){g.delete(e);return}if(!n){e.coSelectionKeys.clear(),e.overlay.setSelection(null),e.overlay.setCoSelection([]);return}if(!e.ready)return;let o=ms(t.slice(0,-1));e.coSelectionKeys=new Set(o.map((r)=>JSON.stringify(r))),e.selReqId+=1,e.channel.post({kind:"measure",paths:[[...n],...o],reqId:e.selReqId})}function Ir(e){if(!e.iframe.isConnected){g.delete(e);return}let t=y.stylebook.selection,n=t?e.stylebook?.tagToCardPath.get(t):void 0;if(!t||!n){e.overlay.setSelection(null);return}if(!e.ready)return;e.selReqId+=1,e.channel.post({kind:"measure",paths:[[...n]],reqId:e.selReqId})}function kn(){return zv("../canvas.html")}var Dr="about:blank";function Bn(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),S===e)S=null;e.overlay.root.remove(),e.iframe.remove(),ke.delete(e.canvasEl),g.delete(e)}function Hr(){if(!We())return kn();let e=p();if(e.canvasUrl)return e.canvasUrl;return e.canvasUrlDeferred?Dr:kn()}function cm(e){let t=0;for(let n of new Set(g))if(e.contains(n.canvasEl))Bn(n),t+=1;return t}function yt(e){let t=Hr(),n=ke.get(e);if(n){if(n.canvasUrl===t)return n;Bn(n)}let o=location.origin,r=crypto.randomUUID(),i=new URL(t,location.href).origin,s=document.createElement("iframe");s.className="jx-canvas-iframe",s.title="Canvas — live page render",s.style.cssText="width:100%;min-height:480px;height:100%;border:0;display:block;background:#fff";let a=new URL(t,location.href);if(a.searchParams.set("token",r),location.protocol==="http:"||location.protocol==="https:")a.searchParams.set("parentOrigin",o);if(s.src=i===o?`${a.pathname}${a.search}`:a.href,!e.style.position)e.style.position="relative";let l=zt(document);e.replaceChildren(s,l.root),Pr(e,()=>sC(e));let c=xt({acceptOrigin:i,source:window,target:{postMessage:(f,h)=>s.contentWindow?.postMessage(f,h)},targetOrigin:i,token:r}),d={canvasEl:e,canvasUrl:t,channel:c,contentFragment:!1,contentHeight:null,hiddenPaths:new Set,popoverOpen:null,dialogOpen:null,editing:!1,editingProp:null,iframe:s,insertHideTimer:null,insertHover:!1,coSelectionKeys:new Set,insertZone:null,lastRenderedGen:-1,lastSelectionRect:null,lastSnapshotSeq:0,overlay:l,panReqId:-1,pending:null,postedVersions:null,idle:null,pendingEnterEdit:null,pendingMeasures:new Map,pendingPatches:0,pendingTabIds:new Map,presenceMeta:new Map,presenceReqId:-1,preview:!1,ready:!1,selectionPath:null,selectionPaths:[],selReqId:0,snapshot:null,stylebook:null,tabId:null};return l.insertButton.addEventListener("click",(f)=>jr(d,f)),l.insertButton.addEventListener("mouseenter",()=>{d.insertHover=!0,le(d)}),l.insertButton.addEventListener("mouseleave",()=>{d.insertHover=!1,Kn(d)}),c.onMessage((f)=>Fr(d,f)),ke.set(e,d),g.add(d),kr(),Ar(),Rr(),d}function Lr(e,t){le(e),e.insertZone=t,e.overlay.setInsertZone(M(t.rect),t.edge)}function zn(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 Kn(e){le(e),e.insertHideTimer=setTimeout(()=>{if(e.insertHideTimer=null,_r(e))return;zn(e)},xr)}function le(e){if(e.insertHideTimer!==null)clearTimeout(e.insertHideTimer),e.insertHideTimer=null}function jr(e,t){t.stopPropagation(),t.preventDefault();let n=e.insertZone;if(!n)return;qn?.(e.overlay.insertButton,n)}var qr=new Set(["contextMenu","dragOver","dropResult","editCommit","editCommitProp","editInsert","editMerge","editRangeReplace","editSplit","editStart","fileDragOver","fileDrop","hit","hover","insertZones","layoutHit","nativeDragEnter"]);function Fr(e,t){if(e.preview&&qr.has(t.kind))return;switch(t.kind){case"ready":{e.ready=!0;let n=bt?.();if(n)e.channel.post({chords:n.chords,kind:"keymap",mac:n.mac});if(e.postedVersions=null,$e(e),e.pending)e.channel.post(e.pending),e.pending=null;Ie(e,e.selectionPaths);return}case"paneFocus":{Pe(e),mt?.();return}case"popoverTargetClick":{let n=P(e);if(!n||e.preview)return;let o=JSON.stringify(n.session.ui.openPopover)===JSON.stringify(t.targetPath),r=t.action==="show"||t.action==="toggle"&&!o;if(r||o)ne()?.run("canvas.setPopoverOpen",{open:r,path:t.targetPath});return}case"commandTargetClick":{let n=P(e);if(!n||e.preview)return;let o=(i)=>JSON.stringify(i)===JSON.stringify(t.targetPath),r=K(n.doc.document,t.targetPath);if(!r||typeof r!=="object")return;if(Ze.has(t.command)){if(!Gs(r))return;let i=t.command==="show-popover"||t.command==="toggle-popover"&&!o(n.session.ui.openPopover);if(i||o(n.session.ui.openPopover))ne()?.run("canvas.setPopoverOpen",{open:i,path:t.targetPath})}else if(Ge.has(t.command)){if(!H(r))return;let i=t.command==="show-modal";if(i||o(n.session.ui.openDialog))ne()?.run("canvas.setDialogOpen",{open:i,path:t.targetPath})}return}case"hit":{Pe(e),mt?.(),OC(null);let n=null,o=_(e.canvasEl)?.panel;if(o?.mediaName&&!o.mediaName.startsWith("git-diff")){n=me(o.mediaName);let i=P(e);if(i)i.session.ui.activeMedia=n}if(Me?.dismiss(),e.stylebook){let i=Sn(e.stylebook.pathToTag,t.hit.path);if(Fn?.(i,n),i){let s=M(t.hit.rect);e.overlay.setSelection(s,`<${i}>`),e.lastSelectionRect=s}else e.overlay.setSelection(null);return}e.selectionPath=t.hit.path,e.selectionPaths=[t.hit.path];let r=P(e);if(r)r.session.selection=t.additive?uv(r.session.selection,t.hit.path):[t.hit.path];{let i=M(t.hit.rect);e.overlay.setSelection(i),e.lastSelectionRect=i}return}case"layoutHit":{if(e.stylebook)return;Pe(e),Me?.dismiss(),OC(t.hit),e.selectionPath=null,e.selectionPaths=[];let n=P(e);if(n)n.session.selection=[];let o=M(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?Sn(e.stylebook.pathToTag,t.hit.path):null,o=y.stylebook.selection;if(t.hit&&n&&n!==o)e.overlay.setHover(M(t.hit.rect));else e.overlay.setHover(null);return}zr(e,t.hit);return}case"insertZones":{if(e.stylebook)return;let n=t.zones?.[0]??null;if(n)Lr(e,n);else Kn(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:M(r.rect)})}e.overlay.setPresence(o);return}if(t.reqId===e.panReqId){e.panReqId=-1;let[o]=t.hits;if(o){let{rect:r,scale:i}=za(e);Pb({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?M(a.rect):null}else for(let a of t.hits){let l=JSON.stringify(a.path);if(l===o)i=M(a.rect);else if(e.coSelectionKeys.has(l))r.push(M(a.rect))}let s=e.stylebook?y.stylebook.selection:null;e.overlay.setSelection(i,s?`<${s}>`:null),e.overlay.setCoSelection(r),e.lastSelectionRect=i,e.hiddenPaths=new Set((t.hidden??[]).map((a)=>JSON.stringify(a)))}return}case"evalResult":{let n=L.get(t.reqId);if(!n)return;L.delete(t.reqId),Z.delete(t.reqId),n(t.gen===e.lastRenderedGen?t.results:null);return}case"renderComplete":{if(e.pendingTabIds.has(t.gen))e.tabId=e.pendingTabIds.get(t.gen)??null;for(let n of e.pendingTabIds.keys())if(n<=t.gen)e.pendingTabIds.delete(n);Rn(e,t.gen);return}case"patchComplete":{e.pendingPatches=Math.max(0,e.pendingPatches-1),Rn(e,t.gen);return}case"idle":{e.idle={animations:t.animations,fonts:t.fonts,gen:t.gen,images:t.images};return}case"renderError":{e.pendingTabIds.delete(t.gen);let n=P(e);if(n)n.session.canvas.refreshing=!1,Ai("leftPanel");k.error("The page could not be rendered.",{detail:t.message,key:`canvas.render:${Dn(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,Ln(e);return}case"dragOver":{if(t.dragSeq!==z)return;if(t.cursor)An=t.dragSeq,$n=Date.now();if(t.gen!==e.lastRenderedGen)return;if(t.preview)e.overlay.setDropIndicator(M(t.preview.referenceRect),t.preview.edge);else e.overlay.setDropIndicator(null);if(t.cursor){let n=za(e);hx(t.cursor.x*n.scale+n.rect.left,t.cursor.y*n.scale+n.rect.top)}return}case"nativeDragEnter":{if(e.stylebook)return;jn?.(e);return}case"dragEnd":{e.overlay.setDropIndicator(null),_d(),ae.delete(t.dragSeq);return}case"dropResult":{if(t.dragSeq!==z||t.gen!==e.lastRenderedGen)return;if(t.instruction&&t.targetPath){let n=ae.get(t.dragSeq);if(n)rm(P(e),{type:t.instruction},n,t.targetPath)}ae.delete(t.dragSeq),e.overlay.setDropIndicator(null),_d();return}case"fileDragOver":{if(e.stylebook)return;wr(e,t.hit,t.preview);return}case"fileDragLeave":{Pn(e);return}case"fileDrop":{if(Pn(e),e.stylebook)return;vt?.(P(e),t.files,t.hit,t.preview);return}case"patchError":{e.pendingPatches=Math.max(0,e.pendingPatches-1);let n=_(e.canvasEl)?.surface;if(n)Wn?.(n.paneId);return}case"forwardKey":{Br(t.event);return}case"forwardWheel":{Vr(e,t);return}case"editStart":{if(S&&S!==e)S.editing=!1,S.editingProp=null,S.snapshot=null;if(S=e,t.prop!==void 0&&pt===Il(t.path))ie(e,t.path,void 0,t.prop);pt=null,Sr+=1,e.editing=!0,e.editingProp=t.prop??null,e.snapshot=null,e.lastSnapshotSeq=0,Ne?.();return}case"selectionChanged":{if(t.seq<=e.lastSnapshotSeq)return;if(e.lastSnapshotSeq=t.seq,e.snapshot=t,!e.editing)e.editing=!0,S=e;Ne?.();return}case"flushComplete":{let n=X.get(t.reqId);if(n)X.delete(t.reqId),se.delete(t.reqId),n();return}case"editCommit":{let n=()=>_t(P(e),t.path,t.children,t.textContent);if(t.inPlace)Tn(e,[t.path],n);else n();return}case"editCommitProp":{let n=()=>jt(P(e),t.path,t.prop,t.value);if(t.inPlace){Tn(e,[t.path],n),dt=Il(t.path);return}let o=n();if(Er(o,dt,Il(t.path)))Tr(e,t.path);dt=null,pt=o?Il(t.path):null;return}case"editMerge":{let n=qt(P(e),t.fromPath,t.intoPath);if(n)ie(e,n.path,n.offset);return}case"editRangeReplace":{let n=Bt(P(e),t.from,t.to,t.between,t.text);if(n)ie(e,n.path,n.offset);return}case"editSplit":{ie(e,Wt(P(e),t.path,t.before,t.after));return}case"editInsert":{ie(e,Vt(P(e),t.path,t.cmd,t.commitData));return}case"slashShow":{let{rect:n,scale:o}=za(e),r=t.rect.x*o+n.left,i=t.rect.y*o+n.top;Te?.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":{Te?.nav(t.key);return}case"slashDismiss":{Te?.dismiss();return}case"previewNavigate":{sr(t.href,e);return}case"contextMenu":{if(e.stylebook)return;Pe(e);let{rect:n,scale:o}=za(e);Me?.show({clientX:t.x*o+n.left,clientY:t.y*o+n.top,path:t.path?[...t.path]:null});return}case"editEnd":{if(!e.editing)return;if(e.editing=!1,e.editingProp=null,e.snapshot=null,S===e)S=null;Ne?.();break}default:break}}function Rn(e,t){if(e.lastRenderedGen=t,Ie(e,e.selectionPaths),Vn(e),zn(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===im(e.canvasEl)?.id)Wr(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 Wr(e,t,n,o){e.channel.post({kind:"enterEdit",path:[...t],...n===void 0?{}:{offset:n},...o===void 0?{}:{prop:o}})}function Vr(e,t){let{rect:n,scale:o}=za(e),r=jl(e.canvasEl)?.wrap;if(!r)return;r.dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:n.left+t.x*o,clientY:n.top+t.y*o,ctrlKey:t.ctrlKey,deltaX:t.deltaX,deltaY:t.deltaY,metaKey:t.metaKey,shiftKey:t.shiftKey}))}function Br(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 zr(e,t){if(!t||Yo(t.path,e.selectionPath)){e.overlay.setHover(null);return}e.overlay.setHover(M(t.rect))}var Ur=4,B=new Map;function Gr(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<=Ur)break;B.delete(o)}return n}function Zr(e,t,n,o,r,i=null){let s=Gr(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=lr(r),d=nx(At,async()=>{xo.renderPreparations+=1;let f=await kt(t,o,i),h=JSON.parse(JSON.stringify(f.renderDoc)),b=JSON.parse(JSON.stringify(t)),T=n?m.tabs.get(n)??null:null,R=wi(T?.doc.sourceFormat)?.studio?.elements,O=R?bn(R):void 0;return{assets:f.assets,doc:h,docBase:f.docBase??`${pm()}/`,mapperCtx:f.mapperCtx,mode:f.mapperCtx.canvasMode,shadowDoc:b,siteStyle:f.siteStyle,...O?{editableTags:O}:{},...c?{allowAutoRequests:!0}:{}}});return s.set(t,{mode:i,payload:d,tabId:n,viewTabId:a}),d}async function CC(e,t,n,o,r=null,i=im(n),s=null,a=null){let l=yt(n);l.pendingTabIds.set(e,r),l.stylebook=null,l.iframe.style.width=o?`${o}px`:"100%";let d={...await Zr(e,t,r,i,$b(n),s),colorScheme:Gn(i),...a?{diffMarks:a}:{},gen:e,kind:"render",popoverOpen:i?.session.ui.openPopover??null,dialogOpen:i?.session.ui.openDialog??null};l.popoverOpen=d.popoverOpen??null,l.dialogOpen=d.dialogOpen??null,gt(l,d.mode==="preview"),Un(l,d)}function Un(e,t){if(xo.hostRenderPosts+=1,e.ready)$e(e),e.channel.post(t);else e.pending=t}function kC(e,t,n,o){let r=yt(n);r.pendingTabIds.set(e,null),r.stylebook={pathToTag:t.pathToTag,tagToCardPath:t.tagToCardPath},gt(r,!1),r.pendingEnterEdit=null,r.iframe.style.width=o?`${o}px`:"100%";let i=JSON.parse(JSON.stringify(t.doc)),s=JSON.parse(JSON.stringify(t.doc)),a={assets:null,colorScheme:Gn(im(n)),doc:i,docBase:`${pm()}/`,gen:e,kind:"render",mapperCtx:{arrayPaths:[],canvasMode:"stylebook",layoutWrapped:!1,pageContentOffset:null,pageContentPrefix:null},mode:"stylebook",shadowDoc:s,siteStyle:null};Un(r,a)}function Gn(e){let t=e?.session.ui.previewColorScheme;return t==="light"||t==="dark"?t:null}function SC(e,t){for(let n of g){if(!n.iframe.isConnected){g.delete(n);continue}if(t&&!t.contains(n.iframe))continue;if(n.ready)n.channel.post({kind:"setColorScheme",scheme:e})}}function EC(e,t){let n=gL(e);for(let o of g){if(!o.iframe.isConnected){g.delete(o);continue}if(t&&!t.contains(o.iframe))continue;if(o.ready)o.channel.post({dir:n,kind:"setLocale",locale:e})}}function TC(e,t){let n=JSON.parse(JSON.stringify(e)),o=0;for(let r of g){if(!r.iframe.isConnected){g.delete(r);continue}if(r.ready)r.channel.post({base:t,doc:n,kind:"redefineElement"}),o+=1}return o}function LC(){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 g){if(!o.iframe.isConnected){g.delete(o);continue}if(o.ready&&!o.stylebook)o.channel.post({kind:"siteStyleUpdate",media:n,siteStyle:t})}}function zb(e){let t=0,n=JSON.parse(JSON.stringify(e));for(let o of g){if(!o.iframe.isConnected){g.delete(o);continue}if(o.ready&&o.stylebook)o.channel.post({gen:o.lastRenderedGen,kind:"styleUpdate",style:n}),t+=1,Ie(o,o.selectionPaths)}return t}function IC(e){let t=Zn();if(!t?.stylebook||!t.ready)return;let n=t.stylebook.tagToCardPath.get(e);if(!n)return;t.selReqId+=1,t.panReqId=t.selReqId,t.channel.post({kind:"measure",paths:[[...n]],reqId:t.selReqId})}function Wa(){let e=S;if(!e||!e.iframe.isConnected)return{editing:!1,editingProp:null,snapshot:null};return{editing:e.editing,editingProp:e.editingProp,snapshot:e.snapshot}}var bt=null;function RC(e,t){bt=e,t?.(()=>On()),On()}function On(){let e=bt?.();if(!e)return;for(let t of g){if(!t.iframe.isConnected){g.delete(t);continue}if(t.ready)t.channel.post({chords:e.chords,kind:"keymap",mac:e.mac})}}function Cd(e){let t=S;if(!t||!t.ready)return;t.channel.post({intent:e,kind:"applyFormat"})}function $C(){let e=S;if(!e||!e.ready)return;e.channel.post({kind:"openSlash"})}function Wb(){let e=S;if(e?.editing&&e.ready&&e.iframe.isConnected)e.channel.post({kind:"endEdit"})}function Zn(){let e=Ut();return e?sC(e.canvas):null}function gx(){let e=S,t=e??Zn();if(!t)return null;let{rect:n,scale:o}=za(t),r=t===e?t.snapshot?.rect:null;if(r)return{height:r.height*o,left:r.x*o+n.left,top:r.y*o+n.top,width:r.width*o};if(t.lastSelectionRect)return{height:t.lastSelectionRect.height*o,left:t.lastSelectionRect.left*o+n.left,top:t.lastSelectionRect.top*o+n.top,width:t.lastSelectionRect.width*o};return null}
2
- export{Uo,lt,ur,Xw,Tl,wo,Nu,$b,im,vT,Qw,Db,Ll,yT,wT,xT,ex,_T,CT,kT,ST,xo,Ab,tx,nx,bi,yd,ET,Il,wd,TT,ix,LT,Nb,IT,Ob,Ou,hr,RT,cp,$T,DT,ox,AT,rx,NT,sx,G1,K1,ax,lx,Mu,OT,MT,Mb,us,xd,Pu,PT,FT,cx,J1,jT,dx,ux,HT,Pb,BT,Y1,Z1,X1,zT,Fb,Q1,hx,_d,wc,jb,Fu,eC,om,tC,WT,VT,px,UT,qT,GT,rm,nC,iC,oC,rC,sC,sm,am,fx,za,aC,lC,lm,n$,b$,cC,Rl,Hb,Bb,dC,uC,hC,pC,fC,mC,gC,bC,vC,yC,wC,xC,mx,_C,cm,CC,kC,SC,EC,TC,LC,zb,IC,Wa,RC,Cd,$C,Wb,gx};
3
-
4
- //# debugId=8587CC83433C749E64756E2164756E21
5
- //# sourceMappingURL=studio-5gs9th4b.js.map
@@ -1,5 +0,0 @@
1
- import{tt,Ni}from"./studio-sxc0zvpt.js";import{vI,zx,un,rn,Pm,CI,ne}from"./studio-cp1gbff9.js";import{ge,Q,v,$c,k,Wd}from"./studio-fqq890ap.js";import{te}from"./studio-ery42sqr.js";var rt="data-jx-region",ce=["rail","navigator","inspector","pane","dock.bottom","statusbar","commandbar","overlay"],de=new Set(["dock.bottom"]);function ue(e){let t=e.indexOf("/"),o=t===-1?e:e.slice(0,t),n=t===-1?void 0:e.slice(t+1);if(n===""||o==="")return null;let a=o,i;if(!de.has(o)){let s=o.indexOf(".");if(s!==-1){if(a=o.slice(0,s),i=o.slice(s+1),i==="")return null}}if(!ce.includes(a))return null;return i===void 0?n===void 0?{surface:a}:{part:n,surface:a}:n===void 0?{instance:i,surface:a}:{instance:i,part:n,surface:a}}function fe(e){return ue(e)!==null}function me(e){if(e==="pane")return"pane.primary";return e.startsWith("pane/")?`pane.primary/${e.slice(5)}`:e}function B(e){return e??document}var pe=[{locate:([,e],t)=>{let n=Ip(`inspector/field:${e}`,t)?.querySelector('[part="browse"]');return n?[n]:[]},pattern:/^inspector\/field:(.+)\/browse$/},{locate:([,e],t)=>{let o=Ip("inspector",t);return o?[...o.querySelectorAll(`[data-prop="${CSS.escape(e)}"]`)]:[]},pattern:/^inspector\/field:(.+)$/}];function ve(e,t){let o=me(e);if(!fe(o))return[];let n=[...B(t).querySelectorAll(`[data-jx-region="${CSS.escape(o)}"]`)];if(n.length>0)return n;for(let a of pe){let i=o.match(a.pattern);if(i)return a.locate(i,B(t))}return[]}function Ip(e,t){return ve(e,t).at(-1)??null}var fk={dock:"dock.bottom",inspector:"inspector",navigator:"navigator",pane:"pane.primary",rail:"rail",status:"statusbar"};function Zi(e,t){return t?`pane.${e}/${t}`:`pane.${e}`}function uI(e){return Zi(e,"tabs")}function hI(e){return`navigator/panel:${e}`}function pI(e){return`inspector/tab:${e}`}var fI="navigator/statements";function mI(e){return`inspector/statements:${e}`}function Iv(e){return`dock.bottom/panel:${e}`}var he={dialog:"dialog",modal:"dialog",popover:"menu",toast:"toasts"};function zt(e,t){let o=he[e];return t?`overlay.${o}:${t}`:`overlay.${o}`}var A=new Map,Y=1;function X(e){let t=Y;return Y+=1,A.set(t,{...e,id:t}),t}function H(e){A.delete(e)}function Z(){return[...A.values()]}function cI(e){let t=e.toLowerCase();return Z().filter((o)=>o.elements.has(t))}function dI(e){return Z().filter((t)=>t.name===e)}var P=null;function pk(e=document){return P??=CI({document:e}),P}function ee(){return P??pk()}var S="jx-studio:/surfaces/",L=new Map;function T(e,t){L.set(e,t),zx(ye(e),t)}function ye(e){return`${S}${e}.json`}function gI(e){return L.get(e)}function be(e){if(!e.startsWith(S)||!e.endsWith(".json"))return;return L.get(e.slice(S.length,-5))}async function R(e,t,o,n={}){let a=L.get(e);if(!a)throw Error(`Studio surface "${e}" is not registered`);if(await ee(),n.region)o.setAttribute(rt,n.region);let i=await vI(a,o,{scope:t,base:S,resolver:be,...n.onNodeCreated?{onNodeCreated:n.onNodeCreated}:{},...n.onNodeMoved?{onNodeMoved:n.onNodeMoved}:{},...n.signal?{signal:n.signal}:{}}),s=(r)=>({dispose:r,elements:i.elements,root:i.root,scope:i.scope});if(n.signal?.aborted)return s(i.dispose);let d=0,l=()=>{i.dispose(),H(d)};return d=X({elements:i.elements,host:o,name:e,remount:async()=>{l(),await R(e,t,o,n)}}),n.signal?.addEventListener("abort",()=>H(d),{once:!0}),s(l)}var oe={$schema:"https://jxsuite.com/schema/v1",$id:"StudioDialog",$description:"Studio's confirm, save-or-discard and prompt dialogs: one jx-dialog whose body is projected from the adapter's scope. `message` is a sentence; `choice` is a `jx-select` over the options; `field` is the prompt's jx-textfield with its refusal. The four answers call the host's functions, and the host decides when the dialog closes.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},secondaryLabel:{$ref:"#/state/secondaryLabel"},cancelLabel:{$ref:"#/state/cancelLabel"},destructive:{$ref:"#/state/destructive"},size:{$ref:"#/state/size"}},attributes:{headline:"${state.headline}","confirm-label":"${state.confirmLabel || null}","secondary-label":"${state.secondaryLabel || null}","cancel-label":"${state.cancelLabel || null}",part:"dialog-host"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},onsecondary:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/secondary"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{'& [part="message"]':{$description:"The one part of a dialog that is text rather than interface, so it opts back in to selection. The root sets `user-select: none` and `styles/tokens.json` restates it on every `dialog`, so the headline, the labels and the buttons around this sentence stay unselectable; a message is often the thing a reader copies into a search or a bug report.",margin:"0 0 var(--jx-space-3)",userSelect:"text"},'& [part="message"]:last-child':{margin:"0"},'& [part="island"] > p, & [part="island"] > span, & [part="island"] > strong, & [part="island"] > em, & [part="island"] > code':{$description:"The island's own prose is the message's other form — a body richer than a sentence, written straight into the island from a lit template (studio-ui-guidelines.md §9.4) — so it is selectable for the same reason `[part=\"message\"]` is. The opt-in stops at those children because the island is ALSO the mount point for a whole document: the Open Grid picker and Push Schema's plan put their surfaces here, and `user-select` inherits, so a rule on the island itself would hand selection to every heading, source row and button they draw, which is the interface the policy exists to keep unselectable. A mounted surface roots a `div`; a message writes paragraphs and text-level spans, so the two forms are told apart by the child that arrives.",userSelect:"text"},'& [part="island"]:empty':{display:"none"},'& [part="message-slot"], & [part="choice-slot"], & [part="field-slot"]':{display:"contents"},'& [part="choice-row"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",margin:"0 0 var(--jx-space-3)"},'& [part="choice-label"]':{fontSize:"var(--jx-text-sm)",color:"var(--jx-fg-dim)"},"& jx-textfield":{width:"100%"}},children:[{tagName:"div",attributes:{part:"message-slot",role:"none"},$switch:{$ref:"#/state/hasMessage"},cases:{true:{tagName:"p",attributes:{part:"message"},textContent:"${state.message}"}}},{tagName:"div",attributes:{part:"island"}},{tagName:"div",attributes:{part:"choice-slot",role:"none"},$switch:{$ref:"#/state/hasChoice"},cases:{true:{tagName:"div",attributes:{part:"choice-row"},children:[{tagName:"span",attributes:{part:"choice-label"},textContent:"${state.choiceLabel}"},{tagName:"jx-select",$props:{label:{$ref:"#/state/choiceLabel"},options:{$ref:"#/state/options"},value:{$ref:"#/state/chosen"}},attributes:{part:"choice"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"event#/target/value"}]}]}}]}}},{tagName:"div",attributes:{part:"field-slot",role:"none"},$switch:{$ref:"#/state/hasField"},cases:{true:{tagName:"jx-textfield",$props:{label:{$ref:"#/state/headline"},value:{$ref:"#/state/value"},placeholder:{$ref:"#/state/placeholder"},invalid:{$ref:"#/state/invalid"},error:{$ref:"#/state/error"},multiline:{$ref:"#/state/multiline"},rows:{$ref:"#/state/rows"},mono:{$ref:"#/state/mono"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"#/state/singleLine"},cases:{true:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]}}]}}]},$description:"The prompt's one field. `multiline` is what makes it a paste box rather than a line: an import the author copied out of a `_redirects` file is column-aligned, so it also asks for `mono`. A multiline field takes Enter as a newline, which is why the Enter-confirms handler below is guarded on it — a paste box whose second line submits the dialog cannot be typed into."}}}]};T("dialog",oe);function An(e){if(e.querySelector('[part="dialog"]'))return Promise.resolve(e);return new Promise((t)=>{e.addEventListener("jx-ready",function o(n){if(n.target!==e&&!e.querySelector('[part="dialog"]'))return;e.removeEventListener("jx-ready",o),t(e)})})}function bs(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(rt,zt("dialog",e.region)),e.layer.append(t);let o=v({cancel:()=>{e.onCancel()},cancelLabel:e.cancelLabel,choiceLabel:e.choice?.label??"",chosen:e.choice?.chosen??"",closed:()=>{e.onClosed()},confirm:()=>{e.onConfirm()},confirmLabel:e.confirmLabel,destructive:e.destructive===!0,error:"",hasChoice:e.choice!==void 0,hasField:e.field!==void 0,mono:e.field?.mono===!0,multiline:e.field?.multiline===!0,rows:e.field?.rows??"3",singleLine:e.field!==void 0&&e.field.multiline!==!0?"true":"false",hasMessage:e.message!==void 0&&e.message!=="",headline:e.headline,input:(r)=>{o.value=r,e.onInput?.(r)},invalid:!1,message:e.message??"",options:e.choice?.options??[],pick:(r)=>{e.onPick?.(r)},placeholder:e.field?.placeholder??"",secondary:()=>{e.onSecondary?.()},secondaryLabel:e.secondaryLabel??"",size:e.size??"sm",value:e.field?.value??""}),n=null,a=!1,i=()=>{},s=new Promise((r)=>{i=r}),l=R("dialog",o,t).then(async(r)=>{let c=r.root;if(a)return r.dispose(),c;if(n=r,await Promise.race([An(c),s]),a)return c;if(e.island?.(c.querySelector('[part="island"]')??c),un(c),e.field){let y=c.querySelector("jx-textfield");if(y)setTimeout(()=>{if(!a)Pm(y,e.field?.select??"all")},0)}return c});return{close(){if(a)return;a=!0,i();let r=n?.root;if(r instanceof HTMLElement)rn(r);n?.dispose(),n=null,t.remove()},host:t,ready:l,update(r){if(r.confirmLabel!==void 0)o.confirmLabel=r.confirmLabel;if(r.cancelLabel!==void 0)o.cancelLabel=r.cancelLabel;if(r.secondaryLabel!==void 0)o.secondaryLabel=r.secondaryLabel;if(r.message!==void 0)o.message=r.message,o.hasMessage=r.message!=="";if(r.value!==void 0)o.value=r.value;if(r.placeholder!==void 0)o.placeholder=r.placeholder;if(r.invalid!==void 0)o.invalid=r.invalid;if(r.error!==void 0)if(r.error!==""&&r.error===o.error){o.error="";let c=r.error;queueMicrotask(()=>{o.error=c})}else o.error=r.error;if(r.options!==void 0)o.options=r.options;if(r.chosen!==void 0)o.chosen=r.chosen}}}var re={$schema:"https://jxsuite.com/schema/v1",$id:"StudioToasts",$description:"The toast stack: a rendering of the notification service's toasts, newest last. Each row is projected by ui/layers.ts with its severity glyph and, where a recovery command exists, that command's title and gate; the two buttons call back into the host, which owns the records and their timers.",tagName:"div",attributes:{part:"stack"},style:{position:"absolute",right:"var(--jx-space-4)",bottom:"36px",display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",alignItems:"flex-end",maxWidth:"min(420px, calc(100vw - 24px))",'& [part="toast"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",pointerEvents:"auto",padding:"var(--jx-space-3)",border:"1px solid var(--jx-border)",borderLeft:"3px solid var(--jx-fg-dim)",borderRadius:"var(--jx-radius-md)",background:"var(--jx-bg-panel)",color:"var(--jx-fg)",fontSize:"var(--jx-text-sm)",lineHeight:"var(--jx-leading-sm)",boxShadow:"var(--jx-shadow-popover)"},'& [part="toast"][data-severity="success"]':{borderLeftColor:"var(--jx-success)"},'& [part="toast"][data-severity="info"]':{borderLeftColor:"var(--jx-accent)"},'& [part="toast"][data-severity="warn"]':{borderLeftColor:"var(--jx-warning)"},'& [part="toast"][data-severity="error"]':{borderLeftColor:"var(--jx-danger)"},'& [part="icon"]':{flex:"none",width:"14px",textAlign:"center",fontWeight:"700"},'& [data-severity="success"] [part="icon"]':{color:"var(--jx-success)"},'& [data-severity="info"] [part="icon"]':{color:"var(--jx-accent)"},'& [data-severity="warn"] [part="icon"]':{color:"var(--jx-warning)"},'& [data-severity="error"] [part="icon"]':{color:"var(--jx-danger)"},'& [part="message"]':{flex:"1",minWidth:"0",overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3"},'& [part="action-slot"]':{display:"contents"},'& [part="action"] > [part="control"]':{color:"var(--jx-accent)"}},children:[{$prototype:"Array",items:{$ref:"#/state/toasts"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"toast","data-severity":"${$map.item.severity}"},children:[{tagName:"span",attributes:{part:"icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"message"},textContent:"${$map.item.message}"},{tagName:"span",attributes:{part:"action-slot",role:"none"},$switch:{$ref:"$map/item/hasAction"},cases:{true:{tagName:"jx-button",$props:{size:"sm",quiet:!0,disabled:{$ref:"$map/item/actionDisabled"}},attributes:{part:"action",title:"${$map.item.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.actionLabel}"}]}}},{tagName:"jx-action-button",$props:{label:"Dismiss notification",hint:"Dismiss notification",icon:"x",size:"sm"},attributes:{part:"dismiss"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dismissToast"},value:[{$ref:"$map/item/id"}]}]}}]}}]};function $e(e){return e instanceof RangeError||e instanceof Error&&e.name==="CommandUnavailableError"}function on(e,t,o,n=t){let a=(s)=>{if(!$e(s))console.error(`${n}: command "${t}" failed`,s);k.error(te(s),{key:`command.run:${t}`,source:n})},i;try{i=e.run(t,o)}catch(s){return a(s),Promise.resolve()}return Promise.resolve(i).catch(a)}function Rc(e,t,o){let n=ne();return n?on(n,e,t,o):Promise.resolve()}var se,F,q,E;function Ct(e){return(e==="popover"?se:e==="modal"?F:e==="toast"?E:q)||document.body}function mk(){se=document.querySelector("#layer-popover"),F=document.querySelector("#layer-modal"),q=document.querySelector("#layer-dialog"),E=document.querySelector("#layer-toast"),Ce()}var ae="jx-dialog[data-open], dialog[open]";function Am(){return Boolean(q?.querySelector(ae)||F?.querySelector(ae))}function Xo(e,t,o={}){let{confirmLabel:n="Confirm",cancelLabel:a="Cancel",destructive:i=!1}=o;return new Promise((s)=>{let d=!1,l=(c)=>{if(d)return;d=!0,r.close(),s(c)},r=bs({cancelLabel:a,confirmLabel:n,destructive:i,headline:e,layer:Ct("dialog"),...G(t),onCancel:()=>l(!1),onClosed:()=>l(!1),onConfirm:()=>l(!0)})})}function Bx(e,t,o={}){let{saveLabel:n="Save",discardLabel:a="Discard",cancelLabel:i="Cancel"}=o;return new Promise((s)=>{let d=!1,l=(c)=>{if(d)return;d=!0,r.close(),s(c)},r=bs({cancelLabel:i,confirmLabel:n,headline:e,layer:Ct("dialog"),...G(t),onCancel:()=>l("cancel"),onClosed:()=>l("cancel"),onConfirm:()=>l("save"),onSecondary:()=>l("discard"),secondaryLabel:a})})}function G(e){if(typeof e==="string")return{message:e};return{island:(t)=>{Ni(e,t)}}}function Nn(e,t={}){let{cancelLabel:o="Cancel",choice:n,confirmLabel:a="OK",message:i,mono:s=!1,multiline:d=!1,placeholder:l="",rows:r="3",select:c="all",size:y,validate:J,value:le=""}=t,D=(m)=>J?J(m,b):m.trim()?"":"Enter a value.",p=le,b=n?.initial??"",f="",U=!1,z=()=>typeof l==="function"?l():l,W=()=>n?n.options().map((m)=>({label:m.label,value:m.value})):[];return new Promise((m)=>{let V=!1,O=(u)=>{if(V)return;V=!0,N.close(),m(u)},K=(u)=>{f=u,N.update({error:f,invalid:f!==""})},N=bs({cancelLabel:o,confirmLabel:a,headline:e,layer:Ct("dialog"),...i===void 0?{}:G(i),...n?{choice:{chosen:b,label:n.label,options:W()}}:{},field:{mono:s,multiline:d,placeholder:z(),rows:r,select:c,value:p},...y===void 0?{}:{size:y},onCancel:()=>O(null),onClosed:()=>O(null),onConfirm:()=>{let u=D(p);if(u){K(u);return}O(p.trim())},onInput:(u)=>{U=!0,p=u;let x=D(p);if(x!==f)K(x)},onPick:(u)=>{b=u,n?.onChange?.(u);let x=D(p);f=U||f?x:"",N.update({chosen:b,error:f,invalid:f!=="",options:W(),placeholder:z()})}})})}var M=new Map;function vs(e,t){let o=`${e}:${t}`,n=M.get(o);if(n&&n.parentElement)return n;return n=document.createElement("div"),n.style.pointerEvents="auto",n.setAttribute(rt,zt(e,t)),Ct(e).append(n),M.set(o,n),n}function Nm(e,t){let o=`${e}:${t}`,n=M.get(o);if(n)Ni(tt,n),n.remove(),M.delete(o)}var Re=180,Le={error:"✕",info:"ℹ",success:"✓",warn:"!"},C=null,h=new Map,g=new Set;function Te(){return globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0}function we(){try{return new URLSearchParams(globalThis.location?.search??"").get("automation")==="1"}catch{return!1}}function gk(){return[...g].map((e)=>`overlay: toast ${e} settling in`)}function _(e){let t=h.get(e);if(t!==void 0)clearTimeout(t),h.delete(e);g.delete(e),Wd(e)}function Ee(e){if(h.has(e.id)||g.has(e.id))return;let t=Te()?0:Re;if(t>0)g.add(e.id),setTimeout(()=>g.delete(e.id),t);let o=e.timeoutMs??0;if(o<=0||we())return;h.set(e.id,setTimeout(()=>_(e.id),o))}T("toasts",re);var I=null,j=null,w=null;function ie(){return I??=v({dismissToast:(e)=>{_(e)},runAction:(e)=>{let t=$c.find((n)=>n.id===e),o=ne();if(!t?.action||!o)return;_(e),on(o,t.action,t.actionArgs,"Notifications")},toasts:[]}),I}function Me(e){let t=e.action===void 0?null:ne(),o=e.action,n=t&&o!==void 0?t.get(o):void 0,a=n&&o!==void 0&&t.isVisible(o)?n:null,i=a&&o!==void 0?t.disabledReason(o):void 0;return{actionDisabled:i!==void 0,actionLabel:a?.title??"",actionTitle:a===null||a===void 0?"":i===void 0?a.title:`${a.title} — requires ${i}`,hasAction:a!==null&&a!==void 0,icon:Le[e.severity],id:e.id,message:e.message,severity:e.severity}}function Ce(){if(je(),!E)return;C=ge(),C.run(()=>{Q(()=>{$c.length,ne();for(let e of $c)Ee(e);ie().toasts=$c.map((e)=>Me(e))})}),j=R("toasts",ie(),E),j.then((e)=>{w=e})}function je(){C?.stop(),C=null;for(let t of h.values())clearTimeout(t);h.clear(),g.clear();let e=j;if(j=null,w)w.dispose(),w=null;else if(e)e.then((t)=>t.dispose());I=null}
2
- export{cI,dI,pk,rt,Ip,fk,Zi,uI,hI,pI,fI,mI,Iv,zt,T,gI,R,An,bs,on,Rc,Ct,mk,Am,Xo,Bx,Nn,vs,Nm,gk};
3
-
4
- //# debugId=5235C2EE8A8D6D9864756E2164756E21
5
- //# sourceMappingURL=studio-7qvs7v0m.js.map
@@ -1,5 +0,0 @@
1
- import{qu}from"./studio-x5g1xk77.js";import{gb}from"./studio-xg1942as.js";import{D}from"./studio-tp642n5g.js";function c(){return Object.keys(D?.projectConfig?.content??{})}function Tw(e){let n=gb(e);if(!n)return null;if(/\.[a-z\d]+$/i.test(n.dir))return null;return{def:n.def,dir:n.dir,ext:n.ext,name:n.name,schema:n.def.schema??null}}function cb(){return c().map((e)=>Tw(e)).filter((e)=>e!==null)}function sa(e){let n=qu(e??null,D?.projectConfig);return n?Tw(n.name):null}function u(e){if(e===null||typeof e!=="object")return e;return JSON.parse(JSON.stringify(e))}function l(e){if(typeof e.$ref==="string")return"";switch(e.type){case"boolean":return!1;case"integer":case"number":return 0;case"array":return[];case"object":return y1(e);default:return""}}function y1(e){let n=e?.properties;if(!n)return{};let i=new Set(Array.isArray(e?.required)?e.required:[]),t={};for(let[r,o]of Object.entries(n))if(o.default!==void 0)t[r]=u(o.default);else if(i.has(r))t[r]=l(o);return t}function CE(e,n){return(Array.isArray(e?.required)?e.required:[]).filter((t)=>n[t]===void 0)}
2
- export{Tw,cb,sa,y1,CE};
3
-
4
- //# debugId=33EF567F57BD535C64756E2164756E21
5
- //# sourceMappingURL=studio-84rtc120.js.map
@@ -1,7 +0,0 @@
1
- import{p}from"./studio-y7jehjrp.js";import{lp}from"./studio-bftp4n4b.js";import{ge,Q,v,Hm}from"./studio-fqq890ap.js";import{ne}from"./studio-cp1gbff9.js";import{T,R}from"./studio-7qvs7v0m.js";import{Bi,y}from"./studio-4m50vh74.js";import{D}from"./studio-tp642n5g.js";function k({slug:e,adapter:t}){let o=new Date().toISOString().slice(0,10);return`${JSON.stringify(t==="cloudflare-workers"?{assets:{binding:"ASSETS",directory:"./dist"},compatibility_date:o,compatibility_flags:["nodejs_compat"],main:"./dist/worker.js",name:e}:{compatibility_date:o,compatibility_flags:["nodejs_compat"],name:e,pages_build_output_dir:"./dist"},null,"\t")}
2
- `}function m(e,{slug:t,adapter:o}){if(!e)return{content:k({adapter:o,slug:t}),patched:!0};let n;try{n=JSON.parse(e)}catch{return{content:e,patched:!1}}if(n.name=t,o==="cloudflare-workers")delete n.pages_build_output_dir,n.main="./dist/worker.js",n.assets={binding:"ASSETS",directory:"./dist"};else delete n.main,delete n.assets,n.pages_build_output_dir="./dist";return{content:`${JSON.stringify(n,null,"\t")}
3
- `,patched:!0}}function gd(){try{return typeof p().cfApi==="function"}catch{return!1}}async function l(e,t){let o=p().cfApi;if(!o)throw Error("This platform cannot reach the Cloudflare API");try{return await o(e,t)}catch(n){throw lp(n),n}}async function YE(){return l("/accounts")}async function j(e,t){try{return await l(`/accounts/${e}/pages/projects/${t}`)}catch{return null}}async function C(e){return l(`/accounts/${e.accountId}/pages/projects`,{method:"POST",body:{name:e.projectName,production_branch:e.productionBranch,build_config:{build_command:"bunx jx build",destination_dir:"dist"},source:{type:"github",config:{owner:e.owner,repo_name:e.repo,production_branch:e.productionBranch,deployments_enabled:!0}}}})}async function Zf(e){let t=await l(`/accounts/${e.accountId}/pages/projects/${e.projectName}/deployments`),[o]=t;if(!o)return null;return{id:o.id,url:o.url,environment:o.environment,stage:o.latest_stage?.name??"unknown",status:o.latest_stage?.status??"unknown",createdOn:o.created_on}}async function P1(e,t){let o={...e.build};if(t===null)delete o.deploy;else o.deploy=t;if(await Bi({build:o}),t!==null){let n=p(),i=null;try{i=await n.readFile("wrangler.jsonc")}catch{i=null}let w=o.adapter==="cloudflare-workers"?"cloudflare-workers":"cloudflare-pages",{content:x,patched:S}=m(i,{adapter:w,slug:t.projectName});if(S)await n.writeFile("wrangler.jsonc",x)}}async function ZE(e,t){let n=await j(t.accountId,t.projectName)??await C(t),i={provider:"cloudflare-pages",accountId:t.accountId,projectName:t.projectName,...n.subdomain?{productionUrl:`https://${n.subdomain}`}:{}};return await P1(e,i),i}var h={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelDeployChecklist",$description:"The deploy checklist, drawn above the Activity feed in the Bottom dock's Activity tab: what is MISSING before this project can ship, as one row with the chain of prerequisites under it. `publish/deploy-checklist.ts` owns the chain — which link is forged, which is merely unasked, and which command forges the next one — and hands this document a row, four steps and at most one action. Nothing here reads source control, the project config or the command registry. It draws in the Activity tab's own vocabulary because a deploy is an ordered list of stages that finish, which is exactly what a row of that feed already is; a fifth visual idiom for it would be a second design of a thing the tab has.",tagName:"div",attributes:{part:"checklist"},style:{$description:"What `.activity-list`, `.activity-row`, `.activity-row--running`, `.activity-row--done`, `.activity-icon`, `.activity-body`, `.activity-head`, `.activity-title`, `.activity-source`, `.activity-status`, `.activity-steps`, `.activity-step`, `.activity-step--done` and `.activity-step-icon` said in `styles/panels.css`, keyed on `part`. This is the LAST reader of those rules — `surfaces/panel-activity.json` carried its own copy when the feed converted, and left the stylesheet standing because this file still drew from it — so the whole `.problem-*, .activity-*` block is dead once this lands. Three token names could not travel: `--spectrum-font-size-50`, `--spectrum-font-size-75` and `--spectrum-corner-radius-75` resolve only inside `<sp-theme>`, and a document mounted into the dock body is outside it, so each would silently have taken its hard-coded px fallback. They are the kit's own scale here. One thing changed meaning on purpose: the step's `data-state` is the checklist's own three-valued state rather than the two CSS classes it used to collapse into, so `unknown` — \"nobody has asked\" — is a state the styling can tell apart from `todo` the day it should.",display:"block",minWidth:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="list"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",margin:"0",padding:"0",listStyle:"none"},'& [part="row"]':{$description:"The left border is the state, at 3px, which is the one thing that must be legible without reading the row. Its default is the dim foreground so a state nobody has a colour for still draws a border rather than a gap.",display:"flex",alignItems:"flex-start",gap:"var(--jx-space-2)",padding:"6px var(--jx-space-2)",border:"1px solid var(--border)",borderLeft:"3px solid var(--fg-dim)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",fontSize:"var(--jx-text-md)"},'& [part="row"][data-state="running"]':{borderLeftColor:"var(--accent)"},'& [part="row"][data-state="done"]':{borderLeftColor:"var(--success)"},'& [part="state-icon"]':{$description:'Named `state-icon` rather than `icon`: `jx-button` puts `part="icon"` on the glyph slot of every button it draws, and the action button below is inside this same light-DOM tree — a rule on the bare name would reach into the kit\'s own drawing and a devtools query could not tell the two apart.',flex:"none",width:"14px",textAlign:"center",fontWeight:"700",lineHeight:"1.5"},'& [part="row"][data-state="running"] > [part="state-icon"]':{color:"var(--accent)"},'& [part="row"][data-state="done"] > [part="state-icon"]':{color:"var(--success)"},'& [part="row-body"]':{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"2px"},'& [part="head"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",alignSelf:"stretch",minWidth:"0"},'& [part="row-title"]':{fontWeight:"700",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="source"]':{$description:"Pushed to the far edge, so the tab reads as a column of who raised what.",flex:"none",marginLeft:"auto",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="summary"]':{color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="steps"]':{$description:'The chain, declared up front, so "which link is missing" is answered by looking rather than by reading the summary and remembering what came before it.',display:"flex",flexDirection:"column",gap:"1px",margin:"2px 0 0",padding:"0",listStyle:"none",fontSize:"var(--jx-text-sm)"},'& [part="step"]':{display:"flex",gap:"6px",color:"var(--fg-dim)"},'& [part="step"][data-state="done"] > [part="step-icon"]':{color:"var(--success)"},'& [part="step-icon"]':{flex:"none",width:"10px",textAlign:"center"},'& [part="action"]':{marginTop:"var(--jx-space-1)"}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProject"},cases:{true:{tagName:"ul",attributes:{part:"list"},children:[{tagName:"li",attributes:{part:"row","data-state":"${state.rowState}"},children:[{tagName:"span",attributes:{part:"state-icon","aria-hidden":"true"},textContent:"${state.rowIcon}"},{tagName:"div",attributes:{part:"row-body"},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"span",attributes:{part:"row-title"},textContent:"Deploy checklist"},{tagName:"span",attributes:{part:"source"},textContent:"Publish"}]},{tagName:"div",attributes:{part:"summary"},textContent:"${state.summary}"},{tagName:"ol",attributes:{part:"steps"},children:[{$prototype:"Array",items:{$ref:"#/state/steps"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"step","data-step":"${$map.item.id}","data-state":"${$map.item.state}"},children:[{tagName:"span",attributes:{part:"step-icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"step-text"},textContent:"${$map.item.text}"}]}}]},{tagName:"span",attributes:{part:"action-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasAction"},cases:{true:{tagName:"jx-button",$description:"The recovery button wears the command's own title, so it reads as a verb rather than as a decoration, and a refused command is dimmed with the reason it names in its tooltip. A command the registry does not have, or whose `when` is false, draws NOTHING rather than a dead label — a surface may choose whether to show a command, never whether it exists (§13).",$props:{size:"sm",disabled:{$ref:"#/state/actionDisabled"}},attributes:{part:"action",title:"${state.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[]}]},children:[{tagName:"span",textContent:"${state.actionLabel}"}]}}}]}]}]}}}]};T("panel-deploy-checklist",h);var d=null,c=null,a=null,r=null;function A(e,t){e.hasProject=t.hasProject,e.rowState=t.rowState,e.rowIcon=t.rowIcon,e.summary=t.summary,e.steps=t.steps,e.hasAction=t.hasAction,e.actionLabel=t.actionLabel,e.actionTitle=t.actionTitle,e.actionDisabled=t.actionDisabled}function N(e){if(d!==e)return!1;return r===null?a!==null:r.root.parentNode===e}function f(e,t){if(N(e))return;u(),d=e;let o=v({actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1,hasProject:!1,rowIcon:"",rowState:"running",runAction:t.runAction,steps:[],summary:""});c=ge(),c.run(()=>{Q(()=>{A(o,t.project())})});let n=R("panel-deploy-checklist",o,e);a=n,n.then((i)=>{if(a===n)r=i;else i.dispose()})}function u(){c?.stop(),c=null;let e=a;if(a=null,r)r.dispose(),r=null;else if(e)e.then((t)=>t.dispose());d=null}function I(){return D?.projectConfig??null}function ca(){return I()?.build?.deploy}var s=Hm({asked:!1,observed:null});function rp(e){s.observed=e,s.asked=!0}function _(){let{status:e}=y.git;if(e===null)return{command:"git.init",detail:"Source control has not reported on this project yet.",id:"repo",label:"Track this project with git",state:"unknown"};return e.isRepo?{command:"git.init",detail:`Tracked${e.branch?` — on branch ${e.branch}`:""}.`,id:"repo",label:"Track this project with git",state:"done"}:{command:"git.init",detail:"A deploy ships what the repository holds, so the repository comes first.",id:"repo",label:"Track this project with git",state:"todo"}}function L(){let{status:e}=y.git;if(e===null||!e.isRepo)return{command:"git.createGithubRepository",detail:"A remote is where the provider builds from.",id:"remote",label:"Push to a remote",state:e===null?"unknown":"todo"};if((e.remotes??[]).length===0)return{command:"git.createGithubRepository",detail:"This repository is local only — nothing outside this machine can build it.",id:"remote",label:"Push to a remote",state:"todo"};return e.ahead>0?{command:"git.push",detail:`${e.ahead} commit(s) are not on ${e.remotes[0]} yet, so a build would ship the older tree.`,id:"remote",label:"Push to a remote",state:"todo"}:{command:"git.push",detail:`Up to date with ${e.remotes[0]}.`,id:"remote",label:"Push to a remote",state:"done"}}function O(){let e=ca();if(e)return{command:"publish.setUp",detail:`Cloudflare Pages project ${e.projectName}.`,id:"provider",label:"Connect a deploy provider",state:"done"};return gd()?{command:"publish.setUp",detail:"Connecting one makes every commit build and publish on its own.",id:"provider",label:"Connect a deploy provider",state:"todo"}:{command:"publish.setUp",detail:"This platform cannot reach the Cloudflare API. Commit and push instead — your host "+"runs bunx jx build and serves dist/.",id:"provider",label:"Connect a deploy provider",state:"unknown"}}function E(){if(!ca())return{command:"publish.deploy",detail:"Nothing has been deployed, because no provider is connected.",id:"deployed",label:"Deploy",state:"todo"};if(!s.asked)return{command:"publish.deploy",detail:"Cloudflare has not been asked yet, so this is not a claim that nothing shipped.",id:"deployed",label:"Deploy",state:"unknown"};if(s.observed===null)return{command:"publish.deploy",detail:"Cloudflare reports no deployments for this project.",id:"deployed",label:"Deploy",state:"todo"};let{observed:e}=s;return e.status==="success"?{command:"publish.deploy",detail:`${e.environment} — ${e.url}`,id:"deployed",label:"Deploy",state:"done"}:{command:"publish.deploy",detail:`Last deployment ${e.stage}: ${e.status}.`,id:"deployed",label:"Deploy",state:"todo"}}function g(){return[_(),L(),O(),E()]}function b(){return g().find((e)=>e.state!=="done")??null}function XE(){if(!D)return null;let e=b();if(e)return{command:e.command,label:e.label,title:e.detail};return{command:"publish.openDashboard",label:"Deployed",title:ca()?.productionUrl??"Everything this project needs to ship is in place."}}var W={done:"✓",todo:"·",unknown:"?"};function V(e){return{icon:W[e.state],id:e.id,state:e.state,text:e.state==="done"?e.label:`${e.label} — ${e.detail}`}}function H(e){let t={actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1};if(!e)return t;let o=ne(),n=o?.get(e.command);if(!o||!n||!o.isVisible(e.command))return t;let i=o.disabledReason(e.command);return{actionDisabled:i!==void 0,actionLabel:n.title,actionTitle:i?`${n.title} — requires ${i}`:n.title,hasAction:!0}}function J(){if(!D)return{actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1,hasProject:!1,rowIcon:"",rowState:"running",steps:[],summary:""};let e=g(),t=e.find((o)=>o.state!=="done")??null;return{...H(t),hasProject:!0,rowIcon:t?"⋯":"✓",rowState:t?"running":"done",steps:e.map((o)=>V(o)),summary:t?t.detail:"Everything this project needs to ship is in place."}}function B(){let e=b();if(!e)return;ne()?.run(e.command)}var F={project:J,runAction:B};function QE(e){let t=e.querySelector("[data-deploy-checklist]");if(!t){u();return}f(t,F)}
4
- export{gd,YE,Zf,P1,ZE,ca,rp,XE,QE};
5
-
6
- //# debugId=32A006FBA9B78D4764756E2164756E21
7
- //# sourceMappingURL=studio-aekhcdzw.js.map
@@ -1,5 +0,0 @@
1
- var e=new Set;function mE(r){return e.add(r),()=>e.delete(r)}function gE(){let r=[];for(let t of e)try{let o=t();if(o)r.push(o)}catch{}return r}
2
- export{mE,gE};
3
-
4
- //# debugId=A7899C52ECFB612864756E2164756E21
5
- //# sourceMappingURL=studio-aqmph6k4.js.map