@jxsuite/studio 10.1.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 (303) hide show
  1. package/dist/chunks/{2020-mkb0qa6p.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-r22jsqht.js → grid-view-w9nfy203.js} +15 -15
  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-pxwwf00y.js → index-yjrfeks8.js} +3 -3
  24. package/dist/chunks/{javascript-pzqryby6.js → javascript-hy2mws8v.js} +3 -3
  25. package/dist/chunks/{jsonMode-tcnyxyap.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-bqpge64f.js → monaco-binding-a51py33c.js} +3 -3
  34. package/dist/chunks/monaco-buffer-pa0g6ax7.js +4 -0
  35. package/dist/chunks/{monaco-setup-1mkab762.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-0g2sm01j.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-rf8d6p9f.js → studio-0w3541dg.js} +6 -6
  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-8qejv8yf.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-jw0q5j6k.js → studio-321ym1tt.js} +4 -4
  56. package/dist/chunks/studio-3c10v2q1.js +5 -0
  57. package/dist/chunks/{studio-9rcbvksg.js → studio-3na1r48j.js} +8 -8
  58. package/dist/chunks/{studio-ggm7zf70.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-423tfdte.js +5 -0
  62. package/dist/chunks/{studio-brdp85q7.js → studio-45mj4jqe.js} +4 -4
  63. package/dist/chunks/studio-4f7thq0p.js +5 -0
  64. package/dist/chunks/{studio-w67vfgy5.js → studio-4fnb5648.js} +4 -4
  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-x2metr13.js → studio-5tet77de.js} +3 -3
  69. package/dist/chunks/studio-7rrdbvex.js +5 -0
  70. package/dist/chunks/studio-8kx6m0rg.js +5 -0
  71. package/dist/chunks/{studio-va0e63sk.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-9qx1ywbv.js +9 -0
  75. package/dist/chunks/studio-a65kbs2e.js +9 -0
  76. package/dist/chunks/studio-aam8zt8z.js +5 -0
  77. package/dist/chunks/{studio-8jb31dcf.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-dy2xtt7a.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-mwnmzx7g.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-hsr3k06v.js → studio-fkrr7kgg.js} +5 -5
  92. package/dist/chunks/studio-fspe7m9t.js +5 -0
  93. package/dist/chunks/{studio-4zqfw5ha.js → studio-g0hxtcga.js} +4 -4
  94. package/dist/chunks/studio-g9brbewz.js +5 -0
  95. package/dist/chunks/studio-ggx3j7nd.js +5 -0
  96. package/dist/chunks/{studio-jh6t5qz4.js → studio-hfxttkyr.js} +4 -4
  97. package/dist/chunks/studio-hh394phe.js +5 -0
  98. package/dist/chunks/{studio-07k0geap.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-nf0pqpbj.js → studio-n9qba0gx.js} +4 -4
  105. package/dist/chunks/studio-nf8esxxc.js +5 -0
  106. package/dist/chunks/studio-nn4f9m9c.js +5 -0
  107. package/dist/chunks/studio-nskxe9q1.js +6 -0
  108. package/dist/chunks/{studio-4nkm4404.js → studio-nvcn2ykc.js} +4 -4
  109. package/dist/chunks/studio-nwynxqtb.js +5 -0
  110. package/dist/chunks/{studio-f2j9et3h.js → studio-nzemfbkk.js} +8 -8
  111. package/dist/chunks/studio-p2a03pgm.js +5 -0
  112. package/dist/chunks/{studio-skynbac3.js → studio-pm17wdc4.js} +4 -4
  113. package/dist/chunks/{studio-9cp96v90.js → studio-q80fg1d6.js} +7 -7
  114. package/dist/chunks/studio-r050sez0.js +6 -0
  115. package/dist/chunks/{studio-sd07xva5.js → studio-s7t4vp1d.js} +5 -5
  116. package/dist/chunks/studio-s9fng7m8.js +7 -0
  117. package/dist/chunks/studio-sce30r7b.js +4 -0
  118. package/dist/chunks/{studio-zxm98z2m.js → studio-stahswgb.js} +6 -6
  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-tpy3rdxn.js → studio-v5wktj6f.js} +4 -4
  123. package/dist/chunks/{studio-7vb997ff.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-xpx91fby.js +6 -0
  131. package/dist/chunks/studio-y1b86ast.js +5 -0
  132. package/dist/chunks/studio-yrcrncev.js +5 -0
  133. package/dist/chunks/{studio-zacvfm31.js → studio-yzpskb0j.js} +4 -4
  134. package/dist/chunks/studio-zfdbmhp3.js +5 -0
  135. package/dist/chunks/{tsMode-6vwhy6ty.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-zcxkfgmf.js → ws-client-arz2qsy9.js} +3 -3
  139. package/dist/iframe-entry.js +13 -13
  140. package/dist/manifest.json +83 -77
  141. package/dist/studio.js +74 -75
  142. package/package.json +5 -5
  143. package/src/browse/library-model.ts +56 -23
  144. package/src/browse/library-pane.ts +44 -29
  145. package/src/browse/library-preview.ts +6 -2
  146. package/src/canvas/asset-refs.ts +13 -4
  147. package/src/canvas/asset-resolve.ts +54 -11
  148. package/src/canvas/canvas-render.ts +25 -0
  149. package/src/canvas/iframe-entry.ts +5 -1
  150. package/src/canvas/iframe-host.ts +16 -6
  151. package/src/canvas/iframe-protocol.ts +9 -1
  152. package/src/commands/context.ts +6 -0
  153. package/src/commands/live-context.ts +5 -2
  154. package/src/editor/shortcuts.ts +6 -0
  155. package/src/files/asset-versions.ts +108 -2
  156. package/src/files/file-ops.ts +11 -1
  157. package/src/files/files.ts +111 -48
  158. package/src/files/media-paths.ts +12 -4
  159. package/src/files/media-upload.ts +195 -21
  160. package/src/files/new-file-name.ts +39 -1
  161. package/src/media/image-bake.ts +164 -0
  162. package/src/media/image-editor.ts +846 -0
  163. package/src/media/image-format.ts +262 -0
  164. package/src/media/image-recipe.ts +651 -0
  165. package/src/media/media-commands.ts +65 -1
  166. package/src/media/media-library-model.ts +1 -1
  167. package/src/media/media-library.ts +175 -15
  168. package/src/media/media-open.ts +156 -3
  169. package/src/media/media-pane.ts +8 -4
  170. package/src/panels/data-grid.ts +0 -4
  171. package/src/panels/pane-context.ts +6 -1
  172. package/src/panels/settings-menu.ts +3 -3
  173. package/src/panels/settings-pane.ts +42 -56
  174. package/src/panels/tab-strip.ts +12 -3
  175. package/src/services/ai-import-tools.ts +6 -3
  176. package/src/services/ai-models.ts +65 -11
  177. package/src/services/ai-settings.ts +45 -5
  178. package/src/services/document-assistant.ts +5 -2
  179. package/src/services/settings/definitions.ts +19 -0
  180. package/src/settings/contributed-section.ts +16 -7
  181. package/src/settings/css-vars-editor.ts +4 -4
  182. package/src/settings/general-settings.ts +1 -4
  183. package/src/settings/preferences-accounts.ts +2 -2
  184. package/src/settings/preferences-dialog.ts +4 -2
  185. package/src/settings/project-sections.ts +1 -1
  186. package/src/settings/section-registry.ts +5 -4
  187. package/src/settings/settings-document.ts +33 -24
  188. package/src/settings/settings-workspace.ts +205 -0
  189. package/src/shell.ts +31 -6
  190. package/src/studio.ts +13 -2
  191. package/src/surfaces/ai-credentials-form.json +59 -5
  192. package/src/surfaces/ai-credentials-form.ts +15 -2
  193. package/src/surfaces/commandbar.ts +7 -3
  194. package/src/surfaces/image-editor.json +1390 -0
  195. package/src/surfaces/image-editor.ts +272 -0
  196. package/src/surfaces/media-library.json +129 -1
  197. package/src/surfaces/media-library.ts +17 -2
  198. package/src/surfaces/settings-contributed.json +4 -4
  199. package/src/surfaces/settings-contributed.ts +2 -2
  200. package/src/surfaces/settings-pane.json +262 -180
  201. package/src/surfaces/settings-pane.ts +63 -14
  202. package/src/types.ts +2 -1
  203. package/src/ui/ai-credentials-form.ts +128 -11
  204. package/src/ui/regions.ts +5 -5
  205. package/src/workspace/tab-workspace.ts +5 -3
  206. package/src/workspace/workspace-home.ts +18 -4
  207. package/src/workspace/workspace-ids.ts +40 -7
  208. package/src/workspace/workspace-switch.ts +3 -1
  209. package/src/workspace/workspace.ts +22 -1
  210. package/dist/chunks/adapter-xcpsmecx.js +0 -4
  211. package/dist/chunks/add-new-flow-ptmhmzr9.js +0 -4
  212. package/dist/chunks/cf-account-picker-z1sgwpwd.js +0 -4
  213. package/dist/chunks/cf-settings-xqvhxxe9.js +0 -4
  214. package/dist/chunks/components-whsc81a7.js +0 -4
  215. package/dist/chunks/content-source-jwtxg78w.js +0 -4
  216. package/dist/chunks/convert-to-repeater-f92ey3kp.js +0 -4
  217. package/dist/chunks/editor-zdqdpq1x.js +0 -4
  218. package/dist/chunks/entry-commands-w8p2fbpt.js +0 -4
  219. package/dist/chunks/extension-sections-y2p1te2r.js +0 -4
  220. package/dist/chunks/file-ops-13ab4swj.js +0 -4
  221. package/dist/chunks/files-zbc8p6v1.js +0 -4
  222. package/dist/chunks/format-host-zjsbktbx.js +0 -4
  223. package/dist/chunks/fs-events-t6x0hch6.js +0 -4
  224. package/dist/chunks/grid-open-fyzdwpkh.js +0 -4
  225. package/dist/chunks/icons-853n6qt3.js +0 -4
  226. package/dist/chunks/iframe-host-kbyqc7pt.js +0 -4
  227. package/dist/chunks/index-6nvj89vb.js +0 -4
  228. package/dist/chunks/jx-validate-5sp8a4rm.js +0 -4
  229. package/dist/chunks/layers-panel-qrxj9vr2.js +0 -4
  230. package/dist/chunks/layers-tpzayggx.js +0 -4
  231. package/dist/chunks/lit-html-x6nrxsx3.js +0 -4
  232. package/dist/chunks/media-library-ywppnjrz.js +0 -4
  233. package/dist/chunks/media-picker-etxgc8qq.js +0 -4
  234. package/dist/chunks/monaco-buffer-qrnqhk0b.js +0 -4
  235. package/dist/chunks/notify-kcv38wwe.js +0 -4
  236. package/dist/chunks/parse-df2kkmhc.js +0 -4
  237. package/dist/chunks/platform-dtsysmyd.js +0 -4
  238. package/dist/chunks/publish-panel-evb1rcxt.js +0 -4
  239. package/dist/chunks/publish-quick-m9vkhahq.js +0 -4
  240. package/dist/chunks/publish-workspace-ktk9h536.js +0 -4
  241. package/dist/chunks/quick-search-2f47fxcw.js +0 -4
  242. package/dist/chunks/references-5w6ajjv7.js +0 -4
  243. package/dist/chunks/right-panel-kz0a6byf.js +0 -4
  244. package/dist/chunks/source-control-1phx90zk.js +0 -4
  245. package/dist/chunks/studio-0hr000ba.js +0 -5
  246. package/dist/chunks/studio-1wyp7dt5.js +0 -5
  247. package/dist/chunks/studio-20ap8dds.js +0 -5
  248. package/dist/chunks/studio-291gqh98.js +0 -5
  249. package/dist/chunks/studio-37twdaf7.js +0 -64
  250. package/dist/chunks/studio-4smcnv33.js +0 -5
  251. package/dist/chunks/studio-56egy6vf.js +0 -5
  252. package/dist/chunks/studio-5dmgmyw4.js +0 -5
  253. package/dist/chunks/studio-5e7p1vgd.js +0 -5
  254. package/dist/chunks/studio-5m0w815d.js +0 -5
  255. package/dist/chunks/studio-695k95bw.js +0 -5
  256. package/dist/chunks/studio-6vwvshw8.js +0 -6
  257. package/dist/chunks/studio-732mw0g8.js +0 -5
  258. package/dist/chunks/studio-76t560kn.js +0 -6
  259. package/dist/chunks/studio-7823f0g8.js +0 -5
  260. package/dist/chunks/studio-8486jn4r.js +0 -5
  261. package/dist/chunks/studio-848rk4p1.js +0 -5
  262. package/dist/chunks/studio-8x8616xd.js +0 -5
  263. package/dist/chunks/studio-a3s6frde.js +0 -4
  264. package/dist/chunks/studio-ahf3cspq.js +0 -4
  265. package/dist/chunks/studio-bkmv1h3e.js +0 -9
  266. package/dist/chunks/studio-cgb97rwv.js +0 -5
  267. package/dist/chunks/studio-ch8gt8vt.js +0 -5
  268. package/dist/chunks/studio-cqf1k4qk.js +0 -5
  269. package/dist/chunks/studio-cvz0e00f.js +0 -5
  270. package/dist/chunks/studio-dbgv4fv9.js +0 -16
  271. package/dist/chunks/studio-eesyjg7h.js +0 -9
  272. package/dist/chunks/studio-et6t8g4m.js +0 -4
  273. package/dist/chunks/studio-fep7hr66.js +0 -7
  274. package/dist/chunks/studio-fyf7j57j.js +0 -5
  275. package/dist/chunks/studio-g5prntab.js +0 -5
  276. package/dist/chunks/studio-ga77mf07.js +0 -5
  277. package/dist/chunks/studio-h7gy12h2.js +0 -5
  278. package/dist/chunks/studio-j933k8nr.js +0 -5
  279. package/dist/chunks/studio-jgbvqcgh.js +0 -5
  280. package/dist/chunks/studio-k4xc5g6h.js +0 -5
  281. package/dist/chunks/studio-p0nf2e1f.js +0 -6
  282. package/dist/chunks/studio-pd9dsqpq.js +0 -5
  283. package/dist/chunks/studio-pmzg17fj.js +0 -5
  284. package/dist/chunks/studio-pzfa2vmb.js +0 -5
  285. package/dist/chunks/studio-qyb5bebs.js +0 -9
  286. package/dist/chunks/studio-rt498t2v.js +0 -5
  287. package/dist/chunks/studio-s0fg2wav.js +0 -5
  288. package/dist/chunks/studio-t3j8htp7.js +0 -7
  289. package/dist/chunks/studio-thj81e98.js +0 -7
  290. package/dist/chunks/studio-tyw7tk0x.js +0 -5
  291. package/dist/chunks/studio-vcz63n42.js +0 -5
  292. package/dist/chunks/studio-vffwe9k7.js +0 -5
  293. package/dist/chunks/studio-vjhej0w5.js +0 -928
  294. package/dist/chunks/studio-vxjap704.js +0 -5
  295. package/dist/chunks/studio-xebavr9s.js +0 -5
  296. package/dist/chunks/studio-yg5n49za.js +0 -5
  297. package/dist/chunks/studio-yhz5b313.js +0 -5
  298. package/dist/chunks/studio-zsjpsw08.js +0 -5
  299. package/dist/chunks/workspace-d65bz1qk.js +0 -4
  300. package/dist/chunks/workspace-home-vbg9b3jh.js +0 -4
  301. package/src/settings/settings-dialog.ts +0 -192
  302. package/src/surfaces/settings-dialog.json +0 -51
  303. package/src/surfaces/settings-dialog.ts +0 -169
@@ -0,0 +1,5 @@
1
+ import{w}from"./studio-sce30r7b.js";import{nu}from"./studio-swedpd82.js";import{p}from"./studio-4fnb5648.js";import{Wi,fn,lr}from"./studio-aam8zt8z.js";import{qI,b1,$o,o2,g0,GI,KI,JI,zv}from"./studio-nvcn2ykc.js";import{$v,LI,Cr,C}from"./studio-4f7thq0p.js";import{Ce,oe,Ov,Mv,h1,df,p1,na,uf,sg,d0}from"./studio-v5wktj6f.js";import{me,ia,te,g,le,Ph}from"./studio-3qr08sxq.js";import{n,Y,Ze,_,v,Go,Di,ld,xf}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";var we=g(new Set);function qm(e){we.add(e)}function Vx(e){we.delete(e)}function ZC(e){return we.has(e)}var lI=()=>({kind:"proceed"});function vv(e,t){return{success:!0,data:e,summary:t}}function Hn(e){return{success:!1,error:e}}function Vr({name:e,description:t,parameters:o,strict:r=!0,llmStrict:i=!1,interactive:s,title:a,annotations:l,interaction:c,settle:u,execute:d}){let f={name:e,description:t,parameters:o,strict:r,llmStrict:i,execute:d};if(s!==void 0)f.interactive=s;if(a!==void 0)f.title=a;if(l!==void 0)f.annotations=l;if(c!==void 0)f.interaction=c;if(u!==void 0)f.settle=u;return f}function Ux(e){let t=[];return{record(o){t.push(o),e?.(o)},writes:t}}function yh(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 Qt=new AbortController().signal;function qx(e={}){let t=e.session??yh();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??Ux(),progress:e.progress??(()=>{}),session:t,signal:e.signal??Qt}}function GO(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 Gx(){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 d=a[c];if(!d)continue;let f=d.type;if(!f)continue;let x=ze(u);if(f==="number"||f==="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(f==="string"&&x!=="string")s.push(`Argument "${c}" should be a string, got ${x}`);else if(f==="boolean"&&x!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${x}`);else if(f==="array"&&x!=="array")s.push(`Argument "${c}" should be an array, got ${x}`);else if(f==="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=qx()){let i=e.get(t);if(!i)return Hn(`Unknown tool: "${t}"`);let s=this.validate(t,o);if(!s.valid)return Hn(`Validation failed: ${(s.errors||[]).join("; ")}`);try{return await i.execute(o,r)}catch(a){return Hn(`Tool "${t}" execution error: ${ge(a)}`)}}}}var en="The author declined this call.";function tn(e){return JSON.parse(JSON.stringify(e))}function ge(e){return e.message}var nn=["string","number","boolean","undefined"];function Re(e,t){return typeof e===t}function on(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function ze(e){if(Array.isArray(e))return"array";return nn.find((t)=>Re(e,t))??"object"}function rn(e){if(!e)return{};let t=JSON.parse(e);if(!on(t)){let o=t===null?"null":ze(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function cI(e,t,o,{approval:r=lI,response:i}={}){let s=!1,a;try{let l=rn(t.argumentsText),c=e.getDefinition(t.name),u=c?sn(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=Hn(`Failed to parse arguments: ${ge(l)}`)}try{return{status:"done",result:tn(a),executed:s}}catch(l){let c=ge(l);return{status:"done",result:Hn(`Tool "${t.name}" returned a result that cannot be serialized: ${c}`),executed:s}}}function sn(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:cn(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(en)}return null}function pe(e){return{status:"done",result:Hn(e),executed:!1}}function cn(e,t,o,r){try{return t(o,r)}catch(i){return Hn(`Tool "${e}" execution error: ${ge(i)}`)}}var un=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"]),KC="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function jn(e){if(!n(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Fx(e){return jn(e)!==null}function fv(e){let t=jn(e);if(t===null)return"ltr";let o=new Intl.Locale(t),r=o.script??o.maximize().script;return r!==void 0&&un.has(r)?"rtl":"ltr"}function Wt(e){let t=jn(e);if(t===null)return n(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var dn="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=jn(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=jn(t.defaultLocale)??i[0]??null;if(t.defaultLocale!==void 0&&jn(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:dn;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 jn(q(e)[o])}function jx(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 mv(e,t){let o=q(e),r=Ae(o,t);return r===-1?o.join("/"):o.filter((i,s)=>s!==r).join("/")}function Qc(e,t,o){if(o===null)return null;let r=jn(t);if(r===null||!o.locales.includes(r))return null;let i=q(e),s=Ae(i,o),a=s===-1?mn(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=jn(o);return r!==null&&t.locales.includes(r)})}function mn(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function VO(e,t){if(t===null)return null;let o=e.split("/").find(Boolean);if(o===void 0)return t.defaultLocale;let r=jn(o);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}function fI(e,t){return Ye(e,"v",t)}function Yx(e,t){return Ye(e,"r",t)}function Ye(e,t,o){if(!n(o)||o==="")return e;let r=e.indexOf("#"),i=r===-1?"":e.slice(r),s=r===-1?e:e.slice(0,r),a=s.indexOf("?"),l=a===-1?s:s.slice(0,a),u=(a===-1?[]:s.slice(a+1).split("&")).filter((d)=>d!==""&&!gn(d,t));return u.push(`${t}=${encodeURIComponent(o)}`),`${l}?${u.join("&")}${i}`}function gn(e,t){let o=e.indexOf("="),r=o===-1?e:e.slice(0,o);if(r===t)return!0;if(!r.includes("%"))return!1;try{return decodeURIComponent(r)===t}catch{return!1}}function Je(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function xv(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||!b1.test(a))continue;let c=bn(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes($o)){let u=yn(r,c,a,o);if(u)s(u.dir,u.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${qI}/${a}`)}return i}function yn(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===""||!b1.test(l))return null;let c=r.find((d)=>d.toLowerCase()===l.toLowerCase());if(c===void 0||!b1.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${qI}/${o}/${c}`}}function bn(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function _v(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let s=JI(e,t.documentDir,t.mounts,t.lanes);if(s===null)return null;let{suffix:a}=g0(e);return Yx(fI(`${t.fileBaseUrl}${zv(s)}${a}`,Je(t.versions,s)),Je(t.revisions,s))}let[o]=t.mounts,r=o?Tn(e,t.documentDir,o):null,i=hn(e,t);return i===void 0?r:Yx(r??e,i)}function hn(e,t){if(!t.revisions||Object.keys(t.revisions).length===0)return;let o=JI(e,t.documentDir,t.mounts,t.lanes);return o===null?void 0:Je(t.revisions,o)}function Tn(e,t,o){if(GI(e))return null;let{path:r,suffix:i}=g0(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=KI(t,s);if(a===null)return null;let l=o2([o],a);if(!l)return null;return`${l}${i}`}function Xe(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function G(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function et(e){return e??C?.projectConfig??null}function tt(e){return e?.content??{}}function vn(e){let t=ln(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function nt(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function ot(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 On(e,t){let o=t===null?"[^/]+":`(?:${t.map((i)=>Xe(i)).join("|")})`,r=G(e).split($o).map((i)=>Xe(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function Pn(e,t,o){let r=On(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function Sn(e){return G(e).replaceAll($o,"").length}function Jd(e,t){if(e===null||e===void 0||e==="")return null;let o=et(t),r=vn(o),i=G(e),s=null,a=-1;for(let[l,c]of Object.entries(tt(o))){let{source:u}=c;if(u===void 0||u===""||nt(u))continue;let d=Sn(u);if(d<=a)continue;let f=Pn(u,i,r);if(f===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===f.length,name:l,...ot(c)},a=d}return s}function Gn(e,t){if(e===null||e===void 0||e==="")return null;let o=et(t),r=G(e),i=r.toLowerCase();for(let[s,a]of Object.entries(tt(o))){let{source:l}=a;if(l===void 0||l===""||!nt(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,...ot(a)}}return Jd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function ed(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function Qx(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,o)=>o?o.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function e0(e){return e.replaceAll(/(^|-)(\w)/g,(t,o,r)=>(o?" ":"")+r.toUpperCase())}function e1(e,t){return e?.$label||ed(t)}function lM(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(o,r,i)=>(r?" ":"")+i.toUpperCase());return ed(t)}function Ra(e){return e==="image"||e==="uri-reference"}function wh(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(Ra(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 xh(e,t){if(!e||!t?.content)return null;let o=Gn(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 Sv(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 t0(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())||e}function cM(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 YO(e){return e?.[0]??null}function Kx(e,t){if(!t||!e)return!1;return e.some((o)=>Cr(o,t))}function Ia(e){return z(e)}function z(e){let t=[];for(let o of e)t.push([...o]);return t}function Jx(e,t){if(Kx(e,t))return z(e.filter((o)=>!Cr(o,t)));return[...z(e),[...t]]}function ZO(e,t,o){let r=e.findIndex((a)=>Cr(a,o)),i=t?e.findIndex((a)=>Cr(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 XO(e){let t=[];for(let o of e)if(!t.some((r)=>Cr(r,o)))t.push([...o]);return t}function Jm(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 rt=null;function aM(e){rt=e}function it(){return rt}var X=null,Q=null,ee=null,Ie=!0;function st(){X=[],Q=[],ee=[],Ie=!0}function y(e){if(X)X.push(e)}function Bi(e){if(Q)Q.push(e)}function at(e){if(ee)ee.push(e)}function lt(){let e={docOps:Q??[],fmOps:ee??[],invertible:Ie,ops:X??[]};return X=null,Q=null,ee=null,Ie=!0,e}var wn=100,Cn=20;function ne(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function S(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 ct=null;function ut(e){ct=e}var dt=null;function ft(e){dt=e}function Rn(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)Mv(e.doc.document,le(t.docOps[i].inverse));for(let i=t.fmOps.length-1;i>=0;i--){let s=t.fmOps[i];Ee(e,s.field,s.before)}e.doc.document={...le(e.doc.document)},e.session.selection=o,e.doc.dirty=r}function Z(e,t,{skipHistory:o=!1,origin:r="user",coalesceKey:i=null,actor:s=null}={}){if(!e)return!1;if(r!=="remote"&&dt?.(e,r))return!1;let a=s??be;if(r!=="remote")je(e,a);let l=Ia(e.session.selection),c=e.doc.dirty;st();let u,d=null;try{t(e)}catch(A){d={error:A}}finally{u=lt()}if(d)throw Rn(e,u,l,c),d.error;let f=le(e.doc.document),x={...f},k=it(),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?In(a):null;if(A)kn(A,e,u,l);else pt(e,f,u,l,i)}return e.doc.dirty=!0,ct?.(e,u,r),!0}function pt(e,t,o,r,i=null){let s=e.history.snapshots.slice(0,e.history.index+1),a=ne()&&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=Ia(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%Cn===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:Ia(e.session.selection),selectionBefore:r}),s.length>wn){if(!s[1].document)s[1].document=ke(s,1);s.shift()}e.history.snapshots=s,e.history.index=s.length-1}function ke(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??[])Mv(i,a);return i}function Yd(e,t,o){return Z(e,(r)=>t(r.doc.document),o)}function De(e,t){Z(e,(o)=>{for(let r of t)xe(o,r)},{origin:"remote",skipHistory:!0})}function dM(e,t,{actor:o=null,selection:r={kind:"keep"}}={}){if(t.length===0)return"unchanged";return Z(e,(s)=>{for(let a of t)xe(s,a,p1(le(s.doc.document),a));An(s,r)},{actor:o})?"applied":"refused"}function An(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"&&Cr(Oe(e.session.selection),t.from))e.session.selection=[[...t.to]]}var Jn=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(Mv(e.doc.document,t),Bi({forward:t,inverse:o}),t.op){case"set-key":{if(Jn.has(t.key))y({key:t.key,op:"doc-meta"});else if(t.key==="style")y({op:"set-style",path:t.path});else if(t.key==="textContent")y({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")y({op:"replace",path:t.path});else{let i=t.key.startsWith("on")&&(xf(t.value)||xf(r));y({isEvent:i,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{y({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{y({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{y({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{y({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var V=new Map,M=new Map,be=null,mt=null;function gt(e){mt=e}function uM(e){let t=V.get(e.id);if(t)he(t);let o={owner:e,receipts:[]};return V.set(e.id,o),{owner:e,flush:()=>he(o),close:()=>{if(he(o),V.get(e.id)===o)V.delete(e.id);return[...o.receipts]}}}function bI(e,t){let o=be;be=e;try{return t()}finally{be=o}}function yt(e,t){let o=M.get(e);return o!==void 0&&(!t||o.lane.owner.id===t.id)}function hM(){for(let e of V.values())he(e)}function In(e){return V.get(e.id)??null}function he(e){for(let[t,o]of M)if(o.lane===e)bt(t,o)}function kn(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 je(e,t){let o=M.get(e);if(o&&o.lane.owner.id!==t?.id)bt(e,o)}function bt(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:[]};pt(e,le(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})}mt?.(e)}var F=new WeakMap;function Zd(e,t){if(t)F.set(e,t);else F.delete(e)}function pM(e){let t=F.get(e);return t?t.canUndo(e):e.history.index>0||M.has(e)}function fM(e){let t=F.get(e);return t?t.canRedo(e):!M.has(e)&&e.history.index<e.history.snapshots.length-1}function ht(e,t){let{snapshots:o}=e.history;e.doc.document=ke(o,t);let r=o[t];e.session.selection=Ia(le(r.selection))}function xt(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let o=JSON.stringify(ke(e.history.snapshots,t)),r=JSON.stringify(ir(le(e.doc.document)));if(o!==r)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function t1(e){je(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=ne()?o.inverseOps:null,i=ne()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Z(e,(a)=>{if(r)for(let l=r.length-1;l>=0;l--)xe(a,le(r[l]));if(i)for(let l=i.length-1;l>=0;l--){let c=le(i[l]);Ee(a,c.field,c.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Ia(le(o.selectionBefore??[])),e.history.index-=1,xt(e,e.history.index)}else e.history.index-=1,ht(e,e.history.index);e.doc.dirty=!0}function mM(e){je(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=ne()?o.forwardOps:null,i=ne()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Z(e,(a)=>{if(r)for(let l of r)xe(a,le(l));if(i)for(let l of i){let c=le(l);Ee(a,c.field,c.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Ia(le(o.selection)),e.history.index+=1,xt(e,e.history.index)}else e.history.index+=1,ht(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=Ov(i),a=df(o,s.length);s.splice(a,0,structuredClone(r)),y({index:a,op:"insert",parentPath:t}),Bi({forward:{index:a,node:Ce(r),op:"insert-child",parentPath:t},inverse:{index:a,op:"remove-child",parentPath:t}})}function _h(e,t){let o=uf(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=S(e.doc.document,i).children.splice(r,1);y({op:"remove",path:t}),Bi({forward:{index:r,op:"remove-child",parentPath:i},inverse:{index:r,node:Ce(s),op:"insert-child",parentPath:i}}),e.session.selection=ye(e.session.selection,t)}function vI(e,t){let o=uf(t);if(!o)return;let r=oe(e.doc.document,t);if(!r)return;let{index:i,parentPath:s}=o,a=structuredClone(le(r));S(e.doc.document,s).children.splice(i+1,0,a),y({index:i+1,op:"insert",parentPath:s}),Bi({forward:{index:i+1,node:Ce(a),op:"insert-child",parentPath:s},inverse:{index:i+1,op:"remove-child",parentPath:s}}),e.session.selection=[[...s,"children",i+1]]}function Ym(e,t){for(let o of sg(t))_h(e,o)}function n0(e,t){let o=[];for(let r of sg(t)){let i=e.session.selection;vI(e,r);let s=Oe(e.session.selection),a=uf(s);if(!s||!a||e.session.selection===i)continue;o=o.map((l)=>h1(a.parentPath,l,a.index,1,!0)),o.unshift(s)}if(o.length>0)e.session.selection=o}function gM(e,t,o="div"){let r=uf(t);if(!r)return;let i=oe(e.doc.document,t);if(!i)return;let{index:s,parentPath:a}=r,l={children:[structuredClone(le(i))],tagName:o},c=Ce(i);S(e.doc.document,a).children.splice(s,1,l),y({op:"replace",path:t}),Bi({forward:{index:s,node:Ce(l),op:"set-child",parentPath:a},inverse:{index:s,node:c,op:"set-child",parentPath:a}}),e.session.selection=[[...a,"children",s]]}function Kp(e,t,o,r){let i=e.doc.document,s=d0(i,t,o,r);if(!s)return;let{forward:a,inverse:l}=s,c=oe(i,a.fromParentPath),u=oe(i,o),[d]=c.children.splice(a.fromIndex,1);if(Ov(u).splice(a.toIndex,0,d),y({fromPath:t,op:"move",toIndex:a.toIndex,toParentPath:o}),Bi({forward:a,inverse:l}),Cr(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=Ce(s);if(r===void 0||r===null||r==="")delete i[o];else i[o]=r;if(Bi(P(t,o,a,Ce(i[o]))),o==="children")e.session.selection=ye(e.session.selection,[...t,"children"]);if(o==="textContent")y({op:"set-text",path:t});else if(o==="style")y({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&xf(l);y({isEvent:c,key:o,op:"set-prop",path:t})}}function Zm(e,t,o,r){let i=S(e.doc.document,t),s=Ce(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,Ce(i.style))),y({op:"set-style",path:t})}function _r(e,t,o,r){let i=S(e.doc.document,t),s=Ce(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,Ce(i.attributes))),y({attr:o,op:"set-attr",path:t})}function bM(e,t,o,r,i){if(!o)return Zm(e,t,r,i);let s=S(e.doc.document,t),a=Ce(s.style);if(!s.style)s.style={};let l=`@${o}`,c=ld(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,Ce(s.style))),y({op:"set-style",path:t})}function i0(e,t,o,r,i){let s=S(e.doc.document,t),a=Ce(s.style);if(!s.style)s.style={};let l=ld(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,Ce(s.style))),y({op:"set-style",path:t})}function vM(e,t,o,r,i,s){let a=S(e.doc.document,t),l=Ce(a.style);if(!a.style)a.style={};let c=`@${o}`,u=ld(a.style,c),d=ld(u,r);if(s===void 0||s===""){if(delete d[i],Object.keys(d).length===0)delete u[r];if(Object.keys(u).length===0)delete a.style[c]}else d[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(P(t,"style",l,Ce(a.style))),y({op:"set-style",path:t})}function Tt(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 o0(e,t,o,r,i){let s=S(e.doc.document,t),a=Ce(s.style);if(!s.style)s.style={};let l=s.style;for(let c of o)l=ld(l,c);if(i===void 0||i==="")delete l[r],Tt(s.style,o);else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(P(t,"style",a,Ce(s.style))),y({op:"set-style",path:t})}function yM(e,t,o,r,i,s){let a=S(e.doc.document,t),l=Ce(a.style);if(!a.style)a.style={};let c=`@${o}`,u=ld(a.style,c),d=u;for(let f of r)d=ld(d,f);if(s===void 0||s===""){if(delete d[i],Tt(u,r),Object.keys(u).length===0)delete a.style[c]}else d[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(P(t,"style",l,Ce(a.style))),y({op:"set-style",path:t})}function wM(e,t,o){let r=S(e.doc.document,t),i=Ce(r.style);if(o&&Object.keys(o).length>0)r.style=o;else delete r.style;Bi(P(t,"style",i,Ce(r.style))),y({op:"set-style",path:t})}function Xd(e,t,o){let r=e.doc.document,i=Ce(r.state);if(!r.state)r.state={};r.state[t]=o,Bi(P([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function xM(e,t){let o=e.doc.document;if(o.state){let r=Ce(o.state);if(delete o.state[t],Object.keys(o.state).length===0)delete o.state;Bi(P([],"state",r,Ce(o.state))),y({key:"state",op:"doc-meta"})}}function Ur(e,t,o){let r=e.doc.document,i=Ce(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,Ce(r.state))),y({key:"state",op:"doc-meta"})}function _M(e,t,o){let r=e.doc.document;if(!r.state||!r.state[t])return;let i=Ce(r.state);r.state[o]=r.state[t],delete r.state[t],Bi(P([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function Jp(e,t,o,r){let i=S(e.doc.document,t),s=Ce(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,Ce(i.$props))),y({op:"replace",path:t})}function SM(e,t,o,r){let i=S(e.doc.document,t),s=Ce(i.cases);if(!i.cases)i.cases={};i.cases[o]=r||{tagName:"div",textContent:o},Bi(P(t,"cases",s,Ce(i.cases))),y({op:"replace",path:t})}function CM(e,t,o){let r=S(e.doc.document,t);if(r.cases){let i=Ce(r.cases);delete r.cases[o],Bi(P(t,"cases",i,Ce(r.cases))),y({op:"replace",path:t})}}function kM(e,t,o,r){let i=S(e.doc.document,t);if(!i.cases||!i.cases[o])return;let s=Ce(i.cases);i.cases[r]=i.cases[o],delete i.cases[o],Bi(P(t,"cases",s,Ce(i.cases))),y({op:"replace",path:t})}function Qd(e,t,o){let r=e.doc.content.frontmatter,i=Object.hasOwn(r,t)?Ce(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:Ce(o);at({after:a,before:i,field:t}),e.doc.dirty=!0}function Ee(e,t,o){if(o===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=o}var W=[],Dn=50;function EM(e){return Object.assign(Ux(),{turnId:e})}function TM(e,t,o=[]){if(t.length===0)return[];let r={batches:[...o],id:e,writes:[...t]};W.push(r);while(W.length>Dn)W.shift();return r.writes}function LM(e){return W.find((t)=>t.id===e)?.writes??[]}function $M(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=En(s,a);if(l)return l}for(let[s,a]of i)for(let l of a)t1(s);return[...i.keys()]}function En(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 IM(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 n1(){W.splice(0)}function RM(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 Gm(e){let t=new Set,o=new Set;return $v(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function KO(e,t){if(!t)return e;return Me(e,"",t)}function Me(e,t,o){if(Array.isArray(e)){let i=null;for(let[s,a]of e.entries()){let l=Me(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=Me(s,`${t}/${LI(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 JC=["design","content","media","styles","publish","settings"],Up="design",vt=[{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"}],Hx=vt.filter((e)=>e.switcher);function aI(e){return typeof e==="string"&&JC.some((t)=>t===e)}function bh(e){return vt.find((t)=>t.id===e)}var $e="workspace://",Bx={content:"content-home",media:"media-home",publish:"publish-home",settings:"settings-home"};function qp(e){return Object.hasOwn(Bx,e)}function $a(e){return`${$e}${e}`}function ml(e){if(!e.startsWith($e))return null;let t=e.slice($e.length);return aI(t)&&qp(t)?t:null}function gv(e){let t=ml(e);return t?bh(t).title:null}var Mn=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"],["image","image"],["preview","canvas"],["source","code"],["stylebook","config"],["tokens","tokens"]]),Gp={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",image:"Image",media:"Media",none:"None",tokens:"Variables"};function Qs(e){return Mn.get(e)??"canvas"}var $n=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function UO(e){return $n.get(e)??"design"}var zx=(e)=>e.editor.kind==="canvas",vh=(e)=>zx(e)&&e.selection.count>0,Wx=(e)=>vh(e)&&!e.selection.isRoot;function bv(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},workspace:{id:Up},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=bv();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var Ln=["palette"],Nn=["caret","global"],_n=["dock","global"],Fn=["canvas","global"],Vn=["grid","global"],Wn=["code","global"],Ot=["global"];function qO(e){if(e.modal.open)return Ln;if(e.caret.active)return Nn;if(e.focus.region!=="pane")return _n;switch(e.editor.kind){case"grid":return Vn;case"code":return Wn;case"canvas":return e.canvas.view==="preview"?Ot:Fn;default:return Ot}}var an="project.json";function Bn(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 Kn=["edit","design","preview","source","stylebook","git-diff"];function yv({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:d=null,canvasMode:f}){let x=me(),k=Gm(r),j=a?.modes??Un(t,s),A=f??j.find((b)=>b!=="preview")??"edit",ue=j[0]==="preview",E={bareRepeaters:k,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:u,mode:zn(t,s),source:d,sourceFormat:s},de={index:0,snapshots:[{document:structuredClone(r),selection:[]}]},U={canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:l,selection:[],ui:Bn(A,ue)};return x.run(()=>({capabilities:{modes:j},doc:g(E),documentPath:t,fileHandle:o,history:g(de),id:e,pinned:!1,preview:c,scope:x,session:g(U)}))}function Un(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 Kn}function zn(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 dI(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 JO(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&Qs(o)===t)}function Km(e){e.scope.stop()}var Pt=new WeakMap,B=new Map;function xn(e){let t=le(e),o=Pt.get(t);if(!o)o=g({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),Pt.set(t,o);return o}function wt(e){B.set(e,(B.get(e)??0)+1)}function Ct(e){let t=B.get(e)??0;if(t<=1)B.delete(e);else B.set(e,t-1)}function wv(e){return B.has(e.replaceAll("\\","/"))}var Yn=8000,Zn=800,Xn=2500,Rt=null;function Qn(){return Rt??=(ce("f9qr7kzh"),import("./index-f9qr7kzh.js")),Rt}function Jt(){try{return p()}catch{return null}}var H=null;function QO(e){H=e}var Ne=null;function eM(e){Ne=e}var It=()=>{};function tM(e){It=e??(()=>{})}var _e=new WeakMap;function kt(e){return le(e)}function Ve(e,t){return e.frontmatterMap(t)}function eo(e){return e.synced}function D(e){return _e.get(kt(e))}function He(e){let t=kt(e),o=_e.get(t);if(!o)o={attaching:null,generation:0,optedOut:g({value:!1}),session:null,watcherInstalled:!1},_e.set(t,o);return o}var At=!1;function to(){if(At)return;At=!0,ut(no),gt(oo),ft((e)=>{if(D(e)?.session?.synced&&xn(e).sourceCanonical)return It("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function no(e,t,o){let r=D(e)?.session;if(!r||!r.synced)return;if(r.lastSeenRef=le(e.doc.document),o==="remote"){Te(r);return}if(r.canWrite)ro(r,t),Te(r)}function oo(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 ro(e,t){let o=t.docOps.map((r)=>r.forward);if(yt(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(le(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 Le(e){let t=e.collab.yDocToJson(e.handle.doc);Z(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 io(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||!io(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=Xn){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,We(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),We(e)},Zn)}async function We(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 Dt(e){if(!Ne||!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 Ne(r,s)}catch{return}if(!eo(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=Ve(t,o.doc),u=a.frontmatter??{};o.doc.transact(()=>{let d=[...c.keys()];for(let f of d)if(!(f in u))c.delete(f);for(let[f,x]of Object.entries(u))if(!t.deepEqual(c.get(f),x))c.set(f,x)},t.MIRROR_ORIGIN)}function nM(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)Dt(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function ea(e){let t=xn(e);return t.active&&t.readOnly}async function uI(e){let t=D(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await We(t),await t.handle.flush(),!0}async function iM(){for(let e of Be)if(D(e)?.session?.synced)await uI(e)}var Be=new Set;function ie(e){if(!Jt()?.collab||!e.documentPath||e.documentPath===an)return;let o=He(e);if(o.watcherInstalled)return;o.watcherInstalled=!0,to(),Be.add(e),e.scope.run(()=>{te(()=>{if(o.optedOut.value)ve(e);else Ke(e)}),ia(()=>{Be.delete(e),ve(e)})})}function hI(e,t){let o=He(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function pI(e){return D(e)?.optedOut.value!==!0}function jt(e){if(!D(e)?.watcherInstalled){ie(e);return}ve(e),Ke(e)}async function Ke(e){let t=He(e);if(t.session||t.attaching)return;let{documentPath:o}=e,r=Jt();if(!o||!r?.collab){xn(e).status="unavailable";return}let{generation:i}=t,s=xn(e);s.status="connecting",s.attachError="";let a=(async()=>{try{let[l,c]=await Promise.all([Qn(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let u,d=new Promise((f,x)=>{u=setTimeout(()=>x(Error("collab-sync-timeout")),Yn)});try{await Promise.race([c.whenSynced,d])}finally{clearTimeout(u)}if(t.generation!==i){c.destroy();return}t.session=so(e,o,l,c),s.active=!0,s.status="synced",s.readOnly=!t.session.canWrite,s.attachError="",wt(o)}catch(l){s.status="failed",s.active=!1,s.attachError=l instanceof Error?l.message:String(l),w.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=xn(e);if(r.active=!1,r.status="detached",r.attachError="",r.peers=[],!o)return;if(Ct(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}Zd(e,null),e.history.snapshots=[{document:ir(le(e.doc.document)),selection:Ia(e.session.selection)}],e.history.index=0,o.undoManager?.destroy(),o.handle.destroy()}function so(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:le(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(le(e.doc.document));if(!o.deepEqual(b,T)){let J=o.diffDocs(T,b);if(J===null)s.synced=!0,Le(s),s.synced=!1;else if(J.length>0)De(e,J)}s.applyingRemoteFrontmatter=!0;let O=Ve(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(le(e.doc.document)),{frontmatter:ir(le(e.doc.content.frontmatter)),origin:o.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});s.lastSeenRef=le(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",Ia(e.session.selection))},u=({stackItem:b})=>{let T=b.meta.get("selection");e.session.selection=Ia(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)}),Zd(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let d=o.structureMap(r.doc),f=(b,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;let O=o.yEventsToDocOps(b);if(O===null){Le(s);return}if(O.length===0)return;try{De(e,O)}catch{Le(s)}};d.observeDeep(f),s.disposers.push(()=>d.unobserveDeep(f));let x=xn(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),ue=(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,Dt(s)},600)};A.observe(ue),s.disposers.push(()=>A.unobserve(ue));let E=Ve(o,r.doc),de=(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(de),s.disposers.push(()=>E.unobserve(de)),e.scope.run(()=>{let b=JSON.stringify(e.doc.content.frontmatter);te(()=>{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,Ge]of Object.entries(O))if(!o.deepEqual(E.get(N),Ge))E.set(N,Ge)},o.LOCAL_ORIGIN),Te(s)}),te(()=>{let T=e.session.selection.length>0?Ia(e.session.selection):null,O=r.awareness.getLocalState();if(O)r.awareness.setLocalState({...O,structuralSelection:T})}),te(()=>{let T=le(e.doc.document);queueMicrotask(()=>{if(D(e)?.session!==s||!s.synced||!s.canWrite)return;let J=le(e.doc.document);if(J!==T||J===s.lastSeenRef)return;s.lastSeenRef=J,re(s),Te(s)})})});let U=xn(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});U.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")U.status="offline";else if(s.synced)U.status="synced"}),r.onReset(()=>{ve(e),Ke(e)})),s.synced=!0,s}function I(e,t,o){return RangeError(`command "${e}" argument "${t}": ${o}`)}function ao(e){if(Y(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}"`:`${ao(e)} ${JSON.stringify(e)}`}function Mt(e){return Array.isArray(e)&&e.every((t)=>n(t)||Y(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 $t(e,t,o){let r=t[o];if(!Y(r)||!Number.isFinite(r))throw I(e,o,`expected a finite number, got ${R(r)}`);return r}function Et(e,t,o){let r=t[o];if(!Y(r)||!Number.isInteger(r))throw I(e,o,`expected an integer, got ${R(r)}`);return r}function Zx(e,t,o,r,i){let s=$t(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 qn(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 QC(e,t,o){let r=t[o];if(!Mt(r))throw I(e,o,`expected an array of path segments (strings or numbers), got ${R(r)}`);return r}function oM(e,t,o){if(t[o]===null)return null;return QC(e,t,o)}function mI(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(!Mt(i))throw I(e,o,`entry ${s} is not a document path — expected an array of segments, got ${R(i)}`);return i})}function Se(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 gl(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function gI(e,t={}){return{description:e,type:"number",...t}}function To(e){return{description:e,type:"boolean"}}function Xx(e,t=!1){let o={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[o,{type:"null"}]}:{description:e,...o}}function rM(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function Fe(e){return{description:e,type:"string"}}function lo(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Ue(e){return n(e)?[e]:e}function Lt(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 lo(o)?"path":"pass-through";return o==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function Nt(e,t){switch(e){case"null":return t===null;case"boolean":return Ze(t);case"string":return n(t);case"number":return Y(t)&&Number.isFinite(t);case"integer":return Y(t)&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return _(t)&&!Array.isArray(t);default:break}return!1}function _t(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function co(e,t,o,r){let i=t[o];if(i===void 0||!r.some((s)=>Nt(s,i)))throw I(e,o,`expected ${_t(r)}, got ${R(i)}`);return i}function Vt(e){switch(Lt(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)=>Vt(t)).join(" or ");case"typed":return _t(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 uo(e,t,o,r){let i=t[o],s=[];for(let a of r){if(a.type!==void 0&&!Ue(a.type).some((l)=>Nt(l,i)))continue;try{return Bt(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw I(e,o,`expected ${r.map((a)=>Vt(a)).join(" or ")}, got ${R(i)}`)}function Bt(e,t,o,r){switch(Lt(r)){case"enum":return qn(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 uo(e,t,o,r.oneOf??[]);case"typed":return co(e,t,o,Ue(r.type??[]));case"boolean":return Hi(e,t,o);case"bounded-number":{if(r.type==="integer")Et(e,t,o);return Zx(e,t,o,r.minimum,r.maximum)}case"number":return $t(e,t,o);case"integer":return Et(e,t,o);case"string":return St(e,t,o);case"path":return QC(e,t,o);case"path-list":return mI(e,t,o);default:return t[o]}}function sM(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]=Bt(e,o,c,i[c])}return l}var fo=20,fi="primary",Xm="secondary",yI=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=qr();return e.derived?.kind==="lens"?pn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return qr().tabOrder}}),h=Ph(()=>m.activeTabId?m.tabs.get(m.activeTabId)??null:null);function qr(){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 Da(e){return m.panes.find((t)=>t.tabOrder.includes(e))}function Sr(e){let t=pn(e);if(!t||t.id===m.activePaneId)return;m.activePaneId=t.id,L();let{activeTabId:o}=t;if(o){qe(o);let r=m.tabs.get(o);if(r)zt(r)}}function Qm(e){return m.activePaneId===e}function i1(e){let t=e??qr().activeTabId,o=t?m.tabs.get(t):null;if(!t||!o)return null;let r=Da(t);if(!r)return null;let i=oc(r.id);return ng(t),Sh(i,t),i.activeTabId=t,m.activePaneId=i.id,L(),qe(t),i}function o1(e){return m.panes.find((t)=>t.id!==e)??po(Xm)}function oc(e){let t=o1(e);if(t.derived)t.derived=null;return t}function po(e){let t=pn(e);if(t)return t;return m.panes=[...m.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],pn(e)}function eg(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)Sh(r,s);let i=o.activeTabId!==null&&K(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 tg(e){return e.tabOrder.length===0&&e.derived===null}var K=()=>!0;function r1(e){K=e??(()=>!0)}var Ut=null;function s1(e){Ut=e}var qt=null;function a1(e){qt=e}function mo(){let e=0;for(let t of m.tabs.keys())if(K(t))e+=1;return e}function Gt(e){return e.tabOrder.findLast((t)=>K(t))??null}function ng(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=Gt(o);if(o.id!==fi&&tg(o))t.push(o.id)}for(let o of t)eg(o)}function Sh(e,t,o){if(e.tabOrder.includes(t))return;let r=o??bo(e,t);e.tabOrder=[...e.tabOrder.slice(0,r),t,...e.tabOrder.slice(r)]}function yo(e){let t=0;for(let o of e.tabOrder){if(m.tabs.get(o)?.pinned!==!0)break;t+=1}return t}function bo(e,t){return m.tabs.get(t)?.pinned===!0?yo(e):e.tabOrder.length}function rc(e,t=null){if(m.projectRoot&&e!==m.projectRoot)n1();m.projectRoot=e,m.projectConfig=t}function Yp(e){let t=h.value;return e!==null&&t!==null&&le(t)===le(e)}function bl(e){if(!e)return!1;let t=m.tabs.get(e.id);return t!==void 0&&le(t)===le(e)}function qe(e){m.mruOrder=[e,...m.mruOrder.filter((t)=>t!==e)]}var Pe=null,se=0;function L(){Pe=null,se=0}function zt(e){if(C&&e.documentPath)C.selectedPath=e.documentPath}function l1(e){let t=pn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=m.tabs.get(e),r=Da(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(m.activePaneId=r.id,!t.cycling)L(),qe(e);zt(o)}function Si(e){if(e.background===!0){let a=m.tabs.get(e.id);if(a)return a;let l=yv({...e,preview:!1}),c=(e.paneId===void 0?void 0:pn(e.paneId))??qr();return Sh(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=yv({...e,preview:o}),i=(e.paneId===void 0?void 0:pn(e.paneId))??qr(),s;if(t)r.pinned=t.pinned,Km(t);else{if(o){let l=Ht(i),c=l?m.tabs.get(l):null;if(c)nu(c);c1()}let a=o?Ht(i):null;if(a)s=i.tabOrder.indexOf(a),eu(a);Sh(i,r.id,s)}return m.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Ht(e){return e.tabOrder.find((t)=>m.tabs.get(t)?.preview===!0)??null}function td(e){let t=m.tabs.get(e);if(t?.preview===!0)t.preview=!1}function c1(){for(let[e,t]of m.tabs)if(t.preview&&(t.doc.dirty||Cv(t)))td(e)}var Yt=null;function wI(e){Yt=e}function Cv(e){return Yt?.(e)??!1}function r0(e,t){let o=m.tabs.get(e),r=Da(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 xI(e,t){let o=m.tabs.get(e),r=Da(e);if(!o||!r)return;r.tabOrder=Zt(r,e,t)}function Zt(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 eu(e){let t=m.tabs.get(e);if(!t)return;let o=Da(e),r=o?.activeTabId===e;if(ho(t),Km(t),m.tabs.delete(e),Vx(e),ng(e),m.mruOrder=m.mruOrder.filter((l)=>l!==e),L(),o&&tg(o))eg(o.id);if(!r)return;let i=qr(),s=qt?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??m.mruOrder.find((l)=>i.tabOrder.includes(l)&&K(l))??Gt(i);if(a)ae(a);else Ut?.(i.id)}function _I(){let e=[...m.tabs.values()];m.tabs.clear(),Xt(),m.mruOrder=[],L();for(let t of e)Km(t)}function Xt(){m.panes=[{activeTabId:null,derived:null,id:fi,tabOrder:[]}],m.activePaneId=fi}function ho(e){if(!e.documentPath)return;let t=e.documentPath;m.closedTabs=[{documentPath:t},...m.closedTabs.filter((o)=>o.documentPath!==t)].slice(0,fo)}function xo(){let[e]=m.closedTabs;if(!e)return;return m.closedTabs=m.closedTabs.slice(1),e.documentPath}function Kt(e){if(!Pe)Pe=m.mruOrder.filter((r)=>m.tabs.has(r)&&K(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 SI(e){let t=[...m.tabs.keys()],o=[...m.tabs.values()],r=yv(e);m.tabs.set(r.id,r),Xt(),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)Km(i);return r}function Ft(e,t={}){ae(e,t)}function kv(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=Zt(r,e,o);return r}return ng(e),Sh(r,e,o),r}function CI(e,t,o){let r=m.tabs.get(e);if(!r)return;if(r.id=t,r.documentPath=o,ZC(e))Vx(e),qm(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(),jt(r)}function kI(e,t){e.registerAll([...vo(t),...Oo(t)])}function vo(e){let t=()=>mo()>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:()=>{Kt(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:()=>{Kt(-1)}},{args:Se({path:Fe('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 ${Gp[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:Se({file:Fe('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=oc(qr().id);if(await e.openFile(i,{paneId:s.id}),![...m.tabs.values()].some((a)=>a.documentPath===i)){if(tg(s)&&s.id!==fi)eg(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=xo();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)r0(o,!r.pinned)}},{args:Se({pinned:To("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))r0(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)td(o)}}]}function Oo(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:()=>{i1()}},{args:Se({path:Fe("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=qr();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(oc(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:()=>{Sr(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:()=>{Sr(Xm)}},{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:Po}]}function Po(){let e=m.panes.find((t)=>t.derived!==null);if(e?.id===fi){if(e.derived=null,!tg(e))return}eg(e?.id??Xm)}
2
+ export{KC,jn,Fx,fv,Wt,ln,go,jx,mv,Qc,VO,JC,Up,Hx,aI,bh,Bx,qp,$a,ml,gv,Gp,Qs,UO,zx,vh,Wx,bv,YC,qO,qm,Vx,ZC,lI,vv,Hn,Vr,Ux,yh,qx,GO,Gx,cI,Gm,KO,an,yv,XC,dI,JO,Km,xn,wv,Oe,YO,Kx,Ia,Jx,ZO,XO,Jm,QO,eM,tM,nM,ea,uI,iM,hI,pI,fI,Yx,xv,_v,St,ti,Zx,Hi,qn,QC,oM,mI,Se,pi,gl,gI,To,Xx,rM,Fe,sM,aM,Bi,Jd,Gn,ed,Qx,e0,e1,lM,Ra,wh,xh,Sv,t0,cM,ir,Z,Yd,dM,uM,bI,hM,Zd,pM,fM,t1,mM,or,_h,vI,Ym,n0,gM,Kp,Qe,Zm,_r,bM,i0,vM,o0,yM,wM,Xd,xM,Ur,_M,Jp,SM,CM,kM,Qd,EM,TM,LM,$M,IM,n1,RM,fi,Xm,yI,m,h,qr,pn,Da,Sr,Qm,i1,o1,oc,eg,tg,r1,s1,a1,ng,Sh,rc,Yp,bl,l1,Si,td,c1,wI,Cv,r0,xI,eu,_I,SI,Ft,kv,CI,kI};
3
+
4
+ //# debugId=2896DE7491A37F0564756E2164756E21
5
+ //# sourceMappingURL=studio-yrcrncev.js.map
@@ -1,5 +1,5 @@
1
- import{VA}from"./studio-f2j9et3h.js";import{bC,h}from"./studio-j933k8nr.js";import{g}from"./studio-ahf3cspq.js";import{T,R}from"./studio-cvz0e00f.js";import{Wt}from"./studio-5e7p1vgd.js";import{Se}from"./studio-tpy3rdxn.js";import{n,Z,Ze,_,v,Me,Oa,Ma}from"./studio-zsjpsw08.js";var B={anyOf:[{additionalProperties:!1,description:"Two-way: `target` is the test, `value` the tag when it is truthy, `initial` the tag when it is not.",properties:{initial:{$ref:"#/$defs/TagName"},operator:{const:"?:",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/TagName"}},required:["operator","target","value","initial"],title:"?: — the tag when the test holds, and the tag when it does not"},{additionalProperties:!1,description:"Multiway: `target` is the discriminant, matched against case keys by its string form. "+"`default` is required — an element with no tag cannot exist.",properties:{cases:{additionalProperties:{$ref:"#/$defs/TagName"},type:"object"},default:{$ref:"#/$defs/TagName"},operator:{const:"switch",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target","cases","default"],title:"switch — one tag per discriminant value, with a required fallback"}],description:"A tag name chosen at element creation. Every branch resolves to a `TagName`, so the candidate set is enumerable without evaluating anything."},G={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]};var K={description:"HTML element tag name or custom element name (must contain a hyphen per Web Components spec). "+"A NAME, never an expression: no `${…}` position in the pipeline evaluates a tagName. Use "+"`$switch`/`cases` to vary the element.",minLength:1,pattern:"^[a-zA-Z][a-zA-Z0-9._-]*$",type:"string"};var Y={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]};var Ce={additionalProperties:!0,description:"A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",properties:{attributes:{additionalProperties:{oneOf:[{type:"string"},{type:"boolean"}]},type:"object"},children:{items:{$ref:"#/$defs/HeadEntry"},type:"array"},tagName:{type:"string"},textContent:{description:"Element content. An object is serialized to JSON inside the tag — that is how a "+'JSON-LD block (`<script type="application/ld+json">`) is authored.',oneOf:[{type:"string"},{type:"object"}]}},required:["tagName"],type:"object"};var Ee={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"};var Re={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"};var Pe={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"};var X={additionalProperties:!1,description:"A $ref binding. Resolves to a state entry (reactive) or plain value (static).",properties:{$ref:{$ref:"#/$defs/AnyRef"}},required:["$ref"],type:"object"};var H={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/StyleObject"}]},description:"CSS style definition. camelCase property names follow CSSOM convention. Keys starting with :, ., &, or [ are treated as nested CSS selectors. Keys matching $media breakpoint names (or other @-prefixed at-rules) group nested rules. Nesting is recursive: selector and at-rule groups may nest to arbitrary depth "+"(e.g. breakpoint → selector → pseudo-class), mirroring the compiler's recursive emission. "+"An object carrying $ref is a reactive VALUE, and the runtime reads it as one. It also matches the nested-block branch vacuously, since a block admits a string under any key, which is why these branches are anyOf rather than oneOf. A DECLARATION at-rule (@font-face, @property, @position-try, @counter-style) may hold an ARRAY of blocks, which is that key written more than once, in order: an object's keys are "+"unique, so @font-face — the at-rule whose identity is not in its key — could not otherwise "+"state a family's second weight at all.",patternProperties:{"^@(font-face|property|position-try|counter-style)":{anyOf:[{$ref:"#/$defs/StyleObject"},{items:{$ref:"#/$defs/StyleObject"},minItems:1,type:"array"}]}},properties:{$description:{description:"Why this rule exists. Emitted as a comment by static builds, ignored at runtime.",type:"string"}},type:"object"};var q={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Ae={description:"Array of child definitions — elements, text, or Array namespaces (dynamic lists) mixed "+"freely. A bare Array namespace (the whole children slot is one dynamic list) is also "+"accepted for backward compatibility, as is a ${…} template string that resolves at build "+"time to an array of child definitions.",oneOf:[{items:{anyOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/SwitchNode"},{$ref:"#/$defs/ArrayNamespace"},{type:"string"},{type:"number"}]},type:"array"},{$ref:"#/$defs/ArrayNamespace"},{description:"Computed children — a ${…} template that resolves at build time to an array of child "+'definitions (e.g. "${state.entry.$children}" for parsed content). A bare plain-text string is NOT a valid children value; text children must be array items.',pattern:String.raw`\$\{`,type:"string"}]};var Q={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},ee={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object"},{$ref:"#/$defs/RefObject"}]},description:"Explicit prop passing at a component boundary.",type:"object"},te={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},re={additionalProperties:!1,description:"Reactive $ref that drives which case to render: a state entry, or inside a mapped array's template the row's $map/item or $map/index (spec §14.1).",properties:{$ref:{oneOf:[{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/MapRef"}],type:"string"}},required:["$ref"],type:"object"};var oe={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive. First parameter is always state (the reactive scope).',properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: an opaque JS source string (first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → JS string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"};var Fe={additionalProperties:!1,description:"A JSON Pointer $ref operand within an expression node. $args/<name> resolves a named formula's parameter (callable entries only).",properties:{$ref:{pattern:String.raw`^(\$map/|\$reduce/|\$args/|event#/|#/|parent#/|window#/|document#/)`,type:"string"}},required:["$ref"],type:"object"},Ne={anyOf:[{not:{pattern:String.raw`\$\{`},type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"},{description:"Plain-object literal (e.g. an Intl options bag). Objects carrying $ref or operator keys are pointers/nodes, never literals.",not:{anyOf:[{required:["$ref"]},{required:["operator"]}]},type:"object"}],description:"A non-reactive operand: scalar, plain-object literal, or array of operands."};var Te={additionalProperties:!1,description:"The core expression node. operator + target, with value gated by arity.",oneOf:[{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/UnaryOperator"}},required:["operator"],title:"Unary — target only, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/BinaryOperator"}},required:["operator","value"],title:"Binary — left in target, right in value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/AssignmentOperator"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"Assignment — writable target, value required"},{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/NoArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator"],title:"pop / shift — array receiver, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/OneArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"push / unshift — array receiver, single value argument"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/SpliceMethod"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},minItems:1,type:"array"}},required:["operator","value"],title:"splice — array receiver, [start, deleteCount, ...items]"},{properties:{operator:{$ref:"#/$defs/ReduceMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value","initial"],title:"reduce — pure fold over a pointer or derived array; seed in initial"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/MapFilterMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value"],title:"map / filter — pure over a pointer or derived array; per-item expression in value"},{description:"The ECMAScript conditional (ternary) operator, pure: target is the test, value the consequent, initial the alternate (the reduce precedent for repurposing initial). Chain else-if by nesting another ?: node in initial.",properties:{operator:{$ref:"#/$defs/ConditionalOperator"}},required:["operator","value","initial"],title:"?: — pure conditional; test in target, consequent in value, alternate in initial"},{description:"Value-keyed multiway selection, pure: target is the discriminant (matched against case keys by its string form, like element-level $switch), cases maps matched values to result operands, default is the operand when no case matches (result is undefined without it). Condition-chain branching composes from nested ?: nodes instead.",not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},type:"object"},default:{$ref:"#/$defs/ExpressionOperand"},operator:{$ref:"#/$defs/SwitchOperator"}},required:["operator","cases"],title:"switch — pure value-keyed selection; discriminant in target, results in cases/default"},{description:"A pure standard-library method call: target is the receiver (any operand — never mutated; change-by-copy names replace the mutating originals), value the optional argument (bare scalar) or argument list (array). A missing receiver or method yields undefined, matching null-safe path reads.",not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/PureMethod"}},required:["operator"],title:"Pure method — genuine prototype methods; receiver in target, args in value"},{description:"Invoke a callable, pure in formula position: target is the callee pointer — a named formula entry (#/state/…) or a blessed pure global via window#/ (Math.*, JSON.*, Object.keys/values/entries, and "+`${VA()}) — and value is the positional argument list (the splice args-in-value precedent). Argument order follows the callee's declared parameters.`,not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/CallOperator"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"}},required:["operator"],title:"call — invoke a named formula or blessed global; callee in target, args in value"}],properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},description:"switch only: matched discriminant value (string form) → result operand.",type:"object"},default:{$ref:"#/$defs/ExpressionOperand",description:"switch only: result operand when no case key matches."},initial:{$ref:"#/$defs/ExpressionOperand"},operator:{type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target"],type:"object"},ne={additionalProperties:!1,description:"A declarative expression entry (Shape 5). Used as a state entry or inline event handler. With parameters it is a named formula: a pure, reusable computation invoked via the call operator, its parameters resolved through $args/<name> refs in the body.",properties:{$description:{type:"string"},$expression:{$ref:"#/$defs/ExpressionNode"},$title:{type:"string"},parameters:{description:"Named-formula parameters (CEM convention, as on Function entries): bare names or CEM parameter objects. Present ⇒ the entry is callable, not a computed value.",items:{anyOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"}},required:["$expression"],type:"object"};var De={description:"A single state entry. Shape is determined by value type: "+"scalar/array → naked reactive property, string with ${} → computed, "+'object with $prototype: "Function" → function, '+"object with $prototype: <other> → data source, "+"object with type and default → typed reactive property, "+"plain object → naked object reactive property.",oneOf:[{type:"number"},{type:"boolean"},{type:"null"},{type:"string"},{type:"array"},{$ref:"#/$defs/TypedStateDef"},{$ref:"#/$defs/FunctionDef"},{$ref:"#/$defs/ExternalClassDef"},{$ref:"#/$defs/ExpressionEntry"},{not:{anyOf:[{required:["$prototype"]},{required:["default"]},{required:["type"]},{required:["$expression"]}]},type:"object"}]};var Je={description:"Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",properties:{documentKinds:{description:'"page"/"component" allow the extension in pages/components discovery; "content" allows it as a content-type source.',items:{enum:["page","component","content"],type:"string"},type:"array"},exportTarget:{description:"When true, site builds emit a serialized sidecar per page in this format.",type:"boolean"},extensions:{description:'File extensions this format claims, with leading dot (e.g. [".md"]).',items:{pattern:String.raw`^\.`,type:"string"},minItems:1,type:"array"},mediaType:{description:"MIME type for the format (icons, labels, HTTP).",type:"string"},remote:{description:"When true, the load capability accepts http(s) URLs as sources.",type:"boolean"}},required:["extensions"],type:"object"},qe={additionalProperties:!1,description:"Project-section admission block (specs/extensions.md §9). A class carrying this block owns "+"the project.json section named by `key`; hosts dispatch that section's data through the class's projectData/resolvePaths capabilities.",properties:{description:{type:"string"},key:{description:"The project.json top-level section this class owns (exclusive per project).",type:"string"},referenceable:{description:"Whether section entries can be referenced from documents (e.g. content types).",type:"boolean"},title:{type:"string"}},required:["key"],type:"object"},Le={additionalProperties:!1,description:"Server-mount admission block (specs/extensions.md §11). A class carrying this block mounts "+"routes under its /_jx/ basePath in the site worker and dev server.",properties:{basePath:{description:"Route subtree this class mounts — must be under /_jx/ (exclusive per project).",examples:["/_jx/data","/_jx/auth"],type:"string"},module:{description:"Module specifier exporting the mount handler.",type:"string"},order:{description:"Mount order (ascending; default 100).",type:"number"}},required:["basePath"],type:"object"},Ve={description:"Connection-provider admission block (specs/extensions.md §12). A class carrying this block "+"provides database connections of the given provider/kind.",properties:{kind:{description:"SQL dialect family the provider speaks.",enum:["sqlite","postgres"],type:"string"},local:{description:"Local-development substitute provider (e.g. sqlite for D1).",type:"string"},module:{description:"Module specifier exporting the provider implementation.",type:"string"},provider:{description:"Provider identifier (e.g. d1, supabase, sqlite).",type:"string"},serve:{description:"Module specifier exporting the serve-time worker binding.",type:"string"}},required:["provider","kind"],type:"object"};var cw=[301,302,303,307,308],He={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"Global type definitions available to all pages.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:"utf8",description:"Default charset for the page.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:bC,type:"string"},type:"array"}},type:"object"},i18n:{description:"Internationalization configuration.",properties:{defaultLocale:{description:"Default locale, as a BCP 47 language tag. The pattern catches shape errors (`en_US`, `en--US`); the build is the authority on well-formedness.",examples:["en"],pattern:bC,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:bC,type:"string"},type:"array"},routing:{description:"Locale routing strategy.",enum:["prefix-except-default","prefix-always"],type:"string"}},type:"object"},images:{$ref:"#/$defs/ImageConfig"},imports:{additionalProperties:{type:"string"},description:"Global import map: $prototype names to .class.json file paths. Makes external classes available by name in all pages.",examples:[{Markdown:"@jxsuite/parser/Markdown.class.json",MarkdownCollection:"@jxsuite/parser/MarkdownCollection.class.json"}],type:"object"},name:{default:"Jx Site",description:"Human-readable project name.",examples:["My Portfolio","Jx Example Site"],type:"string"},redirects:{additionalProperties:{oneOf:[{description:"Destination path or URL; implies a 301.",type:"string"},{additionalProperties:!1,description:"A redirect with an explicit RFC 9110 §15.4 status.",properties:{destination:{type:"string"},status:{default:301,description:"RFC 9110 §15.4 redirection status. 307 and 308 preserve the request method; "+"301 and 302 historically do not.",enum:[...cw],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"};var Ie={additionalProperties:!1,description:"Schema for jx-extension.json manifests. Located at the extension package root and exported so hosts can resolve <package>/jx-extension.json through the exports map.",properties:{$schema:{type:"string"},classes:{additionalProperties:{type:"string"},description:"$prototype-visible class name → class descriptor path, relative to the manifest.",type:"object"},description:{description:"One-line description.",type:"string"},name:{description:"Package name; must match package.json.",type:"string"},schemas:{additionalProperties:!1,description:"Schema fragments this package contributes, relative to the manifest.",properties:{document:{description:"Document-schema fragment (positions like $paths values).",type:"string"},fields:{description:"Field-union fragment: its $defs members are unioned into the per-project "+"field-schema resource as extension field extras (specs/extensions.md §5.3).",type:"string"},project:{description:"Project-schema fragment (top-level project.json sections).",type:"string"}},type:"object"},title:{description:"Human-readable name for studio surfaces.",type:"string"}},required:["name"],type:"object"};var _e=["literal","ref","template","expression","function"],zo={expression:"Formula",function:"Inline function",literal:"Fixed value",ref:"From data…",template:"Mixed text"},q_={expression:"Computed from other values, built up operator by operator.",function:"Code that runs when this fires.",literal:"A value you type here, the same every time.",ref:"The current value of a signal, picked from a list.",template:"Text with ${…} placeholders that fill in from signals."};function Pu(e){if(Me(e))return"ref";if(Oa(e))return"function";if(Ma(e))return"template";if(_(e)&&"$expression"in e)return"expression";return"literal"}var We={oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]},Ue=new Map([["ExpressionEntry",ne],["FunctionDef",oe],["RefObject",X],["StyleObject",H]]);function ze(e){let{properties:t,required:r}=e;return Array.isArray(r)&&r.includes("$ref")&&v(t)&&Boolean(t.$ref)}function Be(e){let{required:t}=e;return Array.isArray(t)&&t.includes("$expression")}function Ge(e){let{properties:t}=e;return v(t)&&v(t.$prototype)&&t.$prototype.const==="Function"}function Ke(e){return e.type==="string"&&e.pattern===void 0&&e.enum===void 0&&e.const===void 0}var Ye=new Set(["array","boolean","integer","null","number","object","string"]);function ie(e,t){if(!v(e))return;if(t.seen.has(e))return;t.seen.add(e);let r=n(e.$ref)?e.$ref:void 0;if(r!==void 0&&Object.keys(e).length===1){let o=r.startsWith("#/$defs/")?r.slice(8):r,l=Ue.get(o);if(l)ie(l,t);else t.unresolved.add(r);return}if(ze(e)){t.found.add("ref");return}if(Be(e)){t.found.add("expression");return}if(Ge(e)){t.found.add("function");return}let a=!1;for(let o of["oneOf","anyOf","allOf"]){let l=e[o];if(Array.isArray(l)){a=!0;for(let y of l)ie(y,t)}}if(a)return;if(Ke(e)){t.found.add("literal"),t.found.add("template");return}if(e.enum!==void 0||e.const!==void 0){t.found.add("literal");return}if(n(e.type)&&Ye.has(e.type))t.found.add("literal")}function Xe(e){let t={found:new Set,seen:new Set,unresolved:new Set};return ie(e,t),{caps:_e.filter((r)=>t.found.has(r)),unresolved:[...t.unresolved].toSorted()}}function ae(e){return Xe(e).caps}var Qe={anyOf:[K,...G.anyOf.slice(1)]},ED=B.anyOf.map((e)=>e.properties.operator.const),et={attribute:Q.additionalProperties,componentProp:ee.additionalProperties,elementProperty:te,eventHandler:We,repeaterFilter:q.properties.filter,repeaterItems:q.properties.items,repeaterSort:q.properties.sort,styleProperty:H.additionalProperties,switchDiscriminant:re,elementTag:Qe,textProperty:Y},de=new Map;function IE(e){let t=de.get(e);if(t)return t;let r=ae(et[e]);return de.set(e,r),r}function $d(e){return n(e)?IE(e):ae(e.schema)}function me(e){return{anyOf:[ae(e).length>0?e:{type:"string"},{$ref:"#/$defs/RefObject"}]}}var pe=new Map,se=new Map;function ce(e,t){return`${h.value?.id??"-"}|${e}|${t}`}function ue(e){return`${h.value?.id??"-"}|${e}`}function pp(e,t,r){pe.set(ce(e,t),Se(r))}function fp(e,t){return pe.has(ce(e,t))}function tt(e,t){return Se(pe.get(ce(e,t)))}function rt(e,t){se.set(ue(e),t)}function fe(e){return e==="literal"||e==="template"}function Fu(e,t){let r=ue(e),a=Pu(t),o=se.get(r),l=o!==void 0&&fe(o)&&fe(a)?o:a;return se.set(r,l),l}function ju(e,t){switch(e){case"ref":{let[r]=t.stateDefs;return r?{$ref:`#/state/${r}`}:{$ref:t.extraSignals?.[0]?.value??""}}case"template":{let[r]=t.stateDefs;return r?`\${state.${r}}`:"${}"}case"expression":return{$expression:{operator:"??",target:null,value:null}};case"function":return{$prototype:"Function",body:"",parameters:[]};default:return t.literalDefault}}function Id(e,t,r,a,o){return pp(e,t,a),rt(e,r),fp(e,r)?tt(e,r):o}var he={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSchemaForm",$description:"The shared schema→form engine as a document: one row per property of a JSON Schema, drawn from a projection `ui/schema-form.ts` computes. Nothing here reads a schema. The flow decides which of nine controls a property gets, what its options are, which rungs of the value ladder the position permits, what a commit is worth and whether the value is refused; this document draws the answer. That split is what lets the Entry editor, Project Settings and the Signals panel all embed the same form and get the same row — and it is why the engine hands back a HOST ELEMENT rather than a template: a document clears the host it is given, so a caller that is still lit renders an empty element for it and puts it in its own tree (studio-ui-guidelines.md §9.3, §9.4).",tagName:"div",attributes:{part:"form"},style:{$description:"What `.style-row`, `.style-row-label`, `.style-row--invalid`, `.style-row-error`, `.style-row-error-count`, `.array-object-field`, `.array-object-row` and `.schema-param-editor` said in `styles/inspector.css`, keyed on `part` and re-pointed at the studio token layer. Those rules are DEAD in the stylesheet now rather than shared: `ui/field-row.ts` drew the same row for the inspector panels and `ui/expression-editor.ts` the same array rows, and both converted, so this document's copy is the only emitter left. Every `--spectrum-font-size-*` reference is gone rather than renamed — those names resolve only inside `<sp-theme>`, and a document mounted in a settings pane or an entry editor is outside it, so each would silently have taken its hard-coded fallback.",display:"contents",'& [part="field"]':{padding:"var(--jx-space-1) 0"},'& [part="value"]':{$description:"The control line: the source chip, then whatever the rung draws. `min-width: 0` is load-bearing — without it a monospaced pointer or a long JSON line pushes the row past the pane's right edge instead of scrolling inside its own control.",display:"flex",alignItems:"flex-start",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="value"] > *':{minWidth:"0"},'& [part="widget"] > *':{$description:"The switch wrapper is `display: contents`, so whatever rung it drew is the flex item of the line above rather than a box inside a box — which is what keeps `min-width: 0` reaching the control that actually needs it.",flex:"1",minWidth:"0"},'& [part="source"]':{$description:"Quiet while the value is fixed, accent-tinted the moment it is produced from something else — the one place in the row that says a value is not what it looks like.",flex:"none",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="source"][data-source="bound"]':{color:"var(--accent)"},'& [part="pointer-group"]':{display:"flex",flex:"1",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="pointer-group"] > *':{flex:"1",minWidth:"0"},'& [part="json"]':{display:"flex",flexDirection:"column",flex:"1",gap:"var(--jx-space-1)",minWidth:"0"},'& [part="chips"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-1)"},'& [part="chip"]':{padding:"1px var(--jx-space-2)",borderRadius:"var(--radius)",background:"var(--bg)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="rows"]':{display:"flex",flexDirection:"column",flex:"1",gap:"var(--jx-space-1)",minWidth:"0"},'& [part="row"]':{$description:"Wraps rather than scrolls: an item with five declared properties in a 260px inspector is a column of controls, not a horizontal scroller nobody finds the end of.",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"var(--jx-space-1)",minWidth:"0"},'& [part="row"] > [part="cell"]:only-of-type > *':{$description:"A row of one cell (an item of a list of single values: a category, a picture) gives that cell the row's width, so a list reads as the fields around it do rather than as a column of stubs.",flex:"1",minWidth:"0"},'& [part="row-add"]':{alignSelf:"flex-start"},'& [part="field-error"]':{$description:"The left rule is what makes the line read as belonging to the control above it rather than to the row below.",margin:"var(--jx-space-1) 0 0",paddingLeft:"var(--jx-space-2)",borderLeft:"2px solid var(--danger)",fontSize:"var(--jx-text-sm)",lineHeight:"1.35",color:"var(--danger)"},'& [part="field-error-count"]':{marginLeft:"var(--jx-space-1)",fontFamily:"var(--font-mono)",opacity:"0.75"}},children:[{$prototype:"Array",items:{$ref:"#/state/fields"},key:{$ref:"$map/item/key"},map:{$description:"One property of the schema. `jx-field` owns the label, the required mark, the invalid shade and the association between the label and whatever control ends up in the slot, so none of that is written here — which is the whole of what the four hand-rolled `.style-row` variants used to carry.",tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}"},$props:{label:{$ref:"$map/item/label"},description:{$ref:"$map/item/description"},required:{$ref:"$map/item/required"},invalid:{$ref:"$map/item/invalid"},span:!0},children:[{tagName:"div",attributes:{part:"value",role:"none"},children:[{tagName:"span",attributes:{part:"source-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasChip"},cases:{true:{$description:"The Value Source chip (§6.6): what produces this value, in the same four words every other bindable position in Studio uses. It opens the rung picker rather than cycling, so any rung the position permits is one action away. Drawn only where the host named somewhere a value could come from — a settings form that names none edits fixed values and shows no chip.",tagName:"jx-action-button",attributes:{part:"source","data-source":"${$map.item.source}"},$props:{label:{$ref:"$map/item/sourceName"},hint:{$ref:"$map/item/sourceHint"},size:"sm",haspopup:"menu",disabled:{$ref:"$map/item/sourceLocked"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickSource"},value:[{$ref:"$map/item/key"},{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"${$map.item.sourceLabel}"}]}}},{tagName:"span",attributes:{part:"widget",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{text:{$description:"The default control, and the one every scalar without a narrower answer lands on. Commits on input, debounced by the flow, which is what makes the canvas and the preview follow a value being typed rather than waiting for a blur.",tagName:"jx-textfield",attributes:{part:"text"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},size:"sm",invalid:{$ref:"$map/item/invalid"},mono:{$ref:"$map/item/mono"},multiline:{$ref:"$map/item/multiline"},type:{$ref:"$map/item/inputType"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},template:{$description:"The Mixed text rung: a string with `${…}` holes in it. Monospaced because what is being written is half text and half pointer, and committed on change rather than on input — a half-typed placeholder is not a template anybody meant.",tagName:"jx-textfield",attributes:{part:"template"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:"${state.templatePlaceholder}",size:"sm",mono:!0},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},pointer:{$description:"The From data… rung. It is TWO controls over one value because the kit has no combobox and this rung needs one: the list is a set of suggestions rather than a whitelist (a value may point at a route param, a signal, or a pointer neither the form nor its host enumerates), so the select offers what the host named and the field accepts anything. Picking a row writes the field; typing a pointer the host never named leaves the select showing it, because a select whose value matches no option synthesises the row rather than lying about what it holds.",tagName:"span",attributes:{part:"pointer-group",role:"none"},children:[{tagName:"jx-textfield",attributes:{part:"pointer"},$props:{label:"${$map.item.label} pointer",value:{$ref:"$map/item/value"},placeholder:"#/state/…",size:"sm",mono:!0},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"span",attributes:{part:"pointer-pick-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasOptions"},cases:{true:{tagName:"jx-select",attributes:{part:"pointer-pick"},$props:{label:"${$map.item.label} source",options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}}]},select:{$description:"A closed set the schema itself declares, or one the host resolved through a `#/$context/…` pointer. The empty row is offered only where the property is optional — a required field has no “none” to choose.",tagName:"jx-select",attributes:{part:"select"},$props:{label:{$ref:"$map/item/label"},options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"},size:"sm",invalid:{$ref:"$map/item/invalid"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},checkbox:{tagName:"jx-checkbox",attributes:{part:"checkbox"},$props:{label:{$ref:"$map/item/label"},checked:{$ref:"$map/item/checked"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commitChecked"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]}},number:{$description:"`min`, `max` and `step` come straight off the property schema, so the control refuses out-of-range input before the flow has to say why. The stepper is off: these are configuration values that get typed, not nudged.",tagName:"jx-number-field",attributes:{part:"number"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},min:{$ref:"$map/item/min"},max:{$ref:"$map/item/max"},step:{$ref:"$map/item/step"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},json:{$description:"A value with structure, edited as the JSON it is. The chips above it are a read of the shape currently held — property name and declared type — so the common case (“what is in here?”) is answered without reading the text. The flow parses on a debounce and keeps the last parsable value; a mid-keystroke `{` is not a refusal.",tagName:"span",attributes:{part:"json",role:"none"},children:[{tagName:"span",attributes:{part:"chips-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasChips"},cases:{true:{tagName:"span",attributes:{part:"chips",role:"none"},children:[{$prototype:"Array",items:{$ref:"$map/item/chips"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"chip"},textContent:"${$map.item.label}"}}]}}},{tagName:"jx-textfield",attributes:{part:"json-text"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},size:"sm",mono:!0,multiline:!0,grows:!0},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editJson"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}]},rows:{$description:"An array whose items have a declared shape: one row per item, one cell per declared property of an object item, or one cell for a single-value item (a list of categories, a gallery of pictures), with a remove beside each and one add below. The alternative was the raw-JSON editor, which is what an array of anything else still gets: a shape the schema states is a shape the form can draw.",tagName:"span",attributes:{part:"rows",role:"none"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"row",role:"none","data-row":"${$map.item.key}"},children:[{$prototype:"Array",items:{$ref:"$map/item/cells"},key:{$ref:"$map/item/id"},map:{tagName:"span",attributes:{part:"cell",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{text:{tagName:"jx-textfield",attributes:{part:"cell-text"},$description:"Committed on input AND on change: a cell showing a pointer is committed when it is left, exactly as the pointer field above is, and a cell showing text follows the canvas while it is typed. The two never disagree — a change after an input carries the same string.",$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/label"},size:"sm"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCell"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCell"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},select:{tagName:"jx-select",attributes:{part:"cell-select"},$props:{label:{$ref:"$map/item/label"},options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCell"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},checkbox:{tagName:"jx-checkbox",attributes:{part:"cell-checkbox"},$props:{label:{$ref:"$map/item/label"},checked:{$ref:"$map/item/checked"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCellChecked"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]}},number:{tagName:"jx-number-field",attributes:{part:"cell-number"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCell"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},control:{$description:"A cell a registered control owns: a relationship to another collection, or a picture (the media field). The document draws the empty host and nothing inside it; `ui/schema-form.ts` mounts the control into it, by the same dispatch a FIELD host gets. An extension's control is its own surface rather than part of this one, and the seam between them is this empty node.",tagName:"span",attributes:{part:"cell-control-host","data-control":"${$map.item.id}",role:"none"}}}}},{tagName:"jx-action-button",attributes:{part:"row-remove"},$props:{icon:"trash",label:"${$map.item.removeLabel}",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeRow"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/key"}]}]}}]}},{tagName:"jx-action-button",attributes:{part:"row-add"},$props:{icon:"plus",label:"${$map.item.addLabel}",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addRow"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"Add"}]}]},control:{$description:"A field a registered control owns outright — `schema-builder`, `secret`, or the `reference` picker. The document draws the empty host and the flow MOUNTS the control into it: the registry's contract (specs/extensions.md §9.1) is a control that owns a host, all three built-ins are documents of their own, and a document clears the host it is given — which is why this node is drawn empty and never written to twice.",tagName:"div",attributes:{part:"control-host","data-control":{$ref:"$map/item/key"},role:"none"}}}}]},{tagName:"span",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasError"},cases:{true:{$description:'§16.1\'s inline tier: why this value is refused, said AT the control that refuses it and for exactly as long as the value stays bad. `role="alert"` so it is announced when it appears, and a repeat counter from two up — “it refused me again” is otherwise indistinguishable from “the field is still red from last time”.',tagName:"p",attributes:{part:"field-error",role:"alert"},children:[{tagName:"span",attributes:{part:"field-error-text"},textContent:"${$map.item.error}"},{tagName:"span",attributes:{part:"error-count-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasCount"},cases:{true:{tagName:"span",attributes:{part:"field-error-count"},textContent:"${$map.item.errorCount}"}}}]}}}]}}]};T("schema-form",he);function nt(e,t){let r=t?.$map,a=v(r)&&v(r.item)?r.item:void 0,o=e==="control-host"?a?.key:e==="cell-control-host"?a?.id:void 0;return n(o)?o:""}function it(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function ye(e,t,r){let a=document.createElement("div");a.style.display="contents";let o=g({...e,...t,templatePlaceholder:"${state.…}"}),l=null,y=!1,b=!1;function d(){y=!0,R("schema-form",o,a,{onNodeCreated:(m,f,S,w)=>{if(!(m instanceof HTMLElement))return;let O=nt(it(S),w);if(O!=="")r(O,m)}}).then((m)=>{if(y=!1,b){m.dispose();return}l=m})}return d(),{dispose(){b=!0,l?.dispose(),l=null,a.textContent=""},host:a,update(m){if(o.fields=m.fields,b||y||l!==null&&a.contains(l.root))return;l?.dispose(),l=null,a.textContent="",d()}}}var M=new Map;function dw(e,t){M.set(e,t)}var at=/^#\/content\/([^/]+)$/;function Hu(e){let t=e?.$ref,r=n(t)?at.exec(t):null;return r?r[1]:null}var ge={resolvePointer:()=>{}};function xe(e,t,r){if(Array.isArray(e))return e;let a;if(v(e)){let l=e.$ref;if(n(l))a=l}else if(n(e))a=e;if(a===void 0||!t)return;let o=t.resolvePointer(a,r);if(Array.isArray(o))return o.map(String);if(v(o))return Object.keys(o);return}function be(e,t){if(e.trim()==="")return Number.NaN;return t?Math.trunc(Number(e)):Number(e)}function $e(e){return e.format!=="json-schema"&&e.type!=="object"&&e.type!=="array"}function st(e){return[...(e.signals??[]).map((t)=>({label:t,value:`#/state/${t}`})),...(e.params??[]).map((t)=>({label:`$params/${t}`,value:`#/$params/${t}`}))]}var F="__none__";function ve(e){if(e===void 0||e===null)return"";return _(e)?JSON.stringify(e,null,2):String(e)}function pt(e,t,r){if(Me(t))return"";if(t===void 0||t===null||t==="")return r?"Required.":"";if(Array.isArray(e.enum)&&!e.enum.includes(t))return`Choose one of: ${e.enum.map(String).join(", ")}.`;if(e.type==="number"||e.type==="integer"){let o=Z(t)?t:Number(t);if(!Number.isFinite(o))return"Enter a number.";if(e.type==="integer"&&!Number.isInteger(o))return"Enter a whole number.";if(e.minimum!==void 0&&o<e.minimum)return`Must be ${e.minimum} or more.`;if(e.maximum!==void 0&&o>e.maximum)return`Must be ${e.maximum} or less.`;return""}if(e.type==="boolean"&&!Ze(t))return"Must be true or false.";if(e.type==="array"&&!Array.isArray(t))return"Must be a list.";if(e.type==="object"&&!v(t))return"Must be an object.";return""}var ct=500,lt=400,I=new Map;function Fl(e,t,r,a){dt(e);let o=I.get(e);if(!o)o=mt(),I.set(e,o);return o.update(t,r,a),o.host}function dt(e){for(let[t,r]of I)if(t!==e&&!r.host.isConnected)r.dispose(),I.delete(t)}function mt(){let e={},t={},r={onChange:()=>{}},a=ge,o=new Map,l=new Map,y=new Map,b=new Map,d=null,m=(i,s,c)=>{if(clearTimeout(l.get(i)),s<=0){c();return}l.set(i,setTimeout(c,s))},f=(i,s)=>{clearTimeout(l.get(i)),l.delete(i),s()},S=(i,s)=>{r.onChange({[i]:s})},w=(i,s)=>{if(i.commit==="none")return;switch(i.commit){case"ref":{let c=s.trim();S(i.prop,c?{$ref:c}:void 0);return}case"template":{S(i.prop,s);return}case"select":{S(i.prop,s===F?void 0:s);return}case"number":{let c=be(s,i.schema.type==="integer");S(i.prop,Number.isNaN(c)?void 0:c);return}case"json":{try{S(i.prop,JSON.parse(s))}catch{}return}default:{if(i.member!==void 0){let c=t[i.prop],u=v(c)?{...c}:{};if(s)u[i.member]=s;else delete u[i.member];S(i.prop,Object.keys(u).length>0?u:void 0);return}S(i.prop,s||void 0)}}},O=(i,s)=>{let c;if(s.length>0)c=i.scalarItems?s.map((u)=>u[le]??""):s;S(i.prop,c)},P=(i)=>{let s=[];for(let c of i.rows??[])s.push({...c});return s},W={addRow:(i)=>{let s=o.get(i);if(!s?.itemProps)return;let c={};for(let[u,x]of Object.entries(s.itemProps))if(x.default!==void 0)c[u]=x.default;O(s,[...P(s),c]),r.rerender?.()},commit:(i,s)=>{let c=o.get(i);if(c)f(i,()=>w(c,s))},commitChecked:(i,s)=>{let c=o.get(i);if(c)S(c.prop,s)},edit:(i,s)=>{let c=o.get(i);if(c&&c.debounceMs>0)m(i,c.debounceMs,()=>w(c,s))},editCell:(i,s,c,u)=>{p(i,s,c,u)},editCellChecked:(i,s,c,u)=>{p(i,s,c,u)},editJson:(i,s)=>{let c=o.get(i);if(c)m(i,ct,()=>w(c,s))},pickSource:(i,s)=>{U(i,s)},removeRow:(i,s)=>{let c=o.get(i);if(!c)return;let u=Number(s);O(c,P(c).filter((x,C)=>C!==u)),r.rerender?.()}};function p(i,s,c,u){let x=o.get(i);if(!x?.itemProps)return;let C=Number(s),J=P(x),E=J[C];if(!E)return;let A=x.itemProps[c];J[C]={...E,[c]:L(A,u,x.refCells?.has(`${i}/${s}/${c}`)??!1)},O(x,J)}function L(i,s,c){if(Ze(s))return s;let u=String(s);if(c){let x=u.trim();return x?{$ref:x}:void 0}if(i?.type==="integer"||i?.type==="number"){let x=be(u,i.type==="integer");return Number.isNaN(x)?void 0:x}if(u===F||u==="")return;return u}function U(i,s){let c=o.get(i);if(!c?.ladder)return;let{fieldKey:u,mode:x,offered:C,sources:J}=c.ladder;d?.close(),d=Wt({label:"Value source",onClosed:()=>{d=null},opener:s,region:"value-source",rows:C.map((E)=>({checked:E===x?"true":"false",destructive:!1,disabled:!1,dividerAbove:!1,id:E,title:zo[E]})),run:(E)=>{let A=C.find((ke)=>ke===E);if(A===void 0||A===x)return;let z=c.schema.default;if(x==="ref"&&z!==void 0&&!fp(u,"literal"))pp(u,"literal",z);S(c.prop,Id(u,x,A,Se(t[c.prop]),ju(A,{extraSignals:J,literalDefault:z,stateDefs:[]})))}})}function N(i){let s=o.get(i);if(s?.control)return{args:{ctx:a,key:s.prop,onChange:(c)=>S(s.prop,c),rerender:r.rerender,schema:s.schema,value:t[s.prop]},control:s.control};for(let c of o.values()){let u=c.cellControls?.get(i);if(!u)continue;let x=(c.rows??[])[Number(u.row)]??{};return{args:{ctx:a,key:u.key,onChange:(C)=>p(c.prop,u.row,u.key,C),rerender:r.rerender,schema:u.schema,value:x[u.key]},control:u.control}}return}function D(i,s){let c=N(i);if(!c)return;let u=b.get(i);if(u?.host===s){u.handle.update(c.args);return}u?.handle.dispose(),b.set(i,{handle:c.control.mount(s,c.args),host:s})}function V(){for(let[i,s]of b)if(!N(i))s.handle.dispose(),b.delete(i)}function j(){V();for(let[i,s]of y)D(i,s)}let k=ye({fields:[]},W,(i,s)=>{y.set(i,s),D(i,s)});return{dispose(){for(let i of l.values())clearTimeout(i);l.clear(),d?.close(),d=null;for(let i of b.values())i.handle.dispose();b.clear(),y.clear(),o.clear(),k.dispose()},host:k.host,update(i,s,c){e=i,t=s,r=c,a=c.context??ge,o.clear(),k.update({fields:ft(e,t,r,a,o)}),j()}}}function ft(e,t,r,a,o){let l=new Set(e.required),y=st(a);return Object.entries(e.properties??{}).flatMap(([b,d])=>{let m={ctx:a,opts:r,plans:o,required:l.has(b),sources:y,value:t},f=je(b,d,m);return f.kind==="control"&&we(d)&&d.properties?.alt?[f,yt(b,m)]:[f]})}var ut=new Set(["src","alt","width","height","title"]);function we(e){let t=e.properties??{};return e.type==="object"&&t.src?.type==="string"&&Object.keys(t).every((r)=>ut.has(r))}function ht(e){let t=(r)=>{let a=v(r.value)?r.value:{},{src:o}=a;return{...r,onChange:(l)=>{if(l===o)return;let{height:y,width:b,...d}=a,m;if(l!==void 0&&l!=="")m={...d,src:l};r.onChange(m)},value:n(o)?o:void 0}};return{mount(r,a){let o=e.mount(r,t(a));return{dispose:()=>o.dispose(),update:(l)=>o.update(t(l))}}}}function yt(e,t){let r=`${e}/alt`,a=t.value[e],o=v(a)?a.alt:void 0,l=je(r,{type:"string"},{...t,required:!1}),y=t.plans.get(r);if(y)y.prop=e,y.member="alt";return{...l,label:`${t.opts.ui?.[e]?.label??e} alt text`,value:n(o)?o:""}}function je(e,t,r){let{ctx:a,opts:o,plans:l,required:y,sources:b,value:d}=r,m=d[e],f={commit:"text",debounceMs:lt,prop:e,schema:t};l.set(e,f);let S=o.errors?.[e]||pt(t,m,Boolean(o.showRequired)&&y),w=o.errorCounts?.[e],O=o.ui?.[e]?.control,P=O?M.get(O):void 0,W=b.length>0&&$e(t)&&!O,p={addLabel:`Add ${e}`,checked:!1,chips:[],description:t.description??"",error:S,errorCount:w!==void 0&&w>1?`×${w}`:"",hasChip:!1,hasChips:!1,hasCount:w!==void 0&&w>1,hasError:S!=="",hasOptions:!1,invalid:S!=="",key:e,kind:"text",label:o.ui?.[e]?.label??e,max:"",min:"",mono:!1,multiline:!1,inputType:"text",options:[],placeholder:"",prop:t.name||e,required:y,rows:[],source:"fixed",sourceHint:"",sourceLabel:"",sourceLocked:!1,sourceName:"",step:"",value:""};if(W){let j=`${a.fieldKeyPrefix??""}.${e}`,k=Fu(j,m),i=$d({schema:me(t)});if(f.ladder={fieldKey:j,mode:k,offered:i,sources:b},p.hasChip=!0,p.sourceLabel=zo[k],p.sourceHint=q_[k],p.source=k==="literal"?"fixed":"bound",p.sourceLocked=!i.some((s)=>s!==k),p.sourceName=p.sourceLocked?`Value source: ${p.sourceLabel} (no other source available here)`:`Value source: ${p.sourceLabel} — click to change`,k==="ref")return f.commit="ref",f.debounceMs=0,p.kind="pointer",p.value=Me(m)?m.$ref:"",p.options=b.map((s)=>({label:s.label,value:s.value})),p.hasOptions=p.options.length>0,p;if(k==="template")return f.commit="template",f.debounceMs=0,p.kind="template",p.value=String(m??""),p}if(P)return f.commit="none",f.control=P,p.kind="control",p;if(Me(m)&&$e(t))return f.commit="ref",f.debounceMs=0,p.kind="text",p.mono=!0,p.value=m.$ref,p.placeholder=e,p;if(Hu(t)!==null){let j=M.get("reference");if(j)return f.commit="none",f.control=j,p.kind="control",p}if(t.format==="image"){let j=M.get("media");if(j)return f.commit="none",f.control=j,p.kind="control",p}let L=we(t)?M.get("media"):void 0;if(L)return f.commit="none",f.control=ht(L),p.kind="control",p;let U=o.ui?.[e]?.enum??t.enum,N=xe(U,a,d);if(N)return f.commit="select",f.debounceMs=0,p.kind="select",p.value=m!==void 0?String(m):t.default!==void 0?String(t.default):F,p.options=[...y?[]:[{label:"—",value:F}],...N.map((j)=>({label:j,value:j}))],p;if(t.type==="boolean")return f.commit="none",p.kind="checkbox",p.checked=Boolean(m??t.default??!1),p;if(t.type==="integer"||t.type==="number")return f.commit="number",f.debounceMs=0,p.kind="number",p.value=m!==void 0?String(m):"",p.placeholder=t.default!=null?String(t.default):"",p.min=t.minimum!==void 0?String(t.minimum):"",p.max=t.maximum!==void 0?String(t.maximum):"",p.step=t.type==="integer"?"1":"",p;if(t.format==="json-schema")return f.commit="json",p.kind="json",p.value=m!==void 0?JSON.stringify(m,null,2):"",p.placeholder=t.description??"JSON Schema defining the data shape…",p.chips=bt(m),p.hasChips=p.chips.length>0,p;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties)return $t(e,t.items.properties,r,f,p);if(t.type==="array"&&St(t.items))return xt(e,t.items,r,f,p);let D=Array.isArray(t.type)?t.type:[t.type];if(D.includes("array")||D.includes("object"))return f.commit="json",p.kind="json",p.value=m!==void 0?JSON.stringify(m,null,2):"",p.placeholder=t.default!==void 0?JSON.stringify(t.default):"",p;p.kind="text",p.value=ve(m),p.placeholder=t.default!==void 0?String(t.default):t.examples?.[0]??"",p.inputType=gt.get(t.format??"")??"text";let V=/^"?(\d{4}-\d{2}-\d{2})/.exec(p.value);if(p.inputType==="date"&&V)p.value=V[1]??p.value;return p}var gt=new Map([["date","date"],["email","email"],["uri","url"]]);function bt(e){if(!v(e))return[];let{properties:t}=e;if(e.$ref||t===null||!_(t))return[];return Object.entries(t).map(([r,a])=>({key:r,label:`${r}: ${String((v(a)?a.type:void 0)??"any")}`}))}function $t(e,t,r,a,o){let l=r.value[e],y=Array.isArray(l)?l:[];return a.commit="none",a.itemProps=t,a.rows=y,a.cellControls=new Map,a.refCells=new Set,o.kind="rows",o.rows=y.map((b,d)=>Oe(e,String(d),b,t,r,a)),o}var le="value";function St(e){if(e===void 0||e.format==="json-schema")return!1;if(Hu(e)!==null||Array.isArray(e.enum))return!0;return e.type==="string"||e.type==="number"||e.type==="integer"||e.type==="boolean"}function xt(e,t,r,a,o){let l=r.value[e],y=[];if(Array.isArray(l))y=l;else if(l!==void 0&&l!==null&&l!=="")y=[l];let b=y.map((f)=>({[le]:f})),d={[le]:t},m=r.opts.ui?.[e]?.label??e;return a.commit="none",a.itemProps=d,a.rows=b,a.scalarItems=!0,a.cellControls=new Map,a.refCells=new Set,o.kind="rows",o.rows=b.map((f,S)=>{let w=Oe(e,String(S),f,d,r,a);for(let O of w.cells)O.label=`${m} ${S+1}`;return w}),o}function Oe(e,t,r,a,o,l){return{cells:Object.entries(a).map(([y,b])=>vt(e,t,y,b,r[y],o,l)),field:e,key:t,removeLabel:`Remove ${e} ${Number(t)+1}`}}function vt(e,t,r,a,o,l,y){let b=`${e}/${t}/${r}`,d={checked:!1,field:e,id:b,key:r,kind:"text",label:r,options:[],row:t,value:""};if(Me(o))return d.value=o.$ref,y.refCells?.add(b),d;if(Hu(a)!==null){let S=M.get("reference");if(S)return d.kind="control",y.cellControls?.set(b,{control:S,key:r,row:t,schema:a}),d}let m=a.format==="image"?M.get("media"):void 0;if(m)return d.kind="control",y.cellControls?.set(b,{control:m,key:r,row:t,schema:a}),d;let f=xe(a.enum,l.ctx,l.value);if(f)return d.kind="select",d.value=o!==void 0?String(o):F,d.options=[{label:"—",value:F},...f.map((S)=>({label:S,value:S}))],d;if(a.type==="boolean")return d.kind="checkbox",d.checked=Boolean(o),d;if(a.type==="integer"||a.type==="number")return d.kind="number",d.value=o!==void 0?String(o):"",d;return d.value=ve(o),d}var wt=/^\{@(\w+)\}$/;function mp(e,t){if(!e.startsWith("#/$context/"))return;let r=[];for(let o of e.slice(11).split("/")){let l=o.match(wt);if(l){let y=t.scope?.[l[1]];if(!n(y)&&!Z(y))return;let b=String(y);if(!b)return;r.push(b)}else r.push(o)}if(r[0]==="$formats"){if(r.length!==1)return;return(t.formats??[]).map((o)=>o.name)}let a=t.projectConfig;for(let o of r){if(!_(a))return;a=a[o]}return a}
2
- export{cw,zo,q_,Pu,ED,IE,$d,pp,fp,Fu,ju,Id,dw,Hu,Fl,mp};
1
+ import{YM}from"./studio-nzemfbkk.js";import{KC,h}from"./studio-yrcrncev.js";import{zt}from"./studio-daksw8kh.js";import{Ce}from"./studio-v5wktj6f.js";import{E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{n,Y,Ze,_,v,Pe,Ha,Ba}from"./studio-k3we3kqb.js";var B={anyOf:[{additionalProperties:!1,description:"Two-way: `target` is the test, `value` the tag when it is truthy, `initial` the tag when it is not.",properties:{initial:{$ref:"#/$defs/TagName"},operator:{const:"?:",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/TagName"}},required:["operator","target","value","initial"],title:"?: — the tag when the test holds, and the tag when it does not"},{additionalProperties:!1,description:"Multiway: `target` is the discriminant, matched against case keys by its string form. "+"`default` is required — an element with no tag cannot exist.",properties:{cases:{additionalProperties:{$ref:"#/$defs/TagName"},type:"object"},default:{$ref:"#/$defs/TagName"},operator:{const:"switch",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target","cases","default"],title:"switch — one tag per discriminant value, with a required fallback"}],description:"A tag name chosen at element creation. Every branch resolves to a `TagName`, so the candidate set is enumerable without evaluating anything."},G={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]};var K={description:"HTML element tag name or custom element name (must contain a hyphen per Web Components spec). "+"A NAME, never an expression: no `${…}` position in the pipeline evaluates a tagName. Use "+"`$switch`/`cases` to vary the element.",minLength:1,pattern:"^[a-zA-Z][a-zA-Z0-9._-]*$",type:"string"};var X={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]};var ke={additionalProperties:!0,description:"A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",properties:{attributes:{additionalProperties:{oneOf:[{type:"string"},{type:"boolean"}]},type:"object"},children:{items:{$ref:"#/$defs/HeadEntry"},type:"array"},tagName:{type:"string"},textContent:{description:"Element content. An object is serialized to JSON inside the tag — that is how a "+'JSON-LD block (`<script type="application/ld+json">`) is authored.',oneOf:[{type:"string"},{type:"object"}]}},required:["tagName"],type:"object"};var Ee={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"};var Me={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"};var Re={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"};var Q={additionalProperties:!1,description:"A $ref binding. Resolves to a state entry (reactive) or plain value (static).",properties:{$ref:{$ref:"#/$defs/AnyRef"}},required:["$ref"],type:"object"};var H={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/StyleObject"}]},description:"CSS style definition. camelCase property names follow CSSOM convention. Keys starting with :, ., &, or [ are treated as nested CSS selectors. Keys matching $media breakpoint names (or other @-prefixed at-rules) group nested rules. Nesting is recursive: selector and at-rule groups may nest to arbitrary depth "+"(e.g. breakpoint → selector → pseudo-class), mirroring the compiler's recursive emission. "+"An object carrying $ref is a reactive VALUE, and the runtime reads it as one. It also matches the nested-block branch vacuously, since a block admits a string under any key, which is why these branches are anyOf rather than oneOf. A DECLARATION at-rule (@font-face, @property, @position-try, @counter-style) may hold an ARRAY of blocks, which is that key written more than once, in order: an object's keys are "+"unique, so @font-face — the at-rule whose identity is not in its key — could not otherwise "+"state a family's second weight at all.",patternProperties:{"^@(font-face|property|position-try|counter-style)":{anyOf:[{$ref:"#/$defs/StyleObject"},{items:{$ref:"#/$defs/StyleObject"},minItems:1,type:"array"}]}},properties:{$description:{description:"Why this rule exists. Emitted as a comment by static builds, ignored at runtime.",type:"string"}},type:"object"};var q={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Ae={description:"Array of child definitions — elements, text, or Array namespaces (dynamic lists) mixed "+"freely. A bare Array namespace (the whole children slot is one dynamic list) is also "+"accepted for backward compatibility, as is a ${…} template string that resolves at build "+"time to an array of child definitions.",oneOf:[{items:{anyOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/SwitchNode"},{$ref:"#/$defs/ArrayNamespace"},{type:"string"},{type:"number"}]},type:"array"},{$ref:"#/$defs/ArrayNamespace"},{description:"Computed children — a ${…} template that resolves at build time to an array of child "+'definitions (e.g. "${state.entry.$children}" for parsed content). A bare plain-text string is NOT a valid children value; text children must be array items.',pattern:String.raw`\$\{`,type:"string"}]};var Z={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},ee={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object"},{$ref:"#/$defs/RefObject"}]},description:"Explicit prop passing at a component boundary.",type:"object"},te={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},re={additionalProperties:!1,description:"Reactive $ref that drives which case to render: a state entry, or inside a mapped array's template the row's $map/item or $map/index (spec §14.1).",properties:{$ref:{oneOf:[{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/MapRef"}],type:"string"}},required:["$ref"],type:"object"};var oe={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive. First parameter is always state (the reactive scope).',properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: an opaque JS source string (first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → JS string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"};var Fe={additionalProperties:!1,description:"A JSON Pointer $ref operand within an expression node. $args/<name> resolves a named formula's parameter (callable entries only).",properties:{$ref:{pattern:String.raw`^(\$map/|\$reduce/|\$args/|event#/|#/|parent#/|window#/|document#/)`,type:"string"}},required:["$ref"],type:"object"},Ne={anyOf:[{not:{pattern:String.raw`\$\{`},type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"},{description:"Plain-object literal (e.g. an Intl options bag). Objects carrying $ref or operator keys are pointers/nodes, never literals.",not:{anyOf:[{required:["$ref"]},{required:["operator"]}]},type:"object"}],description:"A non-reactive operand: scalar, plain-object literal, or array of operands."};var Te={additionalProperties:!1,description:"The core expression node. operator + target, with value gated by arity.",oneOf:[{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/UnaryOperator"}},required:["operator"],title:"Unary — target only, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/BinaryOperator"}},required:["operator","value"],title:"Binary — left in target, right in value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/AssignmentOperator"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"Assignment — writable target, value required"},{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/NoArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator"],title:"pop / shift — array receiver, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/OneArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"push / unshift — array receiver, single value argument"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/SpliceMethod"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},minItems:1,type:"array"}},required:["operator","value"],title:"splice — array receiver, [start, deleteCount, ...items]"},{properties:{operator:{$ref:"#/$defs/ReduceMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value","initial"],title:"reduce — pure fold over a pointer or derived array; seed in initial"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/MapFilterMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value"],title:"map / filter — pure over a pointer or derived array; per-item expression in value"},{description:"The ECMAScript conditional (ternary) operator, pure: target is the test, value the consequent, initial the alternate (the reduce precedent for repurposing initial). Chain else-if by nesting another ?: node in initial.",properties:{operator:{$ref:"#/$defs/ConditionalOperator"}},required:["operator","value","initial"],title:"?: — pure conditional; test in target, consequent in value, alternate in initial"},{description:"Value-keyed multiway selection, pure: target is the discriminant (matched against case keys by its string form, like element-level $switch), cases maps matched values to result operands, default is the operand when no case matches (result is undefined without it). Condition-chain branching composes from nested ?: nodes instead.",not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},type:"object"},default:{$ref:"#/$defs/ExpressionOperand"},operator:{$ref:"#/$defs/SwitchOperator"}},required:["operator","cases"],title:"switch — pure value-keyed selection; discriminant in target, results in cases/default"},{description:"A pure standard-library method call: target is the receiver (any operand — never mutated; change-by-copy names replace the mutating originals), value the optional argument (bare scalar) or argument list (array). A missing receiver or method yields undefined, matching null-safe path reads.",not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/PureMethod"}},required:["operator"],title:"Pure method — genuine prototype methods; receiver in target, args in value"},{description:"Invoke a callable, pure in formula position: target is the callee pointer — a named formula entry (#/state/…) or a blessed pure global via window#/ (Math.*, JSON.*, Object.keys/values/entries, and "+`${YM()}) — and value is the positional argument list (the splice args-in-value precedent). Argument order follows the callee's declared parameters.`,not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/CallOperator"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"}},required:["operator"],title:"call — invoke a named formula or blessed global; callee in target, args in value"}],properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},description:"switch only: matched discriminant value (string form) → result operand.",type:"object"},default:{$ref:"#/$defs/ExpressionOperand",description:"switch only: result operand when no case key matches."},initial:{$ref:"#/$defs/ExpressionOperand"},operator:{type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target"],type:"object"},ne={additionalProperties:!1,description:"A declarative expression entry (Shape 5). Used as a state entry or inline event handler. With parameters it is a named formula: a pure, reusable computation invoked via the call operator, its parameters resolved through $args/<name> refs in the body.",properties:{$description:{type:"string"},$expression:{$ref:"#/$defs/ExpressionNode"},$title:{type:"string"},parameters:{description:"Named-formula parameters (CEM convention, as on Function entries): bare names or CEM parameter objects. Present ⇒ the entry is callable, not a computed value.",items:{anyOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"}},required:["$expression"],type:"object"};var De={description:"A single state entry. Shape is determined by value type: "+"scalar/array → naked reactive property, string with ${} → computed, "+'object with $prototype: "Function" → function, '+"object with $prototype: <other> → data source, "+"object with type and default → typed reactive property, "+"plain object → naked object reactive property.",oneOf:[{type:"number"},{type:"boolean"},{type:"null"},{type:"string"},{type:"array"},{$ref:"#/$defs/TypedStateDef"},{$ref:"#/$defs/FunctionDef"},{$ref:"#/$defs/ExternalClassDef"},{$ref:"#/$defs/ExpressionEntry"},{not:{anyOf:[{required:["$prototype"]},{required:["default"]},{required:["type"]},{required:["$expression"]}]},type:"object"}]};var Je={description:"Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",properties:{documentKinds:{description:'"page"/"component" allow the extension in pages/components discovery; "content" allows it as a content-type source.',items:{enum:["page","component","content"],type:"string"},type:"array"},exportTarget:{description:"When true, site builds emit a serialized sidecar per page in this format.",type:"boolean"},extensions:{description:'File extensions this format claims, with leading dot (e.g. [".md"]).',items:{pattern:String.raw`^\.`,type:"string"},minItems:1,type:"array"},mediaType:{description:"MIME type for the format (icons, labels, HTTP).",type:"string"},remote:{description:"When true, the load capability accepts http(s) URLs as sources.",type:"boolean"}},required:["extensions"],type:"object"},qe={additionalProperties:!1,description:"Project-section admission block (specs/extensions.md §9). A class carrying this block owns "+"the project.json section named by `key`; hosts dispatch that section's data through the class's projectData/resolvePaths capabilities.",properties:{description:{type:"string"},key:{description:"The project.json top-level section this class owns (exclusive per project).",type:"string"},referenceable:{description:"Whether section entries can be referenced from documents (e.g. content types).",type:"boolean"},title:{type:"string"}},required:["key"],type:"object"},Le={additionalProperties:!1,description:"Server-mount admission block (specs/extensions.md §11). A class carrying this block mounts "+"routes under its /_jx/ basePath in the site worker and dev server.",properties:{basePath:{description:"Route subtree this class mounts — must be under /_jx/ (exclusive per project).",examples:["/_jx/data","/_jx/auth"],type:"string"},module:{description:"Module specifier exporting the mount handler.",type:"string"},order:{description:"Mount order (ascending; default 100).",type:"number"}},required:["basePath"],type:"object"},Ve={description:"Connection-provider admission block (specs/extensions.md §12). A class carrying this block "+"provides database connections of the given provider/kind.",properties:{kind:{description:"SQL dialect family the provider speaks.",enum:["sqlite","postgres"],type:"string"},local:{description:"Local-development substitute provider (e.g. sqlite for D1).",type:"string"},module:{description:"Module specifier exporting the provider implementation.",type:"string"},provider:{description:"Provider identifier (e.g. d1, supabase, sqlite).",type:"string"},serve:{description:"Module specifier exporting the serve-time worker binding.",type:"string"}},required:["provider","kind"],type:"object"};var $w=[301,302,303,307,308],He={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"Global type definitions available to all pages.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:"utf8",description:"Default charset for the page.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:KC,type:"string"},type:"array"}},type:"object"},i18n:{description:"Internationalization configuration.",properties:{defaultLocale:{description:"Default locale, as a BCP 47 language tag. The pattern catches shape errors (`en_US`, `en--US`); the build is the authority on well-formedness.",examples:["en"],pattern:KC,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:KC,type:"string"},type:"array"},routing:{description:"Locale routing strategy.",enum:["prefix-except-default","prefix-always"],type:"string"}},type:"object"},images:{$ref:"#/$defs/ImageConfig"},imports:{additionalProperties:{type:"string"},description:"Global import map: $prototype names to .class.json file paths. Makes external classes available by name in all pages.",examples:[{Markdown:"@jxsuite/parser/Markdown.class.json",MarkdownCollection:"@jxsuite/parser/MarkdownCollection.class.json"}],type:"object"},name:{default:"Jx Site",description:"Human-readable project name.",examples:["My Portfolio","Jx Example Site"],type:"string"},redirects:{additionalProperties:{oneOf:[{description:"Destination path or URL; implies a 301.",type:"string"},{additionalProperties:!1,description:"A redirect with an explicit RFC 9110 §15.4 status.",properties:{destination:{type:"string"},status:{default:301,description:"RFC 9110 §15.4 redirection status. 307 and 308 preserve the request method; "+"301 and 302 historically do not.",enum:[...$w],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"};var Ie={additionalProperties:!1,description:"Schema for jx-extension.json manifests. Located at the extension package root and exported so hosts can resolve <package>/jx-extension.json through the exports map.",properties:{$schema:{type:"string"},classes:{additionalProperties:{type:"string"},description:"$prototype-visible class name → class descriptor path, relative to the manifest.",type:"object"},description:{description:"One-line description.",type:"string"},name:{description:"Package name; must match package.json.",type:"string"},schemas:{additionalProperties:!1,description:"Schema fragments this package contributes, relative to the manifest.",properties:{document:{description:"Document-schema fragment (positions like $paths values).",type:"string"},fields:{description:"Field-union fragment: its $defs members are unioned into the per-project "+"field-schema resource as extension field extras (specs/extensions.md §5.3).",type:"string"},project:{description:"Project-schema fragment (top-level project.json sections).",type:"string"}},type:"object"},title:{description:"Human-readable name for studio surfaces.",type:"string"}},required:["name"],type:"object"};var _e=["literal","ref","template","expression","function"],Wo={expression:"Formula",function:"Inline function",literal:"Fixed value",ref:"From data…",template:"Mixed text"},CS={expression:"Computed from other values, built up operator by operator.",function:"Code that runs when this fires.",literal:"A value you type here, the same every time.",ref:"The current value of a signal, picked from a list.",template:"Text with ${…} placeholders that fill in from signals."};function Bu(e){if(Pe(e))return"ref";if(Ha(e))return"function";if(Ba(e))return"template";if(_(e)&&"$expression"in e)return"expression";return"literal"}var We={oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]},Ue=new Map([["ExpressionEntry",ne],["FunctionDef",oe],["RefObject",Q],["StyleObject",H]]);function ze(e){let{properties:t,required:r}=e;return Array.isArray(r)&&r.includes("$ref")&&v(t)&&Boolean(t.$ref)}function Be(e){let{required:t}=e;return Array.isArray(t)&&t.includes("$expression")}function Ge(e){let{properties:t}=e;return v(t)&&v(t.$prototype)&&t.$prototype.const==="Function"}function Ke(e){return e.type==="string"&&e.pattern===void 0&&e.enum===void 0&&e.const===void 0}var Ye=new Set(["array","boolean","integer","null","number","object","string"]);function ie(e,t){if(!v(e))return;if(t.seen.has(e))return;t.seen.add(e);let r=n(e.$ref)?e.$ref:void 0;if(r!==void 0&&Object.keys(e).length===1){let o=r.startsWith("#/$defs/")?r.slice(8):r,l=Ue.get(o);if(l)ie(l,t);else t.unresolved.add(r);return}if(ze(e)){t.found.add("ref");return}if(Be(e)){t.found.add("expression");return}if(Ge(e)){t.found.add("function");return}let a=!1;for(let o of["oneOf","anyOf","allOf"]){let l=e[o];if(Array.isArray(l)){a=!0;for(let y of l)ie(y,t)}}if(a)return;if(Ke(e)){t.found.add("literal"),t.found.add("template");return}if(e.enum!==void 0||e.const!==void 0){t.found.add("literal");return}if(n(e.type)&&Ye.has(e.type))t.found.add("literal")}function Xe(e){let t={found:new Set,seen:new Set,unresolved:new Set};return ie(e,t),{caps:_e.filter((r)=>t.found.has(r)),unresolved:[...t.unresolved].toSorted()}}function ae(e){return Xe(e).caps}var Qe={anyOf:[K,...G.anyOf.slice(1)]},TN=B.anyOf.map((e)=>e.properties.operator.const),et={attribute:Z.additionalProperties,componentProp:ee.additionalProperties,elementProperty:te,eventHandler:We,repeaterFilter:q.properties.filter,repeaterItems:q.properties.items,repeaterSort:q.properties.sort,styleProperty:H.additionalProperties,switchDiscriminant:re,elementTag:Qe,textProperty:X},de=new Map;function _T(e){let t=de.get(e);if(t)return t;let r=ae(et[e]);return de.set(e,r),r}function Od(e){return n(e)?_T(e):ae(e.schema)}function me(e){return{anyOf:[ae(e).length>0?e:{type:"string"},{$ref:"#/$defs/RefObject"}]}}var pe=new Map,se=new Map;function ce(e,t){return`${h.value?.id??"-"}|${e}|${t}`}function ue(e){return`${h.value?.id??"-"}|${e}`}function Cp(e,t,r){pe.set(ce(e,t),Ce(r))}function kp(e,t){return pe.has(ce(e,t))}function tt(e,t){return Ce(pe.get(ce(e,t)))}function rt(e,t){se.set(ue(e),t)}function fe(e){return e==="literal"||e==="template"}function zu(e,t){let r=ue(e),a=Bu(t),o=se.get(r),l=o!==void 0&&fe(o)&&fe(a)?o:a;return se.set(r,l),l}function Wu(e,t){switch(e){case"ref":{let[r]=t.stateDefs;return r?{$ref:`#/state/${r}`}:{$ref:t.extraSignals?.[0]?.value??""}}case"template":{let[r]=t.stateDefs;return r?`\${state.${r}}`:"${}"}case"expression":return{$expression:{operator:"??",target:null,value:null}};case"function":return{$prototype:"Function",body:"",parameters:[]};default:return t.literalDefault}}function Md(e,t,r,a,o){return Cp(e,t,a),rt(e,r),kp(e,r)?tt(e,r):o}var he={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSchemaForm",$description:"The shared schema→form engine as a document: one row per property of a JSON Schema, drawn from a projection `ui/schema-form.ts` computes. Nothing here reads a schema. The flow decides which of nine controls a property gets, what its options are, which rungs of the value ladder the position permits, what a commit is worth and whether the value is refused; this document draws the answer. That split is what lets the Entry editor, Project Settings and the Signals panel all embed the same form and get the same row — and it is why the engine hands back a HOST ELEMENT rather than a template: a document clears the host it is given, so a caller that is still lit renders an empty element for it and puts it in its own tree (studio-ui-guidelines.md §9.3, §9.4).",tagName:"div",attributes:{part:"form"},style:{$description:"What `.style-row`, `.style-row-label`, `.style-row--invalid`, `.style-row-error`, `.style-row-error-count`, `.array-object-field`, `.array-object-row` and `.schema-param-editor` said in `styles/inspector.css`, keyed on `part` and re-pointed at the studio token layer. Those rules are DEAD in the stylesheet now rather than shared: `ui/field-row.ts` drew the same row for the inspector panels and `ui/expression-editor.ts` the same array rows, and both converted, so this document's copy is the only emitter left. Every `--spectrum-font-size-*` reference is gone rather than renamed — those names resolve only inside `<sp-theme>`, and a document mounted in a settings pane or an entry editor is outside it, so each would silently have taken its hard-coded fallback.",display:"contents",'& [part="field"]':{padding:"var(--jx-space-1) 0"},'& [part="value"]':{$description:"The control line: the source chip, then whatever the rung draws. `min-width: 0` is load-bearing — without it a monospaced pointer or a long JSON line pushes the row past the pane's right edge instead of scrolling inside its own control.",display:"flex",alignItems:"flex-start",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="value"] > *':{minWidth:"0"},'& [part="widget"] > *':{$description:"The switch wrapper is `display: contents`, so whatever rung it drew is the flex item of the line above rather than a box inside a box — which is what keeps `min-width: 0` reaching the control that actually needs it.",flex:"1",minWidth:"0"},'& [part="source"]':{$description:"Quiet while the value is fixed, accent-tinted the moment it is produced from something else — the one place in the row that says a value is not what it looks like.",flex:"none",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="source"][data-source="bound"]':{color:"var(--accent)"},'& [part="pointer-group"]':{display:"flex",flex:"1",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="pointer-group"] > *':{flex:"1",minWidth:"0"},'& [part="json"]':{display:"flex",flexDirection:"column",flex:"1",gap:"var(--jx-space-1)",minWidth:"0"},'& [part="chips"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-1)"},'& [part="chip"]':{padding:"1px var(--jx-space-2)",borderRadius:"var(--radius)",background:"var(--bg)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="rows"]':{display:"flex",flexDirection:"column",flex:"1",gap:"var(--jx-space-1)",minWidth:"0"},'& [part="row"]':{$description:"Wraps rather than scrolls: an item with five declared properties in a 260px inspector is a column of controls, not a horizontal scroller nobody finds the end of.",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"var(--jx-space-1)",minWidth:"0"},'& [part="row"] > [part="cell"]:only-of-type > *':{$description:"A row of one cell (an item of a list of single values: a category, a picture) gives that cell the row's width, so a list reads as the fields around it do rather than as a column of stubs.",flex:"1",minWidth:"0"},'& [part="row-add"]':{alignSelf:"flex-start"},'& [part="field-error"]':{$description:"The left rule is what makes the line read as belonging to the control above it rather than to the row below.",margin:"var(--jx-space-1) 0 0",paddingLeft:"var(--jx-space-2)",borderLeft:"2px solid var(--danger)",fontSize:"var(--jx-text-sm)",lineHeight:"1.35",color:"var(--danger)"},'& [part="field-error-count"]':{marginLeft:"var(--jx-space-1)",fontFamily:"var(--font-mono)",opacity:"0.75"}},children:[{$prototype:"Array",items:{$ref:"#/state/fields"},key:{$ref:"$map/item/key"},map:{$description:"One property of the schema. `jx-field` owns the label, the required mark, the invalid shade and the association between the label and whatever control ends up in the slot, so none of that is written here — which is the whole of what the four hand-rolled `.style-row` variants used to carry.",tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}"},$props:{label:{$ref:"$map/item/label"},description:{$ref:"$map/item/description"},required:{$ref:"$map/item/required"},invalid:{$ref:"$map/item/invalid"},span:!0},children:[{tagName:"div",attributes:{part:"value",role:"none"},children:[{tagName:"span",attributes:{part:"source-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasChip"},cases:{true:{$description:"The Value Source chip (§6.6): what produces this value, in the same four words every other bindable position in Studio uses. It opens the rung picker rather than cycling, so any rung the position permits is one action away. Drawn only where the host named somewhere a value could come from — a settings form that names none edits fixed values and shows no chip.",tagName:"jx-action-button",attributes:{part:"source","data-source":"${$map.item.source}"},$props:{label:{$ref:"$map/item/sourceName"},hint:{$ref:"$map/item/sourceHint"},size:"sm",haspopup:"menu",disabled:{$ref:"$map/item/sourceLocked"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickSource"},value:[{$ref:"$map/item/key"},{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"${$map.item.sourceLabel}"}]}}},{tagName:"span",attributes:{part:"widget",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{text:{$description:"The default control, and the one every scalar without a narrower answer lands on. Commits on input, debounced by the flow, which is what makes the canvas and the preview follow a value being typed rather than waiting for a blur.",tagName:"jx-textfield",attributes:{part:"text"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},size:"sm",invalid:{$ref:"$map/item/invalid"},mono:{$ref:"$map/item/mono"},multiline:{$ref:"$map/item/multiline"},type:{$ref:"$map/item/inputType"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},template:{$description:"The Mixed text rung: a string with `${…}` holes in it. Monospaced because what is being written is half text and half pointer, and committed on change rather than on input — a half-typed placeholder is not a template anybody meant.",tagName:"jx-textfield",attributes:{part:"template"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:"${state.templatePlaceholder}",size:"sm",mono:!0},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},pointer:{$description:"The From data… rung. It is TWO controls over one value because the kit has no combobox and this rung needs one: the list is a set of suggestions rather than a whitelist (a value may point at a route param, a signal, or a pointer neither the form nor its host enumerates), so the select offers what the host named and the field accepts anything. Picking a row writes the field; typing a pointer the host never named leaves the select showing it, because a select whose value matches no option synthesises the row rather than lying about what it holds.",tagName:"span",attributes:{part:"pointer-group",role:"none"},children:[{tagName:"jx-textfield",attributes:{part:"pointer"},$props:{label:"${$map.item.label} pointer",value:{$ref:"$map/item/value"},placeholder:"#/state/…",size:"sm",mono:!0},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"span",attributes:{part:"pointer-pick-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasOptions"},cases:{true:{tagName:"jx-select",attributes:{part:"pointer-pick"},$props:{label:"${$map.item.label} source",options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}}]},select:{$description:"A closed set the schema itself declares, or one the host resolved through a `#/$context/…` pointer. The empty row is offered only where the property is optional — a required field has no “none” to choose.",tagName:"jx-select",attributes:{part:"select"},$props:{label:{$ref:"$map/item/label"},options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"},size:"sm",invalid:{$ref:"$map/item/invalid"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},checkbox:{tagName:"jx-checkbox",attributes:{part:"checkbox"},$props:{label:{$ref:"$map/item/label"},checked:{$ref:"$map/item/checked"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commitChecked"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]}},number:{$description:"`min`, `max` and `step` come straight off the property schema, so the control refuses out-of-range input before the flow has to say why. The stepper is off: these are configuration values that get typed, not nudged.",tagName:"jx-number-field",attributes:{part:"number"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},min:{$ref:"$map/item/min"},max:{$ref:"$map/item/max"},step:{$ref:"$map/item/step"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},json:{$description:"A value with structure, edited as the JSON it is. The chips above it are a read of the shape currently held — property name and declared type — so the common case (“what is in here?”) is answered without reading the text. The flow parses on a debounce and keeps the last parsable value; a mid-keystroke `{` is not a refusal.",tagName:"span",attributes:{part:"json",role:"none"},children:[{tagName:"span",attributes:{part:"chips-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasChips"},cases:{true:{tagName:"span",attributes:{part:"chips",role:"none"},children:[{$prototype:"Array",items:{$ref:"$map/item/chips"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"chip"},textContent:"${$map.item.label}"}}]}}},{tagName:"jx-textfield",attributes:{part:"json-text"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},size:"sm",mono:!0,multiline:!0,grows:!0},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editJson"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}]},rows:{$description:"An array whose items have a declared shape: one row per item, one cell per declared property of an object item, or one cell for a single-value item (a list of categories, a gallery of pictures), with a remove beside each and one add below. The alternative was the raw-JSON editor, which is what an array of anything else still gets: a shape the schema states is a shape the form can draw.",tagName:"span",attributes:{part:"rows",role:"none"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"row",role:"none","data-row":"${$map.item.key}"},children:[{$prototype:"Array",items:{$ref:"$map/item/cells"},key:{$ref:"$map/item/id"},map:{tagName:"span",attributes:{part:"cell",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{text:{tagName:"jx-textfield",attributes:{part:"cell-text"},$description:"Committed on input AND on change: a cell showing a pointer is committed when it is left, exactly as the pointer field above is, and a cell showing text follows the canvas while it is typed. The two never disagree — a change after an input carries the same string.",$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/label"},size:"sm"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCell"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCell"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},select:{tagName:"jx-select",attributes:{part:"cell-select"},$props:{label:{$ref:"$map/item/label"},options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCell"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},checkbox:{tagName:"jx-checkbox",attributes:{part:"cell-checkbox"},$props:{label:{$ref:"$map/item/label"},checked:{$ref:"$map/item/checked"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCellChecked"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]}},number:{tagName:"jx-number-field",attributes:{part:"cell-number"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCell"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},control:{$description:"A cell a registered control owns: a relationship to another collection, or a picture (the media field). The document draws the empty host and nothing inside it; `ui/schema-form.ts` mounts the control into it, by the same dispatch a FIELD host gets. An extension's control is its own surface rather than part of this one, and the seam between them is this empty node.",tagName:"span",attributes:{part:"cell-control-host","data-control":"${$map.item.id}",role:"none"}}}}},{tagName:"jx-action-button",attributes:{part:"row-remove"},$props:{icon:"trash",label:"${$map.item.removeLabel}",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeRow"},value:[{$ref:"$map/item/field"},{$ref:"$map/item/key"}]}]}}]}},{tagName:"jx-action-button",attributes:{part:"row-add"},$props:{icon:"plus",label:"${$map.item.addLabel}",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addRow"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"Add"}]}]},control:{$description:"A field a registered control owns outright — `schema-builder`, `secret`, or the `reference` picker. The document draws the empty host and the flow MOUNTS the control into it: the registry's contract (specs/extensions.md §9.1) is a control that owns a host, all three built-ins are documents of their own, and a document clears the host it is given — which is why this node is drawn empty and never written to twice.",tagName:"div",attributes:{part:"control-host","data-control":{$ref:"$map/item/key"},role:"none"}}}}]},{tagName:"span",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasError"},cases:{true:{$description:'§16.1\'s inline tier: why this value is refused, said AT the control that refuses it and for exactly as long as the value stays bad. `role="alert"` so it is announced when it appears, and a repeat counter from two up — “it refused me again” is otherwise indistinguishable from “the field is still red from last time”.',tagName:"p",attributes:{part:"field-error",role:"alert"},children:[{tagName:"span",attributes:{part:"field-error-text"},textContent:"${$map.item.error}"},{tagName:"span",attributes:{part:"error-count-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasCount"},cases:{true:{tagName:"span",attributes:{part:"field-error-count"},textContent:"${$map.item.errorCount}"}}}]}}}]}}]};E("schema-form",he);function nt(e,t){let r=t?.$map,a=v(r)&&v(r.item)?r.item:void 0,o=e==="control-host"?a?.key:e==="cell-control-host"?a?.id:void 0;return n(o)?o:""}function it(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function ye(e,t,r){let a=document.createElement("div");a.style.display="contents";let o=g({...e,...t,templatePlaceholder:"${state.…}"}),l=null,y=!1,b=!1;function d(){y=!0,R("schema-form",o,a,{onNodeCreated:(m,f,S,w)=>{if(!(m instanceof HTMLElement))return;let O=nt(it(S),w);if(O!=="")r(O,m)}}).then((m)=>{if(y=!1,b){m.dispose();return}l=m})}return d(),{dispose(){b=!0,l?.dispose(),l=null,a.textContent=""},host:a,update(m){if(o.fields=m.fields,b||y||l!==null&&a.contains(l.root))return;l?.dispose(),l=null,a.textContent="",d()}}}var P=new Map;function Iw(e,t){P.set(e,t)}var at=/^#\/content\/([^/]+)$/;function Vu(e){let t=e?.$ref,r=n(t)?at.exec(t):null;return r?r[1]:null}var ge={resolvePointer:()=>{}};function Se(e,t,r){if(Array.isArray(e))return e;let a;if(v(e)){let l=e.$ref;if(n(l))a=l}else if(n(e))a=e;if(a===void 0||!t)return;let o=t.resolvePointer(a,r);if(Array.isArray(o))return o.map(String);if(v(o))return Object.keys(o);return}function be(e,t){if(e.trim()==="")return Number.NaN;return t?Math.trunc(Number(e)):Number(e)}function $e(e){return e.format!=="json-schema"&&e.type!=="object"&&e.type!=="array"}function st(e){return[...(e.signals??[]).map((t)=>({label:t,value:`#/state/${t}`})),...(e.params??[]).map((t)=>({label:`$params/${t}`,value:`#/$params/${t}`}))]}var N="__none__";function xe(e){if(e===void 0||e===null)return"";return _(e)?JSON.stringify(e,null,2):String(e)}function pt(e,t,r){if(Pe(t))return"";if(t===void 0||t===null||t==="")return r?"Required.":"";if(Array.isArray(e.enum)&&!e.enum.includes(t))return`Choose one of: ${e.enum.map(String).join(", ")}.`;if(e.type==="number"||e.type==="integer"){let o=Y(t)?t:Number(t);if(!Number.isFinite(o))return"Enter a number.";if(e.type==="integer"&&!Number.isInteger(o))return"Enter a whole number.";if(e.minimum!==void 0&&o<e.minimum)return`Must be ${e.minimum} or more.`;if(e.maximum!==void 0&&o>e.maximum)return`Must be ${e.maximum} or less.`;return""}if(e.type==="boolean"&&!Ze(t))return"Must be true or false.";if(e.type==="array"&&!Array.isArray(t))return"Must be a list.";if(e.type==="object"&&!v(t))return"Must be an object.";return""}var ct=500,lt=400,I=new Map;function Gl(e,t,r,a){dt(e);let o=I.get(e);if(!o)o=mt(),I.set(e,o);return o.update(t,r,a),o.host}function dt(e){for(let[t,r]of I)if(t!==e&&!r.host.isConnected)r.dispose(),I.delete(t)}function mt(){let e={},t={},r={onChange:()=>{}},a=ge,o=new Map,l=new Map,y=new Map,b=new Map,d=null,m=(i,s,c)=>{if(clearTimeout(l.get(i)),s<=0){c();return}l.set(i,setTimeout(c,s))},f=(i,s)=>{clearTimeout(l.get(i)),l.delete(i),s()},S=(i,s)=>{r.onChange({[i]:s})},w=(i,s)=>{if(i.commit==="none")return;switch(i.commit){case"ref":{let c=s.trim();S(i.prop,c?{$ref:c}:void 0);return}case"template":{S(i.prop,s);return}case"select":{S(i.prop,s===N?void 0:s);return}case"number":{let c=be(s,i.schema.type==="integer");S(i.prop,Number.isNaN(c)?void 0:c);return}case"json":{try{S(i.prop,JSON.parse(s))}catch{}return}default:{if(i.member!==void 0){let c=t[i.prop],u=v(c)?{...c}:{};if(s)u[i.member]=s;else delete u[i.member];S(i.prop,Object.keys(u).length>0?u:void 0);return}S(i.prop,s||void 0)}}},O=(i,s)=>{let c;if(s.length>0)c=i.scalarItems?s.map((u)=>u[le]??""):s;S(i.prop,c)},A=(i)=>{let s=[];for(let c of i.rows??[])s.push({...c});return s},W={addRow:(i)=>{let s=o.get(i);if(!s?.itemProps)return;let c={};for(let[u,x]of Object.entries(s.itemProps))if(x.default!==void 0)c[u]=x.default;O(s,[...A(s),c]),r.rerender?.()},commit:(i,s)=>{let c=o.get(i);if(c)f(i,()=>w(c,s))},commitChecked:(i,s)=>{let c=o.get(i);if(c)S(c.prop,s)},edit:(i,s)=>{let c=o.get(i);if(c&&c.debounceMs>0)m(i,c.debounceMs,()=>w(c,s))},editCell:(i,s,c,u)=>{p(i,s,c,u)},editCellChecked:(i,s,c,u)=>{p(i,s,c,u)},editJson:(i,s)=>{let c=o.get(i);if(c)m(i,ct,()=>w(c,s))},pickSource:(i,s)=>{U(i,s)},removeRow:(i,s)=>{let c=o.get(i);if(!c)return;let u=Number(s);O(c,A(c).filter((x,C)=>C!==u)),r.rerender?.()}};function p(i,s,c,u){let x=o.get(i);if(!x?.itemProps)return;let C=Number(s),J=A(x),M=J[C];if(!M)return;let F=x.itemProps[c];J[C]={...M,[c]:L(F,u,x.refCells?.has(`${i}/${s}/${c}`)??!1)},O(x,J)}function L(i,s,c){if(Ze(s))return s;let u=String(s);if(c){let x=u.trim();return x?{$ref:x}:void 0}if(i?.type==="integer"||i?.type==="number"){let x=be(u,i.type==="integer");return Number.isNaN(x)?void 0:x}if(u===N||u==="")return;return u}function U(i,s){let c=o.get(i);if(!c?.ladder)return;let{fieldKey:u,mode:x,offered:C,sources:J}=c.ladder;d?.close(),d=zt({label:"Value source",onClosed:()=>{d=null},opener:s,region:"value-source",rows:C.map((M)=>({checked:M===x?"true":"false",destructive:!1,disabled:!1,dividerAbove:!1,id:M,title:Wo[M]})),run:(M)=>{let F=C.find((Oe)=>Oe===M);if(F===void 0||F===x)return;let z=c.schema.default;if(x==="ref"&&z!==void 0&&!kp(u,"literal"))Cp(u,"literal",z);S(c.prop,Md(u,x,F,Ce(t[c.prop]),Wu(F,{extraSignals:J,literalDefault:z,stateDefs:[]})))}})}function T(i){let s=o.get(i);if(s?.control)return{args:{ctx:a,key:s.prop,onChange:(c)=>S(s.prop,c),rerender:r.rerender,schema:s.schema,value:t[s.prop]},control:s.control};for(let c of o.values()){let u=c.cellControls?.get(i);if(!u)continue;let x=(c.rows??[])[Number(u.row)]??{};return{args:{ctx:a,key:u.key,onChange:(C)=>p(c.prop,u.row,u.key,C),rerender:r.rerender,schema:u.schema,value:x[u.key]},control:u.control}}return}function D(i,s){let c=T(i);if(!c)return;let u=b.get(i);if(u?.host===s){u.handle.update(c.args);return}u?.handle.dispose(),b.set(i,{handle:c.control.mount(s,c.args),host:s})}function V(){for(let[i,s]of b)if(!T(i))s.handle.dispose(),b.delete(i)}function j(){V();for(let[i,s]of y)D(i,s)}let k=ye({fields:[]},W,(i,s)=>{y.set(i,s),D(i,s)});return{dispose(){for(let i of l.values())clearTimeout(i);l.clear(),d?.close(),d=null;for(let i of b.values())i.handle.dispose();b.clear(),y.clear(),o.clear(),k.dispose()},host:k.host,update(i,s,c){e=i,t=s,r=c,a=c.context??ge,o.clear(),k.update({fields:ft(e,t,r,a,o)}),j()}}}function ft(e,t,r,a,o){let l=new Set(e.required),y=st(a);return Object.entries(e.properties??{}).flatMap(([b,d])=>{let m={ctx:a,opts:r,plans:o,required:l.has(b),sources:y,value:t},f=we(b,d,m);return f.kind==="control"&&ve(d)&&d.properties?.alt?[f,yt(b,m)]:[f]})}var ut=new Set(["src","alt","width","height","title"]);function ve(e){let t=e.properties??{};return e.type==="object"&&t.src?.type==="string"&&Object.keys(t).every((r)=>ut.has(r))}function ht(e){let t=(r)=>{let a=v(r.value)?r.value:{},{src:o}=a;return{...r,onChange:(l)=>{if(l===o)return;let{height:y,width:b,...d}=a,m;if(l!==void 0&&l!=="")m={...d,src:l};r.onChange(m)},value:n(o)?o:void 0}};return{mount(r,a){let o=e.mount(r,t(a));return{dispose:()=>o.dispose(),update:(l)=>o.update(t(l))}}}}function yt(e,t){let r=`${e}/alt`,a=t.value[e],o=v(a)?a.alt:void 0,l=we(r,{type:"string"},{...t,required:!1}),y=t.plans.get(r);if(y)y.prop=e,y.member="alt";return{...l,label:`${t.opts.ui?.[e]?.label??e} alt text`,value:n(o)?o:""}}function we(e,t,r){let{ctx:a,opts:o,plans:l,required:y,sources:b,value:d}=r,m=d[e],f={commit:"text",debounceMs:lt,prop:e,schema:t};l.set(e,f);let S=o.errors?.[e]||pt(t,m,Boolean(o.showRequired)&&y),w=o.errorCounts?.[e],O=o.ui?.[e]?.control,A=O?P.get(O):void 0,W=b.length>0&&$e(t)&&!O,p={addLabel:`Add ${e}`,checked:!1,chips:[],description:t.description??"",error:S,errorCount:w!==void 0&&w>1?`×${w}`:"",hasChip:!1,hasChips:!1,hasCount:w!==void 0&&w>1,hasError:S!=="",hasOptions:!1,invalid:S!=="",key:e,kind:"text",label:o.ui?.[e]?.label??e,max:"",min:"",mono:!1,multiline:!1,inputType:"text",options:[],placeholder:"",prop:t.name||e,required:y,rows:[],source:"fixed",sourceHint:"",sourceLabel:"",sourceLocked:!1,sourceName:"",step:"",value:""};if(W){let j=`${a.fieldKeyPrefix??""}.${e}`,k=zu(j,m),i=Od({schema:me(t)});if(f.ladder={fieldKey:j,mode:k,offered:i,sources:b},p.hasChip=!0,p.sourceLabel=Wo[k],p.sourceHint=CS[k],p.source=k==="literal"?"fixed":"bound",p.sourceLocked=!i.some((s)=>s!==k),p.sourceName=p.sourceLocked?`Value source: ${p.sourceLabel} (no other source available here)`:`Value source: ${p.sourceLabel} — click to change`,k==="ref")return f.commit="ref",f.debounceMs=0,p.kind="pointer",p.value=Pe(m)?m.$ref:"",p.options=b.map((s)=>({label:s.label,value:s.value})),p.hasOptions=p.options.length>0,p;if(k==="template")return f.commit="template",f.debounceMs=0,p.kind="template",p.value=String(m??""),p}if(A)return f.commit="none",f.control=A,p.kind="control",p;if(Pe(m)&&$e(t))return f.commit="ref",f.debounceMs=0,p.kind="text",p.mono=!0,p.value=m.$ref,p.placeholder=e,p;if(Vu(t)!==null){let j=P.get("reference");if(j)return f.commit="none",f.control=j,p.kind="control",p}if(t.format==="image"){let j=P.get("media");if(j)return f.commit="none",f.control=j,p.kind="control",p}let L=ve(t)?P.get("media"):void 0;if(L)return f.commit="none",f.control=ht(L),p.kind="control",p;let U=o.ui?.[e]?.enum??t.enum,T=Se(U,a,d);if(T)return f.commit="select",f.debounceMs=0,p.kind="select",p.value=m!==void 0?String(m):t.default!==void 0?String(t.default):N,p.options=[...y?[]:[{label:"—",value:N}],...T.map((j)=>({label:j,value:j}))],p;if(t.type==="boolean")return f.commit="none",p.kind="checkbox",p.checked=Boolean(m??t.default??!1),p;if(t.type==="integer"||t.type==="number")return f.commit="number",f.debounceMs=0,p.kind="number",p.value=m!==void 0?String(m):"",p.placeholder=t.default!=null?String(t.default):"",p.min=t.minimum!==void 0?String(t.minimum):"",p.max=t.maximum!==void 0?String(t.maximum):"",p.step=t.type==="integer"?"1":"",p;if(t.format==="json-schema")return f.commit="json",p.kind="json",p.value=m!==void 0?JSON.stringify(m,null,2):"",p.placeholder=t.description??"JSON Schema defining the data shape…",p.chips=bt(m),p.hasChips=p.chips.length>0,p;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties)return $t(e,t.items.properties,r,f,p);if(t.type==="array"&&St(t.items))return xt(e,t.items,r,f,p);let D=Array.isArray(t.type)?t.type:[t.type];if(D.includes("array")||D.includes("object"))return f.commit="json",p.kind="json",p.value=m!==void 0?JSON.stringify(m,null,2):"",p.placeholder=t.default!==void 0?JSON.stringify(t.default):"",p;p.kind="text",p.value=xe(m),p.placeholder=t.default!==void 0?String(t.default):t.examples?.[0]??"",p.inputType=gt.get(t.format??"")??"text";let V=/^"?(\d{4}-\d{2}-\d{2})/.exec(p.value);if(p.inputType==="date"&&V)p.value=V[1]??p.value;return p}var gt=new Map([["date","date"],["email","email"],["uri","url"]]);function bt(e){if(!v(e))return[];let{properties:t}=e;if(e.$ref||t===null||!_(t))return[];return Object.entries(t).map(([r,a])=>({key:r,label:`${r}: ${String((v(a)?a.type:void 0)??"any")}`}))}function $t(e,t,r,a,o){let l=r.value[e],y=Array.isArray(l)?l:[];return a.commit="none",a.itemProps=t,a.rows=y,a.cellControls=new Map,a.refCells=new Set,o.kind="rows",o.rows=y.map((b,d)=>je(e,String(d),b,t,r,a)),o}var le="value";function St(e){if(e===void 0||e.format==="json-schema")return!1;if(Vu(e)!==null||Array.isArray(e.enum))return!0;return e.type==="string"||e.type==="number"||e.type==="integer"||e.type==="boolean"}function xt(e,t,r,a,o){let l=r.value[e],y=[];if(Array.isArray(l))y=l;else if(l!==void 0&&l!==null&&l!=="")y=[l];let b=y.map((f)=>({[le]:f})),d={[le]:t},m=r.opts.ui?.[e]?.label??e;return a.commit="none",a.itemProps=d,a.rows=b,a.scalarItems=!0,a.cellControls=new Map,a.refCells=new Set,o.kind="rows",o.rows=b.map((f,S)=>{let w=je(e,String(S),f,d,r,a);for(let O of w.cells)O.label=`${m} ${S+1}`;return w}),o}function je(e,t,r,a,o,l){return{cells:Object.entries(a).map(([y,b])=>vt(e,t,y,b,r[y],o,l)),field:e,key:t,removeLabel:`Remove ${e} ${Number(t)+1}`}}function vt(e,t,r,a,o,l,y){let b=`${e}/${t}/${r}`,d={checked:!1,field:e,id:b,key:r,kind:"text",label:r,options:[],row:t,value:""};if(Pe(o))return d.value=o.$ref,y.refCells?.add(b),d;if(Vu(a)!==null){let S=P.get("reference");if(S)return d.kind="control",y.cellControls?.set(b,{control:S,key:r,row:t,schema:a}),d}let m=a.format==="image"?P.get("media"):void 0;if(m)return d.kind="control",y.cellControls?.set(b,{control:m,key:r,row:t,schema:a}),d;let f=Se(a.enum,l.ctx,l.value);if(f)return d.kind="select",d.value=o!==void 0?String(o):N,d.options=[{label:"—",value:N},...f.map((S)=>({label:S,value:S}))],d;if(a.type==="boolean")return d.kind="checkbox",d.checked=Boolean(o),d;if(a.type==="integer"||a.type==="number")return d.kind="number",d.value=o!==void 0?String(o):"",d;return d.value=xe(o),d}var wt=/^\{@(\w+)\}$/;function Ep(e,t){if(!e.startsWith("#/$context/"))return;let r=[];for(let o of e.slice(11).split("/")){let l=o.match(wt);if(l){let y=t.scope?.[l[1]];if(!n(y)&&!Y(y))return;let b=String(y);if(!b)return;r.push(b)}else r.push(o)}if(r[0]==="$formats"){if(r.length!==1)return;return(t.formats??[]).map((o)=>o.name)}let a=t.projectConfig;for(let o of r){if(!_(a))return;a=a[o]}return a}
2
+ export{$w,Wo,CS,Bu,TN,_T,Od,Cp,kp,zu,Wu,Md,Iw,Vu,Gl,Ep};
3
3
 
4
- //# debugId=D2AA730C33BB28BA64756E2164756E21
5
- //# sourceMappingURL=studio-zacvfm31.js.map
4
+ //# debugId=3C802E6B268A7C0664756E2164756E21
5
+ //# sourceMappingURL=studio-yzpskb0j.js.map
@@ -0,0 +1,5 @@
1
+ import{p,ye}from"./studio-4fnb5648.js";import{r2,s2}from"./studio-nvcn2ykc.js";import{gh,WO,Vp}from"./studio-hh394phe.js";import{ln,xv,_v,h}from"./studio-yrcrncev.js";import{C}from"./studio-4f7thq0p.js";function fh(){let t=ye()?p().canvasUrl:void 0;if(t)return new URL(t,location.href).origin;return location.origin}function dv(){let t=ye()?p().canvasUrl:void 0;if(!t)return null;let e=new URL(t,location.href);return e.origin===location.origin?e.searchParams.get("rpcToken"):null}function Gd(t){let e=fh(),n=ye()?p().documentBaseUrl:void 0;if(n){let o=n.endsWith("/")?n:`${n}/`;return new URL(o,`${e}/`).href}let r=t||"";return`${e}/${r?`${r}/`:""}`}function GC(t){if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http")||t.startsWith("views://"))return t;let e=fh();if((e.startsWith("http:")||e.startsWith("https:"))&&e!==location.origin)return`${e}/${t.replace(/^\.?\//,"")}`;return t}function rI(){return ln(C?.projectConfig??{}).i18n?.locales??[]}function uv(t,e){let n=e?.space??"site",r=xv(t,C?.projectConfig?.content,rI());if(n==="site"&&!r&&!WO())return null;let o={documentDir:s2(t??""),lanes:r2,mounts:r?[r]:[],space:n};if(e?.fileBaseUrl!==void 0)o.fileBaseUrl=e.fileBaseUrl;return o}function Xc(t){return hv(t,h.value?.documentPath)}function hv(t,e){if(!t)return t;let n=uv(e,mh()),r=n&&{...n,revisions:Vp(),versions:gh()};return GC(_v(t,r)??t)}function mh(){let t={fileBaseUrl:Gd(C?.projectRoot)};if(ye())t.space=p().assetSpace;return t}
2
+ export{fh,dv,Gd,GC,rI,uv,Xc,hv,mh};
3
+
4
+ //# debugId=E011107A989B159B64756E2164756E21
5
+ //# sourceMappingURL=studio-zfdbmhp3.js.map