@jxsuite/studio 10.2.0 → 10.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/dist/chunks/{2020-bx702wqa.js → 2020-906vx2dq.js} +3 -3
  2. package/dist/chunks/adapter-hnvad61x.js +4 -0
  3. package/dist/chunks/add-new-flow-3tkn72ey.js +4 -0
  4. package/dist/chunks/cf-account-picker-xb8vvt2h.js +4 -0
  5. package/dist/chunks/cf-settings-mkbcz4z2.js +4 -0
  6. package/dist/chunks/components-w5zqwva1.js +4 -0
  7. package/dist/chunks/content-source-1vzxq1ba.js +4 -0
  8. package/dist/chunks/convert-to-repeater-gwzh9gar.js +4 -0
  9. package/dist/chunks/editor-wvf5e6j9.js +4 -0
  10. package/dist/chunks/entry-commands-mx2whrjx.js +4 -0
  11. package/dist/chunks/extension-sections-338ee35t.js +4 -0
  12. package/dist/chunks/file-ops-9bxvk59j.js +4 -0
  13. package/dist/chunks/files-t07yqqej.js +4 -0
  14. package/dist/chunks/format-host-5ja5gxyk.js +4 -0
  15. package/dist/chunks/fs-events-3424ezp3.js +4 -0
  16. package/dist/chunks/grid-open-1mpq9mzb.js +4 -0
  17. package/dist/chunks/{grid-view-tghcwrrt.js → grid-view-w9nfy203.js} +16 -16
  18. package/dist/chunks/icons-gb967qc8.js +4 -0
  19. package/dist/chunks/iframe-host-wsg0bn73.js +4 -0
  20. package/dist/chunks/image-bake-4afr4y6a.js +4 -0
  21. package/dist/chunks/image-editor-x7t8jbjn.js +4 -0
  22. package/dist/chunks/index-f9qr7kzh.js +4 -0
  23. package/dist/chunks/{index-vr006kbt.js → index-yjrfeks8.js} +3 -3
  24. package/dist/chunks/{javascript-z1g3s9fd.js → javascript-hy2mws8v.js} +3 -3
  25. package/dist/chunks/{jsonMode-7szwg8c4.js → jsonMode-vj30te2h.js} +6 -6
  26. package/dist/chunks/jx-validate-ttr5ewf0.js +4 -0
  27. package/dist/chunks/layers-m49nmwvx.js +4 -0
  28. package/dist/chunks/layers-panel-hvy2e549.js +4 -0
  29. package/dist/chunks/lit-html-k2mb9k0r.js +4 -0
  30. package/dist/chunks/media-library-ae67q4at.js +4 -0
  31. package/dist/chunks/media-open-yp9jm834.js +4 -0
  32. package/dist/chunks/media-picker-s41ngdfr.js +4 -0
  33. package/dist/chunks/{monaco-binding-v42w9c1v.js → monaco-binding-a51py33c.js} +3 -3
  34. package/dist/chunks/monaco-buffer-pa0g6ax7.js +4 -0
  35. package/dist/chunks/{monaco-setup-7bffxd6v.js → monaco-setup-g9kterhx.js} +3 -3
  36. package/dist/chunks/notify-bwehrp7q.js +4 -0
  37. package/dist/chunks/parse-hee7ne9b.js +4 -0
  38. package/dist/chunks/platform-kv0k65cy.js +4 -0
  39. package/dist/chunks/publish-panel-gzfxcm0t.js +4 -0
  40. package/dist/chunks/publish-quick-w3nxd7q4.js +4 -0
  41. package/dist/chunks/publish-workspace-dppd82tc.js +4 -0
  42. package/dist/chunks/quick-search-tdxaam55.js +4 -0
  43. package/dist/chunks/references-vqyr5s9x.js +4 -0
  44. package/dist/chunks/right-panel-0yrw4cgz.js +4 -0
  45. package/dist/chunks/source-control-6fk72me2.js +4 -0
  46. package/dist/chunks/{studio-j3d2fjqz.js → studio-0939t1q1.js} +4 -4
  47. package/dist/chunks/studio-0gvvqj3h.js +5 -0
  48. package/dist/chunks/studio-0khd8xtx.js +4 -0
  49. package/dist/chunks/studio-0w3541dg.js +7 -0
  50. package/dist/chunks/{studio-9b7177jq.js → studio-0x6f3nk9.js} +4 -4
  51. package/dist/chunks/studio-1410q5dw.js +5 -0
  52. package/dist/chunks/{studio-awxwjawq.js → studio-15hwqgd8.js} +4 -4
  53. package/dist/chunks/studio-1ks5d9y4.js +5 -0
  54. package/dist/chunks/{studio-881z1xrx.js → studio-2ggfzrrd.js} +4 -4
  55. package/dist/chunks/{studio-4jhw38b2.js → studio-321ym1tt.js} +4 -4
  56. package/dist/chunks/studio-3c10v2q1.js +5 -0
  57. package/dist/chunks/{studio-bvs9kpst.js → studio-3na1r48j.js} +8 -8
  58. package/dist/chunks/{studio-86r8hp7r.js → studio-3q7mhbgx.js} +5 -5
  59. package/dist/chunks/studio-3qr08sxq.js +4 -0
  60. package/dist/chunks/studio-3xk9zdgb.js +5 -0
  61. package/dist/chunks/{studio-qh8berdz.js → studio-423tfdte.js} +4 -4
  62. package/dist/chunks/{studio-75kcdbsk.js → studio-45mj4jqe.js} +4 -4
  63. package/dist/chunks/studio-4f7thq0p.js +5 -0
  64. package/dist/chunks/studio-4fnb5648.js +5 -0
  65. package/dist/chunks/studio-4zd6an2b.js +5 -0
  66. package/dist/chunks/studio-53wy9ek3.js +5 -0
  67. package/dist/chunks/studio-5n193zqd.js +5 -0
  68. package/dist/chunks/{studio-9rbe2xpw.js → studio-5tet77de.js} +3 -3
  69. package/dist/chunks/{studio-ybnwymxw.js → studio-7rrdbvex.js} +4 -4
  70. package/dist/chunks/studio-8kx6m0rg.js +5 -0
  71. package/dist/chunks/{studio-sxdb9h3q.js → studio-90zkgne5.js} +7 -7
  72. package/dist/chunks/studio-9c6cbq2c.js +4 -0
  73. package/dist/chunks/studio-9dq7rwc7.js +5 -0
  74. package/dist/chunks/{studio-cg1bfyhf.js → studio-9qx1ywbv.js} +8 -8
  75. package/dist/chunks/studio-a65kbs2e.js +9 -0
  76. package/dist/chunks/studio-aam8zt8z.js +5 -0
  77. package/dist/chunks/{studio-er5f383a.js → studio-abh9kfdh.js} +4 -4
  78. package/dist/chunks/studio-b4e0ftkt.js +5 -0
  79. package/dist/chunks/studio-b68k0z00.js +5 -0
  80. package/dist/chunks/{studio-399a25za.js → studio-bct64zmj.js} +4 -4
  81. package/dist/chunks/studio-bz0b5brj.js +6 -0
  82. package/dist/chunks/studio-cfnn70h1.js +5 -0
  83. package/dist/chunks/studio-daksw8kh.js +5 -0
  84. package/dist/chunks/{studio-r7pf0rkv.js → studio-e7vjyp04.js} +7 -7
  85. package/dist/chunks/studio-ea6r1zyr.js +5 -0
  86. package/dist/chunks/studio-egnjpyde.js +9 -0
  87. package/dist/chunks/studio-ejrypvmq.js +5 -0
  88. package/dist/chunks/studio-eqcddvc2.js +928 -0
  89. package/dist/chunks/studio-f8tyeyzt.js +5 -0
  90. package/dist/chunks/studio-fj6c905s.js +5 -0
  91. package/dist/chunks/{studio-646nn2ys.js → studio-fkrr7kgg.js} +5 -5
  92. package/dist/chunks/studio-fspe7m9t.js +5 -0
  93. package/dist/chunks/studio-g0hxtcga.js +5 -0
  94. package/dist/chunks/{studio-th7z3fg7.js → studio-g9brbewz.js} +4 -4
  95. package/dist/chunks/studio-ggx3j7nd.js +5 -0
  96. package/dist/chunks/{studio-43y04qck.js → studio-hfxttkyr.js} +4 -4
  97. package/dist/chunks/studio-hh394phe.js +5 -0
  98. package/dist/chunks/{studio-pjtntksy.js → studio-j0zf5x2x.js} +4 -4
  99. package/dist/chunks/studio-jeb7hth3.js +5 -0
  100. package/dist/chunks/studio-k0xzrse2.js +64 -0
  101. package/dist/chunks/studio-k1xqrgm5.js +5 -0
  102. package/dist/chunks/studio-k2evngrj.js +7 -0
  103. package/dist/chunks/studio-k3we3kqb.js +5 -0
  104. package/dist/chunks/{studio-sevbc3xv.js → studio-n9qba0gx.js} +4 -4
  105. package/dist/chunks/{studio-6hzdjfv0.js → studio-nf8esxxc.js} +4 -4
  106. package/dist/chunks/studio-nn4f9m9c.js +5 -0
  107. package/dist/chunks/studio-nskxe9q1.js +6 -0
  108. package/dist/chunks/{studio-ea74s8c1.js → studio-nvcn2ykc.js} +4 -4
  109. package/dist/chunks/studio-nwynxqtb.js +5 -0
  110. package/dist/chunks/studio-nzemfbkk.js +14 -0
  111. package/dist/chunks/studio-p2a03pgm.js +5 -0
  112. package/dist/chunks/{studio-4g8yb6jn.js → studio-pm17wdc4.js} +4 -4
  113. package/dist/chunks/{studio-71m92v9s.js → studio-q80fg1d6.js} +7 -7
  114. package/dist/chunks/studio-r050sez0.js +6 -0
  115. package/dist/chunks/studio-s7t4vp1d.js +6 -0
  116. package/dist/chunks/studio-s9fng7m8.js +7 -0
  117. package/dist/chunks/studio-sce30r7b.js +4 -0
  118. package/dist/chunks/studio-stahswgb.js +7 -0
  119. package/dist/chunks/studio-swedpd82.js +5 -0
  120. package/dist/chunks/studio-thz5t120.js +5 -0
  121. package/dist/chunks/studio-tpxcryf2.js +5 -0
  122. package/dist/chunks/{studio-wc6za3zs.js → studio-v5wktj6f.js} +4 -4
  123. package/dist/chunks/{studio-kg1abnz0.js → studio-vpevkfxw.js} +4 -4
  124. package/dist/chunks/studio-waekn290.js +5 -0
  125. package/dist/chunks/studio-wfct4h6n.js +5 -0
  126. package/dist/chunks/studio-wgc54sxf.js +5 -0
  127. package/dist/chunks/studio-wqfaqw4m.js +5 -0
  128. package/dist/chunks/studio-wse1rs8t.js +7 -0
  129. package/dist/chunks/studio-x0gsfr1d.js +16 -0
  130. package/dist/chunks/{studio-hhp4x8xf.js → studio-xpx91fby.js} +5 -5
  131. package/dist/chunks/studio-y1b86ast.js +5 -0
  132. package/dist/chunks/studio-yrcrncev.js +5 -0
  133. package/dist/chunks/{studio-rzqaz21g.js → studio-yzpskb0j.js} +4 -4
  134. package/dist/chunks/studio-zfdbmhp3.js +5 -0
  135. package/dist/chunks/{tsMode-f54j66ym.js → tsMode-jg1dtphj.js} +7 -7
  136. package/dist/chunks/workspace-9btkc8tk.js +4 -0
  137. package/dist/chunks/workspace-home-qcc4z5ag.js +4 -0
  138. package/dist/chunks/{ws-client-e8kj684q.js → ws-client-arz2qsy9.js} +3 -3
  139. package/dist/iframe-entry.js +13 -13
  140. package/dist/manifest.json +83 -78
  141. package/dist/studio.js +84 -84
  142. package/package.json +2 -2
  143. package/src/browse/library-pane.ts +44 -29
  144. package/src/browse/library-preview.ts +6 -2
  145. package/src/canvas/asset-refs.ts +13 -4
  146. package/src/canvas/asset-resolve.ts +54 -11
  147. package/src/canvas/canvas-render.ts +25 -0
  148. package/src/canvas/iframe-entry.ts +5 -1
  149. package/src/canvas/iframe-host.ts +16 -6
  150. package/src/canvas/iframe-protocol.ts +9 -1
  151. package/src/commands/context.ts +5 -0
  152. package/src/commands/live-context.ts +5 -2
  153. package/src/editor/shortcuts.ts +3 -0
  154. package/src/files/asset-versions.ts +108 -2
  155. package/src/files/file-ops.ts +11 -1
  156. package/src/files/files.ts +111 -48
  157. package/src/files/media-paths.ts +12 -4
  158. package/src/files/media-upload.ts +195 -21
  159. package/src/files/new-file-name.ts +39 -1
  160. package/src/media/image-bake.ts +164 -0
  161. package/src/media/image-editor.ts +846 -0
  162. package/src/media/image-format.ts +262 -0
  163. package/src/media/image-recipe.ts +651 -0
  164. package/src/media/media-commands.ts +65 -1
  165. package/src/media/media-library-model.ts +1 -1
  166. package/src/media/media-library.ts +175 -15
  167. package/src/media/media-open.ts +156 -3
  168. package/src/media/media-pane.ts +8 -4
  169. package/src/panels/pane-context.ts +6 -1
  170. package/src/panels/tab-strip.ts +12 -3
  171. package/src/studio.ts +13 -2
  172. package/src/surfaces/image-editor.json +1390 -0
  173. package/src/surfaces/image-editor.ts +272 -0
  174. package/src/surfaces/media-library.json +129 -1
  175. package/src/surfaces/media-library.ts +17 -2
  176. package/src/types.ts +2 -1
  177. package/src/workspace/tab-workspace.ts +2 -1
  178. package/src/workspace/workspace-switch.ts +3 -1
  179. package/src/workspace/workspace.ts +22 -1
  180. package/dist/chunks/adapter-pp011m5x.js +0 -4
  181. package/dist/chunks/add-new-flow-ecqmzz76.js +0 -4
  182. package/dist/chunks/cf-account-picker-c07znkqt.js +0 -4
  183. package/dist/chunks/cf-settings-0v2bmqy0.js +0 -4
  184. package/dist/chunks/components-yn0dn2pq.js +0 -4
  185. package/dist/chunks/content-source-g0j41yy6.js +0 -4
  186. package/dist/chunks/convert-to-repeater-sbjk7tgn.js +0 -4
  187. package/dist/chunks/editor-xz02jeh1.js +0 -4
  188. package/dist/chunks/entry-commands-kmt02crp.js +0 -4
  189. package/dist/chunks/extension-sections-0rprf12d.js +0 -4
  190. package/dist/chunks/file-ops-mexj5qed.js +0 -4
  191. package/dist/chunks/files-b2tcppdd.js +0 -4
  192. package/dist/chunks/format-host-btsevv0c.js +0 -4
  193. package/dist/chunks/fs-events-r0apejva.js +0 -4
  194. package/dist/chunks/grid-open-n2a8xkht.js +0 -4
  195. package/dist/chunks/icons-853n6qt3.js +0 -4
  196. package/dist/chunks/iframe-host-gx0ypyh3.js +0 -4
  197. package/dist/chunks/index-bs4k9tr6.js +0 -4
  198. package/dist/chunks/jx-validate-ymf10teh.js +0 -4
  199. package/dist/chunks/layers-p9nfya38.js +0 -4
  200. package/dist/chunks/layers-panel-tt1hzhhf.js +0 -4
  201. package/dist/chunks/lit-html-x18n2sfz.js +0 -4
  202. package/dist/chunks/media-library-0n45gv8r.js +0 -4
  203. package/dist/chunks/media-picker-s09at95z.js +0 -4
  204. package/dist/chunks/monaco-buffer-een2ea0v.js +0 -4
  205. package/dist/chunks/notify-qwb8radt.js +0 -4
  206. package/dist/chunks/parse-v77xtwv7.js +0 -4
  207. package/dist/chunks/platform-8jnez0wr.js +0 -4
  208. package/dist/chunks/publish-panel-aysnj611.js +0 -4
  209. package/dist/chunks/publish-quick-kpbqs9mz.js +0 -4
  210. package/dist/chunks/publish-workspace-nd0a8q99.js +0 -4
  211. package/dist/chunks/quick-search-vg0jkhk2.js +0 -4
  212. package/dist/chunks/references-a7v6a0e2.js +0 -4
  213. package/dist/chunks/right-panel-cvk1vxx5.js +0 -4
  214. package/dist/chunks/source-control-fsqzc6he.js +0 -4
  215. package/dist/chunks/studio-05jfwbmf.js +0 -5
  216. package/dist/chunks/studio-0q5jwddh.js +0 -9
  217. package/dist/chunks/studio-0w2dr0q8.js +0 -5
  218. package/dist/chunks/studio-1tzpds97.js +0 -9
  219. package/dist/chunks/studio-216b27sv.js +0 -4
  220. package/dist/chunks/studio-2ejhqns4.js +0 -5
  221. package/dist/chunks/studio-2r90cts3.js +0 -16
  222. package/dist/chunks/studio-399xknkb.js +0 -6
  223. package/dist/chunks/studio-4ncmwqw5.js +0 -5
  224. package/dist/chunks/studio-5atwjgkj.js +0 -7
  225. package/dist/chunks/studio-5frqk7c0.js +0 -5
  226. package/dist/chunks/studio-6cwj6xrx.js +0 -5
  227. package/dist/chunks/studio-78pywnp2.js +0 -6
  228. package/dist/chunks/studio-886t6ztg.js +0 -5
  229. package/dist/chunks/studio-8wnvtr4z.js +0 -5
  230. package/dist/chunks/studio-8z66jk4z.js +0 -5
  231. package/dist/chunks/studio-b2qpt0xy.js +0 -14
  232. package/dist/chunks/studio-c71806xz.js +0 -7
  233. package/dist/chunks/studio-cbwks69x.js +0 -928
  234. package/dist/chunks/studio-cg710sk9.js +0 -5
  235. package/dist/chunks/studio-cw0wb9qk.js +0 -7
  236. package/dist/chunks/studio-cyheys7k.js +0 -5
  237. package/dist/chunks/studio-ea5m9kg5.js +0 -5
  238. package/dist/chunks/studio-efdxjwyp.js +0 -64
  239. package/dist/chunks/studio-egmw2837.js +0 -5
  240. package/dist/chunks/studio-f746039f.js +0 -5
  241. package/dist/chunks/studio-fmdymd9v.js +0 -5
  242. package/dist/chunks/studio-gcm12z00.js +0 -6
  243. package/dist/chunks/studio-gj98m8gy.js +0 -7
  244. package/dist/chunks/studio-hasbgjah.js +0 -5
  245. package/dist/chunks/studio-hz5n7x27.js +0 -5
  246. package/dist/chunks/studio-jeraxdgv.js +0 -7
  247. package/dist/chunks/studio-jvgek9xt.js +0 -5
  248. package/dist/chunks/studio-jws1a87n.js +0 -5
  249. package/dist/chunks/studio-k2sz13zg.js +0 -5
  250. package/dist/chunks/studio-k3m4jkdk.js +0 -5
  251. package/dist/chunks/studio-kg5ya5r2.js +0 -5
  252. package/dist/chunks/studio-khwbgrtg.js +0 -5
  253. package/dist/chunks/studio-mx6wzh25.js +0 -5
  254. package/dist/chunks/studio-mxs3ar9t.js +0 -5
  255. package/dist/chunks/studio-nm4szey4.js +0 -5
  256. package/dist/chunks/studio-nqxqf8p2.js +0 -4
  257. package/dist/chunks/studio-qn7z4krm.js +0 -5
  258. package/dist/chunks/studio-qyed0ah6.js +0 -5
  259. package/dist/chunks/studio-r4bcdwhq.js +0 -5
  260. package/dist/chunks/studio-rtfnhrdg.js +0 -5
  261. package/dist/chunks/studio-s5tzw84t.js +0 -5
  262. package/dist/chunks/studio-t51y8v1d.js +0 -5
  263. package/dist/chunks/studio-t98vq4r6.js +0 -5
  264. package/dist/chunks/studio-tsxpqvh0.js +0 -6
  265. package/dist/chunks/studio-v1yascv2.js +0 -5
  266. package/dist/chunks/studio-wxq6v5sv.js +0 -5
  267. package/dist/chunks/studio-y60sts62.js +0 -4
  268. package/dist/chunks/studio-zndrqawb.js +0 -5
  269. package/dist/chunks/studio-zwaxn5s2.js +0 -5
  270. package/dist/chunks/workspace-home-x1787wpv.js +0 -4
  271. package/dist/chunks/workspace-zpe1np43.js +0 -4
@@ -0,0 +1,5 @@
1
+ import{rt,Eo,xr,zp}from"./studio-g9brbewz.js";function hb(){return Eo(rt.cfToken)}function AE(t){xr(rt.cfToken,t||"")}function OE(){return Eo(rt.cfAccountId)}function dF(t){xr(rt.cfAccountId,t||"")}function ME(){zp([rt.cfToken,rt.cfAccountId])}
2
+ export{hb,AE,OE,dF,ME};
3
+
4
+ //# debugId=C45832926A8EF0DB64756E2164756E21
5
+ //# sourceMappingURL=studio-k1xqrgm5.js.map
@@ -0,0 +1,7 @@
1
+ import{X}from"./studio-9c6cbq2c.js";import{w}from"./studio-sce30r7b.js";import{Jt,Ut}from"./studio-nzemfbkk.js";import{sn,dt}from"./studio-tpxcryf2.js";import{Ve,vt,E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";var _={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGithubAuth",$description:"The RFC 8628 device flow's waiting room: the code GitHub minted, the page to type it into, and a Cancel. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop — and it is the reason the dialog has no confirm button at all: the answer arrives from GitHub over a poll rather than from anything the reader can press here, so a primary button would be a control with nothing to do. Nothing in this document talks to GitHub: `github/github-auth.ts` keeps the client id, the poll loop, its failure budget and every report the three outcomes raise.",tagName:"jx-dialog",$props:{headline:"Sign in to GitHub",confirmLabel:"",cancelLabel:"Cancel",size:"sm"},attributes:{part:"github-auth"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"Four `.github-auth-*` rules in `styles/overlays.css` become the parts below, and two things in them do not travel. `.github-auth-dialog`'s `padding: 16px 0` was the card's own body padding drawn by hand, and `jx-dialog` already pads its body; `.github-auth-dialog p { font-size: 13px }` was a body size this surface picked for itself, and what the paragraphs now inherit is the dialog's own `--jx-text-md`. The `8px 0` margins go with them — the column is a flex column with a gap, so a margin between two rows would be a second opinion about the same space. The code keeps its 24px, which is above the token scale on purpose: it is a string the reader has to copy onto another screen, and reading it out loud is the whole job of this dialog.",'& [part="device"]':{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",textAlign:"center"},'& [part="lede"], & [part="waiting"]':{margin:"0"},'& [part="code"]':{$description:"`<code>`, not a styled `<div>`: this is a literal string to be transcribed, and the element that says so is also the one a reader's own stylesheet and a screen reader's character-by-character mode already know about. It is this dialog's message, and the one string in it the reader must carry to another screen, so it opts back in to selection against the root's `user-select: none`. `all` rather than `text`: one click selects the whole code, so a copy never leaves a character behind.",userSelect:"all",fontFamily:"var(--font-mono)",fontSize:"24px",fontWeight:"700",letterSpacing:"2px",padding:"var(--jx-space-3) var(--jx-space-4)",background:"var(--hover-bg)",borderRadius:"var(--radius)"},'& [part="link"]':{$description:"The blue this carried as a `var(--accent, …)` fallback is gone: `--accent` is declared on `:root` in `styles/tokens.css`, so the fallback could only ever have painted when the token was missing — which is a theme fault to fix rather than a colour to hard-code.",color:"var(--accent)",textDecoration:"underline"},'& [part="waiting"]':{color:"var(--fg-dim)",fontStyle:"italic"}},children:[{tagName:"div",attributes:{part:"device"},children:[{tagName:"p",attributes:{part:"lede"},textContent:"Enter this code on GitHub to authorize Jx Studio:"},{tagName:"code",attributes:{part:"code"},textContent:"${state.userCode}"},{tagName:"a",attributes:{part:"link",href:"${state.verificationUri}",target:"_blank",rel:"noreferrer"},textContent:"Open ${state.verificationUri}"},{tagName:"p",attributes:{part:"waiting"},textContent:"Waiting for authorization…"}]}]};E("github-auth",_);function A(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ve,vt("dialog","github-auth")),e.layer.append(t);let s=!1,l=()=>{if(s)return;s=!0,e.onClosed()},u=()=>s,b=g({cancel:()=>{e.onCancel()},closed:l,userCode:e.userCode,verificationUri:e.verificationUri}),n=null,r=R("github-auth",b,t).then(async(i)=>{n=i;let o=i.root;if(u())return i.dispose(),o;if(await sn(o),u())return o;return Jt(o),o});return{close(){let i=n?.root;if(i instanceof HTMLElement)Ut(i);n?.dispose(),n=null,t.remove(),l()},host:t,ready:r}}var S="jx_github_token",v="Ov23liYVlMFpgjOEPXJH";function P(e){return typeof e==="object"&&e!==null&&"githubAuth"in e&&e.githubAuth!=null}function p(){let e=globalThis,t="__jxPlatform"in e?e.__jxPlatform:void 0;return P(t)?t.githubAuth:null}var f=null,C=!1;function H(e){f=e}function vL(){return f!==null||C||localStorage.getItem("jx_github_token")!==null}function yL(){return p()?"desktop":"browser"}function y(){return f??localStorage.getItem("jx_github_token")}function wL(){f=null,C=!1,localStorage.removeItem("jx_github_token"),p()?.signOut().catch(()=>{})}var O="github.auth",j="Source Control",N="git.signInToGithub",Y=3,z="The request never reached GitHub. GitHub's device-flow endpoints send no CORS headers, so a "+"browser cannot call them directly — the desktop app can. A machine that is offline fails "+"identically, and the browser does not say which happened.";function I(e){w.error("Could not reach GitHub to sign in.",{action:N,detail:`${z}
2
+
3
+ ${X(e)}`,key:O,source:j})}function T(e,t){w.warn(e,{action:N,detail:t,key:O,source:j})}async function F(){let e;try{e=await fetch("https://github.com/login/device/code",{body:JSON.stringify({client_id:v,scope:"repo"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})}catch(t){return I(t),null}if(!e.ok)return T("GitHub refused to start the sign-in.",`GitHub answered ${e.status}${e.statusText?` ${e.statusText}`:""}.`),null;return await e.json()}async function ZS(){let e=y();if(e)return e;let t=p();if(t)try{let{token:r}=await t.signIn();return H(r),r}catch(r){return T("GitHub sign-in was not completed.",X(r)),null}let s=await F();if(!s)return null;let{device_code:l,user_code:u,verification_uri:b,interval:n=5}=s;return new Promise((r)=>{let i=!1,o=null,m=0,k=!1,L=(c)=>{if(k)return;if(k=!0,i=!0,o)clearTimeout(o),o=null;r(c)},x=!1,G=()=>{if(x)return;x=!0,D.close()},d=(c)=>{L(c),G()},h=async()=>{if(i)return;try{let a=await(await fetch("https://github.com/login/oauth/access_token",{body:JSON.stringify({client_id:v,device_code:l,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})).json();if(m=0,a.access_token){localStorage.setItem(S,a.access_token),d(a.access_token);return}if(a.error==="authorization_pending"){o=setTimeout(h,n*1000);return}if(a.error==="slow_down"){o=setTimeout(h,(n+5)*1000);return}T("GitHub sign-in was not completed.",a.error==="access_denied"?"The authorization was declined on GitHub.":a.error==="expired_token"?"The device code expired before it was entered.":`GitHub answered "${a.error??"an unrecognised response"}".`),d(null)}catch(c){if(m+=1,m>=Y){I(c),d(null);return}o=setTimeout(h,n*1000)}},D=A({layer:dt("dialog"),onCancel:()=>{G()},onClosed:()=>{d(null)},userCode:u,verificationUri:b});o=setTimeout(h,n*1000)})}
4
+ export{vL,yL,wL,ZS};
5
+
6
+ //# debugId=A116AF93B212CC5864756E2164756E21
7
+ //# sourceMappingURL=studio-k2evngrj.js.map
@@ -0,0 +1,5 @@
1
+ function n(e){return typeof e==="string"}function Y(e){return typeof e==="number"}function Ze(e){return typeof e==="boolean"}function x2(e){return typeof e==="bigint"}function Gv(e){return typeof e==="symbol"}function Q(e){return typeof e==="function"}function _(e){return typeof e==="object"&&e!==null}function wf(e){return e===null||n(e)||Y(e)||Ze(e)}function v(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Pe(e){return v(e)&&typeof e.$ref==="string"}function Ha(e){return v(e)&&e.$prototype==="Function"}function lc(e){return v(e)&&v(e.$expression)}function E0(e){return lc(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function oR(e){return Ha(e)&&Array.isArray(e.body)}function Kv(e){return v(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function rR(e){return v(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Go(e){return v(e)&&e.$prototype==="Array"}function Jn(e){return v(e)}function Ba(e){return typeof e==="string"&&e.includes("${")}function sR(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(e)}function xl(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Di(e,t){let r=e?.[t];return xl(r)?r:void 0}function ld(e,t){let r=e[t];if(xl(r))return r;let o={};return e[t]=o,o}function xf(e){return Pe(e)||Ha(e)||lc(e)}function pg(e,t){let r=e[t];return xf(r)?r:void 0}function T0(e){if(!e)return[];return e.map((t)=>n(t)?t:t.name)}function i(e){return typeof e==="string"}function jh(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!v(e.$expression))return!1;let t=e.$expression;if(t.operator==="?:")return typeof t.value==="string"&&typeof t.initial==="string";if(t.operator==="switch")return v(t.cases)&&Object.values(t.cases).every((r)=>n(r))&&typeof t.default==="string";return!1}function aR(e){if(i(e))return[e];if(!jh(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}function it(e){return i(e)?e:aR(e).join("|")}function cd(e){return e.startsWith("#")}
2
+ export{n,Y,Ze,x2,Gv,Q,_,wf,v,Pe,Ha,lc,E0,oR,Kv,rR,Go,Jn,Ba,sR,xl,Di,ld,xf,pg,T0,jh,aR,it,cd};
3
+
4
+ //# debugId=A0E20505ACB400C964756E2164756E21
5
+ //# sourceMappingURL=studio-k3we3kqb.js.map
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-jws1a87n.js";import{S}from"./studio-cg710sk9.js";import{n,Z,_,v}from"./studio-8z66jk4z.js";function y(e,o=[]){if(!v(e))return o;let{children:t}=e;if(e.tagName==="slot"){let s=e.attributes,r=v(s)?s.name:void 0,l={name:n(r)?r.trim():""};if(Array.isArray(t)&&t.length>0)l.fallback=t;o.push(l)}if(Array.isArray(t))for(let s of t)y(s,o);return o}function YS(e,o=new Set){if(!v(e))return o;let t=(i)=>{if(v(i)){if(n(i.tagName)&&i.tagName.includes("-"))o.add(i.tagName);YS(i,o)}},{cases:s,children:r,map:l}=e,a=[...Array.isArray(r)?r:[r],l];if(v(s))a.push(...Object.values(s));for(let i of a)t(i);return o}function h(e){if(n(e))return"string";return Z(e)?"number":"boolean"}function x(e,o){if(o==null)return null;if(!_(o))return{default:o,name:e,type:h(o)};let t=v(o)?o:{};if(t.$prototype||t.$handler||t.$compute)return null;return{default:t.default,format:t.format,name:e,type:t.type}}function ZS(e,o){if(!v(e))return null;let{tagName:t}=e;if(!n(t)||!t.includes("-"))return null;let s=y(e),r=e.state,l=v(r)||Array.isArray(r)||n(r)?Object.entries(r):[],a={$id:n(e.$id)&&e.$id?e.$id:null,hasElements:Array.isArray(e.$elements)&&e.$elements.length>0,path:o,props:l.flatMap(([u,f])=>{let m=x(u,f);return m===null?[]:[m]})};if(s.length>0)a.slots=s;let i=[...YS(e)].filter((u)=>u!==t).toSorted();if(i.length>0)a.uses=i;return{...a,tagName:t}}var Ne=[],Zw=!1,g=0,b=Promise.resolve();function xa(){g+=1;let e=g,o=(async()=>{let t=null;try{t=await p().discoverComponents(S?.projectRoot||void 0)}catch{t=null}if(e!==g){await b;return}if(t)Ne=t;Zw=!0})();return b=o,o}function Fb(e,o){if(!e)return!1;let t=Ne.findIndex((l)=>l.path===e),s=ZS(o,e);if(!s){if(t===-1)return!1;return Ne.splice(t,1),!0}let r=s;if(t===-1)Ne.push(r);else Ne[t]=r;return!0}function Hc(e){let o=Object.fromEntries((e.props??[]).map((r)=>[r.name,r.default!==void 0?r.default:""])),t=[];for(let r of e.slots??[])for(let l of structuredClone(r.fallback??[]))if(!r.name)t.push(l);else if(_(l)&&n(l.tagName))l.attributes={slot:r.name,...l.attributes},t.push(l);else t.push({attributes:{slot:r.name},children:[l],tagName:"span"});let s={$props:o,tagName:e.tagName};if(t.length>0)s.children=t;return s}function c(e){let o=[];for(let t of e){if(t===".")continue;if(t===".."&&o.length>0&&o.at(-1)!=="..")o.pop();else o.push(t)}return o}function Bc(e,o,t=S?.projectRoot??null){if(!e)return`./${o}`;let s=e.replaceAll("\\","/"),r=o.replaceAll("\\","/"),l=s.includes("/")?s.slice(0,s.lastIndexOf("/")):"",a=c(l.split("/").filter(Boolean)),i=c(r.split("/").filter(Boolean));if(a[0]===".."&&t){let d=t.replaceAll("\\","/").split("/").filter(Boolean);a=c([...d,...a]),i=c([...d,...i])}let u=0;while(u<a.length&&u<i.length&&a[u]===i[u])u+=1;let f=a.length-u,m=i.slice(u);return(f>0?"../".repeat(f):"./")+m.join("/")}
2
- export{YS,ZS,Ne,Zw,xa,Fb,Hc,Bc};
1
+ import{p}from"./studio-4fnb5648.js";import{C}from"./studio-4f7thq0p.js";import{n,Y,_,v}from"./studio-k3we3kqb.js";function y(e,o=[]){if(!v(e))return o;let{children:t}=e;if(e.tagName==="slot"){let s=e.attributes,r=v(s)?s.name:void 0,l={name:n(r)?r.trim():""};if(Array.isArray(t)&&t.length>0)l.fallback=t;o.push(l)}if(Array.isArray(t))for(let s of t)y(s,o);return o}function MC(e,o=new Set){if(!v(e))return o;let t=(i)=>{if(v(i)){if(n(i.tagName)&&i.tagName.includes("-"))o.add(i.tagName);MC(i,o)}},{cases:s,children:r,map:l}=e,a=[...Array.isArray(r)?r:[r],l];if(v(s))a.push(...Object.values(s));for(let i of a)t(i);return o}function h(e){if(n(e))return"string";return Y(e)?"number":"boolean"}function x(e,o){if(o==null)return null;if(!_(o))return{default:o,name:e,type:h(o)};let t=v(o)?o:{};if(t.$prototype||t.$handler||t.$compute)return null;return{default:t.default,format:t.format,name:e,type:t.type}}function PC(e,o){if(!v(e))return null;let{tagName:t}=e;if(!n(t)||!t.includes("-"))return null;let s=y(e),r=e.state,l=v(r)||Array.isArray(r)||n(r)?Object.entries(r):[],a={$id:n(e.$id)&&e.$id?e.$id:null,hasElements:Array.isArray(e.$elements)&&e.$elements.length>0,path:o,props:l.flatMap(([u,f])=>{let m=x(u,f);return m===null?[]:[m]})};if(s.length>0)a.slots=s;let i=[...MC(e)].filter((u)=>u!==t).toSorted();if(i.length>0)a.uses=i;return{...a,tagName:t}}var Ne=[],wx=!1,g=0,b=Promise.resolve();function Ea(){g+=1;let e=g,o=(async()=>{let t=null;try{t=await p().discoverComponents(C?.projectRoot||void 0)}catch{t=null}if(e!==g){await b;return}if(t)Ne=t;wx=!0})();return b=o,o}function ev(e,o){if(!e)return!1;let t=Ne.findIndex((l)=>l.path===e),s=PC(o,e);if(!s){if(t===-1)return!1;return Ne.splice(t,1),!0}let r=s;if(t===-1)Ne.push(r);else Ne[t]=r;return!0}function Uc(e){let o=Object.fromEntries((e.props??[]).map((r)=>[r.name,r.default!==void 0?r.default:""])),t=[];for(let r of e.slots??[])for(let l of structuredClone(r.fallback??[]))if(!r.name)t.push(l);else if(_(l)&&n(l.tagName))l.attributes={slot:r.name,...l.attributes},t.push(l);else t.push({attributes:{slot:r.name},children:[l],tagName:"span"});let s={$props:o,tagName:e.tagName};if(t.length>0)s.children=t;return s}function c(e){let o=[];for(let t of e){if(t===".")continue;if(t===".."&&o.length>0&&o.at(-1)!=="..")o.pop();else o.push(t)}return o}function qc(e,o,t=C?.projectRoot??null){if(!e)return`./${o}`;let s=e.replaceAll("\\","/"),r=o.replaceAll("\\","/"),l=s.includes("/")?s.slice(0,s.lastIndexOf("/")):"",a=c(l.split("/").filter(Boolean)),i=c(r.split("/").filter(Boolean));if(a[0]===".."&&t){let d=t.replaceAll("\\","/").split("/").filter(Boolean);a=c([...d,...a]),i=c([...d,...i])}let u=0;while(u<a.length&&u<i.length&&a[u]===i[u])u+=1;let f=a.length-u,m=i.slice(u);return(f>0?"../".repeat(f):"./")+m.join("/")}
2
+ export{MC,PC,Ne,wx,Ea,ev,Uc,qc};
3
3
 
4
- //# debugId=049116082B36BF1564756E2164756E21
5
- //# sourceMappingURL=studio-sevbc3xv.js.map
4
+ //# debugId=78FC07363A98994D64756E2164756E21
5
+ //# sourceMappingURL=studio-n9qba0gx.js.map
@@ -1,5 +1,5 @@
1
- import{p,_e}from"./studio-jws1a87n.js";import{ae}from"./studio-b2qpt0xy.js";import{CA}from"./studio-hhp4x8xf.js";import{C}from"./studio-y60sts62.js";import{ei}from"./studio-0w2dr0q8.js";import{Q}from"./studio-nqxqf8p2.js";import{SO,Vn,Ce,pi}from"./studio-k2sz13zg.js";import{Lm,u}from"./studio-2r90cts3.js";import{Ul,Eb,Ri,Od,SS}from"./studio-cw0wb9qk.js";import{Us}from"./studio-0q5jwddh.js";import{ks,Vs,cT}from"./studio-zwaxn5s2.js";import{as}from"./studio-kg5ya5r2.js";import{S}from"./studio-cg710sk9.js";import{le}from"./studio-j3d2fjqz.js";var k={attempts:6,delayMs:5000};function A(e,t){return`https://dash.cloudflare.com/${e}/pages/view/${t}`}async function B(e){if(e>0)await new Promise((t)=>{setTimeout(t,e)})}async function y(e={}){let t=Ri(),r=new AbortController,i=Us({cancel:()=>{r.abort()},source:"Publish",status:"Starting…",steps:["Push to the remote","Ask Cloudflare for the deployment"],title:"Deploy"});i.step("Push to the remote");try{await p().gitPush({setUpstream:!0}),i.log("Pushed the current branch.")}catch(s){return i.log(Q(s)),i.fail("Could not push to the remote.",{action:"git.push"}),!1}if(!t)return i.done("Pushed. No provider is connected, so nothing was asked to build it."),!0;i.step("Ask Cloudflare for the deployment");let n=e.attempts??k.attempts,l=e.delayMs??k.delayMs;for(let s=0;s<n;s+=1){if(r.signal.aborted)return!1;let a;try{a=await Eb(t)}catch(o){return i.log(Q(o)),i.fail("Cloudflare did not answer.",{action:"publish.deploy"}),!1}if(a)return Od(a),i.log(`${a.stage}: ${a.status} — ${a.url}`),i.done(`${a.stage}: ${a.status}`),!0;await B(l)}if(r.signal.aborted)return!1;return Od(null),i.done("Pushed. Cloudflare has not reported a deployment yet."),!0}function q(){return[{category:"Publish",id:"publish.setUp",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"an open project on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>e.capability.publish,run:async()=>{let{openPublishPanel:e}=await (le("aysnj611"),import("./publish-panel-aysnj611.js"));e()},title:"Set Up Publishing"},{category:"Publish",id:"publish.deploy",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a repository with a remote and a connected deploy provider, on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>e.project.isRepo&&Ri()!==void 0&&e.capability.publish,run:async()=>{await y()},title:"Deploy"},{category:"Publish",id:"publish.openDashboard",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a connected deploy provider, on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>Ri()!==void 0&&e.capability.publish,run:()=>{let e=Ri();if(e)window.open(A(e.accountId,e.projectName),"_blank","noopener")},title:"Open Deployment Dashboard"},{category:"Publish",id:"publish.quick",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a project tracked by git",when:(e)=>e.project.open,enablement:(e)=>e.project.isRepo,run:async()=>{let{openQuickPublish:e}=await (le("kpbqs9mz"),import("./publish-quick-kpbqs9mz.js"));e()},title:"Quick Publish"},{args:Ce({tab:pi(Lm,"Which view of the Publish workspace to show: review (the changes and where they go), deploys (the live site and its deployments), branches, or hosting (where the project is saved and hosted). Defaults to the view the workspace was left on.")},[]),category:"Publish",id:"publish.open",level:"project",menus:["never"],group:"8_publish",requires:"an open project",enablement:(e)=>e.project.open,run:async(e,t)=>{let r=t.tab===void 0?null:Vn("publish.open",t,"tab",Lm),i=ae();if(!i)throw Error(`command "publish.open" needs the window's command registry`);if(await i.run("view.setWorkspace",{workspace:"publish"}),r!==null){let{showPublishTab:n}=await (le("nd0a8q99"),import("./publish-workspace-nd0a8q99.js"));n(r)}},title:"Show Publish"}]}function aR(e){e.registerAll(q())}function d(){let e=u.git.status?.remotes;return Array.isArray(e)&&e.length>0?e[0]??"":""}function h(){return u.git.branches?.current||u.git.status?.branch||""}function P(){return Ri()!==void 0&&Ul()&&d()!==""}function R(){let e=Ri();return e?.productionUrl??e?.projectName??""}function b(e){return`studio/${as(e).replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"").slice(0,48).replace(/-$/,"")||"changes"}`}function x(){return _e()&&p().gitCommitBranch!==void 0}function v(){let e=f();return Vs()&&x()&&e!==""&&h()===e}function f(){return u.git.branches?.defaultBranch??""}function zg(){if(!cT())return"This host cannot open a pull request yet. Publish live, or create a branch under Branches and push it.";if(Vs()){let e=f(),t=h();if(v())return"";if(!e||!t||t===e)return`Every commit to ${e||"the default branch"} on this host is live. Create a branch under Branches and send it for review from there.`;return""}if(d()==="")return"A pull request needs a remote. Create the GitHub repository under Hosting first.";return""}function T(){let e=h()||"the current branch";if(P())return`Commits to ${e} and deploys to ${R()}.`;if(Vs())return`Commits to ${e} on GitHub.`;let t=d();return t?`Commits to ${e} and pushes it to ${t}.`:`Commits to ${e}. This repository has no remote, so nothing leaves this machine.`}function M(){let e=h()||"the current branch",t=u.git.commitMessage.trim(),r=t?b(t):"a new studio/ branch";if(v())return`Saves to ${r} on GitHub and opens a pull request into ${e}.`;if(Vs())return`Commits to ${e} and opens a pull request from it into ${f()||"the default branch"}.`;return`Saves to ${r}, pushes it and opens a pull request into ${e}.`}function Ty(e){let t=zg();return[{checked:e==="live"?"true":"false",disabled:!1,label:"Publish live",note:T(),reason:"",value:"live"},{checked:e==="review"?"true":"false",disabled:t!=="",label:"Send for review",note:M(),reason:t,value:"review"}]}function Kf(e){return e==="review"&&zg()!==""?"live":e}function lR(e){if(e==="review")return"Send for review";if(P())return"Publish live";return Vs()||d()!==""?"Commit and push":"Commit"}function D(e){let t=u.git.status?.files??[];return e?t:t.filter((r)=>Boolean(r.staged))}function Jf(e,t=!1){let{status:r}=u.git;if(!S||!r?.isRepo)return"Track this project with git first.";if(u.git.loading)return"Source control is busy.";if(r.files.length===0)return"There is nothing to publish.";if(D(t).length===0)return"Include at least one change.";if(!u.git.commitMessage.trim())return"Write a summary of the change first.";return e==="review"?zg():""}function j(){return(u.git.status?.files??[]).map((e)=>`${e.status}:${e.path}`).join("|")}function s_(){return _e()&&p().buildSite!==void 0}async function cR(){if(!s_()||u.publish.build.state==="running")return;let e=p().buildSite;if(!e)return;u.publish.build.state="running",u.publish.build.text="Building the site…",u.publish.build.for=j();try{let t=await e();if(t.errors.length>0)u.publish.build.state="failed",u.publish.build.text=`Built with ${t.errors.length} error(s): ${t.errors[0]}`;else u.publish.build.state="passed",u.publish.build.text=t.mode==="live"?`${t.routes} page(s) render. This host previews the working tree; it does not build.`:`Site builds: ${t.routes} page(s).`}catch(t){u.publish.build.state="failed",u.publish.build.text=`The site could not be built: ${Q(t)}`}}function Wg(){let e=[],t=SS();if(e.push(t?{command:t.command,key:"deploy",state:t.state==="unknown"?"unknown":"todo",text:`${t.label}: ${t.detail}`}:{command:"",key:"deploy",state:"done",text:"Everything this project needs to ship is in place."}),s_()){let r=u.publish.build.for===j()||u.publish.build.state==="running";e.push(r&&u.publish.build.state!=="idle"?{command:"",key:"build",state:u.publish.build.state==="passed"?"done":u.publish.build.state==="failed"?"failed":"running",text:u.publish.build.text}:{command:"",key:"build",state:"unknown",text:"The site has not been built with these changes."})}return e}function dR(e){let t=e.filter((r)=>r.state!=="done");if(t.length===0)return"Checks passed: ready to publish.";return t.map((r)=>r.text).join(" · ")}function uR(){return u.publish.review.number>0?{number:u.publish.review.number,url:u.publish.review.url}:null}function w(e){if(!u.git.commitMessage)u.git.commitMessage=e}async function Ly(e,t={}){let r=t.includeAll??!1,i=Jf(e,r);if(i)return u.git.error=i,!1;let n=u.git.commitMessage.trim(),l=p();u.git.commitMessage="",u.git.loading=!0,u.git.error=null,await SO();let s=!1,a=!0;try{if(r){let o=D(!0).filter((c)=>!c.staged).map((c)=>c.path);if(o.length>0)await l.gitStage(o)}if(e==="review")await L(l,n,()=>{s=!0});else if(await l.gitCommit(n),s=!0,P())u.git.loading=!1,a=await y();else if(!Vs()&&d()!=="")await l.gitPush();return await ks(),a}catch(o){let c=s?null:CA(o);if(c&&x()){if(u.git.loading=!1,await G(n,c))return!0;return u.git.error??=Q(o),!1}if(u.git.error=Q(o),u.git.loading=!1,!s)w(n);return!1}}function _(e){let t=e.slice(0,3).join(", ");return e.length>3?`${t} and ${e.length-3} more`:t}async function G(e,t){let r=p(),i=r.gitCommitBranch;if(!i)return!1;let n=h()||"this branch",l=t.length===1?"1 file":`${t.length} files`,s=await ei("Publish to a New Branch",{confirmLabel:"Publish to branch",message:`${n} changed on GitHub after these edits began, and ${l} changed on both sides (${_(t)}). Publish your changes to a branch of their own instead, and a pull request will bring them into ${n}.`,value:b(e),validate:(o)=>o.trim()?"":"Enter a branch name."});if(!s)return w(e),!1;u.git.loading=!0,u.git.error=null;let a=!1;try{let o=await i({branch:s,message:e});a=!0;let c=r.createPullRequest,g=h(),m=c&&g?await c({base:g,head:o.branch,title:e}):null;if(m)u.publish.review.number=m.number,u.publish.review.url=m.url;C.success(m?`Published to ${o.branch}. Pull request #${m.number} brings it into ${g}.`:`Published to ${o.branch}.`,{detail:m?.url??"",key:"publish.branch",source:"Publish"});try{await r.gitPull()}catch{}return await ks(),!0}catch(o){if(u.git.error=Q(o),u.git.loading=!1,!a)w(e);return!1}}async function H(e,t,r){if(v()&&e.gitCommitBranch){let l=h(),{branch:s}=await e.gitCommitBranch({branch:b(t),message:t});return r(),{base:l,head:s,title:t}}if(Vs()){await e.gitCommit(t),r();let l=f();return l?{base:l,title:t}:{title:t}}let i=h(),n=b(t);return await e.gitCreateBranch(n),await e.gitCommit(t),r(),await e.gitPush({setUpstream:!0}),i?{base:i,head:n,title:t}:{head:n,title:t}}async function L(e,t,r){let i=e.createPullRequest;if(!i)throw Error(zg());let n=await i(await H(e,t,r));u.publish.review.number=n.number,u.publish.review.url=n.url,C.success(`Pull request #${n.number} opened for review.`,{detail:n.url,key:"publish.review",source:"Publish"})}
2
- export{aR,zg,Ty,Kf,lR,Jf,s_,cR,Wg,dR,uR,Ly};
1
+ import{p,ye}from"./studio-4fnb5648.js";import{ae}from"./studio-wqfaqw4m.js";import{hA}from"./studio-xpx91fby.js";import{w}from"./studio-sce30r7b.js";import{Fn}from"./studio-tpxcryf2.js";import{X}from"./studio-9c6cbq2c.js";import{iM,qn,Se,pi}from"./studio-yrcrncev.js";import{Bm,u}from"./studio-x0gsfr1d.js";import{Zl,Hb,Ri,jd,nC}from"./studio-stahswgb.js";import{qs}from"./studio-a65kbs2e.js";import{ds}from"./studio-y1b86ast.js";import{ks,Us,QT}from"./studio-8kx6m0rg.js";import{C}from"./studio-4f7thq0p.js";import{ce}from"./studio-0939t1q1.js";var x={attempts:6,delayMs:5000};function B(e,t){return`https://dash.cloudflare.com/${e}/pages/view/${t}`}async function S(e){if(e>0)await new Promise((t)=>{setTimeout(t,e)})}async function y(e={}){let t=Ri(),r=new AbortController,i=qs({cancel:()=>{r.abort()},source:"Publish",status:"Starting…",steps:["Push to the remote","Ask Cloudflare for the deployment"],title:"Deploy"});i.step("Push to the remote");try{await p().gitPush({setUpstream:!0}),i.log("Pushed the current branch.")}catch(s){return i.log(X(s)),i.fail("Could not push to the remote.",{action:"git.push"}),!1}if(!t)return i.done("Pushed. No provider is connected, so nothing was asked to build it."),!0;i.step("Ask Cloudflare for the deployment");let n=e.attempts??x.attempts,l=e.delayMs??x.delayMs;for(let s=0;s<n;s+=1){if(r.signal.aborted)return!1;let a;try{a=await Hb(t)}catch(o){return i.log(X(o)),i.fail("Cloudflare did not answer.",{action:"publish.deploy"}),!1}if(a)return jd(a),i.log(`${a.stage}: ${a.status} — ${a.url}`),i.done(`${a.stage}: ${a.status}`),!0;await S(l)}if(r.signal.aborted)return!1;return jd(null),i.done("Pushed. Cloudflare has not reported a deployment yet."),!0}function q(){return[{category:"Publish",id:"publish.setUp",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"an open project on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>e.capability.publish,run:async()=>{let{openPublishPanel:e}=await (ce("gzfxcm0t"),import("./publish-panel-gzfxcm0t.js"));e()},title:"Set Up Publishing"},{category:"Publish",id:"publish.deploy",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a repository with a remote and a connected deploy provider, on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>e.project.isRepo&&Ri()!==void 0&&e.capability.publish,run:async()=>{await y()},title:"Deploy"},{category:"Publish",id:"publish.openDashboard",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a connected deploy provider, on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>Ri()!==void 0&&e.capability.publish,run:()=>{let e=Ri();if(e)window.open(B(e.accountId,e.projectName),"_blank","noopener")},title:"Open Deployment Dashboard"},{category:"Publish",id:"publish.quick",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a project tracked by git",when:(e)=>e.project.open,enablement:(e)=>e.project.isRepo,run:async()=>{let{openQuickPublish:e}=await (ce("w3nxd7q4"),import("./publish-quick-w3nxd7q4.js"));e()},title:"Quick Publish"},{args:Se({tab:pi(Bm,"Which view of the Publish workspace to show: review (the changes and where they go), deploys (the live site and its deployments), branches, or hosting (where the project is saved and hosted). Defaults to the view the workspace was left on.")},[]),category:"Publish",id:"publish.open",level:"project",menus:["never"],group:"8_publish",requires:"an open project",enablement:(e)=>e.project.open,run:async(e,t)=>{let r=t.tab===void 0?null:qn("publish.open",t,"tab",Bm),i=ae();if(!i)throw Error(`command "publish.open" needs the window's command registry`);if(await i.run("view.setWorkspace",{workspace:"publish"}),r!==null){let{showPublishTab:n}=await (ce("dppd82tc"),import("./publish-workspace-dppd82tc.js"));n(r)}},title:"Show Publish"}]}function FD(e){e.registerAll(q())}function d(){let e=u.git.status?.remotes;return Array.isArray(e)&&e.length>0?e[0]??"":""}function h(){return u.git.branches?.current||u.git.status?.branch||""}function v(){return Ri()!==void 0&&Zl()&&d()!==""}function R(){let e=Ri();return e?.productionUrl??e?.projectName??""}function b(e){return`studio/${ds(e).replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"").slice(0,48).replace(/-$/,"")||"changes"}`}function D(){return ye()&&p().gitCommitBranch!==void 0}function k(){let e=f();return Us()&&D()&&e!==""&&h()===e}function f(){return u.git.branches?.defaultBranch??""}function pb(){if(!QT())return"This host cannot open a pull request yet. Publish live, or create a branch under Branches and push it.";if(Us()){let e=f(),t=h();if(k())return"";if(!e||!t||t===e)return`Every commit to ${e||"the default branch"} on this host is live. Create a branch under Branches and send it for review from there.`;return""}if(d()==="")return"A pull request needs a remote. Create the GitHub repository under Hosting first.";return""}function T(){let e=h()||"the current branch";if(v())return`Commits to ${e} and deploys to ${R()}.`;if(Us())return`Commits to ${e} on GitHub.`;let t=d();return t?`Commits to ${e} and pushes it to ${t}.`:`Commits to ${e}. This repository has no remote, so nothing leaves this machine.`}function M(){let e=h()||"the current branch",t=u.git.commitMessage.trim(),r=t?b(t):"a new studio/ branch";if(k())return`Saves to ${r} on GitHub and opens a pull request into ${e}.`;if(Us())return`Commits to ${e} and opens a pull request from it into ${f()||"the default branch"}.`;return`Saves to ${r}, pushes it and opens a pull request into ${e}.`}function hw(e){let t=pb();return[{checked:e==="live"?"true":"false",disabled:!1,label:"Publish live",note:T(),reason:"",value:"live"},{checked:e==="review"?"true":"false",disabled:t!=="",label:"Send for review",note:M(),reason:t,value:"review"}]}function hm(e){return e==="review"&&pb()!==""?"live":e}function jD(e){if(e==="review")return"Send for review";if(v())return"Publish live";return Us()||d()!==""?"Commit and push":"Commit"}function j(e){let t=u.git.status?.files??[];return e?t:t.filter((r)=>Boolean(r.staged))}function pm(e,t=!1){let{status:r}=u.git;if(!C||!r?.isRepo)return"Track this project with git first.";if(u.git.loading)return"Source control is busy.";if(r.files.length===0)return"There is nothing to publish.";if(j(t).length===0)return"Include at least one change.";if(!u.git.commitMessage.trim())return"Write a summary of the change first.";return e==="review"?pb():""}function A(){return(u.git.status?.files??[]).map((e)=>`${e.status}:${e.path}`).join("|")}function X_(){return ye()&&p().buildSite!==void 0}async function HD(){if(!X_()||u.publish.build.state==="running")return;let e=p().buildSite;if(!e)return;u.publish.build.state="running",u.publish.build.text="Building the site…",u.publish.build.for=A();try{let t=await e();if(t.errors.length>0)u.publish.build.state="failed",u.publish.build.text=`Built with ${t.errors.length} error(s): ${t.errors[0]}`;else u.publish.build.state="passed",u.publish.build.text=t.mode==="live"?`${t.routes} page(s) render. This host previews the working tree; it does not build.`:`Site builds: ${t.routes} page(s).`}catch(t){u.publish.build.state="failed",u.publish.build.text=`The site could not be built: ${X(t)}`}}function fb(){let e=[],t=nC();if(e.push(t?{command:t.command,key:"deploy",state:t.state==="unknown"?"unknown":"todo",text:`${t.label}: ${t.detail}`}:{command:"",key:"deploy",state:"done",text:"Everything this project needs to ship is in place."}),X_()){let r=u.publish.build.for===A()||u.publish.build.state==="running";e.push(r&&u.publish.build.state!=="idle"?{command:"",key:"build",state:u.publish.build.state==="passed"?"done":u.publish.build.state==="failed"?"failed":"running",text:u.publish.build.text}:{command:"",key:"build",state:"unknown",text:"The site has not been built with these changes."})}return e}function BD(e){let t=e.filter((r)=>r.state!=="done");if(t.length===0)return"Checks passed: ready to publish.";return t.map((r)=>r.text).join(" · ")}function zD(){return u.publish.review.number>0?{number:u.publish.review.number,url:u.publish.review.url}:null}function P(e){if(!u.git.commitMessage)u.git.commitMessage=e}async function pw(e,t={}){let r=t.includeAll??!1,i=pm(e,r);if(i)return u.git.error=i,!1;let n=u.git.commitMessage.trim(),l=p();u.git.commitMessage="",u.git.loading=!0,u.git.error=null,await iM();let s=!1,a=!0;try{if(r){let o=j(!0).filter((c)=>!c.staged).map((c)=>c.path);if(o.length>0)await l.gitStage(o)}if(e==="review")await L(l,n,()=>{s=!0});else if(await l.gitCommit(n),s=!0,v())u.git.loading=!1,a=await y();else if(!Us()&&d()!=="")await l.gitPush();return await ks(),a}catch(o){let c=s?null:hA(o);if(c&&D()){if(u.git.loading=!1,await G(n,c))return!0;return u.git.error??=X(o),!1}if(u.git.error=X(o),u.git.loading=!1,!s)P(n);return!1}}function _(e){let t=e.slice(0,3).join(", ");return e.length>3?`${t} and ${e.length-3} more`:t}async function G(e,t){let r=p(),i=r.gitCommitBranch;if(!i)return!1;let n=h()||"this branch",l=t.length===1?"1 file":`${t.length} files`,s=await Fn("Publish to a New Branch",{confirmLabel:"Publish to branch",message:`${n} changed on GitHub after these edits began, and ${l} changed on both sides (${_(t)}). Publish your changes to a branch of their own instead, and a pull request will bring them into ${n}.`,value:b(e),validate:(o)=>o.trim()?"":"Enter a branch name."});if(!s)return P(e),!1;u.git.loading=!0,u.git.error=null;let a=!1;try{let o=await i({branch:s,message:e});a=!0;let c=r.createPullRequest,g=h(),m=c&&g?await c({base:g,head:o.branch,title:e}):null;if(m)u.publish.review.number=m.number,u.publish.review.url=m.url;w.success(m?`Published to ${o.branch}. Pull request #${m.number} brings it into ${g}.`:`Published to ${o.branch}.`,{detail:m?.url??"",key:"publish.branch",source:"Publish"});try{await r.gitPull()}catch{}return await ks(),!0}catch(o){if(u.git.error=X(o),u.git.loading=!1,!a)P(e);return!1}}async function H(e,t,r){if(k()&&e.gitCommitBranch){let l=h(),{branch:s}=await e.gitCommitBranch({branch:b(t),message:t});return r(),{base:l,head:s,title:t}}if(Us()){await e.gitCommit(t),r();let l=f();return l?{base:l,title:t}:{title:t}}let i=h(),n=b(t);return await e.gitCreateBranch(n),await e.gitCommit(t),r(),await e.gitPush({setUpstream:!0}),i?{base:i,head:n,title:t}:{head:n,title:t}}async function L(e,t,r){let i=e.createPullRequest;if(!i)throw Error(pb());let n=await i(await H(e,t,r));u.publish.review.number=n.number,u.publish.review.url=n.url,w.success(`Pull request #${n.number} opened for review.`,{detail:n.url,key:"publish.review",source:"Publish"})}
2
+ export{FD,pb,hw,hm,jD,pm,X_,HD,fb,BD,zD,pw};
3
3
 
4
- //# debugId=29E4DD2E0029053264756E2164756E21
5
- //# sourceMappingURL=studio-6hzdjfv0.js.map
4
+ //# debugId=57A18F7383BDC4AA64756E2164756E21
5
+ //# sourceMappingURL=studio-nf8esxxc.js.map
@@ -0,0 +1,5 @@
1
+ import{ae}from"./studio-wqfaqw4m.js";import{p}from"./studio-4fnb5648.js";import{cs}from"./studio-xpx91fby.js";import{Jt,Ut}from"./studio-nzemfbkk.js";import{sn,dt}from"./studio-tpxcryf2.js";import{Zl,sA,Hb,RL,aA,Ri,jd}from"./studio-stahswgb.js";import{hb,AE}from"./studio-k1xqrgm5.js";import{C}from"./studio-4f7thq0p.js";import{Ve,vt,E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{Q}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";function Bl(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 I(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:I(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,N=()=>{if(m)return;m=!0,e.onClosed()},P=()=>m,d=g({...j(e.view),closed:N,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=R("publish",d,t).then(async(o)=>{y=o;let u=o.root;if(P())return o.dispose(),u;if(await sn(u),P())return u;return(u.querySelector('dialog[part="dialog"]')??u).setAttribute(Ve,vt("modal","publish")),Jt(u),u});return{close(){let o=y?.root;if(o instanceof HTMLElement)Ut(o);y?.dispose(),y=null,n="",t.remove(),N()},host:t,ready:A,update(o){Object.assign(d,j(o))}}}var f=null,i="loading",h=[],l=null,r="",c=!1,b=!1,a={accountId:"",branch:"main",owner:"",projectName:"",repo:""};function x(){return C?.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 Bl(e)??""}function L(){let e=Ri();return e?{productionUrl:e.productionUrl??"",projectName:e.projectName}:null}function S(){let e=Zl(),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:b,supported:e,tokenStored:hb()!==""}}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:()=>{b=!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 sA(),a={...a,accountId:i.accountId??h[0]?.id??""};let e=Ri();if(e)l=await Hb(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}AE(t),b=!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("xb8vvt2h"),import("./cf-account-picker-xb8vvt2h.js"));await t()}}catch(e){r=e instanceof Error?e.message:String(e)}c=!1,cs(),await v()}async function V(){let e=x();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 aA(e,n);l=await Hb(m).catch(()=>null)}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}async function z(){let e=x();if(!e)return;c=!0,s();try{await RL(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 NE(e){i={accountId:e.accountId??"demo-account",connected:!0},h=[],l=e.deployment,jd(e.deployment),r="",c=!1,b=!1,s()}function cF(){let e=x(),{owner:t,repo:n}=O();i="loading",h=[],l=null,r="",c=!1,b=!1,a={accountId:"",branch:"main",owner:t,projectName:Ri()?.projectName??T(e?.name??""),repo:n},s(),v()}
2
+ export{Bl,NE,cF};
3
+
4
+ //# debugId=104942E4566EAE1F64756E2164756E21
5
+ //# sourceMappingURL=studio-nn4f9m9c.js.map
@@ -0,0 +1,6 @@
1
+ import{p}from"./studio-4fnb5648.js";import{C}from"./studio-4f7thq0p.js";import{af}from"./studio-aam8zt8z.js";import{oe}from"./studio-v5wktj6f.js";import{v,T0}from"./studio-k3we3kqb.js";async function qw(e,o){return p().codeService(e,o)}async function KN(e){return p().locateFile(e)}var Yu=new Map;async function Gw(e,o){let s=e.$prototype?C?.projectConfig?.imports?.[e.$prototype]:null,t=e.$src||s;if(!t||!e.$prototype)return null;let r=`${t}::${e.$prototype}`;if(Yu.has(r))return Yu.get(r);try{let n=p(),i=!s&&o.documentPath?`${location.origin}/${o.documentPath}`:void 0,a=await n.fetchPluginSchema(t,e.$prototype,i);return Yu.set(r,a),a}catch{return Yu.set(r,null),null}}function ZT(e,o){let s=e.getModel();if(!s)return;let t=af();if(!t)return;let r=o.flatMap((n)=>{let i=n.labels?.[0];if(!i)return[];let{line:a,column:c,length:u}=i.span;return[{code:n.url?{target:t.Uri.parse(n.url),value:n.code}:n.code,endColumn:c+(u||1),endLineNumber:a,message:n.message+(n.help?`
2
+ ${n.help}`:""),severity:n.severity==="error"?t.MarkerSeverity.Error:t.MarkerSeverity.Warning,source:"oxlint",startColumn:c,startLineNumber:a}]});t.editor.setModelMarkers(s,"oxlint",r)}function JN(e,o){let s=(t)=>{if(!v(t))return null;let r=t.parameters;if(!Array.isArray(r)||r.length===0)return null;return T0(r)};if(e.type==="def"){let t=e.defName?s(o?.state?.[e.defName]):null;if(t)return t}else if(e.type==="event"){if(!o||!e.path)return["state","event"];let t=oe(o,e.path),r=t&&e.eventKey?s(t[e.eventKey]):null;if(r)return r}return["state","event"]}
3
+ export{qw,KN,Yu,Gw,ZT,JN};
4
+
5
+ //# debugId=EFAA4A356901D95164756E2164756E21
6
+ //# sourceMappingURL=studio-nskxe9q1.js.map
@@ -1,5 +1,5 @@
1
- var rI="content",OC=/^[\w.~-]+$/,$o="{locale}";function u(t){let n=t.replaceAll("\\","/");return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function p(t){let n=u(t);return n.startsWith("/")?n:`/${n}`}function f(t,n){return[...t].toSorted((e,s)=>s[n].length-e[n].length)}function g(t,n){return t===n||t.startsWith(`${n}/`)}function aM(t,n){let e=u(n);for(let s of f(t,"dir")){let r=u(s.dir);if(!g(e,r)||e===r)continue;let o=e.slice(r.length+1),{filter:i}=s;if(i&&!i(o))return null;let l=o.split("/").map((c)=>encodeURIComponent(c)).join("/");return`${p(s.urlPrefix)}/${l}`}return null}function h(t,n){let e=n.split("#")[0].split("?")[0];if(!e.startsWith("/"))return null;let s;try{s=decodeURIComponent(e)}catch{return null}if(/%2e|%2f/i.test(s))return null;for(let r of f(t,"urlPrefix")){let o=p(r.urlPrefix);if(!s.startsWith(`${o}/`))continue;let l=s.slice(o.length+1).split("/");if(l.some((a)=>a===""||a==="."||a===".."))return null;let{filter:c}=r;if(c&&!c(l.join("/")))return null;return`${u(r.dir)}/${l.join("/")}`}return null}var m=String.raw`"'\s<>()\\`;var MC="public";var lM=["mounts","public"];function Wx(t){let n=t.search(/[#?]/);return n===-1?{path:t,suffix:""}:{path:t.slice(0,n),suffix:t.slice(n)}}function sI(t){return t===""||t.startsWith("/")||t.startsWith("#")||t.includes("${")||/^[a-z][\w+.-]*:/i.test(t)}function Si(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}function cM(t){let n=Si(t),e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function aI(t,n){let s=(t===""||t==="."?[]:Si(t).split("/")).filter((r)=>r!==""&&r!==".");for(let r of n.replaceAll("\\","/").split("/")){if(r===""||r===".")continue;if(r===".."){if(s.length===0)return null;s.pop();continue}s.push(r)}return s.join("/")}function d(t,n,e){let{path:s}=Wx(t);if(!s.startsWith("/"))return[];let r;try{r=decodeURIComponent(s)}catch{return[]}if(/%2e|%2f/i.test(r))return[];let o=r.replace(/^\/+/,"");if(o===""||o.split("/").some((l)=>l==="."||l===".."))return[];let i=[];for(let l of e){if(l==="mounts"){let c=h(n,s);if(c!==null&&!c.startsWith("/")&&!/^[A-Za-z]:/.test(c))i.push(Si(c));continue}i.push(l==="root"?o:`${MC}/${o}`)}return[...new Set(i)]}function dM(t,n,e,s){let{path:r}=Wx(t);if(r==="")return null;if(sI(t))return r.startsWith("/")?d(r,e,s)[0]??null:null;if(r.endsWith("/"))return null;let o;try{o=decodeURIComponent(r)}catch{return null}let i=aI(n,o);if(i===null||i===""||i===Si(n))return null;return i}function wv(t){return t.split("/").map((n)=>encodeURIComponent(n)).join("/")}function uM(t){let n=[],e=0;while(e<t.length){while(e<t.length&&(/\s/.test(t[e])||t[e]===","))e+=1;if(e>=t.length)break;let s=e;while(e<t.length&&!/\s/.test(t[e]))e+=1;let r=t.slice(s,e);if(r.endsWith(",")){n.push({descriptor:"",url:r.replace(/,+$/,"")});continue}while(e<t.length&&/\s/.test(t[e]))e+=1;let o=e;while(e<t.length&&t[e]!==",")e+=1;let i=t.slice(o,e).trim();if(e+=1,r=r.replace(/,+$/,""),r!=="")n.push({descriptor:i,url:r})}return n}function hM(t){return t.map(({url:n,descriptor:e})=>e?`${n} ${e}`:n).join(", ")}
2
- export{rI,OC,$o,aM,MC,lM,Wx,sI,Si,cM,aI,dM,wv,uM,hM};
1
+ var qI="content",b1=/^[\w.~-]+$/,$o="{locale}";function u(t){let n=t.replaceAll("\\","/");return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function p(t){let n=u(t);return n.startsWith("/")?n:`/${n}`}function f(t,n){return[...t].toSorted((e,s)=>s[n].length-e[n].length)}function g(t,n){return t===n||t.startsWith(`${n}/`)}function o2(t,n){let e=u(n);for(let s of f(t,"dir")){let r=u(s.dir);if(!g(e,r)||e===r)continue;let o=e.slice(r.length+1),{filter:i}=s;if(i&&!i(o))return null;let l=o.split("/").map((c)=>encodeURIComponent(c)).join("/");return`${p(s.urlPrefix)}/${l}`}return null}function h(t,n){let e=n.split("#")[0].split("?")[0];if(!e.startsWith("/"))return null;let s;try{s=decodeURIComponent(e)}catch{return null}if(/%2e|%2f/i.test(s))return null;for(let r of f(t,"urlPrefix")){let o=p(r.urlPrefix);if(!s.startsWith(`${o}/`))continue;let l=s.slice(o.length+1).split("/");if(l.some((a)=>a===""||a==="."||a===".."))return null;let{filter:c}=r;if(c&&!c(l.join("/")))return null;return`${u(r.dir)}/${l.join("/")}`}return null}var m=String.raw`"'\s<>()\\`;var v1="public";var r2=["mounts","public"];function g0(t){let n=t.search(/[#?]/);return n===-1?{path:t,suffix:""}:{path:t.slice(0,n),suffix:t.slice(n)}}function GI(t){return t===""||t.startsWith("/")||t.startsWith("#")||t.includes("${")||/^[a-z][\w+.-]*:/i.test(t)}function mi(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}function s2(t){let n=mi(t),e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function KI(t,n){let s=(t===""||t==="."?[]:mi(t).split("/")).filter((r)=>r!==""&&r!==".");for(let r of n.replaceAll("\\","/").split("/")){if(r===""||r===".")continue;if(r===".."){if(s.length===0)return null;s.pop();continue}s.push(r)}return s.join("/")}function d(t,n,e){let{path:s}=g0(t);if(!s.startsWith("/"))return[];let r;try{r=decodeURIComponent(s)}catch{return[]}if(/%2e|%2f/i.test(r))return[];let o=r.replace(/^\/+/,"");if(o===""||o.split("/").some((l)=>l==="."||l===".."))return[];let i=[];for(let l of e){if(l==="mounts"){let c=h(n,s);if(c!==null&&!c.startsWith("/")&&!/^[A-Za-z]:/.test(c))i.push(mi(c));continue}i.push(l==="root"?o:`${v1}/${o}`)}return[...new Set(i)]}function JI(t,n,e,s){let{path:r}=g0(t);if(r==="")return null;if(GI(t))return r.startsWith("/")?d(r,e,s)[0]??null:null;if(r.endsWith("/"))return null;let o;try{o=decodeURIComponent(r)}catch{return null}let i=KI(n,o);if(i===null||i===""||i===mi(n))return null;return i}function zv(t){return t.split("/").map((n)=>encodeURIComponent(n)).join("/")}function a2(t){let n=[],e=0;while(e<t.length){while(e<t.length&&(/\s/.test(t[e])||t[e]===","))e+=1;if(e>=t.length)break;let s=e;while(e<t.length&&!/\s/.test(t[e]))e+=1;let r=t.slice(s,e);if(r.endsWith(",")){n.push({descriptor:"",url:r.replace(/,+$/,"")});continue}while(e<t.length&&/\s/.test(t[e]))e+=1;let o=e;while(e<t.length&&t[e]!==",")e+=1;let i=t.slice(o,e).trim();if(e+=1,r=r.replace(/,+$/,""),r!=="")n.push({descriptor:i,url:r})}return n}function l2(t){return t.map(({url:n,descriptor:e})=>e?`${n} ${e}`:n).join(", ")}
2
+ export{qI,b1,$o,o2,v1,r2,g0,GI,mi,s2,KI,JI,zv,a2,l2};
3
3
 
4
- //# debugId=8B0E5D9A7CE7D29964756E2164756E21
5
- //# sourceMappingURL=studio-ea74s8c1.js.map
4
+ //# debugId=0A0570EA38F8398464756E2164756E21
5
+ //# sourceMappingURL=studio-nvcn2ykc.js.map
@@ -0,0 +1,5 @@
1
+ import{X}from"./studio-9c6cbq2c.js";import{p}from"./studio-4fnb5648.js";import{w}from"./studio-sce30r7b.js";import{ph,us,iI}from"./studio-4zd6an2b.js";import{Jt,Ut}from"./studio-nzemfbkk.js";import{sn,dt,Fn}from"./studio-tpxcryf2.js";import{m,h,eu}from"./studio-yrcrncev.js";import{Kd}from"./studio-hh394phe.js";import{Jc,Ta,J$,RO,Y$,Nx,Ys,Ax,NO,AO,Ox,Mx,ov,nr,Vd,Yc,hh,fl,Px}from"./studio-y1b86ast.js";import{oA,Qw,ex,Xu}from"./studio-ggx3j7nd.js";import{ET,Gu}from"./studio-waekn290.js";import{zt}from"./studio-daksw8kh.js";import{_L,SL,CL,kL,Zu,XS,QS,eC,tC}from"./studio-p2a03pgm.js";import{_p}from"./studio-r050sez0.js";import{Ve,Ln,vt,E,R}from"./studio-9dq7rwc7.js";import{Me}from"./studio-0gvvqj3h.js";import{g}from"./studio-3qr08sxq.js";import{n,_}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";var H=[{key:"all",label:"All media"},{key:"image",label:"Images"},{key:"video",label:"Video"},{key:"audio",label:"Audio"},{key:"document",label:"Documents"},{key:"font",label:"Fonts"},{key:"unused",label:"Unused"}],lS=H.map((e)=>e.key);function re(e){return lS.some((t)=>t===e)}function T(e){return H.find((t)=>t.key===e)?.label??"All media"}var U=[{key:"newest",label:"Newest"},{key:"name",label:"Name"},{key:"size",label:"Size"}],Re=U.map((e)=>e.key);function ne(e){return Re.some((t)=>t===e)}function W(e,t,i){switch(t){case"all":return!0;case"unused":return i!==null&&i.has(e.file);default:return e.kind===t}}function A(e,t){let i=t.trim().toLowerCase();return i===""||e.name.toLowerCase().includes(i)}function q(e,t){return e.filter((a)=>W(a,t.filter,t.unused)&&A(a,t.query)).toSorted((a,r)=>Ae(t.sort,a,r)||a.file.localeCompare(r.file))}function Ae(e,t,i){switch(e){case"name":return t.name.localeCompare(i.name,void 0,{numeric:!0,sensitivity:"base"});case"size":return(i.bytes??-1)-(t.bytes??-1);default:return(i.modified??"").localeCompare(t.modified??"")}}function oe(e,t){let i={all:e.length,audio:0,document:0,font:0,image:0,unused:t===null?null:e.filter((a)=>t.has(a.file)).length,video:0};for(let a of e)i[a.kind]=(i[a.kind]??0)+1;return i}var Ie=132,ae=12;function le(e){return Math.max(1,Math.floor((e+ae)/(Ie+ae)))}function se(e,t,i,a,r=!1){if(a===0)return null;let o=Math.min(Math.max(e,0),a-1),l=o-o%i,c;switch(t){case"ArrowRight":{c=o+1;break}case"ArrowLeft":{c=o-1;break}case"ArrowDown":{c=o+i;break}case"ArrowUp":{c=o-i;break}case"Home":{c=r?0:l;break}case"End":{c=r?a-1:Math.min(l+i-1,a-1);break}default:return null}return c<0||c>=a?o:c}var de={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaLibrary",$description:"The Media workspace's library (`specs/studio.md` §22.6): the project's media as filters, a grid and the selected file's detail. ONE document in two modes. In `manage` it is the Media home tab, with Replace, Open in viewer, Rename, Duplicate and Delete under the detail; in `pick` it is the full-size picker inside a `jx-dialog` (`media-pick-dialog.json`), and the dialog's own footer answers Cancel or Use <file>. `media/media-library.ts` keeps every decision (which files a filter keeps, the sort, what a count may claim, where an arrow lands, what Replace writes) and hands this document strings and discriminants. **Unused is drawn with no number until the usage sweep has settled**, and Missing alt text and tags are not drawn at all: each needs a store that does not exist, and a filter that cannot be answered is not shipped as one that always answers nothing.",tagName:"div",attributes:{part:"media-library","data-jx-region":"${state.region}","data-mode":"${state.mode}","data-drop":"${state.dropActive}"},style:{$description:"Three columns over the whole stage: the filters, the grid with its toolbar, and the selected file's detail. Fills the pane's stage by its own geometry, as the workspace home does: the stage is `position: relative` (`pane-grid.json`). In pick mode the same columns fill the dialog's body instead, so the root's box is the only thing that differs between the two modes.",position:"absolute",inset:"0",display:"grid",gridTemplateColumns:"200px minmax(0, 1fr) 300px",boxSizing:"border-box",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",background:"var(--bg)",'&[data-mode="pick"]':{$description:"Inside a dialog there is no stage to fill: the box is the dialog body's, at a height the dialog can scroll within.",position:"relative",inset:"auto",height:"min(70vh, 620px)",gridTemplateColumns:"150px minmax(0, 1fr) 210px"},'&[data-drop="true"]':{$description:"The drop affordance is a STATE the flow holds, not a class a handler adds and forgets to take off.",outline:"2px dashed var(--accent)",outlineOffset:"-4px"},'& [part="filters"]':{display:"flex",flexDirection:"column",gap:"2px",padding:"var(--jx-space-3) var(--jx-space-2)",borderRight:"1px solid var(--border)",background:"var(--bg-panel)",overflowY:"auto"},'& [part="filters-heading"]':{margin:"0",padding:"var(--jx-space-2) var(--jx-space-2) var(--jx-space-1)",fontSize:"var(--jx-text-xs)",fontWeight:"600",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="filter"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",height:"30px",padding:"0 var(--jx-space-2)",border:"none",borderRadius:"var(--radius)",background:"none",color:"var(--fg)",font:"inherit",textAlign:"left",cursor:"pointer"},'& [part="filter"]:hover':{background:"var(--hover-bg)"},'& [part="filter"][aria-pressed="true"]':{background:"color-mix(in srgb, var(--accent) 16%, transparent)",color:"var(--fg)",fontWeight:"600"},'& [part="filter"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="filter-count"]':{marginLeft:"auto",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",fontWeight:"400"},'& [part="main"]':{display:"flex",flexDirection:"column",minWidth:"0",minHeight:"0"},'& [part="toolbar"]':{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)"},'& [part="title"]':{margin:"0 auto 0 0",fontSize:"var(--jx-text-lg)",fontWeight:"600"},'& [part="search"]':{width:"220px"},'& [part="sort"]':{width:"130px"},'& [part="upload"], & [part="empty-upload"]':{$description:"A LABEL around the file picker, not a button that clicks a hidden one: the picker is the control, so it takes focus, Enter opens it and a screen reader announces a file upload. A plain element because a label forwards a click to the input it contains and a custom element between the two would break that.",position:"relative",display:"inline-flex",alignItems:"center",gap:"6px",height:"28px",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",font:"inherit",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":has(:focus-visible)":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="upload-input"], & [part="replace-input"]':{$description:"Out of the way but still FOCUSABLE: `display: none` would take the control out of the tab order, and the label around it draws the focus ring for it.",position:"absolute",width:"1px",height:"1px",opacity:"0",pointerEvents:"none"},'& [part="upload-glyph"]':{"--jx-icon-size":"16px"},'& [part="body"]':{flex:"1",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-4)"},'& [part="grid"]':{$description:"auto-fill over a minimum tile width; `media/media-library-model.ts` `gridColumns` does the same arithmetic, so ArrowDown lands on the tile drawn under the current one. Keep the two numbers in step.",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(132px, 1fr))",gap:"12px",alignContent:"start"},'& [part="tile"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"4px",borderRadius:"var(--jx-radius-md, 6px)",border:"2px solid transparent",cursor:"pointer",minWidth:"0",outline:"none"},'& [part="tile"]:hover':{background:"var(--hover-bg)"},'& [part="tile"][aria-selected="true"]':{borderColor:"var(--accent)"},'& [part="tile"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"2px"},'& [part="thumb"]':{display:"flex",alignItems:"center",justifyContent:"center",aspectRatio:"4 / 3",borderRadius:"var(--radius)",background:"var(--bg-input)",overflow:"hidden",color:"var(--fg-dim)","--jx-icon-size":"28px"},'& [part="thumb-img"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="tile-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-sm)"},'& [part="tile-caption"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",minHeight:"1em"},'& [part="empty"]':{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",padding:"48px var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)","--jx-icon-size":"40px"},'& [part="empty-title"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="empty-detail"]':{margin:"0",maxWidth:"42ch",lineHeight:"1.5"},'& [part="detail"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-4)",borderLeft:"1px solid var(--border)",background:"var(--bg-panel)",overflowY:"auto",minWidth:"0"},'& [part="detail-hint"]':{margin:"auto 0",textAlign:"center",color:"var(--fg-dim)"},'& [part="detail-preview"]':{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"140px",maxHeight:"220px",borderRadius:"var(--radius)",background:"var(--bg-input)",overflow:"hidden",color:"var(--fg-dim)","--jx-icon-size":"40px"},'& [part="preview-img"], & [part="preview-video"]':{maxWidth:"100%",maxHeight:"220px",objectFit:"contain"},'& [part="preview-audio"]':{width:"100%"},'& [part="preview-specimen"]':{$description:"The viewer's specimen at a side pane's size. The face arrives as the `@font-face` the flow writes under a family name generated from the path (`media/media-pane.ts` `specimenOf`); the element carries only that name, as a custom property, and the fallback stack is a rule, here.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-4)",maxWidth:"100%",color:"var(--fg)",fontFamily:"var(--jx-specimen-family, system-ui), system-ui, sans-serif"},'& [part="specimen-line"]':{margin:"0",lineHeight:"1.3",overflowWrap:"anywhere"},'& [part="specimen-line"][data-size="32"]':{fontSize:"32px"},'& [part="specimen-line"][data-size="14"]':{fontSize:"var(--jx-text-md)"},'& [part="detail-name"]':{margin:"0",fontSize:"var(--jx-text-md)",fontWeight:"600",overflowWrap:"anywhere"},'& [part="facts"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="group-title"]':{margin:"0",fontSize:"var(--jx-text-xs)",fontWeight:"600",color:"var(--fg-dim)"},'& [part="url"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="url-value"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--jx-font-mono)",fontSize:"var(--jx-text-sm)"},'& [part="usage"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="usage-headline"]':{margin:"0",fontSize:"var(--jx-text-sm)"},'& [part="usage-list"]':{margin:"0",padding:"0",listStyle:"none",display:"flex",flexDirection:"column",gap:"2px"},'& [part="usage-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="usage-link"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",border:"none",background:"none",padding:"0",color:"var(--accent)",font:"inherit",fontSize:"var(--jx-text-sm)",textAlign:"left",cursor:"pointer",":hover":{textDecoration:"underline"},":focus-visible":{outline:"var(--jx-focus-ring)"}},'& [part="usage-count"]':{fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="actions"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)",marginTop:"var(--jx-space-2)"},'& [part="replace"]':{position:"relative",display:"inline-flex",alignItems:"center",height:"28px",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg)",color:"var(--fg)",font:"inherit",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":has(:focus-visible)":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}}},ondragover:{$prototype:"Function",body:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/dragOver"},value:[]}],description:"A file dropped ANYWHERE on the library uploads, to the destination the Upload label names before the drop: public/media/."},ondragleave:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dragOut"},value:[]}]},ondrop:{$prototype:"Function",body:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/drop"},value:[{$ref:"event#/dataTransfer/files"}]}]},children:[{tagName:"nav",attributes:{part:"filters","aria-label":"Media filters"},children:[{tagName:"h2",attributes:{part:"filters-heading"},textContent:"Library"},{$prototype:"Array",items:{$ref:"#/state/filters"},key:{$ref:"$map/item/key"},map:{tagName:"button",attributes:{part:"filter",type:"button","aria-pressed":"${$map.item.pressed}","data-filter":"${$map.item.key}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"filter-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"filter-count"},textContent:"${$map.item.count}"}]}}]},{tagName:"section",attributes:{part:"main","aria-labelledby":"${state.titleId}"},children:[{tagName:"header",attributes:{part:"toolbar"},children:[{tagName:"h2",attributes:{part:"title",id:"${state.titleId}"},textContent:"${state.title}"},{tagName:"jx-textfield",attributes:{part:"search"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search by name…",autocomplete:"off",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setQuery"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"sort"},$props:{label:"Sort",size:"sm",options:{$ref:"#/state/sortOptions"},value:{$ref:"#/state/sort"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSort"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"label",attributes:{part:"upload",title:"${state.uploadHint}"},children:[{tagName:"input",attributes:{part:"upload-input",type:"file",multiple:!0,accept:"${state.uploadAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"event#/target"}]}],description:"The picker itself, so the destination in the label's tooltip is visible BEFORE the files are chosen. The flow takes the element rather than the file list because a file input that is not cleared refuses the same file twice."}},{tagName:"jx-icon",attributes:{part:"upload-glyph","aria-hidden":"true"},$props:{name:"upload-simple"}},{tagName:"span",textContent:"Upload"}]}]},{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"grid-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/gridState"},cases:{loading:{tagName:"p",attributes:{part:"empty",role:"status"},textContent:"Reading the project's media…"},counting:{tagName:"p",attributes:{part:"empty",role:"status"},textContent:"${state.countingLabel}"},empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"jx-icon",attributes:{part:"empty-glyph","aria-hidden":"true"},$props:{name:"image"}},{tagName:"p",attributes:{part:"empty-title"},textContent:"${state.emptyTitle}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"},{tagName:"label",attributes:{part:"empty-upload",title:"${state.uploadHint}"},children:[{tagName:"input",attributes:{part:"upload-input",type:"file",multiple:!0,accept:"${state.uploadAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"event#/target"}]}],description:"The picker itself, so the destination in the label's tooltip is visible BEFORE the files are chosen. The flow takes the element rather than the file list because a file input that is not cleared refuses the same file twice."}},{tagName:"jx-icon",attributes:{part:"upload-glyph","aria-hidden":"true"},$props:{name:"upload-simple"}},{tagName:"span",textContent:"Upload"}]}]},nomatch:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"jx-icon",attributes:{part:"empty-glyph","aria-hidden":"true"},$props:{name:"image"}},{tagName:"p",attributes:{part:"empty-title"},textContent:"${state.emptyTitle}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"},{tagName:"jx-button",attributes:{part:"reset"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reset"},value:[]}]},children:[{tagName:"span",textContent:"Show all media"}]}]},listed:{tagName:"div",attributes:{part:"grid",role:"listbox","aria-labelledby":"${state.titleId}"},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowRight:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowLeft:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],Home:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],End:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activateSelected"},value:[]}]}}],description:"The grid pattern: arrows move one tile, Home and End to the ends of the row, Ctrl+Home and Ctrl+End to the ends of the grid, and Enter opens the selected file (in pick mode, uses it). The flow computes where the move lands; the tile that receives it takes focus, so the roving tabindex follows the selection."},children:[{$prototype:"Array",items:{$ref:"#/state/tiles"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"tile",role:"option","aria-selected":"${$map.item.selected}",tabindex:"${$map.item.tabindex}","data-file":"${$map.item.file}",title:"${$map.item.name}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/file"}]}]},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/focusTile"},value:[{$ref:"$map/item/file"}]}],description:"Selection follows focus, the listbox pattern: a Tab onto the grid lands on the roving stop and selects it, so the first Enter opens (in pick mode, uses) the tile the focus ring is on rather than nothing."},ondblclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/file"}]}]},oncontextmenu:{$prototype:"Function",body:[{$switch:{$ref:"#/state/mode"},cases:{manage:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/file"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]}}],description:"Manage mode only: the detail pane's actions at the pointer. Pick mode's dialog is modal, and a menu in the popover layer outside it would be inert, so its right-click is left to the platform."},children:[{tagName:"div",attributes:{part:"thumb"},children:[{tagName:"div",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{image:{tagName:"img",attributes:{part:"thumb-img",src:"${$map.item.thumbSrc}",alt:"",draggable:"false"},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}},pending:{tagName:"span",attributes:{part:"thumb-pending","aria-hidden":"true"}},glyph:{tagName:"jx-icon",attributes:{part:"thumb-glyph","aria-hidden":"true"},$props:{name:{$ref:"$map/item/glyph"}}}},$description:"The thumbnail is asked for when the tile scrolls into view, not when the grid is built: `pending` until the flow's observer reports the tile, then the picture. A file the browser draws no picture of shows its kind's glyph."}]},{tagName:"span",attributes:{part:"tile-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"tile-caption"},textContent:"${$map.item.caption}"}]}}]}}}]}]},{tagName:"aside",attributes:{part:"detail","aria-label":"Details"},children:[{tagName:"div",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/detailState"},cases:{none:{tagName:"p",attributes:{part:"detail-hint"},textContent:"${state.detailHint}"},shown:{tagName:"div",attributes:{part:"detail-body",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"detail-preview"},children:[{tagName:"div",attributes:{part:"preview-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/previewKind"},cases:{image:{tagName:"img",attributes:{part:"preview-img",src:"${state.previewSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"#/state/selectedFile"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}},video:{tagName:"video",attributes:{part:"preview-video",src:"${state.previewSrc}",controls:!0}},audio:{tagName:"audio",attributes:{part:"preview-audio",src:"${state.previewSrc}",controls:!0}},font:{tagName:"div",attributes:{part:"preview-specimen",style:"${state.previewSpecimenFamily}"},children:[{tagName:"style",textContent:"${state.previewFontFace}"},{tagName:"p",attributes:{part:"specimen-line","data-size":"32"},textContent:"Aa"},{tagName:"p",attributes:{part:"specimen-line","data-size":"14"},textContent:"${state.previewSpecimen}"}]},glyph:{tagName:"jx-icon",attributes:{part:"preview-glyph","aria-hidden":"true"},$props:{name:{$ref:"#/state/previewGlyph"}}}}}]},{tagName:"h3",attributes:{part:"detail-name"},textContent:"${state.detailName}"},{tagName:"p",attributes:{part:"facts"},textContent:"${state.detailFacts}"},{tagName:"div",attributes:{part:"url-group"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"Site URL"},{tagName:"div",attributes:{part:"url"},children:[{tagName:"code",attributes:{part:"url-value"},textContent:"${state.detailRef}"},{tagName:"jx-action-button",attributes:{part:"copy"},$props:{size:"sm",quiet:!0,hint:"Copy the site URL"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/copyRef"},value:[]}]},children:[{tagName:"span",textContent:"Copy"}]}]}]},{tagName:"div",attributes:{part:"usage-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/usageState"},cases:{shown:{tagName:"div",attributes:{part:"usage"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"Used on"},{tagName:"p",attributes:{part:"usage-headline"},textContent:"${state.usageHeadline}"},{tagName:"div",attributes:{part:"usage-list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasUsageFiles"},cases:{true:{tagName:"ul",attributes:{part:"usage-list"},children:[{$prototype:"Array",items:{$ref:"#/state/usageFiles"},key:{$ref:"$map/item/path"},map:{tagName:"li",attributes:{part:"usage-row","data-usage":"${$map.item.path}"},children:[{tagName:"button",attributes:{part:"usage-link",type:"button",title:"Open ${$map.item.path}"},textContent:"${$map.item.path}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openDocument"},value:[{$ref:"$map/item/path"}]}]}},{tagName:"span",attributes:{part:"usage-count"},textContent:"${$map.item.count}"}]}}]}}}]}},$description:'Hidden on a host with no reference index, which is a different fact from "nothing uses it": a confident zero is the one answer this pane must never invent.'},{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{manage:{tagName:"div",attributes:{part:"actions"},children:[{tagName:"label",attributes:{part:"replace",title:"Replace ${state.detailName} everywhere it is used"},children:[{tagName:"input",attributes:{part:"replace-input",type:"file",accept:"${state.replaceAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[{$ref:"event#/target"}]}],description:"Replace writes the chosen file over this one's path, so every reference keeps resolving and now shows the new bytes (studio.md §9.3). The element rather than the list, so the input can be cleared."}},{tagName:"span",textContent:"Replace"}]},{tagName:"jx-button",attributes:{part:"open-viewer"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openViewer"},value:[]}]},children:[{tagName:"span",textContent:"Open in viewer"}]},{tagName:"div",attributes:{part:"edit-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editable"},cases:{yes:{tagName:"jx-button",attributes:{part:"edit-image"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editImage"},value:[]}],description:"Withheld, not disabled, for a file the editor cannot write: a refused format is not offered rather than offered and then refused (studio.md §9.5)."},children:[{tagName:"span",textContent:"Edit image"}]},no:{tagName:"span",attributes:{hidden:!0}}}},{tagName:"jx-button",attributes:{part:"rename"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/rename"},value:[]}]},children:[{tagName:"span",textContent:"Rename"}]},{tagName:"div",attributes:{part:"duplicate-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/duplicable"},cases:{yes:{tagName:"jx-button",attributes:{part:"duplicate"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/duplicate"},value:[]}],description:"Withheld, not disabled, on a backend that cannot read a file's raw bytes: a copy read as text would be a broken file (studio.md §9.3)."},children:[{tagName:"span",textContent:"Duplicate"}]},no:{tagName:"span",attributes:{hidden:!0}}}},{tagName:"jx-button",attributes:{part:"delete"},$props:{size:"sm",variant:"negative"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[]}]},children:[{tagName:"span",textContent:"Delete"}]}]}},$description:"Manage mode's actions. Pick mode has none here: its answer is the dialog's own footer, Cancel and Use <file>."}]}}}]}]};E("media-library",de);function Oe(){return{countingLabel:"",detailFacts:"",detailHint:"",detailName:"",detailRef:"",detailState:"none",dropActive:"false",emptyDetail:"",emptyTitle:"",filters:[],gridState:"loading",mode:"manage",previewFontFace:"",previewGlyph:"",previewKind:"glyph",previewSpecimen:"",previewSpecimenFamily:"",previewSrc:"",query:"",region:"",replaceAccept:"",editable:"no",duplicable:"no",selectedFile:"",sort:"",sortOptions:[],tiles:[],title:"",titleId:"",uploadAccept:"",uploadHint:"",usageFiles:[],usageHeadline:"",usageState:"hidden"}}function pe(e,t){Object.assign(e,t),e.hasUsageFiles=t.usageFiles.length>0}function Ke(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function ze(e){let t=e?.$map,i=_(t)&&"item"in t?t.item:void 0;return _(i)&&"file"in i&&n(i.file)?i.file:null}function V(e,t,i,a){if(a.clear)e.replaceChildren();let{tileHost:r,gridHost:o,inputHost:l,...c}=i,d=g({...Oe(),...c,hasUsageFiles:!1});pe(d,t);let f=null,b=!1,M=R("media-library",d,e,{onNodeCreated:(u,s,F,Ee)=>{if(b||!(u instanceof HTMLElement))return;let C=Ke(F);if(C==="tile"){let ie=ze(Ee);if(ie!==null)r(u,ie)}else if(C==="grid")o(u);else if(u instanceof HTMLInputElement&&C==="upload-input")l(u,"upload");else if(u instanceof HTMLInputElement&&C==="replace-input")l(u,"replace")}}).then((u)=>{if(b)u.dispose();else f=u;return u.root});return{attached:()=>{if(b)return!1;let u=f?.root;return u===void 0?!0:u instanceof HTMLElement&&e.contains(u)},dispose(){b=!0,f?.dispose(),f=null},ready:M,update:(u)=>pe(d,u)}}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaPickDialog",$description:"The full-size media picker (`specs/studio.md` §9.3): a `jx-dialog` whose body is the Media workspace's own library surface in pick mode, so the picker and the workspace are one surface at two sizes. The dialog owns modality, Escape, the backdrop and focus restoration, and its footer is the answer: Cancel, or Use <file>, disabled until a file is chosen. The body is an ISLAND: this document draws the slot and nothing in it, and `surfaces/media-pick-dialog.ts` mounts `media-library.json` there through `onNodeCreated`.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},confirmDisabled:{$ref:"#/state/blocked"},cancelLabel:"Cancel",dismissible:!0,size:"xl"},attributes:{part:"media-pick"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},children:[{tagName:"div",attributes:{part:"library-slot"},style:{$description:"The library's box in pick mode is its own (`media-library.json`, `data-mode=\"pick\"`); the slot only gives it the dialog body's width.",minWidth:"0"}}]};E("media-pick-dialog",ue);var B="media-picker";function Ue(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function fe(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ve,vt("dialog",B)),e.layer.append(t);let i=!1,a=()=>{if(i)return;i=!0,e.closed()},r=()=>i,o=g({...e.view,closed:a,confirm:e.confirm}),l=null,c=R("media-pick-dialog",o,t,{onNodeCreated:(d,f,b)=>{if(!r()&&d instanceof HTMLElement&&Ue(b)==="library-slot")e.body(d)}}).then(async(d)=>{l=d;let f=d.root;if(r())return d.dispose(),f;if(await sn(f),!r())Jt(f);return f});return{close(){let d=l?.root;if(d instanceof HTMLElement)Ut(d);l?.dispose(),l=null,t.remove(),a()},host:t,ready:c,update(d){Object.assign(o,d)}}}var uF="media-home",ve={audio:"play",document:"file-text",font:"text-aa",image:"image",video:"play"},We={audio:"Audio",document:"Document",font:"Font",image:"Image",video:"Video"},y={filter:"all",query:"",sort:"newest",selected:null},D=null,S=null,O=0,K=0,P=!1,Y=0;function J(){S=null,P=!1,O=0,K=0,Y+=1}function qe(){return[...L].some((e)=>!e.disposed&&e.choice.filter==="unused")}async function Be(e){if(P||S!==null||!ph())return;let t=Y;P=!0,O=0,K=e.length;let i=new Set;for(let a of e){let r=await Xu(a.file);if(t!==Y)return;if(!qe()){J();return}if(r.status==="ready"&&r.result.files.length===0)i.add(a.file);O+=1,x()}S=i,P=!1,x()}var L=new Set,k=new Map,Q=new Set,j=null;function we(){if(j!==null)return;let e=()=>{J(),x()},t=ET(e),i=iI(e);j=()=>{t(),i()}}function Ge(){if(L.size===0&&j)j(),j=null}function v(e){if(!e.disposed){if(e.handle?.update(ee(e)),e.onSelect?.(),Ye(e),e.focusOwed)queueMicrotask(()=>He(e));xe(e)}}function Ye(e){let t=e.reveal,i=t===null?void 0:e.tiles.get(t);if(i?.isConnected){if(e.reveal=null,i.scrollIntoView({block:"nearest"}),e.revealFocus)e.revealFocus=!1,i.focus()}}function xe(e){if(e.sweepTimer!==null||e.disposed)return;e.sweepTimer=setTimeout(()=>{e.sweepTimer=null,e.observer.releaseDetached();for(let[t,i]of e.tiles)if(!i.isConnected)e.tiles.delete(t);for(let t of[e.inputs.upload,e.inputs.replace])for(let i of t)if(!i.isConnected)t.delete(i)},0)}function $e(e){return[...e].find((t)=>t.isConnected)??null}function x(){for(let e of L)v(e)}function Z(e){if(e.disposed=!0,e.sweepTimer!==null)clearTimeout(e.sweepTimer),e.sweepTimer=null;e.inputs.upload.clear(),e.inputs.replace.clear(),e.observer.destroy(),e.handle?.dispose(),e.handle=null,e.tiles.clear(),L.delete(e),Ge()}function ke(e){let t=Gu(),i=t===null?null:e.images?t.filter((r)=>r.isImage):t;return{files:(i??[]).map((r)=>{let o=Yc(r.file);return{bytes:o?.bytes??null,file:r.file,kind:r.kind,modified:o?.modified??null,name:r.name}}),listed:i}}function Je(e){return H.filter((t)=>(t.key!=="unused"||ph())&&(!e.images||t.key==="image"||t.key==="unused"))}function wb(e){let{filter:t,query:i,selected:a}=e.choice;if(a===null)return null;let r=Gu()?.find((l)=>l.file===a)??null;if(r===null||e.images&&!r.isImage)return null;let o={bytes:null,file:r.file,kind:r.kind,modified:null,name:r.name};return W(o,t,S)&&A(o,i)?r:null}function Qe(e,t){if(t===0)return{emptyDetail:`Upload files or drop them anywhere here. They are saved under ${e.uploadDir}/, and anything already under public/ or a collection's images/ folder is listed here too.`,emptyTitle:e.images?"No images yet":"No media yet"};let{filter:i,query:a}=e.choice;if(a.trim()!=="")return{emptyDetail:`Nothing in ${T(i)} matches it.`,emptyTitle:`No matches for “${a.trim()}”`};if(i==="unused")return{emptyDetail:"Every file is referenced by at least one document.",emptyTitle:"No unused media"};return{emptyDetail:`${t} ${t===1?"file":"files"} in the project, none of them ${T(i).toLowerCase()}.`,emptyTitle:`No ${T(i).toLowerCase()}`}}function ee(e){let{choice:t}=e,{files:i,listed:a}=ke(e),r=oe(i,S),o=Je(e);if(!o.some((s)=>s.key===t.filter))t.filter=o[0]?.key??"all";let l=q(i,{filter:t.filter,query:t.query,sort:t.sort,unused:S}),c=Gu();if(t.filter==="unused"&&c!==null)Be(c);let d="listed";if(a===null)d="loading";else if(t.filter==="unused"&&S===null)d="counting";else if(i.length===0||l.length===0)d=i.length===0?"empty":"nomatch";let f=wb(e),b=l.some((s)=>s.file===t.selected)?t.selected:l[0]?.file??null,M=l.map((s)=>{let F=s.kind==="image";return{caption:Px(Yc(s.file))||We[s.kind],file:s.file,glyph:ve[s.kind],key:s.file,name:s.name,selected:s.file===t.selected?"true":"false",tabindex:s.file===b?"0":"-1",thumbSrc:F&&e.visible.has(s.file)?nr(s.file):"",thumbState:F?e.visible.has(s.file)?"image":"pending":"glyph"}}),u=e.images&&t.filter==="image"?"Images":T(t.filter);return{countingLabel:K>0?`Counting references… ${O} of ${K}`:"Counting references…",dropActive:e.dropActive?"true":"false",filters:o.map((s)=>{let F=r[s.key];return{count:F===null?"":String(F),key:s.key,label:e.images&&s.key==="image"?"All images":s.label,pressed:s.key===t.filter?"true":"false"}}),gridState:d,mode:e.mode,query:t.query,region:e.region,sort:t.sort,sortOptions:U.map((s)=>({label:s.label,value:s.key})),tiles:M,title:u,titleId:`media-library-title-${e.region.replaceAll(/[^\w-]/g,"-")}`,uploadAccept:e.images?"image/*":Jc(),uploadHint:`Upload into ${e.uploadDir}/`,...Qe(e,i.length),...Xe(e,f)}}function Xe(e,t){if(t===null)return{detailFacts:"",detailHint:e.mode==="pick"?"Choose a file to use it.":"Select a file to see its details.",detailName:"",detailRef:"",detailState:"none",previewFontFace:"",previewGlyph:"",previewKind:"glyph",previewSpecimen:"",previewSpecimenFamily:"",previewSrc:"",replaceAccept:"",editable:"no",duplicable:"no",selectedFile:"",usageFiles:[],usageHeadline:"",usageState:"hidden"};let i=Yc(t.file),a=ex(t.file);if(!Vd(t.file))hh(t.file).then(x);if(a===null||a.status==="pending")Xu(t.file).then(x);let r=_L(t.file),o=r==="image"||r==="video"||r==="audio"||r==="font"?r:"glyph",l=o==="font"?CL(t.file):{fontFace:"",specimen:"",specimenFamily:""};return{detailFacts:SL(t.file,i),detailHint:"",detailName:t.name,detailRef:t.ref,detailState:"shown",previewFontFace:l.fontFace,previewGlyph:ve[t.kind],previewKind:o,previewSpecimen:l.specimen,previewSpecimenFamily:l.specimenFamily,previewSrc:o==="glyph"?"":nr(t.file),replaceAccept:NO(t.file),editable:XS(t.file)?"yes":"no",duplicable:QS()?"yes":"no",selectedFile:t.file,...kL(a)}}var me=null,ge=null;function Se(){return me??=(ce("t07yqqej"),import("./files-t07yqqej.js")),me}function Fe(){return ge??=(ce("9bxvk59j"),import("./file-ops-9bxvk59j.js")),ge}function te(e){try{e.showPicker()}catch{e.focus()}}function N(e,t){e.choice.selected=t,v(e)}async function he(e,t){let i=await Ys([...t],{dir:e.uploadDir,only:e.images?"image":"media"}),[a]=i;if(!a)return;if(e.choice.filter!=="all"&&e.choice.filter!==a.kind)e.choice.filter=e.images?"image":"all";e.choice.query="",e.reveal=a.path,N(e,a.path)}async function eN(e){let t=e.split("/").pop()??e,{confirmFileDelete:i}=await Fe();if(!await i({name:t,path:e}))return!1;let{markLocalMutation:a}=await (ce("3424ezp3"),import("./fs-events-3424ezp3.js"));try{a(e),await p().deleteFile(e)}catch(l){return w.error(`Could not delete ${t}.`,{detail:X(l),path:e,source:"Media"}),!1}if(Kd([e]),us(),m.tabs.has(e))eu(e);for(let l of L)if(l.choice.selected===e)l.choice.selected=null;if(y.selected===e)y.selected=null;let r=ov(e),o=await Ze(r,a);return await Nx(o?ov(r):r),w.success(`Deleted ${t}`),!0}async function Ze(e,t){if(!RO(e))return!1;let i=p();try{if((await i.listDirectory(e)).length>0)return!1;return t(e),await i.deleteFile(e),!0}catch{return!1}}async function tN(e){if(eC(e,"renamed"))return null;let t=Mx(e),i=ov(e),{commitRename:a,listRenameSiblings:r,notifyMoveOutcome:o,renameStatus:l}=await Se(),c=await r(e,"Media");if(c===null)return null;let{renamePromptMessage:d}=await Fe(),f=await d(e),b=await Fn("Rename",{confirmLabel:"Rename",select:"stem",validate:(s)=>AO(e,s,c),value:t,...f!==void 0&&{message:f}});if(!b||b===t)return null;let M=Y$(i,b),u=Yc(e);try{let s=await a(e,M);if(y.selected===e)Le(M);if(await Nx(i),u?.width!=null&&u.height!=null)fl(M,u.width,u.height);return o(l(b,s),s,M),M}catch(s){return w.error(`Could not rename ${t}.`,{detail:X(s),path:e,source:"Media"}),null}}async function nN(e){if(eC(e,"duplicated"))return null;let t=await Ax(e);if(t===null)return null;return Le(t.path),x(),t.path}function Le(e){if(y.selected=e,!A({name:Mx(e)},y.query))y.query="";for(let{mount:t}of k.values())t.reveal=e,t.revealFocus=!0}function Ne(e){return{activate:(t)=>{N(e,t),ye(e,t)},activateSelected:()=>{let{selected:t}=e.choice;if(t!==null)ye(e,t)},contextMenu:(t,i,a)=>et(e,t,i,a),copyRef:()=>{let t=wb(e);if(t)Te(t)},dragOut:()=>{if(e.dropActive)e.dropActive=!1,v(e)},dragOver:()=>{if(!e.dropActive)e.dropActive=!0,v(e)},drop:(t)=>{if(e.dropActive=!1,v(e),t?.length)he(e,t)},focusTile:(t)=>{if(e.choice.selected!==t)N(e,t)},gridHost:(t)=>{e.grid=t},inputHost:(t,i)=>{e.inputs[i].add(t),xe(e);let a=D;if(e.mode==="manage"&&a?.role===i&&(i==="upload"||a.file===e.choice.selected))D=null,te(t)},key:(t,i)=>tt(e,t,i),measure:(t,i,a)=>{if(fl(t,i,a))x();else if(!Vd(t))hh(t).then(x)},openDocument:(t)=>{Se().then(({openFileInTab:i})=>i(t))},openViewer:()=>{let{selected:t}=e.choice;if(t!==null)Zu(t)},editImage:()=>{let{selected:t}=e.choice;if(t!==null)tC(t)},remove:()=>{let{selected:t}=e.choice;if(t!==null)eN(t)},rename:()=>{let{selected:t}=e.choice;if(t!==null)tN(t)},duplicate:()=>{let{selected:t}=e.choice;if(t!==null)nN(t)},replace:(t)=>{let[i]=t.files??[];t.value="";let{selected:a}=e.choice;if(i&&a!==null&&oA(a))Ox(a,i).then((r)=>{if(r)Qw(a);x()})},reset:()=>{e.choice.filter=e.images?"image":"all",e.choice.query="",v(e)},select:(t)=>N(e,t),setFilter:(t)=>{if(re(t))e.choice.filter=t,v(e)},setQuery:(t)=>{e.choice.query=t,v(e)},setSort:(t)=>{if(ne(t))e.choice.sort=t,v(e)},tileHost:(t,i)=>{e.tiles.set(i,t),je.set(t,i),e.observer.observe(t)},upload:(t)=>{let i=[...t.files??[]];if(t.value="",i.length>0)he(e,i)}}}function Te(e){if("clipboard"in navigator)navigator.clipboard.writeText(e.ref)}var I=null;function et(e,t,i,a){N(e,t);let r=wb(e);if(!r)return;I?.close();let o=(l,c,d,f={})=>({destructive:!1,disabled:!1,dividerAbove:!1,id:l,run:d,title:c,...f});I=zt({label:`${r.name} actions`,onClosed:(l)=>{if(I===l)I=null},origin:{x:i,y:a},region:"media-tile",rows:[o("open","Open in Viewer",()=>Zu(t)),...XS(t)?[o("edit","Edit Image",()=>tC(t))]:[],o("copy-url","Copy Site URL",()=>Te(r)),o("rename","Rename…",()=>{tN(t)},{dividerAbove:!0}),...QS()?[o("duplicate","Duplicate",()=>{nN(t)})]:[],o("replace","Replace…",()=>BP(t)),o("delete","Delete",()=>{eN(t)},{destructive:!0,dividerAbove:!0})]})}function ye(e,t){if(e.mode==="pick"){let i=wb(e);if(i)e.onPick?.(i);return}Zu(t)}function tt(e,t,i){let{files:a}=ke(e),r=q(a,{filter:e.choice.filter,query:e.choice.query,sort:e.choice.sort,unused:S}),o=r.findIndex((f)=>f.file===e.choice.selected),l=e.grid?le(Me(e.grid).width):1,c=o===-1?r.length>0?0:null:se(o,t,l,r.length,i),d=c===null?void 0:r[c];if(!d)return;N(e,d.file),e.tiles.get(d.file)?.focus()}var je=new WeakMap;function De(e,t,i,a,r,o){let l={choice:t,disposed:!1,dropActive:!1,grid:null,handle:null,images:r,inputs:{replace:new Set,upload:new Set},mode:e,observer:_p((c)=>{let d=je.get(c);if(d!==void 0&&!l.visible.has(d))l.visible.add(d),it(l)}),onPick:null,onSelect:null,paneId:a,reveal:null,revealFocus:!1,focusOwed:!1,region:i,sweepTimer:null,tiles:new Map,uploadDir:o,visible:new Set};return l}var G=new Set;function it(e){if(G.has(e))return;G.add(e),queueMicrotask(()=>{G.delete(e),v(e)})}function cS(e,t){let i=k.get(e);return i!==void 0&&i.tabId===t.id&&i.wrap.isConnected&&i.mount.handle!==null&&i.mount.handle.attached()}function vw(e){let t=k.get(e);if(!t)return;Z(t.mount),k.delete(e)}function JE(e,t){let{paneId:i,wrap:a}=e;if(cS(i,t))return;vw(i);let r=De("manage",y,Ln(i,"media-library"),i,!1,Ta);if(L.add(r),we(),r.handle=V(a,ee(r),Ne(r),{clear:!0}),k.set(i,{mount:r,tabId:t.id,wrap:a}),Q.delete(i))Ce(r)}async function Ce(e){await e.handle?.ready,He(e,!0)}function He(e,t=e.focusOwed){if(!t||e.disposed)return;let{selected:i}=e.choice,a=(i===null?void 0:e.tiles.get(i))??[...e.tiles.values()].find((r)=>r.getAttribute("tabindex")==="0");if(a?.isConnected){e.focusOwed=!1,a.focus();return}e.focusOwed=!0}function YE(e){let t=k.get(e);if(t?.wrap.isConnected&&t.mount.handle?.attached()===!0){Ce(t.mount);return}Q.add(e)}function HP(e){if(e.filter!==void 0)y.filter=e.filter;if(e.query!==void 0)y.query=e.query;if(e.select!==void 0){if(y.selected=e.select,y.filter!=="all")y.filter="all";y.query=""}x()}function hF(){let e=[...k.values()].map((t)=>$e(t.mount.inputs.upload)).find((t)=>t!==null)??null;if(e){te(e);return}D={file:null,role:"upload"}}function BP(e){HP({select:e});let t=null;for(let i of k.values())if(i.mount.choice.selected===e)t??=$e(i.mount.inputs.replace);if(t){te(t);return}D={file:e,role:"replace"}}var z=null;function be(e){let t=wb(e);return{blocked:t===null,confirmLabel:t?`Use ${t.name}`:e.images?"Use image":"Use file",headline:e.images?"Choose an image":"Choose media"}}function dS(){let e=z;if(z=null,e)Z(e.mount),e.dialog.close()}function pF(e){dS();let t={filter:e.images?"image":"all",query:"",selected:null,sort:"newest"},i=De("pick",t,`${vt("dialog",B)}/library`,null,e.images,J$(h.value?.documentPath??null)),a=(o)=>{dS(),e.onPick(o.ref)};i.onPick=a,L.add(i),we();let r=fe({body:(o)=>{i.handle=V(o,ee(i),Ne(i),{clear:!1})},closed:()=>{if(z?.mount===i)dS();else Z(i)},confirm:()=>{let o=wb(i);if(o)a(o)},layer:dt("dialog"),view:be(i)});i.onSelect=()=>r.update(be(i)),z={dialog:r,mount:i}}function ZE(){dS();for(let e of k.keys())vw(e);y.filter="all",y.query="",y.selected=null,y.sort="newest",D=null,Q.clear(),J()}
2
+ export{lS,uF,wb,eN,tN,nN,cS,vw,JE,YE,HP,hF,BP,dS,pF,ZE};
3
+
4
+ //# debugId=676C28E656FDAB3164756E2164756E21
5
+ //# sourceMappingURL=studio-nwynxqtb.js.map