@jxsuite/studio 10.2.0 → 10.3.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 (271) hide show
  1. package/dist/chunks/{2020-bx702wqa.js → 2020-906vx2dq.js} +3 -3
  2. package/dist/chunks/adapter-hnvad61x.js +4 -0
  3. package/dist/chunks/add-new-flow-3tkn72ey.js +4 -0
  4. package/dist/chunks/cf-account-picker-xb8vvt2h.js +4 -0
  5. package/dist/chunks/cf-settings-mkbcz4z2.js +4 -0
  6. package/dist/chunks/components-w5zqwva1.js +4 -0
  7. package/dist/chunks/content-source-1vzxq1ba.js +4 -0
  8. package/dist/chunks/convert-to-repeater-gwzh9gar.js +4 -0
  9. package/dist/chunks/editor-wvf5e6j9.js +4 -0
  10. package/dist/chunks/entry-commands-mx2whrjx.js +4 -0
  11. package/dist/chunks/extension-sections-338ee35t.js +4 -0
  12. package/dist/chunks/file-ops-9bxvk59j.js +4 -0
  13. package/dist/chunks/files-t07yqqej.js +4 -0
  14. package/dist/chunks/format-host-5ja5gxyk.js +4 -0
  15. package/dist/chunks/fs-events-3424ezp3.js +4 -0
  16. package/dist/chunks/grid-open-1mpq9mzb.js +4 -0
  17. package/dist/chunks/{grid-view-tghcwrrt.js → grid-view-w9nfy203.js} +16 -16
  18. package/dist/chunks/icons-gb967qc8.js +4 -0
  19. package/dist/chunks/iframe-host-wsg0bn73.js +4 -0
  20. package/dist/chunks/image-bake-4afr4y6a.js +4 -0
  21. package/dist/chunks/image-editor-x7t8jbjn.js +4 -0
  22. package/dist/chunks/index-f9qr7kzh.js +4 -0
  23. package/dist/chunks/{index-vr006kbt.js → index-yjrfeks8.js} +3 -3
  24. package/dist/chunks/{javascript-z1g3s9fd.js → javascript-hy2mws8v.js} +3 -3
  25. package/dist/chunks/{jsonMode-7szwg8c4.js → jsonMode-vj30te2h.js} +6 -6
  26. package/dist/chunks/jx-validate-ttr5ewf0.js +4 -0
  27. package/dist/chunks/layers-m49nmwvx.js +4 -0
  28. package/dist/chunks/layers-panel-hvy2e549.js +4 -0
  29. package/dist/chunks/lit-html-k2mb9k0r.js +4 -0
  30. package/dist/chunks/media-library-ae67q4at.js +4 -0
  31. package/dist/chunks/media-open-yp9jm834.js +4 -0
  32. package/dist/chunks/media-picker-s41ngdfr.js +4 -0
  33. package/dist/chunks/{monaco-binding-v42w9c1v.js → monaco-binding-a51py33c.js} +3 -3
  34. package/dist/chunks/monaco-buffer-pa0g6ax7.js +4 -0
  35. package/dist/chunks/{monaco-setup-7bffxd6v.js → monaco-setup-g9kterhx.js} +3 -3
  36. package/dist/chunks/notify-bwehrp7q.js +4 -0
  37. package/dist/chunks/parse-hee7ne9b.js +4 -0
  38. package/dist/chunks/platform-kv0k65cy.js +4 -0
  39. package/dist/chunks/publish-panel-gzfxcm0t.js +4 -0
  40. package/dist/chunks/publish-quick-w3nxd7q4.js +4 -0
  41. package/dist/chunks/publish-workspace-dppd82tc.js +4 -0
  42. package/dist/chunks/quick-search-tdxaam55.js +4 -0
  43. package/dist/chunks/references-vqyr5s9x.js +4 -0
  44. package/dist/chunks/right-panel-0yrw4cgz.js +4 -0
  45. package/dist/chunks/source-control-6fk72me2.js +4 -0
  46. package/dist/chunks/{studio-j3d2fjqz.js → studio-0939t1q1.js} +4 -4
  47. package/dist/chunks/studio-0gvvqj3h.js +5 -0
  48. package/dist/chunks/studio-0khd8xtx.js +4 -0
  49. package/dist/chunks/studio-0w3541dg.js +7 -0
  50. package/dist/chunks/{studio-9b7177jq.js → studio-0x6f3nk9.js} +4 -4
  51. package/dist/chunks/studio-1410q5dw.js +5 -0
  52. package/dist/chunks/{studio-awxwjawq.js → studio-15hwqgd8.js} +4 -4
  53. package/dist/chunks/studio-1ks5d9y4.js +5 -0
  54. package/dist/chunks/{studio-881z1xrx.js → studio-2ggfzrrd.js} +4 -4
  55. package/dist/chunks/{studio-4jhw38b2.js → studio-321ym1tt.js} +4 -4
  56. package/dist/chunks/studio-3c10v2q1.js +5 -0
  57. package/dist/chunks/{studio-bvs9kpst.js → studio-3na1r48j.js} +8 -8
  58. package/dist/chunks/{studio-86r8hp7r.js → studio-3q7mhbgx.js} +5 -5
  59. package/dist/chunks/studio-3qr08sxq.js +4 -0
  60. package/dist/chunks/studio-3xk9zdgb.js +5 -0
  61. package/dist/chunks/{studio-qh8berdz.js → studio-423tfdte.js} +4 -4
  62. package/dist/chunks/{studio-75kcdbsk.js → studio-45mj4jqe.js} +4 -4
  63. package/dist/chunks/studio-4f7thq0p.js +5 -0
  64. package/dist/chunks/studio-4fnb5648.js +5 -0
  65. package/dist/chunks/studio-4zd6an2b.js +5 -0
  66. package/dist/chunks/studio-53wy9ek3.js +5 -0
  67. package/dist/chunks/studio-5n193zqd.js +5 -0
  68. package/dist/chunks/{studio-9rbe2xpw.js → studio-5tet77de.js} +3 -3
  69. package/dist/chunks/{studio-ybnwymxw.js → studio-7rrdbvex.js} +4 -4
  70. package/dist/chunks/studio-8kx6m0rg.js +5 -0
  71. package/dist/chunks/{studio-sxdb9h3q.js → studio-90zkgne5.js} +7 -7
  72. package/dist/chunks/studio-9c6cbq2c.js +4 -0
  73. package/dist/chunks/studio-9dq7rwc7.js +5 -0
  74. package/dist/chunks/{studio-cg1bfyhf.js → studio-9qx1ywbv.js} +8 -8
  75. package/dist/chunks/studio-a65kbs2e.js +9 -0
  76. package/dist/chunks/studio-aam8zt8z.js +5 -0
  77. package/dist/chunks/{studio-er5f383a.js → studio-abh9kfdh.js} +4 -4
  78. package/dist/chunks/studio-b4e0ftkt.js +5 -0
  79. package/dist/chunks/studio-b68k0z00.js +5 -0
  80. package/dist/chunks/{studio-399a25za.js → studio-bct64zmj.js} +4 -4
  81. package/dist/chunks/studio-bz0b5brj.js +6 -0
  82. package/dist/chunks/studio-cfnn70h1.js +5 -0
  83. package/dist/chunks/studio-daksw8kh.js +5 -0
  84. package/dist/chunks/{studio-r7pf0rkv.js → studio-e7vjyp04.js} +7 -7
  85. package/dist/chunks/studio-ea6r1zyr.js +5 -0
  86. package/dist/chunks/studio-egnjpyde.js +9 -0
  87. package/dist/chunks/studio-ejrypvmq.js +5 -0
  88. package/dist/chunks/studio-eqcddvc2.js +928 -0
  89. package/dist/chunks/studio-f8tyeyzt.js +5 -0
  90. package/dist/chunks/studio-fj6c905s.js +5 -0
  91. package/dist/chunks/{studio-646nn2ys.js → studio-fkrr7kgg.js} +5 -5
  92. package/dist/chunks/studio-fspe7m9t.js +5 -0
  93. package/dist/chunks/studio-g0hxtcga.js +5 -0
  94. package/dist/chunks/{studio-th7z3fg7.js → studio-g9brbewz.js} +4 -4
  95. package/dist/chunks/studio-ggx3j7nd.js +5 -0
  96. package/dist/chunks/{studio-43y04qck.js → studio-hfxttkyr.js} +4 -4
  97. package/dist/chunks/studio-hh394phe.js +5 -0
  98. package/dist/chunks/{studio-pjtntksy.js → studio-j0zf5x2x.js} +4 -4
  99. package/dist/chunks/studio-jeb7hth3.js +5 -0
  100. package/dist/chunks/studio-k0xzrse2.js +64 -0
  101. package/dist/chunks/studio-k1xqrgm5.js +5 -0
  102. package/dist/chunks/studio-k2evngrj.js +7 -0
  103. package/dist/chunks/studio-k3we3kqb.js +5 -0
  104. package/dist/chunks/{studio-sevbc3xv.js → studio-n9qba0gx.js} +4 -4
  105. package/dist/chunks/{studio-6hzdjfv0.js → studio-nf8esxxc.js} +4 -4
  106. package/dist/chunks/studio-nn4f9m9c.js +5 -0
  107. package/dist/chunks/studio-nskxe9q1.js +6 -0
  108. package/dist/chunks/{studio-ea74s8c1.js → studio-nvcn2ykc.js} +4 -4
  109. package/dist/chunks/studio-nwynxqtb.js +5 -0
  110. package/dist/chunks/studio-nzemfbkk.js +14 -0
  111. package/dist/chunks/studio-p2a03pgm.js +5 -0
  112. package/dist/chunks/{studio-4g8yb6jn.js → studio-pm17wdc4.js} +4 -4
  113. package/dist/chunks/{studio-71m92v9s.js → studio-q80fg1d6.js} +7 -7
  114. package/dist/chunks/studio-r050sez0.js +6 -0
  115. package/dist/chunks/studio-s7t4vp1d.js +6 -0
  116. package/dist/chunks/studio-s9fng7m8.js +7 -0
  117. package/dist/chunks/studio-sce30r7b.js +4 -0
  118. package/dist/chunks/studio-stahswgb.js +7 -0
  119. package/dist/chunks/studio-swedpd82.js +5 -0
  120. package/dist/chunks/studio-thz5t120.js +5 -0
  121. package/dist/chunks/studio-tpxcryf2.js +5 -0
  122. package/dist/chunks/{studio-wc6za3zs.js → studio-v5wktj6f.js} +4 -4
  123. package/dist/chunks/{studio-kg1abnz0.js → studio-vpevkfxw.js} +4 -4
  124. package/dist/chunks/studio-waekn290.js +5 -0
  125. package/dist/chunks/studio-wfct4h6n.js +5 -0
  126. package/dist/chunks/studio-wgc54sxf.js +5 -0
  127. package/dist/chunks/studio-wqfaqw4m.js +5 -0
  128. package/dist/chunks/studio-wse1rs8t.js +7 -0
  129. package/dist/chunks/studio-x0gsfr1d.js +16 -0
  130. package/dist/chunks/{studio-hhp4x8xf.js → studio-xpx91fby.js} +5 -5
  131. package/dist/chunks/studio-y1b86ast.js +5 -0
  132. package/dist/chunks/studio-yrcrncev.js +5 -0
  133. package/dist/chunks/{studio-rzqaz21g.js → studio-yzpskb0j.js} +4 -4
  134. package/dist/chunks/studio-zfdbmhp3.js +5 -0
  135. package/dist/chunks/{tsMode-f54j66ym.js → tsMode-jg1dtphj.js} +7 -7
  136. package/dist/chunks/workspace-9btkc8tk.js +4 -0
  137. package/dist/chunks/workspace-home-qcc4z5ag.js +4 -0
  138. package/dist/chunks/{ws-client-e8kj684q.js → ws-client-arz2qsy9.js} +3 -3
  139. package/dist/iframe-entry.js +13 -13
  140. package/dist/manifest.json +83 -78
  141. package/dist/studio.js +84 -84
  142. package/package.json +2 -2
  143. package/src/browse/library-pane.ts +44 -29
  144. package/src/browse/library-preview.ts +6 -2
  145. package/src/canvas/asset-refs.ts +13 -4
  146. package/src/canvas/asset-resolve.ts +54 -11
  147. package/src/canvas/canvas-render.ts +25 -0
  148. package/src/canvas/iframe-entry.ts +5 -1
  149. package/src/canvas/iframe-host.ts +16 -6
  150. package/src/canvas/iframe-protocol.ts +9 -1
  151. package/src/commands/context.ts +5 -0
  152. package/src/commands/live-context.ts +5 -2
  153. package/src/editor/shortcuts.ts +3 -0
  154. package/src/files/asset-versions.ts +108 -2
  155. package/src/files/file-ops.ts +11 -1
  156. package/src/files/files.ts +111 -48
  157. package/src/files/media-paths.ts +12 -4
  158. package/src/files/media-upload.ts +195 -21
  159. package/src/files/new-file-name.ts +39 -1
  160. package/src/media/image-bake.ts +164 -0
  161. package/src/media/image-editor.ts +846 -0
  162. package/src/media/image-format.ts +262 -0
  163. package/src/media/image-recipe.ts +651 -0
  164. package/src/media/media-commands.ts +65 -1
  165. package/src/media/media-library-model.ts +1 -1
  166. package/src/media/media-library.ts +175 -15
  167. package/src/media/media-open.ts +156 -3
  168. package/src/media/media-pane.ts +8 -4
  169. package/src/panels/pane-context.ts +6 -1
  170. package/src/panels/tab-strip.ts +12 -3
  171. package/src/studio.ts +13 -2
  172. package/src/surfaces/image-editor.json +1390 -0
  173. package/src/surfaces/image-editor.ts +272 -0
  174. package/src/surfaces/media-library.json +129 -1
  175. package/src/surfaces/media-library.ts +17 -2
  176. package/src/types.ts +2 -1
  177. package/src/workspace/tab-workspace.ts +2 -1
  178. package/src/workspace/workspace-switch.ts +3 -1
  179. package/src/workspace/workspace.ts +22 -1
  180. package/dist/chunks/adapter-pp011m5x.js +0 -4
  181. package/dist/chunks/add-new-flow-ecqmzz76.js +0 -4
  182. package/dist/chunks/cf-account-picker-c07znkqt.js +0 -4
  183. package/dist/chunks/cf-settings-0v2bmqy0.js +0 -4
  184. package/dist/chunks/components-yn0dn2pq.js +0 -4
  185. package/dist/chunks/content-source-g0j41yy6.js +0 -4
  186. package/dist/chunks/convert-to-repeater-sbjk7tgn.js +0 -4
  187. package/dist/chunks/editor-xz02jeh1.js +0 -4
  188. package/dist/chunks/entry-commands-kmt02crp.js +0 -4
  189. package/dist/chunks/extension-sections-0rprf12d.js +0 -4
  190. package/dist/chunks/file-ops-mexj5qed.js +0 -4
  191. package/dist/chunks/files-b2tcppdd.js +0 -4
  192. package/dist/chunks/format-host-btsevv0c.js +0 -4
  193. package/dist/chunks/fs-events-r0apejva.js +0 -4
  194. package/dist/chunks/grid-open-n2a8xkht.js +0 -4
  195. package/dist/chunks/icons-853n6qt3.js +0 -4
  196. package/dist/chunks/iframe-host-gx0ypyh3.js +0 -4
  197. package/dist/chunks/index-bs4k9tr6.js +0 -4
  198. package/dist/chunks/jx-validate-ymf10teh.js +0 -4
  199. package/dist/chunks/layers-p9nfya38.js +0 -4
  200. package/dist/chunks/layers-panel-tt1hzhhf.js +0 -4
  201. package/dist/chunks/lit-html-x18n2sfz.js +0 -4
  202. package/dist/chunks/media-library-0n45gv8r.js +0 -4
  203. package/dist/chunks/media-picker-s09at95z.js +0 -4
  204. package/dist/chunks/monaco-buffer-een2ea0v.js +0 -4
  205. package/dist/chunks/notify-qwb8radt.js +0 -4
  206. package/dist/chunks/parse-v77xtwv7.js +0 -4
  207. package/dist/chunks/platform-8jnez0wr.js +0 -4
  208. package/dist/chunks/publish-panel-aysnj611.js +0 -4
  209. package/dist/chunks/publish-quick-kpbqs9mz.js +0 -4
  210. package/dist/chunks/publish-workspace-nd0a8q99.js +0 -4
  211. package/dist/chunks/quick-search-vg0jkhk2.js +0 -4
  212. package/dist/chunks/references-a7v6a0e2.js +0 -4
  213. package/dist/chunks/right-panel-cvk1vxx5.js +0 -4
  214. package/dist/chunks/source-control-fsqzc6he.js +0 -4
  215. package/dist/chunks/studio-05jfwbmf.js +0 -5
  216. package/dist/chunks/studio-0q5jwddh.js +0 -9
  217. package/dist/chunks/studio-0w2dr0q8.js +0 -5
  218. package/dist/chunks/studio-1tzpds97.js +0 -9
  219. package/dist/chunks/studio-216b27sv.js +0 -4
  220. package/dist/chunks/studio-2ejhqns4.js +0 -5
  221. package/dist/chunks/studio-2r90cts3.js +0 -16
  222. package/dist/chunks/studio-399xknkb.js +0 -6
  223. package/dist/chunks/studio-4ncmwqw5.js +0 -5
  224. package/dist/chunks/studio-5atwjgkj.js +0 -7
  225. package/dist/chunks/studio-5frqk7c0.js +0 -5
  226. package/dist/chunks/studio-6cwj6xrx.js +0 -5
  227. package/dist/chunks/studio-78pywnp2.js +0 -6
  228. package/dist/chunks/studio-886t6ztg.js +0 -5
  229. package/dist/chunks/studio-8wnvtr4z.js +0 -5
  230. package/dist/chunks/studio-8z66jk4z.js +0 -5
  231. package/dist/chunks/studio-b2qpt0xy.js +0 -14
  232. package/dist/chunks/studio-c71806xz.js +0 -7
  233. package/dist/chunks/studio-cbwks69x.js +0 -928
  234. package/dist/chunks/studio-cg710sk9.js +0 -5
  235. package/dist/chunks/studio-cw0wb9qk.js +0 -7
  236. package/dist/chunks/studio-cyheys7k.js +0 -5
  237. package/dist/chunks/studio-ea5m9kg5.js +0 -5
  238. package/dist/chunks/studio-efdxjwyp.js +0 -64
  239. package/dist/chunks/studio-egmw2837.js +0 -5
  240. package/dist/chunks/studio-f746039f.js +0 -5
  241. package/dist/chunks/studio-fmdymd9v.js +0 -5
  242. package/dist/chunks/studio-gcm12z00.js +0 -6
  243. package/dist/chunks/studio-gj98m8gy.js +0 -7
  244. package/dist/chunks/studio-hasbgjah.js +0 -5
  245. package/dist/chunks/studio-hz5n7x27.js +0 -5
  246. package/dist/chunks/studio-jeraxdgv.js +0 -7
  247. package/dist/chunks/studio-jvgek9xt.js +0 -5
  248. package/dist/chunks/studio-jws1a87n.js +0 -5
  249. package/dist/chunks/studio-k2sz13zg.js +0 -5
  250. package/dist/chunks/studio-k3m4jkdk.js +0 -5
  251. package/dist/chunks/studio-kg5ya5r2.js +0 -5
  252. package/dist/chunks/studio-khwbgrtg.js +0 -5
  253. package/dist/chunks/studio-mx6wzh25.js +0 -5
  254. package/dist/chunks/studio-mxs3ar9t.js +0 -5
  255. package/dist/chunks/studio-nm4szey4.js +0 -5
  256. package/dist/chunks/studio-nqxqf8p2.js +0 -4
  257. package/dist/chunks/studio-qn7z4krm.js +0 -5
  258. package/dist/chunks/studio-qyed0ah6.js +0 -5
  259. package/dist/chunks/studio-r4bcdwhq.js +0 -5
  260. package/dist/chunks/studio-rtfnhrdg.js +0 -5
  261. package/dist/chunks/studio-s5tzw84t.js +0 -5
  262. package/dist/chunks/studio-t51y8v1d.js +0 -5
  263. package/dist/chunks/studio-t98vq4r6.js +0 -5
  264. package/dist/chunks/studio-tsxpqvh0.js +0 -6
  265. package/dist/chunks/studio-v1yascv2.js +0 -5
  266. package/dist/chunks/studio-wxq6v5sv.js +0 -5
  267. package/dist/chunks/studio-y60sts62.js +0 -4
  268. package/dist/chunks/studio-zndrqawb.js +0 -5
  269. package/dist/chunks/studio-zwaxn5s2.js +0 -5
  270. package/dist/chunks/workspace-home-x1787wpv.js +0 -4
  271. package/dist/chunks/workspace-zpe1np43.js +0 -4
@@ -1,5 +0,0 @@
1
- import{Ft,Wi,fn,lr,Pa}from"./studio-hz5n7x27.js";import{C}from"./studio-y60sts62.js";import{Pn,Yc,St,Hi,Ce,Lo,We,Vd,h}from"./studio-k2sz13zg.js";import{$o}from"./studio-ea74s8c1.js";import{Q}from"./studio-nqxqf8p2.js";import{dm}from"./studio-qh8berdz.js";import{_a}from"./studio-f746039f.js";import{KD,oT}from"./studio-r7pf0rkv.js";import{Co}from"./studio-2r90cts3.js";import{yr,Yu}from"./studio-rtfnhrdg.js";import{lw,db}from"./studio-4jhw38b2.js";import{cb}from"./studio-cg1bfyhf.js";import{jl}from"./studio-khwbgrtg.js";import{wa,Dc,YE}from"./studio-2ejhqns4.js";import{as,gb}from"./studio-kg5ya5r2.js";import{v}from"./studio-8z66jk4z.js";import{le}from"./studio-j3d2fjqz.js";var ob=["page","collection","template","component","media","entry"],nw={collection:{cta:"Create collection",hint:"Posts, products, team… with a page each",icon:"stack",id:"collection",label:"Collection",nameLabel:"Collection name",placeholder:"Recipes"},component:{cta:"Create component",hint:"A reusable block for any page",icon:"cube",id:"component",label:"Component",nameLabel:"Component name",placeholder:"Pricing table"},entry:{cta:"Create entry",hint:"A new item in a collection",icon:"file-text",id:"entry",label:"Entry",nameLabel:"Entry name",placeholder:"My first post"},media:{cta:"Upload",hint:"Images, video, documents",icon:"image",id:"media",label:"Media",nameLabel:"",placeholder:""},page:{cta:"Create page",hint:"A new URL on your site",icon:"file",id:"page",label:"Page",nameLabel:"Page name",placeholder:"Pricing"},template:{cta:"Create template",hint:"Shared frame that pages sit inside",icon:"frame-corners",id:"template",label:"Template",nameLabel:"Template name",placeholder:"Landing"}},Bs="blank",Rc="article",P_="selection",lm="copy",iw=["title","image","richText","date","tags","number","link"],F_={date:{key:"date",label:"Date",schema:{format:"date",type:"string"}},image:{key:"cover",label:"Image",schema:{format:"image",type:"string"}},link:{key:"link",label:"Link",schema:{format:"uri",type:"string"}},number:{key:"number",label:"Number",schema:{type:"number"}},richText:{key:null,label:"Rich text",schema:null},tags:{key:"tags",label:"Tags",schema:{items:{type:"string"},type:"array"}},title:{key:"title",label:"Title",schema:{type:"string"}}},mE=["title","image","richText"];function f(e,n){return e==="."||e===""?n:`${e}/${n}`}function nl(e){return e.replace(/^\.\//,"")}function j_(e,n){let t=n.defaultLayout;if(e===Bs||e==="")return t?!1:void 0;if(t&&nl(t)===nl(e))return;return e}function Ou(e){let n=e.defaultLayout;if(n)return e.layouts.find((r)=>nl(r.ref)===nl(n))?.ref??n;return e.layouts[0]?.ref??Bs}function H_(e,n){let t=Pn(n??"");if(t!==null){let r=e.layouts.find((o)=>nl(o.ref).replace(/\.json$/i,"").split("/").some((l)=>Pn(l)===t));if(r)return r.ref}return Ou(e)}function R(e){return e.trim().replaceAll("\\","/").split("/").map((n)=>as(n)).filter((n)=>n!=="")}function I(e){let n={};for(let r of iw){let o=F_[r];if(e.includes(r)&&o.key!==null&&o.schema!==null)n[o.key]={...o.schema}}let t={properties:n,type:"object"};if(e.includes("title"))t.required=["title"];return t}function fD(e,n){let t=e?.properties??{};return iw.filter((r)=>{let{key:o}=F_[r];return o===null?n:Object.hasOwn(t,o)})}function w(e,n){let t=YE(e.schema);if(n!==void 0&&n!==""&&e.schema?.properties?.title!==void 0)t.title=n;if(e.ext===".json"||e.formatName===null)return{doc:t,format:null};return{doc:{...t,children:[]},format:e.formatName,frontmatter:Object.keys(t).length>0}}function gE(e,n,t,r){let o=[];if(n.includes("title"))o.push({tagName:"h1",textContent:"${state.entry.data.title}"});if(n.includes("image"))o.push({attributes:{alt:n.includes("title")?"${state.entry.data.title}":"",loading:"lazy",src:"${state.entry.data.cover}"},tagName:"img"});if(n.includes("richText")&&r.contentFormat!==null)o.push({children:"${state.entry.$children}",tagName:"div"});let i={};if(t!==void 0)i.$layout=t;return i.$paths={contentType:e,field:"id",param:"slug"},i.title=n.includes("title")?"${state.entry.data.title}":Yu(e),i.state={entry:{$prototype:"ContentEntry",$src:"@jxsuite/parser/ContentEntry.class.json",contentType:e,field:"id",id:{$ref:"#/$params/slug"}}},i.tagName="article",i.children=o,i}function cm(e,n){let t=n.i18n??null,r=Pn(e);return t!==null&&r!==null&&t.locales.includes(r)?r:null}function rb(e){return e.dir.includes($o)}function _(e,n){return e.localeDirs?.[n]??e.dir.replace($o,n.toLowerCase())}function E(e,n,t){let r=t.i18n??null;if(n===null||r===null)return e;return Yc(e,n,{...r,locales:[...r.locales]})??e}function J(e){let n=e.lastIndexOf("/");return n===-1?[".",e]:[e.slice(0,n),e.slice(n+1)]}function W(e,n,t){if(n.startFrom===lm&&n.copyOf!==void 0){let r=t.componentDocs?.get(n.copyOf);if(r){let o=JSON.parse(JSON.stringify(r));return delete o.$id,o.tagName=e,o}}return{children:[],tagName:e}}function B(e,n,t){let r=n.startFrom??Ou(t),o=r===Rc&&t.article!==null?t.article:null,i=o?.ext??".json",l=n.url===void 0?[as(e)].filter((u)=>u!==""):R(n.url),a=l.length===0?n.url===void 0?"":"index":l.at(-1),s=["pages",...l.slice(0,-1)].join("/"),c=a===""?"":`${a}${i}`,m=cm(n.locale,t),d=c===""?f(s,c):E(f(s,c),m,t),b=c===""?s:J(d)[0],p=e.trim(),g;if(o)g={doc:{children:[{tagName:"h1",textContent:p}],title:p},format:o.name,frontmatter:!0};else{let u={},y=j_(r===Rc?Bs:r,t);if(y!==void 0)u.$layout=y;u.title=p,u.tagName="main",u.children=[{tagName:"h1",textContent:p}],g={doc:u,format:null}}let N=c===""?"":yr(d).urlPattern;return{content:g,dir:b,ext:i,extraWrites:[],fileName:c,kind:"page",path:d,route:N,saved:c===""?"":`Saved as ${d} · opens at ${N}`}}function K(e,n,t){let r=as(e),o=n.fields??mE,i=t.i18n??null,l=i!==null&&n.localized!==!1,a=`content/${r}`,s=l?`${a}/${i.defaultLocale.toLowerCase()}`:a,c=t.contentFormat,m=c?.ext??".json",d=Yu(r),b=r===""?"":`first-${d.replaceAll(" ","-")}${m}`,p=I(o),g=structuredClone(p),N={format:c?.name??"json",schema:v(g)?g:{},source:l?`./${a}/${$o}`:`./${a}`},u=w({ext:m,formatName:c?.name??null,schema:p},`First ${d}`),y=[],k,L="";if(n.ownPage!==!1&&r!==""){let j=n.pageTemplate??Ou(t),D=l?[i.defaultLocale,...i.locales.filter((x)=>x!==i.defaultLocale)]:[null],T=[];for(let x of D){let O=E(`pages/${r}/[slug].json`,x,t),A=x===null||j!==Ou(t)?j:H_(t,x);k??=yr(O).urlPattern,y.push({body:{doc:gE(r,o,j_(A,t),t),format:null},path:O}),T.push(O)}L=T.length===1?`, and ${T[0]} at ${k}`:`, and a page in each language (${T.join(", ")})`}let P={config:{entry:N,name:r},content:u,dir:s,ext:m,extraWrites:y,fileName:b,kind:"collection",path:f(s,b),saved:r===""?"":l?`Adds a “${r}” collection to project.json with one folder per language under ${a}/, a first entry in ${s}/${L}.`:`Adds a “${r}” collection to project.json, a ${s}/ folder with a first entry${L}.`};if(k!==void 0)P.route=k;return P}function M(e,n){let t=as(e),r=t===""?"":`${t}.json`,o=f("layouts",r),i={},l=n.startFrom??"";if(l!==""&&l!==Bs)i.$layout=l;return i.tagName="div",i.children=[{children:[{tagName:"slot"}],tagName:"main"}],{content:{doc:i,format:null},dir:"layouts",ext:".json",extraWrites:[],fileName:r,kind:"template",path:o,saved:r===""?"":`Saved as ${o} with one slot.`}}function z(e,n,t){let r=db(e),o=r===""?"":`${r}.json`,i=f("components",o);return{content:{doc:W(r,n,t),format:null},dir:"components",ext:".json",extraWrites:[],fileName:o,kind:"component",path:i,saved:o===""?"":`Saved as ${i} with tag <${r}>.`,tag:r}}function U(e,n,t){let r=t.collections.find((d)=>d.name===n.collection)??null,o=as(e),i=r?.ext??".json",l=cm(n.locale,t),a=r!==null&&rb(r)&&l===null,s=r===null?"content":rb(r)&&l!==null?_(r,l):r.dir,c=o===""||r===null||a?"":`${o}${i}`,m=f(s,c);return{content:r?w(r,e.trim()):{doc:{},format:null},dir:s,ext:i,extraWrites:[],fileName:c,kind:"entry",path:m,saved:c===""?"":`Saved as ${m} in ${r.name}.`}}function bE(e,n,t,r){switch(e){case"page":return B(n,t,r);case"collection":return K(n,t,r);case"template":return M(n,t);case"component":return z(n,t,r);case"entry":return U(n,t,r);default:{let o=t.files??0;return{content:{doc:{},format:null},dir:_a,ext:"",extraWrites:[],fileName:"",kind:e,path:_a,saved:o===0?`Saved under ${_a}/. No folder to choose.`:`${o===1?"1 file":`${o} files`} will be saved under ${_a}/.`}}}}function q(e,n){let t=e.lastIndexOf("/"),r=t===-1?".":e.slice(0,t),o=n(r);return gb(e.slice(t+1),"",{dir:r,taken:o??new Set})}function S(e){if(e.kind!=="page"||e.fileName==="")return[];let n=e.fileName.slice(0,e.fileName.length-e.ext.length);if(n!=="index")return[{dir:e.dir,stem:n},{dir:f(e.dir,n),stem:"index"}];let t=e.dir.lastIndexOf("/");if(t===-1)return[{dir:e.dir,stem:n}];return[{dir:e.dir,stem:n},{dir:e.dir.slice(0,t),stem:e.dir.slice(t+1)}]}function V(e,n){let t=e.fileName.toLowerCase();for(let{dir:r,stem:o}of S(e)){let i=`${o.toLowerCase()}.`;for(let l of n(r)??[])if(l.startsWith(i)&&!(r===e.dir&&l===t))return f(r,l)}return null}function H(e){return gb(e,"",{choice:{ext:"",kind:"fixed"},dir:".",taken:new Set})}function vE(e,n,t,r,o){if(e.kind==="media")return(t.files??0)===0?"Drop files here, or browse for them.":"";let i=H(n);if(i!=="")return i;switch(e.kind){case"page":{if(t.url!==void 0){if(t.url.replaceAll("\\","/").split("/").includes(".."))return"A URL cannot step outside the site.";if(!t.url.trim().startsWith("/"))return"A URL starts with a slash, such as /pricing."}let a=V(e,o);if(a!==null)return`${a} already opens at ${e.route??"/"}.`;break}case"component":{let a=e.tag??"",s=lw(a);if(s!=="")return s;if(r.componentTags.includes(a))return`A component named <${a}> already exists.`;if(t.startFrom===P_&&r.hasSelection!==!0)return"Select an element on the canvas to make a component from it.";if(t.startFrom===lm&&(t.copyOf===void 0||r.componentDocs?.get(t.copyOf)===void 0))return"Choose the component to copy.";break}case"collection":{let a=e.config?.name??"";if(r.declaredContent.includes(a))return`A collection named “${a}” already exists.`;if(o("content")?.has(a)===!0)return`content/${a}/ already exists.`;break}case"entry":{let a=r.collections.find((s)=>s.name===t.collection);if(!a)return"Choose the collection this entry belongs to.";if(rb(a)&&cm(t.locale,r)===null)return`Choose the language this ${Yu(a.name)} is written in.`;break}default:break}let l=[...e.kind==="collection"?[]:[e.path],...e.extraWrites.map((a)=>a.path)];for(let a of l){let s=q(a,o);if(s!=="")return s}return""}function yE(e){let n=new Set,t=(r)=>{let o=r.lastIndexOf("/");n.add(o===-1?".":r.slice(0,o))};if(e.kind==="media")return[];if(e.kind==="collection")n.add("content");else if(e.fileName!=="")t(e.path);for(let r of e.extraWrites)t(r.path);for(let{dir:r}of S(e))n.add(r);return[...n]}function mD(e){let n=(r)=>r==="."?0:r.split("/").length,t=new Map;for(let r of e){let o=n(r);t.set(o,[...t.get(o)??[],r])}return[...t.entries()].toSorted(([r],[o])=>r-o).map(([,r])=>r)}function gD(e,n){if(e===".")return!1;let t=e.lastIndexOf("/"),r=n.get(t===-1?".":e.slice(0,t));return r!==void 0&&!r.has(e.slice(t+1).toLowerCase())}function B_(e){if(e.ext===".json")return null;return(e.def.format?Wi(e.def.format)?.name:void 0)??fn(`untitled${e.ext}`)?.name??lr()?.name??null}async function G(e){let n=w({ext:e.ext,formatName:B_(e),schema:e.schema});if(n.format===null)return Co(n.doc,null);return Pa(n.format,n.doc,{frontmatter:n.frontmatter??!1,mode:"roundtrip"})}async function sP(e,n={}){let t=wa(e);if(!t)return C.error(`No content collection named "${e}" to create an entry in.`,{detail:"A collection needs a `content` entry in project.json whose `source` is a directory. A collection whose source names a single file (a CSV catalogue) has rows, not entry files.",source:"Content"}),null;await Ft().catch(()=>{});let r;try{r=await G(t)}catch(s){return C.error(`Could not prepare a new ${t.name} entry.`,{detail:Q(s),path:t.dir,source:"Content"}),null}let o=n.dir,i=o!==void 0&&Vd(o)?.name===t.name?o:t.dir;if(i.includes($o))return C.error(`"${t.name}" is a localized collection.`,{detail:`Its entries live in one directory per language (${t.dir}). Open the folder for the language you are writing in and create the entry there.`,path:t.dir,source:"Content"}),null;let{createFileIn:l}=await (le("b2tcppdd"),import("./files-b2tcppdd.js")),a=await l({content:r,dir:i,format:{ext:t.ext,kind:"fixed"},source:"Content",suggestedName:"untitled",title:`New ${t.name} entry`});if(a===null)return null;return dm(t.name),await jl(a),a}function F(){let e=h.value;return e&&Dc(e.documentPath)?e:null}function Y(){return[{args:Ce({path:We("Project-relative path of the entry file to open.")}),category:"File",id:"content.openEntry",level:"project",menus:["context/file","palette"],group:"1_file",requires:"an open project",when:(e)=>e.project.open,run:async(e,n)=>{await jl(St("content.openEntry",n,"path"))},title:"Open Entry"},{args:Ce({draft:Lo("True marks the open entry a draft; false marks it published. Written as a `draft` field on the entry.")}),category:"Document",id:"content.setDraft",level:"document",menus:["context/tab","palette"],group:"3_document",requires:"a content entry open",when:(e)=>e.document.open,enablement:()=>F()!==null,undo:"document",run:(e,n)=>{let t=F();if(!t)throw Error("content.setDraft: the active document is not a content entry");cb(t,Hi("content.setDraft",n,"draft"))},title:"Set Draft"},{args:Ce({include:Lo("True lists entries marked `draft: true` alongside the rest.")}),category:"View",id:"content.setIncludeDrafts",level:"project",menus:["palette"],group:"2_view",requires:"an open project",when:(e)=>e.project.open,run:async(e,n)=>{KD(Hi("content.setIncludeDrafts",n,"include")),await oT()},title:"Include Drafts"}]}function wE(e){e.registerAll(Y())}
2
- export{ob,nw,Bs,Rc,P_,lm,iw,F_,mE,nl,j_,Ou,H_,fD,gE,cm,rb,bE,vE,yE,mD,gD,B_,sP,wE};
3
-
4
- //# debugId=F4CFF0B20B54429B64756E2164756E21
5
- //# sourceMappingURL=studio-jvgek9xt.js.map
@@ -1,5 +0,0 @@
1
- import{n,ee,_}from"./studio-8z66jk4z.js";function af(r){if(!r)return!1;if(ee(r.openProject))return!0;return r.openProjectPicker==="repo-list"&&ee(r.listRepos)&&ee(r.importProject)}function dI(r){globalThis.__jxPlatform=r}function Tv(){return globalThis.__jxLauncher}var a=new Map;function uI(){let r=[];for(let[o,i]of a)for(let t=0;t<i;t++)r.push(o);return r}function s(r){a.set(r,(a.get(r)??0)+1)}function c(r){let o=(a.get(r)??1)-1;if(o>0)a.set(r,o);else a.delete(r)}function g(r){return(_(r)||ee(r))&&"then"in r&&ee(r.then)}function d(r,o,i){return(...t)=>{let e=o.apply(i,t);if(!g(e))return e;s(r);let u=()=>{c(r)};return e.then(u,u),e}}function P(r){let o=new Map;return new Proxy(r,{get(i,t){let e=i[t];if(!ee(e)||!n(t))return e;let u=o.get(t);if(u&&u.raw===e)return u.wrapper;let f=d(t,e,i);return o.set(t,{raw:e,wrapper:f}),f}})}var l=null;function p(){let r=globalThis.__jxPlatform;if(!r)throw Error("No platform registered. Call registerPlatform() before starting Studio.");if(l?.raw!==r)l={raw:r,wrapped:P(r)};return l.wrapped}function _e(){return globalThis.__jxPlatform!=null}
2
- export{af,dI,Tv,uI,p,_e};
3
-
4
- //# debugId=373B40B4D224BF9D64756E2164756E21
5
- //# sourceMappingURL=studio-jws1a87n.js.map
@@ -1,5 +0,0 @@
1
- import{ge,ea,ne,g,de,Th,C}from"./studio-y60sts62.js";import{Zd}from"./studio-qn7z4krm.js";import{p}from"./studio-jws1a87n.js";import{Wi,fn,lr}from"./studio-hz5n7x27.js";import{rI,OC,$o,aM,Wx,sI,aI,dM,wv}from"./studio-ea74s8c1.js";import{yv,Q$,Er,S}from"./studio-cg710sk9.js";import{Se,oe,Lv,$v,FC,lf,jC,na,cf,Xm,Gx}from"./studio-wc6za3zs.js";import{n,Z,Ze,_,v,Go,Di,nd,uf}from"./studio-8z66jk4z.js";import{le}from"./studio-j3d2fjqz.js";var we=g(new Set);function Fm(e){we.add(e)}function kx(e){we.delete(e)}function wC(e){return we.has(e)}var O$=()=>({kind:"proceed"});function av(e,t){return{success:!0,data:e,summary:t}}function Fn(e){return{success:!1,error:e}}function Ur({name:e,description:t,parameters:o,strict:r=!0,llmStrict:i=!1,interactive:s,title:a,annotations:l,interaction:c,settle:u,execute:y}){let d={name:e,description:t,parameters:o,strict:r,llmStrict:i,execute:y};if(s!==void 0)d.interactive=s;if(a!==void 0)d.title=a;if(l!==void 0)d.annotations=l;if(c!==void 0)d.interaction=c;if(u!==void 0)d.settle=u;return d}function Ex(e){let t=[];return{record(o){t.push(o),e?.(o)},writes:t}}function gh(e=null,t={}){let o=new Map(Object.entries(t));return{sessionId:e,get:(r)=>o.get(r),set:(r,i)=>{o.set(r,i)},toJSON:()=>Object.fromEntries(o)}}var Yt=new AbortController().signal;function Tx(e={}){let t=e.session??gh();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??Ex(),progress:e.progress??(()=>{}),session:t,signal:e.signal??Yt}}function pO(e){let t=new AbortController;if(e.aborted)return t.abort(e.reason),{release:()=>{},signal:t.signal};let o=()=>{t.abort(e.reason)};return e.addEventListener("abort",o,{once:!0}),{release:()=>{e.removeEventListener("abort",o)},signal:t.signal}}function Lx(){let e=new Map;return{register(t){if(e.has(t.name))console.warn(`Tool "${t.name}" is being re-registered.`);e.set(t.name,t)},list(){return[...e.values()]},listForLLM(){return[...e.values()].map((t)=>{let o={name:t.name,description:t.description,parameters:t.parameters};if(t.llmStrict===!0)o.strict=!0;return{type:"function",function:o}})},getDefinition(t){return e.get(t)},validate(t,o){let r=e.get(t);if(!r)return{valid:!1,errors:[`Unknown tool: "${t}"`]};if(!r.strict)return{valid:!0};let i=r.parameters;if(!i.properties)return{valid:!0};let s=[],a=i.properties,l=i.required||[];for(let c of l)if(!(c in o)||o[c]===void 0||o[c]===null)s.push(`Missing required argument: "${c}"`);for(let[c,u]of Object.entries(o)){let y=a[c];if(!y)continue;let d=y.type;if(!d)continue;let x=Ge(u);if(d==="number"||d==="integer"){if(Re(u,"number"))continue;if(Re(u,"string")){if(!Number.isNaN(Number(u)))continue;s.push(`Argument "${c}" should be a number, got non-numeric string "${u}"`);continue}s.push(`Argument "${c}" should be a number, got ${x}`);continue}if(d==="string"&&x!=="string")s.push(`Argument "${c}" should be a string, got ${x}`);else if(d==="boolean"&&x!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${x}`);else if(d==="array"&&x!=="array")s.push(`Argument "${c}" should be an array, got ${x}`);else if(d==="object"&&x!=="object")s.push(`Argument "${c}" should be an object, got ${x}`)}return s.length>0?{valid:!1,errors:s}:{valid:!0}},async execute(t,o,r=Tx()){let i=e.get(t);if(!i)return Fn(`Unknown tool: "${t}"`);let s=this.validate(t,o);if(!s.valid)return Fn(`Validation failed: ${(s.errors||[]).join("; ")}`);try{return await i.execute(o,r)}catch(a){return Fn(`Tool "${t}" execution error: ${me(a)}`)}}}}var Zt="The author declined this call.";function Xt(e){return JSON.parse(JSON.stringify(e))}function me(e){return e.message}var Qt=["string","number","boolean","undefined"];function Re(e,t){return typeof e===t}function en(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ge(e){if(Array.isArray(e))return"array";return Qt.find((t)=>Re(e,t))??"object"}function tn(e){if(!e)return{};let t=JSON.parse(e);if(!en(t)){let o=t===null?"null":Ge(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function M$(e,t,o,{approval:r=O$,response:i}={}){let s=!1,a;try{let l=tn(t.argumentsText),c=e.getDefinition(t.name),u=c?nn(e,c,l,r,i):null;if(u?.status==="needs_input")return u;if(u)({result:a}=u);else s=!0,a=await e.execute(t.name,l,o)}catch(l){a=Fn(`Failed to parse arguments: ${me(l)}`)}try{return{status:"done",result:Xt(a),executed:s}}catch(l){let c=me(l);return{status:"done",result:Fn(`Tool "${t.name}" returned a result that cannot be serialized: ${c}`),executed:s}}}function nn(e,t,o,r,i){let{interaction:s,settle:a}=t;if(s&&a){let c=e.validate(t.name,o);if(!c.valid)return pe(`Validation failed: ${(c.errors||[]).join("; ")}`);if(i)return{status:"done",result:on(t.name,a,o,i),executed:!1};let u=s(o);return"refusal"in u?pe(u.refusal):{status:"needs_input",request:u}}let l=r(t,o);if(l.kind==="deny")return pe(l.message);if(l.kind==="confirm"){if(!i)return{status:"needs_input",request:{kind:"approval",reason:l.reason,summary:l.summary,title:t.title??t.name,tool:t.name}};if(i.kind!=="approval"||!i.approved)return pe(Zt)}return null}function pe(e){return{status:"done",result:Fn(e),executed:!1}}function on(e,t,o,r){try{return t(o,r)}catch(i){return Fn(`Tool "${e}" execution error: ${me(i)}`)}}var rn=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"]),bC="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function Pn(e){if(!n(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function yx(e){return Pn(e)!==null}function iv(e){let t=Pn(e);if(t===null)return"ltr";let o=new Intl.Locale(t),r=o.script??o.maximize().script;return r!==void 0&&rn.has(r)?"rtl":"ltr"}function Wt(e){let t=Pn(e);if(t===null)return n(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var sn="prefix-except-default";function ln(e){let t=e.i18n,o=[];if(!_(t))return{errors:o,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],i=[];for(let l of r){let c=Pn(l);if(c===null){o.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!i.includes(c))i.push(c)}let s=Pn(t.defaultLocale)??i[0]??null;if(t.defaultLocale!==void 0&&Pn(t.defaultLocale)===null)o.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(s===null)return o.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:o,i18n:null};if(!i.includes(s))i.unshift(s);let a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:sn;return{errors:o,i18n:{defaultLocale:s,locales:i,routing:a}}}function go(e,t){let o=Ae(q(e),t);if(o===-1||t===null)return null;return Pn(q(e)[o])}function wx(e,t){let o=go(e,t);if(o!==null||t===null||t.routing!=="prefix-except-default")return o;return q(e)[0]==="pages"?t.defaultLocale:null}function ov(e,t){let o=q(e),r=Ae(o,t);return r===-1?o.join("/"):o.filter((i,s)=>s!==r).join("/")}function Yc(e,t,o){if(o===null)return null;let r=Pn(t);if(r===null||!o.locales.includes(r))return null;let i=q(e),s=Ae(i,o),a=s===-1?cn(i):s;if(a===-1)return null;let l=s===-1?i:i.filter((c,u)=>u!==s);if(r===o.defaultLocale&&o.routing==="prefix-except-default")return l.join("/");return l.toSpliced(a,0,r.toLowerCase()).join("/")}function q(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function Ae(e,t){if(t===null)return-1;return e.findIndex((o)=>{let r=Pn(o);return r!==null&&t.locales.includes(r)})}function cn(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function dO(e,t){if(t===null)return null;let o=e.split("/").find(Boolean);if(o===void 0)return t.defaultLocale;let r=Pn(o);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}function F$(e,t){if(!n(t)||t==="")return e;let o=e.indexOf("#"),r=o===-1?"":e.slice(o),i=o===-1?e:e.slice(0,o),s=i.indexOf("?"),a=s===-1?i:i.slice(0,s),c=(s===-1?[]:i.slice(s+1).split("&")).filter((u)=>u!==""&&!un(u));return c.push(`v=${encodeURIComponent(t)}`),`${a}?${c.join("&")}${r}`}function un(e){let t=e.indexOf("="),o=t===-1?e:e.slice(0,t);if(o==="v")return!0;if(!o.includes("%"))return!1;try{return decodeURIComponent(o)==="v"}catch{return!1}}function dn(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function dv(e,t,o=[]){if(!e||!t)return null;let r=e.replaceAll("\\","/").replace(/^\.\//,""),i=null,s=(a,l)=>{if(r.startsWith(`${a}/`)&&(!i||a.length>i.dir.length))i={dir:a,urlPrefix:l}};for(let[a,l]of Object.entries(t)){if(!l?.source||!OC.test(a))continue;let c=gn(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes($o)){let u=mn(r,c,a,o);if(u)s(u.dir,u.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${rI}/${a}`)}return i}function mn(e,t,o,r){let i=t.indexOf($o),s=t.slice(0,i),a=t.slice(i+$o.length);if(!e.startsWith(s))return null;let l=e.slice(s.length).split("/")[0]??"";if(l===""||!OC.test(l))return null;let c=r.find((y)=>y.toLowerCase()===l.toLowerCase());if(c===void 0||!OC.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${rI}/${o}/${c}`}}function gn(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function uv(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let r=dM(e,t.documentDir,t.mounts,t.lanes);if(r===null)return null;let{suffix:i}=Wx(e);return F$(`${t.fileBaseUrl}${wv(r)}${i}`,dn(t.versions,r))}let[o]=t.mounts;return o?yn(e,t.documentDir,o):null}function yn(e,t,o){if(sI(e))return null;let{path:r,suffix:i}=Wx(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=aI(t,s);if(a===null)return null;let l=aM([o],a);if(!l)return null;return`${l}${i}`}function ze(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function G(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function Ye(e){return e??S?.projectConfig??null}function Xe(e){return e?.content??{}}function hn(e){let t=ln(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function et(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function tt(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:lr()?.extensions[0]??".json",unresolvedFormat:null};let t=Wi(e.format);return t?.extensions[0]===void 0?{ext:null,unresolvedFormat:e.format}:{ext:t.extensions[0],unresolvedFormat:null}}function bn(e,t){let o=t===null?"[^/]+":`(?:${t.map((i)=>ze(i)).join("|")})`,r=G(e).split($o).map((i)=>ze(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function xn(e,t,o){let r=bn(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function vn(e){return G(e).replaceAll($o,"").length}function Vd(e,t){if(e===null||e===void 0||e==="")return null;let o=Ye(t),r=hn(o),i=G(e),s=null,a=-1;for(let[l,c]of Object.entries(Xe(o))){let{source:u}=c;if(u===void 0||u===""||et(u))continue;let y=vn(u);if(y<=a)continue;let d=xn(u,i,r);if(d===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===d.length,name:l,...tt(c)},a=y}return s}function Un(e,t){if(e===null||e===void 0||e==="")return null;let o=Ye(t),r=G(e),i=r.toLowerCase();for(let[s,a]of Object.entries(Xe(o))){let{source:l}=a;if(l===void 0||l===""||!et(l))continue;let c=G(l).toLowerCase();if(i===c||i.endsWith(`/${c}`))return{def:a,dir:r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:s,...tt(a)}}return Vd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function Zc(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function Nx(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,o)=>o?o.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function Ax(e){return e.replaceAll(/(^|-)(\w)/g,(t,o,r)=>(o?" ":"")+r.toUpperCase())}function SC(e,t){return e?.$label||Zc(t)}function LO(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(o,r,i)=>(r?" ":"")+i.toUpperCase());return Zc(t)}function Da(e){return e==="image"||e==="uri-reference"}function bh(e){if(e.$shorthand===!0)return"shorthand";if(e.$input==="button-group")return"button-group";if(e.$input==="media")return"media";if(e.format==="color")return"color";if(Da(e.format))return"media";if(e.$units!==void 0)return"number-unit";if(e.type==="number")return"number";if(Array.isArray(e.enum))return"select";if(Array.isArray(e.examples)||Array.isArray(e.presets))return"combobox";return"text"}function vh(e,t){if(!e||!t?.content)return null;let o=Un(e,t);if(!o||!o.def.schema)return null;if(!o.fileBacked){let r=o.ext??lr()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(r.toLowerCase()))return null}return{name:o.name,schema:o.def.schema}}function pv(e,t){let o=e.trim().toLowerCase().replaceAll(/[^a-z0-9\s-]/g,"").replaceAll(/\s+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(!o)return"";return`${t}${o}`}function Ox(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())||e}function $O(e){if(!e)return{kind:"text"};let t=e.trim().replaceAll(/\s*\|\s*undefined\b/g,"").trim();if(t==="boolean")return{kind:"boolean"};if(t==="number")return{kind:"number"};if(t.match(/^'[^']*'(\s*\|\s*'[^']*')+$/))return{kind:"combobox",options:[...t.matchAll(/'([^']*)'/g)].map((i)=>i[1])};return{kind:"text"}}function ir(e){return JSON.parse(JSON.stringify(e))}function Oe(e){return e?.at(-1)??null}function gO(e){return e?.[0]??null}function $x(e,t){if(!t||!e)return!1;return e.some((o)=>Er(o,t))}function Ra(e){return z(e)}function z(e){let t=[];for(let o of e)t.push([...o]);return t}function Ix(e,t){if($x(e,t))return z(e.filter((o)=>!Er(o,t)));return[...z(e),[...t]]}function bO(e,t,o){let r=e.findIndex((a)=>Er(a,o)),i=t?e.findIndex((a)=>Er(a,t)):-1;if(r===-1||i===-1)return[[...o]];let s=i<=r?e.slice(i,r+1):e.slice(r,i+1).toReversed();return z(s)}function ye(e,t){return z(e.filter((o)=>!na(t,o)))}function vO(e){let t=[];for(let o of e)if(!t.some((r)=>Er(r,o)))t.push([...o]);return t}function Bm(e){if(e.length===0)return{mixed:!1,value:void 0};let[t]=e,o=JSON.stringify(t??null);for(let r=1;r<e.length;r++)if(JSON.stringify(e[r]??null)!==o)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var nt=null;function TO(e){nt=e}function ot(){return nt}var X=null,Q=null,ee=null,Je=!0;function rt(){X=[],Q=[],ee=[],Je=!0}function f(e){if(X)X.push(e)}function Bi(e){if(Q)Q.push(e)}function it(e){if(ee)ee.push(e)}function st(){let e={docOps:Q??[],fmOps:ee??[],invertible:Je,ops:X??[]};return X=null,Q=null,ee=null,Je=!0,e}var On=100,Sn=20;function te(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function w(e,t){let o=oe(e,t);if(!o)throw TypeError(`No node at path [${t.join(", ")}]`);return o}function P(e,t,o,r){return{forward:{key:t,op:"set-key",path:e,value:r},inverse:{key:t,op:"set-key",path:e,value:o}}}var at=null;function lt(e){at=e}var ct=null;function ut(e){ct=e}function wn(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)$v(e.doc.document,de(t.docOps[i].inverse));for(let i=t.fmOps.length-1;i>=0;i--){let s=t.fmOps[i];je(e,s.field,s.before)}e.doc.document={...de(e.doc.document)},e.session.selection=o,e.doc.dirty=r}function Y(e,t,{skipHistory:o=!1,origin:r="user",coalesceKey:i=null,actor:s=null}={}){if(!e)return!1;if(r!=="remote"&&ct?.(e,r))return!1;let a=s??he;if(r!=="remote")De(e,a);let l=Ra(e.session.selection),c=e.doc.dirty;rt();let u,y=null;try{t(e)}catch(A){y={error:A}}finally{u=st()}if(y)throw wn(e,u,l,c),y.error;let d=de(e.doc.document),x={...d},k=ot(),j=k===null?{patchable:!1,reason:"no-patch-consumer"}:u.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:k.classify(e,u.ops);if(j.patchable)k.markConsumed(x,e);if(e.doc.document=x,j.patchable)try{k.apply(e,u.ops,u)}catch(A){k.escalate(`patch-apply-failed: ${A instanceof Error?A.message:String(A)}`,e)}if(!o){let A=a?An(a):null;if(A)Jn(A,e,u,l);else dt(e,d,u,l,i)}return e.doc.dirty=!0,at?.(e,u,r),!0}function dt(e,t,o,r,i=null){let s=e.history.snapshots.slice(0,e.history.index+1),a=te()&&o.invertible&&(o.docOps.length>0||o.fmOps.length>0),l=s.at(-1);if(i&&a&&l&&l.coalesceKey===i&&l.inverseOps){if(l.forwardOps=[...l.forwardOps??[],...o.docOps.map((u)=>u.forward)],l.inverseOps=[...l.inverseOps,...o.docOps.map((u)=>u.inverse)],l.selection=Ra(e.session.selection),l.document)l.document=ir(t);e.history.snapshots=s,e.history.index=s.length-1;return}let c=!a||s.length%Sn===0;if(s.push({document:c?ir(t):null,fmOps:a&&o.fmOps.length>0?o.fmOps:null,forwardOps:a?o.docOps.map((u)=>u.forward):null,inverseOps:a?o.docOps.map((u)=>u.inverse):null,coalesceKey:i,selection:Ra(e.session.selection),selectionBefore:r}),s.length>On){if(!s[1].document)s[1].document=Ie(s,1);s.shift()}e.history.snapshots=s,e.history.index=s.length-1}function Ie(e,t){let o=t;while(o>=0&&!e[o].document)o-=1;let r=o<0?null:e[o].document;if(!r)throw Error("history-missing-checkpoint");let i=ir(r);for(let s=o+1;s<=t;s++)for(let a of e[s].forwardOps??[])$v(i,a);return i}function Ud(e,t,o){return Y(e,(r)=>t(r.doc.document),o)}function ke(e,t){Y(e,(o)=>{for(let r of t)xe(o,r)},{origin:"remote",skipHistory:!0})}function IO(e,t,{actor:o=null,selection:r={kind:"keep"}}={}){if(t.length===0)return"unchanged";return Y(e,(s)=>{for(let a of t)xe(s,a,jC(de(s.doc.document),a));Cn(s,r)},{actor:o})?"applied":"refused"}function Cn(e,t){if(t.kind==="prune")for(let o of t.under)e.session.selection=ye(e.session.selection,o);else if(t.kind==="follow"&&Er(Oe(e.session.selection),t.from))e.session.selection=[[...t.to]]}var Rn=new Set(["state","$media","$head","$elements","imports","$layout"]);function xe(e,t,o=t){let r=null;if(t.op==="set-key")r=oe(e.doc.document,t.path)?.[t.key];switch($v(e.doc.document,t),Bi({forward:t,inverse:o}),t.op){case"set-key":{if(Rn.has(t.key))f({key:t.key,op:"doc-meta"});else if(t.key==="style")f({op:"set-style",path:t.path});else if(t.key==="textContent")f({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")f({op:"replace",path:t.path});else{let i=t.key.startsWith("on")&&(uf(t.value)||uf(r));f({isEvent:i,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{f({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{f({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{f({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{f({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var V=new Map,M=new Map,he=null,ft=null;function pt(e){ft=e}function RO(e){let t=V.get(e.id);if(t)be(t);let o={owner:e,receipts:[]};return V.set(e.id,o),{owner:e,flush:()=>be(o),close:()=>{if(be(o),V.get(e.id)===o)V.delete(e.id);return[...o.receipts]}}}function V$(e,t){let o=he;he=e;try{return t()}finally{he=o}}function mt(e,t){let o=M.get(e);return o!==void 0&&(!t||o.lane.owner.id===t.id)}function DO(){for(let e of V.values())be(e)}function An(e){return V.get(e.id)??null}function be(e){for(let[t,o]of M)if(o.lane===e)gt(t,o)}function Jn(e,t,o,r){let i=M.get(t);if(!i)i={docOps:[],fmOps:[],invertible:!0,lane:e,selectionBefore:r},M.set(t,i);if(i.docOps.push(...o.docOps),i.fmOps.push(...o.fmOps),!o.invertible||o.docOps.length===0&&o.fmOps.length===0)i.invertible=!1}function De(e,t){let o=M.get(e);if(o&&o.lane.owner.id!==t?.id)gt(e,o)}function gt(e,t){M.delete(e);let{owner:o}=t.lane,r=o.turnId??"";if(F.has(e))t.lane.receipts.push({entry:null,tab:e,turnId:r});else{let i={docOps:t.docOps,fmOps:t.fmOps,invertible:t.invertible,ops:[]};dt(e,de(e.doc.document),i,t.selectionBefore);let s=e.history.snapshots[e.history.index];if(s.actor=o.id,o.turnId!==void 0)s.turnId=o.turnId;t.lane.receipts.push({entry:s,tab:e,turnId:r})}ft?.(e)}var F=new WeakMap;function fv(e,t){if(t)F.set(e,t);else F.delete(e)}function NO(e){let t=F.get(e);return t?t.canUndo(e):e.history.index>0||M.has(e)}function AO(e){let t=F.get(e);return t?t.canRedo(e):!M.has(e)&&e.history.index<e.history.snapshots.length-1}function yt(e,t){let{snapshots:o}=e.history;e.doc.document=Ie(o,t);let r=o[t];e.session.selection=Ra(de(r.selection))}function ht(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let o=JSON.stringify(Ie(e.history.snapshots,t)),r=JSON.stringify(ir(de(e.doc.document)));if(o!==r)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function CC(e){De(e,null);let t=F.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let o=e.history.snapshots[e.history.index],r=te()?o.inverseOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l=r.length-1;l>=0;l--)xe(a,de(r[l]));if(i)for(let l=i.length-1;l>=0;l--){let c=de(i[l]);je(a,c.field,c.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Ra(de(o.selectionBefore??[])),e.history.index-=1,ht(e,e.history.index)}else e.history.index-=1,yt(e,e.history.index);e.doc.dirty=!0}function OO(e){De(e,null);let t=F.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let o=e.history.snapshots[e.history.index+1],r=te()?o.forwardOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l of r)xe(a,de(l));if(i)for(let l of i){let c=de(l);je(a,c.field,c.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Ra(de(o.selection)),e.history.index+=1,ht(e,e.history.index)}else e.history.index+=1,yt(e,e.history.index);e.doc.dirty=!0}function or(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;let s=Lv(i),a=lf(o,s.length);s.splice(a,0,structuredClone(r)),f({index:a,op:"insert",parentPath:t}),Bi({forward:{index:a,node:Se(r),op:"insert-child",parentPath:t},inverse:{index:a,op:"remove-child",parentPath:t}})}function yh(e,t){let o=cf(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=w(e.doc.document,i).children.splice(r,1);f({op:"remove",path:t}),Bi({forward:{index:r,op:"remove-child",parentPath:i},inverse:{index:r,node:Se(s),op:"insert-child",parentPath:i}}),e.session.selection=ye(e.session.selection,t)}function U$(e,t){let o=cf(t);if(!o)return;let r=oe(e.doc.document,t);if(!r)return;let{index:i,parentPath:s}=o,a=structuredClone(de(r));w(e.doc.document,s).children.splice(i+1,0,a),f({index:i+1,op:"insert",parentPath:s}),Bi({forward:{index:i+1,node:Se(a),op:"insert-child",parentPath:s},inverse:{index:i+1,op:"remove-child",parentPath:s}}),e.session.selection=[[...s,"children",i+1]]}function zm(e,t){for(let o of Xm(t))yh(e,o)}function Mx(e,t){let o=[];for(let r of Xm(t)){let i=e.session.selection;U$(e,r);let s=Oe(e.session.selection),a=cf(s);if(!s||!a||e.session.selection===i)continue;o=o.map((l)=>FC(a.parentPath,l,a.index,1,!0)),o.unshift(s)}if(o.length>0)e.session.selection=o}function MO(e,t,o="div"){let r=cf(t);if(!r)return;let i=oe(e.doc.document,t);if(!i)return;let{index:s,parentPath:a}=r,l={children:[structuredClone(de(i))],tagName:o},c=Se(i);w(e.doc.document,a).children.splice(s,1,l),f({op:"replace",path:t}),Bi({forward:{index:s,node:Se(l),op:"set-child",parentPath:a},inverse:{index:s,node:c,op:"set-child",parentPath:a}}),e.session.selection=[[...a,"children",s]]}function qp(e,t,o,r){let i=e.doc.document,s=Gx(i,t,o,r);if(!s)return;let{forward:a,inverse:l}=s,c=oe(i,a.fromParentPath),u=oe(i,o),[y]=c.children.splice(a.fromIndex,1);if(Lv(u).splice(a.toIndex,0,y),f({fromPath:t,op:"move",toIndex:a.toIndex,toParentPath:o}),Bi({forward:a,inverse:l}),Er(Oe(e.session.selection),t))e.session.selection=[[...l.fromParentPath,"children",l.fromIndex]]}function Qe(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;let s=i[o],a=Se(s);if(r===void 0||r===null||r==="")delete i[o];else i[o]=r;if(Bi(P(t,o,a,Se(i[o]))),o==="children")e.session.selection=ye(e.session.selection,[...t,"children"]);if(o==="textContent")f({op:"set-text",path:t});else if(o==="style")f({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&uf(l);f({isEvent:c,key:o,op:"set-prop",path:t})}}function Wm(e,t,o,r){let i=w(e.doc.document,t),s=Se(i.style);if(!i.style)i.style={};if(r===void 0||r==="")delete i.style[o];else i.style[o]=r;if(Object.keys(i.style).length===0)delete i.style;Bi(P(t,"style",s,Se(i.style))),f({op:"set-style",path:t})}function Cr(e,t,o,r){let i=w(e.doc.document,t),s=Se(i.attributes);if(!i.attributes)i.attributes={};if(r===void 0||r==="")delete i.attributes[o];else i.attributes[o]=r;if(Object.keys(i.attributes).length===0)delete i.attributes;Bi(P(t,"attributes",s,Se(i.attributes))),f({attr:o,op:"set-attr",path:t})}function PO(e,t,o,r,i){if(!o)return Wm(e,t,r,i);let s=w(e.doc.document,t),a=Se(s.style);if(!s.style)s.style={};let l=`@${o}`,c=nd(s.style,l);if(i===void 0||i===""){if(delete c[r],Object.keys(c).length===0)delete s.style[l]}else c[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(P(t,"style",a,Se(s.style))),f({op:"set-style",path:t})}function Px(e,t,o,r,i){let s=w(e.doc.document,t),a=Se(s.style);if(!s.style)s.style={};let l=nd(s.style,o);if(i===void 0||i===""){if(delete l[r],Object.keys(l).length===0)delete s.style[o]}else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(P(t,"style",a,Se(s.style))),f({op:"set-style",path:t})}function FO(e,t,o,r,i,s){let a=w(e.doc.document,t),l=Se(a.style);if(!a.style)a.style={};let c=`@${o}`,u=nd(a.style,c),y=nd(u,r);if(s===void 0||s===""){if(delete y[i],Object.keys(y).length===0)delete u[r];if(Object.keys(u).length===0)delete a.style[c]}else y[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(P(t,"style",l,Se(a.style))),f({op:"set-style",path:t})}function bt(e,t){let o=[e];for(let r of t){let i=Di(o.at(-1),r);if(!i)break;o.push(i)}for(let r=o.length-2;r>=0;r--){let i=o[r],s=t[r],a=Di(i,s);if(a&&Object.keys(a).length===0)delete i[s]}}function Fx(e,t,o,r,i){let s=w(e.doc.document,t),a=Se(s.style);if(!s.style)s.style={};let l=s.style;for(let c of o)l=nd(l,c);if(i===void 0||i==="")delete l[r],bt(s.style,o);else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(P(t,"style",a,Se(s.style))),f({op:"set-style",path:t})}function jO(e,t,o,r,i,s){let a=w(e.doc.document,t),l=Se(a.style);if(!a.style)a.style={};let c=`@${o}`,u=nd(a.style,c),y=u;for(let d of r)y=nd(y,d);if(s===void 0||s===""){if(delete y[i],bt(u,r),Object.keys(u).length===0)delete a.style[c]}else y[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(P(t,"style",l,Se(a.style))),f({op:"set-style",path:t})}function HO(e,t,o){let r=w(e.doc.document,t),i=Se(r.style);if(o&&Object.keys(o).length>0)r.style=o;else delete r.style;Bi(P(t,"style",i,Se(r.style))),f({op:"set-style",path:t})}function qd(e,t,o){let r=e.doc.document,i=Se(r.state);if(!r.state)r.state={};r.state[t]=o,Bi(P([],"state",i,Se(r.state))),f({key:"state",op:"doc-meta"})}function BO(e,t){let o=e.doc.document;if(o.state){let r=Se(o.state);if(delete o.state[t],Object.keys(o.state).length===0)delete o.state;Bi(P([],"state",r,Se(o.state))),f({key:"state",op:"doc-meta"})}}function qr(e,t,o){let r=e.doc.document,i=Se(r.state);if(!r.state)r.state={};let s=r.state[t],a=s==null?{}:!_(s)||Array.isArray(s)?{default:s}:s;r.state[t]=a,Object.assign(a,o);for(let l of Object.keys(a))if(a[l]===void 0||a[l]===null)delete a[l];Bi(P([],"state",i,Se(r.state))),f({key:"state",op:"doc-meta"})}function zO(e,t,o){let r=e.doc.document;if(!r.state||!r.state[t])return;let i=Se(r.state);r.state[o]=r.state[t],delete r.state[t],Bi(P([],"state",i,Se(r.state))),f({key:"state",op:"doc-meta"})}function Gp(e,t,o,r){let i=w(e.doc.document,t),s=Se(i.$props);if(!i.$props)i.$props={};if(r===void 0||r===null||r==="")delete i.$props[o];else i.$props[o]=r;if(Object.keys(i.$props).length===0)delete i.$props;Bi(P(t,"$props",s,Se(i.$props))),f({op:"replace",path:t})}function WO(e,t,o,r){let i=w(e.doc.document,t),s=Se(i.cases);if(!i.cases)i.cases={};i.cases[o]=r||{tagName:"div",textContent:o},Bi(P(t,"cases",s,Se(i.cases))),f({op:"replace",path:t})}function VO(e,t,o){let r=w(e.doc.document,t);if(r.cases){let i=Se(r.cases);delete r.cases[o],Bi(P(t,"cases",i,Se(r.cases))),f({op:"replace",path:t})}}function UO(e,t,o,r){let i=w(e.doc.document,t);if(!i.cases||!i.cases[o])return;let s=Se(i.cases);i.cases[r]=i.cases[o],delete i.cases[o],Bi(P(t,"cases",s,Se(i.cases))),f({op:"replace",path:t})}function Gd(e,t,o){let r=e.doc.content.frontmatter,i=Object.hasOwn(r,t)?Se(r[t]):void 0,s=o===void 0||o===null||o==="";if(s)delete r[t];else r[t]=o;let a=s?void 0:Se(o);it({after:a,before:i,field:t}),e.doc.dirty=!0}function je(e,t,o){if(o===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=o}var W=[],In=50;function qO(e){return Object.assign(Ex(),{turnId:e})}function GO(e,t,o=[]){if(t.length===0)return[];let r={batches:[...o],id:e,writes:[...t]};W.push(r);while(W.length>In)W.shift();return r.writes}function KO(e){return W.find((t)=>t.id===e)?.writes??[]}function JO(e){let t=W.find((s)=>s.id===e),o="There is no longer a record of what that turn changed.";if(!t)return"There is no longer a record of what that turn changed.";let r=t.writes.filter((s)=>s.disk).map((s)=>s.path);if(r.length>0)return`Cannot restore: ${r.join(", ")} ${r.length===1?"was":"were"} written straight to disk, which undo cannot reach.`;if(t.batches.length===0)return"There is no longer a record of what that turn changed.";let i=new Map;for(let s of t.batches)i.set(s.tab,[...i.get(s.tab)??[],s]);for(let[s,a]of i){let l=kn(s,a);if(l)return l}for(let[s,a]of i)for(let l of a)CC(s);return[...i.keys()]}function kn(e,t){let o=e.documentPath??"(untitled)";if(e.scope.active===!1)return`Cannot restore: ${o} was closed after that turn.`;if(t.some((l)=>l.entry===null))return`Cannot restore: ${o} is shared live, and Restore cannot check its undo history. Undo it in the document instead.`;let{index:r,snapshots:i}=e.history,s=i.slice(r-t.length+1,r+1);if(r-t.length>=0&&t.every((l,c)=>s[c]===l.entry))return null;return i.indexOf(t.at(-1).entry)>r?`Cannot restore: that turn's change to ${o} was already undone.`:`Cannot restore: ${o} has edits made since that turn began, which Restore would undo too.`}function YO(e){let t=e.filter((l)=>l.ok),o=new Set(t.map((l)=>l.path)),r=e.length-t.length;if(o.size===0)return r>0?`${r} change${r===1?"":"s"} failed`:"";let i=`Changed ${o.size} file${o.size===1?"":"s"}`,s=new Set(t.flatMap((l)=>l.disk?[l.path]:[])),a=[i];if(s.size>0)a.push(`${s.size} written to disk — undo cannot reach ${s.size===1?"it":"them"}`);if(r>0)a.push(`${r} failed`);return a.join(" · ")}function kC(){W.splice(0)}function ZO(e,t){let o=null;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.id===t)return o;let s=i.role==="assistant"&&(i.content||(i.toolCalls?.length??0)>0);if(o===null&&s)o=i.id}return t===void 0?o:null}function jm(e){let t=new Set,o=new Set;return yv(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function fO(e,t){if(!t)return e;return Ee(e,"",t)}function Ee(e,t,o){if(Array.isArray(e)){let i=null;for(let[s,a]of e.entries()){let l=Ee(a,`${t}/${s}`,o);if(l!==a)i??=[...e],i[s]=l}return i??e}if(!v(e))return e;let r=null;for(let[i,s]of Object.entries(e)){let a=Ee(s,`${t}/${Q$(i)}`,o);if(i==="children"&&Array.isArray(a)&&a.length===1){let[l]=a;if(Go(l)&&(o.pointers.has(t)||o.fingerprints.has(JSON.stringify(l))))a=l}if(a!==s)r??={...e},r[i]=a}return r??e}var vC=["design","content","media","styles","publish","settings"],Wp="design",xt=[{icon:"frame-corners",id:"design",switcher:!0,title:"Design"},{icon:"file-text",id:"content",switcher:!0,title:"Content"},{icon:"image",id:"media",switcher:!0,title:"Media"},{icon:"paint-brush",id:"styles",switcher:!0,title:"Styles"},{icon:"paper-plane-tilt",id:"publish",switcher:!0,title:"Publish"},{icon:"gear-six",id:"settings",switcher:!1,title:"Project settings"}],xx=xt.filter((e)=>e.switcher);function A$(e){return typeof e==="string"&&vC.some((t)=>t===e)}function fh(e){return xt.find((t)=>t.id===e)}var Me="workspace://",_x={content:"content-home",media:"media-home",publish:"publish-home",settings:"settings-home"};function Vp(e){return Object.hasOwn(_x,e)}function Ia(e){return`${Me}${e}`}function dl(e){if(!e.startsWith(Me))return null;let t=e.slice(Me.length);return A$(t)&&Vp(t)?t:null}function rv(e){let t=dl(e);return t?fh(t).title:null}var Dn=new Map([["design","canvas"],["edit","canvas"],["entry","entry"],["git-diff","diff"],["grid","grid"],["content-home","home"],["media-home","home"],["publish-home","home"],["settings-home","home"],["media","media"],["preview","canvas"],["source","code"],["stylebook","config"],["tokens","tokens"]]),Up={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",media:"Media",none:"None",tokens:"Variables"};function Qs(e){return Dn.get(e)??"canvas"}var jn=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function uO(e){return jn.get(e)??"design"}var Sx=(e)=>e.editor.kind==="canvas",mh=(e)=>Sx(e)&&e.selection.count>0,Cx=(e)=>mh(e)&&!e.selection.isRoot;function sv(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},workspace:{id:Wp},document:{open:!1,dirty:!1,mode:"",canUndo:!1,canRedo:!1},editor:{kind:"none"},canvas:{view:"design"},pane:{count:1,derived:!1},selection:{count:0,paths:[],kind:"",isRoot:!1,isComponentInstance:!1,isLayoutNode:!1,isRepeater:!1},caret:{active:!1,inCanvas:!1},focus:{region:"pane"},modal:{open:!1},collab:{attached:!1,readOnly:!1,sourceCanonical:!1},ai:{configured:!1,streaming:!1,waiting:!1},capability:{gitClone:!1,importSite:!1,openProjectInNewWindow:!1,openProject:!1,dataRows:!1,windowControls:!1,findReferences:!1,readFileBytes:!1,publish:!1}}}function yC(e={}){let t=sv();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var En=["palette"],Mn=["caret","global"],$n=["dock","global"],Ln=["canvas","global"],Nn=["grid","global"],_n=["code","global"],Tt=["global"];function hO(e){if(e.modal.open)return En;if(e.caret.active)return Mn;if(e.focus.region!=="pane")return $n;switch(e.editor.kind){case"grid":return Nn;case"code":return _n;case"canvas":return e.canvas.view==="preview"?Tt:Ln;default:return Tt}}var an="project.json";function Wn(e,t=!1){return{activeMedia:null,activeSelector:null,openPopover:null,openDialog:null,canvasMode:e,editZoom:1,editingFormula:null,editingFunction:null,featureToggles:{},inspectorSections:{},pendingInlineEdit:null,preview:t,previewColorScheme:"auto",previewLocale:null,previewParams:{},previewProps:null,rightTab:"page",elementTab:"properties",showLayout:!0,styleFilter:"",styleSections:{},dataRows:{},dataLimits:{},styleShorthands:{},zoom:1}}var Bn=["edit","design","preview","source","stylebook","git-diff"];function lv({id:e,documentPath:t=null,fileHandle:o=null,document:r,frontmatter:i,sourceFormat:s=null,capabilities:a,openedFrom:l=null,preview:c=!1,layout:u=null,source:y=null,canvasMode:d}){let x=ge(),k=jm(r),j=a?.modes??Hn(t,s),A=d??j.find((b)=>b!=="preview")??"edit",ce=j[0]==="preview",E={bareRepeaters:k,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:u,mode:Kn(t,s),source:y,sourceFormat:s},ue={index:0,snapshots:[{document:structuredClone(r),selection:[]}]},K={canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:l,selection:[],ui:Wn(A,ce)};return x.run(()=>({capabilities:{modes:j},doc:g(E),documentPath:t,fileHandle:o,history:g(ue),id:e,pinned:!1,preview:c,scope:x,session:g(K)}))}function Hn(e,t){if(e===an)return["stylebook","tokens","source"];let o=Wi(t)??fn(e);if(o)return o.studio?.modes??["edit","design","preview","source"];return Bn}function Kn(e,t){let o=Wi(t)??fn(e);if(o)return o.studio?.documentMode?.default??"content";return"component"}function xC(e){return Qs(e.session.ui.canvasMode)}function P$(e){let t=[];for(let o of e.capabilities.modes){if(o==="preview")continue;let r=Qs(o);if(!t.includes(r))t.push(r)}return t}function mO(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&Qs(o)===t)}function Hm(e){e.scope.stop()}var vt=new WeakMap,B=new Map;function Tn(e){let t=de(e),o=vt.get(t);if(!o)o=g({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),vt.set(t,o);return o}function Ot(e){B.set(e,(B.get(e)??0)+1)}function wt(e){let t=B.get(e)??0;if(t<=1)B.delete(e);else B.set(e,t-1)}function cv(e){return B.has(e.replaceAll("\\","/"))}var qn=8000,Gn=800,zn=2500,Ct=null;function Yn(){return Ct??=(le("bs4k9tr6"),import("./index-bs4k9tr6.js")),Ct}function At(){try{return p()}catch{return null}}var H=null;function yO(e){H=e}var Le=null;function wO(e){Le=e}var Jt=()=>{};function xO(e){Jt=e??(()=>{})}var Ne=new WeakMap;function It(e){return de(e)}function _e(e,t){return e.frontmatterMap(t)}function Zn(e){return e.synced}function D(e){return Ne.get(It(e))}function Be(e){let t=It(e),o=Ne.get(t);if(!o)o={attaching:null,generation:0,optedOut:g({value:!1}),session:null,watcherInstalled:!1},Ne.set(t,o);return o}var Rt=!1;function Xn(){if(Rt)return;Rt=!0,lt(Qn),pt(eo),ut((e)=>{if(D(e)?.session?.synced&&Tn(e).sourceCanonical)return Jt("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function Qn(e,t,o){let r=D(e)?.session;if(!r||!r.synced)return;if(r.lastSeenRef=de(e.doc.document),o==="remote"){Te(r);return}if(r.canWrite)to(r,t),Te(r)}function eo(e){let t=D(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:o,batchNeedsDiff:r}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),r)re(t);else if(o.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,o,t.collab.LOCAL_ORIGIN)}catch{re(t)}t.undoManager?.stopCapturing()}function to(e,t){let o=t.docOps.map((r)=>r.forward);if(mt(e.tab)){if(e.batchOps??=[],o.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...o);return}if(o.length===0){re(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,o,e.collab.LOCAL_ORIGIN)}catch{re(e)}}function re(e){let{collab:t,handle:o,tab:r}=e,i=t.yDocToJson(o.doc),s=ir(de(r.doc.document)),a=t.diffDocs(i,s);if(a===null)t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN);else if(a.length>0)try{t.applyDocOpsToY(o.doc,a,t.LOCAL_ORIGIN)}catch{t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN)}}function $e(e){let t=e.collab.yDocToJson(e.handle.doc);Y(e.tab,(o)=>{let r=o.doc.document;for(let i of Object.keys(r))if(!(i in t))delete r[i];Object.assign(r,t)},{origin:"remote",skipHistory:!0})}function no(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,o=t.clientID;for(let[r,i]of t.getStates())if(i.canWrite!==!1&&r<o)o=r;return o===e.handle.awareness.clientID}function Te(e){if(!H||!no(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=zn){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,Fe(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),Fe(e)},Gn)}async function Fe(e){if(!H||!e.synced)return;try{let t=await H(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function kt(e){if(!Le||!e.synced||!e.canWrite)return;let{collab:t,handle:o,tab:r}=e,i=t.canonicalRevOf(o.doc),s=t.sourceText(o.doc).toString(),a;try{a=await Le(r,s)}catch{return}if(!Zn(e)||t.canonicalRevOf(o.doc)!==i)return;let l=t.diffDocs(t.yDocToJson(o.doc),a.document);if(l===null)t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN);else if(l.length>0)try{t.applyDocOpsToY(o.doc,l,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN)}let c=_e(t,o.doc),u=a.frontmatter??{};o.doc.transact(()=>{let y=[...c.keys()];for(let d of y)if(!(d in u))c.delete(d);for(let[d,x]of Object.entries(u))if(!t.deepEqual(c.get(d),x))c.set(d,x)},t.MIRROR_ORIGIN)}function _O(e){let t=D(e)?.session;if(!t?.synced)return null;let{collab:o,handle:r}=t,i=null,s=()=>i!==null&&t.sourceLockOwner===i;return{awareness:r.awareness,enter:async()=>{i={},t.sourceLockOwner=i;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"source"});if(!t.canWrite)return;let l=null;if(H)try{l=await H(e)}catch{l=null}if(!s())return;o.acquireSourceCanonical(r.doc,l??o.sourceText(r.doc).toString(),o.LOCAL_ORIGIN)},leave:()=>{if(!s()){i=null;return}i=null,t.sourceLockOwner=null;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"structure"});if(!t.canWrite)return;if(o.otherSourceEditors(r.awareness,t.path,r.awareness.clientID).filter((c)=>r.awareness.getStates().get(c)?.canWrite!==!1).length===0)kt(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function hv(e){let t=Tn(e);return t.active&&t.readOnly}async function j$(e){let t=D(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await Fe(t),await t.handle.flush(),!0}async function SO(){for(let e of Ve)if(D(e)?.session?.synced)await j$(e)}var Ve=new Set;function ie(e){if(!At()?.collab||!e.documentPath||e.documentPath===an)return;let o=Be(e);if(o.watcherInstalled)return;o.watcherInstalled=!0,Xn(),Ve.add(e),e.scope.run(()=>{ne(()=>{if(o.optedOut.value)ve(e);else He(e)}),ea(()=>{Ve.delete(e),ve(e)})})}function H$(e,t){let o=Be(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function B$(e){return D(e)?.optedOut.value!==!0}function Dt(e){if(!D(e)?.watcherInstalled){ie(e);return}ve(e),He(e)}async function He(e){let t=Be(e);if(t.session||t.attaching)return;let{documentPath:o}=e,r=At();if(!o||!r?.collab){Tn(e).status="unavailable";return}let{generation:i}=t,s=Tn(e);s.status="connecting",s.attachError="";let a=(async()=>{try{let[l,c]=await Promise.all([Yn(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let u,y=new Promise((d,x)=>{u=setTimeout(()=>x(Error("collab-sync-timeout")),qn)});try{await Promise.race([c.whenSynced,y])}finally{clearTimeout(u)}if(t.generation!==i){c.destroy();return}t.session=oo(e,o,l,c),s.active=!0,s.status="synced",s.readOnly=!t.session.canWrite,s.attachError="",Ot(o)}catch(l){s.status="failed",s.active=!1,s.attachError=l instanceof Error?l.message:String(l),C.warn(`Live collaboration is not available for "${o}" — ${s.attachError}`,{key:`collab:${o}`,path:o,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=a,await a}function ve(e){let t=D(e);if(!t)return;t.generation+=1;let{session:o}=t;t.session=null;let r=Tn(e);if(r.active=!1,r.status="detached",r.attachError="",r.peers=[],!o)return;if(wt(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}fv(e,null),e.history.snapshots=[{document:ir(de(e.doc.document)),selection:Ra(e.session.selection)}],e.history.index=0,o.undoManager?.destroy(),o.handle.destroy()}function oo(e,t,o,r){let i=r.identity(),s={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:i?i.permission!=="read":!0,collab:o,disposers:[],handle:r,lastSeenRef:de(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(o.metaMap(r.doc).get("structureSeeded")===!0){let b=o.yDocToJson(r.doc),T=ir(de(e.doc.document));if(!o.deepEqual(b,T)){let J=o.diffDocs(T,b);if(J===null)s.synced=!0,$e(s),s.synced=!1;else if(J.length>0)ke(e,J)}s.applyingRemoteFrontmatter=!0;let O=_e(o,r.doc);for(let[J,N]of O.entries())e.doc.content.frontmatter[J]=N;s.applyingRemoteFrontmatter=!1}else if(s.canWrite)o.seedStructure(r.doc,ir(de(e.doc.document)),{frontmatter:ir(de(e.doc.content.frontmatter)),origin:o.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});s.lastSeenRef=de(e.doc.document),s.disposers.push(r.onDirty((b)=>{e.doc.dirty=b})),r.awareness.setLocalState({canWrite:s.canWrite,focusedPath:t,structuralSelection:null,user:i?{avatarUrl:i.avatarUrl,color:i.color,login:i.login,name:i.name}:{color:o.colorForKey(String(r.awareness.clientID)),login:`guest-${r.awareness.clientID%1000}`}});let l=new o.UndoManager([o.structureMap(r.doc),o.frontmatterMap(r.doc)],{trackedOrigins:new Set([o.LOCAL_ORIGIN])});s.undoManager=l;let c=({stackItem:b})=>{b.meta.set("selection",Ra(e.session.selection))},u=({stackItem:b})=>{let T=b.meta.get("selection");e.session.selection=Ra(T??[])};l.on("stack-item-added",c),l.on("stack-item-popped",u),s.disposers.push(()=>{l.off("stack-item-added",c),l.off("stack-item-popped",u)}),fv(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let y=o.structureMap(r.doc),d=(b,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;let O=o.yEventsToDocOps(b);if(O===null){$e(s);return}if(O.length===0)return;try{ke(e,O)}catch{$e(s)}};y.observeDeep(d),s.disposers.push(()=>y.unobserveDeep(d));let x=Tn(e);x.sourceCanonical=o.canonicalOf(r.doc)==="source";let k=o.metaMap(r.doc),j=()=>{x.sourceCanonical=o.canonicalOf(r.doc)==="source"};k.observe(j),s.disposers.push(()=>k.unobserve(j));let A=o.sourceText(r.doc),ce=(b,T)=>{if(T.origin===o.MIRROR_ORIGIN||!s.synced)return;if(o.canonicalOf(r.doc)!=="source")return;if(!o.isSourceReconciler(r.awareness,s.path))return;if(s.sourceParseTimer)clearTimeout(s.sourceParseTimer);s.sourceParseTimer=setTimeout(()=>{s.sourceParseTimer=null,kt(s)},600)};A.observe(ce),s.disposers.push(()=>A.unobserve(ce));let E=_e(o,r.doc),ue=(b,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;s.applyingRemoteFrontmatter=!0;try{for(let[O,J]of b.changes.keys)if(J.action==="delete")delete e.doc.content.frontmatter[O];else e.doc.content.frontmatter[O]=E.get(O)}finally{s.applyingRemoteFrontmatter=!1}};E.observe(ue),s.disposers.push(()=>E.unobserve(ue)),e.scope.run(()=>{let b=JSON.stringify(e.doc.content.frontmatter);ne(()=>{let T=JSON.stringify(e.doc.content.frontmatter);if(T===b)return;if(b=T,s.applyingRemoteFrontmatter||!s.synced||!s.canWrite)return;let O=JSON.parse(T);r.doc.transact(()=>{let J=[...E.keys()];for(let N of J)if(!(N in O))E.delete(N);for(let[N,qe]of Object.entries(O))if(!o.deepEqual(E.get(N),qe))E.set(N,qe)},o.LOCAL_ORIGIN),Te(s)}),ne(()=>{let T=e.session.selection.length>0?Ra(e.session.selection):null,O=r.awareness.getLocalState();if(O)r.awareness.setLocalState({...O,structuralSelection:T})}),ne(()=>{let T=de(e.doc.document);queueMicrotask(()=>{if(D(e)?.session!==s||!s.synced||!s.canWrite)return;let J=de(e.doc.document);if(J!==T||J===s.lastSeenRef)return;s.lastSeenRef=J,re(s),Te(s)})})});let K=Tn(e),fe=()=>{let b=[];for(let[T,O]of r.awareness.getStates())if(T!==r.awareness.clientID&&O.user)b.push({clientId:T,state:O});K.peers=b};return fe(),r.awareness.on("change",fe),s.disposers.push(()=>r.awareness.off("change",fe),r.onStatus((b)=>{if(b==="offline"||b==="connecting")K.status="offline";else if(s.synced)K.status="synced"}),r.onReset(()=>{ve(e),He(e)})),s.synced=!0,s}function I(e,t,o){return RangeError(`command "${e}" argument "${t}": ${o}`)}function ro(e){if(Z(e))return"number";if(Ze(e))return"boolean";return n(e)?"string":"object"}function R(e){if(e===void 0)return"missing";return n(e)?`"${e}"`:`${ro(e)} ${JSON.stringify(e)}`}function Et(e){return Array.isArray(e)&&e.every((t)=>n(t)||Z(t))}function St(e,t,o){let r=t[o];if(!n(r)||r==="")throw I(e,o,`expected a non-empty string, got ${R(r)}`);return r}function ti(e,t,o){if(t[o]===void 0)return;return St(e,t,o)}function Mt(e,t,o){let r=t[o];if(!Z(r)||!Number.isFinite(r))throw I(e,o,`expected a finite number, got ${R(r)}`);return r}function jt(e,t,o){let r=t[o];if(!Z(r)||!Number.isInteger(r))throw I(e,o,`expected an integer, got ${R(r)}`);return r}function Rx(e,t,o,r,i){let s=Mt(e,t,o);if(s<r||s>i)throw I(e,o,`${s} is outside the supported range ${r}–${i}`);return s}function Hi(e,t,o){let r=t[o];if(!Ze(r))throw I(e,o,`expected a boolean, got ${R(r)}`);return r}function Vn(e,t,o,r){let i=t[o],s=n(i)?r.find((a)=>a===i):void 0;if(s===void 0)throw I(e,o,`${R(i)} is not declared — declared: ${r.join(", ")||"none"}`);return s}function _C(e,t,o){let r=t[o];if(!Et(r))throw I(e,o,`expected an array of path segments (strings or numbers), got ${R(r)}`);return r}function CO(e,t,o){if(t[o]===null)return null;return _C(e,t,o)}function z$(e,t,o){let r=t[o];if(!Array.isArray(r))throw I(e,o,`expected an array of document paths, got ${R(r)}`);return r.map((i,s)=>{if(!Et(i))throw I(e,o,`entry ${s} is not a document path — expected an array of segments, got ${R(i)}`);return i})}function Ce(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function pi(e,t){return{description:t,enum:[...e],type:"string"}}function ul(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function W$(e,t={}){return{description:e,type:"number",...t}}function Lo(e){return{description:e,type:"boolean"}}function Dx(e,t=!1){let o={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[o,{type:"null"}]}:{description:e,...o}}function kO(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function We(e){return{description:e,type:"string"}}function io(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Ue(e){return n(e)?[e]:e}function $t(e){let t=e;if("enum"in t)return"enum";if("const"in t)return"const";if(Array.isArray(t.oneOf))return"one-of";if(Array.isArray(t.type))return"typed";switch(t.type){case"boolean":return"boolean";case"number":case"integer":{if(t.minimum!==void 0&&t.maximum!==void 0)return"bounded-number";return t.type==="integer"?"integer":"number"}case"string":return"string";case"array":{let o=t.items?.type;if(Array.isArray(o))return io(o)?"path":"pass-through";return o==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function Lt(e,t){switch(e){case"null":return t===null;case"boolean":return Ze(t);case"string":return n(t);case"number":return Z(t)&&Number.isFinite(t);case"integer":return Z(t)&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return _(t)&&!Array.isArray(t);default:break}return!1}function Nt(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function so(e,t,o,r){let i=t[o];if(i===void 0||!r.some((s)=>Lt(s,i)))throw I(e,o,`expected ${Nt(r)}, got ${R(i)}`);return i}function _t(e){switch($t(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>R(t)).join(" | ")}`;case"const":return`the constant ${R(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>_t(t)).join(" or ");case"typed":return Nt(Ue(e.type??[]));case"boolean":return"a boolean";case"bounded-number":return`a number from ${e.minimum} to ${e.maximum}`;case"number":return"a finite number";case"integer":return"an integer";case"string":return"a non-empty string";case"path":return"a document path";case"path-list":return"a list of document paths";default:return"anything"}}function ao(e,t,o,r){let i=t[o],s=[];for(let a of r){if(a.type!==void 0&&!Ue(a.type).some((l)=>Lt(l,i)))continue;try{return Ft(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw I(e,o,`expected ${r.map((a)=>_t(a)).join(" or ")}, got ${R(i)}`)}function Ft(e,t,o,r){switch($t(r)){case"enum":return Vn(e,t,o,r.enum??[]);case"const":{let i=t[o];if(i!==r.const)throw I(e,o,`expected the constant ${R(r.const)}, got ${R(i)}`);return i}case"one-of":return ao(e,t,o,r.oneOf??[]);case"typed":return so(e,t,o,Ue(r.type??[]));case"boolean":return Hi(e,t,o);case"bounded-number":{if(r.type==="integer")jt(e,t,o);return Rx(e,t,o,r.minimum,r.maximum)}case"number":return Mt(e,t,o);case"integer":return jt(e,t,o);case"string":return St(e,t,o);case"path":return _C(e,t,o);case"path-list":return z$(e,t,o);default:return t[o]}}function EO(e,t,o){let r=t,i=r.properties??{},s=Object.keys(i),a=r.required??[],l={};for(let[c,u]of Object.entries(o)){if(u===void 0||Object.hasOwn(i,c))continue;if(r.additionalProperties===!1)throw I(e,c,`not declared — declared: ${s.join(", ")||"none"}`);l[c]=u}for(let c of s){if(o[c]===void 0&&!a.includes(c))continue;l[c]=Ft(e,o,c,i[c])}return l}var lo=20,fi="primary",Vm="secondary",q$=2,m=g({activePaneId:fi,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:fi,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Gr();return e.derived?.kind==="lens"?pn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Gr().tabOrder}}),h=Th(()=>m.activeTabId?m.tabs.get(m.activeTabId)??null:null);function Gr(){let{panes:e}=m;return e.find((t)=>t.id===m.activePaneId)??e[0]}function pn(e){return m.panes.find((t)=>t.id===e)}function Na(e){return m.panes.find((t)=>t.tabOrder.includes(e))}function kr(e){let t=pn(e);if(!t||t.id===m.activePaneId)return;m.activePaneId=t.id,L();let{activeTabId:o}=t;if(o){Ke(o);let r=m.tabs.get(o);if(r)qt(r)}}function Um(e){return m.activePaneId===e}function EC(e){let t=e??Gr().activeTabId,o=t?m.tabs.get(t):null;if(!t||!o)return null;let r=Na(t);if(!r)return null;let i=Ql(r.id);return Km(t),wh(i,t),i.activeTabId=t,m.activePaneId=i.id,L(),Ke(t),i}function TC(e){return m.panes.find((t)=>t.id!==e)??co(Vm)}function Ql(e){let t=TC(e);if(t.derived)t.derived=null;return t}function co(e){let t=pn(e);if(t)return t;return m.panes=[...m.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],pn(e)}function qm(e){if(m.panes.length<2)return;let t=e===fi?m.panes.find((s)=>s.id!==fi)?.id:e,o=t===void 0?void 0:pn(t),r=m.panes.find((s)=>s.id!==t);if(!o||!r)return;for(let s of o.tabOrder)wh(r,s);let i=o.activeTabId!==null&&U(o.activeTabId)?o.activeTabId:null;if(r.activeTabId=m.activePaneId===o.id?i??r.activeTabId??o.activeTabId:r.activeTabId??o.activeTabId,m.activePaneId=r.id,r.derived?.sourcePaneId===o.id)r.derived=null;m.panes=m.panes.filter((s)=>s.id!==o.id),L()}function Gm(e){return e.tabOrder.length===0&&e.derived===null}var U=()=>!0;function LC(e){U=e??(()=>!0)}var Ht=null;function $C(e){Ht=e}var Ut=null;function IC(e){Ut=e}function uo(){let e=0;for(let t of m.tabs.keys())if(U(t))e+=1;return e}function Kt(e){return e.tabOrder.findLast((t)=>U(t))??null}function Km(e){let t=[];for(let o of m.panes){if(!o.tabOrder.includes(e))continue;if(o.tabOrder=o.tabOrder.filter((r)=>r!==e),o.activeTabId===e)o.activeTabId=Kt(o);if(o.id!==fi&&Gm(o))t.push(o.id)}for(let o of t)qm(o)}function wh(e,t,o){if(e.tabOrder.includes(t))return;let r=o??po(e,t);e.tabOrder=[...e.tabOrder.slice(0,r),t,...e.tabOrder.slice(r)]}function fo(e){let t=0;for(let o of e.tabOrder){if(m.tabs.get(o)?.pinned!==!0)break;t+=1}return t}function po(e,t){return m.tabs.get(t)?.pinned===!0?fo(e):e.tabOrder.length}function ec(e,t=null){if(m.projectRoot&&e!==m.projectRoot)kC();m.projectRoot=e,m.projectConfig=t}function Kp(e){let t=h.value;return e!==null&&t!==null&&de(t)===de(e)}function Kd(e){if(!e)return!1;let t=m.tabs.get(e.id);return t!==void 0&&de(t)===de(e)}function Ke(e){m.mruOrder=[e,...m.mruOrder.filter((t)=>t!==e)]}var Pe=null,se=0;function L(){Pe=null,se=0}function qt(e){if(S&&e.documentPath)S.selectedPath=e.documentPath}function RC(e){let t=pn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=m.tabs.get(e),r=Na(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(m.activePaneId=r.id,!t.cycling)L(),Ke(e);qt(o)}function _i(e){if(e.background===!0){let a=m.tabs.get(e.id);if(a)return a;let l=lv({...e,preview:!1}),c=(e.paneId===void 0?void 0:pn(e.paneId))??Gr();return wh(c,l.id),m.tabs.set(l.id,l),l}let t=m.tabs.get(e.id),o=e.preview===!0&&t?.pinned!==!0,r=lv({...e,preview:o}),i=(e.paneId===void 0?void 0:pn(e.paneId))??Gr(),s;if(t)r.pinned=t.pinned,Hm(t);else{if(o){let l=Vt(i),c=l?m.tabs.get(l):null;if(c)Zd(c);DC()}let a=o?Vt(i):null;if(a)s=i.tabOrder.indexOf(a),Jd(a);wh(i,r.id,s)}return m.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Vt(e){return e.tabOrder.find((t)=>m.tabs.get(t)?.preview===!0)??null}function Xc(e){let t=m.tabs.get(e);if(t?.preview===!0)t.preview=!1}function DC(){for(let[e,t]of m.tabs)if(t.preview&&t.doc.dirty)Xc(e)}function jx(e,t){let o=m.tabs.get(e),r=Na(e);if(!o||!r)return;if(o.pinned=t,t)o.preview=!1;let i=r.tabOrder.filter((a)=>a!==e),s=i.filter((a)=>m.tabs.get(a)?.pinned===!0).length;r.tabOrder=[...i.slice(0,s),e,...i.slice(s)]}function G$(e,t){let o=m.tabs.get(e),r=Na(e);if(!o||!r)return;r.tabOrder=Gt(r,e,t)}function Gt(e,t,o){let r=m.tabs.get(t);if(!r)return e.tabOrder;let i=e.tabOrder.filter((u)=>u!==t),s=i.filter((u)=>m.tabs.get(u)?.pinned===!0).length,a=r.pinned?0:s,l=r.pinned?s:i.length,c=Math.min(Math.max(o,a),l);return[...i.slice(0,c),t,...i.slice(c)]}function Jd(e){let t=m.tabs.get(e);if(!t)return;let o=Na(e),r=o?.activeTabId===e;if(mo(t),Hm(t),m.tabs.delete(e),kx(e),Km(e),m.mruOrder=m.mruOrder.filter((l)=>l!==e),L(),o&&Gm(o))qm(o.id);if(!r)return;let i=Gr(),s=Ut?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??m.mruOrder.find((l)=>i.tabOrder.includes(l)&&U(l))??Kt(i);if(a)ae(a);else Ht?.(i.id)}function K$(){let e=[...m.tabs.values()];m.tabs.clear(),zt(),m.mruOrder=[],L();for(let t of e)Hm(t)}function zt(){m.panes=[{activeTabId:null,derived:null,id:fi,tabOrder:[]}],m.activePaneId=fi}function mo(e){if(!e.documentPath)return;let t=e.documentPath;m.closedTabs=[{documentPath:t},...m.closedTabs.filter((o)=>o.documentPath!==t)].slice(0,lo)}function yo(){let[e]=m.closedTabs;if(!e)return;return m.closedTabs=m.closedTabs.slice(1),e.documentPath}function Bt(e){if(!Pe)Pe=m.mruOrder.filter((r)=>m.tabs.has(r)&&U(r)),se=0;let t=Pe;if(t.length<2)return;se=((se+e)%t.length+t.length)%t.length;let o=t[se];return ae(o,{cycling:!0}),o}function J$(e){let t=[...m.tabs.keys()],o=[...m.tabs.values()],r=lv(e);m.tabs.set(r.id,r),zt(),m.panes[0].tabOrder=[r.id],m.mruOrder=[],L(),ae(r.id),ie(r);for(let i of t){if(i===r.id)continue;m.tabs.delete(i)}for(let i of o)Hm(i);return r}function Pt(e,t={}){ae(e,t)}function mv(e,t,o){let r=pn(t);if(!r||!m.tabs.has(e))return null;if(r.tabOrder.includes(e)){if(o!==void 0)r.tabOrder=Gt(r,e,o);return r}return Km(e),wh(r,e,o),r}function Hx(e,t,o){let r=m.tabs.get(e);if(!r)return;if(r.id=t,r.documentPath=o,wC(e))kx(e),Fm(t);m.tabs.delete(e),m.tabs.set(t,r);for(let i of m.panes)if(i.tabOrder=i.tabOrder.map((s)=>s===e?t:s),i.activeTabId===e)i.activeTabId=t;m.mruOrder=m.mruOrder.map((i)=>i===e?t:i),L(),Dt(r)}function Y$(e,t){e.registerAll([...ho(t),...bo(t)])}function ho(e){let t=()=>uo()>1;return[{id:"document.nextTab",title:"Next Tab",category:"Document",level:"document",keybinding:["ctrl+tab","mod+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Bt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Bt(-1)}},{args:Ce({path:We('Project-relative path of the file to open, e.g. "pages/about.json" or "components/nav-bar.json". It must exist.')}),id:"document.open",title:"Open Document",category:"Document",level:"project",menus:["palette"],group:"1_file",when:(o)=>o.project.open,requires:"an open project",aiTool:{description:"Open a project file as the active document; the document tools then operate on it. Use it when the user should SEE the page, or for iterative visual refinement after creating a page or component.",name:"open_document",report:({after:o,args:r})=>{let i=St("document.open",r,"path"),s=h.value?.documentPath??null;if(s!==i)return`Opened "${i}", but the active document is ${s===null?"none":`"${s}"`}.`;let a=o.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${Up[o.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${i}" is the active document, ${a}.`}},run:async(o,r)=>{let i=St("document.open",r,"path");if(await e.openFile(i),![...m.tabs.values()].some((s)=>s.documentPath===i))throw RangeError(`command "document.open" argument "path": "${i}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:Ce({file:We('Project-relative path of the file to open in the other pane, e.g. "pages/about.json". It must exist.')}),id:"document.openToSide",title:"Open to the Side",category:"Document",level:"project",menus:["context/file","palette"],group:"1_file",when:(o)=>o.project.open,requires:"an open project",undo:"none",run:async(o,r)=>{let i=St("document.openToSide",r,"file"),s=Ql(Gr().id);if(await e.openFile(i,{paneId:s.id}),![...m.tabs.values()].some((a)=>a.documentPath===i)){if(Gm(s)&&s.id!==fi)qm(s.id);throw RangeError(`command "document.openToSide" argument "file": "${i}" could not be opened — it `+"does not exist, or no editor claims its format. Problems has the reason.")}}},{id:"document.reopenClosed",title:"Reopen Closed Document",category:"Document",level:"document",keybinding:"mod+shift+t",menus:["context/tab","palette"],group:"1_file",enablement:()=>m.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let o=yo();if(o)await e.openFile(o)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:()=>{let o=m.activeTabId,r=o?m.tabs.get(o):null;if(o&&r)jx(o,!r.pinned)}},{args:Ce({pinned:Lo("True to pin the active document's tab, false to unpin it.")}),id:"document.setPinned",title:"Set Document Pinned",category:"Document",level:"document",menus:["palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:(o,r)=>{let i=m.activeTabId;if(i&&m.tabs.get(i))jx(i,Hi("document.setPinned",r,"pinned"))}},{id:"document.keepOpen",title:"Keep Document Open",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,enablement:()=>{let o=m.activeTabId;return o!==null&&m.tabs.get(o)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let o=m.activeTabId;if(o)Xc(o)}}]}function bo(e){let t=()=>m.panes.length>1;return[{id:"pane.splitRight",title:"Split Right",category:"View",level:"document",keybinding:"mod+\\",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{EC()}},{args:Ce({path:We("Project-relative path of the document to open beside this one.")}),id:"pane.compareWith",title:"Compare With…",category:"View",level:"document",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:async(o,r)=>{let i=St("pane.compareWith",r,"path"),s=Gr();if((s.activeTabId?m.tabs.get(s.activeTabId):null)?.documentPath===i)throw RangeError(`command "pane.compareWith" argument "path": "${i}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(Ql(s.id).id,i)}},{id:"pane.focusPrimary",title:"Focus Primary Pane",category:"View",level:"document",keybinding:"mod+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{kr(fi)}},{id:"pane.focusSecondary",title:"Focus Side Pane",category:"View",level:"document",keybinding:"mod+alt+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{kr(Vm)}},{id:"pane.unsplit",title:"Close Side Pane",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:t,requires:"a second pane",undo:"none",run:xo}]}function xo(){let e=m.panes.find((t)=>t.derived!==null);if(e?.id===fi){if(e.derived=null,!Gm(e))return}qm(e?.id??Vm)}
2
- export{bC,Pn,yx,iv,Wt,ln,go,wx,ov,Yc,dO,vC,Wp,xx,A$,fh,_x,Vp,Ia,dl,rv,Up,Qs,uO,Sx,mh,Cx,sv,yC,hO,Fm,kx,wC,O$,av,Fn,Ur,Ex,gh,Tx,pO,Lx,M$,jm,fO,an,lv,xC,P$,mO,Hm,Tn,cv,F$,dv,uv,Oe,gO,$x,Ra,Ix,bO,vO,Bm,yO,wO,xO,_O,hv,j$,SO,H$,B$,St,ti,Rx,Hi,Vn,_C,CO,z$,Ce,pi,ul,W$,Lo,Dx,kO,We,EO,TO,Bi,Vd,Un,Zc,Nx,Ax,SC,LO,Da,bh,vh,pv,Ox,$O,ir,Y,Ud,IO,RO,V$,DO,fv,NO,AO,CC,OO,or,yh,U$,zm,Mx,MO,qp,Qe,Wm,Cr,PO,Px,FO,Fx,jO,HO,qd,BO,qr,zO,Gp,WO,VO,UO,Gd,qO,GO,KO,JO,YO,kC,ZO,fi,Vm,q$,m,h,Gr,pn,Na,kr,Um,EC,TC,Ql,qm,Gm,LC,$C,IC,Km,wh,ec,Kp,Kd,RC,_i,Xc,DC,jx,G$,Jd,K$,J$,Pt,mv,Hx,Y$};
3
-
4
- //# debugId=623CA1FAFE36CF0264756E2164756E21
5
- //# sourceMappingURL=studio-k2sz13zg.js.map
@@ -1,5 +0,0 @@
1
- import{_x,Ia,dl,m,_i,Pt}from"./studio-k2sz13zg.js";import{fS,_w,RT}from"./studio-ea5m9kg5.js";import{Qk,eE,nD}from"./studio-jeraxdgv.js";import{o_,r_,_k}from"./studio-6cwj6xrx.js";import{Uk,qk,UR}from"./studio-nm4szey4.js";var n={children:[],tagName:"div"},A2=new Set(Object.values(_x));function n_(e){return A2.has(e)}function bk(e){let r=Ia(e),o=m.tabs.get(r);if(o)return Pt(r),o;return _i({capabilities:{modes:[_x[e]]},document:structuredClone(n),documentPath:null,id:r})}function vk(e,r){_i({background:!0,capabilities:{modes:[_x[e]]},document:structuredClone(n),documentPath:null,id:Ia(e),paneId:r})}function i_(e,r){let o=dl(r.id);if(o==="media")return fS(e,r);if(o==="content")return Qk(e,r);if(o==="settings")return Uk(e,r);return o_(e,r)}function Bg(e){_w(e),eE(e),r_(e),qk(e)}function yk(e,r){let{paneId:o}=e;if(i_(o,r))return;Bg(o);let t=dl(r.id);if(t==="media"){RT(e,r);return}if(t==="content"){nD(e,r);return}if(t==="settings"){UR(e,r);return}_k(e,r)}
2
- export{A2,n_,bk,vk,i_,Bg,yk};
3
-
4
- //# debugId=3599BF3258AEC1FC64756E2164756E21
5
- //# sourceMappingURL=studio-k3m4jkdk.js.map
@@ -1,5 +0,0 @@
1
- var tS="__other__";function as(n){return n.trim().toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z\d-]/g,"")}function ZE(n){let e=n.lastIndexOf(".");return e>0?n.slice(e):""}function XE(n,e,i){let t=n.trim();if(i===void 0||e==="__other__")return t;if(i.kind==="fixed"){let o=as(t);return o===""?"":`${o}${i.ext}`}return t.toLowerCase().endsWith(e.toLowerCase())?t:`${t}${e}`}function gb(n,e,i){let{choice:t,dir:o,known:l=new Set,rows:f=null,taken:u}=i,a=n.trim();if(!a)return t?.kind==="fixed"?"Enter a name.":"Enter a file name.";if(t?.kind==="fixed"&&as(a)==="")return"Enter at least one letter or number.";let s=a.replaceAll("\\","/");if(s.startsWith("/")||s.endsWith("/"))return"Enter a name, not a path that starts or ends with a slash.";if(s.split("/").includes(".."))return"A name cannot step outside the destination folder.";if(s.includes("/")&&t!==void 0&&e!=="__other__")return`Pick Other… to create a file in a subfolder of ${o==="."?"the project root":o}.`;let r=ZE(s);if(e!==""&&e!=="__other__"&&r!==""&&r.toLowerCase()!==e.toLowerCase()&&l.has(r.toLowerCase()))return`You picked ${f?.find((g)=>g.value===e)?.label??e}; this name ends in ${r}.`;if(t?.kind==="locked"&&e==="__other__"){if(r!==""&&r.toLowerCase()!==t.ext.toLowerCase()&&l.has(r.toLowerCase()))return t.because}let d=XE(n,e,t);return u.has(d.toLowerCase())?`${d} already exists in ${o}/.`:""}
2
- export{tS,as,ZE,XE,gb};
3
-
4
- //# debugId=EAD3F8EADE61306E64756E2164756E21
5
- //# sourceMappingURL=studio-kg5ya5r2.js.map
@@ -1,5 +0,0 @@
1
- import{Un,m,Pt}from"./studio-k2sz13zg.js";import{ID}from"./studio-cg1bfyhf.js";import{Zu}from"./studio-rtfnhrdg.js";import{le}from"./studio-j3d2fjqz.js";var e="edit",a=new Set(["edit","design"]);function r(t){for(let i of m.tabs.values())if(i.documentPath===t)return i;return null}async function jl(t){if(!Zu(t)){let o=Un(t);if(o&&!o.fileBacked)return ID(t);let{openFileInTab:s}=await (le("b2tcppdd"),import("./files-b2tcppdd.js"));return await s(t),r(t)}let{openFileInTab:i}=await (le("b2tcppdd"),import("./files-b2tcppdd.js"));await i(t);let n=r(t);if(!n)return null;if(!a.has(n.session.ui.canvasMode)&&n.capabilities.modes.includes(e))n.session.ui.canvasMode=e,n.session.ui.preview=!1;return Pt(n.id),n}
2
- export{jl};
3
-
4
- //# debugId=FBE616D1FC85E80864756E2164756E21
5
- //# sourceMappingURL=studio-khwbgrtg.js.map
@@ -1,5 +0,0 @@
1
- import{p,_e}from"./studio-jws1a87n.js";import{Q}from"./studio-nqxqf8p2.js";import{ee}from"./studio-8z66jk4z.js";function hh(){return _e()&&ee(p().findReferences)}function u(e){return`${e.path??""}\x00${e.tagName??""}`}var i=new Map,o=new Map;function zd(e){if(!hh())return{status:"unsupported"};return i.get(u(e))??(o.has(u(e))?{status:"pending"}:null)}async function $a(e){if(!hh())return{status:"unsupported"};if(!e.path&&!e.tagName)return{status:"failed",message:"no target to look for"};let t=u(e),s=i.get(t);if(s)return s;let r=o.get(t);if(r)return r;let n={};if(e.path!==void 0)n.path=e.path;if(e.tagName!==void 0)n.tagName=e.tagName;let a=(async()=>{try{return{result:await p().findReferences(n),status:"ready"}}catch(c){return{message:Q(c),status:"failed"}}})();o.set(t,a);let d=f,l=await a;if(o.get(t)===a)o.delete(t);if(d!==f)return l;return i.set(t,l),l}function $$(e){return i.delete(u(e)),$a(e)}var f=0,g=new Set;function Sr(){f+=1,i.clear(),o.clear();for(let e of g)e()}function I$(e){return g.add(e),()=>{g.delete(e)}}function h(e){let t=0;for(let s of e.files)if(s.path.startsWith("pages/"))t+=1;return{others:e.files.length-t,pages:t}}function tv(e){let{others:t,pages:s}=h(e);if(s===0&&t===0)return"Not used yet";let r=t===1?"file":"files";if(s===0)return`Used in ${t} ${r}`;let n=`Used on ${s} page${s===1?"":"s"}`;return t===0?n:`${n} and ${t} other ${r}`}function R$(e,t){if(e.status==="unsupported")return null;if(e.status==="pending")return"Counting references…";if(e.status==="failed")return`References could not be counted (${e.message}) — this may break more than it appears to.`;let{files:s,refsTotal:r}=e.result;if(s.length===0)return t==="delete"?"Nothing else in this project refers to it.":"Nothing else in this project refers to it, so nothing needs updating.";let n=`${r} reference${r===1?"":"s"} in ${s.length} file${s.length===1?"":"s"}`,a=e.result.errors.length>0?" (at least — some documents could not be read)":"";if(t==="delete")return`${n}${a} will break. Those files stay on disk; the references in them stop resolving.`;if(t==="convert")return`${n}${a} will be updated automatically to point at the new file.`;return`${n}${a} will be updated automatically. Nothing else changes.`}function nv(e){return e.files.toSorted((t,s)=>s.count-t.count||t.path.localeCompare(s.path))}
2
- export{hh,zd,$a,$$,Sr,I$,tv,R$,nv};
3
-
4
- //# debugId=664F4791B8608E0364756E2164756E21
5
- //# sourceMappingURL=studio-mx6wzh25.js.map
@@ -1,5 +0,0 @@
1
- import{He}from"./studio-8wnvtr4z.js";import{ee}from"./studio-8z66jk4z.js";var f=3;function p(e,t,n){return Math.min(n,Math.max(t,e))}function eS(e){let t=Math.max(0,Math.trunc(e.count)),n=Math.max(1,Math.trunc(e.columns??1)),o=Math.ceil(t/n);if(!(e.rowHeight>0)||!(e.viewportHeight>0))return{end:t,padBottom:0,padTop:0,start:0,totalRows:o};let r=Math.max(0,Math.trunc(e.overscanRows??f)),i=Math.max(0,e.scrollTop),m=Math.floor(i/e.rowHeight),w=Math.ceil(e.viewportHeight/e.rowHeight)+1,l=p(m-r,0,o),a=p(m+w+r,l,o);return{end:Math.min(t,a*n),padBottom:(o-a)*e.rowHeight,padTop:l*e.rowHeight,start:Math.min(t,l*n),totalRows:o}}function M(e,t){return e.start===t.start&&e.end===t.end&&e.totalRows===t.totalRows&&e.padTop===t.padTop&&e.padBottom===t.padBottom}function R(e){let{scroller:t,list:n,count:o,rowHeight:r,columns:i,onChange:m,overscanRows:w}=e,l={end:0,padBottom:0,padTop:0,start:0,totalRows:0},a=!1;function c(){if(a)return;let d=eS({columns:i?.()??1,count:o(),overscanRows:w??f,rowHeight:r(),scrollTop:n?H(t,n):t.scrollTop,viewportHeight:t.clientHeight}),b=!M(l,d);if(l=d,b)m(d)}t.addEventListener("scroll",c,{passive:!0});let u=0,T=()=>{if(u!==0)return;u=requestAnimationFrame(()=>{u=0,c()})},s=null;if(ee(globalThis.ResizeObserver)){if(s=new ResizeObserver(T),s.observe(t),n)s.observe(n)}return c(),{destroy(){if(a=!0,t.removeEventListener("scroll",c),s?.disconnect(),s=null,u!==0)cancelAnimationFrame(u),u=0},measure:c,range:()=>l}}function v(e){for(let t=e;t;t=t.parentElement){if(t.scrollHeight<=t.clientHeight)continue;let n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="overlay")return t}return null}function g(e){let t=h.get(e);if(t&&t.isConnected&&e.isConnected&&t.contains(e))return t;let n=L(e)??v(e);if(n)h.set(e,n);else h.delete(e);return n}var x="data-jx-scroller";function L(e){return e.isConnected?e.closest(`[${x}]`):null}function H(e,t){if(e===t)return Math.max(0,e.scrollTop);return Math.max(0,He(e).top-He(t).top)}function mw(e,t){let n=e?.isConnected===!0?g(e):null;if(!n||!e){let o=Math.max(0,Math.trunc(t.count));return{end:o,padBottom:0,padTop:0,start:0,totalRows:o}}return eS({columns:t.columns??1,count:t.count,overscanRows:t.overscanRows??f,rowHeight:t.rowHeight,scrollTop:H(n,e),viewportHeight:n.clientHeight})}function W(e){let t=e.listOffset+e.index*e.rowHeight,n=t+e.rowHeight;if(t<e.scrollTop)return Math.max(0,t);if(n>e.scrollTop+e.viewportHeight)return Math.max(0,n-e.viewportHeight);return null}function gw(e,t,n){let o=e?.isConnected===!0?g(e):null;if(!o||!e||t<0||!(n>0))return!1;let{scrollTop:r}=o,i=W({index:t,listOffset:r-H(o,e),rowHeight:n,scrollTop:r,viewportHeight:o.clientHeight});if(i===null)return!1;return o.scrollTop=i,!0}function zD(e,t,n){let o=e?.querySelector(t);return o&&o.offsetHeight>0?o.offsetHeight:n}var h=new WeakMap;function bw(e,t,n){let o=g(t);if(e&&e.list===t&&e.scroller===o)return e;if(e?.window.destroy(),!o)return null;return{list:t,scroller:o,window:R({count:n.count,list:t,onChange:()=>n.onChange(),rowHeight:n.rowHeight,scroller:o})}}
2
- export{eS,mw,gw,zD,bw};
3
-
4
- //# debugId=1115D00536CEDE4C64756E2164756E21
5
- //# sourceMappingURL=studio-mxs3ar9t.js.map
@@ -1,5 +0,0 @@
1
- import{ae}from"./studio-b2qpt0xy.js";import{Q}from"./studio-nqxqf8p2.js";import{g}from"./studio-y60sts62.js";import{Wp,fh}from"./studio-k2sz13zg.js";import{cA}from"./studio-2r90cts3.js";import{Qn,L,R,nt}from"./studio-0w2dr0q8.js";import{n}from"./studio-8z66jk4z.js";var E=[{id:"general",intro:"",label:"General",note:""},{id:"integrations",intro:"Turn on what your site needs. Each one adds its own options where you use it.",label:"Integrations",note:""},{id:"advanced",intro:"Changes here affect every page. Most sites never need them.",label:"Advanced",note:"For developers"}],BR="integrations";function zR(e){return E.some((t)=>t.id===e)}var U="overview",f=new Map,T=new Set;function k(){for(let e of T)e()}function Sd(){k()}function E_(e){return T.add(e),()=>{T.delete(e)}}function Fl(e){f.set(e.key,e),k()}function WR(e){if(f.delete(e))k()}function q(){return[...f.values()].toSorted((e,t)=>e.order-t.order)}function zy(){let e=q();return E.flatMap((t)=>{let a=e.filter((r)=>(r.group??"integrations")===t.id);return a.length===0?[]:[{id:t.id,intro:t.intro,label:t.label,note:t.note,sections:a}]})}function Wk(){return zy().flatMap((e)=>e.sections.map((t)=>t.key))}function w(e){return f.get(e)}var b=null,h=U;function I(){if(b!==null&&f.has(b))return h=b,b=null,h;if(f.has(h))return h;return Wk()[0]??h}function T_(e){if(f.has(e))h=e,b=null;else b=e;k()}var C={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsPane",$description:"Project Settings' home (§17.1, §22.9): the Settings workspace's surface, filling a pane's stage. A head names the workspace and carries the Back control, which says where it goes; under it, the settings editor's two columns, the grouped section list and the section body. It draws no section: `panels/settings-pane.ts` keeps the registry, decides which section is current, and renders whichever one that is into the one empty `[part=\"section-host\"]` island this document leaves for it (studio-ui-guidelines.md §9.4), because a section renderer may be a lit template or a mounted document and neither can share a container with this one. The list is three vertical `tablist`s, one per group (General, Integrations, Advanced), each named by its group heading: a tablist may own only tabs, so a heading between two runs of rows has to END one list rather than sit inside it. Each group is one tab stop and the arrow keys move within it. Under the groups, a Moved footnote names what left Project Settings for a workspace, each with a button that goes there.",tagName:"div",attributes:{part:"settings","data-jx-region":"${state.region}",role:"region","aria-labelledby":"settings-pane-heading"},style:{$description:"Fills the pane's stage by its own geometry, as the Publish and Media homes do: the stage is `position: relative`, so the home takes the whole of it, and each column scrolls itself. No part below is named `body`, `field`, `label`, `error`, `text` or `actions`: sections mount kit controls and documents of their own inside this one, the kit is light DOM, and a rule keyed on one of their part names here would reach into them.",position:"absolute",inset:"0",display:"flex",flexDirection:"column",boxSizing:"border-box",minHeight:"0",background:"var(--bg)",color:"var(--fg)",fontFamily:"var(--jx-font-sans)",textAlign:"initial",'& [part="head"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-5)",borderBottom:"1px solid var(--border)"},'& [part="heading"]':{flex:"1",margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600"},'& [part="columns"]':{display:"flex",flex:"1",minHeight:"0"},'& [part="nav"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-4)",width:"220px",minWidth:"220px",flexShrink:"0",padding:"var(--jx-space-3) var(--jx-space-3) var(--jx-space-3) var(--jx-space-2)",borderRight:"1px solid var(--border)",overflowY:"auto",fontSize:"13px"},'& [part="group"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="group-title"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",margin:"0",padding:"0 var(--jx-space-3)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",fontWeight:"600",letterSpacing:"0.04em",textTransform:"uppercase"},'& [part="group-note"]':{$description:`The Advanced group's "For developers": a qualifier on the heading, not a second heading, so it reads at the heading's size without its weight.`,fontWeight:"400",letterSpacing:"0",textTransform:"none"},'& [part="group-note"]:empty':{display:"none"},'& [part="group-tabs"]':{$description:"The rule a vertical strip draws on its trailing edge is the column's own here: the nav draws one border for all three groups, so each strip drawing its own would stack three short rules beside it.",borderInlineEnd:"0"},'& [part="nav-item"]':{$description:"Full-bleed rows, which a tab is not by default: `jx-tab` centres its label and caps itself at 220px because a horizontal strip is a row of chips. In the nav column the row IS the target, so the label goes to the leading edge and the cap comes off.",maxWidth:"none",justifyContent:"flex-start",padding:"var(--jx-space-2) var(--jx-space-3)"},'& [part="moved"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",marginTop:"auto",padding:"var(--jx-space-3)",borderTop:"1px solid var(--border)",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)"},'& [part="moved-title"]':{margin:"0",fontWeight:"600",color:"var(--fg)"},'& [part="moved-row"]':{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-1)"},'& [part="content"]':{flex:"1",minWidth:"0",overflowY:"auto",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-6)"},'& [part="group-intro"]':{margin:"0 0 var(--jx-space-3)",color:"var(--fg-dim)",fontSize:"13px",maxWidth:"1200px"},'& [part="group-intro"]:empty':{display:"none"},'& [part="section-host"]':{$description:"Wide enough for a map-layout section's list and editor side by side, and no wider: on a large monitor a form stretched to the stage's full width is a line too long to read.",display:"block",minWidth:"0",maxWidth:"1200px"},'& [part="empty"]':{$description:"What the body says when the active section is registered by nobody: every section unregistering at once, which is a project closing while Settings is on screen. A blank column beside a list reads as a broken surface, so it says which it is.",display:"flex",alignItems:"center",justifyContent:"center",minHeight:"120px",margin:"0",color:"var(--fg-dim)",fontSize:"13px"},'& [part="failure"]':{$description:"A section whose renderer threw or rejected. It is said where the section would have been, in the reader's line of sight, because a section that silently draws nothing is indistinguishable from one with nothing to say.",margin:"0",padding:"var(--jx-space-3)",border:"1px solid var(--danger)",borderRadius:"var(--radius)",color:"var(--fg)",fontSize:"13px"}},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"jx-action-button",attributes:{part:"back"},$props:{size:"sm",quiet:!0,icon:"arrow-left"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/back"},value:[]}]},children:[{tagName:"span",textContent:"${state.backLabel}"}],$description:"Back to the workspace Settings was opened from, named, as the pane context bar's Back is in a workspace with no tab strip (§22.1): the top bar draws no tab for Settings, so nothing else on screen says where the author came from."},{tagName:"h2",attributes:{part:"heading",id:"settings-pane-heading"},textContent:"${state.heading}"}]},{tagName:"div",attributes:{part:"columns",role:"none"},children:[{tagName:"div",attributes:{part:"nav",role:"none"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"group",role:"none","data-group":"${$map.item.id}"},children:[{tagName:"h3",attributes:{part:"group-title",id:"${$map.item.titleId}"},children:[{tagName:"span",textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"group-note"},textContent:"${$map.item.note}"}]},{tagName:"jx-tabs",attributes:{part:"group-tabs",selected:"${state.active}",orientation:"vertical"},$props:{label:{$ref:"$map/item/tabsLabel"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/selectSection"},value:[{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"$map/item/sections"},key:{$ref:"$map/item/key"},map:{tagName:"jx-tab",attributes:{part:"nav-item",id:"${$map.item.tabId}","data-section":"${$map.item.key}",value:"${$map.item.key}",label:"${$map.item.label}",panel:"settings-pane-panel"}}}]}]}},{tagName:"div",attributes:{part:"moved",role:"group","aria-labelledby":"settings-pane-moved"},children:[{tagName:"p",attributes:{part:"moved-title",id:"settings-pane-moved"},textContent:"Moved"},{$prototype:"Array",items:{$ref:"#/state/moved"},key:{$ref:"$map/item/workspace"},map:{tagName:"div",attributes:{part:"moved-row","data-moved":"${$map.item.workspace}"},children:[{tagName:"span",textContent:"${$map.item.what} →"},{tagName:"jx-button",attributes:{part:"moved-link"},$props:{size:"sm",quiet:!0,label:{$ref:"$map/item/linkLabel"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openMoved"},value:[{$ref:"$map/item/workspace"}]}]},children:[{tagName:"span",textContent:"${$map.item.place}"}]}]}}]}]},{tagName:"jx-tab-panel",attributes:{part:"content",id:"settings-pane-panel"},$props:{active:!0,labelledby:{$ref:"#/state/activeTabId"}},children:[{$description:`The current group's intro ("Changes here affect every page. Most sites never need them."), above whichever of its sections is showing. General has none, and an empty sentence draws nothing.`,tagName:"p",attributes:{part:"group-intro"},textContent:"${state.intro}"},{$description:"The island, and it stays empty: a settings section renders itself, into a host this document never writes into and never reads back (studio-ui-guidelines.md §9.4).",tagName:"div",attributes:{part:"section-host"}},{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/hasSection"},cases:{false:{tagName:"p",attributes:{part:"empty"},textContent:"${state.empty}"}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},$switch:{$ref:"#/state/failureState"},cases:{failed:{tagName:"p",attributes:{part:"failure",role:"alert"},textContent:"${state.failure}"}}}]}]}]};L("settings-pane",C);function J(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function A(e){return e===""?"ok":"failed"}function H(e,t,a){let r=g({...t,...a,failureState:A(t.failure)});e.textContent="",delete e._$litPart$;let o=null,s=!1,p=null,S=R("settings-pane",r,e,{onNodeCreated:(i,d,m)=>{if(!s&&i instanceof HTMLElement&&J(m)==="section-host")p=i}}).then((i)=>{if(s){i.dispose();return}o=i});return{attached:()=>{if(s)return!1;let i=o?.root;return i===void 0?!0:i instanceof HTMLElement&&e.contains(i)},body:()=>p,dispose(){s=!0,o?.dispose(),o=null,p=null},async focusActive(){let i=o?.root,d=i instanceof HTMLElement?[...i.querySelectorAll('[part="nav-item"]')].find((y)=>y.dataset.section===r.active):void 0;if(!d)return;let m=d.closest("jx-tabs");if(m&&d.getAttribute("aria-selected")!=="true")await new Promise((y)=>{m.addEventListener("jx-ready",()=>{y()},{once:!0})});if(!s)d.focus()},ready:S,update(i){r.region=i.region,r.heading=i.heading,r.backLabel=i.backLabel,r.groups=i.groups,r.moved=i.moved,r.activeTabId=i.activeTabId,r.empty=i.empty,r.intro=i.intro,r.hasSection=i.hasSection,r.failure=i.failure,r.failureState=A(i.failure),r.active=i.active}}}var K=fh("settings").title,Y="No settings sections.",G=[{place:"Styles › Variables",view:"variables",what:"Colors and fonts",workspace:"styles"},{place:"Publish › Hosting",publishTab:"hosting",what:"Hosting and domain",workspace:"publish"},{inspector:"page",place:"Page tab",what:"Head and SEO defaults",workspace:"design"}];function W(e){return`settings-nav-${e}`}function X(e){return G.find((t)=>t.workspace===e)??null}function P(e,t){let a=I(),r=zy();return{active:a,backLabel:e.backLabel(),activeTabId:W(a),empty:Y,failure:t,groups:r.map((o)=>({id:o.id,label:o.label,note:o.note,sections:o.sections.map((s)=>({key:s.key,label:s.label,tabId:W(s.key)})),tabsLabel:o.note===""?o.label:`${o.label}, ${o.note.toLowerCase()}`,titleId:`settings-group-${o.id}`})),hasSection:w(a)!==void 0,heading:K,intro:w(a)?.intro||(r.find((o)=>o.sections.some((s)=>s.key===a))?.intro??""),moved:G.map((o)=>{let{title:s}=fh(o.workspace),p=o.place??s;return{linkLabel:`${o.what}: ${p}. Go to ${s}`,place:p,what:o.what,workspace:o.workspace}}),region:e.region}}function O(e,t){let a=!1,r=null,o=null,s=null,p="",S=0,i=H(e,P(t,p),{back:()=>{t.back()},openMoved:(l)=>{let c=X(l);if(c!==null)t.openMoved(c.workspace,c.inspector,c.view,c.publishTab)},selectSection:(l)=>{T_(l)}});function d(l,c,u){if(a||u!==S)return;p=`Could not show ${w(l)?.label??l}: ${c}`,i.update(P(t,p))}function m(l){if(a)return;let c=I(),u=i.body();if(u!==r)r=u,s=null;if(!u||!l&&s===c){i.update(P(t,p));return}let M=s!==c;s=c,p="",i.update(P(t,p));let j=w(c);if(!j){o=null,u.replaceChildren();return}if(M||!o||o.parentElement!==u)o=document.createElement("div"),u.replaceChildren(o);S+=1;let N=S;try{let x=j.render(o);if(x instanceof Promise)x.catch((z)=>{d(c,Q(z),N)})}catch(x){d(c,Q(x),N)}}let y=E_(()=>{m(!0)}),F=i.ready.then(()=>{m(!0)});return{attached:()=>i.attached(),dispose(){if(a)return;a=!0,y(),i.dispose()},focusActive:()=>i.focusActive(),ready:F}}var Z="settings";function Vk(e){return Qn(e,Z)}var v=new Map,D=new Set;function _(){let e=cA();return e===null||e==="settings"?Wp:e}async function ee(){await nt("view.setWorkspace",{workspace:_()},"Settings")}async function te(e,t,a,r){if(a!==void 0){await nt("styles.open",{view:a},"Settings");return}if(r!==void 0){await nt("publish.open",{tab:r},"Settings");return}if(await nt("view.setWorkspace",{workspace:e},"Settings"),t===void 0)return;if(await nt("view.setRightPanel",{open:!0},"Settings"),ae()?.isEnabled("view.setRightTab")===!0)await nt("view.setRightTab",{tab:t},"Settings")}function Uk(e,t){let a=v.get(e);return a!==void 0&&a.tabId===t.id&&a.wrap.isConnected&&a.pane.attached()}function qk(e){let t=v.get(e);if(!t)return;v.delete(e),t.pane.dispose()}async function V(e,t){if(await t.pane.ready,v.get(e)===t)await t.pane.focusActive()}async function VR(e){let t=v.get(e);if(t?.wrap.isConnected===!0&&t.pane.attached()){await V(e,t);return}D.add(e)}var ne={back:()=>{ee()},backLabel:()=>`Back to ${fh(_()).title}`,openMoved:(e,t,a,r)=>{te(e,t,a,r)}};function UR(e,t){let{paneId:a,wrap:r}=e;if(Uk(a,t))return;qk(a);let s={pane:O(r,{...ne,region:Vk(a)}),tabId:t.id,wrap:r};if(v.set(a,s),D.delete(a))V(a,s)}
2
- export{BR,zR,Sd,E_,Fl,WR,zy,Wk,T_,Vk,Uk,qk,VR,UR};
3
-
4
- //# debugId=21F25BCFA0743F7364756E2164756E21
5
- //# sourceMappingURL=studio-nm4szey4.js.map
@@ -1,4 +0,0 @@
1
- function Q(n){return n instanceof Error?n.message:String(n)}export{Q};
2
-
3
- //# debugId=2F42A6265BF5F6D664756E2164756E21
4
- //# sourceMappingURL=studio-nqxqf8p2.js.map
@@ -1,5 +0,0 @@
1
- import{de,C}from"./studio-y60sts62.js";import{ee,_}from"./studio-8z66jk4z.js";var st={functionEditor:null,blockActionBarEl:null,selDragCleanup:null,dndCleanups:[],elementsCollapsed:new Set,elementsFilter:"",_currentDropTargetRow:null,layerDragSourceHeight:0,_completionRegistered:!1,_layersCollapsed:null};var m=0;function XO(){return m+=1,m}var l=new Map;function bo(e){let r=l.get(e);if(!r)r=v(e),l.set(e,r);return r}function v(e){return{centerObserver:null,monacoDiffEditor:null,monacoEditor:null,needsCenter:!0,panX:0,panY:0,panels:[],paneId:e,panzoomWrap:null,stage:null,prevCanvasMode:null,prevStylebookCustomizedOnly:null,prevStylebookFilter:null,renderGeneration:0,sourceCollabCleanup:null,stageScrollbar:null,wrap:null}}function xh(e){return e.wrap}function Jp(){return[...l.values()]}function Qc(e){if(!e)return null;for(let r of l.values())if(xh(r)?.contains(e))return r;return null}function g(e){for(let r of e.panels)r.renderScope?.stop(),r.renderScope=null;e.panels.length=0,e.prevCanvasMode=null}function QO(e,r){let t=bo(e);return t.wrap=r,g(t),t}function eM(e){if(l.get(e))Z$(e);let t=v(e);return l.set(e,t),t}var S=null;function tM(e){S=e}function Z$(e){let r=l.get(e);if(!r)return;S?.(r),g(r),y(e)}function y(e){l.delete(e)}var Yp="commit";function b(e){return _(e)&&ee(e.then)}function gv(e){let r=new Map,t=new Map,o=new Map,a=!1,u=!1,c=!1;function f(n,i){if(!b(i))return i;let s=i.finally(()=>{if(o.get(n)===s)o.delete(n)});return o.set(n,s),s}let d={arm(n,i,s){clearTimeout(r.get(n)),t.set(n,s),r.set(n,setTimeout(()=>{r.delete(n),t.delete(n),f(n,s())},i))},cancel(){for(let n of r.values())clearTimeout(n);r.clear(),t.clear()},flush(n){let i=t.get(n);if(!i)return o.get(n);return clearTimeout(r.get(n)),r.delete(n),t.delete(n),f(n,i())},ahead:()=>a,markAhead(){a=!0},typed:()=>u,markTyped(){a=!0,u=!0},markSettled(){a=!1,u=!1},shared:()=>c,markShared(){c=!0}};return e._writes=d,d}var T={logic:{holds:"The handler you were typing",reached:"written into",source:"Logic"},source:{holds:"The source you were typing",reached:"parsed into",source:"Editor"}};function p(e,r,t){if(e._writes?.typed()!==!0)return!0;let a=e._editingTab??null,u=a?.documentPath??"Untitled",{holds:c,reached:f,source:d}=T[r],n=t?{detail:h(t.error)}:{};if(n.key=`buffer-discarded:${r}:${a?.id??"none"}`,n.source=d,a?.documentPath)n.path=a.documentPath;return C.warn(`${c} was discarded — it was never ${f} "${u}".`,n),!1}function h(e){return e instanceof Error?e.stack??e.message:String(e)}function bv(e,r){let t=e?._writes;if(!e||!t)return!0;let o;try{o=t.flush(Yp)}catch(a){return t.cancel(),p(e,r,{error:a})}if(t.cancel(),b(o))return o.then(()=>p(e,r,null),(a)=>p(e,r,{error:a})),!0;return p(e,r,null)}function X$(e){e?._writes?.cancel()}function Yd(e){return Boolean(e?.getModel())}function Zp(e,r){if(!Yd(e)||e.hasTextFocus()||e._writes?.ahead()||e._writes?.shared())return!0;return r!==void 0&&e.getValue()!==r}function w(e){let r=de(e);return[...Jp().map((o)=>o.monacoEditor),st.functionEditor].filter((o)=>o!=null&&o._editingTab!=null&&de(o._editingTab)===r&&Yd(o))}async function Zd(e){for(let r of w(e)){if(!Yd(r))continue;try{await r._writes?.flush(Yp)}catch(t){let o={detail:h(t),key:`buffer-commit:${e.id}`,source:"Editor"};if(e.documentPath)o.path=e.documentPath;C.error(`Could not save the editor's contents into "${e.documentPath??"Untitled"}".`,o)}}}function Xp(e){return w(e).some((r)=>r._writes?.typed()===!0)}
2
- export{st,XO,bo,xh,Jp,Qc,QO,eM,tM,Z$,Yp,gv,bv,X$,Yd,Zp,Zd,Xp};
3
-
4
- //# debugId=623348306DB8011D64756E2164756E21
5
- //# sourceMappingURL=studio-qn7z4krm.js.map
@@ -1,5 +0,0 @@
1
- import{p,_e}from"./studio-jws1a87n.js";import{Q}from"./studio-nqxqf8p2.js";import{$a,R$}from"./studio-mx6wzh25.js";import{ge,ea,ne,g,de,C,pl,of}from"./studio-y60sts62.js";import{fO,hv,j$,Da,Y,fv,Wm,Cr,Px,Fx,m,h,_i}from"./studio-k2sz13zg.js";import{Ft,Qd,Wi,sf,fn,lr,lI,Pa,cI}from"./studio-hz5n7x27.js";import{Pd}from"./studio-f746039f.js";import{T$,iO,oO,uh,ev}from"./studio-b2qpt0xy.js";import{qo}from"./studio-0w2dr0q8.js";import{SN,mL}from"./studio-rtfnhrdg.js";import{Bd}from"./studio-399a25za.js";import{Es,Co}from"./studio-2r90cts3.js";import{il,qu}from"./studio-0q5jwddh.js";import{sN}from"./studio-78pywnp2.js";import{oe}from"./studio-wc6za3zs.js";import{n,Z,Ze,_,v}from"./studio-8z66jk4z.js";function ie(e,o=[]){if(e?.tagName==="slot"){let s=e.attributes?.name;o.push(n(s)?s.trim():"")}if(Array.isArray(e?.children))for(let s of e.children)ie(n(s)?void 0:s,o);return o}function xS(e){let o=ie(e),s=o.filter((r)=>r==="").length;if(s>1)return`Component has ${s} unnamed <slot> elements — only one default slot is allowed. Give extra slots a name attribute.`;let l=new Set;for(let r of o){if(r&&l.has(r))return`Duplicate slot name "${r}" — slot names must be unique within a component.`;l.add(r)}return null}var se={invokerTags:ev,popoverTags:uh},D="Popover",ke={display:"document.repairPopoverDisplay","open-display":"document.repairPopoverDisplay",invoker:"document.repairPopoverInvoker",mode:"document.repairPopoverMode"};function ae(e,o,s,l){let r=`${o}.${s}.${l.join("/")}`,d=e.get(r)??0;return e.set(r,d+1),d===0?r:`${r}#${d}`}function W(e,o){pl((d)=>d.source===D);let s=new Map,l=iO(e,se);for(let d of l){let c=d.fix===void 0?void 0:ke[d.fix],b={detail:d.detail,key:ae(s,"popover",d.rule,d.path),source:D,tier:"problem"};if(c!==void 0)b.action=c,b.actionArgs={path:d.path};if(o!==void 0)b.path=o;C(d.severity,d.message,b)}let r=SN(e,se);for(let d of r){let c={detail:d.detail,key:ae(s,"dialog",d.rule,d.path),source:D,tier:"problem"};if(o!==void 0)c.path=o;C(d.severity,d.message,c)}return l.length+r.length}function z(e,o){let s=o?.path;if(!Array.isArray(s))throw RangeError(`command "${e}" needs a "path" argument naming the popover`);return s}function J(e){let o=h.value;if(!o)throw RangeError(`command "${e}" needs an open document`);return o}function Se(){return[{category:"Document",group:"2_document",id:"document.checkPopovers",level:"document",menus:["palette"],requires:"an open document",run:()=>{let e=J("document.checkPopovers"),o=W(e.doc.document,e.documentPath??void 0);C.success(o===0?"No popover problems found in this document.":`${o} popover problem(s) filed.`,{key:"popover.run",source:D})},title:"Check Popovers",when:(e)=>e.document.open,aiTool:{description:"Check the open document for popover defects an author can fix — a base-rule `display` "+"that defeats the browser's own hiding of a closed popover, `popovertarget` on an "+"element that cannot invoke, a target naming no popover, a cut exit animation — and "+"file each as a Problem. The findings come back as data.",name:"check_popovers",report:()=>{let e=of(D),o=e.length;return{data:e,summary:o===0?"No popover problems found in this document.":`Filed ${o} popover problem${o===1?"":"s"} in Problems.`}}}},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverDisplay",level:"document",menus:[],requires:"a popover whose base rule sets display",run:(e,o)=>{let l=J("document.repairPopoverDisplay"),r=z("document.repairPopoverDisplay",o),d=oe(l.doc.document,r),c=oO(d?.style);if(!c)throw RangeError(`command "${"document.repairPopoverDisplay"}": nothing to move — this popover sets no display`);Y(l,(b)=>{for(let w of c.base)Wm(b,r,w,"");for(let w of c.breakpoints)Fx(b,r,[w],"display","");if(c.openDisplay!==null)Px(b,r,":popover-open","display",c.openDisplay)}),C.success("Moved `display` into `:popover-open`.",{key:"popover.repaired.display",source:D})},title:"Move display into :popover-open",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverInvoker",level:"document",menus:[],requires:"an element carrying popovertarget that cannot invoke",run:(e,o)=>{let l=J("document.repairPopoverInvoker"),r=z("document.repairPopoverInvoker",o);Y(l,(d)=>{Cr(d,r,"popovertarget"),Cr(d,r,"popovertargetaction")}),C.success("Removed the attributes, which did nothing on this element.",{key:"popover.repaired.invoker",source:D})},title:"Remove the inert popover attributes",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverMode",level:"document",menus:[],requires:"a popover whose mode is not one of the three keywords",run:(e,o)=>{let l=J("document.repairPopoverMode"),r=z("document.repairPopoverMode",o);Y(l,(d)=>{Cr(d,r,"popover",T$)}),C.success(`Set \`popover\` to "${T$}".`,{key:"popover.repaired.mode",source:D})},title:"Set popover to auto",when:(e)=>e.document.open}]}function tN(e){e.registerAll(Se())}function Ew(e,o){if(e===o)return!0;if(Array.isArray(e)&&Array.isArray(o))return e.length===o.length&&e.every((s,l)=>s===o[l]);if(_(e)&&_(o)&&!Array.isArray(e)&&!Array.isArray(o))return e.$ref===o.$ref;return!1}var N="grid://",Sb={children:[],tagName:"div"};function ls(e){switch(e.kind){case"pages":return`${N}pages`;case"collection":return`${N}collection/${encodeURIComponent(e.name)}`;default:return`${N}data/${encodeURIComponent(e.connection)}/${encodeURIComponent(e.table)}`}}function xe(e){return e.startsWith(N)}function Vl(e){if(!xe(e))return null;let o=e.slice(N.length).split("/");if(o[0]==="pages"&&o.length===1)return{kind:"pages"};if(o[0]==="collection"&&o.length===2&&o[1])return{kind:"collection",name:decodeURIComponent(o[1])};if(o[0]==="data"&&o.length===3&&o[1]&&o[2])return{connection:decodeURIComponent(o[1]),kind:"data",table:decodeURIComponent(o[2])};return null}function wm(e){let o=Vl(e);if(!o)return null;switch(o.kind){case"pages":return"Pages · grid";case"collection":return`${o.name} · grid`;default:return`${o.table} @ ${o.connection} · grid`}}var le=0;function ce(e){let o=e.coalesceMs??800,s=e.now??(()=>Date.now()),r=g({deletes:new Set,errors:new Map,inserts:new Map,pending:new Map,redoStack:[],stale:new Set,undoStack:[]}),d=null,c=(t,i,a)=>{let u=r.errors.get(t);if(u)u.set(i,a);else r.errors.set(t,new Map([[i,a]]))},b=(t,i)=>{let a=r.errors.get(t);if(a?.delete(i),a?.size===0)r.errors.delete(t)},w=(t)=>{if(r.redoStack.length=0,d){d.push(t);return}let i=r.undoStack.at(-1);if(t.kind==="cell"&&i?.kind==="cell"&&i.rowKey===t.rowKey&&i.field===t.field&&t.at-i.at<=o){i.after=t.after,i.at=t.at;return}r.undoStack.push(t)},k=(t,i,a)=>{let u=r.inserts.get(t);if(u){if(a===null)delete u[i];else u[i]=a;return}if(Ew(a,e.resolveBaseline(t,i))){let f=r.pending.get(t);if(f?.delete(i),f?.size===0)r.pending.delete(t);return}let y=r.pending.get(t);if(y)y.set(i,{value:a});else r.pending.set(t,new Map([[i,{value:a}]]))},P=(t,i)=>{let a=r.inserts.get(t);if(a)return a[i]??null;let u=r.pending.get(t)?.get(i);return u?u.value:e.resolveBaseline(t,i)},O=(t,i)=>{let a=r.errors.get(t);return a?.get(i)??a?.get("*")??null},M=(t,i)=>{switch(t.kind){case"cell":{k(t.rowKey,t.field,i==="undo"?t.before:t.after);break}case"insert":{if(i==="undo")r.inserts.delete(t.tempKey);else r.inserts.set(t.tempKey,{...t.cells});break}case"drop-insert":{if(i==="undo")r.inserts.set(t.tempKey,{...t.cells});else r.inserts.delete(t.tempKey);break}case"delete":{if(i==="undo")r.deletes.delete(t.rowKey);else r.deletes.add(t.rowKey);break}default:{let a=i==="undo"?t.ops.toReversed():t.ops;for(let u of a)M(u,i);break}}},F=()=>{if(d)throw Error("edit-buffer: groups may not nest");d=[]},x=()=>{let t=d;if(d=null,!t)return;if(t.length===1)r.undoStack.push(t[0]);else if(t.length>1)r.undoStack.push({kind:"group",ops:t})},E=(t)=>{let i=(a)=>{switch(a.kind){case"cell":return t(a.rowKey)?null:a;case"insert":case"drop-insert":return t(a.tempKey)?null:a;case"delete":return t(a.rowKey)?null:a;default:{let u=a.ops.map((y)=>i(y)).filter((y)=>y!==null);return u.length>0?{kind:"group",ops:u}:null}}};r.undoStack=r.undoStack.map(i).filter((a)=>a!==null),r.redoStack=r.redoStack.map(i).filter((a)=>a!==null)};return{applyCommitResult(t){let i=new Set;for(let a of t.cells)if(a.ok){let u=r.pending.get(a.rowKey);if(u?.delete(a.field),u?.size===0)r.pending.delete(a.rowKey);b(a.rowKey,a.field)}else if(c(a.rowKey,a.field,a.error??"Save failed"),a.stale)r.stale.add(a.rowKey);for(let a of t.inserts)if(a.ok)r.inserts.delete(a.tempKey),r.errors.delete(a.tempKey),i.add(a.tempKey);else c(a.tempKey,"*",a.error??"Insert failed");for(let a of t.deletes)if(a.ok)r.deletes.delete(a.rowKey),r.pending.delete(a.rowKey),r.errors.delete(a.rowKey),i.add(a.rowKey);else if(c(a.rowKey,"*",a.error??"Delete failed"),a.stale)r.stale.add(a.rowKey);for(let a of i)r.stale.delete(a);if(i.size>0)E((a)=>i.has(a))},buildBatch(){let t=[];for(let[i,a]of r.pending){if(r.deletes.has(i))continue;for(let[u,y]of a)t.push({baseline:e.resolveBaseline(i,u),field:u,rowKey:i,value:y.value})}return{cells:t,deletes:[...r.deletes].map((i)=>({rowKey:i})),inserts:[...r.inserts].map(([i,a])=>({cells:{...a},tempKey:i}))}},canRedo:()=>r.redoStack.length>0,canUndo:()=>r.undoStack.length>0,cellError:O,cellState(t,i){if(O(t,i)!==null)return"error";if(r.stale.has(t))return"stale";if(r.inserts.has(t)||r.pending.get(t)?.has(i))return"dirty";return"clean"},deleteRow(t){if(r.deletes.has(t))return;let i=r.inserts.get(t);if(i){let a={...i};r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),w({cells:a,kind:"drop-insert",tempKey:t});return}r.deletes.add(t),w({kind:"delete",rowKey:t})},dirtyCount(){let t=r.inserts.size+r.deletes.size;for(let[i,a]of r.pending)if(!r.deletes.has(i))t+=a.size;return t},discardRow(t){r.pending.delete(t),r.deletes.delete(t),r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),E((i)=>i===t)},effectiveValue:P,beginGroup:F,endGroup:x,group(t){F();try{t()}finally{x()}},insertRow(t={}){le+=1;let i=`__new-${le}`;return r.inserts.set(i,{...t}),w({cells:{...t},kind:"insert",tempKey:i}),i},isDirty:()=>r.pending.size>0||r.inserts.size>0||r.deletes.size>0,isInsertKey:(t)=>r.inserts.has(t),markStale(t){for(let i of t)r.stale.add(i)},redo(){let t=r.redoStack.pop();if(!t)return!1;return M(t,"redo"),r.undoStack.push(t),!0},reset(){r.pending.clear(),r.inserts.clear(),r.deletes.clear(),r.errors.clear(),r.stale.clear(),r.undoStack.length=0,r.redoStack.length=0},rowState(t){if(r.deletes.has(t))return"pending-delete";if(r.inserts.has(t))return"pending-insert";if(r.stale.has(t))return"stale";if(r.pending.has(t)||r.errors.has(t))return"dirty";return"clean"},setCell(t,i,a){let u=P(t,i);if(Ew(u,a))return;k(t,i,a),w({after:a,at:s(),before:u,field:i,kind:"cell",rowKey:t})},state:r,undo(){let t=r.undoStack.pop();if(!t)return!1;return M(t,"undo"),r.redoStack.push(t),!0}}}var ue={array:220,boolean:70,date:130,enum:140,image:180,number:110,readonly:200,reference:200,string:180,text:340};function fe(e){return Math.min(340,Math.max(90,Math.round(e*7.5)))}function Pe(e){if(e.$ref)return"reference";if(e.enum!==void 0&&Array.isArray(e.enum))return"enum";let o=e.type==="array"?void 0:e.format;if(Da(o))return"image";if(o==="date"||o==="date-time")return"date";switch(e.type){case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"readonly";default:return(e.maxLength??0)>200||e.format==="markdown"?"text":"string"}}function me(e){let o=e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[_-]+/g," ").trim();return o.charAt(0).toUpperCase()+o.slice(1)}function Tw(e,o={}){let s=Object.entries(e?.properties??{}),l=new Set(e?.required),r=new Set(o.readonlyFields),d=s.map(([c,b])=>{let w=r.has(c)?"readonly":Pe(b),k=Array.isArray(b.enum)?Math.max(...b.enum.map((P)=>String(P).length),4):0;return{editable:w!=="readonly",field:c,kind:w,pk:c===o.idField,required:l.has(c),schema:b,title:me(c),widthHint:w==="enum"?fe(k+3):ue[w]}});return d.sort((c,b)=>{let w=(P)=>P.pk?0:P.required?1:2,k=w(c)-w(b);return k===0?0:k}),d}function Lw(e,o=50){let s=e.slice(0,o),l=[];for(let r of s)for(let d of Object.keys(r))if(!l.includes(d))l.push(d);return l.map((r)=>{let d=s.flatMap((w)=>{let k=w[r];return k===null||k===void 0||k===""?[]:[k]}),c=Ge(d),b=Math.max(...d.map((w)=>Qo(w).length),r.length,4);return{editable:!0,field:r,kind:c,title:me(r),widthHint:c==="string"||c==="text"?fe(b):ue[c]}})}function Ge(e){if(e.length===0)return"string";if(e.some((s)=>Array.isArray(s)))return"array";let o=e.map(String);if(e.every((s)=>Ze(s))||o.every((s)=>/^(true|false)$/i.test(s)))return"boolean";if(e.every((s)=>Z(s))||o.every((s)=>s.trim()!==""&&!Number.isNaN(Number(s.replaceAll(/[$€£¥,\s]/g,"")))))return"number";if(o.every((s)=>/^\d{4}-\d{2}-\d{2}([T ].*)?$/.test(s)))return"date";if(o.some((s)=>s.length>200))return"text";return"string"}function yp(e,o){if(e===null||e===void 0)return null;switch(o.kind){case"number":{if(Z(e))return Number.isNaN(e)?null:e;let s=String(e).trim().replaceAll(/[$€£¥,\s]/g,"");if(s==="")return null;let l=Number(s);return Number.isNaN(l)?null:l}case"boolean":{if(Ze(e))return e;return String(e).trim().toLowerCase()==="true"}case"array":{if(Array.isArray(e))return e.map(String);let s=String(e).trim();return s===""?[]:s.split(",").map((l)=>l.trim()).filter(Boolean)}case"reference":{if(v(e)&&"$ref"in e){let l=e.$ref;return n(l)&&l!==""?l:null}let s=String(e).trim();return s===""?null:s}default:{let s=String(e);return s===""?null:s}}}function Qo(e){if(e===null||e===void 0)return"";if(Array.isArray(e))return e.join(", ");if(_(e))return e.$ref;return String(e)}var wS="__key",H=new WeakMap;function er(e){return e?H.get(de(e))??null:null}function wp(e,o){let l=g({columns:[],error:null,grouping:null,loading:!1,query:{},rows:[],saving:!1,total:0}),r=new Map,d=(t)=>{r=new Map(t.map((i)=>[i.key,i]))},c=ce({resolveBaseline:(t,i)=>r.get(t)?.cells[i]??null}),b=async()=>{let t=await o.rows(l.query);d(t.rows),l.rows=t.rows,l.total=t.total},w=(t)=>{let i=l.columns.filter((y)=>y.required&&y.editable);if(i.length===0)return null;let a=t.cells.filter((y)=>y.value===null&&i.some((f)=>f.field===y.field)).map((y)=>({error:"Required",field:y.field,ok:!1,rowKey:y.rowKey})),u=t.inserts.filter((y)=>i.some((f)=>y.cells[f.field]===null||y.cells[f.field]===void 0)).map((y)=>({error:`Missing required: ${i.filter((G)=>y.cells[G.field]===null||y.cells[G.field]===void 0).map((G)=>G.field).join(", ")}`,ok:!1,tempKey:y.tempKey}));if(a.length===0&&u.length===0)return null;return{cells:a,deletes:[],inserts:u}},k=(t)=>t===null||t===""||Array.isArray(t)&&t.length===0,P=(t,i,a)=>{if(a==="number")return(Z(t)?t:0)-(Z(i)?i:0);if(a==="boolean")return(t===!0?1:0)-(i===!0?1:0);return Qo(t).localeCompare(Qo(i))},O=()=>{let t=l.rows.map((u)=>u.key),{dir:i,orderBy:a}=l.query;if(a&&!o.capabilities.remoteSort){let u=l.columns.find((f)=>f.field===a)?.kind,y=i==="desc"?-1:1;t=t.toSorted((f,G)=>{let R=c.effectiveValue(f,a),U=c.effectiveValue(G,a);if(k(R)!==k(U))return k(R)?1:-1;return y*P(R,U,u)})}return l.grouping?[...M(t).values()].flat():t},M=(t)=>{let i=new Map;for(let a of t){let u=Qo(c.effectiveValue(a,l.grouping)),y=i.get(u);if(y)y.push(a);else i.set(u,[a])}return i},F=null,x=()=>F?.refreshData(),E={addRow(t={}){let i=c.insertRow(t);return x(),i},bindView(t){F=t},buffer:c,deleteRows(t){if(t.length===0)return;c.group(()=>{for(let i of t)c.deleteRow(i)}),x()},discardRow(t){c.discardRow(t),x()},replaceAll(t,i){if(t==="")return 0;let a=l.columns.filter((f)=>f.editable&&(f.kind==="string"||f.kind==="text")),u=[...l.rows.map((f)=>f.key),...c.state.inserts.keys()],y=0;if(c.group(()=>{for(let f of u){if(c.rowState(f)==="pending-delete")continue;for(let G of a){let R=c.effectiveValue(f,G.field);if(n(R)&&R.includes(t))c.setCell(f,G.field,R.replaceAll(t,i)),y+=1}}}),y>0)x();return y},effectiveRows(){let t=(u)=>Array.isArray(u)?[...u]:_(u)?{$ref:u.$ref}:u,i=(u)=>{let y=[[wS,u]];for(let f of l.columns)y.push([f.field,t(c.effectiveValue(u,f.field))]);return Object.fromEntries(y)},a=O().map((u)=>i(u));for(let[u]of c.state.inserts)a.push(i(u));return a},groups(){if(!l.grouping)return[];return[...M(O())].map(([t,i])=>({count:i.length,value:t}))},async load(){l.loading=!0,l.error=null;try{l.columns=await o.columns(),await b()}catch(t){l.error=Q(t)}finally{l.loading=!1}x()},async refresh(){if(c.isDirty()){if(!await qo("Refresh Grid",`Discard ${c.dirtyCount()} pending change(s) and reload?`,{confirmLabel:"Discard & Reload",destructive:!0}))return}c.reset(),await o.refresh?.(),await this.load()},async save(){if(l.saving)return;let t=c.buildBatch(),i=t.cells.length+t.inserts.length+t.deletes.length;if(i===0){C.info("No grid changes to save.",{key:"grid.save"});return}let a=w(t);if(a){c.applyCommitResult(a),C.warn("Required cells are empty — fix the marked rows, then save again.",{key:"grid.save",source:"Data",tier:"problem"});return}if(t.deletes.length>0){if(!await qo("Delete Rows",`Save will permanently delete ${t.deletes.length} row(s). Continue?`,{confirmLabel:"Delete & Save",destructive:!0}))return}let y=new Set(t.cells.map((f)=>f.rowKey)).size+t.inserts.length+t.deletes.length>5?il({title:"Saving grid"}):null;l.saving=!0;try{let f=await o.commit(t),G=(S,j)=>`${S}\x00${j}`,R=new Map(t.cells.map((S)=>[G(S.rowKey,S.field),S]));for(let S of f.cells){let j=R.get(G(S.rowKey,S.field));if(S.ok&&j){let re=r.get(S.rowKey);if(re)re.cells[S.field]=j.value}}if(c.applyCommitResult(f),f.inserts.some((S)=>S.ok)||f.deletes.some((S)=>S.ok))await b();let L=f.cells.filter((S)=>S.ok).length+f.inserts.filter((S)=>S.ok).length+f.deletes.filter((S)=>S.ok).length,ee=i-L,te=f.cells.filter((S)=>S.stale).length+f.deletes.filter((S)=>S.stale).length;if(ee===0)C.success(`Saved ${L} change(s).`,{key:"grid.save"});else C.error(`Saved ${L} · ${ee} failed${te?` (${te} stale)`:""} — kept pending.`,{action:"file.save",key:"grid.save",source:"Data"})}catch(f){C.error("Could not save the grid.",{action:"file.save",detail:Q(f),key:"grid.save",source:"Data"})}finally{l.saving=!1,y?.done(),x()}},serializeForSource(){if(!o.serializeForSource)return null;return o.serializeForSource(c.buildBatch())},async setQuery(t){l.query=t,l.loading=!0;try{await b()}catch(i){l.error=Q(i)}finally{l.loading=!1}x()},setGrouping(t){l.grouping=t,x()},async setSort(t){let i={...l.query};if(t)i.orderBy=t.field,i.dir=t.dir;else delete i.orderBy,delete i.dir;if(!o.capabilities.remoteSort){l.query=i,x();return}await this.setQuery(i)},source:o,state:l,tab:e};return e.scope.run(()=>{ne(()=>{e.doc.dirty=c.isDirty()}),fv(e,{canRedo:()=>c.canRedo(),canUndo:()=>c.canUndo(),redo:()=>{c.redo(),x()},undo:()=>{c.undo(),x()}});let t=p();if(t.subscribeFileEvents&&o.backingPaths){let i=t.subscribeFileEvents((a)=>{let u=o.backingPaths(),y=new Set;for(let f of a){if(f.isDir)continue;let G=f.path.replaceAll("\\","/"),R=u.get(G);if(R!==void 0&&!Bd(G))y.add(R)}if(y.size===0)return;if(c.isDirty()){let f=y.has("*")?l.rows.map((G)=>G.key):[...y];c.markStale(f),C.warn("Grid rows changed on disk — marked stale; refresh to reload.",{key:"grid.stale",source:"Data"}),x()}else E.refresh()});ea(i)}ea(()=>{fv(e,null),H.delete(de(e)),o.dispose?.()})}),H.set(de(e),E),E}async function Wu(e){let s=er(e)?.serializeForSource();if(s)return s;await Ft();let l=Wi(e.doc.sourceFormat);if(l?.capabilities.serialize){let r=e.doc.content.frontmatter,d=e.doc.document,c={...r,...d,children:d.children??[]};return Pa(l.name,c,{mode:"roundtrip",...e.doc.source!==null&&{source:e.doc.source}})}if(e.doc.mode==="content"){let r=lr();if(r){let d=e.doc.content.frontmatter,c=Object.keys(d).length>0,b={...d,...e.doc.document};return Pa(r.name,b,{frontmatter:c,mode:"roundtrip"})}}return Co(fO(e.doc.document,e.doc.bareRepeaters??null),e.doc.layout??null)}var Re=200,Ee=500,Te=2097152,A=new Map,V=!1,I=null,T=null,B=null,X=null;function Oe(){let e=[];for(let o of m.tabs.values())if(o.doc.dirty&&o.documentPath)e.push(o);return e}async function pe(){if(!_e())return;let e=p();if(!e.setPreviewOverlay||!e.clearPreviewOverlay)return;let o=new Set;for(let s of Oe()){let l=s.documentPath.replace(/^\.\//,""),r;try{r=await Wu(s)}catch{continue}if(r.length>Te)continue;if(o.add(l),A.get(l)===r)continue;A.set(l,r),await e.setPreviewOverlay(l,r)}for(let s of A.keys())if(!o.has(s))A.delete(s),await e.clearPreviewOverlay(s)}function ye(){if(!V)return;let e=Date.now();if(B??=e,T)clearTimeout(T);let o=e-B,s=Math.max(0,Math.min(Re,Ee-o));T=setTimeout(()=>{T=null,B=null,X=pe().finally(()=>{X=null})},s)}function nN(){ye()}function iN(){if(V)return;V=!0,I=ge(),I.run(()=>{ne(()=>{for(let e of m.tabs.values())e.doc.dirty,e.doc.document;ye()})})}function oN(){if(V=!1,T)clearTimeout(T),T=null;B=null,I?.stop(),I=null,A.clear()}async function _S(){if(!V)return;if(T)clearTimeout(T),T=null,B=null;await X,await pe()}var he=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,Me=new Set(["vnd","prs","x"]);function $e(e){if(!n(e))return null;let[o,...s]=e.split(";"),l=(o??"").indexOf("/");if(l===-1)return null;let r=(o??"").slice(0,l).trim().toLowerCase(),d=(o??"").slice(l+1).trim().toLowerCase();if(!he.test(r)||!he.test(d))return null;let c=d.lastIndexOf("+"),b=c===-1?null:d.slice(c+1),w=c===-1?d:d.slice(0,c);if(b==="")return null;let k=w.indexOf("."),P=k===-1?null:w.slice(0,k),O=P!==null&&Me.has(P)?P:null,M=O===null?w:w.slice(O.length+1);if(M==="")return null;let F={};for(let x of s){let E=x.indexOf("=");if(E===-1)return null;let t=x.slice(0,E).trim().toLowerCase(),i=x.slice(E+1).trim();if(t==="")return null;if(i.startsWith('"')&&i.endsWith('"')&&i.length>=2)i=i.slice(1,-1);F[t]=i}return{parameters:F,subtype:M,suffix:b,tree:O,type:r}}function $w(e){let o=$e(e);if(o===null)return null;let s=o.tree===null?"":`${o.tree}.`,l=o.suffix===null?"":`+${o.suffix}`;return`${o.type}/${s}${o.subtype}${l}`}var we="text/markdown; variant=GFM",be="application/yaml",Tt={".markdown":`${we}; charset=utf-8`,".md":`${we}; charset=utf-8`,".yaml":`${be}; charset=utf-8`,".yml":`${be}; charset=utf-8`};async function rN(e,o){let s=await lI(e.name,o);return cI(e,s)}async function jr(e,o){await Ft();let s=fn(e);if(!s||!s.capabilities.parse)throw sf(e);return{...await rN(s,o),format:s}}var PT=async(e,o)=>{if(e.documentPath&&fn(e.documentPath)){let l=await jr(e.documentPath,o);return e.doc.source=o,{document:l.document,frontmatter:l.frontmatter}}let s=Es(o);return e.doc.layout=s.layout,{document:s.document}};function Fe(e){return"showOpenFilePicker"in e}function De(e){return"showSaveFilePicker"in e}function q(e,o){if(e.documentPath!==null)o.path=e.documentPath;return o}async function fP(){try{await Ft();let e=Qd(),o=[{accept:{"application/json":[".json"]},description:"Jx Component"},...e.filter((r)=>r.capabilities.parse).map((r)=>({accept:{[$w(r.mediaType)??"text/plain"]:r.extensions},description:r.name}))],s=[".json",...e.flatMap((r)=>r.extensions)].join(","),l=async(r,d,c=null)=>{let b=c?await sN(r):null,w=fn(r);if(w){let{document:k,frontmatter:P}=await rN(w,d);_i({document:k,documentPath:b,fileHandle:c,frontmatter:P,id:r,source:d,sourceFormat:w.name})}else if(r.endsWith(".json")){let{document:k,layout:P}=Es(d);_i({document:k,documentPath:b,fileHandle:c,id:r,layout:P})}else throw sf(r)};if(Fe(window)){let[r]=await window.showOpenFilePicker({types:o}),d=await r.getFile();await l(r.name,await d.text(),r)}else{let r=document.createElement("input");r.type="file",r.accept=s,r.addEventListener("change",async()=>{let d=r.files?.[0];if(!d)return;await l(d.name,await d.text())}),r.click()}}catch(e){if(!(e instanceof Error&&e.name==="AbortError"))C.error("Could not open the file.",{detail:Q(e),source:"Open File"})}}var ve=()=>{};function FT(e){ve=e}function K(e){let o=e.doc.document;ve(e.documentPath,o,e);let s=n(o.tagName)&&o.tagName.includes("-")?xS(o):null;if(s)C.warn(s,q(e,{key:`slots:${e.documentPath??e.id}`,source:"Components",tier:"problem"}));W(o,e.documentPath??void 0)}function Ne(e){return!Pd(e.documentPath??"")}async function xp(e=h.value){if(!e)return!1;if(await mL(e.id),hv(e))return C.warn(`You have read access to this session — changes to ${e.documentPath??"this document"} stay in your browser and cannot be saved.`,q(e,{action:"file.save",key:`save.readOnly:${e.documentPath??e.id}`,source:"Collaboration"})),!1;if(!Ne(e))return C.warn(`${e.documentPath??"This file"} is a media file, so there is no document for Save to write.`,q(e,{key:`save.notADocument:${e.documentPath??e.id}`,source:"Save"})),!1;let o=er(e);if(o)return await o.save(),!e.doc.dirty;try{if(await j$(e))return K(e),!0;let s=await Wu(e);if(e.documentPath){if(await p().writeFile(e.documentPath,s),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return _S(),K(e),!0}if(e.fileHandle&&"createWritable"in e.fileHandle){let l=await e.fileHandle.createWritable();if(await l.write(s),await l.close(),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return K(e),!0}C.warn("This document has no save target — use Export.",{key:"save.noTarget"})}catch(s){if(!(s instanceof Error&&s.name==="AbortError"))C.error(`Could not save ${e.documentPath??e.id}.`,q(e,{action:"file.save",detail:Q(s),key:`save:${e.documentPath??e.id}`,source:"Save"}))}return!1}function Ae(e){return Wi(e.doc.sourceFormat)??(e.doc.mode==="content"?lr():void 0)}async function jT(){let e=h.value;if(!e)return;try{await Ft();let o=Ae(e),s=await Wu(e),l=o?$w(o.mediaType)??"text/plain":"application/json",r=o?o.extensions[0]:".json",d=o?o.name:"Jx Component",c=o?`content${r}`:"component.json";if(De(window)){let b=e.documentPath?e.documentPath.split("/").pop():c,w=await window.showSaveFilePicker({suggestedName:b,types:[{accept:{[l]:[r]},description:d}]}),k=await w.createWritable();await k.write(s),await k.close(),e.doc.dirty=!1,K(e),C.success(`Exported as ${w.name}.`)}else{let b=new Blob([s],{type:l}),w=URL.createObjectURL(b),k=document.createElement("a");k.href=w,k.download=c,k.click(),URL.revokeObjectURL(w),e.doc.dirty=!1,K(e),C.success(`Downloaded ${c}.`)}}catch(o){if(!(o instanceof Error&&o.name==="AbortError"))C.error("Could not export the document.",{detail:Q(o),source:"Export"})}}async function Ce(e,o){let s=Pd(e)?await qu(e):await $a({path:e});return R$(s,o)??""}async function Cb(e){let o=await Ce(e.path,"delete"),s=`Delete ${e.name}? This cannot be undone.`;return Boolean(await qo("Delete File",o===""?s:`${s} ${o}`,{confirmLabel:"Delete",destructive:!0}))}async function kb(e,o="rename"){let s=await Ce(e,o);return s===""?void 0:s}
2
- export{Ew,Sb,ls,Vl,wm,Tw,Lw,yp,Qo,wS,er,wp,xS,tN,Wu,nN,iN,oN,_S,$w,rN,jr,PT,fP,FT,xp,jT,Cb,kb};
3
-
4
- //# debugId=9B19B5AB6CBDF39564756E2164756E21
5
- //# sourceMappingURL=studio-qyed0ah6.js.map
@@ -1,5 +0,0 @@
1
- import{k$}from"./studio-b2qpt0xy.js";import{L,R,Xs,Jb}from"./studio-0w2dr0q8.js";import{g}from"./studio-y60sts62.js";import{He}from"./studio-8wnvtr4z.js";var x={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMenu",$description:"A Studio menu: one jx-menu whose rows are a projection of command records the adapter hands in as `rows`. Nothing here decides what a row says; a row prints its record's title, chord, disabled reason and destructive flag, a divider falls where the adapter marked a group boundary, and a row with children owns a one-level submenu of the same shape. The chord and the reason are rendered only when present, so a row's text is its title.",tagName:"jx-menu",$props:{label:{$ref:"#/state/label"},x:{$ref:"#/state/x"},y:{$ref:"#/state/y"},floor:{$ref:"#/state/floor"},placement:{$ref:"#/state/placement"}},onselect:{$ref:"#/state/select"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{role:"none"},children:[{tagName:"div",attributes:{role:"none"},$switch:{$ref:"$map/item/dividerAbove"},cases:{true:{tagName:"hr"}}},{tagName:"jx-menu-item",$props:{value:{$ref:"$map/item/id"},disabled:{$ref:"$map/item/disabled"},destructive:{$ref:"$map/item/destructive"},requires:{$ref:"$map/item/requires"},checked:{$ref:"$map/item/checked"},haspopup:{$ref:"$map/item/haspopup"}},attributes:{"data-command-id":"${$map.item.id}"},children:[{tagName:"span",textContent:"${$map.item.title}"},{tagName:"span",attributes:{slot:"value"},$switch:{$ref:"$map/item/noChord"},cases:{false:{tagName:"kbd",textContent:"${$map.item.chord}"}}},{tagName:"span",attributes:{slot:"description"},$switch:{$ref:"$map/item/enabled"},cases:{false:{tagName:"span",textContent:"Needs ${$map.item.requires}"}}},{tagName:"span",attributes:{slot:"submenu"},$switch:{$ref:"$map/item/haspopup"},cases:{true:{tagName:"jx-menu",$props:{label:{$ref:"$map/item/submenuLabel"}},children:[{$prototype:"Array",items:{$ref:"$map/item/children"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{role:"none"},children:[{tagName:"div",attributes:{role:"none"},$switch:{$ref:"$map/item/dividerAbove"},cases:{true:{tagName:"hr"}}},{tagName:"jx-menu-item",$props:{value:{$ref:"$map/item/id"},disabled:{$ref:"$map/item/disabled"},destructive:{$ref:"$map/item/destructive"},requires:{$ref:"$map/item/requires"},checked:{$ref:"$map/item/checked"}},attributes:{"data-command-id":"${$map.item.id}"},children:[{tagName:"span",textContent:"${$map.item.title}"},{tagName:"span",attributes:{slot:"value"},$switch:{$ref:"$map/item/noChord"},cases:{false:{tagName:"kbd",textContent:"${$map.item.chord}"}}},{tagName:"span",attributes:{slot:"description"},$switch:{$ref:"$map/item/enabled"},cases:{false:{tagName:"span",textContent:"Needs ${$map.item.requires}"}}}]}]}}]}}}]}]}}]};L("menu",x);var j="block-end span-inline-end";function P(e){if(e.placement!==void 0)return e.placement;return e.opener&&!e.origin&&!e.place&&!e.floor?j:""}function N(e){if(!e)return{x:0,y:0};let n=He(e);return{x:Math.round(n.left),y:Math.round(n.bottom)}}function b(e,n=0){let r=n===0?(e.children??[]).map((t)=>b(t,1)):[];return{...e,checked:e.checked??"",children:r,chord:e.chord??"",enabled:!e.disabled,haspopup:r.length>0,noChord:!e.chord,noDivider:!e.dividerAbove,requires:e.requires??"",submenuLabel:e.submenuLabel??e.title}}function S(e,n){for(let r of e){if(r.id===n)return r;let t=r.children.find((a)=>a.id===n);if(t)return t}return}function Bt(e){let n=Xs("popover",e.region),r=new AbortController,t=null,a=null,s=!1,h=()=>{if(s)return;s=!0,r.abort(),a?.(),a=null,Jb("popover",e.region),q(e.opener??null),e.onClosed?.(f)},v=e.place?e.place(new DOMRect):e.origin??N(e.opener),c=g({floor:e.floor?.()??0,label:e.label,placement:P(e),rows:e.rows.map((o)=>b(o)),select:(o,u)=>{let i=String(u.detail),d=S(c.rows,i);if(!d)return;if(k(t,e.opener??null),d.run)d.run();else e.run?.(i);f.close()},x:v.x,y:v.y}),w=()=>{if(s||!t||!e.place)return;let o=e.place(He(t));c.x=o.x,c.y=o.y},p=()=>r.signal.aborted,E=(async()=>{let o=await R("menu",c,n,{signal:r.signal});if(p())return;if({dispose:a}=o,t=o.root,t.addEventListener("toggle",(i)=>{if(i.newState==="closed")h()}),!t.hasAttribute("popover"))await new Promise((i)=>{t.addEventListener("jx-ready",()=>i(),{once:!0})});if(p())return;if(await C(r.signal),p())return;let u=e.opener instanceof HTMLElement&&e.opener!==document.body?e.opener:void 0;t.showPopover(u?{source:u}:void 0),w(),requestAnimationFrame(w)})(),f={close:()=>{if(s)return;if(t?.open)t.hidePopover();h()},host:n,ready:E,setRows:(o)=>{if(s)return;let i=document.activeElement?.closest("jx-menu"),d=i&&i!==t?i.parentElement?.closest("jx-menu-item")?.dataset.commandId:void 0;c.rows=o.map((m)=>b(m)),setTimeout(()=>{if(s||!t||t.contains(document.activeElement))return;let m=d?t.querySelector(`jx-menu-item[data-command-id="${d}"]`):null,y=m?.querySelector("jx-menu")??null;if(m&&!(y?.open&&y.querySelector("jx-menu-item")))m.focus();else k$(t)},0)}};return f}var l=new Set;if(typeof window<"u")window.addEventListener("pointerdown",(e)=>l.add(e.pointerId),!0),window.addEventListener("pointerup",(e)=>l.delete(e.pointerId),!0),window.addEventListener("pointercancel",(e)=>l.delete(e.pointerId),!0),window.addEventListener("blur",()=>l.clear());function C(e){if(l.size===0||e.aborted)return Promise.resolve();return new Promise((n)=>{let r=new AbortController,t=()=>{if(l.size===0||e.aborted)r.abort(),n()},a={capture:!0,signal:r.signal};window.addEventListener("pointerup",t,a),window.addEventListener("pointercancel",t,a),window.addEventListener("blur",t,{signal:r.signal}),e.addEventListener("abort",t,{signal:r.signal})})}function k(e,n){if(e?.contains(document.activeElement)&&n?.isConnected&&n!==document.body)n.focus({preventScroll:!0})}function q(e){let n=document.activeElement;if(e?.isConnected&&(!n||n===document.body))e.focus()}
2
- export{Bt};
3
-
4
- //# debugId=558DA887E1C1A3B864756E2164756E21
5
- //# sourceMappingURL=studio-r4bcdwhq.js.map