@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{St,ti,Se,Fe,xh,m,Si,Ft}from"./studio-yrcrncev.js";import{p}from"./studio-4fnb5648.js";import{jt,fn}from"./studio-aam8zt8z.js";import{Zs,dt}from"./studio-tpxcryf2.js";import{Ls,Ud}from"./studio-bct64zmj.js";import{Fd,WT,BS,UT,qT}from"./studio-e7vjyp04.js";import{Nb,ss,Yl,Ww,Vw,Lp,Qo,$p}from"./studio-thz5t120.js";import{C}from"./studio-4f7thq0p.js";import{E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{n,Y,Q,wf}from"./studio-k3we3kqb.js";var T={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGridOpen",$description:"Every grid-able source a project has, grouped by where it comes from: the project's own pages and content collections first, then each connection's tables. It is the ISLAND of a confirm dialog rather than a dialog of its own — `ui/layers.ts`'s dialog owns the headline, the cancel button, modality and focus, and this document is only the list — because a second answer to \"what is a dialog\" is a defect (studio-ui-guidelines.md §12.5). Group headings are why it is not the kit menu: a menu row can carry a divider above it and cannot carry a name for the run it opens.",tagName:"div",attributes:{part:"sources"},style:{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",minWidth:"280px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="group-title"]':{margin:"0",fontSize:"var(--jx-text-xs)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)"},'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"1px",marginTop:"var(--jx-space-1)"},'& [part="source"]':{textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-2) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer"},'& [part="source"]:hover':{background:"var(--bg-hover)"},'& [part="source"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="group-empty"]':{margin:"0",padding:"var(--jx-space-2)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"}},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/key"},map:{$description:"One origin of grid-able sources. A connection with no tables says why it has none instead of drawing an empty box — an author who has not pushed a schema yet is exactly the reader who needs the sentence.",tagName:"section",attributes:{part:"group","data-group":"${$map.item.key}"},children:[{tagName:"h3",attributes:{part:"group-title"},textContent:"${$map.item.title}"},{tagName:"div",attributes:{part:"rows"},$switch:{$ref:"$map/item/state"},cases:{listed:{tagName:"div",attributes:{part:"rows-list",role:"none"},style:{display:"contents"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/id"},map:{tagName:"button",attributes:{part:"source",type:"button","data-source":"${$map.item.id}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/id"}]}]},textContent:"${$map.item.label}"}}]},empty:{tagName:"p",attributes:{part:"group-empty"},textContent:"${$map.item.emptyMessage}"}}}]}}]};E("grid-open",T);function j(e,r,t){let o=g({groups:r,open:t}),i=null,s=!1,c=R("grid-open",o,e).then((y)=>{let a=y.root;if(s)return y.dispose(),a;return i=y,a});return{dispose(){s=!0,i?.dispose(),i=null},ready:c}}function x(){try{return p()}catch{return null}}function FS(){return Q(x()?.dataRows)}async function I(){let e=x();if(!Q(e?.dataConnections))return null;return e.dataConnections()}async function jN(e){let r=x();if(!Q(r?.dataConnectionTest))return{error:"Connection tests are not supported by this backend",ok:!1};try{return await r.dataConnectionTest(e)}catch(t){return{error:t instanceof Error?t.message:String(t),ok:!1}}}async function jT(e){let r=x();if(!Q(r?.dataPush))return{applied:!1,errors:["Schema push is not supported by this backend"],plan:[]};try{return await r.dataPush(e)}catch(t){return{applied:!1,errors:[t instanceof Error?t.message:String(t)],plan:[]}}}function k(e){let t=x()?.[e];if(t===void 0)throw Error(`The ${String(e)} surface is not supported by this backend`);return t}function v(e){return k("dataRows")(e)}function K(e){return k("dataInsertRow")(e)}function M(e){return k("dataUpdateRow")(e)}function O(e){return k("dataDeleteRow")(e)}function HN(e,r,t){let o=(c)=>c.replaceAll(/([a-z0-9])([A-Z])/g,"$1_$2").replaceAll(/[^A-Za-z0-9]+/g,"_").replaceAll(/^_+|_+$/g,"").toUpperCase(),s=[r??e,t.replace(/Env$/,"")].flatMap((c)=>{let y=o(c);return y?[y]:[]}).join("_")||"SECRET";return/^\d/.test(s)?`JX_${s}`:s}var H=["id","sku","slug","Slug"];function L(e){let r=new Set;return e.map((t,o)=>{let i=t.trim()===""?`column${o+1}`:t;if(r.has(i))i=`${i}__${o+1}`;return r.add(i),i})}function J(e,r){for(let t of H){let o=e.indexOf(t);if(o===-1)continue;let i=r.rows.map((s)=>s[o]??"");if(i.every((s)=>s!=="")&&new Set(i).size===i.length)return t}return null}function A(e,r){let t=Fd(e),o=L(t.headers),i=J(o,t),s=i?o.indexOf(i):-1,c=t.rows.map((d,u)=>s===-1?String(u):d[s]),y=new Map(c.map((d,u)=>[d,u])),a=xh(r,C?.projectConfig),l=a?.schema.properties??{},b=t.rows.slice(0,50).map((d)=>{let u={};for(let[S,G]of o.entries())u[G]=d[S]??"";return u}),f=new Map(Vw(b).map((d)=>[d.field,d])),w=new Map(Ww(a?.schema,{idField:i??void 0}).map((d)=>[d.field,d]));return{columns:o.map((d,u)=>{let G=(d in l?w.get(d):void 0)??f.get(d)??{editable:!0,field:d,kind:"string",title:t.headers[u]||d};return{...G,pk:d===i,title:t.headers[u]?.trim()||G.title}}),doc:t,fields:o,keys:c,keyToIndex:y,loadText:e}}function z(e,r){let t={},o=e.doc.rows[r]??[];for(let[i,s]of e.fields.entries()){let c=e.columns[i],y=o[i]??"";t[s]=c.kind==="string"||c.kind==="text"||c.kind==="readonly"?y:Lp(y,c)}return t}function F(e,r){let t=e.doc.rows.map((s)=>[...s]),o=(s)=>e.fields.indexOf(s);for(let s of r.cells){let c=e.keyToIndex.get(s.rowKey),y=o(s.field);if(c===void 0||y===-1)continue;t[c][y]=Qo(s.value)}for(let s of r.inserts){let c=e.fields.map((y)=>Qo(s.cells[y]??null));t.push(c)}let i=r.deletes.map((s)=>e.keyToIndex.get(s.rowKey)).filter((s)=>s!==void 0).toSorted((s,c)=>c-s);for(let s of i)t.splice(s,1);return{...e.doc,rows:t}}function _(e,r){return{cells:e.cells.map((t)=>({field:t.field,rowKey:t.rowKey,...r})),deletes:e.deletes.map((t)=>({rowKey:t.rowKey,...r})),inserts:e.inserts.map((t)=>({error:r.error,ok:r.ok,tempKey:t.tempKey}))}}function jS(e){let r=null,t=(o=!1)=>{if(!o&&r)return r;return r=p().readFile(e).then((i)=>A(i,e)),r};return{backingPaths:()=>new Map([[e,"*"]]),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return(await t()).columns},async commit(o){let i=await t(),s=p(),c=null;try{c=await s.readFile(e)}catch{c=null}if(c!==i.loadText&&!Ud(e))return _(o,{error:"File changed on disk — refresh to reload",ok:!1,stale:!0});let y=F(i,o),a=WT(y);return Ls(e),await s.writeFile(e,a),r=Promise.resolve(A(a,e)),_(o,{ok:!0})},id:e,label:e.split("/").pop()??e,async refresh(){await t(!0)},async rows(){let o=await t(),i=o.doc.rows.map((s,c)=>({cells:z(o,c),key:o.keys[c]}));return{rows:i,total:i.length}},async serializeForSource(o){let i=await t();return WT(F(i,o))}}}var U=50;function q(e){let r=e.toLowerCase();if(/(int|real|floa|doub|num|dec)/.test(r))return"number";if(r.includes("bool"))return"boolean";if(/(timestamp|datetime|date)/.test(r))return"date";return"string"}function Z(e){return!e.pk&&e.name!=="created_at"&&e.name!=="updated_at"}function W(e){if(e===void 0)return null;if(wf(e))return e;return JSON.stringify(e)}function N(e,r){let t=[],o="id",i=new Map,s=(a)=>{if(a.length>0)t=a,o=a.find((l)=>l.pk)?.name??"id"},c=(a)=>{let l={table:r};if(e)l.connection=e;if(l.limit=a?.limit??U,l.offset=a?.offset??0,a?.orderBy)l.dir=a.dir??"asc",l.orderBy=a.orderBy;return l},y=(a,l)=>{let b=a[o];if(n(b)||Y(b))return i.set(String(b),b),String(b);return`row-${l}`};return{capabilities:{delete:!0,insert:!0,remotePaging:!0,remoteSort:!0},async columns(){if(t.length===0){let a=await v(c({limit:1,offset:0}));s(a.columns)}return t.map((a)=>{let l=Z(a)?q(a.type):"readonly";return{editable:l!=="readonly",field:a.name,kind:l,pk:a.pk===!0,title:a.name,widthHint:a.pk?80:void 0}})},async commit(a){let l={cells:[],deletes:[],inserts:[]},b=new Map;for(let f of a.cells){let w=b.get(f.rowKey)??[];w.push({field:f.field,value:f.value}),b.set(f.rowKey,w)}for(let[f,w]of b){let h=i.get(f),d=(u,S)=>{for(let G of w)l.cells.push({error:S,field:G.field,ok:u,rowKey:f})};if(h===void 0){d(!1,"Row has no primary key — refresh the grid");continue}try{let u={};for(let G of w)u[G.field]=G.value;let S={pk:h,set:u,table:r};if(e)S.connection=e;await M(S),d(!0)}catch(u){d(!1,u instanceof Error?u.message:String(u))}}for(let f of a.inserts)try{let w={};for(let[G,P]of Object.entries(f.cells))if(P!==null)w[G]=P;let h={table:r,values:w};if(e)h.connection=e;let{row:d}=await K(h),u=d[o],S;if(n(u)||Y(u))S=String(u),i.set(S,u);l.inserts.push({newKey:S,ok:!0,tempKey:f.tempKey})}catch(w){l.inserts.push({error:w instanceof Error?w.message:String(w),ok:!1,tempKey:f.tempKey})}for(let f of a.deletes){let w=i.get(f.rowKey);if(w===void 0){l.deletes.push({error:"Row has no primary key — refresh the grid",ok:!1,rowKey:f.rowKey});continue}try{let h={pk:w,table:r};if(e)h.connection=e;await O(h),l.deletes.push({ok:!0,rowKey:f.rowKey})}catch(h){l.deletes.push({error:h instanceof Error?h.message:String(h),ok:!1,rowKey:f.rowKey})}}return l},id:ss({connection:e??"default",kind:"data",table:r}),label:r,async refresh(){t=[],i.clear()},async rows(a){let l=await v(c(a));return s(l.columns),{rows:l.rows.map((f,w)=>{let h=y(f,w),d={};for(let u of t)d[u.name]=W(f[u.name]);return{cells:d,key:h}}),total:l.total}}}}async function HT(e,r={}){let t=m.tabs.get(e);if(t)return Ft(e,{focus:r.focus!==!1}),t;try{await jt()}catch{}let o=jS(e),i=Si({capabilities:{modes:["grid","source"]},document:structuredClone(Nb),documentPath:e,id:e,sourceFormat:fn(e)?.name??null,...r.paneId!==void 0&&{paneId:r.paneId},...r.preview===!0&&{preview:!0},...r.focus===!1&&{focus:!1}});return $p(i,o).load(),i}function D(e){let r=Si({capabilities:{modes:["grid"]},document:structuredClone(Nb),documentPath:null,id:e.id});return $p(r,e).load(),r}function BN(e){let r=ss({kind:"collection",name:e}),t=m.tabs.get(r);if(t)return Ft(r),t;return D(UT(e))}function HS(){let e=ss({kind:"pages"}),r=m.tabs.get(e);if(r)return Ft(e),r;return D(qT())}function V(e,r){let t=ss({connection:e??"default",kind:"data",table:r}),o=m.tabs.get(t);if(o)return Ft(t),o;return D(N(e,r))}function X(e){let r=Yl(e);if(r?.kind==="pages")HS();else if(r?.kind==="collection")BN(r.name);else if(r?.kind==="data")V(r.connection,r.table)}function ee(e,r){return[{emptyMessage:"",key:"project",rows:[{id:ss({kind:"pages"}),label:"Pages"},...e.map(({name:t})=>({id:ss({kind:"collection",name:t}),label:`Collection: ${t}`}))],state:"listed",title:"Project"},...r.map((t)=>({emptyMessage:"No tables — push a schema first.",key:`data:${t.name}`,rows:t.tables.map((o)=>({id:ss({connection:t.name,kind:"data",table:o}),label:o})),state:t.tables.length===0?"empty":"listed",title:`Data · ${t.name}`}))]}async function BT(){let e=BS(),r=[];if(FS())r=(await I().catch(()=>null))?.connections??[];let t=null,o=Zs({cancelLabel:"Cancel",confirmLabel:"",headline:"Open Grid",island:(i)=>{t=j(i,ee(e,r),(s)=>{o.close(),X(s)})},layer:dt("dialog"),onCancel:()=>o.close(),onClosed:()=>{t?.dispose(),t=null},onConfirm:()=>{},region:"grid/open"});o.ready}function te(){return[{args:Se({name:Fe("The content collection's name, as project.json declares it.")}),category:"Project",id:"collection.editInGrid",level:"project",menus:["context/file","palette"],group:"5_data",requires:"a project that declares content collections",when:(e)=>e.project.open,run:(e,r)=>{let t=St("collection.editInGrid",r,"name"),o=BS().map((i)=>i.name);if(!o.includes(t))throw RangeError(`command "collection.editInGrid" argument "name": "${t}" is not a content `+"collection this project declares — it declares: "+`${o.length>0?o.join(", "):"none"}`);BN(t)},title:"Edit Collection in Grid"},{args:{additionalProperties:!1,properties:{connection:Fe('The connection name from project.json. Defaults to "default".'),table:Fe("The table to open.")},required:["table"],type:"object"},category:"Project",id:"data.openGrid",level:"project",menus:["palette"],group:"5_data",requires:"a platform that serves the data routes",when:(e)=>e.project.open,enablement:(e)=>e.capability.dataRows,run:(e,r)=>{let t=St("data.openGrid",r,"table");V(ti("data.openGrid",r,"connection"),t)},title:"Open Data Grid"}]}function zT(e){e.registerAll(te())}
2
+ export{FS,jN,jT,HN,jS,HT,BN,HS,BT,zT};
3
+
4
+ //# debugId=67AF438E9428C4A664756E2164756E21
5
+ //# sourceMappingURL=studio-fspe7m9t.js.map
@@ -0,0 +1,5 @@
1
+ import{Me}from"./studio-0gvvqj3h.js";import{Q}from"./studio-k3we3kqb.js";var f=3;function p(e,t,n){return Math.min(n,Math.max(t,e))}function PS(e){let t=Math.max(0,Math.trunc(e.count)),n=Math.max(1,Math.trunc(e.columns??1)),o=Math.ceil(t/n);if(!(e.rowHeight>0)||!(e.viewportHeight>0))return{end:t,padBottom:0,padTop:0,start:0,totalRows:o};let r=Math.max(0,Math.trunc(e.overscanRows??f)),i=Math.max(0,e.scrollTop),m=Math.floor(i/e.rowHeight),w=Math.ceil(e.viewportHeight/e.rowHeight)+1,l=p(m-r,0,o),a=p(m+w+r,l,o);return{end:Math.min(t,a*n),padBottom:(o-a)*e.rowHeight,padTop:l*e.rowHeight,start:Math.min(t,l*n),totalRows:o}}function M(e,t){return e.start===t.start&&e.end===t.end&&e.totalRows===t.totalRows&&e.padTop===t.padTop&&e.padBottom===t.padBottom}function R(e){let{scroller:t,list:n,count:o,rowHeight:r,columns:i,onChange:m,overscanRows:w}=e,l={end:0,padBottom:0,padTop:0,start:0,totalRows:0},a=!1;function c(){if(a)return;let d=PS({columns:i?.()??1,count:o(),overscanRows:w??f,rowHeight:r(),scrollTop:n?H(t,n):t.scrollTop,viewportHeight:t.clientHeight}),b=!M(l,d);if(l=d,b)m(d)}t.addEventListener("scroll",c,{passive:!0});let u=0,T=()=>{if(u!==0)return;u=requestAnimationFrame(()=>{u=0,c()})},s=null;if(Q(globalThis.ResizeObserver)){if(s=new ResizeObserver(T),s.observe(t),n)s.observe(n)}return c(),{destroy(){if(a=!0,t.removeEventListener("scroll",c),s?.disconnect(),s=null,u!==0)cancelAnimationFrame(u),u=0},measure:c,range:()=>l}}function v(e){for(let t=e;t;t=t.parentElement){if(t.scrollHeight<=t.clientHeight)continue;let n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="overlay")return t}return null}function g(e){let t=h.get(e);if(t&&t.isConnected&&e.isConnected&&t.contains(e))return t;let n=L(e)??v(e);if(n)h.set(e,n);else h.delete(e);return n}var x="data-jx-scroller";function L(e){return e.isConnected?e.closest(`[${x}]`):null}function H(e,t){if(e===t)return Math.max(0,e.scrollTop);return Math.max(0,Me(e).top-Me(t).top)}function Fw(e,t){let n=e?.isConnected===!0?g(e):null;if(!n||!e){let o=Math.max(0,Math.trunc(t.count));return{end:o,padBottom:0,padTop:0,start:0,totalRows:o}}return PS({columns:t.columns??1,count:t.count,overscanRows:t.overscanRows??f,rowHeight:t.rowHeight,scrollTop:H(n,e),viewportHeight:n.clientHeight})}function W(e){let t=e.listOffset+e.index*e.rowHeight,n=t+e.rowHeight;if(t<e.scrollTop)return Math.max(0,t);if(n>e.scrollTop+e.viewportHeight)return Math.max(0,n-e.viewportHeight);return null}function jw(e,t,n){let o=e?.isConnected===!0?g(e):null;if(!o||!e||t<0||!(n>0))return!1;let{scrollTop:r}=o,i=W({index:t,listOffset:r-H(o,e),rowHeight:n,scrollTop:r,viewportHeight:o.clientHeight});if(i===null)return!1;return o.scrollTop=i,!0}function MN(e,t,n){let o=e?.querySelector(t);return o&&o.offsetHeight>0?o.offsetHeight:n}var h=new WeakMap;function Hw(e,t,n){let o=g(t);if(e&&e.list===t&&e.scroller===o)return e;if(e?.window.destroy(),!o)return null;return{list:t,scroller:o,window:R({count:n.count,list:t,onChange:()=>n.onChange(),rowHeight:n.rowHeight,scroller:o})}}
2
+ export{PS,Fw,jw,MN,Hw};
3
+
4
+ //# debugId=0F6CCF769637D90B64756E2164756E21
5
+ //# sourceMappingURL=studio-g0hxtcga.js.map
@@ -1,5 +1,5 @@
1
- import{p,_e}from"./studio-jws1a87n.js";import{C}from"./studio-y60sts62.js";function v(e){return e.trim().replace(/\/+$/,"")}function k(e){return e.trim().toLowerCase()==="anthropic"?"anthropic":""}function a(e){return e.trim()}var rt={aiBaseUrl:{default:"",key:"jx.ai.baseUrl",normalize:v,scope:"user"},aiOpenAiKey:{default:"",key:"jx.ai.openaiKey",normalize:a,scope:"user",secret:!0},aiProvider:{default:"",key:"jx.ai.provider",normalize:k,scope:"user"},aiModel:{default:"gpt-4o",key:"jx.ai.model",normalize:a,scope:"user"},keybindings:{default:"",key:"jx.keybindings",normalize:(e)=>e.trim()==="{}"?"":e.trim(),scope:"user"},theme:{default:"",key:"jx-studio-theme",normalize:a,scope:"user"},showIgnoredFiles:{default:"",key:"jx.files.showIgnored",normalize:a,scope:"user"},developerPanels:{default:"",key:"jx.panels.developer",normalize:a,scope:"user"},cfAccountId:{default:"",key:"jx.cf.accountId",normalize:a,scope:"user"},cfToken:{default:"",key:"jx.cf.token",normalize:a,scope:"user",secret:!0}},S=Object.values(rt),f=S.filter((e)=>e.scope==="user"),z=f.map((e)=>e.key);function h(e){let t=e.schedule??queueMicrotask,n=null,i=Promise.resolve(),r=Promise.resolve();function s(){let o=n;if(n=null,!o)return i;return i=i.then(()=>e.send(o)).catch((u)=>{e.onError?.(u,o)}),i}return{enqueue(o){if(n){Object.assign(n,o);return}n={...o},r=new Promise((u)=>{t(()=>{s().then(u)})})},settled(){return r}}}var c=new Map;function m(){return typeof localStorage>"u"?void 0:localStorage}function x(e,t){try{if(t===null)m()?.removeItem(e);else m()?.setItem(e,t)}catch{}}try{for(let e of S){let t=m()?.getItem(e.key);if(t!==null&&t!==void 0)c.set(e.key,t)}}catch{}function Eo(e){return c.get(e.key)??""}function jA(e){return(c.get(e.key)??"")!==""}var y=new Set;function Ap(e){return y.add(e),()=>{y.delete(e)}}function l(e){for(let t of y)t(e)}var g=h({onError(e){C("error","Your settings could not be saved.",{detail:e instanceof Error?e.message:String(e),key:"settings-write",source:"Settings"})},async send(e){if(!_e())return;let t=p();if(!t.patchSettings)return;let n={},i=[];for(let[r,s]of Object.entries(e))if(s)n[r]=s;else i.push(r);await t.patchSettings({remove:i,set:n})}});function HA(){return g.settled()}function d(e){let t=[];for(let[n,i]of Object.entries(e)){if((c.get(n)??null)===i)continue;if(i===null)c.delete(n);else c.set(n,i);x(n,i),t.push(n)}return t}function fx(e,t){return e.normalize?e.normalize(t):t}function xr(e,t){let n=fx(e,t),i=d({[e.key]:n});if(i.length>0)g.enqueue({[e.key]:n}),l(i)}function BA(e){let t={};for(let[i,r]of e)t[i.key]=fx(i,r);let n=d(t);if(n.length>0)g.enqueue(t),l(n)}function Op(e){let t={};for(let i of e)t[i.key]=null;let n=d(t);if(n.length>0)g.enqueue(t),l(n)}async function zA(){if(!_e())return;let e=p();if(!e.getSettings)return;let t;try{t=await e.getSettings()}catch{return}let n={},i=!1;for(let s of f){let o=t[s.key];if(o)n[s.key]=o;else if(c.get(s.key))i=!0}let r=d(n);if(r.length>0)l(r);if(i){let s={};for(let o of f){let u=c.get(o.key);if(u&&!t[o.key])s[o.key]=u}g.enqueue(s)}}function P(e){let t={};for(let i of f)t[i.key]=e[i.key]??null;let n=d(t);if(n.length>0)l(n)}function WA(){if(!_e())return;p().subscribeSettings?.(P)}
2
- export{rt,Eo,jA,Ap,HA,fx,xr,BA,Op,zA,WA};
1
+ import{p,ye}from"./studio-4fnb5648.js";import{w}from"./studio-sce30r7b.js";function v(e){return e.trim().replace(/\/+$/,"")}function k(e){return e.trim().toLowerCase()==="anthropic"?"anthropic":""}function a(e){return e.trim()}var rt={aiBaseUrl:{default:"",key:"jx.ai.baseUrl",normalize:v,scope:"user"},aiOpenAiKey:{default:"",key:"jx.ai.openaiKey",normalize:a,scope:"user",secret:!0},aiProvider:{default:"",key:"jx.ai.provider",normalize:k,scope:"user"},aiModel:{default:"gpt-4o",key:"jx.ai.model",normalize:a,scope:"user"},keybindings:{default:"",key:"jx.keybindings",normalize:(e)=>e.trim()==="{}"?"":e.trim(),scope:"user"},theme:{default:"",key:"jx-studio-theme",normalize:a,scope:"user"},showIgnoredFiles:{default:"",key:"jx.files.showIgnored",normalize:a,scope:"user"},developerPanels:{default:"",key:"jx.panels.developer",normalize:a,scope:"user"},cfAccountId:{default:"",key:"jx.cf.accountId",normalize:a,scope:"user"},cfToken:{default:"",key:"jx.cf.token",normalize:a,scope:"user",secret:!0}},S=Object.values(rt),f=S.filter((e)=>e.scope==="user"),z=f.map((e)=>e.key);function h(e){let t=e.schedule??queueMicrotask,n=null,i=Promise.resolve(),r=Promise.resolve();function s(){let o=n;if(n=null,!o)return i;return i=i.then(()=>e.send(o)).catch((u)=>{e.onError?.(u,o)}),i}return{enqueue(o){if(n){Object.assign(n,o);return}n={...o},r=new Promise((u)=>{t(()=>{s().then(u)})})},settled(){return r}}}var c=new Map;function m(){return typeof localStorage>"u"?void 0:localStorage}function x(e,t){try{if(t===null)m()?.removeItem(e);else m()?.setItem(e,t)}catch{}}try{for(let e of S){let t=m()?.getItem(e.key);if(t!==null&&t!==void 0)c.set(e.key,t)}}catch{}function Eo(e){return c.get(e.key)??""}function kO(e){return(c.get(e.key)??"")!==""}var y=new Set;function Bp(e){return y.add(e),()=>{y.delete(e)}}function l(e){for(let t of y)t(e)}var g=h({onError(e){w("error","Your settings could not be saved.",{detail:e instanceof Error?e.message:String(e),key:"settings-write",source:"Settings"})},async send(e){if(!ye())return;let t=p();if(!t.patchSettings)return;let n={},i=[];for(let[r,s]of Object.entries(e))if(s)n[r]=s;else i.push(r);await t.patchSettings({remove:i,set:n})}});function EO(){return g.settled()}function d(e){let t=[];for(let[n,i]of Object.entries(e)){if((c.get(n)??null)===i)continue;if(i===null)c.delete(n);else c.set(n,i);x(n,i),t.push(n)}return t}function Dx(e,t){return e.normalize?e.normalize(t):t}function xr(e,t){let n=Dx(e,t),i=d({[e.key]:n});if(i.length>0)g.enqueue({[e.key]:n}),l(i)}function TO(e){let t={};for(let[i,r]of e)t[i.key]=Dx(i,r);let n=d(t);if(n.length>0)g.enqueue(t),l(n)}function zp(e){let t={};for(let i of e)t[i.key]=null;let n=d(t);if(n.length>0)g.enqueue(t),l(n)}async function LO(){if(!ye())return;let e=p();if(!e.getSettings)return;let t;try{t=await e.getSettings()}catch{return}let n={},i=!1;for(let s of f){let o=t[s.key];if(o)n[s.key]=o;else if(c.get(s.key))i=!0}let r=d(n);if(r.length>0)l(r);if(i){let s={};for(let o of f){let u=c.get(o.key);if(u&&!t[o.key])s[o.key]=u}g.enqueue(s)}}function P(e){let t={};for(let i of f)t[i.key]=e[i.key]??null;let n=d(t);if(n.length>0)l(n)}function $O(){if(!ye())return;p().subscribeSettings?.(P)}
2
+ export{rt,Eo,kO,Bp,EO,Dx,xr,TO,zp,LO,$O};
3
3
 
4
- //# debugId=6E698ACA4FBDD88E64756E2164756E21
5
- //# sourceMappingURL=studio-th7z3fg7.js.map
4
+ //# debugId=599624DA050B30E864756E2164756E21
5
+ //# sourceMappingURL=studio-g9brbewz.js.map
@@ -0,0 +1,5 @@
1
+ import{X}from"./studio-9c6cbq2c.js";import{p,ye}from"./studio-4fnb5648.js";import{Lh,w}from"./studio-sce30r7b.js";import{mi}from"./studio-nvcn2ykc.js";import{ea,Zd,m,bl,wI}from"./studio-yrcrncev.js";import{qd,La,lv}from"./studio-4zd6an2b.js";import{Ox,fl,Vm}from"./studio-y1b86ast.js";import{YI,w1,b0,v0,ZI,ad,x1,vf,Uv,y0,w0,Fh,qv,hg,_1,XI,u2,h2,p2,QI,f2,eR,x0,m2,g2,b2}from"./studio-1410q5dw.js";import{C}from"./studio-4f7thq0p.js";import{Ln}from"./studio-9dq7rwc7.js";import{me,te,g,le}from"./studio-3qr08sxq.js";import{Y}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";var ls="image",D=[320,640,960,1280,1920],A=null,H=null;function B(){return A??=(ce("x7t8jbjn"),import("./image-editor-x7t8jbjn.js")),A}function W(){return H??=(ce("4afr4y6a"),import("./image-bake-4afr4y6a.js")),H}var E=new WeakMap;function x(t){return E.get(le(t))}function _(t){let e=le(t),r=E.get(e);if(!r){r=g({decoded:!1,generation:0,history:x0(),live:null,message:"Reading the image…",saving:!1,size:null,source:null,status:"loading",typed:!1}),E.set(e,r);let i=F(r);Zd(e,i),Zd(t,i)}return r}function F(t){return{canRedo:()=>!t.saving&&t.history.future.length>0,canUndo:()=>!t.saving&&t.history.past.length>0,redo:()=>{if(!t.saving)t.history=b2(t.history)},undo:()=>{if(!t.saving)t.history=g2(t.history)}}}function h(t){return t.live??t.history.present}function M(t,e,r){let i=t.source;if(t.source={bytes:e,url:URL.createObjectURL(new Blob([e],{type:r}))},t.status="ready",t.message="",i!==null)URL.revokeObjectURL(i.url)}function U(t){if(t.source!==null)URL.revokeObjectURL(t.source.url),t.source=null,t.status="loading"}async function R(t,e){if(t.source!==null)return;t.generation+=1;let{generation:r}=t;t.status="loading",t.message="Reading the image…";let i=ye()?p():null,u=i?.readFileBytes;if(u===void 0){t.status="refused",t.message="This backend cannot hand Studio a file's raw bytes, so it cannot edit one.";return}let o;try{o=new Uint8Array(await u.call(i,e))}catch(a){if(t.generation===r)t.status="refused",t.message=`Could not read ${e}: ${a instanceof Error?a.message:String(a)}`;return}if(t.generation!==r)return;let n=v0(e,o);if(n!==null){t.status="refused",t.message=n;return}t.size??=YI(o).size,M(t,o,w1(e)??"")}function al(t){let e=x(t),r=e?.size;if(e===void 0||r===null||r===void 0)return!1;return e.typed||!x1(h(e),r)}function P(t,e){t.live=null,t.history=m2(t.history,e)}var v=new Map;function LL(t,e){let r=v.get(t);return r!==void 0&&le(r.tab)===le(e)&&r.wrap.isConnected&&(r.surface===null||r.surface.attached())}function Xw(t){let e=v.get(t);if(!e)return;e.disposed=!0,e.scope.stop(),e.surface?.dispose(),v.delete(t);let r=x(e.tab);if(e.drag!==null&&r!==void 0)r.live=null;if(r!==void 0&&S(e.tab).length===0)r.typed=!1;if(S(e.tab).length===0&&r!==void 0&&!r.saving)U(r),r.generation+=1}function j(t){if(t.rows.length===0||t.rows.find((e)=>e.tabindex==="0")?.id!==t.active)t.rows=hg.map((e)=>({id:e,label:_1[e],tabindex:e===t.active?"0":"-1"}));return t.rows}function y(t){return`${Number(t.toFixed(4))}%`}function O(){let e=C?.projectConfig?.images?.widths;return Array.isArray(e)&&e.length>0&&e.every((r)=>Y(r))?e:D}var q=ZI.map(({id:t,label:e})=>({label:e,value:t}));function b(t,e){let r=t.tab.documentPath??"",i=r.split("/").pop()??r,u=h(e),o=e.size??{height:1,width:1},n=Fh(u.turns,o),a=qv(ad(u,o),u,o),l=Uv(u,o),c=y0(u,o),s=eR(u,o,O()),f=w1(r)??"",d=e.source!==null&&e.decoded&&e.size!==null,I=d&&(e.typed||!x1(u,o)),T=vf(u.turns);return{alt:`${i}, being edited`,aspect:u.aspect,aspectOptions:q,brightness:String(u.brightness),busy:e.saving||!d,undecoded:!d,cannotFit:e.saving||!d||s===null||s===c.width,cannotRedo:e.saving||e.history.future.length===0,cannotSave:e.saving||!I||ea(t.tab),cannotUndo:e.saving||e.history.past.length===0,clean:e.saving||!I,contrast:String(u.contrast),cropH:y(a.height/n.height*100),cropW:y(a.width/n.width*100),cropX:y(a.x/n.width*100),cropY:y(a.y/n.height*100),facts:d?`Output ${c.width} × ${c.height} · crop ${l.width} × ${l.height} · source ${o.width} × ${o.height}`:"",filter:w0(u)||"none",fitHint:s===null?"Already no wider than the largest width the build derives.":"The largest of the project's image widths (images.widths, or the build's defaults) below this crop.",fitLabel:s===null?"Fit for web":`Fit for web (${s} px)`,handleHelpId:`${Ln(t.paneId,"image")}/handle-help`,handles:j(t),imageHeight:T?y(o.height/n.height*100):"100%",imageTransform:`translate(-50%, -50%) scale(${u.flipH?-1:1}, ${u.flipV?-1:1}) rotate(${u.turns*90}deg)`,imageWidth:T?y(o.width/n.width*100):"100%",maxOutputWidth:String(l.width),maxWidth:`${n.width}px`,message:e.message,moveCursor:u.crop===null?"default":"move",name:i,quality:b0(f)?"shown":"hidden",qualityValue:String(u.quality),ratio:String(n.width/n.height),region:Ln(t.paneId,"image"),saturation:String(u.saturation),saving:e.saving,src:e.source?.url??"",status:e.status,warning:`Save overwrites ${r} and keeps no backup. Source control is how to get the original back.`,width:String(c.width)}}function N(t,e,r){let i=qv(ad(e,r),e,r);Lh(`${_1[t]}: crop ${i.width} × ${i.height} at ${i.x}, ${i.y}`)}function z(t){return hg.some((e)=>e===t)}function V(t,e){let r=()=>e.source===null||!e.decoded?null:e.size,i=()=>t.surface?.syncFields(b(t,e)),u=F(e),o=(n)=>{let a=r();if(a!==null&&!e.saving)P(e,n(h(e),a))};return{cycleHandle:(n,a)=>{if(!z(n))return;let l=hg.indexOf(n),c=a<0?-1:1,s=hg[(l+c+hg.length)%hg.length];t.active=s,t.surface?.update(b(t,e)),t.surface?.focusHandle(s),Lh(_1[s])},fieldEdited:()=>{e.typed=!0},fitForWeb:()=>{o((n,a)=>{let l=eR(n,a,O());return l===null?n:QI(n,a,l)})},flip:(n)=>{o((a)=>p2(a,n==="v"?"v":"h"))},handleDown:(n,a,l,c,s)=>{let f=r(),d=t.surface?.frameRect();if(f===null||!z(n)||!d||d.width<=0||e.saving)return;s.setPointerCapture(a),t.active=n,t.drag={handle:n,pointerId:a,scale:Fh(h(e).turns,f).width/d.width,start:h(e),startX:l,startY:c}},handleFocused:(n)=>{if(z(n)&&t.active!==n)t.active=n,t.surface?.update(b(t,e))},handleMove:(n,a,l)=>{let{drag:c}=t,s=r();if(c===null||c.pointerId!==n||s===null||e.saving)return;e.live=XI(c.start,s,c.handle,(a-c.startX)*c.scale,(l-c.startY)*c.scale)},handleUp:(n)=>{let{drag:a}=t;if(a===null||a.pointerId!==n)return;if(t.drag=null,e.live!==null)P(e,e.live)},imageFailed:(n)=>{if(e.source?.url!==n)return;U(e),e.status="refused",e.message=`${t.tab.documentPath??"This file"} could not be decoded, so it cannot be edited.`},imageLoaded:(n,a)=>{if(e.source===null||!(n>0&&a>0))return;if(e.decoded=!0,e.size?.width!==n||e.size.height!==a)e.size={height:a,width:n};fl(t.tab.documentPath??"",n,a)},nudge:(n,a,l,c)=>{let s=r();if(s===null||!z(n)||e.saving)return;let f=c?10:1,d=XI(h(e),s,n,a*f,l*f);P(e,d),N(n,d,s)},redo:()=>{u.redo(t.tab)},reset:()=>{o(()=>x0().present)},rotate:(n)=>{o((a)=>h2(a,n<0?-1:1))},save:()=>{$L(t.tab)},setAspect:(n)=>{let a=ZI.find((l)=>l.id===n);if(a)o((l,c)=>u2(l,c,a.id))},setValue:(n,a)=>{if(a.trim()!==""&&(n==="brightness"||n==="contrast"||n==="saturation"||n==="quality"))o((l)=>f2(l,n,Number(a)));e.typed=!1,i()},setWidth:(n)=>{o((a,l)=>QI(a,l,n.trim()===""?null:Number(n))),e.typed=!1,i()},undo:()=>{u.undo(t.tab)}}}function iA(t,e){let{paneId:r,wrap:i}=t;if(LL(r,e))return;Xw(r);let u=_(e),o={active:"nw",disposed:!1,drag:null,paneId:r,rows:[],scope:me(),surface:null,tab:e,wrap:i};v.set(r,o),R(u,e.documentPath??""),B().then(({mountImageEditorSurface:n})=>{if(o.disposed)return;o.surface=n(i,b(o,u),V(o,u)),o.scope.run(()=>{te(()=>{if(!o.disposed)o.surface?.update(b(o,u))})})})}async function Q(t,e){if(t.source===null)await R(t,e);if(t.source===null&&t.status==="loading")await R(t,e);return t.source}function S(t){let e=le(t);return[...v.values()].filter((r)=>le(r.tab)===e)}async function $L(t){let e=t.documentPath??"",r=e.split("/").pop()??e;if(ea(t))return w.warn(`You have read access to this session — the edit to ${r} stays in your browser and cannot be saved.`,{key:`image.readOnly:${e}`,path:e,source:"Collaboration"}),!1;let i=x(t);if(i===void 0||i.saving)return i===void 0;for(let u of S(t))u.surface?.flushFields(),u.drag=null;if(i.typed=!1,i.live!==null)P(i,i.live);i.saving=!0;try{let{size:u}=i,o=h(i);if(u===null||x1(o,u))return w.info(`${r} has no changes, so nothing was written.`,{key:`image.identity:${e}`}),!0;let n=(k)=>(w.error(`Could not save ${r}.`,{detail:k,path:e,source:"Image"}),!1),a=await Q(i,e);if(a===null)return n(i.message);let l=w1(e)??"",{bakeImage:c}=await W(),s;try{s=await c(o,a.bytes,l)}catch(k){return n(`The browser could not process this image: ${X(k)}`)}if(!s.ok)return n(s.reason);if(!bl(t))return!1;if(t.documentPath!==e)return n("It was renamed while saving, so the edit was not written to its old name.");let{blob:f}=s,d=Vm(a.bytes.byteLength),I=f.size>a.bytes.byteLength?", so the file grew":"";if(!await Ox(e,new File([f],r,{type:l}),{note:`${s.size.width} × ${s.size.height}, ${Vm(f.size)} (was ${d}${I})`}))return!1;return M(i,new Uint8Array(await f.arrayBuffer()),l),i.size=s.size,i.decoded=!0,fl(e,s.size.width,s.size.height),i.live=null,i.history=x0(),!0}finally{if(i.saving=!1,S(t).length===0)U(i),i.generation+=1}}function oA(t){let e=m.tabs.get(t);if(!e||!al(e))return!0;let r=t.split("/").pop()??t;return w.warn(`${r} has an unsaved edit. Save or discard it before replacing the file.`,{key:`image.replaceDirty:${t}`,path:t,source:"Image"}),!1}function Qw(t){let e=m.tabs.get(t),r=e&&x(e);if(!e||r===void 0||r.saving||al(e))return;if(U(r),r.generation+=1,r.size=null,r.decoded=!1,r.live=null,r.history=x0(),S(e).length>0)R(r,t)}wI(al);var G={message:"no media file to look for",status:"failed"};function L(t){let e=mi(t);return e===""?null:{path:e}}function ex(t){let e=L(t);return e===null?null:qd(e)}async function Xu(t){let e=L(t);return e===null?G:La(e)}function rA(t){if(t===null)return"Counting references…";switch(t.status){case"unsupported":return null;case"pending":return"Counting references…";case"failed":return"Usage unknown";default:return lv(t.result)}}
2
+ export{ls,al,LL,Xw,iA,$L,oA,Qw,ex,Xu,rA};
3
+
4
+ //# debugId=4EBD0C6B7B176E4464756E2164756E21
5
+ //# sourceMappingURL=studio-ggx3j7nd.js.map
@@ -1,5 +1,5 @@
1
- import{Ne}from"./studio-sevbc3xv.js";import{bt,Oc,Uo,Br}from"./studio-rtfnhrdg.js";import{Wt,Yc,ti,Vn,Ce,pi,We,m,Gr,pn,TC,Km,wh,Xc}from"./studio-k2sz13zg.js";import{ne}from"./studio-y60sts62.js";import{to,Ts,sl,u}from"./studio-2r90cts3.js";import{Vt}from"./studio-cg710sk9.js";import{oe}from"./studio-wc6za3zs.js";var O_=["code","layout","component","diff","breakpoint","locale"],T={breakpoint:"design",code:"source",component:"design"},x={design:"Design",source:"Code"},k="Could not read this file's comparison against HEAD.";var Au={breakpoint:"Same page at",code:"Code",component:"Component definition",diff:"Diff vs HEAD",layout:"Layout",locale:"Same page in"};function R(e){let t=pn(e)?.derived;if(!t)return null;let o=bt(t.sourcePaneId);if(!o)return{diffPath:null,kind:t.kind,media:null,mode:null,path:null,probePath:null,reason:"The pane this one follows has no document open.",select:null,status:"unavailable"};if(t.kind==="lens")return w(e,t,o);return S(e,t,o)}function w(e,t,o){let n={diffPath:null,kind:"lens",media:t.media,mode:t.mode,path:null,probePath:null,select:null};if(t.preset==="diff"){let i=o.documentPath;if(!h(i))return{...n,reason:"Nothing to compare — this file matches HEAD.",status:"unavailable"};if(t.diff?.filePath===i&&(t.diffRev===void 0||t.diffRev===u.git.rev))return{...n,reason:"",status:"ready"};if(c.get(e)?.failed&&c.get(e)?.path===i)return{...n,reason:k,status:"unavailable"};return{...n,diffPath:i,reason:"",status:"loading"}}if(t.preset==="code"&&Oc(o)==="source")return{...n,reason:"The pane this one follows is showing Code — one document has one editor.",status:"unavailable"};if(t.preset==="breakpoint"&&!M_(o).includes(t.media))return{...n,reason:`This document does not declare a "${t.media??"base"}" breakpoint.`,status:"unavailable"};return{...n,reason:"",status:"ready"}}function h(e){return u.git.status?.files.find((t)=>t.path===e&&(t.status==="M"||t.status==="A"||t.status==="U"))??null}function S(e,t,o){let n={diffPath:null,kind:"companion",media:null,mode:null};if(t.preset==="layout"){let a=u.layoutSelection,r=a?.layoutFile??sl(o.doc.document.$layout);return r===null?{...n,path:null,probePath:null,reason:"This page has no layout.",select:null,status:"unavailable"}:{...n,path:r,probePath:null,reason:"",select:a?a.layoutPath:null,status:"ready"}}if(t.preset==="locale"){let a=Ts(),r=o.documentPath===null||t.locale===null?null:Yc(o.documentPath,t.locale,a);if(r===null)return{...n,path:null,probePath:null,reason:"This document has no path in that locale.",select:null,status:"unavailable"};let l=d.get(e);if(l?.path!==r||l.exists===null)return{...n,path:null,probePath:r,reason:"",select:null,status:"loading"};if(!l.exists)return{...n,path:null,probePath:null,reason:`No ${Wt(t.locale)} copy of this document yet — `+"the Languages panel can create one.",select:null,status:"unavailable"};return{...n,path:r,probePath:null,reason:"",select:null,status:"ready"}}let i=_(o);if(i===null)return t.resolved===null?{...n,path:null,probePath:null,reason:"Select an element inside a component to see its definition.",select:null,status:"unavailable"}:{...n,path:null,probePath:null,reason:"",select:null,status:"ready"};return{...n,path:i,probePath:null,reason:"",select:null,status:"ready"}}function M_(e){let{sizeBreakpoints:t}=Br(to(e.doc.document.$media));return[null,...t.map((o)=>o.name)]}function _(e){let[t]=e?.session.selection??[];if(!e||!t)return null;let o=e.doc.document,n=[...t];while(n){let i=oe(o,n),a=i?Ne.find((r)=>r.tagName===i.tagName):null;if(a?.path)return a.path;n=Vt(n)}return null}function F(e,t){if(t.sourcePaneId===e||!pn(t.sourcePaneId))throw RangeError(`pane "${e}" cannot derive from "${t.sourcePaneId}" — a derivation names `+"another pane that is in the grid");b(e,t)}function b(e,t){let o=pn(e);if(o)c.delete(e),d.delete(e),o.derived=t}function pE(e){b(e,null)}function f(e,t){let o=pn(e),n=o?.derived,i=R(e);if(!o||!n||!i)return;if(Uo.derivedResolves+=1,n.status=i.status,n.reason=i.reason,n.kind==="lens"){let r=pn(n.sourcePaneId);if(o.tabOrder.length>0||o.activeTabId!==null){let l=[...o.tabOrder];for(let s of l)if(Km(s),r)wh(r,s);o.activeTabId=null}if(n.preset==="diff"&&i.status!=="ready")n.diff=null;A(e,i,t);return}if(C(e,i,t),n.resolved!==null&&bt(e)===null)n.resolved=null;if(i.path===null||i.path===n.resolved){v(e,i);return}n.resolved=i.path,Uo.derivedRetargets+=1;let a=t.openFileInPane(e,i.path);if(i.select===null)return;Promise.resolve(a).then(()=>{v(e,i)})}function v(e,t){let o=t.select,n=bt(e);if(!o||!n||t.path!==null&&n.documentPath!==t.path)return;let[i]=n.session.selection;if(i?.length===o.length&&i.every((a,r)=>a===o[r]))return;n.session.selection=[[...o]]}var c=new Map;function A(e,t,o){let n=t.diffPath,i=h(n),{rev:a}=u.git,r=c.get(e);if(n===null||!i||r?.path===n&&r.rev===a)return;c.set(e,{failed:!1,path:n,rev:a}),o.loadDiff(n,i.status).then((l)=>{let s=pn(e)?.derived;if(s?.kind!=="lens"||s.preset!=="diff"||c.get(e)?.path!==n)return;if(l)s.diff=l,s.diffRev=a;else c.set(e,{failed:!0,path:n,rev:a});f(e,o)}).catch((l)=>{console.error("loadDiff error:",l)})}var d=new Map;function C(e,t,o){let n=t.probePath;if(n===null||d.get(e)?.path===n)return;d.set(e,{exists:null,path:n}),o.fileExists(n).then((i)=>{let a=pn(e)?.derived;if(a?.kind!=="companion"||a.preset!=="locale"||d.get(e)?.path!==n)return;d.set(e,{exists:i,path:n}),f(e,o)}).catch((i)=>{console.error("fileExists error:",i)})}var p=new Map;function M(e,t){if(p.has(e))return;p.set(e,requestAnimationFrame(()=>{p.delete(e);try{f(e,t)}catch(o){console.error("applyDerivation error:",o)}}))}function hD(e,t){ne(()=>{let o=pn(e),n=o?.derived;if(!n)return;o.activeTabId;let i=bt(n.sourcePaneId);if(n.kind==="lens"&&n.preset==="code")i?.session.ui.canvasMode;if(n.kind==="companion"&&n.preset==="component")i?.session.selection;if(n.kind==="companion"&&n.preset==="layout")u.layoutSelection,i?.doc.document?.$layout;M(e,t)})}function tw(e,t,o,n=null){let i=bt(t);if(!i)return"an open document";let a=T[e];if(a&&!i.capabilities.modes.includes(a))return`a document with a ${x[a]} view — this one declares none`;if(e==="code")return Oc(i)==="source"?"a source pane that is not already showing Code":null;if(e==="diff")return h(i.documentPath)===null?"a file with changes against HEAD":null;if(e==="breakpoint")return M_(i).includes(o)?null:"a breakpoint this document declares — see Project Settings › Contexts";if(e==="layout")return sl(i.doc.document.$layout)===null?"a page with a layout — this one declares none":null;if(e==="locale"){let r=Ts();if(r===null||r.locales.length<2)return"a project that declares more than one locale — see Project Settings › Locales";if(i.documentPath===null)return"a document that has been saved";return n!==null&&r.locales.includes(n)?null:"a locale this project declares"}return null}function ib(e){let t=pn(e);return t&&t.activeTabId!==null&&t.derived===null?null:D}var D="an open document in a pane that is not itself derived";function O(e,t,o,n=null){if(e==="locale")return{kind:"companion",locale:n,preset:e,reason:"",resolved:null,sourcePaneId:t,status:"loading"};if(e==="layout"||e==="component")return{kind:"companion",preset:e,reason:"",resolved:null,sourcePaneId:t,status:"loading"};return{diff:null,kind:"lens",media:e==="breakpoint"?o:null,mode:e==="code"?"source":e==="diff"?"git-diff":"design",preset:e,reason:"",sourcePaneId:t,status:"loading",zoom:1}}function P(){return m.panes.find((e)=>fE(e.id)===null)??null}function fE(e){let t=pn(e);return t?.derived?.kind==="companion"&&t.activeTabId?null:y}var y="a derived pane showing a document of its own — Code, Diff and breakpoint views project "+"the document already open beside them";function pD(e){return[{args:Ce({locale:We('BCP 47 tag for preset "locale". Ignored by every other preset.'),media:We('Breakpoint name for preset "breakpoint" — omit or leave empty for the base size. '+"Ignored by every other preset."),preset:pi(O_,"Which projection of this pane's document to show beside it.")},["preset"]),id:"pane.derive",title:"Show Beside This…",category:"View",level:"document",menus:["context/pane"],group:"5_pane",when:(t)=>t.document.open,enablement:()=>ib(Gr().id)===null,requires:D,undo:"none",run:(t,o)=>{let n=Vn("pane.derive",o,"preset",O_),i=ti("pane.derive",o,"media")??null,a=ti("pane.derive",o,"locale")??null,r=Gr(),l=tw(n,r.id,i,a);if(l)throw RangeError(`command "pane.derive" argument "preset": "${n}" requires ${l}`);let s=TC(r.id);F(s.id,O(n,r.id,i,a));let E=[...s.tabOrder];for(let g of E)Km(g),wh(r,g);f(s.id,e)}},{id:"pane.pin",title:"Keep This Document",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:()=>P()!==null,requires:y,undo:"none",run:()=>{let t=P();if(!t?.activeTabId)return;Xc(t.activeTabId),pE(t.id)}}]}
2
- export{O_,Au,M_,pE,hD,tw,ib,fE,pD};
1
+ import{Ne}from"./studio-n9qba0gx.js";import{bt,ka,Uo,Hr}from"./studio-53wy9ek3.js";import{Wt,Qc,ti,qn,Se,pi,Fe,m,qr,pn,o1,ng,Sh,td}from"./studio-yrcrncev.js";import{to,Ts,hl,u}from"./studio-x0gsfr1d.js";import{Vt}from"./studio-4f7thq0p.js";import{oe}from"./studio-v5wktj6f.js";import{te}from"./studio-3qr08sxq.js";var sS=["code","layout","component","diff","breakpoint","locale"],T={breakpoint:"design",code:"source",component:"design"},x={design:"Design",source:"Code"},k="Could not read this file's comparison against HEAD.";var ju={breakpoint:"Same page at",code:"Code",component:"Component definition",diff:"Diff vs HEAD",layout:"Layout",locale:"Same page in"};function R(e){let t=pn(e)?.derived;if(!t)return null;let o=bt(t.sourcePaneId);if(!o)return{diffPath:null,kind:t.kind,media:null,mode:null,path:null,probePath:null,reason:"The pane this one follows has no document open.",select:null,status:"unavailable"};if(t.kind==="lens")return w(e,t,o);return S(e,t,o)}function w(e,t,o){let n={diffPath:null,kind:"lens",media:t.media,mode:t.mode,path:null,probePath:null,select:null};if(t.preset==="diff"){let i=o.documentPath;if(!h(i))return{...n,reason:"Nothing to compare — this file matches HEAD.",status:"unavailable"};if(t.diff?.filePath===i&&(t.diffRev===void 0||t.diffRev===u.git.rev))return{...n,reason:"",status:"ready"};if(c.get(e)?.failed&&c.get(e)?.path===i)return{...n,reason:k,status:"unavailable"};return{...n,diffPath:i,reason:"",status:"loading"}}if(t.preset==="code"&&ka(o)==="source")return{...n,reason:"The pane this one follows is showing Code — one document has one editor.",status:"unavailable"};if(t.preset==="breakpoint"&&!aS(o).includes(t.media))return{...n,reason:`This document does not declare a "${t.media??"base"}" breakpoint.`,status:"unavailable"};return{...n,reason:"",status:"ready"}}function h(e){return u.git.status?.files.find((t)=>t.path===e&&(t.status==="M"||t.status==="A"||t.status==="U"))??null}function S(e,t,o){let n={diffPath:null,kind:"companion",media:null,mode:null};if(t.preset==="layout"){let a=u.layoutSelection,r=a?.layoutFile??hl(o.doc.document.$layout);return r===null?{...n,path:null,probePath:null,reason:"This page has no layout.",select:null,status:"unavailable"}:{...n,path:r,probePath:null,reason:"",select:a?a.layoutPath:null,status:"ready"}}if(t.preset==="locale"){let a=Ts(),r=o.documentPath===null||t.locale===null?null:Qc(o.documentPath,t.locale,a);if(r===null)return{...n,path:null,probePath:null,reason:"This document has no path in that locale.",select:null,status:"unavailable"};let l=d.get(e);if(l?.path!==r||l.exists===null)return{...n,path:null,probePath:r,reason:"",select:null,status:"loading"};if(!l.exists)return{...n,path:null,probePath:null,reason:`No ${Wt(t.locale)} copy of this document yet — `+"the Languages panel can create one.",select:null,status:"unavailable"};return{...n,path:r,probePath:null,reason:"",select:null,status:"ready"}}let i=_(o);if(i===null)return t.resolved===null?{...n,path:null,probePath:null,reason:"Select an element inside a component to see its definition.",select:null,status:"unavailable"}:{...n,path:null,probePath:null,reason:"",select:null,status:"ready"};return{...n,path:i,probePath:null,reason:"",select:null,status:"ready"}}function aS(e){let{sizeBreakpoints:t}=Hr(to(e.doc.document.$media));return[null,...t.map((o)=>o.name)]}function _(e){let[t]=e?.session.selection??[];if(!e||!t)return null;let o=e.doc.document,n=[...t];while(n){let i=oe(o,n),a=i?Ne.find((r)=>r.tagName===i.tagName):null;if(a?.path)return a.path;n=Vt(n)}return null}function F(e,t){if(t.sourcePaneId===e||!pn(t.sourcePaneId))throw RangeError(`pane "${e}" cannot derive from "${t.sourcePaneId}" — a derivation names `+"another pane that is in the grid");b(e,t)}function b(e,t){let o=pn(e);if(o)c.delete(e),d.delete(e),o.derived=t}function GE(e){b(e,null)}function f(e,t){let o=pn(e),n=o?.derived,i=R(e);if(!o||!n||!i)return;if(Uo.derivedResolves+=1,n.status=i.status,n.reason=i.reason,n.kind==="lens"){let r=pn(n.sourcePaneId);if(o.tabOrder.length>0||o.activeTabId!==null){let l=[...o.tabOrder];for(let s of l)if(ng(s),r)Sh(r,s);o.activeTabId=null}if(n.preset==="diff"&&i.status!=="ready")n.diff=null;A(e,i,t);return}if(C(e,i,t),n.resolved!==null&&bt(e)===null)n.resolved=null;if(i.path===null||i.path===n.resolved){v(e,i);return}n.resolved=i.path,Uo.derivedRetargets+=1;let a=t.openFileInPane(e,i.path);if(i.select===null)return;Promise.resolve(a).then(()=>{v(e,i)})}function v(e,t){let o=t.select,n=bt(e);if(!o||!n||t.path!==null&&n.documentPath!==t.path)return;let[i]=n.session.selection;if(i?.length===o.length&&i.every((a,r)=>a===o[r]))return;n.session.selection=[[...o]]}var c=new Map;function A(e,t,o){let n=t.diffPath,i=h(n),{rev:a}=u.git,r=c.get(e);if(n===null||!i||r?.path===n&&r.rev===a)return;c.set(e,{failed:!1,path:n,rev:a}),o.loadDiff(n,i.status).then((l)=>{let s=pn(e)?.derived;if(s?.kind!=="lens"||s.preset!=="diff"||c.get(e)?.path!==n)return;if(l)s.diff=l,s.diffRev=a;else c.set(e,{failed:!0,path:n,rev:a});f(e,o)}).catch((l)=>{console.error("loadDiff error:",l)})}var d=new Map;function C(e,t,o){let n=t.probePath;if(n===null||d.get(e)?.path===n)return;d.set(e,{exists:null,path:n}),o.fileExists(n).then((i)=>{let a=pn(e)?.derived;if(a?.kind!=="companion"||a.preset!=="locale"||d.get(e)?.path!==n)return;d.set(e,{exists:i,path:n}),f(e,o)}).catch((i)=>{console.error("fileExists error:",i)})}var p=new Map;function M(e,t){if(p.has(e))return;p.set(e,requestAnimationFrame(()=>{p.delete(e);try{f(e,t)}catch(o){console.error("applyDerivation error:",o)}}))}function XD(e,t){te(()=>{let o=pn(e),n=o?.derived;if(!n)return;o.activeTabId;let i=bt(n.sourcePaneId);if(n.kind==="lens"&&n.preset==="code")i?.session.ui.canvasMode;if(n.kind==="companion"&&n.preset==="component")i?.session.selection;if(n.kind==="companion"&&n.preset==="layout")u.layoutSelection,i?.doc.document?.$layout;M(e,t)})}function bw(e,t,o,n=null){let i=bt(t);if(!i)return"an open document";let a=T[e];if(a&&!i.capabilities.modes.includes(a))return`a document with a ${x[a]} view — this one declares none`;if(e==="code")return ka(i)==="source"?"a source pane that is not already showing Code":null;if(e==="diff")return h(i.documentPath)===null?"a file with changes against HEAD":null;if(e==="breakpoint")return aS(i).includes(o)?null:"a breakpoint this document declares — see Project Settings › Contexts";if(e==="layout")return hl(i.doc.document.$layout)===null?"a page with a layout — this one declares none":null;if(e==="locale"){let r=Ts();if(r===null||r.locales.length<2)return"a project that declares more than one locale — see Project Settings › Locales";if(i.documentPath===null)return"a document that has been saved";return n!==null&&r.locales.includes(n)?null:"a locale this project declares"}return null}function yb(e){let t=pn(e);return t&&t.activeTabId!==null&&t.derived===null?null:D}var D="an open document in a pane that is not itself derived";function O(e,t,o,n=null){if(e==="locale")return{kind:"companion",locale:n,preset:e,reason:"",resolved:null,sourcePaneId:t,status:"loading"};if(e==="layout"||e==="component")return{kind:"companion",preset:e,reason:"",resolved:null,sourcePaneId:t,status:"loading"};return{diff:null,kind:"lens",media:e==="breakpoint"?o:null,mode:e==="code"?"source":e==="diff"?"git-diff":"design",preset:e,reason:"",sourcePaneId:t,status:"loading",zoom:1}}function P(){return m.panes.find((e)=>KE(e.id)===null)??null}function KE(e){let t=pn(e);return t?.derived?.kind==="companion"&&t.activeTabId?null:y}var y="a derived pane showing a document of its own — Code, Diff and breakpoint views project "+"the document already open beside them";function QD(e){return[{args:Se({locale:Fe('BCP 47 tag for preset "locale". Ignored by every other preset.'),media:Fe('Breakpoint name for preset "breakpoint" — omit or leave empty for the base size. '+"Ignored by every other preset."),preset:pi(sS,"Which projection of this pane's document to show beside it.")},["preset"]),id:"pane.derive",title:"Show Beside This…",category:"View",level:"document",menus:["context/pane"],group:"5_pane",when:(t)=>t.document.open,enablement:()=>yb(qr().id)===null,requires:D,undo:"none",run:(t,o)=>{let n=qn("pane.derive",o,"preset",sS),i=ti("pane.derive",o,"media")??null,a=ti("pane.derive",o,"locale")??null,r=qr(),l=bw(n,r.id,i,a);if(l)throw RangeError(`command "pane.derive" argument "preset": "${n}" requires ${l}`);let s=o1(r.id);F(s.id,O(n,r.id,i,a));let E=[...s.tabOrder];for(let g of E)ng(g),Sh(r,g);f(s.id,e)}},{id:"pane.pin",title:"Keep This Document",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:()=>P()!==null,requires:y,undo:"none",run:()=>{let t=P();if(!t?.activeTabId)return;td(t.activeTabId),GE(t.id)}}]}
2
+ export{sS,ju,aS,GE,XD,bw,yb,KE,QD};
3
3
 
4
- //# debugId=F1C86F560EDDDAE864756E2164756E21
5
- //# sourceMappingURL=studio-43y04qck.js.map
4
+ //# debugId=02DD2968B046325064756E2164756E21
5
+ //# sourceMappingURL=studio-hfxttkyr.js.map
@@ -0,0 +1,5 @@
1
+ import{mi}from"./studio-nvcn2ykc.js";import{ja}from"./studio-3qr08sxq.js";import{n}from"./studio-k3we3kqb.js";var w=new Set([".apng",".avif",".bmp",".gif",".ico",".jpeg",".jpg",".png",".svg",".webp",".eot",".otf",".ttf",".woff",".woff2",".m4v",".mov",".mp4",".ogv",".webm",".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav"]);function d(e){let o=e.lastIndexOf("/"),t=e.lastIndexOf(".");return t>o+1&&w.has(e.slice(t).toLowerCase())}var c=new Map,u=0,R=0,m=new Map,h=new Map,s=new Map,v=0,b=Date.now().toString(36),l=null,g=null,y=Object.freeze({}),pv=ja(0);function p(){g=null,pv.value+=1}function x(e){if(!s.has(e))return!1;return v+=1,s.set(e,`${b}.${v.toString(36)}`),l=null,d(e)}function S(e){if(s.delete(e))l=null}function O(){return u}function E(e,o){let t=m.get(e);if(t!==void 0&&t>o)return!0;for(let[i,r]of h)if(r>o&&e.startsWith(i))return!0;return!1}function P(e,o){if(o<R)return;let t=!1;for(let i of e){if(i.type!=="file")continue;let r=mi(i.path);if(r===""||E(r,o))continue;let a=n(i.version)&&i.version!==""?i.version:null,f=c.get(r);if(a===null){if(f===void 0)continue;c.delete(r)}else if(f===a)continue;else c.set(r,a),S(r);if(d(r))t=!0}if(t)p()}async function $s(e){let o=O(),t=await e();return P(t,o),t}function Kd(e,o=[]){u+=1;let t=!1;for(let i of e){let r=mi(i);if(r==="")continue;if(m.set(r,u),c.delete(r)&&d(r))t=!0;if(x(r))t=!0}for(let i of o){let r=mi(i);if(r==="")continue;let a=`${r}/`;h.set(a,u);for(let f of s.keys())if(f.startsWith(a)&&x(f))t=!0;for(let f of c.keys())if(f.startsWith(a)){if(c.delete(f),d(f))t=!0}}if(t)p()}function HO(e){return c.get(mi(e))}function gh(){if(g)return g;let e={},o=!1;for(let[t,i]of c)if(d(t))e[t]=i,o=!0;return g=o?Object.freeze(e):y,g}function sI(){let e=gh()!==y;if(c.clear(),m.clear(),h.clear(),u+=1,R=u,e)p()}function BO(e){let o=mi(e);if(o==="")return;v+=1;let t=`${b}.${v.toString(36)}`;if(s.set(o,t),l=null,d(o))p();return t}function zO(e){return s.get(mi(e))}function WO(){return s.size>0}function Vp(){if(l)return l;return l=s.size===0?y:Object.freeze(Object.fromEntries(s)),l}function Um(){if(sI(),s.size>0)s.clear(),l=null,p()}
2
+ export{pv,$s,Kd,HO,gh,sI,BO,zO,WO,Vp,Um};
3
+
4
+ //# debugId=B5EC893CD327897964756E2164756E21
5
+ //# sourceMappingURL=studio-hh394phe.js.map
@@ -1,5 +1,5 @@
1
- import{n,v}from"./studio-8z66jk4z.js";var S=500;class h extends Error{constructor(){super();this.name="MaxOpsExceededError"}}function Ws(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,r)=>Ws(i,t[r]));if(v(e)&&v(t)){let i=Object.keys(e),r=Object.keys(t);return i.length===r.length&&i.every((a)=>(a in t)&&Ws(e[a],t[a]))}return!1}function A(e){let t=5381;for(let i=0;i<e.length;i++)t=Math.imul(t,33)+(e.codePointAt(i)??0);return t.toString(36)}function m(e){return n(e)?`s:${e}`:`n:${A(JSON.stringify(e))}`}function g(e){if(n(e))return"s";let{attributes:t,$props:i}=e,r=(v(t)?t.id:void 0)??(v(i)?i.key:void 0)??"";return`w:${String(e.tagName??"")}:${String(r)}`}function y(e,t,i=Number.POSITIVE_INFINITY){let r=e.length,a=t.length;if(r===0||a===0||r*a>i)return[];let l=Array.from({length:r+1},()=>Array.from({length:a+1},()=>0));for(let s=r-1;s>=0;s--)for(let c=a-1;c>=0;c--)l[s][c]=e[s]===t[c]?l[s+1][c+1]+1:Math.max(l[s+1][c],l[s][c+1]);let f=[],o=0,u=0;while(o<r&&u<a)if(e[o]===t[u])f.push([o,u]),o+=1,u+=1;else if(l[o+1][u]>=l[o][u+1])o+=1;else u+=1;return f}function aT(e,t,i={}){let r=i.maxCells??Number.POSITIVE_INFINITY,a=y(e.map((s)=>m(s)),t.map((s)=>m(s)),r),l=[],f=-1,o=-1,u=[];for(let[s,c]of a)u.push([f+1,s,o+1,c]),l.push({aIndex:s,bIndex:c,identical:!0}),f=s,o=c;u.push([f+1,e.length,o+1,t.length]);for(let[s,c,x,I]of u){let J=e.slice(s,c),O=t.slice(x,I);for(let[M,N]of y(J.map((p)=>g(p)),O.map((p)=>g(p)),r))l.push({aIndex:s+M,bIndex:x+N,identical:!1})}return l.toSorted((s,c)=>s.aIndex-c.aIndex)}function d(e,t){if(e.ops.length>=e.maxOps)throw new h;e.ops.push(t)}function b(e,t,i,r){for(let f of new Set([...Object.keys(i),...Object.keys(r)])){if(f==="children")continue;if(!(f in r))d(e,{key:f,op:"set-key",path:t});else if(!Ws(i[f],r[f]))d(e,{key:f,op:"set-key",path:t,value:r[f]})}let a=i.children,l=r.children;if(Array.isArray(a)&&Array.isArray(l))D(e,t,a,l);else if(!Ws(a,l))d(e,{key:"children",op:"set-key",path:t,value:l})}function D(e,t,i,r){let a=aT(i,r),l=new Set(a.map((o)=>o.aIndex)),f=new Map(a.map((o)=>[o.bIndex,o]));for(let o=i.length-1;o>=0;o--)if(!l.has(o))d(e,{index:o,op:"remove-child",parentPath:t});for(let[o,u]of r.entries()){let s=f.get(o);if(!s){d(e,{index:o,node:u,op:"insert-child",parentPath:t});continue}if(s.identical)continue;let c=i[s.aIndex];if(v(c)&&v(u))b(e,[...t,"children",o],c,u);else if(!Ws(c,u))d(e,{index:o,node:u,op:"set-child",parentPath:t})}}function dP(e,t,i={}){let r={maxOps:i.maxOps??S,ops:[]};try{b(r,[],e,t)}catch(a){if(a instanceof h)return null;throw a}return r.ops}
2
- export{Ws,aT,dP};
1
+ import{n,v}from"./studio-k3we3kqb.js";var S=500;class h extends Error{constructor(){super();this.name="MaxOpsExceededError"}}function Vs(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,r)=>Vs(i,t[r]));if(v(e)&&v(t)){let i=Object.keys(e),r=Object.keys(t);return i.length===r.length&&i.every((a)=>(a in t)&&Vs(e[a],t[a]))}return!1}function A(e){let t=5381;for(let i=0;i<e.length;i++)t=Math.imul(t,33)+(e.codePointAt(i)??0);return t.toString(36)}function m(e){return n(e)?`s:${e}`:`n:${A(JSON.stringify(e))}`}function g(e){if(n(e))return"s";let{attributes:t,$props:i}=e,r=(v(t)?t.id:void 0)??(v(i)?i.key:void 0)??"";return`w:${String(e.tagName??"")}:${String(r)}`}function y(e,t,i=Number.POSITIVE_INFINITY){let r=e.length,a=t.length;if(r===0||a===0||r*a>i)return[];let l=Array.from({length:r+1},()=>Array.from({length:a+1},()=>0));for(let s=r-1;s>=0;s--)for(let c=a-1;c>=0;c--)l[s][c]=e[s]===t[c]?l[s+1][c+1]+1:Math.max(l[s+1][c],l[s][c+1]);let f=[],o=0,u=0;while(o<r&&u<a)if(e[o]===t[u])f.push([o,u]),o+=1,u+=1;else if(l[o+1][u]>=l[o][u+1])o+=1;else u+=1;return f}function GT(e,t,i={}){let r=i.maxCells??Number.POSITIVE_INFINITY,a=y(e.map((s)=>m(s)),t.map((s)=>m(s)),r),l=[],f=-1,o=-1,u=[];for(let[s,c]of a)u.push([f+1,s,o+1,c]),l.push({aIndex:s,bIndex:c,identical:!0}),f=s,o=c;u.push([f+1,e.length,o+1,t.length]);for(let[s,c,x,I]of u){let J=e.slice(s,c),O=t.slice(x,I);for(let[M,N]of y(J.map((p)=>g(p)),O.map((p)=>g(p)),r))l.push({aIndex:s+M,bIndex:x+N,identical:!1})}return l.toSorted((s,c)=>s.aIndex-c.aIndex)}function d(e,t){if(e.ops.length>=e.maxOps)throw new h;e.ops.push(t)}function b(e,t,i,r){for(let f of new Set([...Object.keys(i),...Object.keys(r)])){if(f==="children")continue;if(!(f in r))d(e,{key:f,op:"set-key",path:t});else if(!Vs(i[f],r[f]))d(e,{key:f,op:"set-key",path:t,value:r[f]})}let a=i.children,l=r.children;if(Array.isArray(a)&&Array.isArray(l))D(e,t,a,l);else if(!Vs(a,l))d(e,{key:"children",op:"set-key",path:t,value:l})}function D(e,t,i,r){let a=GT(i,r),l=new Set(a.map((o)=>o.aIndex)),f=new Map(a.map((o)=>[o.bIndex,o]));for(let o=i.length-1;o>=0;o--)if(!l.has(o))d(e,{index:o,op:"remove-child",parentPath:t});for(let[o,u]of r.entries()){let s=f.get(o);if(!s){d(e,{index:o,node:u,op:"insert-child",parentPath:t});continue}if(s.identical)continue;let c=i[s.aIndex];if(v(c)&&v(u))b(e,[...t,"children",o],c,u);else if(!Vs(c,u))d(e,{index:o,node:u,op:"set-child",parentPath:t})}}function bF(e,t,i={}){let r={maxOps:i.maxOps??S,ops:[]};try{b(r,[],e,t)}catch(a){if(a instanceof h)return null;throw a}return r.ops}
2
+ export{Vs,GT,bF};
3
3
 
4
- //# debugId=14C6DAB00943B37164756E2164756E21
5
- //# sourceMappingURL=studio-pjtntksy.js.map
4
+ //# debugId=13A8EE013C9C522B64756E2164756E21
5
+ //# sourceMappingURL=studio-j0zf5x2x.js.map
@@ -0,0 +1,5 @@
1
+ import{Gn,m,Ft}from"./studio-yrcrncev.js";import{wN}from"./studio-9qx1ywbv.js";import{rh}from"./studio-53wy9ek3.js";import{ce}from"./studio-0939t1q1.js";var e="edit",a=new Set(["edit","design"]);function r(t){for(let i of m.tabs.values())if(i.documentPath===t)return i;return null}async function Vl(t){if(!rh(t)){let o=Gn(t);if(o&&!o.fileBacked)return wN(t);let{openFileInTab:s}=await (ce("t07yqqej"),import("./files-t07yqqej.js"));return await s(t),r(t)}let{openFileInTab:i}=await (ce("t07yqqej"),import("./files-t07yqqej.js"));await i(t);let n=r(t);if(!n)return null;if(!a.has(n.session.ui.canvasMode)&&n.capabilities.modes.includes(e))n.session.ui.canvasMode=e,n.session.ui.preview=!1;return Ft(n.id),n}
2
+ export{Vl};
3
+
4
+ //# debugId=1FB211209C9683E364756E2164756E21
5
+ //# sourceMappingURL=studio-jeb7hth3.js.map