@jxsuite/studio 10.5.0 → 10.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/data/locales/en/elements.json +434 -0
  2. package/data/webdata.json +116 -139
  3. package/dist/chunks/{2020-7sx2vexa.js → 2020-rqm7qrje.js} +3 -3
  4. package/dist/chunks/adapter-cyy8vbcx.js +4 -0
  5. package/dist/chunks/add-new-flow-8cgtejv2.js +4 -0
  6. package/dist/chunks/{cf-account-picker-ajh60k54.js → cf-account-picker-v3qd2dhw.js} +3 -3
  7. package/dist/chunks/cf-settings-1fnw874z.js +4 -0
  8. package/dist/chunks/{color-area-gbcftzh3.js → color-area-frd9y9q6.js} +2 -2
  9. package/dist/chunks/{color-field-85136598.js → color-field-rebpbe33.js} +3 -3
  10. package/dist/chunks/{color-slider-w1s3ndd8.js → color-slider-6bzmk3s7.js} +2 -2
  11. package/dist/chunks/color-t2bnnj8y.js +4 -0
  12. package/dist/chunks/{combobox-dk98wc5x.js → combobox-c49x7gf1.js} +2 -2
  13. package/dist/chunks/components-y8yhdd7d.js +4 -0
  14. package/dist/chunks/content-source-9e7qvmsf.js +4 -0
  15. package/dist/chunks/convert-to-repeater-pd2w4z21.js +4 -0
  16. package/dist/chunks/editor-mb9jzdrw.js +4 -0
  17. package/dist/chunks/entry-commands-at0wnx3f.js +4 -0
  18. package/dist/chunks/extension-sections-4z9qq0gh.js +4 -0
  19. package/dist/chunks/file-ops-dtdvjmza.js +4 -0
  20. package/dist/chunks/files-8pf70854.js +4 -0
  21. package/dist/chunks/format-host-fd3m2y2a.js +4 -0
  22. package/dist/chunks/fs-events-hrk29vcv.js +4 -0
  23. package/dist/chunks/grid-open-bh74v82z.js +4 -0
  24. package/dist/chunks/{grid-view-0v4hjspb.js → grid-view-a51mgzmq.js} +10 -10
  25. package/dist/chunks/{icons-j9eksgew.js → icons-qp8fn1k8.js} +2 -2
  26. package/dist/chunks/{iframe-entry-4zqtn3ry.js → iframe-entry-mpwe5pwk.js} +4 -4
  27. package/dist/chunks/{iframe-entry-2x9bn5ng.js → iframe-entry-msd43x9h.js} +4 -4
  28. package/dist/chunks/iframe-entry-rt8jz5t8.js +5 -0
  29. package/dist/chunks/{iframe-entry-54kwwhmg.js → iframe-entry-v40cr813.js} +2 -2
  30. package/dist/chunks/iframe-host-q0s0wwy3.js +4 -0
  31. package/dist/chunks/{image-bake-m8gzaan9.js → image-bake-q9ajdjsj.js} +3 -3
  32. package/dist/chunks/{image-editor-0afyws7c.js → image-editor-ke9std9b.js} +2 -2
  33. package/dist/chunks/index-57ang7ma.js +4 -0
  34. package/dist/chunks/index-eytr7av4.js +17 -0
  35. package/dist/chunks/{index-2q88g57p.js → index-x495reff.js} +3 -3
  36. package/dist/chunks/{javascript-5sxtr1g7.js → javascript-qe34bvaz.js} +3 -3
  37. package/dist/chunks/{jsonMode-m6sf47hq.js → jsonMode-m8rseh31.js} +8 -8
  38. package/dist/chunks/jx-validate-bbd1mary.js +4 -0
  39. package/dist/chunks/layers-panel-wcjtdqsa.js +4 -0
  40. package/dist/chunks/layers-yscpys6q.js +4 -0
  41. package/dist/chunks/{listbox-k5p41049.js → listbox-tktzq5xj.js} +2 -2
  42. package/dist/chunks/lit-html-qm5wbhqz.js +4 -0
  43. package/dist/chunks/media-library-2hfff88g.js +4 -0
  44. package/dist/chunks/media-open-4pb05cne.js +4 -0
  45. package/dist/chunks/media-picker-bzktmmwr.js +4 -0
  46. package/dist/chunks/{menu-26nez152.js → menu-xc3cbgsd.js} +2 -2
  47. package/dist/chunks/{monaco-binding-1s2b8snq.js → monaco-binding-7t38arh9.js} +3 -3
  48. package/dist/chunks/monaco-buffer-3vz94c9f.js +4 -0
  49. package/dist/chunks/monaco-setup-fstdew02.js +4 -0
  50. package/dist/chunks/notify-gbdcckrh.js +4 -0
  51. package/dist/chunks/parse-fpdzgk4c.js +4 -0
  52. package/dist/chunks/platform-9g72gdqr.js +4 -0
  53. package/dist/chunks/{popover-fhdnt4be.js → popover-cnmsav6b.js} +2 -2
  54. package/dist/chunks/publish-panel-91x1cb5d.js +4 -0
  55. package/dist/chunks/publish-quick-e2dmf7eg.js +4 -0
  56. package/dist/chunks/publish-workspace-1x8mnzrj.js +4 -0
  57. package/dist/chunks/quick-search-2m4y6p1x.js +4 -0
  58. package/dist/chunks/references-yg1g9rwx.js +4 -0
  59. package/dist/chunks/right-panel-7mfyhzrk.js +4 -0
  60. package/dist/chunks/source-control-rrc4jgp5.js +4 -0
  61. package/dist/chunks/{split-qh21j2b0.js → split-d15yencd.js} +2 -2
  62. package/dist/chunks/{studio-r5g7fx7q.js → studio-0jhhznxy.js} +6 -6
  63. package/dist/chunks/studio-0nb57pjg.js +7 -0
  64. package/dist/chunks/{studio-bpzwhn88.js → studio-0wa4wv4s.js} +4 -4
  65. package/dist/chunks/studio-0z8kp4xk.js +5 -0
  66. package/dist/chunks/{studio-jqvke4ac.js → studio-18gc5t3v.js} +4 -4
  67. package/dist/chunks/{studio-xh6rf05g.js → studio-1b79rpcb.js} +4 -4
  68. package/dist/chunks/studio-211q5j7m.js +4 -0
  69. package/dist/chunks/studio-213pyfxh.js +16 -0
  70. package/dist/chunks/studio-2b1smjvp.js +5 -0
  71. package/dist/chunks/{studio-dst8y8vh.js → studio-2v6tc9jp.js} +4 -4
  72. package/dist/chunks/studio-30j0wz99.js +5 -0
  73. package/dist/chunks/studio-3kmqhwtt.js +5 -0
  74. package/dist/chunks/studio-44drsmhw.js +5 -0
  75. package/dist/chunks/{studio-d5f7sskn.js → studio-495b6f2r.js} +4 -4
  76. package/dist/chunks/{studio-g65t6svn.js → studio-4gthb2fd.js} +4 -4
  77. package/dist/chunks/{studio-bmwgj8ez.js → studio-4xadhxj1.js} +4 -4
  78. package/dist/chunks/{studio-zav9hgb3.js → studio-52mzbxqm.js} +4 -4
  79. package/dist/chunks/{studio-thgexj3w.js → studio-56mmnsw8.js} +7 -7
  80. package/dist/chunks/studio-59hz8f4r.js +5 -0
  81. package/dist/chunks/{studio-bk0anq3b.js → studio-5k9mfafh.js} +3 -3
  82. package/dist/chunks/{studio-qarg1xf9.js → studio-5qez462c.js} +5 -5
  83. package/dist/chunks/studio-6tnpg0vx.js +5 -0
  84. package/dist/chunks/studio-6w8mt734.js +6 -0
  85. package/dist/chunks/studio-7hm04x5z.js +5 -0
  86. package/dist/chunks/studio-8atmfjjm.js +7 -0
  87. package/dist/chunks/{studio-69g6a0jn.js → studio-8n99z71s.js} +4 -4
  88. package/dist/chunks/{studio-ep1384t9.js → studio-8vmad6x2.js} +4 -4
  89. package/dist/chunks/{studio-6sxnqqw8.js → studio-93p5k4r4.js} +4 -4
  90. package/dist/chunks/{studio-hy936516.js → studio-9gb0m81w.js} +4 -4
  91. package/dist/chunks/{studio-ek4fb4eb.js → studio-a4ymg4vd.js} +4 -4
  92. package/dist/chunks/studio-anc8067x.js +5 -0
  93. package/dist/chunks/{studio-ketrgtph.js → studio-dbdt67kr.js} +5 -5
  94. package/dist/chunks/studio-dbex091t.js +5 -0
  95. package/dist/chunks/{studio-nngc45ct.js → studio-dj8ctxey.js} +4 -4
  96. package/dist/chunks/{studio-pgze9p34.js → studio-ed9bz68j.js} +5 -5
  97. package/dist/chunks/{studio-4ncxzw5m.js → studio-fe2d1fp5.js} +4 -4
  98. package/dist/chunks/{studio-m8hesdrw.js → studio-fgp4cyy3.js} +4 -4
  99. package/dist/chunks/{studio-151kgn69.js → studio-ft706q02.js} +4 -4
  100. package/dist/chunks/{studio-pv1ts08p.js → studio-g79s1dyg.js} +5 -5
  101. package/dist/chunks/{studio-zkkt13qd.js → studio-gahswxp4.js} +4 -4
  102. package/dist/chunks/{studio-x5ffyssw.js → studio-gbqc12bk.js} +4 -4
  103. package/dist/chunks/{studio-4jy967rj.js → studio-gxphbetb.js} +5 -5
  104. package/dist/chunks/studio-hdf01j7q.js +7 -0
  105. package/dist/chunks/studio-hf259xzd.js +48 -0
  106. package/dist/chunks/studio-jbva4wxw.js +5 -0
  107. package/dist/chunks/{studio-td3h1644.js → studio-jj9gf1qc.js} +4 -4
  108. package/dist/chunks/studio-jsjg3mjv.js +5 -0
  109. package/dist/chunks/studio-jtvb8hd7.js +5 -0
  110. package/dist/chunks/{studio-c72v1kwc.js → studio-kp4vzrct.js} +4 -4
  111. package/dist/chunks/{studio-s4k1v7dt.js → studio-kpx02gaa.js} +6 -6
  112. package/dist/chunks/{studio-3yr1zdp9.js → studio-kv1728ex.js} +8 -8
  113. package/dist/chunks/studio-m25ry0mf.js +5 -0
  114. package/dist/chunks/studio-mcbwmkyh.js +5 -0
  115. package/dist/chunks/studio-meajkr51.js +5 -0
  116. package/dist/chunks/studio-mkjrjpr2.js +6 -0
  117. package/dist/chunks/{studio-nv5eq0f7.js → studio-mr084886.js} +181 -181
  118. package/dist/chunks/{studio-43pynnhz.js → studio-mrb10hv3.js} +4 -4
  119. package/dist/chunks/{studio-7qqb7hb8.js → studio-nhpg405j.js} +4 -4
  120. package/dist/chunks/{studio-n271vdsg.js → studio-nsec0hxm.js} +41 -41
  121. package/dist/chunks/{studio-ztzf8mce.js → studio-nv0mh0p5.js} +4 -4
  122. package/dist/chunks/studio-pafmb06w.js +5 -0
  123. package/dist/chunks/{studio-4s5bka8t.js → studio-pgftd79b.js} +4 -4
  124. package/dist/chunks/{studio-wn2cmf9q.js → studio-pk961xgz.js} +4 -4
  125. package/dist/chunks/studio-pzbr7g05.js +5 -0
  126. package/dist/chunks/{studio-15mfah02.js → studio-qcc5hsw2.js} +6 -6
  127. package/dist/chunks/studio-qfq58c8n.js +5 -0
  128. package/dist/chunks/{studio-j3bq30yz.js → studio-qvb2jr83.js} +4 -4
  129. package/dist/chunks/studio-r85zw6ay.js +5 -0
  130. package/dist/chunks/{studio-f69wcajk.js → studio-s0kwce5w.js} +5 -5
  131. package/dist/chunks/studio-s6ymkf3q.js +14 -0
  132. package/dist/chunks/{studio-8ncm9zwx.js → studio-s7p5ccxa.js} +4 -4
  133. package/dist/chunks/{studio-zzgp5yka.js → studio-s9jjap3x.js} +4 -4
  134. package/dist/chunks/{studio-ber1dgte.js → studio-t5hde1ws.js} +4 -4
  135. package/dist/chunks/studio-vj9yv897.js +5 -0
  136. package/dist/chunks/{studio-ajfq4fmr.js → studio-wmak8xjw.js} +4 -4
  137. package/dist/chunks/{studio-k05g7efh.js → studio-wqsmvtqj.js} +4 -4
  138. package/dist/chunks/studio-x3z3rhej.js +5 -0
  139. package/dist/chunks/{studio-7qr8k0v2.js → studio-xb55kpmy.js} +4 -4
  140. package/dist/chunks/{studio-f3awr5nc.js → studio-xxtdajmv.js} +7 -7
  141. package/dist/chunks/{studio-1a7zshnv.js → studio-xxttcym1.js} +4 -4
  142. package/dist/chunks/{studio-czpmzs9r.js → studio-y2zsnzye.js} +7 -7
  143. package/dist/chunks/{studio-9f5vcb4w.js → studio-y3tjh2xb.js} +3 -3
  144. package/dist/chunks/studio-y4f1rdsj.js +5 -0
  145. package/dist/chunks/studio-ybkd5w8k.js +5 -0
  146. package/dist/chunks/{studio-cv6gnjqd.js → studio-yetr4gg1.js} +4 -4
  147. package/dist/chunks/{studio-ehj3csbm.js → studio-z295anhs.js} +5 -5
  148. package/dist/chunks/{studio-pte5w7rf.js → studio-z89e6wpg.js} +8 -8
  149. package/dist/chunks/{studio-4z0cdh16.js → studio-zbwr6prc.js} +3 -3
  150. package/dist/chunks/{studio-w3aafbpk.js → studio-zdbsv5q2.js} +3 -3
  151. package/dist/chunks/{studio-eq5vqn1q.js → studio-zvthj8hg.js} +4 -4
  152. package/dist/chunks/toast-2kn2vrn4.js +4 -0
  153. package/dist/chunks/{toast-host-g3r2s0kn.js → toast-host-3rxeyj3d.js} +3 -3
  154. package/dist/chunks/{tooltip-gtx40bjg.js → tooltip-ghkxkasp.js} +2 -2
  155. package/dist/chunks/{tree-a19s1c05.js → tree-vw4nc63s.js} +2 -2
  156. package/dist/chunks/{tsMode-3f116hth.js → tsMode-7gngmamr.js} +7 -7
  157. package/dist/chunks/workspace-gv0hxgsm.js +4 -0
  158. package/dist/chunks/workspace-home-j7e0mjy5.js +4 -0
  159. package/dist/chunks/{ws-client-cb49m87s.js → ws-client-vs11sxc5.js} +3 -3
  160. package/dist/iframe-entry.js +14 -14
  161. package/dist/manifest.json +84 -83
  162. package/dist/studio.js +80 -80
  163. package/package.json +12 -12
  164. package/src/browse/preview-style.ts +2 -1
  165. package/src/canvas/canvas-render.ts +6 -1
  166. package/src/canvas/iframe-drop.ts +84 -1
  167. package/src/canvas/iframe-entry.ts +9 -6
  168. package/src/canvas/iframe-render.ts +13 -0
  169. package/src/collab/collab-session.ts +2 -2
  170. package/src/commands/levels.ts +1 -1
  171. package/src/create/add-new-flow.ts +2 -1
  172. package/src/editor/convert-targets.ts +2 -23
  173. package/src/editor/slash-menu.ts +35 -17
  174. package/src/files/files.ts +18 -0
  175. package/src/format/format-choices.ts +5 -5
  176. package/src/format/format-host.ts +35 -3
  177. package/src/grid/redirects-grid.ts +4 -4
  178. package/src/locale/element-names.ts +131 -0
  179. package/src/panels/dnd.ts +3 -1
  180. package/src/panels/elements-panel.ts +93 -36
  181. package/src/panels/imports-panel.ts +3 -2
  182. package/src/panels/navigator-panels.ts +10 -10
  183. package/src/panels/panel-registry.ts +3 -3
  184. package/src/panels/site-panel.ts +2 -1
  185. package/src/panels/style-panel.ts +2 -1
  186. package/src/panels/styles-panel.ts +2 -2
  187. package/src/platforms/cloud.ts +5 -2
  188. package/src/services/ai-command-tools.ts +2 -1
  189. package/src/services/ai-project-tools.ts +18 -5
  190. package/src/services/jxn-language.ts +110 -0
  191. package/src/services/model-uri.ts +3 -0
  192. package/src/services/monaco-setup.ts +6 -2
  193. package/src/settings/contributed-section.ts +2 -1
  194. package/src/settings/extension-commands.ts +2 -1
  195. package/src/settings/general-settings.ts +2 -2
  196. package/src/settings/settings-document.ts +5 -5
  197. package/src/shell.ts +1 -1
  198. package/src/studio.ts +28 -11
  199. package/src/style/variables-view.ts +2 -2
  200. package/src/surfaces/panel-elements.json +466 -206
  201. package/src/surfaces/panel-elements.ts +61 -25
  202. package/src/tabs/project-config.ts +13 -13
  203. package/src/tabs/tab.ts +7 -2
  204. package/src/types.ts +11 -2
  205. package/src/view.ts +9 -2
  206. package/src/workspace/tab-workspace.ts +2 -2
  207. package/src/workspace/workspace-back.ts +2 -2
  208. package/dist/chunks/adapter-12dxr3z7.js +0 -4
  209. package/dist/chunks/add-new-flow-any4pw2q.js +0 -4
  210. package/dist/chunks/cf-settings-hbj16kh3.js +0 -4
  211. package/dist/chunks/color-thzpppyc.js +0 -4
  212. package/dist/chunks/components-a98hzqw9.js +0 -4
  213. package/dist/chunks/content-source-jq3fjs3w.js +0 -4
  214. package/dist/chunks/convert-to-repeater-g66r6qp1.js +0 -4
  215. package/dist/chunks/editor-rth1rzj8.js +0 -4
  216. package/dist/chunks/entry-commands-02j0s19w.js +0 -4
  217. package/dist/chunks/extension-sections-rqrs7dr0.js +0 -4
  218. package/dist/chunks/file-ops-6a49er4c.js +0 -4
  219. package/dist/chunks/files-b2p9y0yz.js +0 -4
  220. package/dist/chunks/format-host-7xe57k1s.js +0 -4
  221. package/dist/chunks/fs-events-0xsy168g.js +0 -4
  222. package/dist/chunks/grid-open-h3q4fjy5.js +0 -4
  223. package/dist/chunks/iframe-entry-m24fza30.js +0 -5
  224. package/dist/chunks/iframe-host-8jcmaktg.js +0 -4
  225. package/dist/chunks/index-7nj2375a.js +0 -4
  226. package/dist/chunks/jx-validate-808zgbgy.js +0 -4
  227. package/dist/chunks/layers-0ffdtqjn.js +0 -4
  228. package/dist/chunks/layers-panel-rw62wtvf.js +0 -4
  229. package/dist/chunks/lit-html-9bz9rcfv.js +0 -4
  230. package/dist/chunks/media-library-2a5hdbek.js +0 -4
  231. package/dist/chunks/media-open-069kzhj4.js +0 -4
  232. package/dist/chunks/media-picker-4p4pd28y.js +0 -4
  233. package/dist/chunks/monaco-buffer-m9fd2dka.js +0 -4
  234. package/dist/chunks/monaco-setup-e0crh3v6.js +0 -4
  235. package/dist/chunks/notify-re3js157.js +0 -4
  236. package/dist/chunks/parse-hee7ne9b.js +0 -4
  237. package/dist/chunks/platform-rywy3tkg.js +0 -4
  238. package/dist/chunks/publish-panel-czkpg8m4.js +0 -4
  239. package/dist/chunks/publish-quick-b9wbhqj6.js +0 -4
  240. package/dist/chunks/publish-workspace-yy6d23b7.js +0 -4
  241. package/dist/chunks/quick-search-tp7pjnmv.js +0 -4
  242. package/dist/chunks/references-wd2yj8s1.js +0 -4
  243. package/dist/chunks/right-panel-x971k0zc.js +0 -4
  244. package/dist/chunks/source-control-k4p00hpe.js +0 -4
  245. package/dist/chunks/studio-1d8m5s38.js +0 -16
  246. package/dist/chunks/studio-35pmfjtx.js +0 -5
  247. package/dist/chunks/studio-44xqe0b7.js +0 -4
  248. package/dist/chunks/studio-48yzqzqr.js +0 -5
  249. package/dist/chunks/studio-5rq3e4q5.js +0 -5
  250. package/dist/chunks/studio-6hcfm9q3.js +0 -5
  251. package/dist/chunks/studio-6mf31e16.js +0 -5
  252. package/dist/chunks/studio-8w5pa88p.js +0 -7
  253. package/dist/chunks/studio-9c6cbq2c.js +0 -4
  254. package/dist/chunks/studio-aaw7wxv8.js +0 -5
  255. package/dist/chunks/studio-afx9brsc.js +0 -5
  256. package/dist/chunks/studio-dmgh2rrj.js +0 -5
  257. package/dist/chunks/studio-erjccagy.js +0 -5
  258. package/dist/chunks/studio-ex1644g2.js +0 -5
  259. package/dist/chunks/studio-gw83z798.js +0 -7
  260. package/dist/chunks/studio-j52ks8q7.js +0 -5
  261. package/dist/chunks/studio-kefs4sz4.js +0 -5
  262. package/dist/chunks/studio-m3jrjfhy.js +0 -14
  263. package/dist/chunks/studio-n4pnf0sw.js +0 -5
  264. package/dist/chunks/studio-ncwx602y.js +0 -5
  265. package/dist/chunks/studio-nzp0sqjg.js +0 -5
  266. package/dist/chunks/studio-ph17an19.js +0 -5
  267. package/dist/chunks/studio-q509sqt8.js +0 -5
  268. package/dist/chunks/studio-s49y6m5b.js +0 -5
  269. package/dist/chunks/studio-t46rt6gx.js +0 -5
  270. package/dist/chunks/studio-veh91hjv.js +0 -5
  271. package/dist/chunks/studio-vswmz40d.js +0 -6
  272. package/dist/chunks/studio-w4mfaaam.js +0 -5
  273. package/dist/chunks/studio-x5py815g.js +0 -5
  274. package/dist/chunks/studio-z6s56dzz.js +0 -5
  275. package/dist/chunks/studio-ze1sm147.js +0 -7
  276. package/dist/chunks/studio-zn7ysyzb.js +0 -5
  277. package/dist/chunks/toast-w11qpkyz.js +0 -4
  278. package/dist/chunks/workspace-home-61n1jz3q.js +0 -4
  279. package/dist/chunks/workspace-sheek6zw.js +0 -4
@@ -1,5 +1,5 @@
1
- function m(s,n={}){let t=n.baseMs??1000,o=n.maxMs??30000,i=n.random??Math.random,e=Math.min(o,t*2**Math.max(0,s));return e/2+i()*e/2}function ow(s,n={}){let t=n.win??(typeof window>"u"?void 0:window),o=n.doc??(typeof document>"u"?void 0:document),i=0,e=null,r=!1,a=()=>{if(e=null,!r)s()},c=()=>{if(r||e===null)return;clearTimeout(e),i=0,a()},u=(d)=>{if(d.persisted)c()},l=()=>{if(o?.visibilityState==="visible")c()};return t?.addEventListener("online",c),t?.addEventListener("pageshow",u),o?.addEventListener("visibilitychange",l),{dispose(){if(r)return;if(r=!0,e!==null)clearTimeout(e),e=null;t?.removeEventListener("online",c),t?.removeEventListener("pageshow",u),o?.removeEventListener("visibilitychange",l)},opened(){i=0},scheduleRetry(){if(r||e!==null)return;let d=m(i,n);i+=1,e=setTimeout(a,d)},wake:c}}
2
- export{ow};
1
+ function m(s,n={}){let t=n.baseMs??1000,o=n.maxMs??30000,i=n.random??Math.random,e=Math.min(o,t*2**Math.max(0,s));return e/2+i()*e/2}function dw(s,n={}){let t=n.win??(typeof window>"u"?void 0:window),o=n.doc??(typeof document>"u"?void 0:document),i=0,e=null,r=!1,a=()=>{if(e=null,!r)s()},c=()=>{if(r||e===null)return;clearTimeout(e),i=0,a()},u=(d)=>{if(d.persisted)c()},l=()=>{if(o?.visibilityState==="visible")c()};return t?.addEventListener("online",c),t?.addEventListener("pageshow",u),o?.addEventListener("visibilitychange",l),{dispose(){if(r)return;if(r=!0,e!==null)clearTimeout(e),e=null;t?.removeEventListener("online",c),t?.removeEventListener("pageshow",u),o?.removeEventListener("visibilitychange",l)},opened(){i=0},scheduleRetry(){if(r||e!==null)return;let d=m(i,n);i+=1,e=setTimeout(a,d)},wake:c}}
2
+ export{dw};
3
3
 
4
- //# debugId=70E2AF39E9E88F0E64756E2164756E21
5
- //# sourceMappingURL=studio-8ncm9zwx.js.map
4
+ //# debugId=371128BA6B32B86064756E2164756E21
5
+ //# sourceMappingURL=studio-s7p5ccxa.js.map
@@ -1,5 +1,5 @@
1
- import{Ot}from"./studio-z6s56dzz.js";var b=new Map([[".jpeg",{container:"jpeg",label:"JPEG",mime:"image/jpeg"}],[".jpg",{container:"jpeg",label:"JPEG",mime:"image/jpeg"}],[".png",{container:"png",label:"PNG",mime:"image/png"}],[".webp",{container:"webp",label:"WebP",mime:"image/webp"}]]),V=new Map([[".avif","The browser has no AVIF encoder, so an edit could not be written back as AVIF."],[".bmp","The browser has no BMP encoder, so an edit could not be written back as BMP."],[".gif","The browser has no GIF encoder, and a bake would flatten the animation to its first frame."],[".ico","An icon file holds several resolutions, not one image."],[".svg","An SVG is a vector document, not a bitmap. Edit it in its Source mode instead."]]),z=48000000,fg=16384,_M=fg*fg,T=[137,80,78,71,13,10,26,10];function s(e,t,n){if(t+n.length>e.length)return!1;for(let i=0;i<n.length;i++)if(e[t+i]!==n.codePointAt(i))return!1;return!0}function A(e,t){return t.length<=e.length&&t.every((n,i)=>e[i]===n)}function c(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function y(e,t){return c(e).getUint16(t,!0)+e[t+2]*65536}function w(e){return e%16384}function O(e){let t=null,n=T.length;while(n+8<=e.length){let i=c(e).getUint32(n);if(s(e,n+4,"IHDR")&&n+16<=e.length)t={height:c(e).getUint32(n+12),width:c(e).getUint32(n+8)};else if(s(e,n+4,"acTL"))return{animated:!0,container:"png",size:t};else if(s(e,n+4,"IDAT")||s(e,n+4,"IEND"))break;n+=12+i}return{animated:!1,container:"png",size:t}}function k(e){if(s(e,12,"VP8X")&&e.length>=30)return{animated:Math.floor(e[20]/2)%2===1,container:"webp",size:{height:y(e,27)+1,width:y(e,24)+1}};if(s(e,12,"VP8L")&&e.length>=25){let t=c(e).getUint32(21,!0);return{animated:!1,container:"webp",size:{height:w(Math.floor(t/16384))+1,width:w(t)+1}}}if(s(e,12,"VP8 ")&&e.length>=30)return{animated:!1,container:"webp",size:{height:w(c(e).getUint16(28,!0)),width:w(c(e).getUint16(26,!0))}};return{animated:!1,container:"webp",size:null}}function j(e){let t=2;while(t+9<=e.length){if(e[t]!==255)break;let n=e[t+1];if(n===255){t+=1;continue}if(n===1||n>=208&&n<=215){t+=2;continue}if(n>=192&&n<=207&&n!==196&&n!==200&&n!==204)return{animated:!1,container:"jpeg",size:{height:c(e).getUint16(t+5),width:c(e).getUint16(t+7)}};t+=2+c(e).getUint16(t+2)}return{animated:!1,container:"jpeg",size:null}}function sI(e){if(A(e,T))return O(e);if(A(e,[255,216,255]))return j(e);if(s(e,0,"RIFF")&&s(e,8,"WEBP"))return k(e);if(s(e,0,"GIF8"))return{animated:!1,container:"gif",size:null};if(s(e,4,"ftyp")&&(s(e,8,"avif")||s(e,8,"avis")))return{animated:s(e,8,"avis"),container:"avif",size:null};return{animated:!1,container:"unknown",size:null}}function I1(e){return b.get(Ot(e))?.mime??null}function C_(e){return e==="image/jpeg"||e==="image/webp"}function SM(e){return b.has(Ot(e))}function k_(e,t){let n=Ot(e),i=b.get(n);if(i===void 0)return V.get(n)??`${n||"A file with no extension"} is not an image format Studio edits.`;let o=sI(t);if(o.container!==i.container)return`This file's bytes are not ${i.label}, whatever its ${n} extension says, so an edit could not be written back as one.`;if(o.animated)return`This ${i.label} is animated, and a bake would keep only its first frame.`;if(o.size!==null&&o.size.width*o.size.height>z){let a=o.size.width*o.size.height/1e6;return`This image is ${o.size.width} × ${o.size.height} (${a.toFixed(1)} megapixels), past the ${z/1e6} megapixels an edit can hold in memory.`}return null}var G=[0,1,2,3],aI=[{id:"free",label:"Free"},{id:"original",label:"Original"},{id:"1:1",label:"Square (1:1)"},{id:"4:3",label:"4:3"},{id:"3:4",label:"3:4"},{id:"3:2",label:"3:2"},{id:"2:3",label:"2:3"},{id:"16:9",label:"16:9"},{id:"9:16",label:"9:16"}],Q={"1:1":"1:1","16:9":"9:16","2:3":"3:2","3:2":"2:3","3:4":"4:3","4:3":"3:4","9:16":"16:9",free:"free",original:"original"};var W=Object.freeze({aspect:"free",brightness:100,contrast:100,crop:null,flipH:!1,flipV:!1,quality:90,saturation:100,turns:0,width:null});function d(e){return{...e,crop:e.crop===null?null:{...e.crop}}}function ad(e,t){return e.crop??{height:t.height,width:t.width,x:0,y:0}}function E(e,t){return e===null||e.x===0&&e.y===0&&e.width===t.width&&e.height===t.height}function N1(e,t){return E(e.crop,t)&&(e.turns===0?!e.flipH&&!e.flipV:e.turns===2&&e.flipH&&e.flipV)&&(e.width===null||e.width>=Yy(e,t).width)&&e.quality===90&&e.brightness===100&&e.contrast===100&&e.saturation===100}function vf(e){return e%2===1}function Yy(e,t){let n=ad(e,t);return vf(e.turns)?{height:n.width,width:n.height}:{height:n.height,width:n.width}}function E_(e,t){let n=Yy(e,t);if(e.width===null||e.width>=n.width)return n;let i=Math.max(1,Math.round(e.width));return{height:Math.max(1,Math.round(n.height*i/n.width)),width:i}}function T_(e){let t=[];if(e.brightness!==100)t.push(`brightness(${e.brightness}%)`);if(e.contrast!==100)t.push(`contrast(${e.contrast}%)`);if(e.saturation!==100)t.push(`saturate(${e.saturation}%)`);return t.join(" ")}function Ph(e,t){return vf(e)?{height:t.width,width:t.height}:{height:t.height,width:t.width}}function B([e,t],n,i){let{width:o,height:a}=i,r;switch(n.turns){case 1:{r=[a-t,e];break}case 2:{r=[o-e,a-t];break}case 3:{r=[t,o-e];break}default:r=[e,t]}let l=Ph(n.turns,i);return[n.flipH?l.width-r[0]:r[0],n.flipV?l.height-r[1]:r[1]]}function Y([e,t],n,i){let{width:o,height:a}=i,r=Ph(n.turns,i),l=n.flipH?r.width-e:e,u=n.flipV?r.height-t:t;switch(n.turns){case 1:return[u,a-l];case 2:return[o-l,a-u];case 3:return[o-u,l];default:return[l,u]}}function U(e,t){let[n,i]=t([e.x,e.y]),[o,a]=t([e.x+e.width,e.y+e.height]);return{height:Math.abs(a-i),width:Math.abs(o-n),x:Math.min(n,o),y:Math.min(i,a)}}function Zy(e,t,n){return U(e,(i)=>B(i,t,n))}function q(e,t,n){return U(e,(i)=>Y(i,t,n))}var X=["n","ne","e","se","s","sw","w","nw"],mg=["move",...X],D1={e:"Right edge",move:"Crop area",n:"Top edge",ne:"Top right corner",nw:"Top left corner",s:"Bottom edge",se:"Bottom right corner",sw:"Bottom left corner",w:"Left edge"},f=1;function J(e,t,n,i,o){let a=Ph(e.turns,t),r=Zy(ad(e,t),e,t),l=H(e,t),u=l===null?Z(r,a,n,i,o):ee(r,a,n,i,o,l);return I(e,t,u)}function K(e,t,n,i){let o=Ph(e.turns,t),a=Zy(ad(e,t),e,t);return I(e,t,{...a,x:h(Math.round(a.x+n),0,o.width-a.width),y:h(Math.round(a.y+i),0,o.height-a.height)})}function lI(e,t,n,i,o){return n==="move"?K(e,t,i,o):J(e,t,n,i,o)}function I(e,t,n){let i=d(e),o=q(n,e,t);return i.crop=E(o,t)?null:o,_(i,t)}function Z(e,t,n,i,o){let{x:a,y:r}=e,l=e.x+e.width,u=e.y+e.height;if(n.includes("w"))a=h(Math.round(a+i),0,l-f);if(n.includes("e"))l=h(Math.round(l+i),a+f,t.width);if(n.includes("n"))r=h(Math.round(r+o),0,u-f);if(n.includes("s"))u=h(Math.round(u+o),r+f,t.height);return{height:u-r,width:l-a,x:a,y:r}}function ee(e,t,n,i,o,a){let r=n.includes("w"),l=n.includes("e"),u=n.includes("n"),p=n.includes("s"),P=l?i:r?-i:0,S=p?o:u?-o:0,C=(l||r)&&(!(u||p)||Math.abs(P)>=Math.abs(S)*a)?e.width+P:(e.height+S)*a,g=r?e.x+e.width:l?e.x:e.x+e.width/2,m=u?e.y+e.height:p?e.y:e.y+e.height/2,v=r?g:l?t.width-g:2*Math.min(g,t.width-g),N=u?m:p?t.height-m:2*Math.min(m,t.height-m),D=Math.min(v,N*a),M=Math.min(Math.max(C,Math.max(f,f*a)),D),x=Math.max(f,Math.round(M)),R=Math.max(f,Math.round(M/a)),L=r?g-x:l?g:Math.round(g-x/2),F=u?m-R:p?m:Math.round(m-R/2);return{height:R,width:x,x:h(L,0,t.width-x),y:h(F,0,t.height-R)}}function H(e,t){if(e.aspect==="free")return null;if(e.aspect==="original"){let o=Ph(e.turns,t);return o.width/o.height}let[n,i]=e.aspect.split(":");return Number(n)/Number(i)}function CM(e,t,n){let i={...d(e),aspect:n},o=H(i,t);if(o===null)return i;let a=Ph(e.turns,t),r=Zy(ad(e,t),e,t),l=Math.min(a.width,a.height*o),u=Math.max(f,Math.round(l)),p=Math.max(f,Math.round(l/o));return I(i,t,{height:p,width:u,x:h(Math.round(r.x+r.width/2-u/2),0,a.width-u),y:h(Math.round(r.y+r.height/2-p/2),0,a.height-p)})}function h(e,t,n){return Math.min(Math.max(e,t),n)}function _(e,t){if(e.width!==null&&e.width>=Yy(e,t).width)e.width=null;return e}function kM(e,t){let n=d(e);return n.turns=G[(e.turns+t+4)%4],n.flipH=e.flipV,n.flipV=e.flipH,n.aspect=Q[e.aspect],n.width=null,n}function EM(e,t){let n=d(e);if(t==="h")n.flipH=!e.flipH;else n.flipV=!e.flipV;return n}function cI(e,t,n){let i=d(e);return i.width=n===null||!Number.isFinite(n)||n<1?null:Math.round(n),_(i,t)}var te={max:200,min:0},ne={max:100,min:1};function TM(e,t,n){let i=d(e),o=t==="quality"?ne:te;return i[t]=Number.isFinite(n)?h(Math.round(n),o.min,o.max):e[t],i}function dI(e,t,n){let i=Yy(e,t).width,o=null;for(let a of n)if(Number.isFinite(a)&&a>=1&&a<i&&(o===null||a>o))o=Math.round(a);return o}var ie=100;function $_(e=W){return{future:[],past:[],present:d(e)}}function oe(e,t){return JSON.stringify(d(e))===JSON.stringify(d(t))}function $M(e,t){if(oe(e.present,t))return e;return{future:[],past:[...e.past,e.present].slice(-ie),present:d(t)}}function LM(e){let t=e.past.at(-1);if(t===void 0)return e;return{future:[e.present,...e.future],past:e.past.slice(0,-1),present:t}}function RM(e){let[t,...n]=e.future;if(t===void 0)return e;return{future:n,past:[...e.past,e.present],present:t}}
2
- export{fg,_M,sI,I1,C_,SM,k_,aI,ad,N1,vf,Yy,E_,T_,Ph,Zy,mg,D1,lI,CM,kM,EM,cI,TM,dI,$_,$M,LM,RM};
1
+ import{Ot}from"./studio-6tnpg0vx.js";var b=new Map([[".jpeg",{container:"jpeg",label:"JPEG",mime:"image/jpeg"}],[".jpg",{container:"jpeg",label:"JPEG",mime:"image/jpeg"}],[".png",{container:"png",label:"PNG",mime:"image/png"}],[".webp",{container:"webp",label:"WebP",mime:"image/webp"}]]),V=new Map([[".avif","The browser has no AVIF encoder, so an edit could not be written back as AVIF."],[".bmp","The browser has no BMP encoder, so an edit could not be written back as BMP."],[".gif","The browser has no GIF encoder, and a bake would flatten the animation to its first frame."],[".ico","An icon file holds several resolutions, not one image."],[".svg","An SVG is a vector document, not a bitmap. Edit it in its Source mode instead."]]),z=48000000,yg=16384,AM=yg*yg,T=[137,80,78,71,13,10,26,10];function s(e,t,n){if(t+n.length>e.length)return!1;for(let i=0;i<n.length;i++)if(e[t+i]!==n.codePointAt(i))return!1;return!0}function A(e,t){return t.length<=e.length&&t.every((n,i)=>e[i]===n)}function c(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function y(e,t){return c(e).getUint16(t,!0)+e[t+2]*65536}function w(e){return e%16384}function O(e){let t=null,n=T.length;while(n+8<=e.length){let i=c(e).getUint32(n);if(s(e,n+4,"IHDR")&&n+16<=e.length)t={height:c(e).getUint32(n+12),width:c(e).getUint32(n+8)};else if(s(e,n+4,"acTL"))return{animated:!0,container:"png",size:t};else if(s(e,n+4,"IDAT")||s(e,n+4,"IEND"))break;n+=12+i}return{animated:!1,container:"png",size:t}}function k(e){if(s(e,12,"VP8X")&&e.length>=30)return{animated:Math.floor(e[20]/2)%2===1,container:"webp",size:{height:y(e,27)+1,width:y(e,24)+1}};if(s(e,12,"VP8L")&&e.length>=25){let t=c(e).getUint32(21,!0);return{animated:!1,container:"webp",size:{height:w(Math.floor(t/16384))+1,width:w(t)+1}}}if(s(e,12,"VP8 ")&&e.length>=30)return{animated:!1,container:"webp",size:{height:w(c(e).getUint16(28,!0)),width:w(c(e).getUint16(26,!0))}};return{animated:!1,container:"webp",size:null}}function j(e){let t=2;while(t+9<=e.length){if(e[t]!==255)break;let n=e[t+1];if(n===255){t+=1;continue}if(n===1||n>=208&&n<=215){t+=2;continue}if(n>=192&&n<=207&&n!==196&&n!==200&&n!==204)return{animated:!1,container:"jpeg",size:{height:c(e).getUint16(t+5),width:c(e).getUint16(t+7)}};t+=2+c(e).getUint16(t+2)}return{animated:!1,container:"jpeg",size:null}}function mI(e){if(A(e,T))return O(e);if(A(e,[255,216,255]))return j(e);if(s(e,0,"RIFF")&&s(e,8,"WEBP"))return k(e);if(s(e,0,"GIF8"))return{animated:!1,container:"gif",size:null};if(s(e,4,"ftyp")&&(s(e,8,"avif")||s(e,8,"avis")))return{animated:s(e,8,"avis"),container:"avif",size:null};return{animated:!1,container:"unknown",size:null}}function j1(e){return b.get(Ot(e))?.mime??null}function I_(e){return e==="image/jpeg"||e==="image/webp"}function PM(e){return b.has(Ot(e))}function N_(e,t){let n=Ot(e),i=b.get(n);if(i===void 0)return V.get(n)??`${n||"A file with no extension"} is not an image format Studio edits.`;let o=mI(t);if(o.container!==i.container)return`This file's bytes are not ${i.label}, whatever its ${n} extension says, so an edit could not be written back as one.`;if(o.animated)return`This ${i.label} is animated, and a bake would keep only its first frame.`;if(o.size!==null&&o.size.width*o.size.height>z){let a=o.size.width*o.size.height/1e6;return`This image is ${o.size.width} × ${o.size.height} (${a.toFixed(1)} megapixels), past the ${z/1e6} megapixels an edit can hold in memory.`}return null}var G=[0,1,2,3],gI=[{id:"free",label:"Free"},{id:"original",label:"Original"},{id:"1:1",label:"Square (1:1)"},{id:"4:3",label:"4:3"},{id:"3:4",label:"3:4"},{id:"3:2",label:"3:2"},{id:"2:3",label:"2:3"},{id:"16:9",label:"16:9"},{id:"9:16",label:"9:16"}],Q={"1:1":"1:1","16:9":"9:16","2:3":"3:2","3:2":"2:3","3:4":"4:3","4:3":"3:4","9:16":"16:9",free:"free",original:"original"};var W=Object.freeze({aspect:"free",brightness:100,contrast:100,crop:null,flipH:!1,flipV:!1,quality:90,saturation:100,turns:0,width:null});function d(e){return{...e,crop:e.crop===null?null:{...e.crop}}}function cd(e,t){return e.crop??{height:t.height,width:t.width,x:0,y:0}}function E(e,t){return e===null||e.x===0&&e.y===0&&e.width===t.width&&e.height===t.height}function H1(e,t){return E(e.crop,t)&&(e.turns===0?!e.flipH&&!e.flipV:e.turns===2&&e.flipH&&e.flipV)&&(e.width===null||e.width>=tv(e,t).width)&&e.quality===90&&e.brightness===100&&e.contrast===100&&e.saturation===100}function Sf(e){return e%2===1}function tv(e,t){let n=cd(e,t);return Sf(e.turns)?{height:n.width,width:n.height}:{height:n.height,width:n.width}}function D_(e,t){let n=tv(e,t);if(e.width===null||e.width>=n.width)return n;let i=Math.max(1,Math.round(e.width));return{height:Math.max(1,Math.round(n.height*i/n.width)),width:i}}function O_(e){let t=[];if(e.brightness!==100)t.push(`brightness(${e.brightness}%)`);if(e.contrast!==100)t.push(`contrast(${e.contrast}%)`);if(e.saturation!==100)t.push(`saturate(${e.saturation}%)`);return t.join(" ")}function jh(e,t){return Sf(e)?{height:t.width,width:t.height}:{height:t.height,width:t.width}}function B([e,t],n,i){let{width:o,height:a}=i,r;switch(n.turns){case 1:{r=[a-t,e];break}case 2:{r=[o-e,a-t];break}case 3:{r=[t,o-e];break}default:r=[e,t]}let l=jh(n.turns,i);return[n.flipH?l.width-r[0]:r[0],n.flipV?l.height-r[1]:r[1]]}function Y([e,t],n,i){let{width:o,height:a}=i,r=jh(n.turns,i),l=n.flipH?r.width-e:e,u=n.flipV?r.height-t:t;switch(n.turns){case 1:return[u,a-l];case 2:return[o-l,a-u];case 3:return[o-u,l];default:return[l,u]}}function U(e,t){let[n,i]=t([e.x,e.y]),[o,a]=t([e.x+e.width,e.y+e.height]);return{height:Math.abs(a-i),width:Math.abs(o-n),x:Math.min(n,o),y:Math.min(i,a)}}function nv(e,t,n){return U(e,(i)=>B(i,t,n))}function q(e,t,n){return U(e,(i)=>Y(i,t,n))}var X=["n","ne","e","se","s","sw","w","nw"],vg=["move",...X],B1={e:"Right edge",move:"Crop area",n:"Top edge",ne:"Top right corner",nw:"Top left corner",s:"Bottom edge",se:"Bottom right corner",sw:"Bottom left corner",w:"Left edge"},f=1;function J(e,t,n,i,o){let a=jh(e.turns,t),r=nv(cd(e,t),e,t),l=H(e,t),u=l===null?Z(r,a,n,i,o):ee(r,a,n,i,o,l);return I(e,t,u)}function K(e,t,n,i){let o=jh(e.turns,t),a=nv(cd(e,t),e,t);return I(e,t,{...a,x:h(Math.round(a.x+n),0,o.width-a.width),y:h(Math.round(a.y+i),0,o.height-a.height)})}function bI(e,t,n,i,o){return n==="move"?K(e,t,i,o):J(e,t,n,i,o)}function I(e,t,n){let i=d(e),o=q(n,e,t);return i.crop=E(o,t)?null:o,_(i,t)}function Z(e,t,n,i,o){let{x:a,y:r}=e,l=e.x+e.width,u=e.y+e.height;if(n.includes("w"))a=h(Math.round(a+i),0,l-f);if(n.includes("e"))l=h(Math.round(l+i),a+f,t.width);if(n.includes("n"))r=h(Math.round(r+o),0,u-f);if(n.includes("s"))u=h(Math.round(u+o),r+f,t.height);return{height:u-r,width:l-a,x:a,y:r}}function ee(e,t,n,i,o,a){let r=n.includes("w"),l=n.includes("e"),u=n.includes("n"),p=n.includes("s"),P=l?i:r?-i:0,S=p?o:u?-o:0,C=(l||r)&&(!(u||p)||Math.abs(P)>=Math.abs(S)*a)?e.width+P:(e.height+S)*a,g=r?e.x+e.width:l?e.x:e.x+e.width/2,m=u?e.y+e.height:p?e.y:e.y+e.height/2,v=r?g:l?t.width-g:2*Math.min(g,t.width-g),N=u?m:p?t.height-m:2*Math.min(m,t.height-m),D=Math.min(v,N*a),M=Math.min(Math.max(C,Math.max(f,f*a)),D),x=Math.max(f,Math.round(M)),R=Math.max(f,Math.round(M/a)),L=r?g-x:l?g:Math.round(g-x/2),F=u?m-R:p?m:Math.round(m-R/2);return{height:R,width:x,x:h(L,0,t.width-x),y:h(F,0,t.height-R)}}function H(e,t){if(e.aspect==="free")return null;if(e.aspect==="original"){let o=jh(e.turns,t);return o.width/o.height}let[n,i]=e.aspect.split(":");return Number(n)/Number(i)}function MM(e,t,n){let i={...d(e),aspect:n},o=H(i,t);if(o===null)return i;let a=jh(e.turns,t),r=nv(cd(e,t),e,t),l=Math.min(a.width,a.height*o),u=Math.max(f,Math.round(l)),p=Math.max(f,Math.round(l/o));return I(i,t,{height:p,width:u,x:h(Math.round(r.x+r.width/2-u/2),0,a.width-u),y:h(Math.round(r.y+r.height/2-p/2),0,a.height-p)})}function h(e,t,n){return Math.min(Math.max(e,t),n)}function _(e,t){if(e.width!==null&&e.width>=tv(e,t).width)e.width=null;return e}function FM(e,t){let n=d(e);return n.turns=G[(e.turns+t+4)%4],n.flipH=e.flipV,n.flipV=e.flipH,n.aspect=Q[e.aspect],n.width=null,n}function jM(e,t){let n=d(e);if(t==="h")n.flipH=!e.flipH;else n.flipV=!e.flipV;return n}function yI(e,t,n){let i=d(e);return i.width=n===null||!Number.isFinite(n)||n<1?null:Math.round(n),_(i,t)}var te={max:200,min:0},ne={max:100,min:1};function HM(e,t,n){let i=d(e),o=t==="quality"?ne:te;return i[t]=Number.isFinite(n)?h(Math.round(n),o.min,o.max):e[t],i}function vI(e,t,n){let i=tv(e,t).width,o=null;for(let a of n)if(Number.isFinite(a)&&a>=1&&a<i&&(o===null||a>o))o=Math.round(a);return o}var ie=100;function A_(e=W){return{future:[],past:[],present:d(e)}}function oe(e,t){return JSON.stringify(d(e))===JSON.stringify(d(t))}function BM(e,t){if(oe(e.present,t))return e;return{future:[],past:[...e.past,e.present].slice(-ie),present:d(t)}}function VM(e){let t=e.past.at(-1);if(t===void 0)return e;return{future:[e.present,...e.future],past:e.past.slice(0,-1),present:t}}function WM(e){let[t,...n]=e.future;if(t===void 0)return e;return{future:n,past:[...e.past,e.present],present:t}}
2
+ export{yg,AM,mI,j1,I_,PM,N_,gI,cd,H1,Sf,tv,D_,O_,jh,nv,vg,B1,bI,MM,FM,jM,yI,HM,vI,A_,BM,VM,WM};
3
3
 
4
- //# debugId=D0538BAB23C2535E64756E2164756E21
5
- //# sourceMappingURL=studio-zzgp5yka.js.map
4
+ //# debugId=65FBF979FA32342864756E2164756E21
5
+ //# sourceMappingURL=studio-s9jjap3x.js.map
@@ -1,5 +1,5 @@
1
- import{ae}from"./studio-q509sqt8.js";import{p}from"./studio-xh6rf05g.js";import{ds}from"./studio-pv1ts08p.js";import{Jt,Ut}from"./studio-m3jrjfhy.js";import{sn,dt}from"./studio-cv6gnjqd.js";import{Xl,yO,Wb,B$,vO,Ii,jd}from"./studio-qarg1xf9.js";import{mb,UE}from"./studio-35pmfjtx.js";import{x}from"./studio-zn7ysyzb.js";import{ze,yt,E,I}from"./studio-1a7zshnv.js";import{b}from"./studio-9f5vcb4w.js";import{Q}from"./studio-erjccagy.js";import{ce}from"./studio-7qqb7hb8.js";function Wl(e){let t=e.trim().replaceAll("\\","/").split("/").filter((n)=>n!=="");return t.some((n)=>n==="."||n==="..")?null:t.join("/")}var w={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPublish",$description:"Publish: the one-click Cloudflare Pages flow, as a `jx-dialog` over the kit. Eight bodies, one at a time, because the reader is at exactly one point of a chain — a host that cannot reach Cloudflare at all, a question still in flight, a connection that lapsed, an invitation to connect, a stored token Cloudflare refused, a field to paste a replacement into, the create-and-connect form, and the connected status. `publish/publish-panel.ts` keeps every one of those decisions and the calls that settle them; this document knows only which of the eight it was told to draw. **The token is never painted.** The field below binds no `value` — it is written by the reader and read once, on its way to storage — so a stored secret cannot reach the attribute, the serialised HTML or the accessibility tree, which is `studio.md` §15 rule 1 written as a missing binding rather than as a rule somebody remembers.",tagName:"jx-dialog",$props:{headline:"Publish",confirmLabel:"",cancelLabel:"Close",size:"md"},attributes:{part:"publish"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"What the five `.publish-*` names carried, keyed on `part`, and most of them do not survive the move. `.publish-modal` and its `.new-project-modal` base were a fixed card, a scroll body, a border, a shadow and a `z-index: 1000` — a modal `<dialog>` is every one of those, and the top layer is what the z-index was climbing towards. `.publish-field` was a label stacked over a control, which is `jx-field`'s whole shape. What is left is the column gap between bodies, the two button rows, the hint and the refusal. Nothing here uses `--spectrum-*`: those custom properties resolve only inside `<sp-theme>`, and a document mounted in a layer host is outside it, so each would silently have taken its hard-coded fallback.",'& [part="body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="note"], & [part="status-line"], & [part="deployment"]':{margin:"0",lineHeight:"1.5"},'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="actions"]':{$description:'Wraps rather than overflows (studio-ui-guidelines.md §4.6): two buttons whose labels are whole phrases — "Verify & Connect", "Preferences › Accounts" — are wider than a narrow dialog at the sizes a reader may have set.',display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)"},'& [part="submit"]':{alignSelf:"flex-start"},'& [part="hint"]':{$description:"Publishing rides every commit, so the connected body's only job is to say what is already happening. Dim, because it is a standing fact rather than something to act on.",margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="failure"]':{$description:'`failure` and not `error`: `jx-textfield` and `jx-select` each draw a `[part="error"]` of their own inside this same tree, and the kit is light DOM — a scoped rule on that name would restyle the token field\'s refusal line too.',margin:"0",color:"var(--danger)",lineHeight:"1.5"},'& [part="link"], & [part="install-link"]':{color:"var(--accent)",textDecoration:"underline"},"& code":{fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)"}},children:[{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{unsupported:{tagName:"p",attributes:{part:"note"},children:["This platform cannot reach the Cloudflare API. Publish by committing and pushing — your host builds ",{tagName:"code",textContent:"bunx jx build"}," and serves ",{tagName:"code",textContent:"dist/"},"."]},loading:{tagName:"p",attributes:{part:"note"},textContent:"Checking Cloudflare connection…"},lapsed:{tagName:"div",attributes:{part:"lapsed",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Your Cloudflare connection has expired, so publishing cannot reach your account. Reconnect to restore it — this site's Pages project and its settings are untouched."},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"reconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"${state.connectLabel}"}]}]},hosted:{tagName:"div",attributes:{part:"hosted",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Connect your Cloudflare account to publish this site."},{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"connect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"Connect Cloudflare"}]}]},stored:{tagName:"div",attributes:{part:"stored",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"A Cloudflare API token is stored on this machine, and Cloudflare did not accept it. It may have been revoked, or it may be missing the Account Settings Read and Pages Read/Write permissions."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"replace"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[]}]},children:[{tagName:"span",textContent:"Replace token"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},token:{tagName:"div",attributes:{part:"token-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Paste a Cloudflare API token (permissions: Account Settings Read, Pages Read/Write). It is stored on this machine and only sent to the same-origin proxy — Studio never renders it back."},{tagName:"jx-field",$props:{span:!0,label:"API token"},attributes:{part:"token-row","data-field":"token"},children:[{tagName:"jx-textfield",$description:"No `value` binding, and its absence is the contract: a secret may pass through a field the reader typed it into and may never be painted into one they did not. The draft lives in the adapter's closure until Verify reads it, so nothing here — not the attribute, not the accessibility tree, not a DOM dump — has ever held it.",$props:{type:"password",placeholder:"cf_..."},attributes:{part:"token"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setToken"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"verify"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/verify"},value:[]}]},children:[{tagName:"span",textContent:"Verify & Connect"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},form:{tagName:"div",attributes:{part:"connect-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},children:["Create a Cloudflare Pages project connected to this repository. Every commit then builds and publishes automatically (",{tagName:"code",textContent:"bunx jx build"},")."]},{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Account"},attributes:{part:"row","data-field":"account"},children:[{tagName:"jx-select",$props:{options:{$ref:"#/state/accountOptions"},value:{$ref:"#/state/accountId"}},attributes:{part:"account"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAccount"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Pages project name"},attributes:{part:"row","data-field":"projectName"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/projectName"}},attributes:{part:"project-name"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setProjectName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub owner"},attributes:{part:"row","data-field":"owner"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/owner"}},attributes:{part:"owner"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub repository"},attributes:{part:"row","data-field":"repo"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/repo"}},attributes:{part:"repo"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRepo"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Production branch"},attributes:{part:"row","data-field":"branch"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/branch"}},attributes:{part:"branch"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBranch"},value:[{$ref:"event#/target/value"}]}]}}]}]},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"submit"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/submit"},value:[]}]},children:[{tagName:"span",textContent:"${state.submitLabel}"}]}]},status:{tagName:"div",attributes:{part:"status",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"status-line"},children:["Connected to Pages project ",{tagName:"strong",attributes:{part:"project-name"},textContent:"${state.deployProject}"},{tagName:"span",attributes:{part:"site-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProductionUrl"},cases:{true:{tagName:"span",children:[" — ",{tagName:"a",attributes:{part:"link",href:"${state.productionUrl}",target:"_blank",rel:"noreferrer"},textContent:"${state.productionUrl}"}]}}}]},{tagName:"div",attributes:{part:"deployment-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDeployment"},cases:{true:{tagName:"p",attributes:{part:"deployment"},children:["Latest deployment: ",{tagName:"strong",attributes:{part:"deployment-state"},textContent:"${state.deploymentState}"}," (${state.deploymentEnvironment}) — ",{tagName:"a",attributes:{part:"link",href:"${state.deploymentUrl}",target:"_blank",rel:"noreferrer"},textContent:"preview"}]},false:{tagName:"p",attributes:{part:"deployment"},textContent:"No deployments yet — the first commit after connecting triggers one."}}},{tagName:"p",attributes:{part:"hint"},textContent:"Publishing happens automatically on every commit."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]},children:[{tagName:"span",textContent:"Refresh"}]},{tagName:"jx-button",$props:{variant:"negative",disabled:{$ref:"#/state/busy"}},attributes:{part:"disconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/disconnect"},value:[]}]},children:[{tagName:"span",textContent:"Disconnect"}]}]}]}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFailure"},cases:{true:{tagName:"p",attributes:{part:"failure"},children:["${state.failure}",{tagName:"span",attributes:{part:"pages-app-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/needsPagesApp"},cases:{true:{tagName:"span",children:[" — if the Cloudflare Pages GitHub App is not installed on the repository, ",{tagName:"a",attributes:{part:"install-link",href:"${state.pagesAppUrl}",target:"_blank",rel:"noreferrer"},textContent:"install it"}," and retry."]}}}]}}}]}]};E("publish",w);var D="https://github.com/apps/cloudflare-pages/installations/new";function R(e){if(!e.supported)return"unsupported";if(e.loading)return"loading";if(e.connected&&e.lapsed)return"lapsed";if(!e.connected){if(e.hosted)return"hosted";return e.tokenStored&&!e.replacing?"stored":"token"}return e.deploy?"status":"form"}function j(e){let{error:t}=e;return{accountId:e.form.accountId,accountOptions:e.accounts,body:R(e),branch:e.form.branch,busy:e.busy,connectLabel:e.busy?"Reconnecting…":"Reconnect Cloudflare",deploymentEnvironment:e.deployment?.environment??"",deploymentState:e.deployment?`${e.deployment.stage}: ${e.deployment.status}`:"",deploymentUrl:e.deployment?.url??"",deployProject:e.deploy?.projectName??"",failure:t,hasDeployment:e.deployment!==null,hasFailure:t!=="",hasProductionUrl:(e.deploy?.productionUrl??"")!=="",needsPagesApp:/github/i.test(t)&&/app|install|source|repo/i.test(t),owner:e.form.owner,pagesAppUrl:D,productionUrl:e.deploy?.productionUrl??"",projectName:e.form.projectName,repo:e.form.repo,submitLabel:e.busy?"Connecting…":"Create & Connect"}}function k(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let n="",m=!1,P=()=>{if(m)return;m=!0,e.onClosed()},C=()=>m,d=b({...j(e.view),closed:P,connect:()=>{e.onConnect()},disconnect:()=>{e.onDisconnect()},openAccounts:()=>{e.onOpenAccounts()},refresh:()=>{e.onRefresh()},replace:()=>{n="",e.onReplaceToken()},setAccount:(o)=>{d.accountId=o,e.onField("accountId",o)},setBranch:(o)=>{d.branch=o,e.onField("branch",o)},setOwner:(o)=>{d.owner=o,e.onField("owner",o)},setProjectName:(o)=>{d.projectName=o,e.onField("projectName",o)},setRepo:(o)=>{d.repo=o,e.onField("repo",o)},setToken:(o)=>{n=o},submit:()=>{e.onSubmit()},verify:()=>{let o=n;n="",e.onSaveToken(o)}}),y=null,A=I("publish",d,t).then(async(o)=>{y=o;let u=o.root;if(C())return o.dispose(),u;if(await sn(u),C())return u;return(u.querySelector('dialog[part="dialog"]')??u).setAttribute(ze,yt("modal","publish")),Jt(u),u});return{close(){let o=y?.root;if(o instanceof HTMLElement)Ut(o);y?.dispose(),y=null,n="",t.remove(),P()},host:t,ready:A,update(o){Object.assign(d,j(o))}}}var f=null,i="loading",h=[],l=null,r="",c=!1,g=!1,a={accountId:"",branch:"main",owner:"",projectName:"",repo:""};function N(){return x?.projectConfig??null}function T(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-+|-+$/g,"").slice(0,58)||"site"}function O(){let e=p().projectRoot,t=/^([\w.-]+)\/([\w.-]+)(?:@.+)?$/.exec(e);return t?{owner:t[1],repo:t[2]}:{owner:"",repo:""}}function H(){let e=/^[\w.-]+\/[\w.-]+@[^:]+:(.+)$/.exec(p().projectRoot)?.[1]??"";return Wl(e)??""}function L(){let e=Ii();return e?{productionUrl:e.productionUrl??"",projectName:e.projectName}:null}function S(){let e=Xl(),t=i==="loading"?null:i;return{accounts:h.map((n)=>({label:n.name,value:n.id})),busy:c,connected:t?.connected===!0,deploy:L(),deployment:l?{environment:l.environment,stage:l.stage,status:l.status,url:l.url}:null,error:r,form:{...a},hosted:e&&Q(p().cfConnect),lapsed:t?.connected===!0&&t.needsReconnect===!0,loading:i==="loading",replacing:g,supported:e,tokenStored:mb()!==""}}function s(){if(f){f.update(S());return}f=k({layer:dt("modal"),onClosed:B,onConnect:()=>{M()},onDisconnect:()=>{z()},onField:(e,t)=>{a={...a,[e]:t}},onOpenAccounts:_,onRefresh:()=>{v()},onReplaceToken:()=>{g=!0,r="",s()},onSaveToken:(e)=>{U(e)},onSubmit:()=>{V()},view:S()})}async function v(){i="loading",s();try{if(i=await p().cfConnection?.()??null,i?.connected&&!i.needsReconnect){h=await yO(),a={...a,accountId:i.accountId??h[0]?.id??""};let e=Ii();if(e)l=await Wb(e),jd(l)}}catch(e){i=null,r=e instanceof Error?e.message:String(e)}s()}async function U(e){let t=e.trim();if(!t){r="Paste a token, or use Preferences › Accounts to forget the stored one.",s();return}UE(t),g=!1,r="",await v()}function _(){ae()?.run("app.preferences",{section:"accounts"})}async function M(){c=!0,r="",s();try{let e=await p().cfConnect?.()??null;if(e?.status==="timeout")r="The Cloudflare window didn't finish. Sign in there, then reconnect — nothing was changed.";else if(e?.status==="connected"&&!e.connection.accountId){let{openCfAccountPicker:t}=await (ce("ajh60k54"),import("./cf-account-picker-ajh60k54.js"));await t()}}catch(e){r=e instanceof Error?e.message:String(e)}c=!1,ds(),await v()}async function V(){let e=N();if(!e)return;if(!a.projectName||!a.owner||!a.repo||!a.accountId){r="Account, project name, and the GitHub owner/repo are all required.",s();return}c=!0,r="",s();try{let t=H(),n={accountId:a.accountId,owner:a.owner,productionBranch:a.branch||"main",projectName:a.projectName,repo:a.repo};if(t)n.rootDir=t;let m=await vO(e,n);l=await Wb(m).catch(()=>null)}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}async function z(){let e=N();if(!e)return;c=!0,s();try{await B$(e,null),l=null}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}function B(){let e=f;f=null,e?.close()}function zE(e){i={accountId:e.accountId??"demo-account",connected:!0},h=[],l=e.deployment,jd(e.deployment),r="",c=!1,g=!1,s()}function SF(){let e=N(),{owner:t,repo:n}=O();i="loading",h=[],l=null,r="",c=!1,g=!1,a={accountId:"",branch:"main",owner:t,projectName:Ii()?.projectName??T(e?.name??""),repo:n},s(),v()}
2
- export{Wl,zE,SF};
1
+ import{ae}from"./studio-dbex091t.js";import{p}from"./studio-1b79rpcb.js";import{us}from"./studio-g79s1dyg.js";import{Gt,Ut}from"./studio-s6ymkf3q.js";import{an,dt}from"./studio-yetr4gg1.js";import{ec,LO,Jb,Y$,RO,Ii,Bd}from"./studio-5qez462c.js";import{vb,QE}from"./studio-qfq58c8n.js";import{x}from"./studio-anc8067x.js";import{ze,yt,E,I}from"./studio-xxttcym1.js";import{b}from"./studio-y3tjh2xb.js";import{Q}from"./studio-0z8kp4xk.js";import{ce}from"./studio-nhpg405j.js";function Ul(e){let t=e.trim().replaceAll("\\","/").split("/").filter((n)=>n!=="");return t.some((n)=>n==="."||n==="..")?null:t.join("/")}var w={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPublish",$description:"Publish: the one-click Cloudflare Pages flow, as a `jx-dialog` over the kit. Eight bodies, one at a time, because the reader is at exactly one point of a chain — a host that cannot reach Cloudflare at all, a question still in flight, a connection that lapsed, an invitation to connect, a stored token Cloudflare refused, a field to paste a replacement into, the create-and-connect form, and the connected status. `publish/publish-panel.ts` keeps every one of those decisions and the calls that settle them; this document knows only which of the eight it was told to draw. **The token is never painted.** The field below binds no `value` — it is written by the reader and read once, on its way to storage — so a stored secret cannot reach the attribute, the serialised HTML or the accessibility tree, which is `studio.md` §15 rule 1 written as a missing binding rather than as a rule somebody remembers.",tagName:"jx-dialog",$props:{headline:"Publish",confirmLabel:"",cancelLabel:"Close",size:"md"},attributes:{part:"publish"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"What the five `.publish-*` names carried, keyed on `part`, and most of them do not survive the move. `.publish-modal` and its `.new-project-modal` base were a fixed card, a scroll body, a border, a shadow and a `z-index: 1000` — a modal `<dialog>` is every one of those, and the top layer is what the z-index was climbing towards. `.publish-field` was a label stacked over a control, which is `jx-field`'s whole shape. What is left is the column gap between bodies, the two button rows, the hint and the refusal. Nothing here uses `--spectrum-*`: those custom properties resolve only inside `<sp-theme>`, and a document mounted in a layer host is outside it, so each would silently have taken its hard-coded fallback.",'& [part="body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="note"], & [part="status-line"], & [part="deployment"]':{margin:"0",lineHeight:"1.5"},'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="actions"]':{$description:'Wraps rather than overflows (studio-ui-guidelines.md §4.6): two buttons whose labels are whole phrases — "Verify & Connect", "Preferences › Accounts" — are wider than a narrow dialog at the sizes a reader may have set.',display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)"},'& [part="submit"]':{alignSelf:"flex-start"},'& [part="hint"]':{$description:"Publishing rides every commit, so the connected body's only job is to say what is already happening. Dim, because it is a standing fact rather than something to act on.",margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="failure"]':{$description:'`failure` and not `error`: `jx-textfield` and `jx-select` each draw a `[part="error"]` of their own inside this same tree, and the kit is light DOM — a scoped rule on that name would restyle the token field\'s refusal line too.',margin:"0",color:"var(--danger)",lineHeight:"1.5"},'& [part="link"], & [part="install-link"]':{color:"var(--accent)",textDecoration:"underline"},"& code":{fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)"}},children:[{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{unsupported:{tagName:"p",attributes:{part:"note"},children:["This platform cannot reach the Cloudflare API. Publish by committing and pushing — your host builds ",{tagName:"code",textContent:"bunx jx build"}," and serves ",{tagName:"code",textContent:"dist/"},"."]},loading:{tagName:"p",attributes:{part:"note"},textContent:"Checking Cloudflare connection…"},lapsed:{tagName:"div",attributes:{part:"lapsed",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Your Cloudflare connection has expired, so publishing cannot reach your account. Reconnect to restore it — this site's Pages project and its settings are untouched."},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"reconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"${state.connectLabel}"}]}]},hosted:{tagName:"div",attributes:{part:"hosted",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Connect your Cloudflare account to publish this site."},{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"connect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"Connect Cloudflare"}]}]},stored:{tagName:"div",attributes:{part:"stored",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"A Cloudflare API token is stored on this machine, and Cloudflare did not accept it. It may have been revoked, or it may be missing the Account Settings Read and Pages Read/Write permissions."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"replace"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[]}]},children:[{tagName:"span",textContent:"Replace token"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},token:{tagName:"div",attributes:{part:"token-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Paste a Cloudflare API token (permissions: Account Settings Read, Pages Read/Write). It is stored on this machine and only sent to the same-origin proxy — Studio never renders it back."},{tagName:"jx-field",$props:{span:!0,label:"API token"},attributes:{part:"token-row","data-field":"token"},children:[{tagName:"jx-textfield",$description:"No `value` binding, and its absence is the contract: a secret may pass through a field the reader typed it into and may never be painted into one they did not. The draft lives in the adapter's closure until Verify reads it, so nothing here — not the attribute, not the accessibility tree, not a DOM dump — has ever held it.",$props:{type:"password",placeholder:"cf_..."},attributes:{part:"token"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setToken"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"verify"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/verify"},value:[]}]},children:[{tagName:"span",textContent:"Verify & Connect"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},form:{tagName:"div",attributes:{part:"connect-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},children:["Create a Cloudflare Pages project connected to this repository. Every commit then builds and publishes automatically (",{tagName:"code",textContent:"bunx jx build"},")."]},{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Account"},attributes:{part:"row","data-field":"account"},children:[{tagName:"jx-select",$props:{options:{$ref:"#/state/accountOptions"},value:{$ref:"#/state/accountId"}},attributes:{part:"account"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAccount"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Pages project name"},attributes:{part:"row","data-field":"projectName"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/projectName"}},attributes:{part:"project-name"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setProjectName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub owner"},attributes:{part:"row","data-field":"owner"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/owner"}},attributes:{part:"owner"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub repository"},attributes:{part:"row","data-field":"repo"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/repo"}},attributes:{part:"repo"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRepo"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Production branch"},attributes:{part:"row","data-field":"branch"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/branch"}},attributes:{part:"branch"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBranch"},value:[{$ref:"event#/target/value"}]}]}}]}]},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"submit"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/submit"},value:[]}]},children:[{tagName:"span",textContent:"${state.submitLabel}"}]}]},status:{tagName:"div",attributes:{part:"status",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"status-line"},children:["Connected to Pages project ",{tagName:"strong",attributes:{part:"project-name"},textContent:"${state.deployProject}"},{tagName:"span",attributes:{part:"site-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProductionUrl"},cases:{true:{tagName:"span",children:[" — ",{tagName:"a",attributes:{part:"link",href:"${state.productionUrl}",target:"_blank",rel:"noreferrer"},textContent:"${state.productionUrl}"}]}}}]},{tagName:"div",attributes:{part:"deployment-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDeployment"},cases:{true:{tagName:"p",attributes:{part:"deployment"},children:["Latest deployment: ",{tagName:"strong",attributes:{part:"deployment-state"},textContent:"${state.deploymentState}"}," (${state.deploymentEnvironment}) — ",{tagName:"a",attributes:{part:"link",href:"${state.deploymentUrl}",target:"_blank",rel:"noreferrer"},textContent:"preview"}]},false:{tagName:"p",attributes:{part:"deployment"},textContent:"No deployments yet — the first commit after connecting triggers one."}}},{tagName:"p",attributes:{part:"hint"},textContent:"Publishing happens automatically on every commit."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]},children:[{tagName:"span",textContent:"Refresh"}]},{tagName:"jx-button",$props:{variant:"negative",disabled:{$ref:"#/state/busy"}},attributes:{part:"disconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/disconnect"},value:[]}]},children:[{tagName:"span",textContent:"Disconnect"}]}]}]}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFailure"},cases:{true:{tagName:"p",attributes:{part:"failure"},children:["${state.failure}",{tagName:"span",attributes:{part:"pages-app-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/needsPagesApp"},cases:{true:{tagName:"span",children:[" — if the Cloudflare Pages GitHub App is not installed on the repository, ",{tagName:"a",attributes:{part:"install-link",href:"${state.pagesAppUrl}",target:"_blank",rel:"noreferrer"},textContent:"install it"}," and retry."]}}}]}}}]}]};E("publish",w);var D="https://github.com/apps/cloudflare-pages/installations/new";function R(e){if(!e.supported)return"unsupported";if(e.loading)return"loading";if(e.connected&&e.lapsed)return"lapsed";if(!e.connected){if(e.hosted)return"hosted";return e.tokenStored&&!e.replacing?"stored":"token"}return e.deploy?"status":"form"}function j(e){let{error:t}=e;return{accountId:e.form.accountId,accountOptions:e.accounts,body:R(e),branch:e.form.branch,busy:e.busy,connectLabel:e.busy?"Reconnecting…":"Reconnect Cloudflare",deploymentEnvironment:e.deployment?.environment??"",deploymentState:e.deployment?`${e.deployment.stage}: ${e.deployment.status}`:"",deploymentUrl:e.deployment?.url??"",deployProject:e.deploy?.projectName??"",failure:t,hasDeployment:e.deployment!==null,hasFailure:t!=="",hasProductionUrl:(e.deploy?.productionUrl??"")!=="",needsPagesApp:/github/i.test(t)&&/app|install|source|repo/i.test(t),owner:e.form.owner,pagesAppUrl:D,productionUrl:e.deploy?.productionUrl??"",projectName:e.form.projectName,repo:e.form.repo,submitLabel:e.busy?"Connecting…":"Create & Connect"}}function k(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let n="",m=!1,P=()=>{if(m)return;m=!0,e.onClosed()},C=()=>m,d=b({...j(e.view),closed:P,connect:()=>{e.onConnect()},disconnect:()=>{e.onDisconnect()},openAccounts:()=>{e.onOpenAccounts()},refresh:()=>{e.onRefresh()},replace:()=>{n="",e.onReplaceToken()},setAccount:(o)=>{d.accountId=o,e.onField("accountId",o)},setBranch:(o)=>{d.branch=o,e.onField("branch",o)},setOwner:(o)=>{d.owner=o,e.onField("owner",o)},setProjectName:(o)=>{d.projectName=o,e.onField("projectName",o)},setRepo:(o)=>{d.repo=o,e.onField("repo",o)},setToken:(o)=>{n=o},submit:()=>{e.onSubmit()},verify:()=>{let o=n;n="",e.onSaveToken(o)}}),y=null,A=I("publish",d,t).then(async(o)=>{y=o;let u=o.root;if(C())return o.dispose(),u;if(await an(u),C())return u;return(u.querySelector('dialog[part="dialog"]')??u).setAttribute(ze,yt("modal","publish")),Gt(u),u});return{close(){let o=y?.root;if(o instanceof HTMLElement)Ut(o);y?.dispose(),y=null,n="",t.remove(),P()},host:t,ready:A,update(o){Object.assign(d,j(o))}}}var f=null,i="loading",h=[],l=null,r="",c=!1,g=!1,a={accountId:"",branch:"main",owner:"",projectName:"",repo:""};function N(){return x?.projectConfig??null}function T(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-+|-+$/g,"").slice(0,58)||"site"}function O(){let e=p().projectRoot,t=/^([\w.-]+)\/([\w.-]+)(?:@.+)?$/.exec(e);return t?{owner:t[1],repo:t[2]}:{owner:"",repo:""}}function H(){let e=/^[\w.-]+\/[\w.-]+@[^:]+:(.+)$/.exec(p().projectRoot)?.[1]??"";return Ul(e)??""}function L(){let e=Ii();return e?{productionUrl:e.productionUrl??"",projectName:e.projectName}:null}function S(){let e=ec(),t=i==="loading"?null:i;return{accounts:h.map((n)=>({label:n.name,value:n.id})),busy:c,connected:t?.connected===!0,deploy:L(),deployment:l?{environment:l.environment,stage:l.stage,status:l.status,url:l.url}:null,error:r,form:{...a},hosted:e&&Q(p().cfConnect),lapsed:t?.connected===!0&&t.needsReconnect===!0,loading:i==="loading",replacing:g,supported:e,tokenStored:vb()!==""}}function s(){if(f){f.update(S());return}f=k({layer:dt("modal"),onClosed:B,onConnect:()=>{M()},onDisconnect:()=>{z()},onField:(e,t)=>{a={...a,[e]:t}},onOpenAccounts:_,onRefresh:()=>{v()},onReplaceToken:()=>{g=!0,r="",s()},onSaveToken:(e)=>{U(e)},onSubmit:()=>{V()},view:S()})}async function v(){i="loading",s();try{if(i=await p().cfConnection?.()??null,i?.connected&&!i.needsReconnect){h=await LO(),a={...a,accountId:i.accountId??h[0]?.id??""};let e=Ii();if(e)l=await Jb(e),Bd(l)}}catch(e){i=null,r=e instanceof Error?e.message:String(e)}s()}async function U(e){let t=e.trim();if(!t){r="Paste a token, or use Preferences › Accounts to forget the stored one.",s();return}QE(t),g=!1,r="",await v()}function _(){ae()?.run("app.preferences",{section:"accounts"})}async function M(){c=!0,r="",s();try{let e=await p().cfConnect?.()??null;if(e?.status==="timeout")r="The Cloudflare window didn't finish. Sign in there, then reconnect — nothing was changed.";else if(e?.status==="connected"&&!e.connection.accountId){let{openCfAccountPicker:t}=await (ce("v3qd2dhw"),import("./cf-account-picker-v3qd2dhw.js"));await t()}}catch(e){r=e instanceof Error?e.message:String(e)}c=!1,us(),await v()}async function V(){let e=N();if(!e)return;if(!a.projectName||!a.owner||!a.repo||!a.accountId){r="Account, project name, and the GitHub owner/repo are all required.",s();return}c=!0,r="",s();try{let t=H(),n={accountId:a.accountId,owner:a.owner,productionBranch:a.branch||"main",projectName:a.projectName,repo:a.repo};if(t)n.rootDir=t;let m=await RO(e,n);l=await Jb(m).catch(()=>null)}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}async function z(){let e=N();if(!e)return;c=!0,s();try{await Y$(e,null),l=null}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}function B(){let e=f;f=null,e?.close()}function XE(e){i={accountId:e.accountId??"demo-account",connected:!0},h=[],l=e.deployment,Bd(e.deployment),r="",c=!1,g=!1,s()}function AF(){let e=N(),{owner:t,repo:n}=O();i="loading",h=[],l=null,r="",c=!1,g=!1,a={accountId:"",branch:"main",owner:t,projectName:Ii()?.projectName??T(e?.name??""),repo:n},s(),v()}
2
+ export{Ul,XE,AF};
3
3
 
4
- //# debugId=C2B562B4CEC6B45A64756E2164756E21
5
- //# sourceMappingURL=studio-ber1dgte.js.map
4
+ //# debugId=C536537665B0874664756E2164756E21
5
+ //# sourceMappingURL=studio-t5hde1ws.js.map
@@ -0,0 +1,5 @@
1
+ import{M$,F$,j$}from"./studio-ed9bz68j.js";import{p,we}from"./studio-1b79rpcb.js";import{vb,eT,tT}from"./studio-qfq58c8n.js";import{OO,px,hl,$a,WO,us,tc,gx}from"./studio-g79s1dyg.js";import{ce}from"./studio-nhpg405j.js";var t="checking",i=null;function _w(){return we()&&Boolean(p().cfConnect)}async function yb(){if(!_w())return;i??=(async()=>{try{t=await p().cfConnection?.()??null}catch{t=null}i=null,gm()})(),await i}function XN(){if(_w()&&t==="checking"&&!i)yb()}function QN(){t="checking",i=null}async function d(){let n=await p().cfConnect?.();if(n?.status==="connected"&&!n.connection.accountId){let{openCfAccountPicker:e}=await (ce("v3qd2dhw"),import("./cf-account-picker-v3qd2dhw.js"));await e()}us(),await yb()}function s(){let n={id:"disconnect",label:"Disconnect",run:async()=>{await p().cfDisconnect?.(),us(),await yb()},variant:"negative"},e=(r)=>({id:r==="Connect"?"connect":"reconnect",label:r,run:d,variant:"accent"}),o={id:"cloudflare",label:"Cloudflare",revoke:()=>{}};if(t==="checking")return{...o,actions:[],connected:!1,detail:"Checking your connection…"};if(!t?.connected)return{...o,actions:[e("Connect")],connected:!1,detail:"Not connected. Connecting publishes this site and runs the assistant on Workers AI."};let c=()=>{n.run()};if(t.needsReconnect)return{...o,actions:[e("Reconnect"),n],connected:!0,detail:"Connection expired. Reconnect to keep publishing and the assistant working.",revoke:c};if(t.needsAccount||!t.accountId)return{...o,actions:[{id:"choose-account",label:"Choose account",run:async()=>{let{openCfAccountPicker:r}=await (ce("v3qd2dhw"),import("./cf-account-picker-v3qd2dhw.js"));if(await r())us(),await yb()},variant:"accent"},n],connected:!0,detail:"Connected, but no account is chosen yet — publishing and the assistant need one.",revoke:c};return{...o,actions:[n],connected:!0,detail:`Connected — ${t.accountName??t.accountId}.`,revoke:c}}function l(){let n=vb(),e=eT();return{connected:Boolean(n),detail:n?`Connected${e?` — account ${e}`:""}.`:"Not connected. Publishing will ask when it needs it.",id:"cloudflare",label:"Cloudflare",revoke:tT}}function u(n){let e={id:n.id,label:n.label,run:async()=>{await gx(n)}};if(n.primary)e.variant="accent";return e}function f(n){return{actions:(n.actions??[]).map((e)=>u(e)),connected:n.connected??!1,detail:n.detail,id:`platform:${n.id}`,label:n.label,revoke:()=>{}}}function ZE(){let n=M$(),e=tc(),o=hl();return[{id:"github",label:"GitHub",detail:n?F$()==="desktop"?"Signed in — the token is in this app's config folder, readable only by you.":"Signed in — a device-flow token is stored in this browser.":"Not signed in. Cloning and pushing will ask when they need it.",connected:Boolean(n),revoke:j$},{id:"ai",label:"AI provider",detail:px()?`${$a()==="anthropic"?"Anthropic key":"Key"} stored. Model ${e}${o?` via ${o}`:""}.`:"No key stored. The Assistant section is where one is entered.",connected:px(),revoke:WO},_w()?s():l(),...OO().map((c)=>f(c))]}function eD(n){let e=ZE().find((o)=>o.id===n);if(!e)return!1;return e.revoke(),gm(),!0}var a=new Set;function tD(n){return a.add(n),()=>{a.delete(n)}}function gm(){for(let n of a)n()}
2
+ export{_w,yb,XN,QN,ZE,eD,tD,gm};
3
+
4
+ //# debugId=DB190B3E9F8D608764756E2164756E21
5
+ //# sourceMappingURL=studio-vj9yv897.js.map
@@ -1,5 +1,5 @@
1
- import{xn,g,h,Si,Ft}from"./studio-s49y6m5b.js";import{ao,w}from"./studio-bk0anq3b.js";import{KR,p,ve}from"./studio-xh6rf05g.js";import{fn}from"./studio-ex1644g2.js";import{X}from"./studio-9c6cbq2c.js";import{la,Ot}from"./studio-z6s56dzz.js";import{Jt,Ut}from"./studio-m3jrjfhy.js";import{Vb}from"./studio-g65t6svn.js";import{u}from"./studio-1d8m5s38.js";import{hi,Fm,tc,yL,wL,iy}from"./studio-aaw7wxv8.js";import{sn,dt,Kr,Fn,cR}from"./studio-cv6gnjqd.js";import{Js,pO,al}from"./studio-thgexj3w.js";import{rC}from"./studio-pgze9p34.js";import{hO}from"./studio-dmgh2rrj.js";import{KP,x,YP,so}from"./studio-zn7ysyzb.js";import{ze,yt,E,I}from"./studio-1a7zshnv.js";import{b}from"./studio-9f5vcb4w.js";import{n,Q,S,m}from"./studio-erjccagy.js";import{ce}from"./studio-7qqb7hb8.js";var vt={children:[],tagName:"div"},xt=new Set(["bunfig.json","jsconfig.json","package-lock.json","package.json","tsconfig.json","wrangler.json"]);function jb(t){let e=t.slice(t.lastIndexOf("/")+1);if(xt.has(e)||e.endsWith(".schema.json"))return!1;return t.endsWith(".json")||Boolean(fn(t))}function B(t,e){if(t.startsWith("../")||t.includes("/../"))return`"${t}" is outside this project, so its comparison belongs to the project that owns it.`;if(e==="R")return"A renamed file's comparison needs both paths, and Studio does not model the old name yet.";if(Vb(t))return`"${t}" is an image or media file, and a comparison of one is not text.`;return null}function Pt(){return["git-diff"]}function St(t){let e=g.tabs.get(t);if(e)return Ft(t),e;return Si({capabilities:{modes:Pt()},document:structuredClone(vt),documentPath:t,id:t,sourceFormat:null})}async function V(t){if(!jb(t))return St(t);let e=await (ce("b2p9y0yz"),import("./files-b2p9y0yz.js"));return await e.openFileInTab(t,{canvasMode:"git-diff"}),[...g.tabs.values()].find((o)=>o.documentPath===t)??null}var P=[];function Ct(){return ve()&&Q(p().listProjects)}async function Q0(){if(!Ct()){P=[];return}try{P=await p().listProjects?.()??[]}catch{P=[]}}function lO(){return P}function W(t){P=t}var q=2,kt=1e4;class z extends Error{blockedBy;constructor(t,e){super(t.length===0?`Studio did not report ${q} consecutive quiet frames within ${e}ms`:`Studio was not idle after ${e}ms — blocked by ${t.join("; ")}`);this.name="NotIdleError",this.blockedBy=t}}function K(){return[{blockers:()=>{let t=YP();return t>0?[`render: ${t} renderer(s) mid-paint`]:[]},name:"render"},{blockers:yL,name:"canvas"},{blockers:()=>{let t=KR();if(t.length===0)return[];return[`platform: ${t.length} in-flight (${[...new Set(t)].join(", ")})`]},name:"platform"},{blockers:cR,name:"overlay"},{blockers:pO,name:"activity"},{blockers:hO,name:"grid"}]}function jt(t=K()){let e=[];for(let o of t)e.push(...o.blockers());return e}function Z(t={}){let{frames:e=q,now:o=()=>Date.now(),raf:r=(s)=>{requestAnimationFrame(()=>s())},sources:i=K(),timeoutMs:a=kt}=t;return new Promise((s,d)=>{let c=o()+a,l=0,f=!1,J=[],H=()=>{if(f)return;let k=jt(i);if(k.length>0)J=k,l=0;else if(l+=1,l>=e){f=!0,s();return}if(o()>=c){f=!0,d(new z(k.length>0?k:J,a));return}r(H)};r(H)})}var Y=/\.toggle[A-Z]/;function Rt(t){return t.replace(/\.toggle([A-Z])/,(e,o)=>`.set${o}`)}function tt(t){return!Y.test(t.id)}var At={"file.contextMenu":{disposition:"refused",note:"opening a menu to press an item names a control; the ITEM is the command"},"layers.contextMenu":{disposition:"refused",note:"matched RENDERED TEXT, which R1 of scripts/screenshots/README.md forbids; a row is addressed by its data-jx-path"},"project.showWelcome":{disposition:"refused",note:"cold start is a startup profile (?profile=fresh), not an action"},"settings.setSection":{disposition:"refused",note:`mirrored the section registry's LABELS; say settings.open { section: "contexts" }`},"view.setStatus":{disposition:"refused",note:"the status bar is not staged — if a capture needs a calm shell, the app must BE calm"}},$t=new Map(Object.entries(At)),Dt={openSettings:'a user opens Settings — run("settings.open")',select:'a user selects a node — run("selection.set", { path })',setActivity:'a user picks a Navigator panel — run("navigator.showPanel", { panel })',setRightTab:'a user picks an Inspector tab — run("inspector.setTab", { tab })',setStatus:"the status bar reports what the app just did; staging it is the one lie the Remote Rule (studio.md §13.5) names outright",setZoom:'a user zooms — run("canvas.setZoom", { zoom })'},Et=new Map(Object.entries(Dt));function U(t,e){let o=t[e];if(o===void 0)return[];if(!Array.isArray(o))throw TypeError(`seed argument "${e}" must be an array`);return o}function Tt(t,e){let o=t[e];if(!S(o))throw TypeError(`seed argument "${e}" must be an object`);return o}function Gt(t,e){let o=t[e];if(o===void 0)return;if(!n(o))throw TypeError(`seed argument "${e}" must be a string`);return o}function It(t){return[{boundary:"the assistant's model stream",id:"seed.assistant",run:(e)=>{t.seedAssistantMessages(U(e,"messages"))}},{boundary:"the collaboration websocket (awareness + sync)",id:"seed.collab",run:(e)=>{let o=h.value;if(!o)return;let r=xn(o);r.status="synced",r.active=!0;let i=[];for(let a of U(e,"peers")){let s={...a.state};s.focusedPath??=o.documentPath,i.push({...a,state:s})}r.peers=i,so()}},{boundary:"the Cloudflare Pages API",id:"seed.publish",run:(e)=>{let o=Gt(e,"accountId"),r={deployment:Tt(e,"deployment")};if(o)r.accountId=o;t.seedPublishConnected(r)}},{boundary:"the platform's git routes (`gitStatus` / `gitBranches` / `gitLog`)",id:"seed.git",run:(e)=>{let{status:o,branches:r,log:i}=e;u.git.status=o??null,u.git.branches=r??null,u.git.logEntries=i??null,u.git.loading=!1,u.git.error=null,so()}},{boundary:"the platform's recent-projects store (desktop IPC / cloud API)",id:"seed.projectList",run:(e)=>{W(U(e,"projects")),so()}}]}class L extends Error{id;constructor(t,e){super(`automation refuses "${t}" — ${e}`);this.name="AutomationRefusedError",this.id=t}}function Lt(t){let e=[];for(let o of t.visible()){if(!tt(o))continue;let r=t.disabledReason(o.id),i={enabled:r===void 0,id:o.id,title:o.title};if(o.args)i.args=o.args;if(r!==void 0)i.requires=r;e.push(i)}return e}function Mt(t,e,o){if(o.has(t))return`"${t}" is a seed, not a command — call seed("${t}", …)`;let r=$t.get(t);if(r)return`"${t}" is refused by spec §13.5: ${r.note}`;let i=e.list().filter((a)=>tt(a)).map((a)=>a.id);return`unknown command "${t}" — the registry declares ${i.length} scriptable id(s)`}function Nt(t){let e=new Map(It(t).map((r)=>[r.id,r])),o=new Set(e.keys());return{probe:{commands:()=>Lt(t.registry),idle:(r={})=>Z(r),pointAt:(r)=>wL(r.path),revealPath:(r)=>iy(r),seeds:()=>[...e.values()].map((r)=>({boundary:r.boundary,id:r.id})),state:()=>t.registry.context()},async run(r,i={}){if(Y.test(r))throw new L(r,`it names a delta against state the caller cannot observe; call "${Rt(r)}"`);let{registry:a}=t;if(!a.get(r))throw Error(Mt(r,a,o));await a.run(r,i)},async seed(r,i={}){let a=r.startsWith("seed.")?r.slice(5):r,s=Et.get(a);if(s)throw new L(r,`a seed stands in for a remote, never for a user: ${s}`);let d=e.get(r.startsWith("seed.")?r:`seed.${r}`);if(!d)throw Error(`unknown seed "${r}" — declared seeds are ${[...e.keys()].join(", ")}`);await d.run(i)}}}function tx(t){return new URLSearchParams(t).get("automation")==="1"}function cO(t){if(!tx(location.search))return!1;return globalThis.__jxAutomation=Nt(t),!0}var et={$schema:"https://jxsuite.com/schema/v1",$id:"StudioJxsuiteUpdate",$description:"The on-open offer to bring a project's `@jxsuite/*` dependencies up to their newest published versions: one sentence, and the packages that would move. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answers. Nothing here asks the registry or writes a manifest: `packages/jxsuite-update.ts` keeps the lookup, the dismissal key and the install, and this document only says what is on offer.",tagName:"jx-dialog",$props:{headline:"Update @jxsuite packages?",confirmLabel:"Update",cancelLabel:"Not now",size:"sm"},attributes:{part:"jxsuite-update"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'The old body was a lit template with no stylesheet at all, which is why the conversion is mostly a deletion. Two `<br />`s stood in for a paragraph break, and one `<span style="white-space: pre-line">` held every package as a single `\\n`-joined string — a list spelled as whitespace. Neither is addressable and neither announces as what it is, so a screen reader read one run-on line and a test could only match a substring of it. It is a `<ul>` of keyed rows now: the list says how many packages there are, and each row is `[data-package]`. The one token repair travels with it — that span asked for `--spectrum-font-size-75`, which resolves only inside `<sp-theme>`, and a document mounted in the dialog layer is outside it, so the size silently fell back to the hard-coded `12px` written beside it.','& [part="offer"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="lede"]':{margin:"0"},'& [part="list"]':{$description:"Capped and scrolling, because the count is the registry's rather than this dialog's: a project that has not been opened in a year can have every `@jxsuite/*` package behind at once, and a dialog that grows past the viewport puts its own Update button off screen.",listStyle:"none",margin:"0",padding:"0",display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",maxHeight:"240px",overflowY:"auto"},'& [part="package"]':{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:"var(--jx-space-3)",fontSize:"var(--jx-text-sm)"},'& [part="package-name"]':{color:"var(--fg)"},'& [part="package-move"]':{$description:"Tabular figures, so a column of versions does not jitter between rows of different widths.",color:"var(--fg-dim)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"}},children:[{tagName:"div",attributes:{part:"offer"},children:[{tagName:"p",attributes:{part:"lede"},textContent:"Newer versions of these packages have been published. Update the project to them?"},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/packages"},key:{$ref:"$map/item/name"},map:{tagName:"li",attributes:{part:"package","data-package":"${$map.item.name}"},children:[{tagName:"span",attributes:{part:"package-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"package-move"},textContent:"${$map.item.current} → ${$map.item.target}"}]}}]}]}]};E("jxsuite-update",et);function ot(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(ze,yt("dialog","jxsuite-update")),t.layer.append(e);let o=!1,r=()=>{if(o)return;o=!0,t.onClosed()},i=()=>o,a=b({cancel:()=>{t.onCancel()},closed:r,confirm:()=>{t.onConfirm()},packages:t.packages}),s=null,d=I("jxsuite-update",a,e).then(async(c)=>{s=c;let l=c.root;if(i())return c.dispose(),l;if(await sn(l),i())return l;return Jt(l),l});return{close(){let c=s?.root;if(c instanceof HTMLElement)Ut(c);s?.dispose(),s=null,e.remove(),r()},host:e,ready:d}}function nx(t){return t.replace(/^[\^~>=<v\s]+/,"").trim().split(/\s+/)[0]??""}function rt(t){if(t.includes(":"))return!1;return/^\d+\.\d+/.test(nx(t))}function nt(t){let e=nx(t).split(/[-+]/)[0]??"",[o=0,r=0,i=0]=e.split(".").map((a)=>Math.trunc(Number(a))||0);return[o,r,i]}function Ht(t,e){let o=nt(t),r=nt(e);for(let i=0;i<3;i++){let a=o[i]??0,s=r[i]??0;if(a!==s)return a<s?-1:1}return 0}function eC(t,e){if(!rt(t)||!rt(e))return!1;return Ht(e,t)>0}var M="@jxsuite/";async function N(){let t=p();if(!t.packageVersions)return[];let e;try{e=await t.packageVersions()}catch{return[]}let o=[];for(let r of e)if(r.name.startsWith(M)&&eC(r.current,r.latest))o.push({current:r.current,dev:Boolean(r.dev),latest:r.latest,name:r.name});return o}function it(t,e){let o=e.map((r)=>`${r.name}@${r.latest}`).toSorted().join(",");return`jx:jxsuite-update-dismissed:${t}:${o}`}function Bt(t,e){try{return localStorage.getItem(it(t,e))==="1"}catch{return!1}}function Vt(t,e){try{localStorage.setItem(it(t,e),"1")}catch{}}async function O(t){let e=p();if(!e.setPackageVersions||t.length===0)return;let o=al({status:"Updating @jxsuite packages…",title:"Updating dependencies"});try{let r=await e.setPackageVersions(t.map((i)=>({dev:i.dev,name:i.name,version:`^${i.latest}`})));if(r.ok)o.done(),w.success(`Updated ${t.length} @jxsuite package(s) to their latest versions.`);else o.fail(r.log??"Update failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}}function Wt(t){return new Promise((e)=>{let o=!1,r=(d)=>{if(o)return;o=!0,e(d)},i=!1,a=()=>{if(i)return;i=!0,s.close()},s=ot({layer:dt("dialog"),onCancel:()=>{a()},onClosed:()=>{r(!1),a()},onConfirm:()=>{r(!0),a()},packages:t.map((d)=>({current:d.current,name:d.name,target:`^${d.latest}`}))})})}async function Dm(t){if(tx(location.search))return;if(!p().setPackageVersions)return;let o=await N();if(o.length===0||Bt(t,o))return;if(!await Wt(o)){Vt(t,o);return}await O(o)}var j=["package.json","bun.lock","bun.lockb"],qt=new Set(["??","U"]),zt=25;function R(t){if(Array.isArray(t))return t.map((e)=>R(e));if(m(t)){let e={};for(let[o,r]of Object.entries(t).toSorted(([i],[a])=>i<a?-1:1))e[o]=R(r);return e}return t}function at(t){let e={...t};for(let o of["dependencies","devDependencies"]){let r=e[o];if(!m(r))continue;let i={...r};for(let a of Object.keys(i))if(a.startsWith(M))i[a]="*";e[o]=i}return e}function Xt(t,e){if(t===null||e===null)return!1;let o,r;try{o=JSON.parse(t),r=JSON.parse(e)}catch{return!1}if(!m(o)||!m(r))return!1;return JSON.stringify(R(at(o)))===JSON.stringify(R(at(r)))}async function A(t,e){try{return await p().gitShow({path:t,ref:e})}catch{return null}}async function ct(t){try{return await p().readFile(t)}catch{return null}}async function lt(t){let e=[],o=[],r=!0;for(let i of j){let a=t.files.filter((c)=>c.path===i);if(a.length===0)continue;let s=await A(i,"@{u}");if(a.every((c)=>qt.has(c.status))){if(s!==null)o.push(i);continue}let d=await A(i,"HEAD");if(s===null||s===d)continue;if(e.push(i),i==="package.json")r&&=Xt(d,await ct(i))}return{automated:r,discard:e,removeUntracked:o}}function ut(t){return t.discard.length===0&&t.removeUntracked.length===0}async function Kt(t){let e=[...new Set(t.files.filter((o)=>!j.includes(o.path)).map((o)=>o.path))];if(e.length>zt)return!0;for(let o of e){let r=await A(o,"@{u}");if(r!==null&&r!==await A(o,"HEAD"))return!0}return!1}async function Zt(t){let e=p();if(t.discard.length>0)await e.gitUnstage(t.discard),await e.gitDiscard(t.discard);for(let o of t.removeUntracked)await e.deleteFile(o)}async function F(){let t=p(),e=[];try{e=await N()}catch{e=[]}if(e.length>0&&t.setPackageVersions){await O(e);return}if(!t.installDependencies)return;let o=al({status:"Installing dependencies…",title:"Syncing dependencies"});try{let r=await t.installDependencies();if(r.ok)o.done();else o.fail(r.log??"Install failed")}catch(r){o.fail(X(r))}}async function pt(t){let e=p();try{await Zt(t)}catch(o){throw Error(`Could not reset local package files: ${X(o)}`,{cause:o})}try{await e.gitPull()}catch(o){throw await F(),o}w.warn("Local package updates were superseded by pulled changes.",{source:"Source Control"}),await F()}async function Qt(t){let e=p(),o;try{o=await e.gitStatus()}catch{throw t}if(!(o.behind>0))throw t;let r=await lt(o);if(ut(r)||await Kt(o))throw t;if(!r.automated){if(!await Kr("Discard local package changes?","package.json / bun.lock have local edits that conflict with incoming changes. Discard them, pull, and re-sync packages?",{confirmLabel:"Discard and pull",destructive:!0}))throw t}await pt(r)}async function st(){let t;try{let e=await p().listDirectory("");t=new Set(e.filter((o)=>o.type==="file").map((o)=>o.name))}catch{t=new Set(j)}return Promise.all(j.map((e)=>t.has(e)?ct(e):Promise.resolve(null)))}async function _(){let t=p(),e=await st(),o=null;try{await t.gitFetch(),o=await t.gitStatus()}catch{o=null}if(o&&o.behind>0){let i=await lt(o);if(!ut(i)&&i.automated){await pt(i);return}}try{await t.gitPull()}catch(i){await Qt(i);return}let r=await st();if(e.some((i,a)=>i!==r[a]))await F()}async function Om(){let t=p();try{let e=await t.gitStatus();if(!e.isRepo||!Array.isArray(e.remotes)||e.remotes.length===0)return}catch{return}w.info("Syncing project…",{key:"project.sync",source:"Source Control"});try{await _()}catch(e){w.warn("The project could not be synced with its remote.",{detail:X(e),key:"project.sync",source:"Source Control",tier:"problem"})}}var mt={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGithubPublish",$description:"Create GitHub Repository: the three things the flow needs before it calls the API — the repository's name, an optional description, and whether it is private. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answer buttons. Nothing here reaches GitHub: `github/github-publish.ts` keeps the token, the request and the activity, and this document only collects.",tagName:"jx-dialog",$props:{headline:"Create GitHub Repository",confirmLabel:"Create Repository",cancelLabel:"Cancel",size:"sm"},attributes:{part:"github-publish"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'What is NOT here is most of the conversion. `.github-publish-dialog` was a flex column with an 8px gap and `8px 0` of padding: the gap is the one thing it said that nothing else draws, and `jx-dialog`\'s own body already pads the content, so only the gap survives. `.github-publish-dialog sp-textfield { width: 100% }` had nothing to transcribe either — a `jx-field` row is a grid whose control cell stretches, so the field fills the row without being told to. The three `sp-field-label`s are gone with them, because `jx-field` draws the label AND names the control from it; the third of them carried no `for` at all, so "Visibility" was text beside a switch rather than a name for it.','& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"}},children:[{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Repository name"},attributes:{part:"row","data-field":"name"},children:[{tagName:"jx-textfield",$props:{placeholder:"my-project",value:{$ref:"#/state/name"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Description (optional)"},attributes:{part:"row","data-field":"description"},children:[{tagName:"jx-textfield",$props:{placeholder:"A brief description",value:{$ref:"#/state/description"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDescription"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Visibility"},attributes:{part:"row","data-field":"visibility"},children:[{tagName:"div",$description:'The row opens with a plain `div`, and that is the whole reason it exists: `jx-field` names the first thing slotted into it that observes `labelledby`, so a switch slotted straight in would be announced "Visibility" over the top of the words printed beside it. A `div` observes no naming, so the switch keeps the name its own label gives it.',attributes:{part:"visibility-row"},children:[{tagName:"jx-switch",attributes:{part:"toggle"},$props:{checked:{$ref:"#/state/isPrivate"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setPrivate"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Private repository"}]}]}]}]}]};E("github-publish",mt);function ft(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(ze,yt("dialog","github-publish")),t.layer.append(e);let o=!1,r=()=>{if(o)return;o=!0,t.onClosed()},i=()=>o,a=b({cancel:()=>{t.onCancel()},closed:r,confirm:()=>{t.onConfirm({description:a.description,isPrivate:a.isPrivate,name:a.name})},description:"",isPrivate:!0,name:t.name,setDescription:(l)=>{a.description=l},setName:(l)=>{a.name=l},setPrivate:(l)=>{a.isPrivate=l}}),s=null,d=I("github-publish",a,e).then(async(l)=>{s=l;let f=l.root;if(i())return l.dispose(),f;if(await sn(f),i())return f;return Jt(f),f});return{close(){if(o)return;let l=s?.root;if(l instanceof HTMLElement)Ut(l);s?.dispose(),s=null,e.remove(),r()},host:e,ready:d}}var D=["Create the repository","Add the remote","Push"];function te(t){return new Promise((e)=>{let o=!1,r=(a)=>{if(o)return;o=!0,e(a)},i=ft({layer:dt("dialog"),name:t,onCancel:()=>{i.close()},onClosed:()=>{r(null)},onConfirm:(a)=>{r({...a,name:a.name||t}),i.close()}})})}async function gt({projectName:t}){let e=await rC();if(!e)return!1;let o=await te(t);if(!o)return!1;let r=Js({source:"Source Control",status:`Creating ${o.name}…`,steps:[...D],title:"Create GitHub repository"});r.step(D[0]);let i;try{i=await fetch("https://api.github.com/user/repos",{body:JSON.stringify({auto_init:!1,description:o.description,name:o.name,private:o.isPrivate}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${e}`,"Content-Type":"application/json"},method:"POST"})}catch(c){return r.log(X(c)),r.fail("Could not reach GitHub to create the repository.",{action:"git.createGithubRepository"}),!1}if(!i.ok){let c=await i.json();return r.log(c.errors?.[0]?.message||c.message||`GitHub answered ${i.status}.`),r.fail("Could not create the GitHub repository.",{action:"git.createGithubRepository"}),!1}let a=await i.json();r.log(`Created ${a.html_url}`);let s=p();r.step(D[1]);try{await s.gitAddRemote("origin",a.clone_url)}catch(c){return r.log(X(c)),r.fail("The repository was created, but the remote could not be added.",{action:"view.setWorkspace",actionArgs:{workspace:"publish"}}),!1}r.step(D[2]);try{await s.gitPush({setUpstream:!0})}catch(c){return r.log(X(c)),r.fail("The repository was created, but the push failed.",{action:"git.push"}),!1}let{refreshGitStatus:d}=await (ce("k4p00hpe"),import("./source-control-k4p00hpe.js"));return await d(),r.done(a.html_url),w.success(`Repository created: ${a.html_url}`,{key:"github.repo"}),!0}async function ee(){let t=p(),{git:e}=u,o;try{o=await t.gitStatus()}catch(r){e.error=X(r);return}if(e.status=o,!o.isRepo){e.branches=null;return}try{e.branches=await t.gitBranches()}catch(r){e.error=X(r)}}async function Es(){if(!x)return;let{git:t}=u;t.loading=!0,t.error=null;try{if(await ee(),t.lastUpdated=ao(),t.rev+=1,await oe(),t.logEntries!==null)await tC()}catch(e){t.error=X(e)}finally{t.loading=!1}}async function oe(){let t=u.git.diffState;if(!t)return;let e=u.git.status?.files.find((o)=>o.path===t.filePath);if(!e||!ht(e.status)){u.git.diffState=null;return}try{u.git.diffState=await G(t.filePath,e.status)}catch{}}async function l$(t){if(u.git.rev+=1,!u.git.loading)Es();let e=u.git.diffState;if(!t||e?.filePath!==t)return;try{u.git.diffState=await G(t,e.fileStatus)}catch{}}async function tC(){try{u.git.logEntries=await p().gitLog(30)}catch(t){u.git.error=X(t)}}async function nC(t){let e=p();if(!e.gitClone){w.warn("Cloning is not supported on this platform.",{source:"Source Control"});return}let o=await Fn("Clone Git Repository",{confirmLabel:"Clone",message:"Repository URL",placeholder:"https://github.com/user/repo.git",validate:(r)=>r.trim()?"":"Enter a repository URL."});if(!o)return;try{w.info("Cloning repository…",{key:"git.clone",source:"Source Control"});let r=await e.gitClone(o);if(r.root)w.success("Clone complete.",{key:"git.clone"}),await t.openRecentProject(r.root)}catch(r){w.error("Could not clone the repository.",{detail:X(r),key:"git.clone",source:"Source Control"})}}function Hb(){return ve()&&Boolean(p().gitClone)}function Gs(){return ve()&&p().gitHosted===!0}function c$(){return ve()&&Q(p().createPullRequest)}var re=new Map([["A","added"],["D","deleted"],["M","modified"],["R","renamed"],["U","untracked"]]);function ne(t){return re.get(t)??"changed"}var ie=new Map([["A","NEW"],["D","DELETED"],["M","EDIT"],["R","RENAMED"],["U","NEW"]]);function d$(t){return ie.get(t)??"EDIT"}var ae=new Set(["M","A","U","D"]);function ht(t){return ae.has(t)}async function G(t,e){let o=p(),r=e!=="A"&&e!=="U",i=e!=="D",[a,s]=await Promise.all([r?o.gitShow({path:t,ref:"HEAD"}):Promise.resolve(""),i?o.readFile(t):Promise.resolve("")]);return{currentContent:s,filePath:t,fileStatus:e,originalContent:a}}async function u$(t,e){try{return await G(t,e)}catch(o){return console.warn("loadDiffForLens:",X(o)),null}}var T={};function h$(t){T=t}function p$(){T.cloneRepository?.()}function bt(t){return u.git.status?.files.find((e)=>e.path===t)}async function f$(t){let e=bt(t);if(!e)return;let o=ht(e.status)?B(e.path,e.status):`"${e.path}" has no change this view can open.`;if(o){u.git.error=o;return}try{u.git.loading=!0;let r=await G(e.path,e.status);u.git.diffState=r,T.setGitDiffState?.(r);let i=await V(e.path);if(i)T.setCanvasMode?.(i,"git-diff")}catch(r){u.git.error=`Failed to load diff: ${X(r)}`}finally{u.git.loading=!1}}async function y(t){let e=p();u.git.loading=!0,u.git.error=null;try{return await t(e),await Es(),!0}catch(o){return u.git.error=X(o),u.git.loading=!1,!1}}async function se(){try{w.info("Initializing repository…",{key:"git.init"}),await p().gitInit(),w.success("Repository initialized.",{key:"git.init"})}catch(t){w.error("Could not initialize the repository.",{action:"git.init",detail:X(t),key:"git.init",source:"Source Control"});return}await Es()}async function le(){await y((t)=>t.gitPush())}async function m$(){await y((t)=>t.gitFetch())}async function g$(){u.git.loading=!0,u.git.error=null;try{await _(),await Es()}catch(t){u.git.error=X(t),u.git.loading=!1}}async function ue(){await gt({projectName:x?.name||"my-project"})}async function pe(){if(await rC())w.success("Signed in to GitHub.",{key:"github.auth"})}async function b$(t,e){await y((o)=>e?o.gitStage([t]):o.gitUnstage([t]))}async function y$(t){let e=(u.git.status?.files??[]).filter((o)=>Boolean(o.staged)!==t).map((o)=>o.path);if(e.length===0)return;await y((o)=>t?o.gitStage(e):o.gitUnstage(e))}var v={paths:new Set,root:""};function de(){let t=x?.projectRoot??"";if(v.root!==t)v={paths:new Set,root:t};let e=u.git.status?.files??[],o=new Set(e.map((i)=>i.path));for(let i of v.paths)if(!o.has(i))v.paths.delete(i);let r=e.filter((i)=>!v.paths.has(i.path));for(let i of r)v.paths.add(i.path);return r.filter((i)=>!i.staged).map((i)=>i.path)}async function v$(){if(u.git.loading||!u.git.status?.isRepo)return;let t=de();if(t.length>0)await y((e)=>e.gitStage(t))}async function w$(t){if(bt(t)?.status==="U")return;if(!await Kr("Discard Changes",`Discard changes to ${t}?`,{confirmLabel:"Discard",destructive:!0}))return;await y((o)=>o.gitDiscard([t]))}async function x$(){let{branches:t,status:e}=u.git,o=await Fn("New Branch",{confirmLabel:"Create",message:`Branching from ${t?.current||e?.branch||"the current branch"}.`,placeholder:"feature/my-change",validate:(r)=>r.trim()?"":"Enter a branch name."});if(o)await y((r)=>r.gitCreateBranch(o.trim()))}async function _$(t){if(t===u.git.branches?.current)return;if(Gs()){if(!await Kr("Switch Branch",`Each branch opens in its own session, so switching to ${t} reloads Studio on that branch.`,{confirmLabel:"Switch and reload"}))return}await y((e)=>e.gitCheckout(t))}function iC(t){let e=t.path.split("/"),o=e.pop()??t.path,r=e.join("/"),i=ne(t.status);return{cannotDiscard:t.status==="U",dir:r,hasDir:r!=="",included:Boolean(t.staged),key:t.path,label:`${t.path}, ${i}`,name:o,path:t.path,status:t.status,statusWord:i}}var wt=[["components","Components"],["layouts","Layouts"],["styles","Styles"]];function me(t){let e=tc(t);if(e!==null)return e;let[o]=t.split("/");if(o==="pages")return hi;if(wt.some(([r])=>r===o))return`folder:${o}`;return la.has(Ot(t))?"media":"other"}function S$(t){let e=[...Fm().map((r)=>[r.key,r.title]),...wt.map(([r,i])=>[`folder:${r}`,i]),["media","Media"],["other","Other"]],o=new Map;for(let r of t){let i=me(r.path);o.set(i,[...o.get(i)??[],r])}return e.flatMap(([r,i])=>{let a=o.get(r);return a?[{files:a.map((s)=>iC(s)),key:r,name:i}]:[]})}function C$(t){return{hash:t.hash.slice(0,7),key:t.hash,message:t.message,meta:`${t.author} · ${ix(t.date)}`}}function ix(t){let e=new Date(t),o=ao()-e.getTime(),r=Math.floor(o/60000);if(r<1)return"just now";if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);if(a<30)return`${a}d ago`;return e.toLocaleDateString()}function k$(t){return t?`Last updated ${new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:""}var C=null;function E$(){if(C)return;C=setInterval(()=>{if(u.workspace==="publish"&&!u.git.loading)Es()},KP)}function Bb(){if(C)clearInterval(C),C=null;v={paths:new Set,root:""}}function fe(){return[{category:"Source Control",id:"git.init",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"an open project that git is not already tracking",when:(t)=>t.project.open,enablement:(t)=>!t.project.isRepo,run:async()=>{await se()},title:"Initialize Repository"},{category:"Source Control",id:"git.createGithubRepository",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"a project tracked by git",when:(t)=>t.project.open,enablement:(t)=>t.project.isRepo,run:async()=>{await ue()},title:"Create GitHub Repository"},{category:"Source Control",id:"git.push",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"a project tracked by git",when:(t)=>t.project.open,enablement:(t)=>t.project.isRepo,run:async()=>{await le()},title:"Push"},{category:"Source Control",id:"git.signInToGithub",level:"application",menus:["palette"],group:"7_scm",run:async()=>{await pe()},title:"Sign In to GitHub"}]}function T$(t){t.registerAll(fe())}
2
- export{Q0,lO,tx,cO,nx,eC,Dm,Om,jb,Es,l$,tC,nC,Hb,Gs,c$,d$,u$,h$,p$,f$,m$,g$,b$,y$,v$,w$,x$,_$,iC,S$,C$,ix,k$,E$,Bb,T$};
1
+ import{xn,g,h,Si,Ft}from"./studio-ybkd5w8k.js";import{lo,w}from"./studio-5k9mfafh.js";import{nI,p,we}from"./studio-1b79rpcb.js";import{Z}from"./studio-mkjrjpr2.js";import{fn}from"./studio-hf259xzd.js";import{ca,Ot}from"./studio-6tnpg0vx.js";import{Gt,Ut}from"./studio-s6ymkf3q.js";import{qb}from"./studio-4gthb2fd.js";import{u}from"./studio-3kmqhwtt.js";import{pi,Vm,ic,TL,LL,ay}from"./studio-m25ry0mf.js";import{an,dt,Kr,Fn,yR}from"./studio-yetr4gg1.js";import{Ys,CO,cl}from"./studio-56mmnsw8.js";import{hC}from"./studio-ed9bz68j.js";import{SO}from"./studio-pzbr7g05.js";import{sM,x,cM,ao}from"./studio-anc8067x.js";import{ze,yt,E,I}from"./studio-xxttcym1.js";import{b}from"./studio-y3tjh2xb.js";import{n,Q,S,f}from"./studio-0z8kp4xk.js";import{ce}from"./studio-nhpg405j.js";var vt={children:[],tagName:"div"},xt=new Set(["bunfig.json","jsconfig.json","package-lock.json","package.json","tsconfig.json","wrangler.json"]);function Wb(t){let e=t.slice(t.lastIndexOf("/")+1);if(xt.has(e)||e.endsWith(".schema.json"))return!1;return t.endsWith(".json")||Boolean(fn(t))}function B(t,e){if(t.startsWith("../")||t.includes("/../"))return`"${t}" is outside this project, so its comparison belongs to the project that owns it.`;if(e==="R")return"A renamed file's comparison needs both paths, and Studio does not model the old name yet.";if(qb(t))return`"${t}" is an image or media file, and a comparison of one is not text.`;return null}function Pt(){return["git-diff"]}function St(t){let e=g.tabs.get(t);if(e)return Ft(t),e;return Si({capabilities:{modes:Pt()},document:structuredClone(vt),documentPath:t,id:t,sourceFormat:null})}async function V(t){if(!Wb(t))return St(t);let e=await (ce("8pf70854"),import("./files-8pf70854.js"));return await e.openFileInTab(t,{canvasMode:"git-diff"}),[...g.tabs.values()].find((o)=>o.documentPath===t)??null}var P=[];function Ct(){return we()&&Q(p().listProjects)}async function aC(){if(!Ct()){P=[];return}try{P=await p().listProjects?.()??[]}catch{P=[]}}function vO(){return P}function W(t){P=t}var q=2,kt=1e4;class z extends Error{blockedBy;constructor(t,e){super(t.length===0?`Studio did not report ${q} consecutive quiet frames within ${e}ms`:`Studio was not idle after ${e}ms — blocked by ${t.join("; ")}`);this.name="NotIdleError",this.blockedBy=t}}function X(){return[{blockers:()=>{let t=cM();return t>0?[`render: ${t} renderer(s) mid-paint`]:[]},name:"render"},{blockers:TL,name:"canvas"},{blockers:()=>{let t=nI();if(t.length===0)return[];return[`platform: ${t.length} in-flight (${[...new Set(t)].join(", ")})`]},name:"platform"},{blockers:yR,name:"overlay"},{blockers:CO,name:"activity"},{blockers:SO,name:"grid"}]}function jt(t=X()){let e=[];for(let o of t)e.push(...o.blockers());return e}function K(t={}){let{frames:e=q,now:o=()=>Date.now(),raf:r=(s)=>{requestAnimationFrame(()=>s())},sources:i=X(),timeoutMs:a=kt}=t;return new Promise((s,d)=>{let c=o()+a,l=0,m=!1,J=[],H=()=>{if(m)return;let k=jt(i);if(k.length>0)J=k,l=0;else if(l+=1,l>=e){m=!0,s();return}if(o()>=c){m=!0,d(new z(k.length>0?k:J,a));return}r(H)};r(H)})}var Y=/\.toggle[A-Z]/;function Rt(t){return t.replace(/\.toggle([A-Z])/,(e,o)=>`.set${o}`)}function tt(t){return!Y.test(t.id)}var At={"file.contextMenu":{disposition:"refused",note:"opening a menu to press an item names a control; the ITEM is the command"},"layers.contextMenu":{disposition:"refused",note:"matched RENDERED TEXT, which R1 of scripts/screenshots/README.md forbids; a row is addressed by its data-jx-path"},"project.showWelcome":{disposition:"refused",note:"cold start is a startup profile (?profile=fresh), not an action"},"settings.setSection":{disposition:"refused",note:`mirrored the section registry's LABELS; say settings.open { section: "contexts" }`},"view.setStatus":{disposition:"refused",note:"the status bar is not staged — if a capture needs a calm shell, the app must BE calm"}},$t=new Map(Object.entries(At)),Dt={openSettings:'a user opens Settings — run("settings.open")',select:'a user selects a node — run("selection.set", { path })',setActivity:'a user picks a Navigator panel — run("navigator.showPanel", { panel })',setRightTab:'a user picks an Inspector tab — run("inspector.setTab", { tab })',setStatus:"the status bar reports what the app just did; staging it is the one lie the Remote Rule (studio.md §13.5) names outright",setZoom:'a user zooms — run("canvas.setZoom", { zoom })'},Et=new Map(Object.entries(Dt));function U(t,e){let o=t[e];if(o===void 0)return[];if(!Array.isArray(o))throw TypeError(`seed argument "${e}" must be an array`);return o}function Tt(t,e){let o=t[e];if(!S(o))throw TypeError(`seed argument "${e}" must be an object`);return o}function It(t,e){let o=t[e];if(o===void 0)return;if(!n(o))throw TypeError(`seed argument "${e}" must be a string`);return o}function Lt(t){return[{boundary:"the assistant's model stream",id:"seed.assistant",run:(e)=>{t.seedAssistantMessages(U(e,"messages"))}},{boundary:"the collaboration websocket (awareness + sync)",id:"seed.collab",run:(e)=>{let o=h.value;if(!o)return;let r=xn(o);r.status="synced",r.active=!0;let i=[];for(let a of U(e,"peers")){let s={...a.state};s.focusedPath??=o.documentPath,i.push({...a,state:s})}r.peers=i,ao()}},{boundary:"the Cloudflare Pages API",id:"seed.publish",run:(e)=>{let o=It(e,"accountId"),r={deployment:Tt(e,"deployment")};if(o)r.accountId=o;t.seedPublishConnected(r)}},{boundary:"the platform's git routes (`gitStatus` / `gitBranches` / `gitLog`)",id:"seed.git",run:(e)=>{let{status:o,branches:r,log:i}=e;u.git.status=o??null,u.git.branches=r??null,u.git.logEntries=i??null,u.git.loading=!1,u.git.error=null,ao()}},{boundary:"the platform's recent-projects store (desktop IPC / cloud API)",id:"seed.projectList",run:(e)=>{W(U(e,"projects")),ao()}}]}class L extends Error{id;constructor(t,e){super(`automation refuses "${t}" — ${e}`);this.name="AutomationRefusedError",this.id=t}}function Mt(t){let e=[];for(let o of t.visible()){if(!tt(o))continue;let r=t.disabledReason(o.id),i={enabled:r===void 0,id:o.id,title:o.title};if(o.args)i.args=o.args;if(r!==void 0)i.requires=r;e.push(i)}return e}function Nt(t,e,o){if(o.has(t))return`"${t}" is a seed, not a command — call seed("${t}", …)`;let r=$t.get(t);if(r)return`"${t}" is refused by spec §13.5: ${r.note}`;let i=e.list().filter((a)=>tt(a)).map((a)=>a.id);return`unknown command "${t}" — the registry declares ${i.length} scriptable id(s)`}function _t(t){let e=new Map(Lt(t).map((r)=>[r.id,r])),o=new Set(e.keys());return{probe:{commands:()=>Mt(t.registry),idle:(r={})=>K(r),pointAt:(r)=>LL(r.path),revealPath:(r)=>ay(r),seeds:()=>[...e.values()].map((r)=>({boundary:r.boundary,id:r.id})),state:()=>t.registry.context()},async run(r,i={}){if(Y.test(r))throw new L(r,`it names a delta against state the caller cannot observe; call "${Rt(r)}"`);let{registry:a}=t;if(!a.get(r))throw Error(Nt(r,a,o));await a.run(r,i)},async seed(r,i={}){let a=r.startsWith("seed.")?r.slice(5):r,s=Et.get(a);if(s)throw new L(r,`a seed stands in for a remote, never for a user: ${s}`);let d=e.get(r.startsWith("seed.")?r:`seed.${r}`);if(!d)throw Error(`unknown seed "${r}" — declared seeds are ${[...e.keys()].join(", ")}`);await d.run(i)}}}function sx(t){return new URLSearchParams(t).get("automation")==="1"}function wO(t){if(!sx(location.search))return!1;return globalThis.__jxAutomation=_t(t),!0}var et={$schema:"https://jxsuite.com/schema/v1",$id:"StudioJxsuiteUpdate",$description:"The on-open offer to bring a project's `@jxsuite/*` dependencies up to their newest published versions: one sentence, and the packages that would move. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answers. Nothing here asks the registry or writes a manifest: `packages/jxsuite-update.ts` keeps the lookup, the dismissal key and the install, and this document only says what is on offer.",tagName:"jx-dialog",$props:{headline:"Update @jxsuite packages?",confirmLabel:"Update",cancelLabel:"Not now",size:"sm"},attributes:{part:"jxsuite-update"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'The old body was a lit template with no stylesheet at all, which is why the conversion is mostly a deletion. Two `<br />`s stood in for a paragraph break, and one `<span style="white-space: pre-line">` held every package as a single `\\n`-joined string — a list spelled as whitespace. Neither is addressable and neither announces as what it is, so a screen reader read one run-on line and a test could only match a substring of it. It is a `<ul>` of keyed rows now: the list says how many packages there are, and each row is `[data-package]`. The one token repair travels with it — that span asked for `--spectrum-font-size-75`, which resolves only inside `<sp-theme>`, and a document mounted in the dialog layer is outside it, so the size silently fell back to the hard-coded `12px` written beside it.','& [part="offer"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="lede"]':{margin:"0"},'& [part="list"]':{$description:"Capped and scrolling, because the count is the registry's rather than this dialog's: a project that has not been opened in a year can have every `@jxsuite/*` package behind at once, and a dialog that grows past the viewport puts its own Update button off screen.",listStyle:"none",margin:"0",padding:"0",display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",maxHeight:"240px",overflowY:"auto"},'& [part="package"]':{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:"var(--jx-space-3)",fontSize:"var(--jx-text-sm)"},'& [part="package-name"]':{color:"var(--fg)"},'& [part="package-move"]':{$description:"Tabular figures, so a column of versions does not jitter between rows of different widths.",color:"var(--fg-dim)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"}},children:[{tagName:"div",attributes:{part:"offer"},children:[{tagName:"p",attributes:{part:"lede"},textContent:"Newer versions of these packages have been published. Update the project to them?"},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/packages"},key:{$ref:"$map/item/name"},map:{tagName:"li",attributes:{part:"package","data-package":"${$map.item.name}"},children:[{tagName:"span",attributes:{part:"package-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"package-move"},textContent:"${$map.item.current} → ${$map.item.target}"}]}}]}]}]};E("jxsuite-update",et);function ot(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(ze,yt("dialog","jxsuite-update")),t.layer.append(e);let o=!1,r=()=>{if(o)return;o=!0,t.onClosed()},i=()=>o,a=b({cancel:()=>{t.onCancel()},closed:r,confirm:()=>{t.onConfirm()},packages:t.packages}),s=null,d=I("jxsuite-update",a,e).then(async(c)=>{s=c;let l=c.root;if(i())return c.dispose(),l;if(await an(l),i())return l;return Gt(l),l});return{close(){let c=s?.root;if(c instanceof HTMLElement)Ut(c);s?.dispose(),s=null,e.remove(),r()},host:e,ready:d}}function ax(t){return t.replace(/^[\^~>=<v\s]+/,"").trim().split(/\s+/)[0]??""}function rt(t){if(t.includes(":"))return!1;return/^\d+\.\d+/.test(ax(t))}function nt(t){let e=ax(t).split(/[-+]/)[0]??"",[o=0,r=0,i=0]=e.split(".").map((a)=>Math.trunc(Number(a))||0);return[o,r,i]}function Ht(t,e){let o=nt(t),r=nt(e);for(let i=0;i<3;i++){let a=o[i]??0,s=r[i]??0;if(a!==s)return a<s?-1:1}return 0}function lC(t,e){if(!rt(t)||!rt(e))return!1;return Ht(e,t)>0}var M="@jxsuite/";async function N(){let t=p();if(!t.packageVersions)return[];let e;try{e=await t.packageVersions()}catch{return[]}let o=[];for(let r of e)if(r.name.startsWith(M)&&lC(r.current,r.latest))o.push({current:r.current,dev:Boolean(r.dev),latest:r.latest,name:r.name});return o}function it(t,e){let o=e.map((r)=>`${r.name}@${r.latest}`).toSorted().join(",");return`jx:jxsuite-update-dismissed:${t}:${o}`}function Bt(t,e){try{return localStorage.getItem(it(t,e))==="1"}catch{return!1}}function Vt(t,e){try{localStorage.setItem(it(t,e),"1")}catch{}}async function O(t){let e=p();if(!e.setPackageVersions||t.length===0)return;let o=cl({status:"Updating @jxsuite packages…",title:"Updating dependencies"});try{let r=await e.setPackageVersions(t.map((i)=>({dev:i.dev,name:i.name,version:`^${i.latest}`})));if(r.ok)o.done(),w.success(`Updated ${t.length} @jxsuite package(s) to their latest versions.`);else o.fail(r.log??"Update failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}}function Wt(t){return new Promise((e)=>{let o=!1,r=(d)=>{if(o)return;o=!0,e(d)},i=!1,a=()=>{if(i)return;i=!0,s.close()},s=ot({layer:dt("dialog"),onCancel:()=>{a()},onClosed:()=>{r(!1),a()},onConfirm:()=>{r(!0),a()},packages:t.map((d)=>({current:d.current,name:d.name,target:`^${d.latest}`}))})})}async function Mm(t){if(sx(location.search))return;if(!p().setPackageVersions)return;let o=await N();if(o.length===0||Bt(t,o))return;if(!await Wt(o)){Vt(t,o);return}await O(o)}var j=["package.json","bun.lock","bun.lockb"],qt=new Set(["??","U"]),zt=25;function R(t){if(Array.isArray(t))return t.map((e)=>R(e));if(f(t)){let e={};for(let[o,r]of Object.entries(t).toSorted(([i],[a])=>i<a?-1:1))e[o]=R(r);return e}return t}function at(t){let e={...t};for(let o of["dependencies","devDependencies"]){let r=e[o];if(!f(r))continue;let i={...r};for(let a of Object.keys(i))if(a.startsWith(M))i[a]="*";e[o]=i}return e}function Xt(t,e){if(t===null||e===null)return!1;let o,r;try{o=JSON.parse(t),r=JSON.parse(e)}catch{return!1}if(!f(o)||!f(r))return!1;return JSON.stringify(R(at(o)))===JSON.stringify(R(at(r)))}async function A(t,e){try{return await p().gitShow({path:t,ref:e})}catch{return null}}async function ct(t){try{return await p().readFile(t)}catch{return null}}async function lt(t){let e=[],o=[],r=!0;for(let i of j){let a=t.files.filter((c)=>c.path===i);if(a.length===0)continue;let s=await A(i,"@{u}");if(a.every((c)=>qt.has(c.status))){if(s!==null)o.push(i);continue}let d=await A(i,"HEAD");if(s===null||s===d)continue;if(e.push(i),i==="package.json")r&&=Xt(d,await ct(i))}return{automated:r,discard:e,removeUntracked:o}}function ut(t){return t.discard.length===0&&t.removeUntracked.length===0}async function Kt(t){let e=[...new Set(t.files.filter((o)=>!j.includes(o.path)).map((o)=>o.path))];if(e.length>zt)return!0;for(let o of e){let r=await A(o,"@{u}");if(r!==null&&r!==await A(o,"HEAD"))return!0}return!1}async function Zt(t){let e=p();if(t.discard.length>0)await e.gitUnstage(t.discard),await e.gitDiscard(t.discard);for(let o of t.removeUntracked)await e.deleteFile(o)}async function F(){let t=p(),e=[];try{e=await N()}catch{e=[]}if(e.length>0&&t.setPackageVersions){await O(e);return}if(!t.installDependencies)return;let o=cl({status:"Installing dependencies…",title:"Syncing dependencies"});try{let r=await t.installDependencies();if(r.ok)o.done();else o.fail(r.log??"Install failed")}catch(r){o.fail(Z(r))}}async function pt(t){let e=p();try{await Zt(t)}catch(o){throw Error(`Could not reset local package files: ${Z(o)}`,{cause:o})}try{await e.gitPull()}catch(o){throw await F(),o}w.warn("Local package updates were superseded by pulled changes.",{source:"Source Control"}),await F()}async function Qt(t){let e=p(),o;try{o=await e.gitStatus()}catch{throw t}if(!(o.behind>0))throw t;let r=await lt(o);if(ut(r)||await Kt(o))throw t;if(!r.automated){if(!await Kr("Discard local package changes?","package.json / bun.lock have local edits that conflict with incoming changes. Discard them, pull, and re-sync packages?",{confirmLabel:"Discard and pull",destructive:!0}))throw t}await pt(r)}async function st(){let t;try{let e=await p().listDirectory("");t=new Set(e.filter((o)=>o.type==="file").map((o)=>o.name))}catch{t=new Set(j)}return Promise.all(j.map((e)=>t.has(e)?ct(e):Promise.resolve(null)))}async function _(){let t=p(),e=await st(),o=null;try{await t.gitFetch(),o=await t.gitStatus()}catch{o=null}if(o&&o.behind>0){let i=await lt(o);if(!ut(i)&&i.automated){await pt(i);return}}try{await t.gitPull()}catch(i){await Qt(i);return}let r=await st();if(e.some((i,a)=>i!==r[a]))await F()}async function Fm(){let t=p();try{let e=await t.gitStatus();if(!e.isRepo||!Array.isArray(e.remotes)||e.remotes.length===0)return}catch{return}w.info("Syncing project…",{key:"project.sync",source:"Source Control"});try{await _()}catch(e){w.warn("The project could not be synced with its remote.",{detail:Z(e),key:"project.sync",source:"Source Control",tier:"problem"})}}var mt={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGithubPublish",$description:"Create GitHub Repository: the three things the flow needs before it calls the API — the repository's name, an optional description, and whether it is private. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answer buttons. Nothing here reaches GitHub: `github/github-publish.ts` keeps the token, the request and the activity, and this document only collects.",tagName:"jx-dialog",$props:{headline:"Create GitHub Repository",confirmLabel:"Create Repository",cancelLabel:"Cancel",size:"sm"},attributes:{part:"github-publish"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'What is NOT here is most of the conversion. `.github-publish-dialog` was a flex column with an 8px gap and `8px 0` of padding: the gap is the one thing it said that nothing else draws, and `jx-dialog`\'s own body already pads the content, so only the gap survives. `.github-publish-dialog sp-textfield { width: 100% }` had nothing to transcribe either — a `jx-field` row is a grid whose control cell stretches, so the field fills the row without being told to. The three `sp-field-label`s are gone with them, because `jx-field` draws the label AND names the control from it; the third of them carried no `for` at all, so "Visibility" was text beside a switch rather than a name for it.','& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"}},children:[{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Repository name"},attributes:{part:"row","data-field":"name"},children:[{tagName:"jx-textfield",$props:{placeholder:"my-project",value:{$ref:"#/state/name"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Description (optional)"},attributes:{part:"row","data-field":"description"},children:[{tagName:"jx-textfield",$props:{placeholder:"A brief description",value:{$ref:"#/state/description"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDescription"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Visibility"},attributes:{part:"row","data-field":"visibility"},children:[{tagName:"div",$description:'The row opens with a plain `div`, and that is the whole reason it exists: `jx-field` names the first thing slotted into it that observes `labelledby`, so a switch slotted straight in would be announced "Visibility" over the top of the words printed beside it. A `div` observes no naming, so the switch keeps the name its own label gives it.',attributes:{part:"visibility-row"},children:[{tagName:"jx-switch",attributes:{part:"toggle"},$props:{checked:{$ref:"#/state/isPrivate"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setPrivate"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Private repository"}]}]}]}]}]};E("github-publish",mt);function ft(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(ze,yt("dialog","github-publish")),t.layer.append(e);let o=!1,r=()=>{if(o)return;o=!0,t.onClosed()},i=()=>o,a=b({cancel:()=>{t.onCancel()},closed:r,confirm:()=>{t.onConfirm({description:a.description,isPrivate:a.isPrivate,name:a.name})},description:"",isPrivate:!0,name:t.name,setDescription:(l)=>{a.description=l},setName:(l)=>{a.name=l},setPrivate:(l)=>{a.isPrivate=l}}),s=null,d=I("github-publish",a,e).then(async(l)=>{s=l;let m=l.root;if(i())return l.dispose(),m;if(await an(m),i())return m;return Gt(m),m});return{close(){if(o)return;let l=s?.root;if(l instanceof HTMLElement)Ut(l);s?.dispose(),s=null,e.remove(),r()},host:e,ready:d}}var D=["Create the repository","Add the remote","Push"];function te(t){return new Promise((e)=>{let o=!1,r=(a)=>{if(o)return;o=!0,e(a)},i=ft({layer:dt("dialog"),name:t,onCancel:()=>{i.close()},onClosed:()=>{r(null)},onConfirm:(a)=>{r({...a,name:a.name||t}),i.close()}})})}async function gt({projectName:t}){let e=await hC();if(!e)return!1;let o=await te(t);if(!o)return!1;let r=Ys({source:"Source Control",status:`Creating ${o.name}…`,steps:[...D],title:"Create GitHub repository"});r.step(D[0]);let i;try{i=await fetch("https://api.github.com/user/repos",{body:JSON.stringify({auto_init:!1,description:o.description,name:o.name,private:o.isPrivate}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${e}`,"Content-Type":"application/json"},method:"POST"})}catch(c){return r.log(Z(c)),r.fail("Could not reach GitHub to create the repository.",{action:"git.createGithubRepository"}),!1}if(!i.ok){let c=await i.json();return r.log(c.errors?.[0]?.message||c.message||`GitHub answered ${i.status}.`),r.fail("Could not create the GitHub repository.",{action:"git.createGithubRepository"}),!1}let a=await i.json();r.log(`Created ${a.html_url}`);let s=p();r.step(D[1]);try{await s.gitAddRemote("origin",a.clone_url)}catch(c){return r.log(Z(c)),r.fail("The repository was created, but the remote could not be added.",{action:"view.setWorkspace",actionArgs:{workspace:"publish"}}),!1}r.step(D[2]);try{await s.gitPush({setUpstream:!0})}catch(c){return r.log(Z(c)),r.fail("The repository was created, but the push failed.",{action:"git.push"}),!1}let{refreshGitStatus:d}=await (ce("rrc4jgp5"),import("./source-control-rrc4jgp5.js"));return await d(),r.done(a.html_url),w.success(`Repository created: ${a.html_url}`,{key:"github.repo"}),!0}async function ee(){let t=p(),{git:e}=u,o;try{o=await t.gitStatus()}catch(r){e.error=Z(r);return}if(e.status=o,!o.isRepo){e.branches=null;return}try{e.branches=await t.gitBranches()}catch(r){e.error=Z(r)}}async function $s(){if(!x)return;let{git:t}=u;t.loading=!0,t.error=null;try{if(await ee(),t.lastUpdated=lo(),t.rev+=1,await oe(),t.logEntries!==null)await cC()}catch(e){t.error=Z(e)}finally{t.loading=!1}}async function oe(){let t=u.git.diffState;if(!t)return;let e=u.git.status?.files.find((o)=>o.path===t.filePath);if(!e||!ht(e.status)){u.git.diffState=null;return}try{u.git.diffState=await G(t.filePath,e.status)}catch{}}async function b$(t){if(u.git.rev+=1,!u.git.loading)$s();let e=u.git.diffState;if(!t||e?.filePath!==t)return;try{u.git.diffState=await G(t,e.fileStatus)}catch{}}async function cC(){try{u.git.logEntries=await p().gitLog(30)}catch(t){u.git.error=Z(t)}}async function dC(t){let e=p();if(!e.gitClone){w.warn("Cloning is not supported on this platform.",{source:"Source Control"});return}let o=await Fn("Clone Git Repository",{confirmLabel:"Clone",message:"Repository URL",placeholder:"https://github.com/user/repo.git",validate:(r)=>r.trim()?"":"Enter a repository URL."});if(!o)return;try{w.info("Cloning repository…",{key:"git.clone",source:"Source Control"});let r=await e.gitClone(o);if(r.root)w.success("Clone complete.",{key:"git.clone"}),await t.openRecentProject(r.root)}catch(r){w.error("Could not clone the repository.",{detail:Z(r),key:"git.clone",source:"Source Control"})}}function zb(){return we()&&Boolean(p().gitClone)}function Gs(){return we()&&p().gitHosted===!0}function y$(){return we()&&Q(p().createPullRequest)}var re=new Map([["A","added"],["D","deleted"],["M","modified"],["R","renamed"],["U","untracked"]]);function ne(t){return re.get(t)??"changed"}var ie=new Map([["A","NEW"],["D","DELETED"],["M","EDIT"],["R","RENAMED"],["U","NEW"]]);function v$(t){return ie.get(t)??"EDIT"}var ae=new Set(["M","A","U","D"]);function ht(t){return ae.has(t)}async function G(t,e){let o=p(),r=e!=="A"&&e!=="U",i=e!=="D",[a,s]=await Promise.all([r?o.gitShow({path:t,ref:"HEAD"}):Promise.resolve(""),i?o.readFile(t):Promise.resolve("")]);return{currentContent:s,filePath:t,fileStatus:e,originalContent:a}}async function w$(t,e){try{return await G(t,e)}catch(o){return console.warn("loadDiffForLens:",Z(o)),null}}var T={};function x$(t){T=t}function _$(){T.cloneRepository?.()}function bt(t){return u.git.status?.files.find((e)=>e.path===t)}async function S$(t){let e=bt(t);if(!e)return;let o=ht(e.status)?B(e.path,e.status):`"${e.path}" has no change this view can open.`;if(o){u.git.error=o;return}try{u.git.loading=!0;let r=await G(e.path,e.status);u.git.diffState=r,T.setGitDiffState?.(r);let i=await V(e.path);if(i)T.setCanvasMode?.(i,"git-diff")}catch(r){u.git.error=`Failed to load diff: ${Z(r)}`}finally{u.git.loading=!1}}async function y(t){let e=p();u.git.loading=!0,u.git.error=null;try{return await t(e),await $s(),!0}catch(o){return u.git.error=Z(o),u.git.loading=!1,!1}}async function se(){try{w.info("Initializing repository…",{key:"git.init"}),await p().gitInit(),w.success("Repository initialized.",{key:"git.init"})}catch(t){w.error("Could not initialize the repository.",{action:"git.init",detail:Z(t),key:"git.init",source:"Source Control"});return}await $s()}async function le(){await y((t)=>t.gitPush())}async function C$(){await y((t)=>t.gitFetch())}async function k$(){u.git.loading=!0,u.git.error=null;try{await _(),await $s()}catch(t){u.git.error=Z(t),u.git.loading=!1}}async function ue(){await gt({projectName:x?.name||"my-project"})}async function pe(){if(await hC())w.success("Signed in to GitHub.",{key:"github.auth"})}async function E$(t,e){await y((o)=>e?o.gitStage([t]):o.gitUnstage([t]))}async function T$(t){let e=(u.git.status?.files??[]).filter((o)=>Boolean(o.staged)!==t).map((o)=>o.path);if(e.length===0)return;await y((o)=>t?o.gitStage(e):o.gitUnstage(e))}var v={paths:new Set,root:""};function de(){let t=x?.projectRoot??"";if(v.root!==t)v={paths:new Set,root:t};let e=u.git.status?.files??[],o=new Set(e.map((i)=>i.path));for(let i of v.paths)if(!o.has(i))v.paths.delete(i);let r=e.filter((i)=>!v.paths.has(i.path));for(let i of r)v.paths.add(i.path);return r.filter((i)=>!i.staged).map((i)=>i.path)}async function $$(){if(u.git.loading||!u.git.status?.isRepo)return;let t=de();if(t.length>0)await y((e)=>e.gitStage(t))}async function L$(t){if(bt(t)?.status==="U")return;if(!await Kr("Discard Changes",`Discard changes to ${t}?`,{confirmLabel:"Discard",destructive:!0}))return;await y((o)=>o.gitDiscard([t]))}async function R$(){let{branches:t,status:e}=u.git,o=await Fn("New Branch",{confirmLabel:"Create",message:`Branching from ${t?.current||e?.branch||"the current branch"}.`,placeholder:"feature/my-change",validate:(r)=>r.trim()?"":"Enter a branch name."});if(o)await y((r)=>r.gitCreateBranch(o.trim()))}async function I$(t){if(t===u.git.branches?.current)return;if(Gs()){if(!await Kr("Switch Branch",`Each branch opens in its own session, so switching to ${t} reloads Studio on that branch.`,{confirmLabel:"Switch and reload"}))return}await y((e)=>e.gitCheckout(t))}function uC(t){let e=t.path.split("/"),o=e.pop()??t.path,r=e.join("/"),i=ne(t.status);return{cannotDiscard:t.status==="U",dir:r,hasDir:r!=="",included:Boolean(t.staged),key:t.path,label:`${t.path}, ${i}`,name:o,path:t.path,status:t.status,statusWord:i}}var wt=[["components","Components"],["layouts","Layouts"],["styles","Styles"]];function me(t){let e=ic(t);if(e!==null)return e;let[o]=t.split("/");if(o==="pages")return pi;if(wt.some(([r])=>r===o))return`folder:${o}`;return ca.has(Ot(t))?"media":"other"}function N$(t){let e=[...Vm().map((r)=>[r.key,r.title]),...wt.map(([r,i])=>[`folder:${r}`,i]),["media","Media"],["other","Other"]],o=new Map;for(let r of t){let i=me(r.path);o.set(i,[...o.get(i)??[],r])}return e.flatMap(([r,i])=>{let a=o.get(r);return a?[{files:a.map((s)=>uC(s)),key:r,name:i}]:[]})}function D$(t){return{hash:t.hash.slice(0,7),key:t.hash,message:t.message,meta:`${t.author} · ${lx(t.date)}`}}function lx(t){let e=new Date(t),o=lo()-e.getTime(),r=Math.floor(o/60000);if(r<1)return"just now";if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);if(a<30)return`${a}d ago`;return e.toLocaleDateString()}function O$(t){return t?`Last updated ${new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:""}var C=null;function A$(){if(C)return;C=setInterval(()=>{if(u.workspace==="publish"&&!u.git.loading)$s()},sM)}function Ub(){if(C)clearInterval(C),C=null;v={paths:new Set,root:""}}function fe(){return[{category:"Source Control",id:"git.init",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"an open project that git is not already tracking",when:(t)=>t.project.open,enablement:(t)=>!t.project.isRepo,run:async()=>{await se()},title:"Initialize Repository"},{category:"Source Control",id:"git.createGithubRepository",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"a project tracked by git",when:(t)=>t.project.open,enablement:(t)=>t.project.isRepo,run:async()=>{await ue()},title:"Create GitHub Repository"},{category:"Source Control",id:"git.push",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"a project tracked by git",when:(t)=>t.project.open,enablement:(t)=>t.project.isRepo,run:async()=>{await le()},title:"Push"},{category:"Source Control",id:"git.signInToGithub",level:"application",menus:["palette"],group:"7_scm",run:async()=>{await pe()},title:"Sign In to GitHub"}]}function P$(t){t.registerAll(fe())}
2
+ export{aC,vO,sx,wO,ax,lC,Mm,Fm,Wb,$s,b$,cC,dC,zb,Gs,y$,v$,w$,x$,_$,S$,C$,k$,E$,T$,$$,L$,R$,I$,uC,N$,D$,lx,O$,A$,Ub,P$};
3
3
 
4
- //# debugId=5D9DF04309B4DA5F64756E2164756E21
5
- //# sourceMappingURL=studio-ajfq4fmr.js.map
4
+ //# debugId=7933D99AD6D8F5E264756E2164756E21
5
+ //# sourceMappingURL=studio-wmak8xjw.js.map
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-xh6rf05g.js";import{hs}from"./studio-wn2cmf9q.js";import{Rs,Kd,gR}from"./studio-48yzqzqr.js";import{ky,g}from"./studio-s49y6m5b.js";import{x}from"./studio-zn7ysyzb.js";var P=/[.*+?^${}()|[\]\\]/;function v(e){return P.test(e)?`\\${e}`:e}function L(e){let t=e.length;while(t>0&&e[t-1]===" "){let n=0,r=t-2;while(r>=0&&e[r]==="\\")n+=1,r-=1;if(n%2===1)break;t-=1}return e.slice(0,t)}function T(e,t){let n=t+1;if(e[n]==="!")n+=1;if(e[n]==="]")n+=1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]==="]")return n;n+=1}return-1}function k(e){let t="",n=0;while(n<e.length){let r=e[n];if(r==="\\"){let o=e[n+1];if(o===void 0)t+=String.raw`\\`,n+=1;else t+=v(o),n+=2;continue}if(r==="*"){let o=0;while(e[n]==="*")o+=1,n+=1;let i=t===""||t.endsWith("/");if(o>=2&&i&&e[n]==="/")t+="(?:[^/]+/)*",n+=1;else if(o>=2&&i&&n>=e.length)t+=".*";else t+="[^/]*";continue}if(r==="?"){t+="[^/]",n+=1;continue}if(r==="["){let o=T(e,n);if(o===-1){t+=String.raw`\[`,n+=1;continue}let i=e.slice(n+1,o),s=i.startsWith("!"),a=s?i.slice(1):i;t+=`[${s?"^":""}${a.startsWith("]")?String.raw`\]${a.slice(1)}`:a}]`,n=o+1;continue}t+=v(r),n+=1}return t}function F(e){let t=L(e);if(t===""||t.startsWith("#"))return null;let n=!1;if(t.startsWith("!"))n=!0,t=t.slice(1);let r=!1;if(t.endsWith("/"))r=!0,t=t.slice(0,-1);let o=t.includes("/");if(t.startsWith("/"))t=t.slice(1),o=!0;if(t==="")return null;let i=k(t);return{dirOnly:r,negated:n,re:new RegExp(`^${o?"":"(?:.*/)?"}${i}$`),source:e}}function M(e){let t=[];for(let n of e.split(/\r?\n/)){let r=F(n);if(r)t.push(r)}return t}function b(e){let t=e.replaceAll("\\","/").replace(/^\.\/+/,"").replace(/\/+$/,"");return t==="."?"":t}function O(e,t){if(e==="")return t;return t.startsWith(`${e}/`)?t.slice(e.length+1):null}function w(e){let t=b(e),n=[""];if(t==="")return n;let r="";for(let o of t.split("/"))r=r===""?o:`${r}/${o}`,n.push(r);return n}function W(e,t,n){let r=!1;for(let o of e){let i=O(o.base,t);if(i===null||i==="")continue;for(let s of o.rules){if(s.dirOnly&&!n)continue;if(s.re.test(i))r=!s.negated}}return r}function N(e,t,n){let r=b(t);if(r==="")return!1;let o=r.split("/"),i="";for(let[s,a]of o.entries()){i=i===""?a:`${i}/${a}`;let u=s===o.length-1;if(W(e,i,u?n:!0))return!0}return!1}var d=new Map,y=new Map;function Wp(){d.clear(),y.clear()}async function C(e){try{let t=await p().readFile(e===""?".gitignore":`${e}/.gitignore`);return{base:e,rules:M(t)}}catch{return null}}function _(e){let t=d.get(e);if(t!==void 0)return Promise.resolve(t);let n=y.get(e);if(n)return n;let r=C(e).then((o)=>(d.set(e,o),y.delete(e),o));return y.set(e,r),r}async function E(){let e=[...d.keys()];y.clear();let t=await Promise.all(e.map((n)=>C(n)));d.clear();for(let[n,r]of e.entries())d.set(r,t[n]??null)}async function GA(e){await Promise.all(w(e).map((t)=>_(t)))}function A(e){let t=[];for(let n of w(e)){let r=d.get(n);if(r)t.push(r)}return t}function JA(e,t,n){return N(A(e),t,n)}function D(e){return e.some((t)=>b(t).split("/").pop()===".gitignore")}var U=1500,S={commit:0,open:1,reconnect:2},G=250,V=8,R=new Map,I=(e)=>e.replaceAll("\\","/");function Ls(...e){Kd(e,e);let t=Date.now()+U;for(let n of e)if(n)R.set(I(n),t)}function Ud(e){let t=I(e),n=R.get(t);if(n===void 0)return!1;if(Date.now()>n)return R.delete(t),!1;return!0}function Y(e){let t=e.lastIndexOf("/");return t===-1?".":e.slice(0,t)}function z(e){let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function B(e,t,n){let r=new Set;for(let o of n){let i=Y(o.path);if(o.type==="add"||o.type==="addDir"){let s=e.get(i);if(s&&!s.some((a)=>a.path===o.path))s.push({name:z(o.path),path:o.path,type:o.isDir?"directory":"file"}),r.add(i);if(o.type==="addDir"&&!e.has(o.path))e.set(o.path,[])}else if(o.type==="unlink"||o.type==="unlinkDir"){let s=e.get(i);if(s){let a=s.findIndex((u)=>u.path===o.path);if(a!==-1)s.splice(a,1),r.add(i)}if(o.type==="unlinkDir"){e.delete(o.path);let a=[];for(let c of e.keys())if(c.startsWith(`${o.path}/`))a.push(c);for(let c of a)e.delete(c);let u=[];for(let c of t)if(c===o.path||c.startsWith(`${o.path}/`))u.push(c);for(let c of u)t.delete(c)}}}return r}function j(e){let t=[],n=[];for(let r of e)if(r.type==="unlinkDir")n.push(r.path);else if(r.type!=="addDir")t.push(r.path);if(t.length>0||n.length>0)Kd(t,n)}function q(e,t){return e!==void 0&&e.length===t.length&&e.every((n,r)=>n===t[r])}var K=2;async function H(e,t){let n=[...e.keys()],r=0,o=async(s)=>{for(let a=0;a<K;a+=1){let u=e.get(s);if(!u)return;let c=[...u],l;try{l=await t(s)}catch{l=null}if(!e.has(s))return;if(!q(e.get(s),c))continue;if(l)e.set(s,l);else e.delete(s);return}},i=async()=>{while(r<n.length){let s=n[r];r+=1,await o(s)}};await Promise.all(Array.from({length:Math.min(V,n.length)},i))}var J=new Set(["media","grid"]);function Q(e){return e.some((t)=>J.has(t))||e.length>0&&e.every((t)=>t==="git-diff")}function X(){let e=new Set;for(let t of g.tabs.values()){let n=t.documentPath;if(n&&!t.doc.dirty&&!ky(n)&&!Q(t.capabilities.modes))e.add(n)}return[...e]}function uR(e){let t=p();if(!t.subscribeFileEvents)return()=>{};let n=[],r=null,o=null,i=null,s=()=>{r=null;let l=x,f=n.filter((h)=>!Ud(h.path));if(n=[],!l||f.length===0)return;let m=B(l.dirs,l.expanded,f);if(e.onContentChange){for(let h of f)if(h.type==="change")e.onContentChange(h.path)}if(m.size>0)e.renderLeftPanel()},a=async()=>{i=null;let l=o;o=null;let f=x;if(!f||!l)return;let m=H(f.dirs,(h)=>Rs(()=>t.listDirectory(h)));if(l==="reconnect")hs(),e.invalidateDerivedCaches?.(void 0,!0),await Promise.all([m,E()]);else await m;if(x!==f)return;if(l==="reconnect")e.onResyncContent?.(X());e.renderLeftPanel()},u=(l)=>{if(l!=="commit")gR();if(!o||S[l]>S[o])o=l;if(i)clearTimeout(i);i=setTimeout(()=>{a()},G)},c=t.subscribeFileEvents((l)=>{if(hs(),e.invalidateDerivedCaches?.(l.map((f)=>f.path),l.some((f)=>f.type!=="change")),j(l),D(l.map((f)=>f.path)))E().then(()=>e.renderLeftPanel());if(n.push(...l),r)clearTimeout(r);r=setTimeout(s,50)},{onResync:u});return()=>{if(i)clearTimeout(i),i=null;c()}}
2
- export{Wp,GA,JA,Ls,Ud,uR};
1
+ import{p}from"./studio-1b79rpcb.js";import{ps}from"./studio-pk961xgz.js";import{Is,Gd,kR}from"./studio-44drsmhw.js";import{Ly,g}from"./studio-ybkd5w8k.js";import{x}from"./studio-anc8067x.js";var P=/[.*+?^${}()|[\]\\]/;function v(e){return P.test(e)?`\\${e}`:e}function L(e){let t=e.length;while(t>0&&e[t-1]===" "){let n=0,r=t-2;while(r>=0&&e[r]==="\\")n+=1,r-=1;if(n%2===1)break;t-=1}return e.slice(0,t)}function T(e,t){let n=t+1;if(e[n]==="!")n+=1;if(e[n]==="]")n+=1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]==="]")return n;n+=1}return-1}function k(e){let t="",n=0;while(n<e.length){let r=e[n];if(r==="\\"){let o=e[n+1];if(o===void 0)t+=String.raw`\\`,n+=1;else t+=v(o),n+=2;continue}if(r==="*"){let o=0;while(e[n]==="*")o+=1,n+=1;let i=t===""||t.endsWith("/");if(o>=2&&i&&e[n]==="/")t+="(?:[^/]+/)*",n+=1;else if(o>=2&&i&&n>=e.length)t+=".*";else t+="[^/]*";continue}if(r==="?"){t+="[^/]",n+=1;continue}if(r==="["){let o=T(e,n);if(o===-1){t+=String.raw`\[`,n+=1;continue}let i=e.slice(n+1,o),s=i.startsWith("!"),a=s?i.slice(1):i;t+=`[${s?"^":""}${a.startsWith("]")?String.raw`\]${a.slice(1)}`:a}]`,n=o+1;continue}t+=v(r),n+=1}return t}function F(e){let t=L(e);if(t===""||t.startsWith("#"))return null;let n=!1;if(t.startsWith("!"))n=!0,t=t.slice(1);let r=!1;if(t.endsWith("/"))r=!0,t=t.slice(0,-1);let o=t.includes("/");if(t.startsWith("/"))t=t.slice(1),o=!0;if(t==="")return null;let i=k(t);return{dirOnly:r,negated:n,re:new RegExp(`^${o?"":"(?:.*/)?"}${i}$`),source:e}}function M(e){let t=[];for(let n of e.split(/\r?\n/)){let r=F(n);if(r)t.push(r)}return t}function b(e){let t=e.replaceAll("\\","/").replace(/^\.\/+/,"").replace(/\/+$/,"");return t==="."?"":t}function O(e,t){if(e==="")return t;return t.startsWith(`${e}/`)?t.slice(e.length+1):null}function w(e){let t=b(e),n=[""];if(t==="")return n;let r="";for(let o of t.split("/"))r=r===""?o:`${r}/${o}`,n.push(r);return n}function W(e,t,n){let r=!1;for(let o of e){let i=O(o.base,t);if(i===null||i==="")continue;for(let s of o.rules){if(s.dirOnly&&!n)continue;if(s.re.test(i))r=!s.negated}}return r}function N(e,t,n){let r=b(t);if(r==="")return!1;let o=r.split("/"),i="";for(let[s,a]of o.entries()){i=i===""?a:`${i}/${a}`;let u=s===o.length-1;if(W(e,i,u?n:!0))return!0}return!1}var d=new Map,y=new Map;function qp(){d.clear(),y.clear()}async function C(e){try{let t=await p().readFile(e===""?".gitignore":`${e}/.gitignore`);return{base:e,rules:M(t)}}catch{return null}}function _(e){let t=d.get(e);if(t!==void 0)return Promise.resolve(t);let n=y.get(e);if(n)return n;let r=C(e).then((o)=>(d.set(e,o),y.delete(e),o));return y.set(e,r),r}async function E(){let e=[...d.keys()];y.clear();let t=await Promise.all(e.map((n)=>C(n)));d.clear();for(let[n,r]of e.entries())d.set(r,t[n]??null)}async function aP(e){await Promise.all(w(e).map((t)=>_(t)))}function A(e){let t=[];for(let n of w(e)){let r=d.get(n);if(r)t.push(r)}return t}function lP(e,t,n){return N(A(e),t,n)}function D(e){return e.some((t)=>b(t).split("/").pop()===".gitignore")}var U=1500,S={commit:0,open:1,reconnect:2},G=250,V=8,R=new Map,I=(e)=>e.replaceAll("\\","/");function Rs(...e){Gd(e,e);let t=Date.now()+U;for(let n of e)if(n)R.set(I(n),t)}function Jd(e){let t=I(e),n=R.get(t);if(n===void 0)return!1;if(Date.now()>n)return R.delete(t),!1;return!0}function Y(e){let t=e.lastIndexOf("/");return t===-1?".":e.slice(0,t)}function z(e){let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function B(e,t,n){let r=new Set;for(let o of n){let i=Y(o.path);if(o.type==="add"||o.type==="addDir"){let s=e.get(i);if(s&&!s.some((a)=>a.path===o.path))s.push({name:z(o.path),path:o.path,type:o.isDir?"directory":"file"}),r.add(i);if(o.type==="addDir"&&!e.has(o.path))e.set(o.path,[])}else if(o.type==="unlink"||o.type==="unlinkDir"){let s=e.get(i);if(s){let a=s.findIndex((u)=>u.path===o.path);if(a!==-1)s.splice(a,1),r.add(i)}if(o.type==="unlinkDir"){e.delete(o.path);let a=[];for(let c of e.keys())if(c.startsWith(`${o.path}/`))a.push(c);for(let c of a)e.delete(c);let u=[];for(let c of t)if(c===o.path||c.startsWith(`${o.path}/`))u.push(c);for(let c of u)t.delete(c)}}}return r}function j(e){let t=[],n=[];for(let r of e)if(r.type==="unlinkDir")n.push(r.path);else if(r.type!=="addDir")t.push(r.path);if(t.length>0||n.length>0)Gd(t,n)}function q(e,t){return e!==void 0&&e.length===t.length&&e.every((n,r)=>n===t[r])}var K=2;async function H(e,t){let n=[...e.keys()],r=0,o=async(s)=>{for(let a=0;a<K;a+=1){let u=e.get(s);if(!u)return;let c=[...u],l;try{l=await t(s)}catch{l=null}if(!e.has(s))return;if(!q(e.get(s),c))continue;if(l)e.set(s,l);else e.delete(s);return}},i=async()=>{while(r<n.length){let s=n[r];r+=1,await o(s)}};await Promise.all(Array.from({length:Math.min(V,n.length)},i))}var J=new Set(["media","grid"]);function Q(e){return e.some((t)=>J.has(t))||e.length>0&&e.every((t)=>t==="git-diff")}function X(){let e=new Set;for(let t of g.tabs.values()){let n=t.documentPath;if(n&&!t.doc.dirty&&!Ly(n)&&!Q(t.capabilities.modes))e.add(n)}return[...e]}function wR(e){let t=p();if(!t.subscribeFileEvents)return()=>{};let n=[],r=null,o=null,i=null,s=()=>{r=null;let l=x,f=n.filter((h)=>!Jd(h.path));if(n=[],!l||f.length===0)return;let m=B(l.dirs,l.expanded,f);if(e.onContentChange){for(let h of f)if(h.type==="change")e.onContentChange(h.path)}if(m.size>0)e.renderLeftPanel()},a=async()=>{i=null;let l=o;o=null;let f=x;if(!f||!l)return;let m=H(f.dirs,(h)=>Is(()=>t.listDirectory(h)));if(l==="reconnect")ps(),e.invalidateDerivedCaches?.(void 0,!0),await Promise.all([m,E()]);else await m;if(x!==f)return;if(l==="reconnect")e.onResyncContent?.(X());e.renderLeftPanel()},u=(l)=>{if(l!=="commit")kR();if(!o||S[l]>S[o])o=l;if(i)clearTimeout(i);i=setTimeout(()=>{a()},G)},c=t.subscribeFileEvents((l)=>{if(ps(),e.invalidateDerivedCaches?.(l.map((f)=>f.path),l.some((f)=>f.type!=="change")),j(l),D(l.map((f)=>f.path)))E().then(()=>e.renderLeftPanel());if(n.push(...l),r)clearTimeout(r);r=setTimeout(s,50)},{onResync:u});return()=>{if(i)clearTimeout(i),i=null;c()}}
2
+ export{qp,aP,lP,Rs,Jd,wR};
3
3
 
4
- //# debugId=0F4BDBCF692D242964756E2164756E21
5
- //# sourceMappingURL=studio-k05g7efh.js.map
4
+ //# debugId=85AF390C55E7390964756E2164756E21
5
+ //# sourceMappingURL=studio-wqsmvtqj.js.map
@@ -0,0 +1,5 @@
1
+ function Op(t){if(Number.isNaN(t.getTime()))return"";let r=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0");return`${String(t.getFullYear()).padStart(4,"0")}-${r}-${n}`}
2
+ export{Op};
3
+
4
+ //# debugId=58EB8AF43DC0B1AC64756E2164756E21
5
+ //# sourceMappingURL=studio-x3z3rhej.js.map
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-xh6rf05g.js";import{jt,Pa,_l}from"./studio-ex1644g2.js";import{Tn,nt,ta}from"./studio-cv6gnjqd.js";import{ae}from"./studio-q509sqt8.js";import{h}from"./studio-s49y6m5b.js";import{jw,UD,Db,_i}from"./studio-ze1sm147.js";import{Ch,Eo,x}from"./studio-zn7ysyzb.js";import{E,I}from"./studio-1a7zshnv.js";import{b}from"./studio-9f5vcb4w.js";import{n,xf}from"./studio-erjccagy.js";var M={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPalette",$description:'The command palette: a `role="combobox"` field over the kit\'s `jx-listbox`, whose rows are `jx-option`s the host projects. `rows` is the ranked set for the current mode and query; `activeId` is the highlight, and it is ONE string — the id the field points `aria-activedescendant` at and the id the listbox is handed as `active`, so a key moves the caret without the rows reconciling and no row re-decides its own flag. The FIELD is not a `jx-combobox`: this one carries a mode chip inside its box, its Enter runs a command rather than committing a value, and its panel is a centred scrim rather than a popover under a control. Every gesture calls back into panels/quick-search.ts, which owns the modes, the ranking, the recents and what a row does.',tagName:"div",attributes:{part:"palette"},style:{display:"contents",'& [part="overlay"]':{position:"fixed",inset:"0",zIndex:"1000",display:"flex",justifyContent:"center",paddingTop:"60px",background:"rgba(0, 0, 0, 0.4)"},'& [part="overlay"][hidden]':{display:"none"},'& [part="panel"]':{width:"560px",maxWidth:"calc(100vw - 32px)",maxHeight:"420px",display:"flex",flexDirection:"column",alignSelf:"flex-start",background:"var(--jx-bg-overlay)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-md)",boxShadow:"var(--jx-shadow-dialog)",color:"var(--jx-fg)",fontFamily:"var(--jx-font-sans)",overflow:"hidden"},'& [part="input-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",paddingLeft:"var(--jx-space-4)",background:"var(--jx-bg-input)",borderBottom:"1px solid var(--jx-border)"},'& [part="chip-slot"], & [part="empty-slot"], & [part="section-slot"], & [part="trailing-slot"]':{display:"contents"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-1)",flexShrink:"0",padding:"2px var(--jx-space-1) 2px var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-accent-solid)",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-sm)"},'& [part="chip-remove"] > [part="control"]':{color:"inherit",opacity:"0.8",":hover":{opacity:"1",background:"transparent"}},'& [part="input"]':{flex:"1",minWidth:"0",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-4) var(--jx-space-1)",font:"inherit",fontSize:"var(--jx-text-lg)",border:"none",outline:"none",background:"none",color:"var(--jx-fg)","::placeholder":{color:"var(--jx-fg-muted)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="results"]':{$description:"The list is the kit's: a `jx-listbox` of `jx-option`, so the highlight is ONE id — `active`, the same string the field points `aria-activedescendant` at — and the listbox's sidecar is the single writer of every row's `selected`. What this surface still decides is density. The kit's row pads itself by `--jx-space-3`; the other half of the 16px optical margin the panel has always had sits here, on the list, so the heading, the rows and the empty sentence line up on one edge instead of each naming it.",flex:"1",paddingInline:"var(--jx-space-3)"},'& [part="option"] [part="label"]':{fontWeight:"500"},'& [part="option"] [part="description"]':{$description:"A `jx-select` row's note is a category at the END of the row, so the kit pushes it there with an auto margin. A palette row's note is a CONTINUATION of its name — the file's directory, the command's category — and the far edge belongs to the chord, which is how this surface teaches the keyboard it replaced. So the auto margin moves to the end slot.",marginInlineStart:"0"},'& [part="option"] [part="end"]':{marginInlineStart:"auto"},'& [part="option"][aria-disabled="true"]':{$description:"An unavailable command is greyed with its `requires` sentence as the subtitle, and that sentence is the reason the row is on screen at all. The kit fades the whole row to 0.45, which would take a muted grey below any readable contrast — so the row keeps its ink and only the name and the glyph dim.",opacity:"1"},'& [part="option"][aria-disabled="true"] [part="label"], & [part="option"][aria-disabled="true"] [part="icon"]':{opacity:"0.45"},'& [part="chord"]':{flexShrink:"0",fontFamily:"inherit",fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-muted)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-sm)",padding:"0 5px"},'& [part="option"][aria-selected="true"] [part="chord"]':{color:"inherit",borderColor:"currentColor"},'& [part="badge"]':{fontSize:"var(--jx-text-xs)",padding:"1px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-border)",color:"var(--jx-fg-dim)"},'& [part="hint"]':{padding:"var(--jx-space-2) var(--jx-space-5)",borderTop:"1px solid var(--jx-border)",color:"var(--jx-fg-muted)",fontSize:"var(--jx-text-xs)"},'& [part="hint"] kbd':{fontFamily:"inherit",color:"var(--jx-fg-dim)"}},children:[{tagName:"div",attributes:{part:"overlay",hidden:"${state.open ? null : ''}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"},value:[]}]},children:[{tagName:"div",attributes:{part:"panel"},onclick:{$prototype:"Function",body:[{stopPropagation:!0}]},children:[{tagName:"div",attributes:{part:"input-row"},children:[{tagName:"span",attributes:{part:"chip-slot",role:"none"},$switch:{$ref:"#/state/hasChip"},cases:{true:{tagName:"span",attributes:{part:"chip"},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${state.chipLabel}"},{tagName:"jx-action-button",$props:{label:"Clear mode",hint:"Clear mode (Backspace)",icon:"x",size:"sm"},attributes:{part:"chip-remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}},{tagName:"input",attributes:{part:"input",type:"text",role:"combobox","aria-controls":"quick-search-listbox","aria-expanded":"${state.expanded ? 'true' : 'false'}","aria-activedescendant":"${state.activeId || null}","aria-autocomplete":"list","aria-label":"${state.placeholder}",placeholder:"${state.placeholder}"},value:{$ref:"#/state/query"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activate"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/close"},value:[]}],Backspace:[{$switch:{$ref:"#/state/canClearMode"},cases:{true:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}]}}]},{tagName:"jx-listbox",attributes:{part:"results",id:"quick-search-listbox"},$props:{label:"Results",active:"${state.activeId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activateRow"},value:[{$ref:"event#/detail"}]}],description:"One handler for every row, because a row's `select` bubbles. The detail is the row's `value`, which is the index it occupies in `rows` — the same number a hover names, and the number the id is built from."},children:[{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/isEmpty"},cases:{true:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyHint}"}}},{tagName:"div",attributes:{part:"section-slot",role:"none"},$switch:{$ref:"#/state/showSection"},cases:{true:{tagName:"div",attributes:{part:"group-heading"},textContent:"${state.sectionLabel}"}}},{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"jx-option",attributes:{part:"option",id:"quick-search-option-${$map.index}","data-kind":"${$map.item.kind}"},$props:{value:"${$map.index}",label:{$ref:"$map/item/name"},description:{$ref:"$map/item/detail"},disabled:{$ref:"$map/item/disabled"}},onmouseenter:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/hover"},value:[{$ref:"$map/index"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",attributes:{slot:"end",part:"trailing-slot"},$switch:{$ref:"$map/item/trailing"},cases:{chord:{tagName:"kbd",attributes:{part:"chord"},textContent:"${$map.item.chord}"},recent:{tagName:"span",attributes:{part:"badge"},textContent:"recent"}}}]}}]},{tagName:"div",attributes:{part:"hint"},children:[{tagName:"kbd",textContent:"↑↓"}," move · ",{tagName:"kbd",textContent:"↵"}," run · ",{tagName:"kbd",textContent:"?"}," modes · ",{tagName:"kbd",textContent:">"}," commands · ",{tagName:"kbd",textContent:"@"}," elements"]}]}]}]};var C=[{mode:"files",prefix:"",chip:"Files",placeholder:"Go to a file…",description:"Open a file by any part of its path — pgblog finds pages/blog/index.md."},{mode:"commands",prefix:">",chip:"Commands",placeholder:"Run a command…",description:"Run anything Studio can do, with its keyboard shortcut printed beside it."},{mode:"nodes",prefix:"@",chip:"Symbols",placeholder:"Go to an element in this document…",description:"Select an element in the open document by its Outline name."},{mode:"projects",prefix:"",chip:"Recent Projects",placeholder:"Open a recent project…",description:"Reopen a project you have had open before."},{mode:"picker",prefix:"?",chip:"Modes",placeholder:"Type ? for modes, > for commands, @ for elements…",description:"List these modes."}],X=new Map(C.map((e)=>[e.mode,e])),O=C.filter((e)=>e.prefix!=="");function _(e){return X.get(e)??C[0]}function L(e,t,o){let a=O.find((s)=>t.startsWith(s.prefix));if(a)return L(a.mode,t.slice(1),o);let i=e;if(i==="picker"&&t.trim()!=="")i="files";if(i==="files"&&!o)i="projects";return{mode:i,query:t}}var Y=new Set(["/","-","_","."," "]);function Z(e,t){if(t==="")return 0;let o=e.toLowerCase(),a=t.toLowerCase(),i=o.lastIndexOf("/")+1,s=0,r=0,y=-2;for(let K of a){let u=o.indexOf(K,r);if(u===-1)return null;if(u===y+1)s+=8;if(u===0||Y.has(o[u-1]??""))s+=6;if(u>=i)s+=4;y=u,r=u+1}return s-y*0.01-o.length*0.001}function R(e,t,o){let a=[];for(let[i,s]of e.entries()){let r=Z(o(s),t);if(r!==null)a.push({index:i,item:s,score:r})}return a.toSorted((i,s)=>s.score-i.score||i.index-s.index).map((i)=>i.item)}function q(e){let t=e.args,o=t?.properties;if(!t||!o)return{kind:"none"};let a=Object.keys(o);if(a.length!==1)return{kind:"unsupported"};let i=a[0],s=o[i];if(s.enum)return{kind:"choice",name:i,choices:s.enum.map((r)=>({label:String(r),value:r}))};if(s.type==="boolean")return{kind:"choice",name:i,choices:[{label:"on",value:!0},{label:"off",value:!1}]};return{kind:"unsupported"}}function S(e){return`quick-search-option-${e}`}var D="jx-studio-recent-commands",ee=6;function H(){try{let e=JSON.parse(localStorage.getItem(D)||"[]");return Array.isArray(e)?e.filter((t)=>n(t)):[]}catch{return[]}}function te(e){let t=[e,...H().filter((o)=>o!==e)].slice(0,ee);try{localStorage.setItem(D,JSON.stringify(t))}catch{}}var z=null,g=!1,v="picker",l="",d=0,k=null,j=!1,c=null;function B(){return ta("popover","quick-search")}function YE(e){z=e??null}function yb(e="files"){g=!0,v=e,l="",d=0,c=null,k=null,m(),ye(),N()}function w(){g=!1,c=null,m()}function Q(){return x?x.projectRoot:null}function W(){return x!=null}function J(){return L(v,l,W())}function U(e){let t=e.split("/");return t.pop(),t.length>0?t.join("/"):""}function ne(e){if(e.startsWith("/home/"))return`~/${e.split("/").slice(3).join("/")}`;return e}async function N(){if(!g||k!==null||j||!W())return;j=!0,m();try{await jt(),k=(await p().searchFiles("",_l())).map((t)=>({kind:"file",path:t.path,name:t.name??t.path.split("/").pop()??"",detail:U(t.path),recent:!1}))}catch{k=[]}j=!1,m()}function oe(e){if(e.trim()==="")return UD(Q()??void 0).map((t)=>({kind:"file",path:t.path,name:t.name,detail:U(t.path),recent:!0}));return R(k??[],e.trim(),(t)=>t.path)}function re(e){let t=jw().map((o)=>({kind:"project",root:o.root,name:o.name,detail:ne(o.root)}));return R(t,e.trim(),(o)=>`${o.name}/${o.root}`)}function ie(e,t){let o=H(),a=[];for(let r of e.visible()){if(q(r).kind==="unsupported")continue;if(!(r.menus??["palette"]).includes("palette"))continue;a.push({kind:"command",id:r.id,name:`${r.category}: ${r.title}`,detail:e.disabledReason(r.id)??"",chord:e.keymap.formatBinding(r.id)??"",enabled:e.isEnabled(r.id),recent:o.includes(r.id)})}let i=R(a,t.trim(),(r)=>r.name);if(t.trim()!=="")return i;let s=o.map((r)=>i.find((y)=>y.id===r)).filter((r)=>r!==void 0);return[...s,...i.filter((r)=>!s.includes(r))]}function se(e){let t=h.value;if(!t)return[];let o=Ch(t.doc.document).map((a)=>({kind:"node",path:a.path,name:xf(a.node)?String(a.node).slice(0,60):Eo(a.node),detail:a.nodeType}));return R(o,e.trim(),(a)=>a.name)}function ce(){return C.flatMap((e)=>e.mode==="picker"?[]:[{kind:"mode",mode:e.mode,name:e.chip,detail:e.description,chord:e.prefix}])}function de(e){let t=c,o=t.choices.map((a)=>({kind:"arg",commandId:t.command.id,argName:t.name,value:a.value,name:a.label,detail:`${t.command.title} → ${t.name}`}));return R(o,e.trim(),(a)=>a.name)}function le(){let{mode:e,query:t}=J();if(c)return{rows:de(t),showingRecent:!1};switch(e){case"commands":{let o=ae();return{rows:o?ie(o,t):[],showingRecent:t.trim()===""}}case"nodes":return{rows:se(t),showingRecent:!1};case"projects":return{rows:re(t),showingRecent:t.trim()===""};case"picker":return{rows:ce(),showingRecent:!1};default:return{rows:oe(t),showingRecent:t.trim()===""}}}function pe(e){let t=O.find((o)=>e.startsWith(o.prefix));if(t)v=t.mode,l=e.slice(1);else l=e;if(d=0,e!==l)P().query=e;m(),N()}function me(){v="picker",c=null,d=0,m()}function ue(e){v=e,l="",d=0,m(),N()}function G(e,t){let o=ae();if(!o)return;te(e.id),w(),Tn(o,e.id,t,"Palette")}function A(e){switch(e.kind){case"project":{w(),z?.openRecentProject(e.root);return}case"file":{w(),Db({name:e.name,path:e.path,root:Q()??""}),_i(e.path);return}case"mode":{ue(e.mode);return}case"node":{w(),nt("selection.set",{path:e.path},"Palette");return}case"arg":{G(c.command,{[e.argName]:e.value});return}default:he(e)}}function he(e){let t=ae(),o=t?.get(e.id);if(!t||!o||!e.enabled)return;let a=q(o);if(a.kind==="choice"){c={choices:a.choices,command:o,name:a.name},l="",d=0,m();return}G(o)}function fe(e){let t=e.split(".").pop()?.toLowerCase();if(t==="json")return"file-code";if(t&&Pa(t))return"file-text";return"file"}function ge(e){switch(e.kind){case"project":return"folder-open";case"file":return fe(e.name);case"command":return"play";case"node":return"stack";default:return"caret-right"}}function xe(e,t){if((e.kind==="command"||e.kind==="mode")&&e.chord)return"chord";if(e.kind==="command"&&e.recent)return"recent";return t?"recent":"none"}function be(e){switch(e.kind){case"project":return`project:${e.root}`;case"file":return`file:${e.path}`;case"command":return`command:${e.id}`;case"node":return`node:${e.path.join("/")}`;case"mode":return`mode:${e.mode}`;default:return`arg:${e.value}`}}function ve(e,t){if(j)return"Reading the project's files…";if(t.trim()!=="")return"No results";switch(e){case"projects":return"No recent projects — open one to get started";case"nodes":return"Open a document to jump to its elements";case"commands":return"Type to find any command in Studio";default:return _(e).placeholder}}E("palette",M);var T=null,F=null,f=[];function P(){return T??=b({activate:()=>{let e=f[d];if(e)A(e)},activateRow:(e)=>{let t=f[Number(e)];if(t)A(t)},activeId:"",canClearMode:!1,chipLabel:"",clearMode:me,close:w,emptyHint:"",expanded:!1,hasChip:!1,hover:(e)=>{d=e,P().activeId=S(e)},input:pe,isEmpty:!0,move:(e)=>{if(f.length===0)return;d=Math.max(0,Math.min(d+e,f.length-1)),P().activeId=S(d)},open:!1,placeholder:"",query:"",rows:[],sectionLabel:"",showSection:!1}),T}function ye(){setTimeout(()=>{if(g)B().querySelector('[part="input"]')?.focus()},0)}function m(){let e=P();if(!F)F=I("palette",e,B());if(e.open=g,!g){f=[];return}let{mode:t,query:o}=J(),{rows:a,showingRecent:i}=le(),s=_(t);f=a,e.placeholder=c?`Choose a ${c.name}…`:s.placeholder,e.hasChip=c!==null||t!=="picker",e.chipLabel=c?c.command.title:s.chip,e.query=l,e.canClearMode=l===""&&(c!==null||v!=="picker"),e.rows=a.map((r)=>({chord:(r.kind==="command"||r.kind==="mode")&&r.chord?r.chord:"",detail:r.detail,disabled:r.kind==="command"&&!r.enabled,icon:ge(r),key:be(r),kind:r.kind,name:r.name,trailing:xe(r,i)})),e.expanded=a.length>0,e.activeId=a.length>0?S(d):"",e.isEmpty=a.length===0,e.emptyHint=ve(t,o),e.showSection=i&&a.length>0,e.sectionLabel=c?`${c.command.title} — ${c.name}`:t==="projects"?"Recent projects":t==="commands"?"Recently used":"Recently opened"}
2
- export{YE,yb};
1
+ import{p}from"./studio-1b79rpcb.js";import{jt,Fa,Cl}from"./studio-hf259xzd.js";import{Tn,it,na}from"./studio-yetr4gg1.js";import{ae}from"./studio-dbex091t.js";import{h}from"./studio-ybkd5w8k.js";import{zw,nO,Mb,hi}from"./studio-8atmfjjm.js";import{Th,To,x}from"./studio-anc8067x.js";import{E,I}from"./studio-xxttcym1.js";import{b}from"./studio-y3tjh2xb.js";import{n,kf}from"./studio-0z8kp4xk.js";var M={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPalette",$description:'The command palette: a `role="combobox"` field over the kit\'s `jx-listbox`, whose rows are `jx-option`s the host projects. `rows` is the ranked set for the current mode and query; `activeId` is the highlight, and it is ONE string — the id the field points `aria-activedescendant` at and the id the listbox is handed as `active`, so a key moves the caret without the rows reconciling and no row re-decides its own flag. The FIELD is not a `jx-combobox`: this one carries a mode chip inside its box, its Enter runs a command rather than committing a value, and its panel is a centred scrim rather than a popover under a control. Every gesture calls back into panels/quick-search.ts, which owns the modes, the ranking, the recents and what a row does.',tagName:"div",attributes:{part:"palette"},style:{display:"contents",'& [part="overlay"]':{position:"fixed",inset:"0",zIndex:"1000",display:"flex",justifyContent:"center",paddingTop:"60px",background:"rgba(0, 0, 0, 0.4)"},'& [part="overlay"][hidden]':{display:"none"},'& [part="panel"]':{width:"560px",maxWidth:"calc(100vw - 32px)",maxHeight:"420px",display:"flex",flexDirection:"column",alignSelf:"flex-start",background:"var(--jx-bg-overlay)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-md)",boxShadow:"var(--jx-shadow-dialog)",color:"var(--jx-fg)",fontFamily:"var(--jx-font-sans)",overflow:"hidden"},'& [part="input-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",paddingLeft:"var(--jx-space-4)",background:"var(--jx-bg-input)",borderBottom:"1px solid var(--jx-border)"},'& [part="chip-slot"], & [part="empty-slot"], & [part="section-slot"], & [part="trailing-slot"]':{display:"contents"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-1)",flexShrink:"0",padding:"2px var(--jx-space-1) 2px var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-accent-solid)",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-sm)"},'& [part="chip-remove"] > [part="control"]':{color:"inherit",opacity:"0.8",":hover":{opacity:"1",background:"transparent"}},'& [part="input"]':{flex:"1",minWidth:"0",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-4) var(--jx-space-1)",font:"inherit",fontSize:"var(--jx-text-lg)",border:"none",outline:"none",background:"none",color:"var(--jx-fg)","::placeholder":{color:"var(--jx-fg-muted)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="results"]':{$description:"The list is the kit's: a `jx-listbox` of `jx-option`, so the highlight is ONE id — `active`, the same string the field points `aria-activedescendant` at — and the listbox's sidecar is the single writer of every row's `selected`. What this surface still decides is density. The kit's row pads itself by `--jx-space-3`; the other half of the 16px optical margin the panel has always had sits here, on the list, so the heading, the rows and the empty sentence line up on one edge instead of each naming it.",flex:"1",paddingInline:"var(--jx-space-3)"},'& [part="option"] [part="label"]':{fontWeight:"500"},'& [part="option"] [part="description"]':{$description:"A `jx-select` row's note is a category at the END of the row, so the kit pushes it there with an auto margin. A palette row's note is a CONTINUATION of its name — the file's directory, the command's category — and the far edge belongs to the chord, which is how this surface teaches the keyboard it replaced. So the auto margin moves to the end slot.",marginInlineStart:"0"},'& [part="option"] [part="end"]':{marginInlineStart:"auto"},'& [part="option"][aria-disabled="true"]':{$description:"An unavailable command is greyed with its `requires` sentence as the subtitle, and that sentence is the reason the row is on screen at all. The kit fades the whole row to 0.45, which would take a muted grey below any readable contrast — so the row keeps its ink and only the name and the glyph dim.",opacity:"1"},'& [part="option"][aria-disabled="true"] [part="label"], & [part="option"][aria-disabled="true"] [part="icon"]':{opacity:"0.45"},'& [part="chord"]':{flexShrink:"0",fontFamily:"inherit",fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-muted)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-sm)",padding:"0 5px"},'& [part="option"][aria-selected="true"] [part="chord"]':{color:"inherit",borderColor:"currentColor"},'& [part="badge"]':{fontSize:"var(--jx-text-xs)",padding:"1px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-border)",color:"var(--jx-fg-dim)"},'& [part="hint"]':{padding:"var(--jx-space-2) var(--jx-space-5)",borderTop:"1px solid var(--jx-border)",color:"var(--jx-fg-muted)",fontSize:"var(--jx-text-xs)"},'& [part="hint"] kbd':{fontFamily:"inherit",color:"var(--jx-fg-dim)"}},children:[{tagName:"div",attributes:{part:"overlay",hidden:"${state.open ? null : ''}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"},value:[]}]},children:[{tagName:"div",attributes:{part:"panel"},onclick:{$prototype:"Function",body:[{stopPropagation:!0}]},children:[{tagName:"div",attributes:{part:"input-row"},children:[{tagName:"span",attributes:{part:"chip-slot",role:"none"},$switch:{$ref:"#/state/hasChip"},cases:{true:{tagName:"span",attributes:{part:"chip"},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${state.chipLabel}"},{tagName:"jx-action-button",$props:{label:"Clear mode",hint:"Clear mode (Backspace)",icon:"x",size:"sm"},attributes:{part:"chip-remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}},{tagName:"input",attributes:{part:"input",type:"text",role:"combobox","aria-controls":"quick-search-listbox","aria-expanded":"${state.expanded ? 'true' : 'false'}","aria-activedescendant":"${state.activeId || null}","aria-autocomplete":"list","aria-label":"${state.placeholder}",placeholder:"${state.placeholder}"},value:{$ref:"#/state/query"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activate"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/close"},value:[]}],Backspace:[{$switch:{$ref:"#/state/canClearMode"},cases:{true:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}]}}]},{tagName:"jx-listbox",attributes:{part:"results",id:"quick-search-listbox"},$props:{label:"Results",active:"${state.activeId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activateRow"},value:[{$ref:"event#/detail"}]}],description:"One handler for every row, because a row's `select` bubbles. The detail is the row's `value`, which is the index it occupies in `rows` — the same number a hover names, and the number the id is built from."},children:[{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/isEmpty"},cases:{true:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyHint}"}}},{tagName:"div",attributes:{part:"section-slot",role:"none"},$switch:{$ref:"#/state/showSection"},cases:{true:{tagName:"div",attributes:{part:"group-heading"},textContent:"${state.sectionLabel}"}}},{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"jx-option",attributes:{part:"option",id:"quick-search-option-${$map.index}","data-kind":"${$map.item.kind}"},$props:{value:"${$map.index}",label:{$ref:"$map/item/name"},description:{$ref:"$map/item/detail"},disabled:{$ref:"$map/item/disabled"}},onmouseenter:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/hover"},value:[{$ref:"$map/index"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",attributes:{slot:"end",part:"trailing-slot"},$switch:{$ref:"$map/item/trailing"},cases:{chord:{tagName:"kbd",attributes:{part:"chord"},textContent:"${$map.item.chord}"},recent:{tagName:"span",attributes:{part:"badge"},textContent:"recent"}}}]}}]},{tagName:"div",attributes:{part:"hint"},children:[{tagName:"kbd",textContent:"↑↓"}," move · ",{tagName:"kbd",textContent:"↵"}," run · ",{tagName:"kbd",textContent:"?"}," modes · ",{tagName:"kbd",textContent:">"}," commands · ",{tagName:"kbd",textContent:"@"}," elements"]}]}]}]};var C=[{mode:"files",prefix:"",chip:"Files",placeholder:"Go to a file…",description:"Open a file by any part of its path — pgblog finds pages/blog/index.md."},{mode:"commands",prefix:">",chip:"Commands",placeholder:"Run a command…",description:"Run anything Studio can do, with its keyboard shortcut printed beside it."},{mode:"nodes",prefix:"@",chip:"Symbols",placeholder:"Go to an element in this document…",description:"Select an element in the open document by its Outline name."},{mode:"projects",prefix:"",chip:"Recent Projects",placeholder:"Open a recent project…",description:"Reopen a project you have had open before."},{mode:"picker",prefix:"?",chip:"Modes",placeholder:"Type ? for modes, > for commands, @ for elements…",description:"List these modes."}],X=new Map(C.map((e)=>[e.mode,e])),O=C.filter((e)=>e.prefix!=="");function _(e){return X.get(e)??C[0]}function L(e,t,o){let a=O.find((s)=>t.startsWith(s.prefix));if(a)return L(a.mode,t.slice(1),o);let i=e;if(i==="picker"&&t.trim()!=="")i="files";if(i==="files"&&!o)i="projects";return{mode:i,query:t}}var Y=new Set(["/","-","_","."," "]);function Z(e,t){if(t==="")return 0;let o=e.toLowerCase(),a=t.toLowerCase(),i=o.lastIndexOf("/")+1,s=0,r=0,y=-2;for(let K of a){let u=o.indexOf(K,r);if(u===-1)return null;if(u===y+1)s+=8;if(u===0||Y.has(o[u-1]??""))s+=6;if(u>=i)s+=4;y=u,r=u+1}return s-y*0.01-o.length*0.001}function R(e,t,o){let a=[];for(let[i,s]of e.entries()){let r=Z(o(s),t);if(r!==null)a.push({index:i,item:s,score:r})}return a.toSorted((i,s)=>s.score-i.score||i.index-s.index).map((i)=>i.item)}function q(e){let t=e.args,o=t?.properties;if(!t||!o)return{kind:"none"};let a=Object.keys(o);if(a.length!==1)return{kind:"unsupported"};let i=a[0],s=o[i];if(s.enum)return{kind:"choice",name:i,choices:s.enum.map((r)=>({label:String(r),value:r}))};if(s.type==="boolean")return{kind:"choice",name:i,choices:[{label:"on",value:!0},{label:"off",value:!1}]};return{kind:"unsupported"}}function S(e){return`quick-search-option-${e}`}var D="jx-studio-recent-commands",ee=6;function H(){try{let e=JSON.parse(localStorage.getItem(D)||"[]");return Array.isArray(e)?e.filter((t)=>n(t)):[]}catch{return[]}}function te(e){let t=[e,...H().filter((o)=>o!==e)].slice(0,ee);try{localStorage.setItem(D,JSON.stringify(t))}catch{}}var z=null,g=!1,v="picker",l="",d=0,k=null,j=!1,c=null;function B(){return na("popover","quick-search")}function rT(e){z=e??null}function _b(e="files"){g=!0,v=e,l="",d=0,c=null,k=null,m(),ye(),N()}function w(){g=!1,c=null,m()}function Q(){return x?x.projectRoot:null}function W(){return x!=null}function J(){return L(v,l,W())}function U(e){let t=e.split("/");return t.pop(),t.length>0?t.join("/"):""}function ne(e){if(e.startsWith("/home/"))return`~/${e.split("/").slice(3).join("/")}`;return e}async function N(){if(!g||k!==null||j||!W())return;j=!0,m();try{await jt(),k=(await p().searchFiles("",Cl())).map((t)=>({kind:"file",path:t.path,name:t.name??t.path.split("/").pop()??"",detail:U(t.path),recent:!1}))}catch{k=[]}j=!1,m()}function oe(e){if(e.trim()==="")return nO(Q()??void 0).map((t)=>({kind:"file",path:t.path,name:t.name,detail:U(t.path),recent:!0}));return R(k??[],e.trim(),(t)=>t.path)}function re(e){let t=zw().map((o)=>({kind:"project",root:o.root,name:o.name,detail:ne(o.root)}));return R(t,e.trim(),(o)=>`${o.name}/${o.root}`)}function ie(e,t){let o=H(),a=[];for(let r of e.visible()){if(q(r).kind==="unsupported")continue;if(!(r.menus??["palette"]).includes("palette"))continue;a.push({kind:"command",id:r.id,name:`${r.category}: ${r.title}`,detail:e.disabledReason(r.id)??"",chord:e.keymap.formatBinding(r.id)??"",enabled:e.isEnabled(r.id),recent:o.includes(r.id)})}let i=R(a,t.trim(),(r)=>r.name);if(t.trim()!=="")return i;let s=o.map((r)=>i.find((y)=>y.id===r)).filter((r)=>r!==void 0);return[...s,...i.filter((r)=>!s.includes(r))]}function se(e){let t=h.value;if(!t)return[];let o=Th(t.doc.document).map((a)=>({kind:"node",path:a.path,name:kf(a.node)?String(a.node).slice(0,60):To(a.node),detail:a.nodeType}));return R(o,e.trim(),(a)=>a.name)}function ce(){return C.flatMap((e)=>e.mode==="picker"?[]:[{kind:"mode",mode:e.mode,name:e.chip,detail:e.description,chord:e.prefix}])}function de(e){let t=c,o=t.choices.map((a)=>({kind:"arg",commandId:t.command.id,argName:t.name,value:a.value,name:a.label,detail:`${t.command.title} → ${t.name}`}));return R(o,e.trim(),(a)=>a.name)}function le(){let{mode:e,query:t}=J();if(c)return{rows:de(t),showingRecent:!1};switch(e){case"commands":{let o=ae();return{rows:o?ie(o,t):[],showingRecent:t.trim()===""}}case"nodes":return{rows:se(t),showingRecent:!1};case"projects":return{rows:re(t),showingRecent:t.trim()===""};case"picker":return{rows:ce(),showingRecent:!1};default:return{rows:oe(t),showingRecent:t.trim()===""}}}function pe(e){let t=O.find((o)=>e.startsWith(o.prefix));if(t)v=t.mode,l=e.slice(1);else l=e;if(d=0,e!==l)P().query=e;m(),N()}function me(){v="picker",c=null,d=0,m()}function ue(e){v=e,l="",d=0,m(),N()}function G(e,t){let o=ae();if(!o)return;te(e.id),w(),Tn(o,e.id,t,"Palette")}function A(e){switch(e.kind){case"project":{w(),z?.openRecentProject(e.root);return}case"file":{w(),Mb({name:e.name,path:e.path,root:Q()??""}),hi(e.path);return}case"mode":{ue(e.mode);return}case"node":{w(),it("selection.set",{path:e.path},"Palette");return}case"arg":{G(c.command,{[e.argName]:e.value});return}default:he(e)}}function he(e){let t=ae(),o=t?.get(e.id);if(!t||!o||!e.enabled)return;let a=q(o);if(a.kind==="choice"){c={choices:a.choices,command:o,name:a.name},l="",d=0,m();return}G(o)}function fe(e){let t=e.split(".").pop()?.toLowerCase();if(t==="json")return"file-code";if(t&&Fa(t))return"file-text";return"file"}function ge(e){switch(e.kind){case"project":return"folder-open";case"file":return fe(e.name);case"command":return"play";case"node":return"stack";default:return"caret-right"}}function xe(e,t){if((e.kind==="command"||e.kind==="mode")&&e.chord)return"chord";if(e.kind==="command"&&e.recent)return"recent";return t?"recent":"none"}function be(e){switch(e.kind){case"project":return`project:${e.root}`;case"file":return`file:${e.path}`;case"command":return`command:${e.id}`;case"node":return`node:${e.path.join("/")}`;case"mode":return`mode:${e.mode}`;default:return`arg:${e.value}`}}function ve(e,t){if(j)return"Reading the project's files…";if(t.trim()!=="")return"No results";switch(e){case"projects":return"No recent projects — open one to get started";case"nodes":return"Open a document to jump to its elements";case"commands":return"Type to find any command in Studio";default:return _(e).placeholder}}E("palette",M);var T=null,F=null,f=[];function P(){return T??=b({activate:()=>{let e=f[d];if(e)A(e)},activateRow:(e)=>{let t=f[Number(e)];if(t)A(t)},activeId:"",canClearMode:!1,chipLabel:"",clearMode:me,close:w,emptyHint:"",expanded:!1,hasChip:!1,hover:(e)=>{d=e,P().activeId=S(e)},input:pe,isEmpty:!0,move:(e)=>{if(f.length===0)return;d=Math.max(0,Math.min(d+e,f.length-1)),P().activeId=S(d)},open:!1,placeholder:"",query:"",rows:[],sectionLabel:"",showSection:!1}),T}function ye(){setTimeout(()=>{if(g)B().querySelector('[part="input"]')?.focus()},0)}function m(){let e=P();if(!F)F=I("palette",e,B());if(e.open=g,!g){f=[];return}let{mode:t,query:o}=J(),{rows:a,showingRecent:i}=le(),s=_(t);f=a,e.placeholder=c?`Choose a ${c.name}…`:s.placeholder,e.hasChip=c!==null||t!=="picker",e.chipLabel=c?c.command.title:s.chip,e.query=l,e.canClearMode=l===""&&(c!==null||v!=="picker"),e.rows=a.map((r)=>({chord:(r.kind==="command"||r.kind==="mode")&&r.chord?r.chord:"",detail:r.detail,disabled:r.kind==="command"&&!r.enabled,icon:ge(r),key:be(r),kind:r.kind,name:r.name,trailing:xe(r,i)})),e.expanded=a.length>0,e.activeId=a.length>0?S(d):"",e.isEmpty=a.length===0,e.emptyHint=ve(t,o),e.showSection=i&&a.length>0,e.sectionLabel=c?`${c.command.title} — ${c.name}`:t==="projects"?"Recent projects":t==="commands"?"Recently used":"Recently opened"}
2
+ export{rT,_b};
3
3
 
4
- //# debugId=9E53E9012ED9D6E264756E2164756E21
5
- //# sourceMappingURL=studio-7qr8k0v2.js.map
4
+ //# debugId=54B78D2FA0FCD69964756E2164756E21
5
+ //# sourceMappingURL=studio-xb55kpmy.js.map