@jxsuite/studio 10.4.0 → 10.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/dist/chunks/2020-7sx2vexa.js +4 -0
  2. package/dist/chunks/adapter-12dxr3z7.js +4 -0
  3. package/dist/chunks/{add-new-flow-v0pm96mr.js → add-new-flow-any4pw2q.js} +3 -3
  4. package/dist/chunks/{cf-account-picker-xb8vvt2h.js → cf-account-picker-ajh60k54.js} +3 -3
  5. package/dist/chunks/cf-settings-hbj16kh3.js +4 -0
  6. package/dist/chunks/{color-area-h8dbasp1.js → color-area-gbcftzh3.js} +2 -2
  7. package/dist/chunks/{color-field-qv5r2b16.js → color-field-85136598.js} +3 -3
  8. package/dist/chunks/{color-slider-nz2mrzky.js → color-slider-w1s3ndd8.js} +2 -2
  9. package/dist/chunks/color-thzpppyc.js +4 -0
  10. package/dist/chunks/{combobox-6hs00996.js → combobox-dk98wc5x.js} +3 -3
  11. package/dist/chunks/components-a98hzqw9.js +4 -0
  12. package/dist/chunks/content-source-jq3fjs3w.js +4 -0
  13. package/dist/chunks/{convert-to-repeater-r8sfxjjm.js → convert-to-repeater-g66r6qp1.js} +3 -3
  14. package/dist/chunks/editor-rth1rzj8.js +4 -0
  15. package/dist/chunks/entry-commands-02j0s19w.js +4 -0
  16. package/dist/chunks/{extension-sections-vjzw46xb.js → extension-sections-rqrs7dr0.js} +3 -3
  17. package/dist/chunks/file-ops-6a49er4c.js +4 -0
  18. package/dist/chunks/files-b2p9y0yz.js +4 -0
  19. package/dist/chunks/format-host-7xe57k1s.js +4 -0
  20. package/dist/chunks/fs-events-0xsy168g.js +4 -0
  21. package/dist/chunks/grid-open-h3q4fjy5.js +4 -0
  22. package/dist/chunks/{grid-view-2f03wcgw.js → grid-view-0v4hjspb.js} +17 -17
  23. package/dist/chunks/{icons-gb967qc8.js → icons-j9eksgew.js} +2 -2
  24. package/dist/chunks/{iframe-entry-btck0e9s.js → iframe-entry-4zqtn3ry.js} +4 -4
  25. package/dist/chunks/{iframe-entry-b5qgggyp.js → iframe-entry-54kwwhmg.js} +4 -4
  26. package/dist/chunks/{iframe-entry-42hpmwz5.js → iframe-entry-m24fza30.js} +4 -4
  27. package/dist/chunks/iframe-host-8jcmaktg.js +4 -0
  28. package/dist/chunks/{image-bake-4afr4y6a.js → image-bake-m8gzaan9.js} +3 -3
  29. package/dist/chunks/{image-editor-x7t8jbjn.js → image-editor-0afyws7c.js} +3 -3
  30. package/dist/chunks/{index-yjrfeks8.js → index-2q88g57p.js} +3 -3
  31. package/dist/chunks/index-7nj2375a.js +4 -0
  32. package/dist/chunks/{javascript-hy2mws8v.js → javascript-5sxtr1g7.js} +3 -3
  33. package/dist/chunks/jsonMode-m6sf47hq.js +13 -0
  34. package/dist/chunks/jx-validate-808zgbgy.js +4 -0
  35. package/dist/chunks/layers-0ffdtqjn.js +4 -0
  36. package/dist/chunks/layers-panel-rw62wtvf.js +4 -0
  37. package/dist/chunks/{listbox-7gka1h86.js → listbox-k5p41049.js} +2 -2
  38. package/dist/chunks/lit-html-9bz9rcfv.js +4 -0
  39. package/dist/chunks/media-library-2a5hdbek.js +4 -0
  40. package/dist/chunks/media-open-069kzhj4.js +4 -0
  41. package/dist/chunks/media-picker-4p4pd28y.js +4 -0
  42. package/dist/chunks/menu-26nez152.js +4 -0
  43. package/dist/chunks/{monaco-binding-a51py33c.js → monaco-binding-1s2b8snq.js} +3 -3
  44. package/dist/chunks/monaco-buffer-m9fd2dka.js +4 -0
  45. package/dist/chunks/monaco-setup-e0crh3v6.js +4 -0
  46. package/dist/chunks/notify-re3js157.js +4 -0
  47. package/dist/chunks/platform-rywy3tkg.js +4 -0
  48. package/dist/chunks/popover-fhdnt4be.js +4 -0
  49. package/dist/chunks/publish-panel-czkpg8m4.js +4 -0
  50. package/dist/chunks/{publish-quick-4fwngwrw.js → publish-quick-b9wbhqj6.js} +3 -3
  51. package/dist/chunks/publish-workspace-yy6d23b7.js +4 -0
  52. package/dist/chunks/quick-search-tp7pjnmv.js +4 -0
  53. package/dist/chunks/references-wd2yj8s1.js +4 -0
  54. package/dist/chunks/right-panel-x971k0zc.js +4 -0
  55. package/dist/chunks/source-control-k4p00hpe.js +4 -0
  56. package/dist/chunks/{split-m5rwn31z.js → split-qh21j2b0.js} +2 -2
  57. package/dist/chunks/{studio-v5wktj6f.js → studio-151kgn69.js} +4 -4
  58. package/dist/chunks/studio-15mfah02.js +10 -0
  59. package/dist/chunks/studio-1a7zshnv.js +5 -0
  60. package/dist/chunks/studio-1d8m5s38.js +16 -0
  61. package/dist/chunks/studio-35pmfjtx.js +5 -0
  62. package/dist/chunks/{studio-3na1r48j.js → studio-3yr1zdp9.js} +8 -8
  63. package/dist/chunks/studio-43pynnhz.js +5 -0
  64. package/dist/chunks/studio-44xqe0b7.js +4 -0
  65. package/dist/chunks/{studio-hh394phe.js → studio-48yzqzqr.js} +4 -4
  66. package/dist/chunks/{studio-9gr7xs9r.js → studio-4jy967rj.js} +5 -5
  67. package/dist/chunks/{studio-4bgvvzhv.js → studio-4ncxzw5m.js} +4 -4
  68. package/dist/chunks/{studio-pm17wdc4.js → studio-4s5bka8t.js} +4 -4
  69. package/dist/chunks/{studio-5tet77de.js → studio-4z0cdh16.js} +3 -3
  70. package/dist/chunks/studio-5rq3e4q5.js +5 -0
  71. package/dist/chunks/{studio-wmjmsw0p.js → studio-69g6a0jn.js} +4 -4
  72. package/dist/chunks/studio-6hcfm9q3.js +5 -0
  73. package/dist/chunks/studio-6mf31e16.js +5 -0
  74. package/dist/chunks/studio-6sxnqqw8.js +5 -0
  75. package/dist/chunks/{studio-0939t1q1.js → studio-7qqb7hb8.js} +4 -4
  76. package/dist/chunks/{studio-bg8pzprg.js → studio-7qr8k0v2.js} +4 -4
  77. package/dist/chunks/{studio-0x6f3nk9.js → studio-8ncm9zwx.js} +4 -4
  78. package/dist/chunks/studio-8w5pa88p.js +7 -0
  79. package/dist/chunks/{studio-3qr08sxq.js → studio-9f5vcb4w.js} +3 -3
  80. package/dist/chunks/studio-aaw7wxv8.js +5 -0
  81. package/dist/chunks/studio-afx9brsc.js +5 -0
  82. package/dist/chunks/studio-ajfq4fmr.js +5 -0
  83. package/dist/chunks/{studio-evq47j2z.js → studio-ber1dgte.js} +4 -4
  84. package/dist/chunks/{studio-sce30r7b.js → studio-bk0anq3b.js} +3 -3
  85. package/dist/chunks/{studio-0gvvqj3h.js → studio-bmwgj8ez.js} +4 -4
  86. package/dist/chunks/{studio-s24mhq0z.js → studio-bpzwhn88.js} +4 -4
  87. package/dist/chunks/{studio-g9brbewz.js → studio-c72v1kwc.js} +4 -4
  88. package/dist/chunks/{studio-tpxcryf2.js → studio-cv6gnjqd.js} +4 -4
  89. package/dist/chunks/{studio-90zkgne5.js → studio-czpmzs9r.js} +7 -7
  90. package/dist/chunks/{studio-2pk7kc7z.js → studio-d5f7sskn.js} +4 -4
  91. package/dist/chunks/studio-dmgh2rrj.js +5 -0
  92. package/dist/chunks/{studio-nwf0c32p.js → studio-dst8y8vh.js} +4 -4
  93. package/dist/chunks/studio-ehj3csbm.js +6 -0
  94. package/dist/chunks/{studio-hfqpfmpk.js → studio-ek4fb4eb.js} +4 -4
  95. package/dist/chunks/studio-ep1384t9.js +5 -0
  96. package/dist/chunks/{studio-abh9kfdh.js → studio-eq5vqn1q.js} +4 -4
  97. package/dist/chunks/studio-erjccagy.js +5 -0
  98. package/dist/chunks/studio-ex1644g2.js +5 -0
  99. package/dist/chunks/studio-f3awr5nc.js +12 -0
  100. package/dist/chunks/studio-f69wcajk.js +9 -0
  101. package/dist/chunks/{studio-jma2q8r9.js → studio-g65t6svn.js} +4 -4
  102. package/dist/chunks/{studio-r6mx7vm5.js → studio-gw83z798.js} +5 -5
  103. package/dist/chunks/{studio-2x972v58.js → studio-hy936516.js} +4 -4
  104. package/dist/chunks/studio-j3bq30yz.js +5 -0
  105. package/dist/chunks/studio-j52ks8q7.js +5 -0
  106. package/dist/chunks/{studio-g0hxtcga.js → studio-jqvke4ac.js} +4 -4
  107. package/dist/chunks/{studio-bnc50f9h.js → studio-k05g7efh.js} +4 -4
  108. package/dist/chunks/studio-kefs4sz4.js +5 -0
  109. package/dist/chunks/{studio-2e4hry72.js → studio-ketrgtph.js} +5 -5
  110. package/dist/chunks/studio-m3jrjfhy.js +14 -0
  111. package/dist/chunks/{studio-45mj4jqe.js → studio-m8hesdrw.js} +4 -4
  112. package/dist/chunks/{studio-k0xzrse2.js → studio-n271vdsg.js} +36 -36
  113. package/dist/chunks/studio-n4pnf0sw.js +5 -0
  114. package/dist/chunks/{studio-gnazwtv3.js → studio-ncwx602y.js} +4 -4
  115. package/dist/chunks/{studio-amaz545p.js → studio-nngc45ct.js} +4 -4
  116. package/dist/chunks/{studio-eqcddvc2.js → studio-nv5eq0f7.js} +173 -173
  117. package/dist/chunks/{studio-az3wvyh2.js → studio-nzp0sqjg.js} +4 -4
  118. package/dist/chunks/{studio-k2evngrj.js → studio-pgze9p34.js} +5 -5
  119. package/dist/chunks/studio-ph17an19.js +5 -0
  120. package/dist/chunks/studio-pte5w7rf.js +9 -0
  121. package/dist/chunks/studio-pv1ts08p.js +6 -0
  122. package/dist/chunks/studio-q509sqt8.js +5 -0
  123. package/dist/chunks/{studio-rr00ex23.js → studio-qarg1xf9.js} +6 -6
  124. package/dist/chunks/studio-r5g7fx7q.js +9 -0
  125. package/dist/chunks/studio-s49y6m5b.js +5 -0
  126. package/dist/chunks/studio-s4k1v7dt.js +7 -0
  127. package/dist/chunks/studio-t46rt6gx.js +5 -0
  128. package/dist/chunks/{studio-61rg2cz5.js → studio-td3h1644.js} +4 -4
  129. package/dist/chunks/{studio-v7a7yb5w.js → studio-thgexj3w.js} +7 -7
  130. package/dist/chunks/{studio-vpevkfxw.js → studio-veh91hjv.js} +4 -4
  131. package/dist/chunks/studio-vswmz40d.js +6 -0
  132. package/dist/chunks/{studio-daksw8kh.js → studio-w3aafbpk.js} +4 -4
  133. package/dist/chunks/studio-w4mfaaam.js +5 -0
  134. package/dist/chunks/{studio-4zd6an2b.js → studio-wn2cmf9q.js} +4 -4
  135. package/dist/chunks/studio-x5ffyssw.js +5 -0
  136. package/dist/chunks/{studio-swedpd82.js → studio-x5py815g.js} +4 -4
  137. package/dist/chunks/{studio-4fnb5648.js → studio-xh6rf05g.js} +4 -4
  138. package/dist/chunks/studio-z6s56dzz.js +5 -0
  139. package/dist/chunks/{studio-nvcn2ykc.js → studio-zav9hgb3.js} +4 -4
  140. package/dist/chunks/{studio-a88ej93p.js → studio-ze1sm147.js} +6 -6
  141. package/dist/chunks/{studio-pj216fmn.js → studio-zkkt13qd.js} +4 -4
  142. package/dist/chunks/studio-zn7ysyzb.js +5 -0
  143. package/dist/chunks/{studio-xx3r3sb0.js → studio-ztzf8mce.js} +4 -4
  144. package/dist/chunks/{studio-1410q5dw.js → studio-zzgp5yka.js} +4 -4
  145. package/dist/chunks/{tooltip-dj1pvgz7.js → tooltip-gtx40bjg.js} +3 -3
  146. package/dist/chunks/{tree-j0ebwr5s.js → tree-a19s1c05.js} +2 -2
  147. package/dist/chunks/tsMode-3f116hth.js +14 -0
  148. package/dist/chunks/workspace-home-61n1jz3q.js +4 -0
  149. package/dist/chunks/workspace-sheek6zw.js +4 -0
  150. package/dist/chunks/{ws-client-arz2qsy9.js → ws-client-cb49m87s.js} +3 -3
  151. package/dist/iframe-entry.js +14 -14
  152. package/dist/manifest.json +82 -82
  153. package/dist/studio.js +97 -96
  154. package/dist/workers/ts.worker.js +3 -3
  155. package/package.json +11 -11
  156. package/src/browse/library-layouts.ts +9 -12
  157. package/src/browse/library-pane.ts +22 -16
  158. package/src/browse/library-source.ts +3 -4
  159. package/src/canvas/canvas-live-render.ts +2 -5
  160. package/src/canvas/canvas-page-context.ts +5 -0
  161. package/src/content/entry-commands.ts +32 -27
  162. package/src/content/entry-editor.ts +46 -44
  163. package/src/content/entry-inspector.ts +15 -12
  164. package/src/content/entry-model.ts +3 -3
  165. package/src/content/entry-summaries.ts +5 -5
  166. package/src/content/hold-state.ts +172 -0
  167. package/src/content/page-summaries.ts +10 -14
  168. package/src/editor/inline-edit.ts +6 -1
  169. package/src/editor/repeater-scope.ts +333 -74
  170. package/src/grid/sources/content-source.ts +42 -66
  171. package/src/panels/block-action-bar.ts +3 -4
  172. package/src/panels/events-panel.ts +6 -2
  173. package/src/panels/formula-workspace.ts +9 -0
  174. package/src/panels/properties-panel.ts +127 -35
  175. package/src/panels/statement-editor.ts +4 -0
  176. package/src/panels/tab-strip.ts +29 -26
  177. package/src/services/ai-project-tools.ts +3 -3
  178. package/src/services/ai-tools.ts +5 -5
  179. package/src/services/ai-write-report.ts +22 -4
  180. package/src/services/context-manager.ts +110 -2
  181. package/src/services/document-assistant.ts +2 -2
  182. package/src/services/harness/chat-reducer.ts +9 -4
  183. package/src/services/render-critic.ts +234 -12
  184. package/src/services/tool-executor.ts +16 -8
  185. package/src/surfaces/collections-panel.json +1 -1
  186. package/src/surfaces/collections-panel.ts +1 -1
  187. package/src/surfaces/entry-editor.json +10 -10
  188. package/src/surfaces/entry-editor.ts +22 -19
  189. package/src/surfaces/entry-inspector.json +11 -11
  190. package/src/surfaces/entry-inspector.ts +17 -10
  191. package/src/surfaces/tab-strip.json +5 -5
  192. package/src/surfaces/tab-strip.ts +2 -2
  193. package/src/types.ts +2 -0
  194. package/src/ui/expression-editor.ts +10 -5
  195. package/src/ui/schema-form.ts +18 -1
  196. package/src/utils/edit-display.ts +27 -1
  197. package/dist/chunks/2020-906vx2dq.js +0 -4
  198. package/dist/chunks/adapter-hnvad61x.js +0 -4
  199. package/dist/chunks/cf-settings-mkbcz4z2.js +0 -4
  200. package/dist/chunks/color-04361ttk.js +0 -4
  201. package/dist/chunks/components-w5zqwva1.js +0 -4
  202. package/dist/chunks/content-source-g38w0d3f.js +0 -4
  203. package/dist/chunks/editor-wvf5e6j9.js +0 -4
  204. package/dist/chunks/entry-commands-t13dyw3c.js +0 -4
  205. package/dist/chunks/file-ops-1sghzgcr.js +0 -4
  206. package/dist/chunks/files-zrqtgt41.js +0 -4
  207. package/dist/chunks/format-host-9gy76erh.js +0 -4
  208. package/dist/chunks/fs-events-45rhg3me.js +0 -4
  209. package/dist/chunks/grid-open-t4fq6bbm.js +0 -4
  210. package/dist/chunks/iframe-host-9aq8ze3q.js +0 -4
  211. package/dist/chunks/index-f9qr7kzh.js +0 -4
  212. package/dist/chunks/jsonMode-vj30te2h.js +0 -13
  213. package/dist/chunks/jx-validate-r4ax11e3.js +0 -4
  214. package/dist/chunks/layers-m49nmwvx.js +0 -4
  215. package/dist/chunks/layers-panel-zr92pwdp.js +0 -4
  216. package/dist/chunks/lit-html-k2mb9k0r.js +0 -4
  217. package/dist/chunks/media-library-j74rt0w4.js +0 -4
  218. package/dist/chunks/media-open-mypr0k6b.js +0 -4
  219. package/dist/chunks/media-picker-pemtbsjv.js +0 -4
  220. package/dist/chunks/menu-d2jxpgma.js +0 -4
  221. package/dist/chunks/monaco-buffer-pa0g6ax7.js +0 -4
  222. package/dist/chunks/monaco-setup-0hw9f835.js +0 -4
  223. package/dist/chunks/notify-bwehrp7q.js +0 -4
  224. package/dist/chunks/platform-kv0k65cy.js +0 -4
  225. package/dist/chunks/popover-9tf4cjrk.js +0 -4
  226. package/dist/chunks/publish-panel-vg1n880b.js +0 -4
  227. package/dist/chunks/publish-workspace-jv4w2bx2.js +0 -4
  228. package/dist/chunks/quick-search-nh29rt8a.js +0 -4
  229. package/dist/chunks/references-vqyr5s9x.js +0 -4
  230. package/dist/chunks/right-panel-3ws9f2w0.js +0 -4
  231. package/dist/chunks/source-control-h3hcs5gy.js +0 -4
  232. package/dist/chunks/studio-0khd8xtx.js +0 -4
  233. package/dist/chunks/studio-1ctnw3xv.js +0 -5
  234. package/dist/chunks/studio-1ks5d9y4.js +0 -5
  235. package/dist/chunks/studio-1y9mab9m.js +0 -5
  236. package/dist/chunks/studio-2kpxm0eh.js +0 -7
  237. package/dist/chunks/studio-2zz4qbv9.js +0 -5
  238. package/dist/chunks/studio-3pz4t5a2.js +0 -5
  239. package/dist/chunks/studio-4f7thq0p.js +0 -5
  240. package/dist/chunks/studio-7rrdbvex.js +0 -5
  241. package/dist/chunks/studio-9dq7rwc7.js +0 -5
  242. package/dist/chunks/studio-acer0g8w.js +0 -5
  243. package/dist/chunks/studio-brh8d2pr.js +0 -5
  244. package/dist/chunks/studio-c2fa783p.js +0 -9
  245. package/dist/chunks/studio-cfnn70h1.js +0 -5
  246. package/dist/chunks/studio-cqxj4fcy.js +0 -5
  247. package/dist/chunks/studio-cw11h078.js +0 -5
  248. package/dist/chunks/studio-dn56z7sn.js +0 -5
  249. package/dist/chunks/studio-egnjpyde.js +0 -9
  250. package/dist/chunks/studio-ejrypvmq.js +0 -5
  251. package/dist/chunks/studio-frc16j8v.js +0 -10
  252. package/dist/chunks/studio-j0zf5x2x.js +0 -5
  253. package/dist/chunks/studio-j5fcp6gj.js +0 -5
  254. package/dist/chunks/studio-jd1qb1st.js +0 -7
  255. package/dist/chunks/studio-k1xqrgm5.js +0 -5
  256. package/dist/chunks/studio-k3we3kqb.js +0 -5
  257. package/dist/chunks/studio-knsjyx7n.js +0 -5
  258. package/dist/chunks/studio-mrjtnm62.js +0 -5
  259. package/dist/chunks/studio-n9qba0gx.js +0 -5
  260. package/dist/chunks/studio-nzemfbkk.js +0 -14
  261. package/dist/chunks/studio-pwctzka3.js +0 -16
  262. package/dist/chunks/studio-q80fg1d6.js +0 -12
  263. package/dist/chunks/studio-q9hx2qp0.js +0 -5
  264. package/dist/chunks/studio-qrzmfaf6.js +0 -5
  265. package/dist/chunks/studio-tmfcn347.js +0 -6
  266. package/dist/chunks/studio-wqfaqw4m.js +0 -5
  267. package/dist/chunks/studio-xpx91fby.js +0 -6
  268. package/dist/chunks/studio-xva3hzkv.js +0 -5
  269. package/dist/chunks/studio-z3fztxrp.js +0 -9
  270. package/dist/chunks/studio-z9453ypn.js +0 -6
  271. package/dist/chunks/tsMode-jg1dtphj.js +0 -14
  272. package/dist/chunks/workspace-6ztqcrsh.js +0 -4
  273. package/dist/chunks/workspace-home-rse9h8a0.js +0 -4
  274. package/src/content/draft-state.ts +0 -108
@@ -0,0 +1,5 @@
1
+ import{jn,vy,Wt,ln,gr,qx,tP,xn,Pe,Na,n_,St,r_,Hi,qn,Se,pi,ER,Tr,Fe,Kn,Z,ro,xh,Gp,Xe,Jp,fi,g,h,pn,Co,Yp}from"./studio-s49y6m5b.js";import{w}from"./studio-bk0anq3b.js";import{st,br,Zp,nd}from"./studio-x5py815g.js";import{p,ve}from"./studio-xh6rf05g.js";import{rd,Wi}from"./studio-ex1644g2.js";import{mf,su,zy,sd,Is,$r,Ns,ja,yf,cc,Uy,pM,To,rr,Nh,qy}from"./studio-m3jrjfhy.js";import{KC,De,Uc,qc}from"./studio-43pynnhz.js";import{yy,mh,zp}from"./studio-48yzqzqr.js";import{la,Ot}from"./studio-z6s56dzz.js";import{ml,zo,Zs,Xs,Uo}from"./studio-czpmzs9r.js";import{ae}from"./studio-q509sqt8.js";import{tr,SA,UL,$x,Lx,$s,Hp,fl,Rx,qL,u,tR}from"./studio-1d8m5s38.js";import{ph,oc,gy,fh}from"./studio-w4mfaaam.js";import{oo,zt,Vi,ko,x,nu,nf,kh,wn}from"./studio-zn7ysyzb.js";import{re,oa}from"./studio-151kgn69.js";import{Me,v_}from"./studio-bmwgj8ez.js";import{me,te,le}from"./studio-9f5vcb4w.js";import{N_}from"./studio-eq5vqn1q.js";import{n,J,Q,S,m,Oe,Rr,Jn,ur,it,cd}from"./studio-erjccagy.js";import{ce}from"./studio-7qqb7hb8.js";var Ar=128,iL="fullRender",XO="mountCanvas",QO="patchBatch",tn="prepareRender",qr={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=qr;var Qt=new Map;function nn(){try{return typeof localStorage<"u"&&Boolean(localStorage.getItem("jx-canvas-debug"))}catch{return!1}}function en(){return typeof performance<"u"&&Q(performance.now)?performance.now():0}function on(e,t){if(nn())console.debug(`[jx-canvas] ${e}`,t??"")}function mx(e){qr.escalations+=1,qr.lastEscalationReason=e,on("escalation",e)}function Ir(e){if(e.length===0)return 0;let t=e.toSorted((r,i)=>r-i),o=Math.min(t.length-1,Math.ceil(t.length*0.95)-1);return t[Math.max(0,o)]??0}function Dr(e,t){let o=Number.isFinite(t)&&t>0?t:0,r=Qt.get(e);if(!r)r=[],Qt.set(e,r);if(r.push(o),r.length>Ar)r.shift();let i=qr.timings[e],a={count:(i?.count??0)+1,lastMs:o,maxMs:Math.max(i?.maxMs??0,o),p95Ms:Ir(r),totalMs:(i?.totalMs??0)+o};if(qr.timings[e]=a,e===iL)qr.lastFullRenderMs=a.lastMs,qr.p95FullRenderMs=a.p95Ms;on(`span:${e}`,`${o.toFixed(2)}ms`)}function rn(e){let t=en(),o=nn(),r=`jx-${e}-start`;if(o)try{performance.mark(r)}catch{}let i=!1;return()=>{if(i)return qr.timings[e]?.lastMs??0;i=!0;let a=en()-t;if(o)try{performance.measure(`jx-${e}`,r),performance.clearMarks(r)}catch{}return Dr(e,a),a}}function IC(e,t){let o=rn(e);try{return t()}finally{o()}}async function NC(e,t){let o=rn(e);try{return await t()}finally{o()}}function vo(){return br(g.activePaneId)}function bt(e){let t=pn(e),o=t?.derived,r=o?.kind==="lens"?pn(o.sourcePaneId)?.activeTabId:t?.activeTabId;return r?g.tabs.get(r)??null:null}function Vo(e){return pn(e)?.derived??null}function yC(e){if(!e)return[];let t=[];for(let o of g.panes)if(bt(o.id)?.id===e.id)t.push(br(o.id));return t}function z(e){for(let t of Zp()){let o=t.panels.find((r)=>r.canvas===e);if(o)return{panel:o,surface:t}}return null}function an(e){let t=e.canvas,o=t?z(t):null;return o?bt(o.surface.paneId):null}function Ta(e){let t=e?.session.ui,o=t?.canvasMode??"design";return t?.preview&&(o==="edit"||o==="design")?"preview":o}function Ur(e){let t=Vo(e);if(t?.kind==="lens"){let o=t.mode;return bt(e)?.session.ui?.preview&&(o==="edit"||o==="design")?"preview":o}return Ta(bt(e))}function ul(e){let t=Vo(e);if(t?.kind==="lens"&&t.preset==="breakpoint")return t.media;return bt(e)?.session.ui.activeMedia??null}function at(e){return nd(e)?.paneId??fi}function pe(e){return bt(at(e))}function yx(e){return mf(e)!==null}function Pp(e){return mf(e)}function Wo(e){if(!e)return{baseWidth:320,featureQueries:[],sizeBreakpoints:[]};let t=[],o=[],r=320;for(let[i,a]of Object.entries(e)){if(i==="--"){let c=String(a).match(/^(\d+)\s*px$/);r=c?Number(c[1]):320;continue}let l=a.match(/min-width:\s*([\d.]+)px/),s=a.match(/max-width:\s*([\d.]+)px/);if(l)o.push({name:i,query:a,type:"min",width:Number(l[1])});else if(s)o.push({name:i,query:a,type:"max",width:Number(s[1])});else t.push({name:i,query:a})}return o.sort((i,a)=>i.type==="min"?i.width-a.width:a.width-i.width),{baseWidth:r,featureQueries:t,sizeBreakpoints:o}}function kr(e,t){let o=new Set;for(let r of e)if(r.type==="min"&&t>=r.width)o.add(r.name);else if(r.type==="max"&&t<=r.width)o.add(r.name);return o}function sn(e,t){let o=kr(e,t),r=null;for(let i of e){if(!o.has(i.name))continue;let a=Math.abs(i.width-t);if(r===null){r=i;continue}let l=Math.abs(r.width-t);if(a<l||a===l&&i.width<r.width)r=i}return r?.name??null}function aA(e,t,o=8){let r=null;for(let i of t){let a=Math.abs(i-e);if(a>o)continue;if(r===null||a<Math.abs(r-e))r=i}return r??e}var OC={$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 jm=OC.$defs,Lr=new Set(["pre"]),Cs=new Set(Object.entries(jm).filter(([e,t])=>!Lr.has(e)&&(t.$inlineChildren?.length??0)>0).map(([e])=>e));var cn=new Set(["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"]);function lt(e,t){if(!t)return cn.has(e);let o=jm[t];if(!o||!o.$inlineChildren)return!1;return o.$inlineChildren.includes(e)}function rA(e){let t=jm[e];if(!t)return null;let o=t.$inlineActions;if(n(o))o=jm[o]?.$inlineActions??void 0;if(!Array.isArray(o))return null;return o}var _r=null;function gx(e,t){if(!S(e))return!1;let o=(it(e.tagName)||"div").toLowerCase();if(t){let r=(it(t.tagName)||"div").toLowerCase();return lt(o,r)}return cn.has(o)}function oA(){return _r!==null}function Te(e){return!e||e==="base"?null:e}function bx(e){let t=e.panels;if(t.length===0)return null;if(t.length===1)return t[0];let o=ul(e.paneId);for(let r of t){if(o===null&&r.mediaName==="base")return r;if(r.mediaName===o)return r}return t[0]}function un(){return bx(vo())}function sA(e,t){if(!e)return t;let o=t;for(let r=zt(o);r;r=zt(o)){let i=re(e,o),a=re(e,r);if(!i||!a)break;let l=(it(i.tagName)||"div").toLowerCase(),s=(it(a.tagName)||"div").toLowerCase();if(!lt(l,s))break;o=r}return o}var Hm=240,lA=8,cA=16,Ne=new Map;function ct(e){return Wo(tr(e.doc.document.$media))}function AC(e){let{baseWidth:t,sizeBreakpoints:o}=ct(e),r=e.session.ui.activeMedia;return o.find((i)=>i.name===r)?.width??t}function jr(e,t){let o=Ne.get(e);if(!o)return null;if(!t||o.tabId!==t.id||o.media!==t.session.ui.activeMedia)return Ne.delete(e),null;return o.width}function dA(e,t){let o=t?AC(t):0;return jr(e.paneId,t)??o}function PC(e){Ne.delete(e)}function uA(e){let{baseWidth:t,sizeBreakpoints:o}=ct(e);return[t,...o.map((r)=>r.width)]}function MC(e,t,o){let{sizeBreakpoints:r}=ct(t),i=sn(r,o);return t.session.ui.activeMedia=i,Ne.set(e,{media:i,tabId:t.id,width:o}),i}var ut={invokerTags:qy,popoverTags:Nh};function sL(e,t){if(!e||!t)return null;for(let o=t.length;o>=0;o-=1){let r=t.slice(0,o),i=re(e,r);if(S(i)&&ja(i,ut))return r}return null}function dn(e,t){let o=e.doc.document;if(!o)return null;if(t){let r=re(o,t);return S(r)&&ja(r,ut)?t:null}return sL(o,Pe(e.session.selection))}function fn(){let e=h.value?.doc.document;return e?pM(e,ut):!1}var gn=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],dt=new Set(["show-modal","close","request-close"]),pt=new Set(["toggle-popover","show-popover","hide-popover"]),Fr=["any","closerequest","none"],Vr=new Set(gn),Wr=new Set(Fr),Br=new Set(["button"]);function _(e){return $r(e)==="dialog"}function mn(e){return e.startsWith("--")}function zr(e){let t=[];for(let{node:o}of cc(e)){let r=yf(o);if(_(o)&&r!==null&&!t.includes(r))t.push(r)}return t}function hn(e){for(let{node:t}of cc(e))if(_(t))return!0;return!1}function Kr(e){let t=e.oncommand;return t!==void 0&&t!==null}function Gr(e,t){for(let{node:o}of cc(e)){if(o===e)continue;let r=$r(o);if(r==="button"){let i=Is(o,"command"),a=Is(o,"commandfor");if(i!==null&&(i==="close"||i==="request-close")&&(a===null||a===t))return!0}if(r==="form"&&Is(o,"method")?.toLowerCase()==="dialog")return!0}return!1}function zO(e,t){let o=[...cc(e,[],null,t)],r=zr(e),i=Uy(e,t),a=r.length>0||i.length>0,l=new Map,s=new Map;for(let{node:d}of o){let f=yf(d);if(f!==null&&!l.has(f))l.set(f,d);if($r(d)==="button"){let v=Is(d,"commandfor"),y=Is(d,"command");if(v!==null){let b=s.get(v)??new Set;b.add(y??""),s.set(v,b)}}}let c=[];for(let{node:d,path:f}of o)if(c.push(...Zr(d,f,l,r,i,a,t)),_(d))c.push(...Yr(d,f,s));return c}function Zr(e,t,o,r,i,a,l){let s=[],c=$r(e),d=l?.invokerTags?.has(c)??!1,f=Is(e,"command"),v=Is(e,"commandfor");if(!(f!==null||v!==null||("command"in sd(e))||("commandfor"in sd(e))))return s;let b=Ns(e,"the element");if(!Br.has(c)&&!d)return s.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. ${rr}`,fix:"invoker",message:`<${c||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),s;if(f!==null&&!Vr.has(f)&&!mn(f))return s.push({detail:`\`command\` is an enumerated attribute taking ${gn.map((E)=>`\`${E}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${rr}`,message:`${b} declares command="${f}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),s;if(v!==null){let E=o.get(v),k=r.includes(v),O=i.includes(v);if(!E&&a){let H=[...r,...i].map((V)=>`"${V}"`).join(", ");return s.push({detail:`No element in this document has the id "${v}". The dialogs and popovers here are: ${H}. A commandfor that names nothing does nothing, silently. ${rr}`,message:`commandfor="${v}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),s}if(f!==null&&E){if(dt.has(f)&&!_(E))s.push({detail:`\`${f}\` acts on a <dialog>, and "${v}" is ${O?"a popover":`a <${$r(E)||"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."} ${rr}`,message:`${b} sends ${f} to "${v}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(pt.has(f)&&!ja(E,l))s.push({detail:`\`${f}\` acts on a popover, and "${v}" is ${k?"a dialog":`a <${$r(E)||"element"}>`} that declares no \`popover\`. The click is ignored. ${k?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${rr}`,message:`${b} sends ${f} to "${v}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(mn(f)&&!Kr(E))s.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${v}" 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. ${rr}`,message:`${b} sends ${f} to "${v}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return s}function Yr(e,t,o){let r=[],i=Ns(e,"the dialog"),a=yf(e),{style:l}=e,s=Is(e,"closedby");if(s!==null&&!Wr.has(s))r.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. ${rr}`,message:`${i} declares closedby="${s}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(To(l,"display")!==null)r.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. ${rr}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let c=a===null?void 0:o.get(a),d=Is(e,"open")!==null||sd(e).open===!0||e.open===!0;if(a!==null&&!c?.has("show-modal")&&!d)r.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. ${rr}`,message:`${i} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(c?.has("show-modal")&&s==="none"&&!Gr(e,a))r.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"\`. ${rr}`,message:`${i} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}function aL(e,t){if(!e||!t)return null;for(let o=t.length;o>=0;o-=1){let r=t.slice(0,o),i=re(e,r);if(S(i)&&_(i))return r}return null}function FC(e,t){let o=e.doc.document;if(!o)return null;if(t){let r=re(o,t);return S(r)&&_(r)?t:null}return aL(o,Pe(e.session.selection))}function vn(){let e=h.value?.doc.document;return e?hn(e):!1}var Xr=/\[\.\.\.(\w+)\]|\[(\w+)\]/g;function yn(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function wo(e){let t=yn(e),o=t.slice(t.lastIndexOf("/")+1),r=o.lastIndexOf(".");if(r>0)t=t.slice(0,t.length-(o.length-r));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let i=[],a=!1,l=!1,s=t.replaceAll(Xr,(c,d,f)=>{if(a=!0,d)return l=!0,i.push(d),"*";return i.push(f),`:${f}`});return{isCatchAll:l,isDynamic:a,params:i,urlPattern:s}}function Bc(e){if(!e)return"/";return wo(e).urlPattern}function hl(e){if(!e)return[];return wo(e).params}function nh(e,t){let o=yn(e).split("/");if(!o.every((l)=>l!==""&&l[0]!=="_"))return!1;if(t===void 0)return!0;let r=o.at(-1)??"",i=r.lastIndexOf("."),a=i>0?r.slice(i).toLowerCase():"";return a!==""&&new Set(t).has(a)}function vC(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}function Jb(e){let t=e.document?.$paths,o=e.frontmatter?.$paths;return t??o??null}var Ae=new Map;function qO(){Ae.clear()}function wC(e,t){if(!t)return Promise.resolve({});let o=`${e??""}::${JSON.stringify(t)}`,r=Ae.get(o);if(!r)r=Qr(t).catch((i)=>(Ae.delete(o),console.warn("page-params: failed to enumerate $paths values:",i),{})),Ae.set(o,r);return r}async function Qr(e){if(Array.isArray(e)){let t={};for(let o of e)for(let[r,i]of Object.entries(o))Re(t,r,i);return t}if("contentType"in e&&n(e.contentType)&&e.contentType){let t=e.param??"slug",o=e.field??"id",r=await ti(e.contentType),i={[t]:[]};if(!Array.isArray(r))return i;let a=r;for(let l of a)Re(i,t,o==="id"?l.id:l.data?.[o]??l.id);return i}if("values"in e&&Array.isArray(e.values)){let t=e.param??"value",o={[t]:[]};for(let r of e.values)Re(o,t,r);return o}if("$ref"in e&&n(e.$ref)&&e.$ref){let t=e.param??"id",o=e.field??"id",r=await p().readFile(e.$ref.replace(/^\.\//,"")),i=JSON.parse(r),a={[t]:[]};if(!Array.isArray(i))return a;for(let l of i)Re(a,t,m(l)?l[o]??l.id??l:l);return a}return{}}async function ei(){let e=await rd();for(let t of e){let o=t.classes?.find((r)=>r.name==="ContentCollection");if(o)return o.path}return"@jxsuite/parser/ContentCollection.class.json"}async function ti(e){let t={$prototype:"ContentCollection",$src:await ei(),contentType:e},o=p();if(o.resolveClass)return o.resolveClass(t);return fetch("/__jx_resolve__",{body:JSON.stringify(t),headers:{"content-type":"application/json"},method:"POST"}).then((r)=>{if(!r.ok)throw Error(`Class resolution failed: ${r.status}`);return r.json()})}function Re(e,t,o){if(o===null||o===void 0||o==="")return;let r=String(o);e[t]??=[];let i=e[t];if(!i.includes(r))i.push(r)}function xC(e,t,o){if(Object.keys(t).length===0)return e;let r=Pn(e,t);return r.state??={},r.state.$page={params:{...t},title:n(r.title)?r.title:"",url:Bc(o)},r}function _C(e){if(!e)return[];return Object.keys(e).filter((t)=>{let o=e[t];return m(o)&&n(o.$prototype)&&n(o.$src)&&JSON.stringify(o).includes('"#/$params/')})}async function bn(e,t,o){if(t.length===0)return;let r=p(),{resolveClass:i}=r;if(!i)return;let{state:a}=e;if(!a)return;await Promise.all(t.map(async(l)=>{let s=a[l];if(!m(s))return;let c={...s};if(o)c.$base=o;try{a[l]=await i.call(r,c)}catch(d){console.warn(`page-params: failed to resolve state.${l} for preview:`,d)}}))}function Cn(e,t){let o=ni(e,t);if(o!==null)return o;if(Array.isArray(e))return e.map((r)=>Cn(r,t));return m(e)?Pn(e,t):e}function Pn(e,t){let o={};for(let[r,i]of Object.entries(e))o[r]=Cn(i,t);return o}function ni(e,t){if(!Oe(e)||!e.$ref.startsWith("#/$params/"))return null;return t[e.$ref.slice(10)]??null}function G(e){return bt(e.paneId)}function fe(e){let t=Vo(e.paneId);if(t?.kind==="lens")return t.zoom;return G(e)?.session.ui.zoom??1}function Bm(e=vo()){return fe(e)}function $e(e,t){let o=Vo(e.paneId);if(o?.kind==="lens"){o.zoom=t;return}let r=G(e);if(r)r.session.ui.zoom=t}function oi(e){return Boolean(e.canvas&&e.viewport)}function Mp(e,t,o,r=null){let a={_width:r||null,canvas:null,element:null,mediaName:e||"",ready:!1,renderScope:null,scrollContainer:null,viewport:null},l=[];if(r&&!o)l.push(`--panel-viewport-w:${r}px`);if(r)l.push(`--panel-canvas-w:${r}px`);return{item:{fullWidth:o,header:t?"shown":"hidden",key:e??"",label:t??"",mediaAttr:e,widthVars:l.join(";")},panel:a}}function hA(e,t){for(let{item:o,panel:r}of e){let i=(a)=>t.panelNode(o.key,a);r.element=i("panel"),r.viewport=i("panel-viewport"),r.canvas=i("panel-canvas")}}function pA(e,t){let o=e.find((i)=>i.item.key===t);if(!o)return;let r=an(o.panel);if(r)r.session.ui.activeMedia=Te(o.item.mediaAttr)}function ht(e){if(!e.panzoomWrap)return;let t=e.wrap.clientWidth,o=e.panzoomWrap.scrollWidth,r=fe(e),i=t-o*r;e.panX=i>=0?i/2:16,e.panY=0}function vx(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}ht(e),Ys(e)}),e.centerObserver.observe(e.panzoomWrap),ht(e)}function Ys(e){if(!e.panzoomWrap)return;let t=fe(e);e.panzoomWrap.style.transform=`translate(${e.panX}px, ${e.panY}px) scale(${t})`,wn("overlays")}var vt=0.25,yt=3;function Tn(e){return Math.min(yt,Math.max(vt,e))}function ri(e,t,o){let r=e.wrap.querySelector('[part="edit-canvas"]'),i=e.panels[0]?.canvas;if(!r||!i)return null;let a=e.wrap.querySelector('[part="edit-column"]'),l=a?Me(a).width:0,s=t&&l>0?l/t:1,c=o;if(c===null){let d=Me(r);c=d.top+d.height/2}return{layoutY:Math.max(0,(c-Me(i).top)/s),scroller:r,zoom:s}}function ah(e=vo(),t=null){if(Ur(e.paneId)!=="edit")return;let[o]=e.panels;if(!o||!oi(o))return;let r=o.canvas,i=r.querySelector("iframe"),a=G(e)?.session.ui.editZoom??1,l=ri(e,o._width??null,t);if(a===1){if(o._width=null,r.style.width="",r.style.transform="",r.style.transformOrigin="",i)i.style.width="100%";o.viewport.style.height=""}else{let s=e.wrap.querySelector('[part="edit-column"]');if(!s)return;let c=Me(s).width;if(c<=0)return;let d=c/a;if(o._width=d,r.style.width=`${d}px`,r.style.transform=`scale(${a})`,r.style.transformOrigin="top left",i)i.style.width=`${d}px`,o.viewport.style.height=`${i.offsetHeight*a}px`}if(l)l.scroller.scrollTop+=l.layoutY*(a-l.zoom);wn("overlays")}function Fp(e,t=vo()){let o=G(t);if(!o)return;o.session.ui.editZoom=Tn(e),ah(t)}var ft=new Map,mt=new Map;function fA(e,t=vo(),o=null){let r=G(t);if(!r)return;if(r.session.ui.editZoom=Tn(e),mt.set(t.paneId,o),ft.has(t.paneId))return;ft.set(t.paneId,requestAnimationFrame(()=>{ft.delete(t.paneId);let i=mt.get(t.paneId)??null;mt.delete(t.paneId),ah(t,i)}))}function ii(e){let t=getComputedStyle(e).getPropertyValue("--boards-inset").trim(),o=Number(t.replace(/px$/,""));return Number.isFinite(o)?o:0}function Mn(e,t,o){if(!e.panzoomWrap)return;let r=e.wrap.clientWidth,i=e.wrap.clientHeight-ii(e.panzoomWrap),a=24,l=32,s=0,{panels:c}=e;for(let de of c)s+=de._width||800;s+=a*Math.max(0,c.length-1)+l;let d=fe(e),y=Me(e.panzoomWrap).height/d+l,b=r/s,E=i/y,k=t==="width"?b:Math.min(b,E),O=Math.min(o,Math.max(K,k));$e(e,O);let H=s*O,V=y*O;e.panX=Math.max(0,(r-H)/2),e.panY=Math.max(0,(i-V)/2),Ys(e)}function mA({maxZoom:e=U,surface:t=vo()}={}){Ie("page",t),Mn(t,"page",e)}var K=0.05,U=5;function Nn(e){return Math.min(U,Math.max(K,e))}var ai="page",xt=["width","page","none"];function si(e,t,o){let r=t[o];if(li(r))return r;if(J(r)&&r>=K&&r<=U)return r;throw RangeError(`command "${e}" argument "${o}": expected ${xt.map((i)=>`"${i}"`).join(" | ")} or a number in [${K}, ${U}], got ${JSON.stringify(r)}`)}function li(e){return n(e)&&xt.includes(e)}var Rn=new Map;function On(e){let t=G(e);if(!t)return null;let o=Vo(e.paneId)?.kind==="lens"?`::${e.paneId}`:"";return`${t.id}::${t.documentPath??""}${o}`}function Ie(e,t){let o=On(t);if(o)Rn.set(o,e)}function jC(e=vo()){let t=On(e);return(t===null?void 0:Rn.get(t))??ai}function An(e,t=vo()){let o=e??jC(t);if(o==="none"){Ys(t);return}if(J(o)){$e(t,Nn(o)),Ys(t);return}Mn(t,o,1)}function lL(e,t=vo()){Ie(e,t),An(e,t)}function Vm(e,t=vo(),o=null){if(!G(t))return;let i=Nn(e),a=i/fe(t);if(Ie(i,t),t.panzoomWrap&&a!==1){let l=Me(t.panzoomWrap),s=Me(t.wrap),c=o?.clientX??s.left+s.width/2,d=o?.clientY??s.top+s.height/2;t.panX+=(c-l.left)*(1-a),t.panY+=(d-l.top)*(1-a),t.needsCenter=!1}$e(t,i),Ys(t)}function HC(e){if(e.wrap.clientWidth<=0){Ys(e);return}An(jC(e),e)}function gA(e=vo()){if(Ie(1,e),!e.panzoomWrap)return;$e(e,1),ht(e),Ys(e)}function $n(e,t){let o=Me(In(e)??e.wrap),r=t.top+t.height/2-o.top;return o.height/2-r}function In(e){return bx(e)?.scrollContainer??null}function ci(e,t,o){let r=In(e);if(!r){kn(e,t);return}let i=r.scrollTop-t;if(o){r.scrollTo({behavior:"smooth",top:i});return}r.scrollTop=i}function BC(e,t=vo()){ci(t,$n(t,e),!1)}function Dn(e,t=vo()){let o=Me(t.wrap);if(e.top>=o.top&&e.top+e.height<=o.top+o.height)return;let r=$n(t,e),i=Math.max(t.panY,0)-t.panY,a=Math.min(r,i);if(a!==0)t.needsCenter=!1,kn(t,a)}function kn(e,t){let o=e.panY,r=o+t,i=performance.now(),a=250,l=(s)=>{let c=Math.min((s-i)/250,1),d=c*(2-c);if(e.panY=o+(r-o)*d,Ys(e),c<1)requestAnimationFrame(l)};requestAnimationFrame(l)}var ui=["edit","design","preview","source","stylebook","tokens","grid","git-diff"],gt=ui.filter((e)=>e!=="git-diff"),ke=new Set(["edit","design"]);function di(e){return ke.has(e)}var cL=["edit","design","preview"];function mi(e){return cL.filter((t)=>e.capabilities.modes.includes(t))}function bA(e){return mi(e).filter((t)=>t!=="preview")}function dL(e){let t=e.session.ui.canvasMode;return di(t)?t:null}function uL(e){return{available:e.capabilities.modes.includes("preview")&&ke.has(e.session.ui.canvasMode),on:e.session.ui.preview===!0}}function hL(e,t,o){if(t==="preview"){if(ke.has(e.session.ui.canvasMode))e.session.ui.preview=!0;return}if(e.session.ui.preview=!1,e.session.ui.canvasMode!==t)o(e,t)}var Sn=new Set(["design","stylebook","git-diff"]),D=(e)=>e.document.open,En=["auto","light","dark"];function gi(e){function t(l){let s=h.value;if(!s)throw RangeError(`command "${l}" needs an open document; no tab is active`);return s}function o(l,s){let{pane:c}=s;if(c===void 0)return t(l);let d=St(l,s,"pane"),f=bt(d);if(!f)throw RangeError(`command "${l}" argument "pane": "${d}" has no open document`);return f}let r={pane:Fe("Which pane to render this way. Defaults to the focused one.")};function i(l){e.renderPane(a(l))}function a(l){let{pane:s}=l;return n(s)?s:g.activePaneId}return[{args:Se({mode:pi(gt,"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:D,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, tokens and grid 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:l,args:s})=>{let c=qn("canvas.setMode",s,"mode",gt),d=l.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 ${c} mode; ${d}.`}},run:(l,s)=>{let c=qn("canvas.setMode",s,"mode",gt),d=t("canvas.setMode"),{modes:f}=d.capabilities;if(!f.includes(c))throw RangeError(`command "canvas.setMode" argument "mode": "${c}" is not a mode this document `+`supports — it declares: ${f.join(", ")}`);if(c==="preview"){let v=d.session.ui.canvasMode;if(!ke.has(v))throw RangeError(`command "canvas.setMode" argument "mode": "preview" composes with the edit and design base modes; this pane is in "${v}"`);d.session.ui.preview=!0;return}d.session.ui.preview=!1,e.setCanvasMode(d,c)},title:"Set Canvas Mode"},{args:Se({zoom:ER("Pan-zoom scale, 1 = 100%.",{maximum:U,minimum:K})}),category:"View",id:"canvas.setZoom",level:"document",menus:["palette"],group:"3_canvas",requires:"a document on the pan-zoom surface",when:D,enablement:()=>Sn.has(e.getCanvasMode()),run:(l,s)=>{t("canvas.setZoom"),Vm(r_("canvas.setZoom",s,"zoom",K,U))},title:"Set Zoom"},{args:Se({fit:{description:'How the document is framed: "width" | "page" | "none", or a numeric pan-zoom scale.',oneOf:[{enum:[...xt],type:"string"},{maximum:U,minimum:K,type:"number"}]}}),category:"View",id:"canvas.setFit",level:"document",menus:["palette"],group:"3_canvas",requires:"a document on the pan-zoom surface",when:D,enablement:()=>Sn.has(e.getCanvasMode()),run:(l,s)=>{t("canvas.setFit"),lL(si("canvas.setFit",s,"fit"))},title:"Set Fit"},{args:Se({zoom:ER("Edit-mode content zoom, 1 = 100%.",{maximum:yt,minimum:vt})}),category:"View",id:"canvas.setEditZoom",level:"document",menus:["palette"],group:"3_canvas",requires:"a document in edit mode",when:D,enablement:()=>e.getCanvasMode()==="edit",run:(l,s)=>{t("canvas.setEditZoom"),Fp(r_("canvas.setEditZoom",s,"zoom",vt,yt))},title:"Set Edit Zoom"},{args:{additionalProperties:!1,properties:{...r,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:D,enablement:()=>e.getCanvasMode()==="edit",run:(l,s)=>{let c=o("canvas.setEditWidth",s),{width:d}=s;if(d===null){PC(a(s)),i(s);return}MC(a(s),c,r_("canvas.setEditWidth",s,"width",Hm,1e4)),i(s)},title:"Set Edit Width"},{args:{additionalProperties:!1,properties:{...r,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:D,run:(l,s)=>{let c=o("canvas.setBreakpoint",s),{media:d}=s;if(d!==null&&!n(d))throw RangeError('command "canvas.setBreakpoint" argument "media": expected a breakpoint key or null');let f=Object.keys(tr(c.doc.document.$media));if(d!==null&&!f.includes(d))throw RangeError(`command "canvas.setBreakpoint" argument "media": "${d}" is not a breakpoint this `+`document defines — it defines: ${f.length>0?f.join(", "):"nothing"}`);c.session.ui.activeMedia=d,i(s)},title:"Set Breakpoint"},{args:Se({...r,scheme:pi(En,"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:D,run:(l,s)=>{let c=o("canvas.setColorScheme",s);c.session.ui.previewColorScheme=qn("canvas.setColorScheme",s,"scheme",En),i(s)},title:"Set Color Scheme"},{args:Se({...r,locale:Fe("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:(l)=>l.document.open&&l.project.isMultilingual,run:(l,s)=>{let c=o("i18n.switchLocale",s),d=St("i18n.switchLocale",s,"locale"),f=$s();if(f===null||!f.locales.includes(d))throw RangeError(`command "i18n.switchLocale" argument "locale": "${d}" is not a locale this `+`project declares — it declares: ${f===null?"nothing":f.locales.join(", ")}`);c.session.ui.previewLocale=d,i(s)},title:"Set Rendering Language"},{args:Se({...r,visible:Tr("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:D,run:(l,s)=>{let c=o("canvas.setLayoutVisible",s);c.session.ui.showLayout=Hi("canvas.setLayoutVisible",s,"visible"),i(s)},title:"Show Layout Elements"},{args:Se({...r,open:Tr("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:()=>fn(),group:"3_canvas",id:"canvas.setPopoverOpen",level:"document",menus:["palette"],requires:"a popover in the open document",run:(l,s)=>{let c=o("canvas.setPopoverOpen",s),d=s.path,f=s.open===void 0?!0:Hi("canvas.setPopoverOpen",s,"open");if(!f&&d===void 0){e.setOpenPopover(c,null);return}let v=dn(c,d);if(v===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(c,f?v:null)},title:"Show Popover",when:D},{args:Se({...r,open:Tr("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:()=>vn(),group:"3_canvas",id:"canvas.setDialogOpen",level:"document",menus:["palette"],requires:"a dialog in the open document",run:(l,s)=>{let c=o("canvas.setDialogOpen",s),d=s.path,f=s.open===void 0?!0:Hi("canvas.setDialogOpen",s,"open");if(!f&&d===void 0){e.setOpenDialog(c,null);return}let v=FC(c,d);if(v===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(c,f?v:null)},title:"Show Dialog",when:D},{args:{additionalProperties:!1,properties:{...r,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:D,run:(l,s)=>{o("canvas.setResolvingOpen",s);let{open:c,pane:d}=s;e.setResolvingOpen(n(d)?d:g.activePaneId,c===void 0||Hi("canvas.setResolvingOpen",s,"open"))},title:"Show Resolving Values"},{args:{additionalProperties:!1,properties:{...r,name:Fe("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:D,run:(l,s)=>{let c=o("canvas.setTestProp",s),d=St("canvas.setTestProp",s,"name"),f=Object.keys(c.doc.document.state??{});if(!f.includes(d))throw RangeError(`command "canvas.setTestProp" argument "name": "${d}" is not a prop this component `+`declares — it declares: ${f.length>0?f.join(", "):"nothing"}`);let{value:v}=s,y={...c.session.ui.previewProps};if(v===null||v===void 0)delete y[d];else y[d]=v;c.session.ui.previewProps=Object.keys(y).length>0?y:null,i(s)},title:"Set Test Value"},{args:{additionalProperties:!1,properties:{...r,name:Fe("The route parameter's name, without brackets."),value:Fe("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:D,run:(l,s)=>{let c=o("canvas.setRouteParam",s),d=St("canvas.setRouteParam",s,"name"),f=hl(c.documentPath);if(!f.includes(d))throw RangeError(`command "canvas.setRouteParam" argument "name": "${d}" is not a parameter of this `+`route — it has: ${f.length>0?f.join(", "):"none"}`);c.session.ui.previewParams={...c.session.ui.previewParams,[d]:St("canvas.setRouteParam",s,"value")},i(s)},title:"Set Route Parameter"}]}function yA(e,t){e.registerAll(gi(t))}function wx(e=vo()){let t=ul(e.paneId),o=e.panels;for(let r of o){let i=r.element?.querySelector('[part="panel-header"]');if(i){let a=t===null&&r.mediaName==="base"||t===r.mediaName;i.toggleAttribute("data-active",a)}}}var Ct="jx:canvas";function Hn(e){let{target:t,source:o,targetOrigin:r,acceptOrigin:i,token:a}=e,l=new Set,s=(c)=>{if(i!=="*"&&c.origin!==i)return;let d=c.data;if(!S(d)||!(Ct in d)||d[Ct]!==a)return;let f="payload"in d?d.payload:void 0;for(let v of l)v(f)};return o.addEventListener("message",s),{dispose(){l.clear(),o.removeEventListener("message",s)},onMessage(c){return l.add(c),()=>l.delete(c)},post(c){t.postMessage({[Ct]:a,payload:c},r)}}}var Pt=null;function Ln(){return Pt}function Kb(e){if(Pt){Pt(e);return}window.open(e,"_blank","noopener,noreferrer")}function Gb(e,t,o,r=null,i=null,a=[]){if(!e.state)e.state={};let l={};if(i!==null)l.defaultLocale=i.defaultLocale,l.locales=i.locales;e.state.$site={name:t.name??"Jx Site",url:t.url??"",...l,...t.state};let s=(n(e.$lang)?e.$lang:void 0)??tP(o.urlPattern,i)??t.defaults?.lang,c=a.map((f)=>({code:f.locale,current:f.urlPattern===o.urlPattern,dir:vy(f.locale),label:Wt(f.locale),url:f.urlPattern})),d={params:o._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:o.urlPattern};if(c.length>0)d.alternates=c;if(o.pagination){let{first:f,itemCount:v,last:y,next:b,number:E,pageCount:k,pageSize:O,pages:H,prev:V}=o.pagination;d.pagination={first:f,itemCount:v,last:y,next:b,number:E,pageCount:k,pageSize:O,pages:H.map(({current:de,number:oe,url:P})=>({current:de,number:oe,url:P})),prev:V}}if(s!==void 0)d.dir=vy(s),d.locale=s;if(e.state.$page=d,t.state){for(let[f,v]of Object.entries(t.state))if(f!=="$site"&&f!=="$page"&&!(f in e.state))e.state[f]=v}if(t.$media)e.$media={...t.$media,...e.$media};if(t.imports&&Object.keys(t.imports).length>0){if(!e.imports)e.imports={};for(let[f,v]of Object.entries(t.imports))if(!(f in e.imports))e.imports[f]=r&&(v.startsWith("./")||v.startsWith("../"))?r(v,o):v}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let f=new Set,v=[];for(let y of[...t.$elements,...e.$elements]){let b=n(y)?y:S(y)?y.$ref:void 0;if(b&&!f.has(b))f.add(b),v.push(y)}e.$elements=v}return e}var vi=new Set(["img","video","source","iframe","audio"]),_n="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",wt="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";function UO(e,t){e.addEventListener("error",(o)=>{let{target:r}=o;if(r instanceof HTMLImageElement&&r.getAttribute("src")!==wt)r.setAttribute("src",wt),r.removeAttribute("srcset"),r.dataset.placeholder=""},{capture:!0,signal:t})}var yi=/(src|poster|image|bg|background|icon|logo|photo|avatar|thumbnail|cover|banner)$/i;function Fn(e){return yi.test(e)}var xi=/(?<![\w$.])(?:item|index|\$map)\b/u;function Y(e){if(n(e))return e.includes("${")&&xi.test(e);return Jn(e)&&n(e.$ref)&&/^(?:#\/)?\$map\//u.test(e.$ref)}function Je(e,t){if(e==="href"||e==="action")return"";if(Fn(e))return wt;if(n(t))return He(t);return Jn(t)&&n(t.$ref)?Un(t.$ref):""}var bi=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"]),Ci=new Set(["div","section","article","aside","header","footer","main","nav","figure","figcaption","details","fieldset","form","ul","ol","dl","table"]);var Pi=["width","height","inlineSize","blockSize"];function Si(e){let{style:t}=e;if(!S(t))return!1;return Pi.some((o)=>{let r=t[o],i=J(r)?String(r):n(r)?r.trim():"";return i!==""&&i!=="auto"})}function wi(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(ur(e.children))return null;if(Si(e))return null;if(bi.has(it(e.tagName)))return"empty-text-placeholder";if(Ci.has(it(e.tagName)))return"empty-container-placeholder";return null}function He(e){return e.replaceAll(/\$\{([^}]+)\}/g,"❪ $1 ❫")}function Ei(e){return He(e.replaceAll(/\s*\?\?\s*\[\s*\]\s*(?=\})/gu,""))}function Ti(e,t){let o=e.map;return{children:S(o)?[q(o,Mi(e.items,t))]:[],className:"repeater-perimeter",tagName:"div"}}function Vn(e){return JSON.stringify(e)}function Wn(e){let t=e.startsWith("#/")?e.slice(2):e,[o,...r]=t.split("/"),i=o==="state"||o==="$map"?o:null;if(i===null)return null;let a=r.map((l)=>l.replaceAll("~1","/").replaceAll("~0","~"));return i+a.map((l)=>`?.[${Vn(l)}]`).join("")}function Et(e,t){if(t===null)return`(${e})`;return`((r) => ((item, index, $map) => (${e}))(r, 0, { index: 0, item: r }))(${t})`}function Mi(e,t){if(Array.isArray(e))return`${Vn(e)}[0]`;if(Oe(e)){let r=Wn(e.$ref);return r===null?null:`${Et(r,t)}?.[0]`}let o=n(e)?Bn(e):[];if(n(e)&&o.length===1&&Ni(e,o[0]))return`${Et(o[0].expr,t)}?.[0]`;return null}function Ni(e,t){return t.start===0&&t.end===e.length-1}function Bn(e){let t=[],o=e.indexOf("${");while(o!==-1){let r=0,i=-1;for(let a=o+1;a<e.length;a+=1)if(e[a]==="{")r+=1;else if(e[a]==="}"){if(r-=1,r===0){i=a;break}}if(i===-1)break;t.push({end:i,expr:e.slice(o+2,i),start:o}),o=e.indexOf("${",i+1)}return t}function zn(e,t=null){let o=Bn(e);if(o.length===0)return e;let r="",i=0;for(let{start:a,end:l,expr:s}of o)r+=e.slice(i,a),r+=`\${(() => { try { return ${Et(s,t)}; } catch { return ""; } })()}`,i=l+1;return r+e.slice(i)}function Ri(e,t){let o=e.startsWith("#/")?e.slice(2):e;if(o!=="$map"&&!o.startsWith("$map/"))return{$ref:e};let r=Wn(e);return t===null||r===null?void 0:zn(`\${${r}}`,t)}function Un(e){return`{${e.startsWith("#/state/")?e.slice(8):e}}`}function Tt(e,t=null){return q(e,t)}function q(e,t){if(Array.isArray(e))return e.map((s)=>q(s,t));if(!Jn(e))return e;if(e.$prototype==="Array")return Ti(e,t);let o=e,r={},i=!1,a=n(o.tagName)&&vi.has(o.tagName);if(a){let{attributes:s,src:c}=o,d=s?.src,f=o.poster,v=s?.poster;if(!(c&&c!==""||d&&d!=="")&&!(f&&f!==""||v&&v!==""))i=!0}for(let[s,c]of Object.entries(o))if(s==="state"||s==="$media"||s==="$elements")r[s]=c;else if(s==="$props"&&nu(c)){let d={};for(let[f,v]of Object.entries(c))if(!Y(v))d[f]=v;else if(n(v))d[f]=Fn(f)||f==="href"||f==="action"?Je(f,v):zn(v,t);else if(Oe(v)){let y=Ri(v.$ref,t);if(y!==void 0)d[f]=y}else d[f]=v;r[s]=d}else if(s==="children"){if(Array.isArray(c))r.children=c.map((d)=>q(d,t));else if(Jn(c)&&c.$prototype==="Array")r.children=[q(c,t)];else if(!ur(c))r.children=q(c,t)}else if(s==="cases"&&o.$switch&&nu(c)){let[d]=Object.entries(c);if(d){let[,f]=d;r.children=nu(f)&&!(Jn(f)&&f.$ref)?[q(f,t)]:[{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: ${Object.keys(c).join(" | ")}]`}]}}else if(s==="attributes"&&a&&nu(c)){let d={};for(let[f,v]of Object.entries(c))if((f==="src"||f==="poster")&&(v===""||v==null||Y(v)))i=!0,d[f]=_n;else d[f]=Y(v)?Je(f,v):v;r.attributes=d}else if(s==="attributes"&&nu(c)){let d={};for(let[f,v]of Object.entries(c))d[f]=Y(v)?Je(f,v):v;r.attributes=d}else if(s==="style")if(nu(c)){let d={};for(let[f,v]of Object.entries(c))if(!Y(v))d[f]=v;r.style=d}else r.style=c;else if(s==="$switch"&&n(c)&&c.includes("${"))r[s]=He(c);else if(s==="textContent"&&n(c)&&c.includes("${"))r[s]=He(c);else if(s==="textContent"&&Jn(c)&&c.$ref)r[s]=Un(c.$ref);else if(a&&(s==="src"||s==="poster"))if(c===""||c==null||Y(c))i=!0,r[s]=_n;else r[s]=c;else if(Y(c))r[s]=Je(s,c);else if(n(c)||Jn(c)&&c.$ref)r[s]=c;else r[s]=q(c,t);if(ur(o.children)){r.textContent=Ei(o.children);let{attributes:s}=r;r.attributes=nu(s)?{...s,contenteditable:"false"}:{contenteditable:"false"}}let l=wi(r);if(l)r.className=r.className?`${r.className} ${l}`:l;if(i){let s=n(r.className)?r.className:"";if(!s.includes("empty-media-placeholder"))r.className=s?`${s} empty-media-placeholder`:"empty-media-placeholder"}return r}function SC(e){let t=e?.tagName;return n(t)&&t.includes("-")}function Oi(e){return S(e)&&!Array.isArray(e)}function Gn(e){if(e===void 0)return null;if(Oi(e)){if(e.$expression||e.$compute||e.$prototype||e.$handler)return null;return"default"in e||"type"in e?"signal":"literal"}return n(e)&&e.includes("${")?null:"literal"}function KO(e){let t=e?.state??{},o=[];for(let[r,i]of Object.entries(t)){if(cd(r))continue;let a=Gn(i);if(!a)continue;let l=a==="signal"?i.default:i;o.push({name:r,value:l})}return o}function Zn(e,t){let o={...e.state},r=!1;for(let[i,a]of Object.entries(t)){let l=o[i],s=Gn(l);if(!s)continue;o[i]=s==="signal"?{...l,default:a}:a,r=!0}if(!r)return e;return{...e,state:o}}var Ai=new Set(["data","media","metadata","news","series","species"]),$i=new Set(["archive","catalog","catalogue","collection","directory","faq","gallery","inventory","library","menu","portfolio","showcase"]);function CC(e){return e.replaceAll(/[_-]+/g," ").replaceAll(/([a-z\d])([A-Z])/g,"$1 $2").trim().replaceAll(/\s+/g," ").toLowerCase()}function ih(e){let t=/[_-]|[a-z\d][A-Z]/.test(e)?CC(e):e,o=t.lastIndexOf(" "),r=t.slice(o+1);if($i.has(r.toLowerCase()))return`${t} item`;return`${t.slice(0,o+1)}${Ii(r)}`}function Ii(e){if(Ai.has(e.toLowerCase()))return e;if(/[^aeiou]ies$/.test(e))return`${e.slice(0,-3)}y`;if(/(?:ss|x|ch|sh|z)es$/.test(e))return e.slice(0,-2);if(/(?:us|is|ss)$/.test(e))return e;if(e.endsWith("s"))return e.slice(0,-1);return e}function Yb(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Zb(e){return(e.replaceAll("\\","/").split("/").pop()??e).replace(/\.[^.]+$/,"").replaceAll(/[-_]+/g," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())}var hi="pages";function Mt(){return x?.projectConfig?.content??{}}function Yn(e){return e!==void 0&&/\.[\da-z]+$/i.test(e.replace(/\/+$/,""))}var Di={fileBacked:!1,item:"page",key:hi,kind:"pages",title:"Pages"};function Fm(){let e=Object.entries(Mt()).map(([t,o])=>({fileBacked:Yn(o.source),item:ih(t),key:t,kind:"collection",title:Yb(CC(t))}));return[Di,...e]}function tL(){return Fm().map((e)=>e.key)}function fx(e){let t=Mt()[e]?.source;return t!==void 0&&Yn(t)?t.replace(/^\.\//,""):null}function GO(e){return Mt()[e]?.schema??null}function ec(e){return Fm().find((t)=>t.key===e)??null}function tc(e){if(!e)return null;let t=e.replaceAll("\\","/").replace(/^\.\//,"");if(la.has(Ot(t)))return null;if(t.startsWith("pages/"))return nh(t)?hi:null;return Kn(t)?.name??null}function rh(e){if(!e)return!1;let t=Kn(e);if(!t||t.fileBacked)return!1;let o=Ot(e);return o!==".json"&&o!==".csv"}function JO(e,t){if(e===void 0||t)return{entries:!0,pages:!0,scan:!0};let o=e.map((r)=>r.replaceAll("\\","/").replace(/^\.\//,""));return{entries:o.some((r)=>{let i=tc(r);return i!==null&&i!==hi}),pages:o.some((r)=>r.startsWith("pages/")),scan:!1}}function ki(e,t,o){let r=e?.state??t?.state,i=`#/$params/${o}`;for(let a of Object.values(m(r)?r:{})){if(!m(a)||a.$prototype!=="ContentEntry")continue;let{contentType:l,id:s}=a;if(m(s)&&s.$ref===i&&n(l)&&l!=="")return l}return null}function kC(e,t){let o=Jb({document:e,frontmatter:t}),r=null,i=null,a=null,l=null;if(o&&!Array.isArray(o)&&"contentType"in o){let d=o.contentType;r=n(d)&&d!==""?d:null;let f="param"in o?o.param:void 0;i=n(f)&&f!==""?f:null;let v="field"in o?o.field:void 0;a=n(v)&&v!==""&&v!=="id"?v:null}else if(o&&!Array.isArray(o)&&"values"in o){let d="param"in o?o.param:void 0,f=n(d)&&d!==""?d:null;r=f===null?null:ki(e,t,f),i=r===null?null:f;let v=o.values;l=r!==null&&Array.isArray(v)?v.flatMap((y)=>{let b=Rt(y);return b===null?[]:[b]}):null}let s=e?.$layout??t?.$layout,c=n(s)||s===!1?s:void 0;return{contentType:r,field:a,layout:c,param:i,...l!==null&&{values:l}}}async function nL(e){let t={contentType:null,field:null,layout:void 0,param:null};try{let o=await p().readFile(e);if(e.endsWith(".json"))return kC(JSON.parse(o),null);let{parseSourceForPath:r}=await (ce("6a49er4c"),import("./file-ops-6a49er4c.js")),i=await r(e,o);return kC(i.document,i.frontmatter)}catch{return t}}var W=null,ge=null,Nt=0,Le=new Set;async function Xn(e,t){let o;try{o=await p().listDirectory(e)}catch{return}await Promise.all(o.map(async(r)=>{if(r.type==="directory")await Xn(r.path,t);else t.push(r.path)}))}async function Ji(){let e=[];await Xn("pages",e);let t=e.filter((a)=>a.includes("[")&&nh(a)).toSorted(),o=await Promise.all(t.map(async(a)=>[a,await nL(a)])),{i18n:r}=ln(x?.projectConfig??{}),i=new Map;for(let[a,l]of o)if(l.contentType){let s={field:l.field,layout:l.layout,locale:qx(a,r),param:l.param,path:a,pattern:wo(a).urlPattern,...l.values&&{values:l.values}};i.set(l.contentType,[...i.get(l.contentType)??[],s])}return i}function At(){if(W)return Promise.resolve(W);if(!ve()||!x)return Promise.resolve(new Map);if(!ge){let e=Nt;ge=Ji().then((t)=>{if(e===Nt){W=t,ge=null;for(let o of Le)o()}return t})}return ge}function Qn(e,t){if(!e||e.length===0)return null;let o=jn(t),r=ln(x?.projectConfig??{}).i18n?.defaultLocale??null;return(o===null?void 0:e.find((i)=>i.locale===o))??(r===null?void 0:e.find((i)=>i.locale===r))??e.find((i)=>i.locale===null)??e[0]}function Vc(e){if(!e)return null;return gr(e,ln(x?.projectConfig??{}).i18n)}function oh(e,t){if(!W){At();return}return Qn(W.get(e),t)}function YO(e){if(!W){At();return}return W.get(e)??[]}async function _e(e,t){let o=await At();return Qn(o.get(e),t)}function Xb(){Nt+=1,W=null,ge=null}function Op(e){return Le.add(e),()=>{Le.delete(e)}}function Rt(e){if(n(e)&&e!=="")return e;return J(e)&&Number.isFinite(e)?String(e):null}function EC(e,t,o){if(!e)return null;let r=t.split("/").pop()??t,i=r.lastIndexOf("."),a=i>0?r.slice(0,i):r,l=e.field===null?null:Rt(o?.[e.field]),s=t.endsWith(".json")?Rt(o?.id):null,c=l??s??a;if(e.values&&!e.values.includes(c))return null;if(e.param)return e.pattern.replace(`:${e.param}`,c);return e.pattern.replace(/:[A-Za-z_]\w*/,c)}function TC(e,t){if(e===!1)return null;if(n(e)&&e!=="")return e;if(t?.layout===!1)return null;if(n(t?.layout)&&t.layout!=="")return t.layout;return x?.projectConfig?.defaults?.layout??null}function ZO(){Xb(),Le.clear()}function $C(e){return e.startsWith("pages/")||e.startsWith("./pages/")}function Li(e,t){let o=t.split("/"),r={};for(let[i,a]of e.split("/").entries()){let l=o[i];if(a.startsWith(":")&&l!==void 0)r[a.slice(1)]=l}return r}async function _i(e){let{documentPath:t,fields:o,isEntry:r,params:i}=e;if(!r)return{_pathParams:{...i},sourcePath:t,urlPattern:Bc(t)};let a=Kn(t),l=a?await _e(a.name,Vc(t)):null,s=EC(l,t,o);if(!l||s===null)return{_pathParams:{},sourcePath:t,urlPattern:l?.pattern??"/"};return{_pathParams:Li(l.pattern,s),sourcePath:l.path,urlPattern:s}}async function LC(e,t){if(!t)return null;let o=await _i(e),r=e.fields?.title,i=n(e.title)?e.title:n(r)?r:null,a={state:{}};if(i!==null)a.title=i;if(n(e.lang))a.$lang=e.lang;let l=Gb(a,t,o,null,ln(t).i18n),{$page:s,$site:c}=l.state??{};return s===void 0||c===void 0?null:{$page:s,$site:c}}var je=new Map;function RC(){je=new Map}function Fi(e){if(!e.startsWith("#/state/"))return null;let[t]=e.slice(8).split("/");return t?t.replaceAll("~1","/").replaceAll("~0","~"):null}function $t(e){if(n(e))return e.includes("${");if(Array.isArray(e))return e.some((t)=>$t(t));return m(e)&&Object.values(e).some((t)=>$t(t))}function eo(e,t){if(n(e.$src))return e.$src;return n(e.$prototype)&&Object.hasOwn(t,e.$prototype)?t[e.$prototype]??null:null}function It(e,t={}){return m(e)&&n(e.$prototype)&&eo(e,t)!==null&&!$t(e)}function to(e,t){return Object.entries(e.state??{}).filter(([,o])=>m(o)&&!n(o.$src)&&It(o,t)).map(([o])=>o)}function no(e){let t=new Set,o=(i)=>{if(Array.isArray(i)){for(let a of i)o(a);return}if(!Jn(i))return;if(i.$prototype==="Array"&&Oe(i.items)){let a=Fi(i.items.$ref);if(a)t.add(a)}o(i.map),o(i.children);for(let a of Object.values(i.cases??{}))o(a)};o(e.children);let r=e.state??{};return[...t].filter((i)=>It(r[i]))}function qi(e,t){return console.warn(`canvas: could not resolve state.${e} before the render:`,t),null}async function io(e,t,o,r={}){let i=p(),{resolveClass:a}=i,l=e.state;if(t.length===0||!a||!l)return e;let s={...l};return await Promise.all(t.map(async(c)=>{let d=s[c];if(!It(d,r))return;let f={...d,$src:eo(d,r)};if(o)f.$base=o;let v=JSON.stringify(f),y=je.get(v);if(!y)y=a.call(i,f).then((E)=>E??null,(E)=>(je.delete(v),qi(c,E))),je.set(v,y);let b=await y;if(b!==null)s[c]=b})),{...e,state:s}}function ao(e,t=[]){if(!S(e))return null;if(Array.isArray(e.children)){let o=e.children.findIndex((r)=>S(r)&&!r.$__layout);if(o!==-1)return{offset:o,prefix:[...t,"children"]};for(let r=0;r<e.children.length;r++){let i=e.children[r];if(S(i)&&i.$__layout){let a=ao(i,[...t,"children",r]);if(a)return a}}}return null}function Dt(e,t,o=[]){if(!S(e))return;if(e.$__layout={file:t,path:o},Array.isArray(e.children))for(let[r,i]of e.children.entries()){if(n(i))continue;Dt(i,t,[...o,"children",r])}if(Array.isArray(e.$elements)){for(let[r,i]of e.$elements.entries())if(!n(i))Dt(i,t,[...o,"$elements",r])}}async function so(e,t=new Set){let o=e.replace(/^\.\//,"");if(t.has(o))return null;t.add(o);let r=await Rx(e);if(!r)return null;Dt(r,o);let i=r.$layout;if(!n(i)||!i)return r;let a=await so(i,t);if(!a)return r;let l=qL(a,r);return delete l.$layout,l}function Bi(e,t){for(let o of e??[]){if(!S(o)||!n(o.$ref)||!/^\.\.?\//.test(o.$ref))continue;let r=o.$__layout;if(!m(r)||!n(r.file))continue;let i=new URL(o.$ref,`jx-project:/${r.file}`).pathname.replace(/^\//,"");o.$ref=qc(t,i)}}function lo(e,t){if(e.$layout!==void 0)return e.$layout;let o=t?.doc.content.frontmatter.$layout;return n(o)||o===!1?o:void 0}async function zi(e,t,o){let r=lo(e,t),i=o?Kn(o):null,a=i?await _e(i.name,Vc(o)):null;return TC(r,a)}async function co(e,t,o=null){let r={documentPath:t?.documentPath,mode:t?.doc.mode},i=o??Ta(t),a=i==="preview"?structuredClone(le(e)):Tt(nf(e)),l=!1,s=r.documentPath&&x?.isSiteProject&&$C(r.documentPath),c=!s&&Boolean(x?.isSiteProject)&&rh(r.documentPath),d=null,f=0;if((s||c)&&t?.session.ui.showLayout!==!1){let P=c?await zi(e,t,r.documentPath):fl(lo(e,t));if(P){let N=await so(P);if(N){let L=i==="preview"?structuredClone(le(e)):a,T=qL(N,L);if(a=i==="preview"?T:Tt(nf(T)),l=!0,r.documentPath)Bi(a.$elements,r.documentPath);let A=ao(T);d=A?.prefix??null,f=A?.offset??0}}}let v=x?.projectConfig;if(s&&v){if(a={...a,state:{...a.state}},a.imports)a.imports={...a.imports};Gb(a,v,{urlPattern:Bc(r.documentPath)})}let y=oc(x?.projectRoot),b=r.documentPath?new URL(r.documentPath,y).href:void 0,E=gy(r.documentPath,fh());if(s&&t){let{previewParams:P}=t.session.ui;if(Object.keys(P).length>0){let N=_C(e.state??null);a=xC(a,P,r.documentPath),await bn(a,N,b)}}if((s||c)&&r.documentPath){let P=await LC({documentPath:r.documentPath,fields:c?t?.doc.content.frontmatter??null:null,isEntry:c,lang:e.$lang,params:t?.session.ui.previewParams??{},title:e.title},x?.projectConfig);if(P)a={...a,state:{...a.state,...P}}}let k=await rd(),O=UL(k),H=to(a,O);if(i!=="preview")H.push(...no(e));if(a=await io(a,[...new Set(H)],b,O),!s&&t&&SC(a)){let{previewProps:P}=t.session.ui;if(P&&Object.keys(P).length>0)a=Zn(a,P)}let V=new Set;if(i!=="preview")(function P(N,L){if(!S(N))return;if(N.$prototype==="Array"){V.add(L.join("/"));let T=N.map;if(S(T))P(T,[...L,"map"]);return}if(Array.isArray(N.children))for(let[T,A]of N.children.entries()){if(n(A))continue;P(A,[...L,"children",T])}else if(Rr(N.children))P(N.children,[...L,"children"]);if(N.$switch&&N.cases)for(let[T,A]of Object.entries(N.cases))P(A,[...L,"cases",T])})(e,[]);let de=r.documentPath!=null&&(r.documentPath.startsWith("layouts/")||r.documentPath.startsWith("./layouts/")),oe=$x(a.$elements);if((r.mode==="content"||l||de)&&De.length>0){let P=new Set(oe.map((T)=>S(T)?T.$ref:T)),N=new Map(De.map((T)=>[T.tagName,T])),L=KC(a);if(a.tagName)L.add(it(a.tagName));for(let T of L)for(let A of N.get(T)?.uses??[])L.add(A);for(let T of L){let A=N.get(T);if(A&&A.source!=="npm"&&A.path){let rt=qc(r.documentPath??null,A.path);if(!P.has(rt))oe.push({$ref:rt}),P.add(rt)}}}if(oe.length>0)a.$elements=oe;return a.imports=SA(a.imports,k),a.$media=tr(a.$media),a.$head=Lx(a.$head),{assets:E,docBase:b,mapperCtx:{arrayPaths:[...V],canvasMode:i,layoutWrapped:l,pageContentOffset:f,pageContentPrefix:d},renderDoc:a,siteStyle:x?.projectConfig?.style??null}}function ji(e){if(e==="--")return"Base";return e.replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(t)=>t.toUpperCase())||e}var uo=new Set(["script","style","link","iframe","object","embed"]);function sh(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 kt(e){return S(e)&&n(e.$ref)?e.$ref:null}function Ve(e){if(e.source!=="npm"||!e.package)return null;return e.modulePath?`${e.package}/${e.modulePath}`:e.package}function Ki(e,t){let o=Ve(e);if(o)return o;return e.path?{$ref:qc(t,e.path)}:null}function rL(e,t,o){let r=Ve(t);if(r)return e.some((a)=>n(a)&&(a===r||a===t.package));if(!t.path)return!1;let i=ie(qc(o,t.path));return e.some((a)=>{let l=kt(a);return l!==null&&ie(l)===i})}function ie(e){return e.replace(/^(?:\.\/)+/,"")}function Qb(e,t,o){let r=Ki(t,o);if(!r)return[...e];let a=Ve(t)&&t.modulePath?e.filter((l)=>l!==t.package):[...e];return rL(a,t,o)?a:[...a,r]}function oL(e,t,o){let r=Ve(t);if(r)return e.filter((a)=>!(n(a)&&(a===r||a===t.package)));if(!t.path)return[...e];let i=ie(qc(o,t.path));return e.filter((a)=>{let l=kt(a);return l===null||ie(l)!==i})}function eA(e,t){return e.filter((o)=>!n(o)||!(o===t||o.startsWith(`${t}/`)))}function tA(e,t){let o=ie(t);return e.filter((r)=>{let i=kt(r);return i===null||ie(i)!==o})}var Ui="Components";function Ap(e,t){let o=Gi(e,t);if(o)Xe(e,[],"$elements",o)}function Gi(e,t){if(!n(t)||!t.includes("-"))return null;let o=De.find((a)=>a.tagName===t);if(!o)return null;let r=e.doc.document.$elements??[],i=Qb(r,o,e.documentPath??null);return i.length===r.length?null:i}function DC(e){let t=De.find((o)=>o.tagName===e);return t?Uc(t):null}function nA(){return De.map((e)=>({component:!0,description:(e.source==="npm"?e.package:e.path)??"",group:Ui,label:`<${e.tagName}>`,tag:e.tagName}))}function X(e){if(!e)return[];if(Array.isArray(e.children))return e.children;return n(e.textContent)&&e.textContent.length>0?[e.textContent]:[]}function he(e){let t=0;for(let o of e)t+=n(o)?o.length:he(X(o));return t}function Jt(e,t,o){let r=[],i=0;for(let a of e){if(i>=o)break;if(n(a)){let d=i+a.length;if(d>t){let f=a.slice(Math.max(0,t-i),Math.max(0,Math.min(o,d)-i));if(f)r.push(f)}i=d;continue}let l=X(a),s=he(l),c=i+s;if(s===0){if(i>=t&&i<o)r.push({...a})}else if(c>t){let d=Jt(l,Math.max(0,t-i),Math.min(o,c)-i);if(d.length>0)r.push(Zi(a,d))}i=c}return r}function Zi(e,t){let{children:o,textContent:r,...i}=e;if(t.length===0)return{...i,textContent:""};if(t.length===1&&n(t[0]))return{...i,textContent:t[0]};return{...i,children:t}}function po(e){let t=[];for(let o of e){if(n(o)){if(o.length===0)continue;let r=t.at(-1);if(n(r)){t[t.length-1]=r+o;continue}}t.push(o)}return t}function fo(e,t,o,r,i=""){return po([...Jt(e,0,t),...i?[i]:[],...Jt(o,r,he(o))])}function Ht(e){let t=po(e);if(t.length===0)return{textContent:""};if(t.length===1&&n(t[0]))return{textContent:t[0]};return{children:t}}function mo(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;let[o]=t;if(t.length===1&&n(o)&&o.trim()==="")return!0;return t.length===1&&S(o)&&o.tagName==="br"}function Lt(e){return{index:Vi(e),parentPath:zt(e)}}function go(e,t,o,r,i={}){if(!e)return;let a=re(e.doc.document,t);if(o){if(a&&JSON.stringify(a.children)===JSON.stringify(o))return;Z(e,(l)=>{if(a?.textContent!=null)Xe(l,t,"textContent");Xe(l,t,"children",o)},{coalesceKey:i.coalesceKey??null})}else if(r!=null){if(a&&a.textContent===r&&!a.children)return;Z(e,(l)=>{if(a?.children)Xe(l,t,"children");Xe(l,t,"textContent",r)},{coalesceKey:i.coalesceKey??null})}}function ho(e,t,o,r){if(!e)return!1;let i=re(e.doc.document,t);if(!i)return!1;if(`${i.$props?.[o]??""}`===r)return!1;return Z(e,(l)=>{Jp(l,t,o,r)}),!0}function yo(e,t,o){if(!e)return null;let r=re(e.doc.document,t),i=re(e.doc.document,o);if(!r||!i)return null;if(oa(t,o)||oa(o,t))return null;let a=X(i),l=X(r),s=he(a),c=Ht([...a,...l]);return Z(e,(d)=>{if(c.children){if(i.textContent!=null)Xe(d,o,"textContent");Xe(d,o,"children",c.children)}else{if(i.children)Xe(d,o,"children");Xe(d,o,"textContent",c.textContent??"")}if(xh(d,t),xo(d,zt(t)),Yp(e))d.session.selection=[o]}),{offset:s,path:o}}function xo(e,t){let o=t;while(o.length>0){let r=re(e.doc.document,o),i=r?.children;if(!r||!Array.isArray(i)||i.length>0)return;let a=zt(o);if(xh(e,o),!a)return;o=a}}function bo(e,t,o,r){let{parentPath:i,index:a}=Lt(t),l=[...i,"children",a+1];if(!e)return l;let s={tagName:"p"};if(r.textContent!=null)s.textContent=r.textContent;else if(r.children)s.children=r.children;else s.textContent="";return Z(e,(c)=>{if(o.textContent!=null)Xe(c,t,"children"),Xe(c,t,"textContent",o.textContent);else if(o.children)Xe(c,t,"textContent"),Xe(c,t,"children",o.children);if(ro(c,i,a+1,s),Yp(e))c.session.selection=[l]}),l}function Yi(e,t,o,r){let{parentPath:i,index:a}=Lt(t),l=mo(r),s=l?a:a+1,c=[...i,"children",s];if(!e)return c;return Z(e,(d)=>{if(l)xh(d,t);else if(r?.children)Xe(d,t,"textContent"),Xe(d,t,"children",r.children);else if(r?.textContent!=null)Xe(d,t,"children"),Xe(d,t,"textContent",r.textContent);if(ro(d,i,s,o),Ap(d,o.tagName),Yp(e))d.session.selection=[c]}),c}function Po(e,t,o,r){let i=o.component===!0?DC(o.tag):null;if(i)return Yi(e,t,i,r);if(mo(r)){if(!e)return t;return Z(e,(d)=>{Xe(d,t,"tagName",o.tag),Xe(d,t,"children");let f=sh(o.tag);if(f.textContent&&f.textContent!=="Paragraph text")Xe(d,t,"textContent",f.textContent);else Xe(d,t,"textContent");if(Yp(e))d.session.selection=[t]}),t}let{parentPath:a,index:l}=Lt(t),s=[...a,"children",l+1];if(!e)return s;let c=sh(o.tag);return Z(e,(d)=>{if(r?.children)Xe(d,t,"textContent"),Xe(d,t,"children",r.children);else if(r?.textContent!=null)Xe(d,t,"children"),Xe(d,t,"textContent",r.textContent);if(ro(d,a,l+1,structuredClone(c)),Yp(e))d.session.selection=[s]}),s}function So(e,t,o,r,i){if(!e)return null;let a=re(e.doc.document,t.path),l=re(e.doc.document,o.path);if(!a||!l)return null;if(oa(t.path,o.path)||oa(o.path,t.path))return null;let s=Ht(fo(X(a),t.offset,X(l),o.offset,i)),c=[...r,o.path].toSorted(Xi);return Z(e,(d)=>{if(s.children){if(a.textContent!=null)Xe(d,t.path,"textContent");Xe(d,t.path,"children",s.children)}else{if(a.children)Xe(d,t.path,"children");Xe(d,t.path,"textContent",s.textContent??"")}for(let f of c)if(re(d.doc.document,f))xh(d,f),xo(d,zt(f));if(Yp(e))d.session.selection=[t.path]}),{offset:t.offset+i.length,path:t.path}}function Xi(e,t){let o=Math.min(e.length,t.length);for(let r=0;r<o;r++){let i=e[r],a=t[r];if(i===a)continue;if(J(i)&&J(a))return a-i;return String(a).localeCompare(String(i))}return t.length-e.length}function I(e,t=1){return{height:e.height*t,left:e.x*t,top:e.y*t,width:e.width*t}}function iA(e,t,o=1){return{x:(e.x-t.left)/o,y:(e.y-t.top)/o}}function qe(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 Eo(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 o=e.createElement("div");o.className="overlay-box overlay-selection",o.style.display="none";let r=e.createElement("div");r.className="overlay-label",r.style.display="none",o.append(r);let i=e.createElement("div");i.className="overlay-box overlay-hover",i.style.display="none";let a=e.createElement("div");a.className="canvas-drop-indicator",a.style.display="none";let l=e.createElement("button");l.className="insertion-helper",l.textContent="+",l.style.pointerEvents="auto",l.style.display="none";let s=e.createElement("div");s.className="canvas-replace-target",s.style.display="none";let c=e.createElement("div");c.className="overlay-presence-group";let d=e.createElement("div");return d.className="overlay-coselection-group",t.append(i,o,d,a,s,l,c),{dispose:()=>t.remove(),insertButton:l,root:t,setDropIndicator:(f,v="inside")=>ea(a,f,v),setHover:(f)=>qe(i,f),setInsertZone:(f,v="center")=>Qi(l,f,v),setReplaceTarget:(f)=>qe(s,f),setSuppressed:(f)=>{t.style.display=f?"none":""},setCoSelection:(f)=>{d.replaceChildren();for(let v of f){let y=e.createElement("div");y.className="overlay-box overlay-selection overlay-coselection",qe(y,v),d.append(y)}},setPresence:(f)=>{c.replaceChildren();for(let v of f){let y=e.createElement("div");y.className="overlay-box overlay-presence",y.style.cssText=`position:absolute;display:block;pointer-events:none;outline:1.5px solid ${v.color};outline-offset:1px;left:${v.placement.left}px;top:${v.placement.top}px;width:${v.placement.width}px;height:${v.placement.height}px`;let b=e.createElement("div");b.className="overlay-presence-tag",b.textContent=v.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:${v.color}`,y.append(b),c.append(y)}},setSelection:(f,v=null)=>{if(qe(o,f),f&&v)r.textContent=v,r.style.display="block";else r.style.display="none"}}}function Qi(e,t,o){if(!t){e.style.display="none",e.classList.remove("visible");return}e.dataset.edge=o,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 ea(e,t,o){if(!t){e.style.display="none";return}if(e.style.display="block",e.style.left=`${t.left}px`,e.style.width=`${t.width}px`,o==="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=`${o==="top"?t.top:t.top+t.height}px`}function Wc(e){return JSON.stringify(e)}var j=null;function ta(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 pL(e,t,o,r=document){let i=ta(r);i.textContent=e,i.style.left=`${t}px`,i.style.top=`${o}px`,i.style.display="block"}function VC(e,t){if(!j||j.style.display==="none")return;j.style.left=`${e}px`,j.style.top=`${t}px`}function lh(){if(j)j.style.display="none"}var Mo=function(){if(typeof window>"u")return null;var e=new Image;return e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",e}();function pl(e){var t=e.nativeSetDragImage;if(t&&Mo)t(Mo,0,0)}function No(e,t){if(e==null)return{};var o={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;o[r]=e[r]}return o}function Ro(e,t){if(e==null)return{};var o,r,i=No(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)===-1&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}function We(e,t){var o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;return o.every(function(i){return Object.is(e[i],t[i])})}function Oo(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:We,t=null;return function(o){if(t&&e(t.value,o))return t.value;return t={value:o},t.value}}var na=["block"];function Ao(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),o.push.apply(o,r)}return o}function $o(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?Ao(Object(o),!0).forEach(function(r){ml(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Ao(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function ra(e){return{x:(e.right+e.left)/2,y:(e.bottom+e.top)/2}}function _t(e){var{client:t,borderBox:o}=e,r=o.height/4;if(t.y<=o.top+r)return"reorder-above";if(t.y>=o.bottom-r)return"reorder-below";return"make-child"}function ia(e){var{element:t,input:o,currentLevel:r,indentPerLevel:i,mode:a}=e,l={x:o.clientX,y:o.clientY},s=t.getBoundingClientRect();if(a==="standard"){var c=_t({borderBox:s,client:l});return{type:c,indentPerLevel:i,currentLevel:r}}var d=ra(s);if(a==="expanded"){var f=_t({borderBox:s,client:l});return{type:f==="reorder-above"?f:"make-child",indentPerLevel:i,currentLevel:r}}var v=i*r;if(l.x<s.left+v){if(l.y<d.y)return{type:"reorder-above",indentPerLevel:i,currentLevel:r};var y=(l.x-s.left)/i,b=Math.max(Math.floor(y),0);return{type:"reparent",desiredLevel:b,indentPerLevel:i,currentLevel:r}}return{type:_t({borderBox:s,client:l}),indentPerLevel:i,currentLevel:r}}function Io(e,t){if(e.type!==t.type)return!1;if(e.type==="instruction-blocked"&&t.type==="instruction-blocked")return Io(e.desired,t.desired);return We(e,t)}var aa=Oo(Io);function sa(e){var{desired:t,block:o}=e;if(o!==null&&o!==void 0&&o.includes(t.type)&&t.type!=="instruction-blocked"){var r={type:"instruction-blocked",desired:t};return r}return t}function xx(e,t){var o=t.block,r=Ro(t,na),i=ia(r),a=sa({desired:i,block:o}),l=aa(a);return $o($o({},e),{},ml({},Be,l))}function jp(e){var t;return(t=e[Be])!==null&&t!==void 0?t:null}var Be=Symbol("tree-item-instruction");var Do=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="320" height="180" viewBox="0 0 320 180"><rect width="320" height="180" fill="#808080" fill-opacity="0.16"/><g fill="#808080" fill-opacity="0.38"><circle cx="118" cy="64" r="14"/><path d="M60 140l52-50 34 30 38-46 76 66z"/></g></svg>')}`;function ca(e){let t=e.getAttribute("src")?.trim()??"",o=e.getAttribute("srcset")?.trim()??"";if(t!==""||o!=="")return!1;return!(e.parentElement?.localName==="picture"?e.parentElement:null)?.querySelector("source[srcset]:not([srcset=''])")}function jt(e){if(ca(e))e.setAttribute("data-jx-image-placeholder",""),e.setAttribute("src",Do);else if(e.hasAttribute("data-jx-image-placeholder")&&e.getAttribute("src")!==Do)e.removeAttribute("data-jx-image-placeholder")}function Ho(e){return e.localName==="img"}function Jo(e){if(e.nodeType!==e.ELEMENT_NODE||!("querySelectorAll"in e))return[];let t=e,o=[...t.querySelectorAll("img")];return Ho(t)?[t,...o]:o}function Lo(e){for(let r of Jo(e))jt(r);let o=new(e.ownerDocument.defaultView?.MutationObserver??MutationObserver)((r)=>{for(let i of r){if(i.type==="attributes"){let{target:a}=i;if(a.nodeType===a.ELEMENT_NODE&&"localName"in a){let l=a;if(Ho(l))jt(l)}continue}for(let a of i.addedNodes)for(let l of Jo(a))jt(l)}});return o.observe(e,{attributeFilter:["src","srcset"],attributes:!0,childList:!0,subtree:!0}),()=>o.disconnect()}async function _x(e,t=new Map){su(!0);try{if(!await ua(e))return _o(e.tagName);let o=document.createElement(e.tagName);for(let i of e.props||[])if(i.default!==void 0&&i.default!=="false"&&i.default!=="''"){let a=String(i.default).replaceAll(/^'|'$/g,"");o.setAttribute(i.name,a)}let r=o;for(let[i,a]of t)r[i]=a;return Lo(o),o}catch(o){return console.warn("Component preview failed:",e.tagName,o),_o(e.tagName)}}async function ua(e){if(e.source==="npm")return Boolean(customElements.get(e.tagName));if(e.path&&!e.path.endsWith(".json"))return!1;let t=x?.projectRoot;return await zy(`${location.origin}/${t?`${t}/`:""}${e.path}`),!0}function _o(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 da='[part="outline"]',Ft='[part="row"]',pa='[part="verbs"]',ze=null;function vA(){if(ze!==null)cancelAnimationFrame(ze);for(let e of st.dndCleanups)e();st.dndCleanups=[],ze=requestAnimationFrame(()=>{ze=null;let e=kh?.querySelector(da);if(!e)return;for(let o of e.querySelectorAll("[data-dnd-row]")){let r=o.dataset.value.split("/").map((c)=>/^\d+$/.test(c)?Math.trunc(Number(c)):c),i=Math.trunc(Number(o.dataset.dndDepth))||0,a=Object.hasOwn(o.dataset,"dndVoid"),l=Object.hasOwn(o.dataset,"dndExpanded"),s=zo(Uo({canDrag({element:c,input:d}){if(v_(d.clientX,d.clientY)?.closest(pa))return!1;return!0},element:o,getInitialData(){return{path:r,type:"tree-node"}},onGenerateDragPreview({nativeSetDragImage:c}){pl({nativeSetDragImage:c})},onDragStart(){if(o.dataset.dragging="",st.layerDragSourceHeight=o.offsetHeight,l)fa(o,e)},onDrop(){if(delete o.dataset.dragging,l)wn("leftPanel")}}),Zs({element:o,canDrop({source:c}){let d=c.data.path;if(Array.isArray(d)&&oa(d,r))return!1;return!0},getData({input:c,element:d}){return xx({path:r},{block:a?["make-child"]:[],currentLevel:i,element:d,indentPerLevel:16,input:c,mode:l?"expanded":"standard"})},onDragEnter({self:c}){jo(o,c.data,e)},onDrag({self:c}){jo(o,c.data,e)},onDrop(){ye(e)}}));st.dndCleanups.push(s)}let t=Xs({onDrop({source:o,location:r}){ye(e);let[i]=r.current.dropTargets;if(!i)return;let a=jp(i.data);if(!a||a.type==="instruction-blocked")return;let l=o.data,s=i.data.path;if(!Array.isArray(s))return;let c=l.type==="tree-node"&&o.element,d=c&&Object.hasOwn(c.dataset,"dndExpanded");if(ey(h.value,a,l,s),d){let f=h.value,v=Pe(f?.session.selection);if(v)st._layersCollapsed||=new Set,st._layersCollapsed.add(v.join("/"))}},onDropTargetChange({location:o}){let[r]=o.current.dropTargets;if(r&&!jp(r.data))ye(e)}});st.dndCleanups.push(t)})}function wA(){requestAnimationFrame(()=>{let e=kh?.querySelector(".components-section");if(!e)return;for(let t of e.querySelectorAll("[data-component-tag]")){let o=t.dataset.componentTag;if(!o)continue;let r=De.find((s)=>s.tagName===o);if(!r)continue;let i=t.querySelector(".element-card-preview");if(i&&!i.querySelector(o))_x(r).then((s)=>{i.textContent="",i.append(s)});let a=Uc(r),l=Uo({element:t,getInitialData(){return{fragment:structuredClone(a),type:"block"}},onGenerateDragPreview({nativeSetDragImage:s}){pl({nativeSetDragImage:s})}});st.dndCleanups.push(l)}})}function xA(){requestAnimationFrame(()=>{let e=kh?.querySelector('[part="content"]');if(!e)return;for(let t of e.querySelectorAll("[data-block-tag]")){let o=t.dataset.blockTag,r=t.querySelector(".element-card-preview");if(r&&!r.firstChild){let l=document.createElement(uo.has(o)?"span":o);l.textContent=o,r.append(l)}let i=sh(o),a=Uo({element:t,getInitialData(){return{fragment:structuredClone(i),type:"block"}},onGenerateDragPreview({nativeSetDragImage:l}){pl({nativeSetDragImage:l})}});st.dndCleanups.push(a)}})}function fa(e,t){let o=`${e.dataset.value}/`,r=t.querySelectorAll(Ft);for(let i of r)if(i.dataset.value?.startsWith(o))i.style.display="none"}function jo(e,t,o){let r=jp(t);if(st._currentDropTargetRow&&st._currentDropTargetRow!==e)delete st._currentDropTargetRow.dataset.drop;if(!r||r.type==="instruction-blocked"){ye(o);return}if(r.type==="make-child"){ye(o),e.dataset.drop="",st._currentDropTargetRow=e;return}delete e.dataset.drop,st._currentDropTargetRow=e;let i=[...o.querySelectorAll(Ft)],a=i.indexOf(e),l=st.layerDragSourceHeight;for(let[s,c]of i.entries()){if(c.dataset.dragging!==void 0)continue;if(r.type==="reorder-above")c.style.transform=s>=a?`translateY(${l}px)`:"";else c.style.transform=s>a?`translateY(${l}px)`:""}}function ye(e){if(st._currentDropTargetRow)delete st._currentDropTargetRow.dataset.drop,st._currentDropTargetRow=null;let t=e.querySelectorAll(Ft);for(let o of t)o.style.transform="",o.style.display=""}function Fo(e,t,o){if(t==="make-child")return{index:oo(re(e,o)).length,parent:o};let r=zt(o),i=Vi(o);if(!r||!J(i))return;if(t==="reorder-above")return{index:i,parent:r};if(t==="reorder-below")return{index:i+1,parent:r};return null}function ey(e,t,o,r){if(!e)return;if(o.type==="tree-node"){let i=o.path,a=Fo(e.doc.document,t.type,r);if(a)Z(e,(l)=>Gp(l,i,a.parent,a.index))}else if(o.type==="block"){let i=Fo(e.doc.document,t.type,r);if(i===void 0)return;let a=o.fragment;if(i)Z(e,(l)=>{ro(l,i.parent,i.index,structuredClone(a)),Ap(l,a.tagName),l.session.selection=[[...i.parent,"children",i.index]]})}}function qo(e){let t={};for(let[o,r]of Object.entries(e?.nesting??{}))if(o!=="_root")t[o]=r?.inline===!0;for(let o of e?.inline??[])t[o]=!1;return t}function F(e){return JSON.parse(JSON.stringify(e))}var et=new WeakMap,C=new Set,ne=0,be=new Map,ar=-1,sr=0,ma=600;function fL(e){return ar===e&&Date.now()-sr<=ma}var Bo=0,lr=new Set;function ga(e,t){let o;try{o=new URL(e,t.iframe.src||ph())}catch{return}if(!["http:","https:","mailto:","tel:"].includes(o.protocol))return;let r=o.href,i=Ln();if(i){i(r);return}window.open(r,"_blank","noopener,noreferrer")}function mL(e){lr.add(e)}function ha(e){return lr.delete(e)}var B=new Map,se=new Map,Ce=new Map,va=300;function gL(e,t,o,r=va){let i=null;for(let s of C){if(!s.iframe.isConnected){C.delete(s);continue}if(s.ready&&!s.stylebook&&e!==null&&s.tabId===e){i=s;break}}if(!i)return Promise.resolve(null);Bo+=1;let a=Bo,l=F(t);return i.channel.post({contextPath:o?[...o]:null,exprs:l,gen:i.lastRenderedGen,kind:"evalExpr",reqId:a}),new Promise((s)=>{let c=setTimeout(()=>{B.delete(a),se.delete(a),s(null)},r);se.set(a,i),B.set(a,(d)=>{clearTimeout(c),se.delete(a),s(d)})})}var Ko=0,ue=new Map,ya=250;function bL(e,t=ya){let o=[];for(let r of C){if(!r.iframe.isConnected){C.delete(r);continue}if(r.ready&&!r.stylebook&&e!==null&&r.tabId===e)o.push(r)}if(o.length===0)return Promise.resolve();return new Promise((r)=>{let i=o.length,a=setTimeout(()=>{for(let c of s)ue.delete(c),Ce.delete(c);r()},t),l=()=>{if(i-=1,i===0)clearTimeout(a),r()},s=[];for(let c of o){Ko+=1;let d=Ko;s.push(d),ue.set(d,l),Ce.set(d,c),c.channel.post({kind:"flushEdits",reqId:d})}})}function WC(e){return et.get(e)??null}function ty(e){for(let t of C){if(!t.iframe.isConnected)continue;let o=Me(t.iframe);if(e.x>=o.left&&e.x<=o.right&&e.y>=o.top&&e.y<=o.bottom)return t}return null}function ny(e,t,o){ne+=1,be.set(ne,o);let r=t.type==="tree-node"?{path:[...t.path],type:"tree-node"}:{type:t.type};return e.channel.post({dragSeq:ne,gen:e.lastRenderedGen,kind:"dragStart",src:r}),ne}function zC(){return ne}function nc(e){let t=Me(e.iframe),o=e.iframe.clientWidth>0?t.width/e.iframe.clientWidth:1;return{rect:t,scale:o}}function cr(e){if(e.stylebook)return"stylebook";return e.tabId??"unbound"}function yL(){let e=[];for(let t of C){if(!t.iframe.isConnected){C.delete(t);continue}let o=`canvas[${cr(t)}]`;if(!t.ready){e.push(`${o}: frame has not handshaked`);continue}let r=[...t.pendingTabIds.keys()];if(r.length>0)e.push(`${o}: gen ${r.join(", ")} unacked`);if(t.pendingPatches>0)e.push(`${o}: ${t.pendingPatches} unacked patch(es)`);if(t.pendingMeasures.size>0)e.push(`${o}: ${t.pendingMeasures.size} measure(s) in flight`);let{idle:i}=t;if(!i){e.push(`${o}: no quiescence report yet`);continue}if(i.gen!==t.lastRenderedGen)e.push(`${o}: quiescence is for gen ${i.gen}, DOM is gen ${t.lastRenderedGen}`);if(!i.fonts)e.push(`${o}: fonts still loading`);if(i.animations>0)e.push(`${o}: ${i.animations} running animation(s)`);if(i.images>0)e.push(`${o}: ${i.images} pending image retry(ies)`)}if(B.size>0)e.push(`canvas: ${B.size} expression eval(s) in flight`);return e}var xa=500,ba=2,Ca=40;function dr(){let e=h.value?.id??null,t=null;for(let o of C){if(!o.iframe.isConnected){C.delete(o);continue}if(!o.ready||o.stylebook)continue;if(o.tabId===e)return o;t??=o}return t}function pr(e,t){let{rect:o,scale:r}=nc(e),i=o.left+t.x*r,a=o.top+t.y*r,l=t.width*r,s=t.height*r;return{height:s,left:i,top:a,width:l,x:i+l/2,y:a+s/2}}function we(e,t){return new Promise((o)=>{e.measureSeq+=1;let r=e.measureSeq,i=setTimeout(()=>{e.pendingMeasures.delete(r),o(null)},xa);e.pendingMeasures.set(r,(a)=>{clearTimeout(i);let[l]=a;o(l?pr(e,l.rect):null)}),e.channel.post({kind:"measure",paths:[[...t]],reqId:r})})}function vL(e){let t=WC(e),o=t?.lastHover;if(!t||!o)return null;return{settle:async()=>(await we(t,o.path))?.top??null,top:pr(t,o.rect).top}}function wL(e){let t=dr();return t?we(t,e):Promise.resolve(null)}function Pa(e){return new Promise((t)=>{let o=Number.NaN,r=0,i=0,a=()=>{let{top:l}=Me(e.iframe);if(r=l===o?r+1:0,o=l,i+=1,r>=ba||i>=Ca){t();return}requestAnimationFrame(a)};requestAnimationFrame(a)})}async function iy(e){let t=dr();return t?pF(t,e):null}async function pF(e,t){let o=await we(e,t);if(!o)return null;let r=z(e.canvasEl)?.surface;return BC({height:o.height,top:o.top},r),await Pa(e),we(e,t)}function DF(e,t){let o=WC(e);return o?we(o,t):Promise.resolve(null)}function Sa(e){let t=e.canvasEl.parentElement;if(!t)return;let o=/scale\(([\d.]+)\)/.exec(e.canvasEl.style.transform),r=o?Number(o[1]):1;t.style.height=r===1?"":`${e.iframe.offsetHeight*r}px`}function fr(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",Sa(e)}function Ut(e,t){if(e.preview=t,e.overlay.setSuppressed(t),t)e.pendingEnterEdit=null;fr(e)}function xL(e,t){Ut(Zt(e),t)}function zc(e,t){if(!e.iframe.isConnected)return;e.channel.post(t)}function Sx(e){be.delete(e)}function Cx(e){e.overlay.setDropIndicator(null)}var mr=null;function _L(e){mr=e}var wa=300,hr=null;function SL(e){hr=e}var Gt=null;function CL(e){Gt=e}function Ea(e,t,o){if((t?Ma(t.tagName):!1)&&t){e.overlay.setDropIndicator(null),e.overlay.setReplaceTarget(I(t.rect));return}e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(o?I(o.referenceRect):null,o?.edge)}function Go(e){e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(null)}function Ma(e){return e==="img"||e==="video"||e==="source"}function Ra(e,t){if(e.dataset.jxGutterDrop==="1")return;e.dataset.jxGutterDrop="1",e.addEventListener("dragover",(o)=>{if(![...o.dataTransfer?.types??[]].includes("Files"))return;if(o.preventDefault(),o.dataTransfer)o.dataTransfer.dropEffect="copy"}),e.addEventListener("drop",(o)=>{let r=o.dataTransfer?.files,i=t();if(!r?.length||!i||i.stylebook)return;o.preventDefault(),Gt?.(M(i),[...r],null,null)})}var Ge=null;function kL(e){Ge=e}var Ze=null;function EL(e){Ze=e}var vr=null;function TL(e){vr=e}function Zo(e,t){let o=[...t];for(;;){let r=e.get(Wc(o));if(r)return r;if(o.length<2)return null;o=o.slice(0,-2)}}var R=null;function $L(){let e=R;return Boolean(e?.editing&&e.iframe.isConnected)}var Ye=null;function LL(e){Ye=e}var Kt=null;function RL(e){Kt=e}var Yo=null,yr=null;function IL(e){yr=e}function NL(e,t){for(let o of C){if(!o.iframe.isConnected){C.delete(o);continue}if(o.ready&&o.tabId===e.id&&!o.preview)o.popoverOpen=t,o.channel.post({kind:"setPopoverOpen",path:t})}}function DL(e,t){for(let o of C){if(!o.iframe.isConnected){C.delete(o);continue}if(o.ready&&o.tabId===e.id&&!o.preview)o.dialogOpen=t,o.channel.post({kind:"setDialogOpen",path:t})}}function UC(e,t){let o=0;for(let r of C){if(!r.iframe.isConnected){C.delete(r);continue}if(r.ready&&r.tabId===t){let i=z(r.canvasEl)?.surface;if(!i){mx("host-stage-unresolved");continue}let a=i.renderGeneration,l=tt?.host===r?tt.paths:void 0;nt(r),r.channel.post(l?{echoPaths:l,forwardOps:e,gen:a,kind:"patch"}:{forwardOps:e,gen:a,kind:"patch"}),r.pendingPatches+=1,o+=1}}return o}var tt=null,Oa=0;function Xo(e,t,o){tt={host:e,paths:t};try{o()}finally{tt=null}}var Vt=null,qt=null;function Aa(e,t,o){return!e&&t===o}function $a(e,t){let o=M(e);if(!o)return;let r=re(o.doc.document,t);if(!r)return;UC([{key:"$props",op:"set-key",path:t,value:r.$props}],o.id)}function M(e){return e.tabId?g.tabs.get(e.tabId)??null:null}function OL(e){return M(e)}function Ke(e){let t=z(e.canvasEl)?.surface.paneId;if(t)Co(t)}var Ia=Object.freeze([]);function Da(){let e=new Map;for(let t of g.panes){let o=t.activeTabId?g.tabs.get(t.activeTabId):null;if(!o)continue;let r=o.session.selection;r.map((i)=>i.join("/")).join("|"),e.set(o.id,r)}return e}function ka(){if(Yo)return;let e=me(!0);e.run(()=>{te(()=>{let t=Da();u.stylebook.selection;for(let o of C)ot(o,(o.tabId?t.get(o.tabId):null)??Ia)})}),Yo={stop:()=>e.stop()}}function nt(e){if(!e.ready)return;let t=mh(),o=zp();if(t===e.postedVersions&&o===e.postedRevisions)return;let r=e.postedVersions===null;if(e.postedVersions=t,e.postedRevisions=o,r&&Object.keys(t).length===0&&Object.keys(o).length===0)return;e.channel.post({kind:"assetVersions",revisions:o,versions:t})}var Qo=!1,Bt=!1;function Ja(){if(Qo)return;Qo=!0,me(!0).run(()=>{te(()=>{if(yy.value,Bt)return;Bt=!0,queueMicrotask(()=>{Bt=!1,Ha()})})})}function Ha(){for(let e of C){if(!e.iframe.isConnected){C.delete(e);continue}nt(e)}}var er=!1,Ue=null;function La(){if(er)return;er=!0,me(!0).run(()=>{te(()=>{for(let t of g.panes){let o=t.activeTabId?g.tabs.get(t.activeTabId):null;if(!o)continue;let{peers:r}=xn(o);r.map((i)=>JSON.stringify(i.state.structuralSelection??null)).join("|")}if(Ue)clearTimeout(Ue);Ue=setTimeout(()=>{Ue=null;for(let t of C)xr(t)},100)})})}function xr(e){if(e.stylebook||!e.ready||!e.iframe.isConnected)return;let t=M(e),o=t?xn(t).peers:[];e.presenceMeta.clear();let r=[];for(let i of o){let{structuralSelection:a}=i.state;if(!a||i.state.focusedPath!==t?.documentPath)continue;for(let l of a){let s=[...l];r.push(s),e.presenceMeta.set(JSON.stringify(s),{color:i.state.user.color,label:i.state.user.name??i.state.user.login})}}if(r.length===0){e.presenceReqId=-1,e.overlay.setPresence([]);return}e.measureSeq+=1,e.presenceReqId=e.measureSeq,e.channel.post({kind:"measure",paths:r,reqId:e.presenceReqId})}function ot(e,t){if(e.stylebook){_a(e);return}let o=Pe(t);if(e.selectionPath=o,e.selectionPaths=t,!e.iframe.isConnected){C.delete(e);return}if(!o){e.selReqId=-1,e.coSelectionKeys.clear(),e.overlay.setSelection(null),e.overlay.setCoSelection([]);return}if(!e.ready)return;let r=Na(t.slice(0,-1));e.coSelectionKeys=new Set(r.map((i)=>JSON.stringify(i))),e.measureSeq+=1,e.selReqId=e.measureSeq,e.channel.post({kind:"measure",paths:[[...o],...r],reqId:e.selReqId})}function _a(e){if(!e.iframe.isConnected){C.delete(e);return}let t=u.stylebook.selection,o=t?e.stylebook?.tagToCardPath.get(t):void 0;if(!t||!o){e.selReqId=-1,e.overlay.setSelection(null);return}if(!e.ready)return;e.measureSeq+=1,e.selReqId=e.measureSeq,e.channel.post({kind:"measure",paths:[[...o]],reqId:e.selReqId})}function nr(){return N_("../canvas.html")}function Cr(e){e.channel.dispose();for(let[t,o]of B)if(se.get(t)===e)B.delete(t),se.delete(t),o(null);for(let[t,o]of ue)if(Ce.get(t)===e)ue.delete(t),Ce.delete(t),o();for(let[,t]of e.pendingMeasures)t([]);if(e.pendingMeasures.clear(),e.pendingTabIds.clear(),Ee(e),R===e)R=null;e.overlay.root.remove(),e.iframe.remove(),et.delete(e.canvasEl),C.delete(e)}function Fa(){if(!ve())return nr();return p().canvasUrl||nr()}function ry(e){let t=0;for(let o of new Set(C))if(e.contains(o.canvasEl))Cr(o),t+=1;return t}function Zt(e){let t=Fa(),o=et.get(e);if(o){if(o.canvasUrl===t)return o;Cr(o)}let r=location.origin,i=crypto.randomUUID(),a=new URL(t,location.href).origin,l=document.createElement("iframe");l.className="jx-canvas-iframe",l.title="Canvas — live page render",l.style.cssText="width:100%;min-height:480px;height:100%;border:0;display:block;background:#fff";let s=new URL(t,location.href);if(s.searchParams.set("token",i),location.protocol==="http:"||location.protocol==="https:")s.searchParams.set("parentOrigin",r);if(l.src=a===r?`${s.pathname}${s.search}`:s.href,!e.style.position)e.style.position="relative";let c=Eo(document);e.replaceChildren(l,c.root),Ra(e,()=>WC(e));let d=Hn({acceptOrigin:a,source:window,target:{postMessage:(v,y)=>l.contentWindow?.postMessage(v,y)},targetOrigin:a,token:i}),f={canvasEl:e,canvasUrl:t,channel:d,contentFragment:!1,contentHeight:null,hiddenPaths:new Set,popoverOpen:null,dialogOpen:null,editing:!1,editingProp:null,iframe:l,insertHideTimer:null,insertHover:!1,coSelectionKeys:new Set,insertZone:null,lastRenderedGen:-1,lastHover:null,lastSelectionRect:null,lastSnapshotSeq:0,measureSeq:0,overlay:c,panReqId:-1,pending:null,postedVersions:null,postedRevisions: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:-1,snapshot:null,stylebook:null,tabId:null};return c.insertButton.addEventListener("click",(v)=>Wa(f,v)),c.insertButton.addEventListener("mouseenter",()=>{f.insertHover=!0,Ee(f)}),c.insertButton.addEventListener("mouseleave",()=>{f.insertHover=!1,Sr(f)}),d.onMessage((v)=>za(f,v)),et.set(e,f),C.add(f),ka(),La(),Ja(),f}function Va(e,t){Ee(e),e.insertZone=t,e.overlay.setInsertZone(I(t.rect),t.edge)}function Pr(e){Ee(e),e.insertZone=null,e.insertHover=!1,e.overlay.setInsertZone(null)}function qa(e){let t=e.overlay.insertButton;return e.insertHover||t.matches(":hover")}function Sr(e){Ee(e),e.insertHideTimer=setTimeout(()=>{if(e.insertHideTimer=null,qa(e))return;Pr(e)},wa)}function Ee(e){if(e.insertHideTimer!==null)clearTimeout(e.insertHideTimer),e.insertHideTimer=null}function Wa(e,t){t.stopPropagation(),t.preventDefault();let o=e.insertZone;if(!o)return;hr?.(e.overlay.insertButton,o)}var Ba=new Set(["contextMenu","dragOver","dropResult","editCommit","editCommitProp","editInput","editInsert","editMerge","editRangeReplace","editSplit","editStart","fileDragOver","fileDrop","hit","hover","insertZones","layoutHit","nativeDragEnter"]);function za(e,t){if(e.preview&&Ba.has(t.kind))return;switch(t.kind){case"ready":{e.ready=!0;let o=Yt?.();if(o)e.channel.post({chords:o.chords,kind:"keymap",mac:o.mac});if(e.postedVersions=null,e.postedRevisions=null,nt(e),e.pending)e.channel.post(e.pending),e.pending=null;ot(e,e.selectionPaths);return}case"paneFocus":{Ke(e),Kt?.();return}case"popoverTargetClick":{let o=M(e);if(!o||e.preview)return;let r=JSON.stringify(o.session.ui.openPopover)===JSON.stringify(t.targetPath),i=t.action==="show"||t.action==="toggle"&&!r;if(i||r)ae()?.run("canvas.setPopoverOpen",{open:i,path:t.targetPath});return}case"commandTargetClick":{let o=M(e);if(!o||e.preview)return;let r=(a)=>JSON.stringify(a)===JSON.stringify(t.targetPath),i=re(o.doc.document,t.targetPath);if(!Jn(i))return;if(pt.has(t.command)){if(!ja(i))return;let a=t.command==="show-popover"||t.command==="toggle-popover"&&!r(o.session.ui.openPopover);if(a||r(o.session.ui.openPopover))ae()?.run("canvas.setPopoverOpen",{open:a,path:t.targetPath})}else if(dt.has(t.command)){if(!_(i))return;let a=t.command==="show-modal";if(a||r(o.session.ui.openDialog))ae()?.run("canvas.setDialogOpen",{open:a,path:t.targetPath})}return}case"hit":{Ke(e),Kt?.(),tR(null);let o=null,r=z(e.canvasEl)?.panel;if(r?.mediaName&&!r.mediaName.startsWith("git-diff")){o=Te(r.mediaName);let a=M(e);if(a)a.session.ui.activeMedia=o}if(Ze?.dismiss(),e.stylebook){let a=Zo(e.stylebook.pathToTag,t.hit.path);if(vr?.(a,o),a){let l=I(t.hit.rect);e.overlay.setSelection(l,`<${a}>`),e.lastSelectionRect=l}else e.overlay.setSelection(null);return}e.selectionPath=t.hit.path,e.selectionPaths=[t.hit.path];let i=M(e);if(i)i.session.selection=t.additive?n_(i.session.selection,t.hit.path):[t.hit.path];{let a=I(t.hit.rect);e.overlay.setSelection(a),e.lastSelectionRect=a}return}case"layoutHit":{if(e.stylebook)return;Ke(e),Ze?.dismiss(),tR(t.hit),e.selectionPath=null,e.selectionPaths=[];let o=M(e);if(o)o.session.selection=[];let r=I(t.hit.rect);e.overlay.setSelection(r,`LAYOUT · ${t.hit.layoutFile}`),e.lastSelectionRect=r,wn("rightPanel");return}case"hover":{if(e.stylebook){let o=t.hit?Zo(e.stylebook.pathToTag,t.hit.path):null,r=u.stylebook.selection;if(t.hit&&o&&o!==r)e.overlay.setHover(I(t.hit.rect));else e.overlay.setHover(null);return}e.lastHover=t.hit,Za(e,t.hit);return}case"insertZones":{if(e.stylebook)return;let o=t.zones?.[0]??null;if(o)Va(e,o);else Sr(e);return}case"geometry":{let o=e.pendingMeasures.get(t.reqId);if(o){e.pendingMeasures.delete(t.reqId),o(t.hits);return}if(t.reqId===e.presenceReqId){e.presenceReqId=-1;let r=[];for(let i of t.hits){let a=e.presenceMeta.get(JSON.stringify(i.path));if(a)r.push({...a,placement:I(i.rect)})}e.overlay.setPresence(r);return}if(t.reqId===e.panReqId){e.panReqId=-1;let[r]=t.hits;if(r){let{rect:i,scale:a}=nc(e);Dn({height:r.rect.height*a,top:r.rect.y*a+i.top})}return}if(t.reqId===e.selReqId){let r=JSON.stringify(e.selectionPath),i=[],a=null;if(e.stylebook){let[s]=t.hits;a=s?I(s.rect):null}else for(let s of t.hits){let c=JSON.stringify(s.path);if(c===r)a=I(s.rect);else if(e.coSelectionKeys.has(c))i.push(I(s.rect))}let l=e.stylebook?u.stylebook.selection:null;e.overlay.setSelection(a,l?`<${l}>`:null),e.overlay.setCoSelection(i),e.lastSelectionRect=a,e.hiddenPaths=new Set((t.hidden??[]).map((s)=>JSON.stringify(s)))}return}case"evalResult":{let o=B.get(t.reqId);if(!o)return;B.delete(t.reqId),se.delete(t.reqId),o(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 o of e.pendingTabIds.keys())if(o<=t.gen)e.pendingTabIds.delete(o);or(e,t.gen);return}case"patchComplete":{e.pendingPatches=Math.max(0,e.pendingPatches-1),or(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 o=M(e);if(o)o.session.canvas.refreshing=!1,wn("leftPanel");w.error("The page could not be rendered.",{detail:t.message,key:`canvas.render:${cr(e)}`,source:"Canvas"});return}case"dataScope":{if(t.gen!==e.lastRenderedGen)return;let o=M(e);if(o)o.session.canvas.scope=t.scope,o.session.canvas.refreshing=!1;wn("leftPanel");return}case"contentHeight":{e.contentHeight=t.height,e.contentFragment=t.fragment,fr(e);return}case"dragOver":{if(t.dragSeq!==ne)return;if(t.cursor)ar=t.dragSeq,sr=Date.now();if(t.gen!==e.lastRenderedGen)return;if(t.preview)e.overlay.setDropIndicator(I(t.preview.referenceRect),t.preview.edge);else e.overlay.setDropIndicator(null);if(t.cursor){let o=nc(e);VC(t.cursor.x*o.scale+o.rect.left,t.cursor.y*o.scale+o.rect.top)}return}case"nativeDragEnter":{if(e.stylebook)return;mr?.(e);return}case"dragEnd":{e.overlay.setDropIndicator(null),lh(),be.delete(t.dragSeq);return}case"dropResult":{if(t.dragSeq!==ne||t.gen!==e.lastRenderedGen)return;if(t.instruction&&t.targetPath){let o=be.get(t.dragSeq);if(o)ey(M(e),{type:t.instruction},o,t.targetPath)}be.delete(t.dragSeq),e.overlay.setDropIndicator(null),lh();return}case"fileDragOver":{if(e.stylebook)return;Ea(e,t.hit,t.preview);return}case"fileDragLeave":{Go(e);return}case"fileDrop":{if(Go(e),e.stylebook)return;Gt?.(M(e),t.files,t.hit,t.preview);return}case"patchError":{e.pendingPatches=Math.max(0,e.pendingPatches-1);let o=z(e.canvasEl)?.surface;if(o)yr?.(o.paneId);return}case"forwardKey":{Ga(t.event);return}case"forwardWheel":{Ua(e,t);return}case"editStart":{if(R&&R!==e)R.editing=!1,R.editingProp=null,R.snapshot=null;if(R=e,t.prop!==void 0&&qt===Wc(t.path))xe(e,t.path,void 0,t.prop);qt=null,Oa+=1,e.editing=!0,e.editingProp=t.prop??null,e.snapshot=null,e.lastSnapshotSeq=0,Ye?.();return}case"selectionChanged":{if(t.seq<=e.lastSnapshotSeq)return;if(e.lastSnapshotSeq=t.seq,e.snapshot=t,!e.editing)e.editing=!0,R=e;Ye?.();return}case"flushComplete":{let o=ue.get(t.reqId);if(o)ue.delete(t.reqId),Ce.delete(t.reqId),o();return}case"editInput":{let o=M(e);if(o)o.doc.dirty=!0;return}case"editCommit":{let o=()=>go(M(e),t.path,t.children,t.textContent);if(t.inPlace)Xo(e,[t.path],o);else o();return}case"editCommitProp":{let o=()=>ho(M(e),t.path,t.prop,t.value);if(t.inPlace){Xo(e,[t.path],o),Vt=Wc(t.path);return}let r=o();if(Aa(r,Vt,Wc(t.path)))$a(e,t.path);Vt=null,qt=r?Wc(t.path):null;return}case"editMerge":{let o=yo(M(e),t.fromPath,t.intoPath);if(o)xe(e,o.path,o.offset);return}case"editRangeReplace":{let o=So(M(e),t.from,t.to,t.between,t.text);if(o)xe(e,o.path,o.offset);return}case"editSplit":{xe(e,bo(M(e),t.path,t.before,t.after));return}case"editInsert":{xe(e,Po(M(e),t.path,t.cmd,t.commitData));return}case"slashShow":{let{rect:o,scale:r}=nc(e),i=t.rect.x*r+o.left,a=t.rect.y*r+o.top,l={filter:t.filter,onDismiss:()=>e.channel.post({kind:"slashDismissed"}),onSelect:(s)=>e.channel.post({cmd:{...s},kind:"slashSelect"}),rect:{bottom:a+t.rect.height*r,height:t.rect.height*r,left:i,top:a,width:t.rect.width*r}};if(t.showFilter===!0)l.showFilter=!0;Ge?.show(l);return}case"slashNav":{Ge?.nav(t.key);return}case"slashDismiss":{Ge?.dismiss();return}case"previewNavigate":{ga(t.href,e);return}case"contextMenu":{if(e.stylebook)return;Ke(e);let{rect:o,scale:r}=nc(e);Ze?.show({clientX:t.x*r+o.left,clientY:t.y*r+o.top,path:t.path?[...t.path]:null});return}case"editEnd":{if(!e.editing)return;if(e.editing=!1,e.editingProp=null,e.snapshot=null,R===e)R=null;Ye?.();break}default:break}}function or(e,t){if(e.lastRenderedGen=t,ot(e,e.selectionPaths),xr(e),Pr(e),es(e),e.pendingEnterEdit&&t>=e.pendingEnterEdit.minGen){let{offset:o,path:r,prop:i}=e.pendingEnterEdit;if(e.pendingEnterEdit=null,e.tabId!==null&&e.tabId===pe(e.canvasEl)?.id)Ka(e,r,o,i)}}function xe(e,t,o,r){let i={minGen:e.lastRenderedGen,path:[...t]};if(o!==void 0)i.offset=o;if(r!==void 0)i.prop=r;e.pendingEnterEdit=i}function Ka(e,t,o,r){let i={kind:"enterEdit",path:[...t]};if(o!==void 0)i.offset=o;if(r!==void 0)i.prop=r;e.channel.post(i)}function Ua(e,t){let{rect:o,scale:r}=nc(e),i=nd(e.canvasEl)?.wrap;if(!i)return;i.dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:o.left+t.x*r,clientY:o.top+t.y*r,ctrlKey:t.ctrlKey,deltaX:t.deltaX,deltaY:t.deltaY,metaKey:t.metaKey,shiftKey:t.shiftKey}))}function Ga(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 Za(e,t){if(!t||ko(t.path,e.selectionPath)){e.overlay.setHover(null);return}e.overlay.setHover(I(t.rect))}var Ya=4,ee=new Map;function Xa(e){let t=ee.get(e);if(t)return ee.delete(e),ee.set(e,t),t;let o=new Map;ee.set(e,o);for(let r of ee.keys()){if(ee.size<=Ya)break;ee.delete(r)}return o}function Qa(e,t,o,r,i,a=null){let l=Xa(e),s=r?.id??null,c=l.get(t);if(c&&c.tabId===o&&c.viewTabId===s&&c.mode===a)return c.payload;let d=ha(i),f=NC(tn,async()=>{qr.renderPreparations+=1;let v=await co(t,r,a),y=F(v.renderDoc),b=F(t),E=o?g.tabs.get(o)??null:null,k=Wi(E?.doc.sourceFormat)?.studio?.elements,O=k?qo(k):void 0,H={assets:v.assets,doc:y,docBase:v.docBase??`${ph()}/`,mapperCtx:v.mapperCtx,mode:v.mapperCtx.canvasMode,shadowDoc:b,siteStyle:v.siteStyle};if(O)H.editableTags=O;if(d)H.allowAutoRequests=!0;return H});return l.set(t,{mode:a,payload:f,tabId:o,viewTabId:s}),f}async function AL(e,t,o,r,i=null,a=pe(o),l=null,s=null){let c=Zt(o);c.pendingTabIds.set(e,i),c.stylebook=null,c.iframe.style.width=r?`${r}px`:"100%";let f={...await Qa(e,t,i,a,at(o),l),colorScheme:Er(a),gen:e,kind:"render",locale:Nr(a),popoverOpen:a?.session.ui.openPopover??null,dialogOpen:a?.session.ui.openDialog??null};if(s)f.diffMarks=s;c.popoverOpen=f.popoverOpen??null,c.dialogOpen=f.dialogOpen??null,Ut(c,f.mode==="preview"),wr(c,f)}function wr(e,t){if(qr.hostRenderPosts+=1,e.ready){nt(e),e.channel.post(t);return}let o=e.pending;if(o?.kind==="render"&&o.gen>t.gen){e.pendingTabIds.delete(t.gen);return}e.pending=t}function PL(e,t,o,r){let i=Zt(o);i.pendingTabIds.set(e,null),i.stylebook={pathToTag:t.pathToTag,tagToCardPath:t.tagToCardPath},Ut(i,!1),i.pendingEnterEdit=null,i.iframe.style.width=r?`${r}px`:"100%";let a=F(t.doc),l=F(t.doc),s={assets:null,colorScheme:Er(pe(o)),locale:Nr(pe(o)),doc:a,docBase:`${ph()}/`,gen:e,kind:"render",mapperCtx:{arrayPaths:[],canvasMode:"stylebook",layoutWrapped:!1,pageContentOffset:null,pageContentPrefix:null},mode:"stylebook",shadowDoc:l,siteStyle:null};wr(i,s)}function Er(e){let t=e?.session.ui.previewColorScheme;return t==="light"||t==="dark"?t:null}function ML(e,t){for(let o of C){if(!o.iframe.isConnected){C.delete(o);continue}if(t&&!t.contains(o.iframe))continue;if(o.ready)o.channel.post({kind:"setColorScheme",scheme:e})}}function Mr(e){return e===null?null:{dir:vy(e),locale:e}}function Nr(e){return Mr(e?Hp(e.session.ui.previewLocale,e.documentPath):null)}function FL(e,t){let o=vy(e);for(let r of C){if(!r.iframe.isConnected){C.delete(r);continue}if(t&&!t.contains(r.iframe))continue;if(r.ready)r.channel.post({dir:o,kind:"setLocale",locale:e});else if(r.pending?.kind==="render")r.pending={...r.pending,locale:Mr(e)}}}function jL(e,t){let o=F(e),r=0;for(let i of C){if(!i.iframe.isConnected){C.delete(i);continue}if(i.ready)i.channel.post({base:t,doc:o,kind:"redefineElement"}),r+=1}return r}function HL(){let e=x?.projectConfig;if(!e)return;let t=F(e.style??null),o=F(e.$media??{});for(let r of C){if(!r.iframe.isConnected){C.delete(r);continue}if(r.ready&&!r.stylebook)r.channel.post({kind:"siteStyleUpdate",media:o,siteStyle:t})}}function kx(e){let t=0,o=F(e);for(let r of C){if(!r.iframe.isConnected){C.delete(r);continue}if(r.ready&&r.stylebook)r.channel.post({gen:r.lastRenderedGen,kind:"styleUpdate",style:o}),t+=1,ot(r,r.selectionPaths)}return t}var Qe=null;function Or(e,t){if(!e?.stylebook||!e.ready)return!1;let o=e.stylebook.tagToCardPath.get(t);if(!o)return!1;return e.measureSeq+=1,e.panReqId=e.measureSeq,e.channel.post({kind:"measure",paths:[[...o]],reqId:e.panReqId}),!0}function BL(e){Qe=Or(Xt(),e)?null:e}function es(e){let t=Qe;if(t===null||!e.stylebook)return;if(u.stylebook.selection!==t){Qe=null;return}if(e===Xt()&&Or(e,t))Qe=null}function ic(){let e=R;if(!e||!e.iframe.isConnected)return{editing:!1,editingProp:null,snapshot:null};return{editing:e.editing,editingProp:e.editingProp,snapshot:e.snapshot}}var Yt=null;function VL(e,t){Yt=e,t?.(()=>ir()),ir()}function ir(){let e=Yt?.();if(!e)return;for(let t of C){if(!t.iframe.isConnected){C.delete(t);continue}if(t.ready)t.channel.post({chords:e.chords,kind:"keymap",mac:e.mac})}}function ch(e){let t=R;if(!t||!t.ready)return;t.channel.post({intent:e,kind:"applyFormat"})}function WL(){let e=R;if(!e||!e.ready)return;e.channel.post({kind:"openSlash"})}function Ex(){let e=R;if(e?.editing&&e.ready&&e.iframe.isConnected)e.channel.post({kind:"endEdit"})}function Xt(){let e=un();return e?WC(e.canvas):null}function qC(){let e=R,t=e??Xt();if(!t)return null;let{rect:o,scale:r}=nc(t);if(t.lastSelectionRect)return{height:t.lastSelectionRect.height*r,left:t.lastSelectionRect.left*r+o.left,top:t.lastSelectionRect.top*r+o.top,width:t.lastSelectionRect.width*r};let i=t===e?t.snapshot?.rect:null;if(i)return{height:i.height*r,left:i.x*r+o.left,top:i.y*r+o.top,width:i.width*r};return null}
2
+ export{vo,bt,Vo,yC,Ta,Ur,ul,zO,Kb,Gb,wo,Bc,hl,nh,vC,UO,Jb,qO,wC,xC,_C,SC,KO,CC,ih,Yb,Zb,hi,Fm,tL,fx,GO,ec,tc,rh,JO,kC,nL,Vc,oh,YO,Xb,Op,EC,TC,ZO,$C,LC,RC,iL,XO,QO,qr,mx,IC,NC,ji,sh,rL,Qb,oL,eA,tA,Ap,DC,nA,iA,Wc,OC,jm,rA,gx,oA,bx,sA,yx,Pp,Wo,aA,Hm,lA,cA,AC,dA,PC,uA,MC,sL,aL,FC,Bm,Mp,hA,pA,vx,Ys,ah,Fp,fA,mA,jC,lL,Vm,HC,gA,BC,cL,bA,dL,uL,hL,yA,wx,pL,VC,lh,pl,xx,jp,_x,vA,wA,xA,ey,fL,mL,gL,bL,WC,ty,ny,zC,nc,yL,vL,wL,iy,pF,DF,xL,zc,Sx,Cx,_L,SL,CL,kL,EL,TL,$L,LL,RL,IL,NL,DL,UC,OL,ry,AL,PL,ML,FL,jL,HL,kx,BL,ic,VL,ch,WL,Ex,qC};
3
+
4
+ //# debugId=8CDD77C4755AC90464756E2164756E21
5
+ //# sourceMappingURL=studio-aaw7wxv8.js.map