@jxsuite/studio 10.0.0 → 10.2.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 (244) hide show
  1. package/dist/chunks/{2020-j56903f1.js → 2020-bx702wqa.js} +3 -3
  2. package/dist/chunks/adapter-pp011m5x.js +4 -0
  3. package/dist/chunks/add-new-flow-ecqmzz76.js +4 -0
  4. package/dist/chunks/cf-account-picker-c07znkqt.js +4 -0
  5. package/dist/chunks/cf-settings-0v2bmqy0.js +4 -0
  6. package/dist/chunks/components-yn0dn2pq.js +4 -0
  7. package/dist/chunks/content-source-g0j41yy6.js +4 -0
  8. package/dist/chunks/{convert-to-repeater-fhdwyg14.js → convert-to-repeater-sbjk7tgn.js} +3 -3
  9. package/dist/chunks/editor-xz02jeh1.js +4 -0
  10. package/dist/chunks/entry-commands-kmt02crp.js +4 -0
  11. package/dist/chunks/extension-sections-0rprf12d.js +4 -0
  12. package/dist/chunks/file-ops-mexj5qed.js +4 -0
  13. package/dist/chunks/files-b2tcppdd.js +4 -0
  14. package/dist/chunks/format-host-btsevv0c.js +4 -0
  15. package/dist/chunks/fs-events-r0apejva.js +4 -0
  16. package/dist/chunks/grid-open-n2a8xkht.js +4 -0
  17. package/dist/chunks/{grid-view-ka55z38f.js → grid-view-tghcwrrt.js} +12 -12
  18. package/dist/chunks/iframe-host-gx0ypyh3.js +4 -0
  19. package/dist/chunks/index-bs4k9tr6.js +4 -0
  20. package/dist/chunks/{index-qb98xhse.js → index-vr006kbt.js} +3 -3
  21. package/dist/chunks/{javascript-ces13wny.js → javascript-z1g3s9fd.js} +2 -2
  22. package/dist/chunks/{jsonMode-6md16d4v.js → jsonMode-7szwg8c4.js} +5 -5
  23. package/dist/chunks/jx-validate-ymf10teh.js +4 -0
  24. package/dist/chunks/layers-p9nfya38.js +4 -0
  25. package/dist/chunks/layers-panel-tt1hzhhf.js +4 -0
  26. package/dist/chunks/lit-html-x18n2sfz.js +4 -0
  27. package/dist/chunks/media-library-0n45gv8r.js +4 -0
  28. package/dist/chunks/media-picker-s09at95z.js +4 -0
  29. package/dist/chunks/{monaco-binding-p8j80s4w.js → monaco-binding-v42w9c1v.js} +3 -3
  30. package/dist/chunks/monaco-buffer-een2ea0v.js +4 -0
  31. package/dist/chunks/{monaco-setup-wasktzfg.js → monaco-setup-7bffxd6v.js} +3 -3
  32. package/dist/chunks/notify-qwb8radt.js +4 -0
  33. package/dist/chunks/parse-v77xtwv7.js +4 -0
  34. package/dist/chunks/platform-8jnez0wr.js +4 -0
  35. package/dist/chunks/publish-panel-aysnj611.js +4 -0
  36. package/dist/chunks/{publish-quick-vr695j26.js → publish-quick-kpbqs9mz.js} +3 -3
  37. package/dist/chunks/publish-workspace-nd0a8q99.js +4 -0
  38. package/dist/chunks/quick-search-vg0jkhk2.js +4 -0
  39. package/dist/chunks/references-a7v6a0e2.js +4 -0
  40. package/dist/chunks/right-panel-cvk1vxx5.js +4 -0
  41. package/dist/chunks/source-control-fsqzc6he.js +4 -0
  42. package/dist/chunks/studio-05jfwbmf.js +5 -0
  43. package/dist/chunks/{studio-hy4ye0dx.js → studio-0q5jwddh.js} +7 -7
  44. package/dist/chunks/{studio-jttyqrmh.js → studio-0w2dr0q8.js} +4 -4
  45. package/dist/chunks/{studio-xkxetm65.js → studio-1tzpds97.js} +5 -5
  46. package/dist/chunks/{studio-m48v13s3.js → studio-216b27sv.js} +3 -3
  47. package/dist/chunks/studio-2ejhqns4.js +5 -0
  48. package/dist/chunks/studio-2r90cts3.js +16 -0
  49. package/dist/chunks/{studio-h310mbqm.js → studio-399a25za.js} +4 -4
  50. package/dist/chunks/studio-399xknkb.js +6 -0
  51. package/dist/chunks/{studio-wxhy1yh7.js → studio-43y04qck.js} +4 -4
  52. package/dist/chunks/{studio-06j4en5h.js → studio-4g8yb6jn.js} +2 -2
  53. package/dist/chunks/{studio-jw0q5j6k.js → studio-4jhw38b2.js} +4 -4
  54. package/dist/chunks/{studio-3v5cagy9.js → studio-4ncmwqw5.js} +4 -4
  55. package/dist/chunks/studio-5atwjgkj.js +7 -0
  56. package/dist/chunks/{studio-gr36vnte.js → studio-5frqk7c0.js} +4 -4
  57. package/dist/chunks/{studio-9dz76yqc.js → studio-646nn2ys.js} +5 -5
  58. package/dist/chunks/{studio-tj2s0tks.js → studio-6cwj6xrx.js} +4 -4
  59. package/dist/chunks/studio-6hzdjfv0.js +5 -0
  60. package/dist/chunks/{studio-hcsba201.js → studio-71m92v9s.js} +7 -7
  61. package/dist/chunks/{studio-3c8pp7pb.js → studio-75kcdbsk.js} +4 -4
  62. package/dist/chunks/{studio-gwrhcrss.js → studio-78pywnp2.js} +5 -5
  63. package/dist/chunks/{studio-9cxmp61c.js → studio-86r8hp7r.js} +5 -5
  64. package/dist/chunks/studio-886t6ztg.js +5 -0
  65. package/dist/chunks/studio-8wnvtr4z.js +5 -0
  66. package/dist/chunks/studio-8z66jk4z.js +5 -0
  67. package/dist/chunks/{studio-ajw4k8hp.js → studio-9rbe2xpw.js} +3 -3
  68. package/dist/chunks/{studio-y26hx9re.js → studio-awxwjawq.js} +4 -4
  69. package/dist/chunks/studio-b2qpt0xy.js +14 -0
  70. package/dist/chunks/{studio-dx73md4n.js → studio-bvs9kpst.js} +7 -7
  71. package/dist/chunks/studio-c71806xz.js +7 -0
  72. package/dist/chunks/{studio-7dzyz9n8.js → studio-cbwks69x.js} +144 -144
  73. package/dist/chunks/studio-cg1bfyhf.js +9 -0
  74. package/dist/chunks/studio-cg710sk9.js +5 -0
  75. package/dist/chunks/studio-cw0wb9qk.js +7 -0
  76. package/dist/chunks/studio-cyheys7k.js +5 -0
  77. package/dist/chunks/studio-ea5m9kg5.js +5 -0
  78. package/dist/chunks/{studio-ry81j4q1.js → studio-ea74s8c1.js} +4 -4
  79. package/dist/chunks/{studio-xdpz9rpe.js → studio-efdxjwyp.js} +34 -34
  80. package/dist/chunks/{studio-agyvzfm4.js → studio-egmw2837.js} +4 -4
  81. package/dist/chunks/{studio-5tzgq6fx.js → studio-er5f383a.js} +4 -4
  82. package/dist/chunks/studio-f746039f.js +5 -0
  83. package/dist/chunks/studio-fmdymd9v.js +5 -0
  84. package/dist/chunks/studio-gcm12z00.js +6 -0
  85. package/dist/chunks/{studio-vswcpzk7.js → studio-gj98m8gy.js} +5 -5
  86. package/dist/chunks/{studio-yg3djpnm.js → studio-hasbgjah.js} +4 -4
  87. package/dist/chunks/studio-hhp4x8xf.js +6 -0
  88. package/dist/chunks/{studio-3w35qvay.js → studio-hz5n7x27.js} +4 -4
  89. package/dist/chunks/{studio-7xag4na8.js → studio-j3d2fjqz.js} +4 -4
  90. package/dist/chunks/studio-jeraxdgv.js +7 -0
  91. package/dist/chunks/studio-jvgek9xt.js +5 -0
  92. package/dist/chunks/studio-jws1a87n.js +5 -0
  93. package/dist/chunks/studio-k2sz13zg.js +5 -0
  94. package/dist/chunks/studio-k3m4jkdk.js +5 -0
  95. package/dist/chunks/{studio-r17asgs0.js → studio-kg1abnz0.js} +4 -4
  96. package/dist/chunks/{studio-s0fg2wav.js → studio-kg5ya5r2.js} +4 -4
  97. package/dist/chunks/studio-khwbgrtg.js +5 -0
  98. package/dist/chunks/studio-mx6wzh25.js +5 -0
  99. package/dist/chunks/studio-mxs3ar9t.js +5 -0
  100. package/dist/chunks/studio-nm4szey4.js +5 -0
  101. package/dist/chunks/studio-nqxqf8p2.js +4 -0
  102. package/dist/chunks/{studio-h5tpz5ke.js → studio-pjtntksy.js} +4 -4
  103. package/dist/chunks/studio-qh8berdz.js +5 -0
  104. package/dist/chunks/studio-qn7z4krm.js +5 -0
  105. package/dist/chunks/studio-qyed0ah6.js +5 -0
  106. package/dist/chunks/{studio-x97ay0v4.js → studio-r4bcdwhq.js} +4 -4
  107. package/dist/chunks/{studio-wxdcd42g.js → studio-r7pf0rkv.js} +6 -6
  108. package/dist/chunks/studio-rtfnhrdg.js +5 -0
  109. package/dist/chunks/{studio-fy7jzj9j.js → studio-rzqaz21g.js} +4 -4
  110. package/dist/chunks/studio-s5tzw84t.js +5 -0
  111. package/dist/chunks/{studio-1e8dw2w2.js → studio-sevbc3xv.js} +4 -4
  112. package/dist/chunks/{studio-ewarnzm4.js → studio-sxdb9h3q.js} +6 -6
  113. package/dist/chunks/studio-t51y8v1d.js +5 -0
  114. package/dist/chunks/{studio-k3bcy02e.js → studio-t98vq4r6.js} +4 -4
  115. package/dist/chunks/studio-th7z3fg7.js +5 -0
  116. package/dist/chunks/studio-tsxpqvh0.js +6 -0
  117. package/dist/chunks/{studio-396srjbk.js → studio-v1yascv2.js} +4 -4
  118. package/dist/chunks/{studio-ekgtrndg.js → studio-wc6za3zs.js} +4 -4
  119. package/dist/chunks/{studio-ndskgqef.js → studio-wxq6v5sv.js} +4 -4
  120. package/dist/chunks/{studio-4kzbrr5t.js → studio-y60sts62.js} +3 -3
  121. package/dist/chunks/studio-ybnwymxw.js +5 -0
  122. package/dist/chunks/studio-zndrqawb.js +5 -0
  123. package/dist/chunks/studio-zwaxn5s2.js +5 -0
  124. package/dist/chunks/{tsMode-h6tkz0ea.js → tsMode-f54j66ym.js} +5 -5
  125. package/dist/chunks/workspace-home-x1787wpv.js +4 -0
  126. package/dist/chunks/workspace-zpe1np43.js +4 -0
  127. package/dist/chunks/{ws-client-e951my95.js → ws-client-e8kj684q.js} +3 -3
  128. package/dist/manifest.json +76 -75
  129. package/dist/studio.js +83 -81
  130. package/package.json +4 -4
  131. package/src/browse/library-model.ts +56 -23
  132. package/src/commands/context.ts +1 -0
  133. package/src/editor/shortcuts.ts +3 -0
  134. package/src/panels/data-grid.ts +0 -4
  135. package/src/panels/settings-menu.ts +3 -3
  136. package/src/panels/settings-pane.ts +42 -56
  137. package/src/platform-errors.ts +17 -1
  138. package/src/platforms/cloud.ts +14 -0
  139. package/src/publish/publish-changes.ts +136 -4
  140. package/src/services/ai-import-tools.ts +6 -3
  141. package/src/services/ai-models.ts +65 -11
  142. package/src/services/ai-settings.ts +45 -5
  143. package/src/services/document-assistant.ts +5 -2
  144. package/src/services/settings/definitions.ts +19 -0
  145. package/src/settings/contributed-section.ts +16 -7
  146. package/src/settings/css-vars-editor.ts +4 -4
  147. package/src/settings/general-settings.ts +1 -4
  148. package/src/settings/preferences-accounts.ts +2 -2
  149. package/src/settings/preferences-dialog.ts +4 -2
  150. package/src/settings/project-sections.ts +1 -1
  151. package/src/settings/section-registry.ts +5 -4
  152. package/src/settings/settings-document.ts +33 -24
  153. package/src/settings/settings-workspace.ts +205 -0
  154. package/src/shell.ts +31 -6
  155. package/src/surfaces/ai-credentials-form.json +59 -5
  156. package/src/surfaces/ai-credentials-form.ts +15 -2
  157. package/src/surfaces/commandbar.ts +7 -3
  158. package/src/surfaces/settings-contributed.json +4 -4
  159. package/src/surfaces/settings-contributed.ts +2 -2
  160. package/src/surfaces/settings-pane.json +262 -180
  161. package/src/surfaces/settings-pane.ts +63 -14
  162. package/src/types.ts +14 -0
  163. package/src/ui/ai-credentials-form.ts +128 -11
  164. package/src/ui/regions.ts +5 -5
  165. package/src/workspace/tab-workspace.ts +3 -2
  166. package/src/workspace/workspace-home.ts +18 -4
  167. package/src/workspace/workspace-ids.ts +40 -7
  168. package/dist/chunks/adapter-wc5zvg9a.js +0 -4
  169. package/dist/chunks/add-new-flow-snx1s4b0.js +0 -4
  170. package/dist/chunks/cf-account-picker-xyqw0jex.js +0 -4
  171. package/dist/chunks/cf-settings-hp1pjm0n.js +0 -4
  172. package/dist/chunks/components-nkwphrx3.js +0 -4
  173. package/dist/chunks/content-source-6a253wmk.js +0 -4
  174. package/dist/chunks/editor-wqrc68ca.js +0 -4
  175. package/dist/chunks/entry-commands-nef0wrmp.js +0 -4
  176. package/dist/chunks/extension-sections-8ez2rrk8.js +0 -4
  177. package/dist/chunks/file-ops-y3w71k1n.js +0 -4
  178. package/dist/chunks/files-de90apn9.js +0 -4
  179. package/dist/chunks/format-host-zfjz4rzm.js +0 -4
  180. package/dist/chunks/fs-events-77c0mr0x.js +0 -4
  181. package/dist/chunks/grid-open-4n4fjfpf.js +0 -4
  182. package/dist/chunks/iframe-host-na2mywz4.js +0 -4
  183. package/dist/chunks/index-ewmgdb7c.js +0 -4
  184. package/dist/chunks/jx-validate-b309c020.js +0 -4
  185. package/dist/chunks/layers-8rn8y6qv.js +0 -4
  186. package/dist/chunks/layers-panel-eyah7h9z.js +0 -4
  187. package/dist/chunks/lit-html-wyqw04y2.js +0 -4
  188. package/dist/chunks/media-library-gs3np47y.js +0 -4
  189. package/dist/chunks/media-picker-tt7dk4tb.js +0 -4
  190. package/dist/chunks/monaco-buffer-wsf6cmnq.js +0 -4
  191. package/dist/chunks/notify-qwst108r.js +0 -4
  192. package/dist/chunks/parse-n8dfxnqf.js +0 -4
  193. package/dist/chunks/platform-c16mqvmp.js +0 -4
  194. package/dist/chunks/publish-panel-d34bhvwj.js +0 -4
  195. package/dist/chunks/publish-workspace-2yr60mt4.js +0 -4
  196. package/dist/chunks/quick-search-e6xsdv0d.js +0 -4
  197. package/dist/chunks/references-gsj6trdv.js +0 -4
  198. package/dist/chunks/right-panel-33jv1knc.js +0 -4
  199. package/dist/chunks/source-control-bj9bejjv.js +0 -4
  200. package/dist/chunks/studio-03mqh8ax.js +0 -5
  201. package/dist/chunks/studio-0ydxv2mr.js +0 -7
  202. package/dist/chunks/studio-2hsqbq7b.js +0 -7
  203. package/dist/chunks/studio-2j86y34y.js +0 -6
  204. package/dist/chunks/studio-2ks6ka4g.js +0 -5
  205. package/dist/chunks/studio-34jrz12k.js +0 -5
  206. package/dist/chunks/studio-35vrtpdq.js +0 -5
  207. package/dist/chunks/studio-38g0jdz7.js +0 -5
  208. package/dist/chunks/studio-3zge48z4.js +0 -7
  209. package/dist/chunks/studio-45gyxpcq.js +0 -5
  210. package/dist/chunks/studio-5wzdy1jc.js +0 -16
  211. package/dist/chunks/studio-732mw0g8.js +0 -5
  212. package/dist/chunks/studio-771k2n12.js +0 -5
  213. package/dist/chunks/studio-88bmt9rh.js +0 -5
  214. package/dist/chunks/studio-c1pxszat.js +0 -5
  215. package/dist/chunks/studio-cpkamjdn.js +0 -14
  216. package/dist/chunks/studio-d038kqbs.js +0 -5
  217. package/dist/chunks/studio-d83m0wyq.js +0 -5
  218. package/dist/chunks/studio-dbxv7w4s.js +0 -5
  219. package/dist/chunks/studio-de1s2x9v.js +0 -5
  220. package/dist/chunks/studio-epenqmvk.js +0 -7
  221. package/dist/chunks/studio-et2q4s8n.js +0 -5
  222. package/dist/chunks/studio-h7weqf2q.js +0 -5
  223. package/dist/chunks/studio-hwejq03c.js +0 -5
  224. package/dist/chunks/studio-k3a8rp3d.js +0 -5
  225. package/dist/chunks/studio-p1n2xjda.js +0 -5
  226. package/dist/chunks/studio-pgm83a2f.js +0 -6
  227. package/dist/chunks/studio-pqqq6v85.js +0 -5
  228. package/dist/chunks/studio-psh8mwnw.js +0 -4
  229. package/dist/chunks/studio-rzg8hnkf.js +0 -5
  230. package/dist/chunks/studio-tyw7tk0x.js +0 -5
  231. package/dist/chunks/studio-v9ywz2se.js +0 -6
  232. package/dist/chunks/studio-vzgmyt0v.js +0 -5
  233. package/dist/chunks/studio-x08a3m0a.js +0 -5
  234. package/dist/chunks/studio-x3mjr5cc.js +0 -5
  235. package/dist/chunks/studio-xh683qzy.js +0 -5
  236. package/dist/chunks/studio-yx8hzqja.js +0 -5
  237. package/dist/chunks/studio-zg16eeq1.js +0 -5
  238. package/dist/chunks/studio-zgx7svjd.js +0 -9
  239. package/dist/chunks/studio-zkq3r91p.js +0 -5
  240. package/dist/chunks/workspace-home-zkkrxq3r.js +0 -4
  241. package/dist/chunks/workspace-tdqqjqaa.js +0 -4
  242. package/src/settings/settings-dialog.ts +0 -192
  243. package/src/surfaces/settings-dialog.json +0 -51
  244. package/src/surfaces/settings-dialog.ts +0 -169
@@ -1,4 +1,4 @@
1
- import{ky,ba,e_,rs,t_,ss}from"./studio-dx73md4n.js";import{Se}from"./studio-ekgtrndg.js";import{n,Z,v}from"./studio-zkq3r91p.js";var HI="meta",BI="frontmatter",zI="structure",WI="source",VI=2;function m(e){return v(e)}function wu(e){return e.getMap(HI)}function UI(e){return e.getMap(BI)}function Mg(e){return e.getMap(zI)}function qI(e){return e.getText(WI)}var Y=new Set(["textContent"]),h=new Set(["style","attributes","$props"]);function y(e,t){let o=e.toString();if(o===t)return!1;let r=0,s=Math.min(o.length,t.length);while(r<s&&o[r]===t[r])r+=1;let a=o.length,i=t.length;while(a>r&&i>r&&o[a-1]===t[i-1])a-=1,i-=1;if(a>r)e.delete(r,a-r);if(i>r)e.insert(r,t.slice(r,i));return!0}function f(e){let t=new rs;for(let[o,r]of Object.entries(e)){if(r===void 0)continue;t.set(o,m(r)?f(r):Se(r))}return t}function g(e,t){for(let o of[...e.keys()])if(!(o in t)||t[o]===void 0)e.delete(o);for(let[o,r]of Object.entries(t)){if(r===void 0)continue;let s=e.get(o);if(m(r))if(s instanceof rs)g(s,r);else e.set(o,f(r));else if(!b(s,r))e.set(o,Se(r))}}function b(e,t){if(e===t)return!0;if(e instanceof rs||e instanceof ba||e instanceof ss)return!1;return JSON.stringify(e??null)===JSON.stringify(t??null)}function d(e){return n(e)?new ss(e):GI(e)}function Vf(e){let t=new ba;return t.insert(0,e.map((o)=>d(o))),t}function GI(e){if(!m(e))throw TypeError("collab-schema: a document node must be a plain object");let t=new rs;for(let[o,r]of Object.entries(e)){if(r===void 0)continue;if(o==="children"&&Array.isArray(r))t.set(o,Vf(r));else if(Y.has(o)&&n(r))t.set(o,new ss(r));else if(h.has(o)&&m(r))t.set(o,f(r));else t.set(o,Se(r))}return t}function S(e){return Object.fromEntries(Array.from(e.entries(),([t,o])=>[t,Uf(o)]))}function E(e){if(n(e))return e;return e instanceof ss?e.toString():S(e)}function Uf(e){if(e instanceof rs)return S(e);if(e instanceof ba)return e.toArray().map((t)=>Uf(t));if(e instanceof ss)return e.toString();return e}function u2(e){return S(Mg(e))}function X0(e,t){let o=Mg(e);for(let r of t)if(o instanceof rs)o=o.get(String(r));else if(o instanceof ba){let s=Number(r);if(!Number.isInteger(s)||s<0||s>=o.length)return;o=o.get(s)}else return;return o}function ck(e,t,o){let r=qI(e);if(r.toString()===t)return!1;return e.transact(()=>{y(r,t)},o),!0}function h2(e,t,o={}){let r=wu(e);if(r.get("structureSeeded")===!0)return!1;return e.transact(()=>{let s=Mg(e);for(let[i,c]of Object.entries(t)){if(c===void 0)continue;if(i==="children"&&Array.isArray(c))s.set(i,Vf(c));else s.set(i,Se(c))}let a=UI(e);for(let[i,c]of Object.entries(o.frontmatter??{}))if(c!==void 0)a.set(i,Se(c));r.set("schemaVersion",VI),r.set("canonical","structure"),r.set("canonicalRev",0),r.set("sourceFormat",o.sourceFormat??null),r.set("structureSeeded",!0)},o.origin),!0}var p2="jx-local",f2="jx-mirror",m2="jx-seed";class xu extends Error{constructor(e){super(`collab-path-unresolved:${e.join("/")}`);this.name="CollabPathError"}}function O(e,t){let o=X0(e,t);if(!(o instanceof rs))throw new xu(t);return o}function p(e,t,o){let r=O(e,t),s=r.get("children");if(s instanceof ba)return s;if(o&&s===void 0){let a=new ba;return r.set("children",a),a}throw new xu([...t,"children"])}function J(e,t,o){let r=e.get(t);if(t==="children"&&Array.isArray(o)){e.set(t,Vf(o));return}if(Y.has(t)&&n(o)){if(r instanceof ss)y(r,o);else e.set(t,new ss(o));return}if(h.has(t)&&v(o)){if(r instanceof rs)g(r,o);else e.set(t,f(o));return}e.set(t,Se(o))}function V(e,t){let{op:o}=t;switch(t.op){case"set-key":{let r=O(e,t.path);if(t.value===void 0)r.delete(t.key);else J(r,t.key,t.value);return}case"insert-child":{let r=p(e,t.parentPath,!0);if(t.index<0||t.index>r.length)throw new xu([...t.parentPath,"children",t.index]);r.insert(t.index,[d(t.node)]);return}case"remove-child":{let r=p(e,t.parentPath,!1);if(t.index<0||t.index>=r.length)throw new xu([...t.parentPath,"children",t.index]);r.delete(t.index,1);return}case"set-child":{let r=p(e,t.parentPath,!1);if(t.index<0||t.index>=r.length)throw new xu([...t.parentPath,"children",t.index]);let s=r.get(t.index);if(s instanceof ss&&n(t.node)){y(s,t.node);return}r.delete(t.index,1),r.insert(t.index,[d(t.node)]);return}case"move-child":{let r=p(e,t.fromParentPath,!1),s=p(e,t.toParentPath,!0);if(t.fromIndex<0||t.fromIndex>=r.length)throw new xu([...t.fromParentPath,"children",t.fromIndex]);let a=Uf(r.get(t.fromIndex));if(r.delete(t.fromIndex,1),t.toIndex<0||t.toIndex>s.length)throw new xu([...t.toParentPath,"children",t.toIndex]);s.insert(t.toIndex,[d(a)]);return}default:throw Error(`unknown-doc-op:${o}`)}}function g2(e,t,o){e.transact(()=>{for(let r of t)V(e,r)},o)}function w(e){for(let t=0;t<e.length;t++){let o=e[t];if(!n(o))continue;if(h.has(o))return{key:o,nodePath:e.slice(0,t)};if(Y.has(o))return{key:o,nodePath:e.slice(0,t)}}return null}function P(e){return e instanceof ss||e instanceof rs||n(e)}function C(e){return e.every((t)=>n(t)||Z(t))}function b2(e){if(e.length===0)return[];let t=e.map((s)=>s.path);if(!t.every((s)=>C(s)))return null;for(let s=0;s<t.length;s++)for(let a=0;a<t.length;a++){if(s===a)continue;let i=t[s],c=t[a];if(i.length<=c.length&&i.every((u,l)=>u===c[l]))return null}if(e.filter((s)=>s instanceof ky).length>1)return null;let r=[];for(let s of e){let{path:a}=s,i=w(a);if(i){let{doc:c}=s.target;if(!c)return null;let u=X0(c,[...i.nodePath,i.key]);if(u===void 0)return null;r.push({key:i.key,op:"set-key",path:i.nodePath,value:Uf(u)});continue}if(s instanceof t_){let c=a.at(-1);if(a.at(-2)==="children"&&Z(c)){r.push({index:c,node:s.target.toString(),op:"set-child",parentPath:a.slice(0,-2)});continue}return null}if(s instanceof e_){let c=s.target;for(let[u,l]of s.changes.keys)if(l.action==="delete")r.push({key:u,op:"set-key",path:a});else r.push({key:u,op:"set-key",path:a,value:Uf(c.get(u))})}else if(s instanceof ky){if(a.at(-1)!=="children")return null;let c=a.slice(0,-1),u=0;for(let l of s.changes.delta)if(l.retain!==void 0)u+=l.retain;else if(l.delete!==void 0)for(let x=0;x<l.delete;x++)r.push({index:u,op:"remove-child",parentPath:c});else if(l.insert!==void 0){let x=Array.isArray(l.insert)?l.insert:[l.insert];for(let D of x){if(!P(D))return null;r.push({index:u,node:E(D),op:"insert-child",parentPath:c}),u+=1}}}else return null}return r}function v2(e,t,o){e.transact(()=>{let r=Mg(e),s=[...r.keys()];for(let i of s)if(!(i in t)||t[i]===void 0)r.delete(i);for(let[i,c]of Object.entries(t)){if(c===void 0)continue;if(i==="children"&&Array.isArray(c))r.set(i,Vf(c));else r.set(i,Se(c))}let a=wu(e);a.set("canonicalRev",Number(a.get("canonicalRev")??0)+1)},o)}function dk(e){return wu(e).get("canonical")==="source"?"source":"structure"}function uk(e){return Number(wu(e).get("canonicalRev")??0)}function y2(e,t,o){if(dk(e)==="source")return!1;return e.transact(()=>{ck(e,t,o);let r=wu(e);r.set("canonical","source"),r.set("canonicalRev",uk(e)+1)},o),!0}function w2(e,t){if(dk(e)!=="source")return!1;return e.transact(()=>{let o=wu(e);o.set("canonical","structure"),o.set("canonicalRev",uk(e)+1)},t),!0}function x2(e,t,o){let r=[];for(let[s,a]of e.getStates()){let i=a;if(s!==o&&i.mode==="source"&&i.focusedPath===t)r.push(s)}return r}function _2(e,t){let o=e.clientID,r=e.getStates().get(o);if(r?.mode!=="source"||r.focusedPath!==t)return!1;let s=o;for(let[a,i]of e.getStates()){let c=i;if(c.mode==="source"&&c.focusedPath===t&&c.canWrite!==!1&&a<s)s=a}return s===o}var hk=["#4f9cf9","#e5484d","#30a46c","#f5a524","#8e4ec6","#00a2c7","#e93d82","#a8845c"];function S2(e){let t=5381;for(let r=0;r<e.length;r++)t=Math.imul(t,33)+(e.codePointAt(r)??0);let o=Math.abs(t)%hk.length;return hk[o]}export{HI,BI,zI,WI,VI,wu,UI,Mg,qI,Vf,GI,Uf,u2,X0,ck,h2,p2,f2,m2,xu,g2,b2,v2,dk,uk,y2,w2,x2,_2,hk,S2};
1
+ import{ky,va,e_,rs,t_,ss}from"./studio-bvs9kpst.js";import{Se}from"./studio-wc6za3zs.js";import{n,Z,v}from"./studio-8z66jk4z.js";var VI="meta",UI="frontmatter",qI="structure",GI="source",KI=2;function m(e){return v(e)}function xu(e){return e.getMap(VI)}function JI(e){return e.getMap(UI)}function Fg(e){return e.getMap(qI)}function YI(e){return e.getText(GI)}var Y=new Set(["textContent"]),h=new Set(["style","attributes","$props"]);function y(e,t){let o=e.toString();if(o===t)return!1;let r=0,s=Math.min(o.length,t.length);while(r<s&&o[r]===t[r])r+=1;let a=o.length,i=t.length;while(a>r&&i>r&&o[a-1]===t[i-1])a-=1,i-=1;if(a>r)e.delete(r,a-r);if(i>r)e.insert(r,t.slice(r,i));return!0}function f(e){let t=new rs;for(let[o,r]of Object.entries(e)){if(r===void 0)continue;t.set(o,m(r)?f(r):Se(r))}return t}function g(e,t){for(let o of[...e.keys()])if(!(o in t)||t[o]===void 0)e.delete(o);for(let[o,r]of Object.entries(t)){if(r===void 0)continue;let s=e.get(o);if(m(r))if(s instanceof rs)g(s,r);else e.set(o,f(r));else if(!b(s,r))e.set(o,Se(r))}}function b(e,t){if(e===t)return!0;if(e instanceof rs||e instanceof va||e instanceof ss)return!1;return JSON.stringify(e??null)===JSON.stringify(t??null)}function d(e){return n(e)?new ss(e):ZI(e)}function qf(e){let t=new va;return t.insert(0,e.map((o)=>d(o))),t}function ZI(e){if(!m(e))throw TypeError("collab-schema: a document node must be a plain object");let t=new rs;for(let[o,r]of Object.entries(e)){if(r===void 0)continue;if(o==="children"&&Array.isArray(r))t.set(o,qf(r));else if(Y.has(o)&&n(r))t.set(o,new ss(r));else if(h.has(o)&&m(r))t.set(o,f(r));else t.set(o,Se(r))}return t}function S(e){return Object.fromEntries(Array.from(e.entries(),([t,o])=>[t,Gf(o)]))}function E(e){if(n(e))return e;return e instanceof ss?e.toString():S(e)}function Gf(e){if(e instanceof rs)return S(e);if(e instanceof va)return e.toArray().map((t)=>Gf(t));if(e instanceof ss)return e.toString();return e}function w2(e){return S(Fg(e))}function X0(e,t){let o=Fg(e);for(let r of t)if(o instanceof rs)o=o.get(String(r));else if(o instanceof va){let s=Number(r);if(!Number.isInteger(s)||s<0||s>=o.length)return;o=o.get(s)}else return;return o}function ck(e,t,o){let r=YI(e);if(r.toString()===t)return!1;return e.transact(()=>{y(r,t)},o),!0}function x2(e,t,o={}){let r=xu(e);if(r.get("structureSeeded")===!0)return!1;return e.transact(()=>{let s=Fg(e);for(let[i,c]of Object.entries(t)){if(c===void 0)continue;if(i==="children"&&Array.isArray(c))s.set(i,qf(c));else s.set(i,Se(c))}let a=JI(e);for(let[i,c]of Object.entries(o.frontmatter??{}))if(c!==void 0)a.set(i,Se(c));r.set("schemaVersion",KI),r.set("canonical","structure"),r.set("canonicalRev",0),r.set("sourceFormat",o.sourceFormat??null),r.set("structureSeeded",!0)},o.origin),!0}var _2="jx-local",S2="jx-mirror",C2="jx-seed";class _u extends Error{constructor(e){super(`collab-path-unresolved:${e.join("/")}`);this.name="CollabPathError"}}function O(e,t){let o=X0(e,t);if(!(o instanceof rs))throw new _u(t);return o}function p(e,t,o){let r=O(e,t),s=r.get("children");if(s instanceof va)return s;if(o&&s===void 0){let a=new va;return r.set("children",a),a}throw new _u([...t,"children"])}function J(e,t,o){let r=e.get(t);if(t==="children"&&Array.isArray(o)){e.set(t,qf(o));return}if(Y.has(t)&&n(o)){if(r instanceof ss)y(r,o);else e.set(t,new ss(o));return}if(h.has(t)&&v(o)){if(r instanceof rs)g(r,o);else e.set(t,f(o));return}e.set(t,Se(o))}function V(e,t){let{op:o}=t;switch(t.op){case"set-key":{let r=O(e,t.path);if(t.value===void 0)r.delete(t.key);else J(r,t.key,t.value);return}case"insert-child":{let r=p(e,t.parentPath,!0);if(t.index<0||t.index>r.length)throw new _u([...t.parentPath,"children",t.index]);r.insert(t.index,[d(t.node)]);return}case"remove-child":{let r=p(e,t.parentPath,!1);if(t.index<0||t.index>=r.length)throw new _u([...t.parentPath,"children",t.index]);r.delete(t.index,1);return}case"set-child":{let r=p(e,t.parentPath,!1);if(t.index<0||t.index>=r.length)throw new _u([...t.parentPath,"children",t.index]);let s=r.get(t.index);if(s instanceof ss&&n(t.node)){y(s,t.node);return}r.delete(t.index,1),r.insert(t.index,[d(t.node)]);return}case"move-child":{let r=p(e,t.fromParentPath,!1),s=p(e,t.toParentPath,!0);if(t.fromIndex<0||t.fromIndex>=r.length)throw new _u([...t.fromParentPath,"children",t.fromIndex]);let a=Gf(r.get(t.fromIndex));if(r.delete(t.fromIndex,1),t.toIndex<0||t.toIndex>s.length)throw new _u([...t.toParentPath,"children",t.toIndex]);s.insert(t.toIndex,[d(a)]);return}default:throw Error(`unknown-doc-op:${o}`)}}function k2(e,t,o){e.transact(()=>{for(let r of t)V(e,r)},o)}function w(e){for(let t=0;t<e.length;t++){let o=e[t];if(!n(o))continue;if(h.has(o))return{key:o,nodePath:e.slice(0,t)};if(Y.has(o))return{key:o,nodePath:e.slice(0,t)}}return null}function P(e){return e instanceof ss||e instanceof rs||n(e)}function C(e){return e.every((t)=>n(t)||Z(t))}function E2(e){if(e.length===0)return[];let t=e.map((s)=>s.path);if(!t.every((s)=>C(s)))return null;for(let s=0;s<t.length;s++)for(let a=0;a<t.length;a++){if(s===a)continue;let i=t[s],c=t[a];if(i.length<=c.length&&i.every((u,l)=>u===c[l]))return null}if(e.filter((s)=>s instanceof ky).length>1)return null;let r=[];for(let s of e){let{path:a}=s,i=w(a);if(i){let{doc:c}=s.target;if(!c)return null;let u=X0(c,[...i.nodePath,i.key]);if(u===void 0)return null;r.push({key:i.key,op:"set-key",path:i.nodePath,value:Gf(u)});continue}if(s instanceof t_){let c=a.at(-1);if(a.at(-2)==="children"&&Z(c)){r.push({index:c,node:s.target.toString(),op:"set-child",parentPath:a.slice(0,-2)});continue}return null}if(s instanceof e_){let c=s.target;for(let[u,l]of s.changes.keys)if(l.action==="delete")r.push({key:u,op:"set-key",path:a});else r.push({key:u,op:"set-key",path:a,value:Gf(c.get(u))})}else if(s instanceof ky){if(a.at(-1)!=="children")return null;let c=a.slice(0,-1),u=0;for(let l of s.changes.delta)if(l.retain!==void 0)u+=l.retain;else if(l.delete!==void 0)for(let x=0;x<l.delete;x++)r.push({index:u,op:"remove-child",parentPath:c});else if(l.insert!==void 0){let x=Array.isArray(l.insert)?l.insert:[l.insert];for(let D of x){if(!P(D))return null;r.push({index:u,node:E(D),op:"insert-child",parentPath:c}),u+=1}}}else return null}return r}function T2(e,t,o){e.transact(()=>{let r=Fg(e),s=[...r.keys()];for(let i of s)if(!(i in t)||t[i]===void 0)r.delete(i);for(let[i,c]of Object.entries(t)){if(c===void 0)continue;if(i==="children"&&Array.isArray(c))r.set(i,qf(c));else r.set(i,Se(c))}let a=xu(e);a.set("canonicalRev",Number(a.get("canonicalRev")??0)+1)},o)}function dk(e){return xu(e).get("canonical")==="source"?"source":"structure"}function uk(e){return Number(xu(e).get("canonicalRev")??0)}function L2(e,t,o){if(dk(e)==="source")return!1;return e.transact(()=>{ck(e,t,o);let r=xu(e);r.set("canonical","source"),r.set("canonicalRev",uk(e)+1)},o),!0}function $2(e,t){if(dk(e)!=="source")return!1;return e.transact(()=>{let o=xu(e);o.set("canonical","structure"),o.set("canonicalRev",uk(e)+1)},t),!0}function I2(e,t,o){let r=[];for(let[s,a]of e.getStates()){let i=a;if(s!==o&&i.mode==="source"&&i.focusedPath===t)r.push(s)}return r}function R2(e,t){let o=e.clientID,r=e.getStates().get(o);if(r?.mode!=="source"||r.focusedPath!==t)return!1;let s=o;for(let[a,i]of e.getStates()){let c=i;if(c.mode==="source"&&c.focusedPath===t&&c.canWrite!==!1&&a<s)s=a}return s===o}var hk=["#4f9cf9","#e5484d","#30a46c","#f5a524","#8e4ec6","#00a2c7","#e93d82","#a8845c"];function D2(e){let t=5381;for(let r=0;r<e.length;r++)t=Math.imul(t,33)+(e.codePointAt(r)??0);let o=Math.abs(t)%hk.length;return hk[o]}export{VI,UI,qI,GI,KI,xu,JI,Fg,YI,qf,ZI,Gf,w2,X0,ck,x2,_2,S2,C2,_u,k2,E2,T2,dk,uk,L2,$2,I2,R2,hk,D2};
2
2
 
3
- //# debugId=1F60BDE038560FD764756E2164756E21
4
- //# sourceMappingURL=studio-m48v13s3.js.map
3
+ //# debugId=86C33C125A4D0FB764756E2164756E21
4
+ //# sourceMappingURL=studio-216b27sv.js.map
@@ -0,0 +1,5 @@
1
+ import{vh}from"./studio-k2sz13zg.js";import{bb}from"./studio-r7pf0rkv.js";import{S}from"./studio-cg710sk9.js";import{n,_}from"./studio-8z66jk4z.js";function JE(){return Object.keys(S?.projectConfig?.content??{})}function wa(e){let t=bb(e);if(!t)return null;if(/\.[a-z\d]+$/i.test(t.dir))return null;return{def:t.def,dir:t.dir,ext:t.ext,name:t.name,schema:t.def.schema??null}}function vw(){return JE().map((e)=>wa(e)).filter((e)=>e!==null)}function Dc(e){let t=vh(e??null,S?.projectConfig);return t?wa(t.name):null}function WD(e){let t=vh(e??null,S?.projectConfig),r=t?bb(t.name):null;if(!t||!r)return null;return{def:r.def,dir:r.dir,ext:r.ext,name:r.name,schema:t.schema}}function c(e){if(e===null||!_(e))return e;return JSON.parse(JSON.stringify(e))}function u(e){if(n(e.$ref))return"";switch(e.type){case"boolean":return!1;case"integer":case"number":return 0;case"array":return[];case"object":return YE(e);default:return""}}function YE(e){let t=e?.properties;if(!t)return{};let r=new Set(Array.isArray(e.required)?e.required:[]),o={};for(let[i,l]of Object.entries(t))if(l.default!==void 0)o[i]=c(l.default);else if(r.has(i))o[i]=u(l);return o}function VD(e,t){return(Array.isArray(e?.required)?e.required:[]).filter((o)=>t[o]===void 0)}
2
+ export{JE,wa,vw,Dc,WD,YE,VD};
3
+
4
+ //# debugId=921632B9F279F9B664756E2164756E21
5
+ //# sourceMappingURL=studio-2ejhqns4.js.map
@@ -0,0 +1,16 @@
1
+ import{Q}from"./studio-nqxqf8p2.js";import{p}from"./studio-jws1a87n.js";import{ge,ne,Kr,Jr,g,de,pM,C}from"./studio-y60sts62.js";import{Pn,yx,ln,go,vC,Wp,xx,A$,an,lv,Hm,Hi,Vn,Ce,pi,Lo,Y,fi,Vm,m,kr,ec,Pt}from"./studio-k2sz13zg.js";import{rf}from"./studio-hz5n7x27.js";import{rt,Eo,xr}from"./studio-th7z3fg7.js";import{S,ed,wn}from"./studio-cg710sk9.js";import{n,Z,Ze,Iv,ee,_,v}from"./studio-8z66jk4z.js";import{le}from"./studio-j3d2fjqz.js";function F(e){return e.replaceAll("~","~0").replaceAll("/","~1")}var Ve=100;function H(e){let t={blankAfter:new Set,escaped:new Map,inline:new Map},o=0,r=()=>{let l=0;while(o<e.length&&(e[o]===" "||e[o]==="\t"||e[o]==="\r"||e[o]===`
2
+ `)){if(e[o]===`
3
+ `)l+=1;o+=1}return l},s=()=>{let l=o,f=new Set;o+=1;while(o<e.length&&e[o]!=='"')if(e[o]==="\\")if(e[o+1]==="u"){let b=Number.parseInt(e.slice(o+2,o+6),16);if(b>=128)f.add(b);o+=6}else o+=2;else o+=1;return o+=1,{escaped:f,raw:e.slice(l,o)}},i=(l,f)=>{let b=r();if(e[o]===f)return o+=1,!0;if(o+=1,b+=r(),b>=2)t.blankAfter.add(l);return!1},a=(l)=>{r();let f=e[o];if(f==="{"){o+=1;let b=r()>0;if(e[o]==="}"){o+=1;return}t.inline.set(l,!b);while(o<e.length){let c=JSON.parse(s().raw);r(),o+=1;let d=`${l}/${F(c)}`;if(a(d),i(d,"}"))return}}else if(f==="["){if(o+=1,r(),e[o]==="]"){o+=1;return}for(let b=0;o<e.length;b+=1){let c=`${l}/${b}`;if(a(c),i(c,"]"))return}}else if(f==='"'){let{escaped:b}=s();if(b.size>0)t.escaped.set(l,b)}else while(o<e.length&&!`,]} \r
4
+ `.includes(e[o]))o+=1};return a(""),t}function Es(e){return{document:JSON.parse(e),layout:H(e)}}var He=/[^\u0020-\u007E]/,Ge=/^[\p{Mn}\p{Me}\p{Cf}]$/u,Ke=/^\p{Emoji_Presentation}$/u;function qe(e){return e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=12871&&e!==12351||e>=12880&&e<=19903||e>=19968&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=110592&&e<=110593||e>=127488&&e<=127569||e>=131072&&e<=262141)}function be(e){if(!He.test(e))return e.length;let t=0;for(let o of e){if(Ge.test(o))continue;t+=qe(o.codePointAt(0))||Ke.test(o)?2:1}return t}function he(e){return e===void 0||ee(e)||Iv(e)}function U(e){return Object.entries(e).filter(([,t])=>!he(t))}function M(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ye(e){if(e.length<2)return!1;let t=Array.isArray(e[0])?"array":M(e[0])?"object":null;if(t===null)return!1;return e.every((o)=>t==="array"?Array.isArray(o)&&o.length>1:M(o)&&U(o).length>1)}function Xe(e){return e.length>1&&e.every((t)=>Z(t))}function V(e,t){let o=he(e)?"null":JSON.stringify(e);return t===void 0?o:o.replaceAll(/[\u0080-\uFFFF]/g,(r)=>{let s=r.codePointAt(0);return t.has(s)?`\\u${s.toString(16).padStart(4,"0")}`:r})}function Co(e,t,o=Ve){let r=t?.inline??new Map,s=t?.blankAfter??new Set,i=t?.escaped??new Map,a=(c,d)=>r.get(c)??d,l=(c,d,h)=>{if(Array.isArray(c)){if(c.length===0)return"[]";if(Ye(c))return null;let y=[];for(let[x,P]of c.entries()){let T=`${d}/${x}`,w=s.has(T)?null:l(P,T,h);if(w===null)return null;y.push(w)}return`[${y.join(", ")}]`}if(M(c)){let y=U(c);if(y.length===0)return"{}";if(!a(d,h))return null;let x=[];for(let[P,T]of y){let w=`${d}/${F(P)}`,E=s.has(w)?null:l(T,w,!0);if(E===null)return null;x.push(`${JSON.stringify(P)}: ${E}`)}return`{ ${x.join(", ")} }`}return V(c,i.get(d))},f=(c)=>c.map(({path:d,text:h},y)=>y===c.length-1?h:`${h},
5
+ ${s.has(d)?`
6
+ `:""}`).join(""),b=(c,d,h,y,x,P)=>{if(!Array.isArray(c)&&!M(c))return V(c,i.get(d));let T=l(c,d,x);if(T!==null&&y+be(T)+P<=o)return T;let w=" ".repeat(h+2),E=`
7
+ ${" ".repeat(h)}`;if(Array.isArray(c)){if(Xe(c))return`[
8
+ ${Qe(c,w,o,(A)=>s.has(`${d}/${A}`))}${E}]`;let L=c.map((R,A)=>{let O=`${d}/${A}`,J=A===c.length-1,z=b(R,O,h+2,w.length,x,J?0:1);return{path:O,text:`${w}${z}`}});return`[
9
+ ${f(L)}${E}]`}let me=U(c),Be=a(d,x),ze=me.map(([L,R],A)=>{let O=`${d}/${F(L)}`,J=`${JSON.stringify(L)}: `,z=A===me.length-1,Fe=w.length+be(J),Ue=b(R,O,h+2,Fe,Be,z?0:1);return{path:O,text:`${w}${J}${Ue}`}});return`{
10
+ ${f(ze)}${E}}`};return`${b(e,"",0,0,!1,0)}
11
+ `}function Qe(e,t,o,r){let s=[],i="";for(let[a,l]of e.entries()){let f=`${V(l)}${a===e.length-1?"":","}`;if(i==="")i=`${t}${f}`;else if(i.length+1+f.length<=o)i=`${i} ${f}`;else s.push(i),i=`${t}${f}`;if(r(a)&&a<e.length-1)s.push(i,""),i=""}return s.push(i),s.join(`
12
+ `)}function Tm(e){return Co(e,we())}var k=null,j=null,N=null,I=null;function we(){return ve()?.doc.layout??I}var G=null;function ve(){let e=m.tabs.get(an);return e?de(e):null}function et(){if(j)Hm(j),j=null;k=null,N=null,I=null,G=null}function xe(){return G??=(async()=>{try{let e=await p().readFile(an),{document:t,layout:o}=Es(e);I=o,N=Co(t,we())}catch{N=null}})(),G}async function zL(e){if(await xe(),e.doc.layout===null&&I!==null)e.doc.layout=I}function tt(e){let t=wn();if(t.projectConfig===e)return;ed({...t,projectConfig:e}),ec(m.projectRoot,e)}function ot(){let e=S?.projectConfig;return e?de(e):null}function K(e){return de(e)}function Pe(e,t){for(let o of Object.keys(e))delete e[o];Object.assign(e,t)}function Se(e){return k=e,e.scope.run(()=>{ne(()=>{let t=e.doc.document;if(k!==e||!S)return;tt(K(t))})}),e}function XS(){let e=wn(),t=ve();if(k&&(k!==(t??j)||de(k.doc.document)!==e.projectConfig))et();if(k)return k;if(t)return Se(t);return j=lv({document:e.projectConfig??{},documentPath:an,id:an}),Se(j)}function ye(e){return JSON.stringify(e.extensions??null)}async function nt(){let{loadFormats:e,refreshExtensionUi:t,refreshFormats:o}=await (le("btsevv0c"),import("./format-host-btsevv0c.js"));o(),e(),t(p())}async function Yl(e){let t=ot(),o=XS();await zL(o);let r=K(o.doc.document),s=Tm(r),i=t&&t!==r&&Tm(t)!==s?t:null;if(i&&o.doc.dirty){let h=Error(`${an} has unsaved changes in its editor tab`);return C.error(`Could not save ${an} — the file is open with unsaved changes. Save or `+"revert that tab, then make the settings change again.",{key:`save:${an}`,path:an,source:"Settings"}),{error:h,ok:!1}}let a=i??r,l=e?{...a,...e}:a,f=Tm(l);if(!i&&!o.doc.dirty&&f===N)return{ok:!0};let b=ye(r);Y(o,(h)=>{let y=h.doc.document;if(i)Pe(y,i);for(let[x,P]of Object.entries(e??{}))y[x]=P});let c=K(o.doc.document),d=Tm(c);try{await p().writeFile(an,d)}catch(h){return C.error(`Could not save ${an} — ${Q(h)}`,{key:`save:${an}`,path:an,source:"Settings"}),{error:h,ok:!1}}if(N=d,o.doc.dirty=!1,ye(c)!==b)await nt();return{ok:!0}}async function nA(e,t){if(!S){ec(m.projectRoot,e);return}let o=XS();Y(o,(r)=>Pe(r.doc.document,e),{skipHistory:!0}),o.doc.dirty=!1,await xe(),I=H(t),o.doc.layout=I,N=Tm(e)}function to(e){let t=S?.projectConfig?.$media;if(!t)return e||{};if(!e)return{...t};return{...t,...e}}function wr(e){let t=S?.projectConfig?.style;if(!t)return e||{};if(!e)return{...t};let o={...t};for(let[r,s]of Object.entries(e)){let i=o[r];o[r]=_(s)&&_(i)?{...i,...s}:s}return o}function iA(e,t=[]){return{...WL(t),...S?.projectConfig?.imports,...e}}function WL(e){let t=e.flatMap((o)=>(o.classes??[]).filter((r)=>r.path.endsWith(".class.json")).map((r)=>[r.name,r.path]));return Object.fromEntries(t.toReversed())}function Xw(e){let t=S?.projectConfig?.$elements;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,r=[];for(let s of[...t,...e]){let i=n(s)?s:_(s)?s.$ref:void 0;if(i&&!o.has(i))o.add(i),r.push(s)}return r}function Qw(e){let t=S?.projectConfig?.$head;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,r=[];for(let s of[...t,...e]){let i=_(s)?s.attributes:void 0,a=String(i?.href||i?.src||"")||JSON.stringify(s);if(!o.has(a))o.add(a),r.push(s)}return r}function Ts(){let e=S?.projectConfig;return e?ln(e).i18n:null}function Rp(e,t){let o=Ts();if(o===null)return null;let r=Pn(e);if(r!==null&&o.locales.includes(r))return r;return go(t??"",o)??o.defaultLocale}var q=new Map;function oA(){q.clear()}function sl(e){if(e===!1)return null;let t=S?.projectConfig?.defaults?.layout;return e||t||null}async function ex(e){let t=e.replace(/^\.\//,""),o=q.get(t);if(o!==void 0)return structuredClone(o);try{let s=await p().readFile(t),i=JSON.parse(s);return q.set(t,i),structuredClone(i)}catch{return null}}function VL(e,t){let o=t.children??[],r=Array.isArray(o)?o:[],s=new Map,i=[];for(let a of r){let l=n(a)?void 0:a.attributes?.slot;if(!n(a)&&n(l)&&l){if(!s.has(l))s.set(l,[]);s.get(l).push(a)}else i.push(a)}if(Te(e,s,i),t.state)e.state={...e.state,...t.state};if(t.$media)e.$media={...e.$media,...t.$media};if(t.style)e.style={...e.style,...t.style};if(t.attributes)e.attributes={...e.attributes,...t.attributes};return e}function Te(e,t,o){if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(_(s)&&s.tagName==="slot"){let i=s.attributes?.name;if(n(i)&&i&&t.has(i))r.push(...t.get(i)),t.delete(i);else if(!i&&o.length>0)r.push(...o);else if(Array.isArray(s.children))r.push(...s.children)}else{if(_(s))Te(s,t,o);r.push(s)}e.children=r}async function no(e){let t=await Yl(e);if(!t.ok)throw t.error}var ke=new Set([fi,Vm]),it=new Set(["auto","light","dark"]);function st(e){return n(e)&&it.has(e)}function at(e){let{ui:t}=e.session;return{activeMedia:t.activeMedia,canvasMode:t.canvasMode,editZoom:t.editZoom,preview:t.preview,previewColorScheme:t.previewColorScheme,previewLocale:t.previewLocale,showLayout:t.showLayout,zoom:t.zoom}}function Ie(){let e={},t=[];for(let o of m.panes){if(o.derived)continue;let r=[];for(let i of o.tabOrder){let a=m.tabs.get(i);if(!a?.documentPath)continue;r.push(a.documentPath),e[a.documentPath]=at(a)}if(r.length===0)continue;let s=o.activeTabId?m.tabs.get(o.activeTabId):null;t.push({activeFile:s?.documentPath??null,files:r,id:o.id})}return{focusedPane:m.activePaneId,panes:t,ui:e}}function lt(e){if(!v(e))return{};let t={};if(n(e.canvasMode))t.canvasMode=e.canvasMode;if(Ze(e.preview))t.preview=e.preview;if(Z(e.zoom)&&Number.isFinite(e.zoom))t.zoom=e.zoom;if(Z(e.editZoom)&&Number.isFinite(e.editZoom))t.editZoom=e.editZoom;if(e.activeMedia===null||n(e.activeMedia))t.activeMedia=e.activeMedia;if(st(e.previewColorScheme))t.previewColorScheme=e.previewColorScheme;if(e.previewLocale===null||n(e.previewLocale)&&yx(e.previewLocale))t.previewLocale=e.previewLocale;if(Ze(e.showLayout))t.showLayout=e.showLayout;return t}function _e(e){if(!v(e)||!Array.isArray(e.panes))return null;let t=[];for(let r of e.panes){if(!v(r)||!n(r.id)||!ke.has(r.id))continue;let s=Array.isArray(r.files)?r.files.filter((i)=>n(i)&&i!==""):[];if(s.length===0)continue;t.push({activeFile:n(r.activeFile)&&s.includes(r.activeFile)?r.activeFile:null,files:s,id:r.id})}if(t.length===0)return null;let o={};if(_(e.ui))for(let[r,s]of Object.entries(e.ui))o[r]=lt(s);return{focusedPane:n(e.focusedPane)&&ke.has(e.focusedPane)?e.focusedPane:fi,panes:t,ui:o}}async function rA(e,t){let o=0;if(e.panes.some((i)=>i.id===Vm))t.ensureSecondPane();for(let i of e.panes)for(let a of i.files){try{await t.openFile(a,i.id)}catch{}if([...m.tabs.values()].some((l)=>l.documentPath===a))o+=1}if(o===0)return 0;for(let i of m.tabs.values()){let a=i.documentPath?e.ui[i.documentPath]:void 0;if(!a)continue;let{ui:l}=i.session;if(a.canvasMode&&i.capabilities.modes.includes(a.canvasMode))l.canvasMode=a.canvasMode;if(a.preview!==void 0)l.preview=a.preview;if(a.zoom!==void 0)l.zoom=a.zoom;if(a.editZoom!==void 0)l.editZoom=a.editZoom;if(a.activeMedia!==void 0)l.activeMedia=a.activeMedia;if(a.previewColorScheme!==void 0)l.previewColorScheme=a.previewColorScheme;if(a.previewLocale!==void 0)l.previewLocale=a.previewLocale;if(a.showLayout!==void 0)l.showLayout=a.showLayout}let r=m.panes.some((i)=>i.id===e.focusedPane)?e.focusedPane:null,s=null;for(let i of e.panes){let a=m.panes.find((f)=>f.id===i.id);if(!a||!i.activeFile)continue;let l=a.tabOrder.find((f)=>m.tabs.get(f)?.documentPath===i.activeFile);if(!l)continue;if(a.id===r)s=l;else Pt(l,{focus:!1})}if(s)Pt(s);else if(r)kr(r);return o}var Lm=["review","deploys","branches","hosting"],QS={branches:"Branches",deploys:"Deploys",hosting:"Hosting",review:"Review changes"},ct=["live","review"],Ee="review",Ae="live",ut=new Set(Lm),pt=new Set(ct);function sA(e){return typeof e==="string"&&ut.has(e)}function tx(e){return typeof e==="string"&&pt.has(e)}var ft={default:{description:"Resume whatever was persisted — layout, recents, settings, chat history.",id:"default",reset:"none"},fresh:{description:"A first-run app: no layout, no recents, no settings, no history.",id:"fresh",reset:"app-state"}},je=new Map(Object.entries(ft)),dt="default",mt=/^jx[-._:]/;function gt(e){return mt.test(e)}function bt(){let e=typeof localStorage>"u"?void 0:localStorage;if(!e)return[];let t=[];try{for(let o=0;o<e.length;o++){let r=e.key(o);if(r&&gt(r))t.push(r)}for(let o of t)e.removeItem(o)}catch{}return t}function ht(e){let t=je.get(e);if(!t)throw RangeError(`unknown startup profile "${e}"; declared: ${[...je.keys()].join(", ")}`);if(t.reset==="app-state")bt();return t}var W=null;function Ne(e){if(W)return W;let t=new URLSearchParams(e??(typeof location>"u"?"":location.search)),o=ht(t.get("profile")??dt),r=t.get("clock");return W={clock:r===null?null:pM(r),profile:o},W}var B=["site","collections","styles","files","search","i18n","layers","data","packages","insert"],St=new Set(["collections","styles"]);function De(e){return e&&!St.has(e)?e:wt}var yt=new Map([["blocks","insert"],["head","site"],["page","site"],["imports","packages"],["git","site"],["state","data"]]),wt="site";function eC(e,t){let o=B.find((r)=>r===e);if(o===void 0)throw Error(`${t}: "${e}" is not a declared Navigator panel id.`);return o}function se(e){if(!n(e))return null;let t=yt.get(e);if(t)return t;return B.find((o)=>o===e)??null}var oe=["page","properties","style","events","assistant"],nx="page",vt=["properties","style","events"],tC="properties";function ix(e){return typeof e==="string"&&vt.some((t)=>t===e)}function UL(e){return typeof e==="string"&&oe.some((t)=>t===e)}var ox=["problems","logic","activity"],qL="problems";function GL(e){return typeof e==="string"&&ox.some((t)=>t===e)}var rx=["light","dark"],zc={content:{id:"content",inspector:{open:!1,whileWriting:!0},navigator:{open:!0,panel:"collections"},rail:!1,tabStrip:!0},design:{id:"design",inspector:{open:!0},navigator:{initial:"site",open:!0},rail:!0,tabStrip:!0},media:{id:"media",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},publish:{id:"publish",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},settings:{id:"settings",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},styles:{id:"styles",inspector:{open:!1,tab:"style",whileWriting:!0},navigator:{open:!0,panel:"styles"},rail:!1,tabStrip:!1}},Le="jx-studio-panel-widths",Re="jx-studio-project::",xt="dark";function KL(e){return typeof e==="string"&&rx.some((t)=>t===e)}function Tt(){let e=Eo(rt.theme);return KL(e)?e:xt}var sx=["left","right","bottom"],D={bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!1,size:280}},aA={bottom:D.bottom.size,left:D.left.size,right:D.right.size},kt={bottom:"--dock-h-bottom",left:"--panel-w-left",right:"--panel-w-right"},It={bottom:"bottom-collapsed",left:"left-collapsed",right:"right-collapsed"},JL=0.5,nC=0.2,iC=0.8;function _t(e){return Z(e)&&e>=nC&&e<=iC?e:JL}function lA(e){u.paneSplit=Math.min(iC,Math.max(nC,e))}function Et(){try{let e=JSON.parse(localStorage.getItem(Le)||"{}");return v(e)?e:{}}catch{return{}}}function Ct(e){return{left:e("left"),right:e("right"),bottom:e("bottom")}}function $e(){return{branches:null,commitMessage:"",diffState:null,error:null,lastUpdated:null,loading:!1,logEntries:null,rev:0,status:null}}function Je(){return{build:{for:"",state:"idle",text:""},deploys:{error:"",project:"",rows:[],state:"idle"},destination:Ae,review:{number:0,url:""},tab:Ee}}var At="tokens";function Me(){return{customizedOnly:!1,filter:"",selection:null,variable:null,view:At}}function jt(){let e=Et(),t=Ct((o)=>{let r=e[o],s=e[`${o}Collapsed`];return{collapsed:Ze(s)?s:D[o].collapsed,size:Z(r)&&r>0?r:D[o].size}});return{bottomTab:GL(e.bottomTab)?e.bottomTab:qL,docks:t,focusRegion:"pane",paneSplit:_t(e.paneSplit),git:$e(),publish:Je(),layoutSelection:null,leftTab:De(se(e.leftTab)),stylebook:Me(),theme:Tt(),workspace:Wp}}Ne();var Nt=["jx-studio-doc-header-expanded"];function Ot(){try{for(let e of Nt)localStorage.removeItem(e)}catch{}}Ot();var u=g(jt());function Md(){try{localStorage.setItem(Le,JSON.stringify({bottom:u.docks.bottom.size,bottomCollapsed:u.docks.bottom.collapsed,bottomTab:u.bottomTab,left:u.docks.left.size,leftCollapsed:u.docks.left.collapsed,leftTab:u.leftTab,paneSplit:u.paneSplit,right:u.docks.right.size,rightCollapsed:u.docks.right.collapsed}))}catch{}}var re,ae={},ce=null;function cA(){return ce}function ue(e){if(!e)return{};try{let t=JSON.parse(localStorage.getItem(`${Re}${e}`)||"{}");return v(t)?t:{}}catch{return{}}}function YL(e){let t=ue(e).workspace;return A$(t)?t:Wp}function dA(e){return _e(ue(e).session)}var pe=null;function ax(e){pe=e}function uA(){fe()}function fe(){let e=m.projectRoot;if(!e)return;try{localStorage.setItem(`${Re}${e}`,JSON.stringify({session:e===pe?Ie():ue(e).session,workspace:u.workspace}))}catch{}}function Dt(e){if(e===re)return;if(re=e,ae={},ce=null,u.workspace=YL(e),e===null){u.leftTab=De(se(u.leftTab));return}Kr();try{We(u.workspace),Md()}finally{Jr()}}function ZL(e,t){let{inspector:o}=zc[e];return o.open||o.whileWriting===!0&&t}function We(e,t){let o=zc[e],r=se(o.navigator.panel??ae[e]??o.navigator.initial??u.leftTab);if(r)u.leftTab=r;if(u.docks.left.collapsed=!o.navigator.open,u.docks.right.collapsed=!ZL(e,t?.writingOnCanvas?.()===!0),o.inspector.tab&&t)t.setInspectorTab(o.inspector.tab)}function oC(e,t){if(u.workspace===e)return!1;if(!zc[u.workspace].navigator.panel)ae[u.workspace]=u.leftTab;return ce=u.workspace,u.workspace=e,We(e,t),Md(),fe(),!0}function $m(e=u.theme){return e==="light"?"vs":"vs-dark"}function Lt(){document.documentElement.dataset.theme=u.theme,rf()?.editor.setTheme($m())}var Rt="rail-hidden",$t="tabs-hidden";function jb(e=u.workspace){return zc[e].tabStrip}function Jt(){let e=document.documentElement;for(let o of sx)e.style.setProperty(kt[o],`${u.docks[o].size}px`);let t=document.querySelector("#app");if(!t)return;for(let o of sx)t.classList.toggle(It[o],u.docks[o].collapsed);t.classList.toggle(Rt,!zc[u.workspace].rail),t.classList.toggle($t,!zc[u.workspace].tabStrip)}var X=null,ie=[];function Hb(e){if(!ie.includes(e))ie.push(e)}function hA(){if(X)return;for(let e of ie)e.mount();X=ge(),X.run(()=>{ne(()=>{Jt()}),ne(()=>{Lt()}),ne(()=>{Dt(m.projectRoot)}),ne(()=>{let e=m.projectRoot;m.activePaneId;for(let t of m.panes)t.id,t.activeTabId,t.tabOrder.join("\x00");if(e)fe()})})}function ko(e,t){if(u.docks[e].collapsed===t){Md();return}u.docks[e].collapsed=t,Md()}function Mt(e){ko(e,!u.docks[e].collapsed)}function pA(e,t){u.docks[e].size=t}function Wc(e){u.leftTab=e,ko("left",!1),Md()}function ih(e){u.bottomTab=e,ko("bottom",!1),Md()}function XL(e){if(u.theme===e)return;u.theme=e,xr(rt.theme,e)}function fA(e){if(e===u.leftTab&&!u.docks.left.collapsed){ko("left",!0);return}Wc(e)}function QL(e){u.layoutSelection=e}function lx(){Object.assign(u.git,$e()),Object.assign(u.publish,Je()),Object.assign(u.stylebook,Me()),u.layoutSelection=null,pe=null,re=void 0}function Oe(e,t){if(t.showWorkspace){t.showWorkspace(e);return}oC(e,t)}var te=(e)=>e.project.open;function Wt(e){return[{args:Ce({tab:pi(B,"Which Navigator panel to show.")}),category:"View",id:"view.setActivity",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",requires:"an open project",when:te,run:(t,o)=>{let r=Vn("view.setActivity",o,"tab",B);if(e.panelAvailable&&!e.panelAvailable(r))throw RangeError(`command "view.setActivity" argument "tab": "${r}" names a panel that is registered but not available right now, so showing it would persist a Navigator tab nothing can draw`);Wc(r)},title:"Show Navigator Panel"},{args:Ce({tab:pi(oe,"Which Inspector tab to show.")}),category:"View",id:"view.setRightTab",level:"document",menus:["palette"],group:"4_docks",requires:"an open document",when:(t)=>t.document.open,run:(t,o)=>{e.setInspectorTab(Vn("view.setRightTab",o,"tab",oe))},title:"Show Inspector Tab"},{args:Ce({open:Lo("True to show the Navigator dock, false to collapse it.")}),category:"View",id:"view.setNavigator",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{ko("left",!Hi("view.setNavigator",o,"open"))},title:"Show Navigator Dock"},{args:Ce({open:Lo("True to show the Inspector dock, false to collapse it.")}),category:"View",id:"view.setRightPanel",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{ko("right",!Hi("view.setRightPanel",o,"open"))},title:"Show Inspector Dock"},{args:Ce({open:Lo("True to show the Bottom dock, false to collapse it.")}),category:"View",id:"view.setBottomDock",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{ko("bottom",!Hi("view.setBottomDock",o,"open"))},title:"Show Bottom Dock"},{category:"View",id:"view.toggleBottomDock",keybinding:"mod+j",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>{Mt("bottom")},title:"Toggle Bottom Dock"},{args:Ce({tab:pi(ox,"Which Bottom dock tab to show.")}),category:"View",id:"view.setBottomTab",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{let r=Vn("view.setBottomTab",o,"tab",ox);if(e.panelAvailable&&!e.panelAvailable(r))throw RangeError(`command "view.setBottomTab" argument "tab": "${r}" names a panel that is registered but not available right now, so showing it would persist a Bottom dock tab nothing can draw`);ih(r)},title:"Show Bottom Dock Tab"},{args:Ce({open:Lo("True to show the Assistant tab, false to step off it.")}),category:"View",id:"view.setAssistant",level:"application",menus:["never"],group:"4_docks",run:(t,o)=>{if(Hi("view.setAssistant",o,"open")){ko("right",!1),e.setInspectorTab("assistant");return}if(e.inspectorTab()==="assistant")e.setInspectorTab(e.restingInspectorTab?.()??nx)},title:"Show Assistant"},{args:Ce({workspace:pi(vC,"Which workspace to show.")}),category:"View",id:"view.setWorkspace",level:"application",menus:["never"],group:"4_workspaces",requires:"an open project",when:te,run:(t,o)=>{Oe(Vn("view.setWorkspace",o,"workspace",vC),e)},title:"Switch Workspace"},...xx.map((t,o)=>({category:"View",id:`workspace.focus.${t.id}`,keybinding:`mod+${o+1}`,level:"application",menus:["palette"],group:"4_workspaces",requires:"an open project",when:te,run:()=>{Oe(t.id,e)},title:`Go to ${t.title}`})),{args:Ce({color:pi(rx,"The Studio chrome's theme.")}),category:"View",id:"view.setTheme",level:"application",menus:["palette"],group:"6_appearance",run:(t,o)=>{XL(Vn("view.setTheme",o,"color",rx))},title:"Set Theme"}]}function mA(e,t){e.registerAll(Wt(t))}
13
+ export{Es,Co,Tm,zL,XS,Yl,nA,to,wr,iA,WL,Xw,Qw,Ts,Rp,oA,sl,ex,VL,no,rA,Lm,QS,sA,tx,eC,nx,tC,ix,UL,ox,qL,GL,rx,zc,KL,sx,aA,JL,nC,iC,lA,u,Md,cA,YL,dA,ax,uA,ZL,oC,$m,jb,Hb,hA,ko,pA,Wc,ih,XL,fA,QL,lx,mA};
14
+
15
+ //# debugId=0F95C5ECA929462B64756E2164756E21
16
+ //# sourceMappingURL=studio-2r90cts3.js.map
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-03mqh8ax.js";import{Sr}from"./studio-de1s2x9v.js";import{us,zd,$$}from"./studio-k3bcy02e.js";import{cv,m}from"./studio-vzgmyt0v.js";import{S}from"./studio-45gyxpcq.js";var P=/[.*+?^${}()|[\]\\]/;function v(e){return P.test(e)?`\\${e}`:e}function L(e){let t=e.length;while(t>0&&e[t-1]===" "){let n=0,r=t-2;while(r>=0&&e[r]==="\\")n+=1,r-=1;if(n%2===1)break;t-=1}return e.slice(0,t)}function T(e,t){let n=t+1;if(e[n]==="!")n+=1;if(e[n]==="]")n+=1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]==="]")return n;n+=1}return-1}function k(e){let t="",n=0;while(n<e.length){let r=e[n];if(r==="\\"){let o=e[n+1];if(o===void 0)t+=String.raw`\\`,n+=1;else t+=v(o),n+=2;continue}if(r==="*"){let o=0;while(e[n]==="*")o+=1,n+=1;let i=t===""||t.endsWith("/");if(o>=2&&i&&e[n]==="/")t+="(?:[^/]+/)*",n+=1;else if(o>=2&&i&&n>=e.length)t+=".*";else t+="[^/]*";continue}if(r==="?"){t+="[^/]",n+=1;continue}if(r==="["){let o=T(e,n);if(o===-1){t+=String.raw`\[`,n+=1;continue}let i=e.slice(n+1,o),s=i.startsWith("!"),a=s?i.slice(1):i;t+=`[${s?"^":""}${a.startsWith("]")?String.raw`\]${a.slice(1)}`:a}]`,n=o+1;continue}t+=v(r),n+=1}return t}function F(e){let t=L(e);if(t===""||t.startsWith("#"))return null;let n=!1;if(t.startsWith("!"))n=!0,t=t.slice(1);let r=!1;if(t.endsWith("/"))r=!0,t=t.slice(0,-1);let o=t.includes("/");if(t.startsWith("/"))t=t.slice(1),o=!0;if(t==="")return null;let i=k(t);return{dirOnly:r,negated:n,re:new RegExp(`^${o?"":"(?:.*/)?"}${i}$`),source:e}}function M(e){let t=[];for(let n of e.split(/\r?\n/)){let r=F(n);if(r)t.push(r)}return t}function b(e){let t=e.replaceAll("\\","/").replace(/^\.\/+/,"").replace(/\/+$/,"");return t==="."?"":t}function O(e,t){if(e==="")return t;return t.startsWith(`${e}/`)?t.slice(e.length+1):null}function x(e){let t=b(e),n=[""];if(t==="")return n;let r="";for(let o of t.split("/"))r=r===""?o:`${r}/${o}`,n.push(r);return n}function W(e,t,n){let r=!1;for(let o of e){let i=O(o.base,t);if(i===null||i==="")continue;for(let s of o.rules){if(s.dirOnly&&!n)continue;if(s.re.test(i))r=!s.negated}}return r}function N(e,t,n){let r=b(t);if(r==="")return!1;let o=r.split("/"),i="";for(let[s,a]of o.entries()){i=i===""?a:`${i}/${a}`;let u=s===o.length-1;if(W(e,i,u?n:!0))return!0}return!1}var g=new Map,h=new Map;function Bp(){g.clear(),h.clear()}async function w(e){try{let t=await p().readFile(e===""?".gitignore":`${e}/.gitignore`);return{base:e,rules:M(t)}}catch{return null}}function _(e){let t=g.get(e);if(t!==void 0)return Promise.resolve(t);let n=h.get(e);if(n)return n;let r=w(e).then((o)=>(g.set(e,o),h.delete(e),o));return h.set(e,r),r}async function E(){let e=[...g.keys()];h.clear();let t=await Promise.all(e.map((n)=>w(n)));g.clear();for(let[n,r]of e.entries())g.set(r,t[n]??null)}async function XA(e){await Promise.all(x(e).map((t)=>_(t)))}function A(e){let t=[];for(let n of x(e)){let r=g.get(n);if(r)t.push(r)}return t}function QA(e,t,n){return N(A(e),t,n)}function C(e){return e.some((t)=>b(t).split("/").pop()===".gitignore")}var U=1500,D={commit:0,open:1,reconnect:2},G=250,V=8,R=new Map,I=(e)=>e.replaceAll("\\","/");function Ta(...e){zd(e,e);let t=Date.now()+U;for(let n of e)if(n)R.set(I(n),t)}function Hd(e){let t=I(e),n=R.get(t);if(n===void 0)return!1;if(Date.now()>n)return R.delete(t),!1;return!0}function Y(e){let t=e.lastIndexOf("/");return t===-1?".":e.slice(0,t)}function z(e){let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function B(e,t,n){let r=new Set;for(let o of n){let i=Y(o.path);if(o.type==="add"||o.type==="addDir"){let s=e.get(i);if(s&&!s.some((a)=>a.path===o.path))s.push({name:z(o.path),path:o.path,type:o.isDir?"directory":"file"}),r.add(i);if(o.type==="addDir"&&!e.has(o.path))e.set(o.path,[])}else if(o.type==="unlink"||o.type==="unlinkDir"){let s=e.get(i);if(s){let a=s.findIndex((u)=>u.path===o.path);if(a!==-1)s.splice(a,1),r.add(i)}if(o.type==="unlinkDir"){e.delete(o.path);let a=[];for(let c of e.keys())if(c.startsWith(`${o.path}/`))a.push(c);for(let c of a)e.delete(c);let u=[];for(let c of t)if(c===o.path||c.startsWith(`${o.path}/`))u.push(c);for(let c of u)t.delete(c)}}}return r}function j(e){let t=[],n=[];for(let r of e)if(r.type==="unlinkDir")n.push(r.path);else if(r.type!=="addDir")t.push(r.path);if(t.length>0||n.length>0)zd(t,n)}function q(e,t){return e!==void 0&&e.length===t.length&&e.every((n,r)=>n===t[r])}var K=2;async function H(e,t){let n=[...e.keys()],r=0,o=async(s)=>{for(let a=0;a<K;a+=1){let u=e.get(s);if(!u)return;let c=[...u],l;try{l=await t(s)}catch{l=null}if(!e.has(s))return;if(!q(e.get(s),c))continue;if(l)e.set(s,l);else e.delete(s);return}},i=async()=>{while(r<n.length){let s=n[r];r+=1,await o(s)}};await Promise.all(Array.from({length:Math.min(V,n.length)},i))}var J=new Set(["media","grid"]);function Q(e){return e.some((t)=>J.has(t))||e.length>0&&e.every((t)=>t==="git-diff")}function X(){let e=new Set;for(let t of m.tabs.values()){let n=t.documentPath;if(n&&!t.doc.dirty&&!cv(n)&&!Q(t.capabilities.modes))e.add(n)}return[...e]}function C$(e){let t=p();if(!t.subscribeFileEvents)return()=>{};let n=[],r=null,o=null,i=null,s=()=>{r=null;let l=S,f=n.filter((d)=>!Hd(d.path));if(n=[],!l||f.length===0)return;let y=B(l.dirs,l.expanded,f);if(e.onContentChange){for(let d of f)if(d.type==="change")e.onContentChange(d.path)}if(y.size>0)e.renderLeftPanel()},a=async()=>{i=null;let l=o;o=null;let f=S;if(!f||!l)return;let y=H(f.dirs,(d)=>us(()=>t.listDirectory(d)));if(l==="reconnect")Sr(),e.invalidateDerivedCaches?.(void 0,!0),await Promise.all([y,E()]);else await y;if(S!==f)return;if(l==="reconnect")e.onResyncContent?.(X());e.renderLeftPanel()},u=(l)=>{if(l!=="commit")$$();if(!o||D[l]>D[o])o=l;if(i)clearTimeout(i);i=setTimeout(()=>{a()},G)},c=t.subscribeFileEvents((l)=>{if(Sr(),e.invalidateDerivedCaches?.(l.map((f)=>f.path),l.some((f)=>f.type!=="change")),j(l),C(l.map((f)=>f.path)))E().then(()=>e.renderLeftPanel());if(n.push(...l),r)clearTimeout(r);r=setTimeout(s,50)},{onResync:u});return()=>{if(i)clearTimeout(i),i=null;c()}}
2
- export{Bp,XA,QA,Ta,Hd,C$};
1
+ import{p}from"./studio-jws1a87n.js";import{Sr}from"./studio-mx6wzh25.js";import{us,Wd,N$}from"./studio-t98vq4r6.js";import{cv,m}from"./studio-k2sz13zg.js";import{S}from"./studio-cg710sk9.js";var P=/[.*+?^${}()|[\]\\]/;function v(e){return P.test(e)?`\\${e}`:e}function L(e){let t=e.length;while(t>0&&e[t-1]===" "){let n=0,r=t-2;while(r>=0&&e[r]==="\\")n+=1,r-=1;if(n%2===1)break;t-=1}return e.slice(0,t)}function T(e,t){let n=t+1;if(e[n]==="!")n+=1;if(e[n]==="]")n+=1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]==="]")return n;n+=1}return-1}function k(e){let t="",n=0;while(n<e.length){let r=e[n];if(r==="\\"){let o=e[n+1];if(o===void 0)t+=String.raw`\\`,n+=1;else t+=v(o),n+=2;continue}if(r==="*"){let o=0;while(e[n]==="*")o+=1,n+=1;let i=t===""||t.endsWith("/");if(o>=2&&i&&e[n]==="/")t+="(?:[^/]+/)*",n+=1;else if(o>=2&&i&&n>=e.length)t+=".*";else t+="[^/]*";continue}if(r==="?"){t+="[^/]",n+=1;continue}if(r==="["){let o=T(e,n);if(o===-1){t+=String.raw`\[`,n+=1;continue}let i=e.slice(n+1,o),s=i.startsWith("!"),a=s?i.slice(1):i;t+=`[${s?"^":""}${a.startsWith("]")?String.raw`\]${a.slice(1)}`:a}]`,n=o+1;continue}t+=v(r),n+=1}return t}function F(e){let t=L(e);if(t===""||t.startsWith("#"))return null;let n=!1;if(t.startsWith("!"))n=!0,t=t.slice(1);let r=!1;if(t.endsWith("/"))r=!0,t=t.slice(0,-1);let o=t.includes("/");if(t.startsWith("/"))t=t.slice(1),o=!0;if(t==="")return null;let i=k(t);return{dirOnly:r,negated:n,re:new RegExp(`^${o?"":"(?:.*/)?"}${i}$`),source:e}}function M(e){let t=[];for(let n of e.split(/\r?\n/)){let r=F(n);if(r)t.push(r)}return t}function b(e){let t=e.replaceAll("\\","/").replace(/^\.\/+/,"").replace(/\/+$/,"");return t==="."?"":t}function O(e,t){if(e==="")return t;return t.startsWith(`${e}/`)?t.slice(e.length+1):null}function x(e){let t=b(e),n=[""];if(t==="")return n;let r="";for(let o of t.split("/"))r=r===""?o:`${r}/${o}`,n.push(r);return n}function W(e,t,n){let r=!1;for(let o of e){let i=O(o.base,t);if(i===null||i==="")continue;for(let s of o.rules){if(s.dirOnly&&!n)continue;if(s.re.test(i))r=!s.negated}}return r}function N(e,t,n){let r=b(t);if(r==="")return!1;let o=r.split("/"),i="";for(let[s,a]of o.entries()){i=i===""?a:`${i}/${a}`;let u=s===o.length-1;if(W(e,i,u?n:!0))return!0}return!1}var g=new Map,h=new Map;function zp(){g.clear(),h.clear()}async function w(e){try{let t=await p().readFile(e===""?".gitignore":`${e}/.gitignore`);return{base:e,rules:M(t)}}catch{return null}}function _(e){let t=g.get(e);if(t!==void 0)return Promise.resolve(t);let n=h.get(e);if(n)return n;let r=w(e).then((o)=>(g.set(e,o),h.delete(e),o));return h.set(e,r),r}async function E(){let e=[...g.keys()];h.clear();let t=await Promise.all(e.map((n)=>w(n)));g.clear();for(let[n,r]of e.entries())g.set(r,t[n]??null)}async function aO(e){await Promise.all(x(e).map((t)=>_(t)))}function A(e){let t=[];for(let n of x(e)){let r=g.get(n);if(r)t.push(r)}return t}function lO(e,t,n){return N(A(e),t,n)}function C(e){return e.some((t)=>b(t).split("/").pop()===".gitignore")}var U=1500,D={commit:0,open:1,reconnect:2},G=250,V=8,R=new Map,I=(e)=>e.replaceAll("\\","/");function La(...e){Wd(e,e);let t=Date.now()+U;for(let n of e)if(n)R.set(I(n),t)}function Bd(e){let t=I(e),n=R.get(t);if(n===void 0)return!1;if(Date.now()>n)return R.delete(t),!1;return!0}function Y(e){let t=e.lastIndexOf("/");return t===-1?".":e.slice(0,t)}function z(e){let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function B(e,t,n){let r=new Set;for(let o of n){let i=Y(o.path);if(o.type==="add"||o.type==="addDir"){let s=e.get(i);if(s&&!s.some((a)=>a.path===o.path))s.push({name:z(o.path),path:o.path,type:o.isDir?"directory":"file"}),r.add(i);if(o.type==="addDir"&&!e.has(o.path))e.set(o.path,[])}else if(o.type==="unlink"||o.type==="unlinkDir"){let s=e.get(i);if(s){let a=s.findIndex((u)=>u.path===o.path);if(a!==-1)s.splice(a,1),r.add(i)}if(o.type==="unlinkDir"){e.delete(o.path);let a=[];for(let c of e.keys())if(c.startsWith(`${o.path}/`))a.push(c);for(let c of a)e.delete(c);let u=[];for(let c of t)if(c===o.path||c.startsWith(`${o.path}/`))u.push(c);for(let c of u)t.delete(c)}}}return r}function j(e){let t=[],n=[];for(let r of e)if(r.type==="unlinkDir")n.push(r.path);else if(r.type!=="addDir")t.push(r.path);if(t.length>0||n.length>0)Wd(t,n)}function q(e,t){return e!==void 0&&e.length===t.length&&e.every((n,r)=>n===t[r])}var K=2;async function H(e,t){let n=[...e.keys()],r=0,o=async(s)=>{for(let a=0;a<K;a+=1){let u=e.get(s);if(!u)return;let c=[...u],l;try{l=await t(s)}catch{l=null}if(!e.has(s))return;if(!q(e.get(s),c))continue;if(l)e.set(s,l);else e.delete(s);return}},i=async()=>{while(r<n.length){let s=n[r];r+=1,await o(s)}};await Promise.all(Array.from({length:Math.min(V,n.length)},i))}var J=new Set(["media","grid"]);function Q(e){return e.some((t)=>J.has(t))||e.length>0&&e.every((t)=>t==="git-diff")}function X(){let e=new Set;for(let t of m.tabs.values()){let n=t.documentPath;if(n&&!t.doc.dirty&&!cv(n)&&!Q(t.capabilities.modes))e.add(n)}return[...e]}function L$(e){let t=p();if(!t.subscribeFileEvents)return()=>{};let n=[],r=null,o=null,i=null,s=()=>{r=null;let l=S,f=n.filter((d)=>!Bd(d.path));if(n=[],!l||f.length===0)return;let y=B(l.dirs,l.expanded,f);if(e.onContentChange){for(let d of f)if(d.type==="change")e.onContentChange(d.path)}if(y.size>0)e.renderLeftPanel()},a=async()=>{i=null;let l=o;o=null;let f=S;if(!f||!l)return;let y=H(f.dirs,(d)=>us(()=>t.listDirectory(d)));if(l==="reconnect")Sr(),e.invalidateDerivedCaches?.(void 0,!0),await Promise.all([y,E()]);else await y;if(S!==f)return;if(l==="reconnect")e.onResyncContent?.(X());e.renderLeftPanel()},u=(l)=>{if(l!=="commit")N$();if(!o||D[l]>D[o])o=l;if(i)clearTimeout(i);i=setTimeout(()=>{a()},G)},c=t.subscribeFileEvents((l)=>{if(Sr(),e.invalidateDerivedCaches?.(l.map((f)=>f.path),l.some((f)=>f.type!=="change")),j(l),C(l.map((f)=>f.path)))E().then(()=>e.renderLeftPanel());if(n.push(...l),r)clearTimeout(r);r=setTimeout(s,50)},{onResync:u});return()=>{if(i)clearTimeout(i),i=null;c()}}
2
+ export{zp,aO,lO,La,Bd,L$};
3
3
 
4
- //# debugId=313F331326D31CAE64756E2164756E21
5
- //# sourceMappingURL=studio-h310mbqm.js.map
4
+ //# debugId=53CFA69337BD98B264756E2164756E21
5
+ //# sourceMappingURL=studio-399a25za.js.map
@@ -0,0 +1,6 @@
1
+ import{gx,Pp,Fp,jp,bx,Nm,Hd,Zb,Hp,C$,lh,Om,eO,Ea}from"./studio-b2qpt0xy.js";import{p}from"./studio-jws1a87n.js";import{ph}from"./studio-t98vq4r6.js";import{uv}from"./studio-k2sz13zg.js";import{Ft,fn}from"./studio-hz5n7x27.js";import{Ne}from"./studio-sevbc3xv.js";import{oh,Wb,Fd,Vb,Ub,rh}from"./studio-8wnvtr4z.js";import{qw}from"./studio-rtfnhrdg.js";import{jr}from"./studio-qyed0ah6.js";import{S}from"./studio-cg710sk9.js";import{n,ee,_,v,id}from"./studio-8z66jk4z.js";function C(e,t){return new URL(`/node_modules/${e}`,t).href}function x(e){if(e===void 0)return!1;if(n(e))return!e.includes("${");if(Array.isArray(e))return e.every((t)=>x(t));if(v(e))return!("$ref"in e)&&!("$prototype"in e)&&!("$expression"in e)&&Object.values(e).every((t)=>x(t));return!0}function gS(e){let t=new Map;for(let[s,r]of Object.entries(e.state??{})){if(id(s)||!v(r)||!Array.isArray(r.examples))continue;let[o]=r.examples;if(x(o))t.set(s,o)}return t}var k={body:"body",root:":root"};function R(e,t,s,r,o=k){let l=[],a=(i,c)=>{let d={mediaQueries:t,scope:c,transposeValue:s};if(r)d.resolveValue=(m,g)=>r(m,g,c);for(let m of Nm(i,d))l.push(m.text)},y={},h={},b=[],w=[];for(let[i,c]of Object.entries(e)){if(_(c)&&!Array.isArray(c)){if(i.startsWith("@"))b.push([i,c]);else if(!i.startsWith("--"))w.push([i,c]);continue}if(bx(i)||i.startsWith("@"))continue;if(i.startsWith("--")||i==="colorScheme"||i==="color-scheme")y[i]=c;else h[i]=c}a(y,o.root),a(h,o.body);for(let[i,c]of w)if(i.startsWith("&"))a({[i]:c},o.root);else a(c,i);for(let[i,c]of b){if(gx(i)||Pp(i)){a({[i]:c},null);continue}let d={},m={},g=[];for(let[u,f]of Object.entries(c)){if(_(f)&&!Array.isArray(f)){if(!u.startsWith("@"))g.push([u,f]);continue}if(u.startsWith("--"))d[u]=f;else m[u]=f}a({[i]:d},o.root),a({[i]:m},o.body);for(let[u,f]of g)a({[i]:f},u)}if(Object.values(t).some((i)=>jp(i)!==null)&&!("colorScheme"in e))l.push(`${o.root} { color-scheme: light dark }`,`${o.root}:where([${Fp}="light"]) { color-scheme: light }`,`${o.root}:where([${Fp}="dark"]) { color-scheme: dark }`);return l.join(`
2
+ `)}var T={body:":host",root:":host"},P=new WeakMap,J=new WeakMap;function A(e){let t=e.replaceAll(/:root\b/g,":host").replaceAll(/(^|[\s,>+~(])(?:html|body)(?![\w-])/g,"$1:host").replaceAll(/:host(?:\s*>?\s*:host)+/g,":host");return t===e?null:t}function j(e){for(let t=0;t<e.cssRules.length;t+=1){let s=e.cssRules[t],r=s instanceof CSSStyleRule?A(s.selectorText):null;if(s instanceof CSSStyleRule&&r!==null){let l=`${r}${s.cssText.slice(s.cssText.indexOf("{"))}`;try{e.insertRule(l,t),e.deleteRule(t+1)}catch{}}let o=e.cssRules[t];if(o instanceof CSSGroupingRule)j(o)}}function D(e){let t=[];for(let s of e??[]){if(!_(s)||String(s.tagName).toLowerCase()!=="link")continue;let{href:r,rel:o}=s.attributes??{};if(n(r)&&r!==""&&n(o)&&o.split(/\s+/).includes("stylesheet"))t.push(r)}return t}async function M(e){let t=Ub(e,"project.json");try{let s=await fetch(t);if(!s.ok)return null;let r=new URL(t,location.href).href,o=new CSSStyleSheet({baseURL:r});return o.replaceSync(await s.text()),j(o),o}catch{return null}}async function L(e){let s=(await Promise.all(D(e.$head).map((o)=>M(o)))).filter((o)=>o!==null),{style:r}=e;if(_(r)){let o=new CSSStyleSheet;o.replaceSync(R(r,e.$media??{},(l)=>l,void 0,T)),s.push(o)}return s}function E(){let e=S?.projectConfig;if(!e||!ee(globalThis.CSSStyleSheet))return Promise.resolve([]);let t=P.get(e);if(!t)t=L(e).then((s)=>(J.set(e,s),s)),P.set(e,t);return t}function eN(){let e=S?.projectConfig;return(e&&J.get(e))??[]}var H=150;function Sw(e=H){let t=new Map;function s(){for(let[r,o]of t){if(t.size<=e)break;t.delete(r),o.remove()}}return{clear(){for(let r of t.values())r.remove();t.clear()},get(r){let o=t.get(r);if(o!==void 0)t.delete(r),t.set(r,o);return o},has:(r)=>t.has(r),keys:()=>[...t.keys()],set(r,o){t.delete(r),t.set(r,o),s()},size:()=>t.size}}function O(e){let t=Fd(S?.projectRoot);return URL.canParse(t)?new URL(e,t).href:location.href}async function N(e){try{let t=await p().readFile(e);Hd(!0);let s=Vb(e,rh());await Ft();let r;if(fn(e))r=(await jr(e,t)).document;else r=JSON.parse(t);return await F(r,e,s)}catch{return null}}async function F(e,t,s){Hd(!0),Zb(Wb());let r=await lh(e,{},O(t)),o=s&&{...s,versions:ph()};C$((l)=>uv(l,o));try{let l=Ea(e,r);return l instanceof HTMLElement?l:null}finally{C$(null)}}async function W(e,t){let s=await AT(t);if(!s)return null;let r=gS(s);return await bS(s,t,r)?qw(e,r):null}async function AT(e){try{let t=JSON.parse(await p().readFile(e));return _(t)&&!Array.isArray(t)?t:null}catch{return null}}async function bS(e,t,s){let r=null;try{Hd(!0),Zb(Wb());let o=await lh(e,{},O(t));for(let[y,h]of s)o[y]=h;let l=!1;Om(()=>{l=!0});let{stop:a}=Hp(()=>Ea({...e,tagName:"div"},o));return r=a,!l}catch{return!1}finally{Om(null),r?.()}}function V(e){return e.source!=="npm"&&(e.path?.endsWith(".json")??!1)}async function Cw(e,t){let s=t.get(e);if(s)return s;let r;try{eO((l)=>C(l,`${oh()}/`)),await E();let o=Ne.find((l)=>l.path===e);if(o&&V(o))r=await W(o,e);else r=o?await qw(o):await N(e)}catch{return}if(!r)return;return t.set(e,r),r}function vp(e){if(!ee(globalThis.IntersectionObserver))return{destroy(){},observe:(r)=>e(r),releaseDetached:()=>0};let t=new Set,s=new IntersectionObserver((r)=>{for(let o of r)if(o.isIntersecting)t.delete(o.target),s.unobserve(o.target),e(o.target)},{rootMargin:"200px"});return{destroy(){s.disconnect(),t.clear()},observe(r){if(t.has(r))return;t.add(r),s.observe(r)},releaseDetached(){let r=0;for(let o of t)if(!o.isConnected)t.delete(o),s.unobserve(o),r+=1;return r}}}
3
+ export{gS,eN,Sw,AT,bS,Cw,vp};
4
+
5
+ //# debugId=5C9D62702C40A66E64756E2164756E21
6
+ //# sourceMappingURL=studio-399xknkb.js.map
@@ -1,5 +1,5 @@
1
- import{Ne}from"./studio-1e8dw2w2.js";import{vt,Nc,Vo,Br}from"./studio-pqqq6v85.js";import{Vt,Kc,Qn,Vn,Ce,ui,We,m,Gr,pn,TC,qm,yh,Yc}from"./studio-vzgmyt0v.js";import{ne}from"./studio-4kzbrr5t.js";import{to,Es,il,h}from"./studio-5wzdy1jc.js";import{Ut}from"./studio-45gyxpcq.js";import{oe}from"./studio-ekgtrndg.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 Ou={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=vt(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(!p(i))return{...n,reason:"Nothing to compare — this file matches HEAD.",status:"unavailable"};if(t.diff?.filePath===i&&(t.diffRev===void 0||t.diffRev===h.git.rev))return{...n,reason:"",status:"ready"};if(u.get(e)?.failed&&u.get(e)?.path===i)return{...n,reason:k,status:"unavailable"};return{...n,diffPath:i,reason:"",status:"loading"}}if(t.preset==="code"&&Nc(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 p(e){return h.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=h.layoutSelection,r=a?.layoutFile??il(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=Es(),r=o.documentPath===null||t.locale===null?null:Kc(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=c.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 ${Vt(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=Ut(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)u.delete(e),c.delete(e),o.derived=t}function dE(e){b(e,null)}function d(e,t){let o=pn(e),n=o?.derived,i=R(e);if(!o||!n||!i)return;if(Vo.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(qm(s),r)yh(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&&vt(e)===null)n.resolved=null;if(i.path===null||i.path===n.resolved){v(e,i);return}n.resolved=i.path,Vo.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=vt(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 u=new Map;function A(e,t,o){let n=t.diffPath,i=p(n),{rev:a}=h.git,r=u.get(e);if(n===null||!i||r?.path===n&&r.rev===a)return;u.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"||u.get(e)?.path!==n)return;if(l)s.diff=l,s.diffRev=a;else u.set(e,{failed:!0,path:n,rev:a});d(e,o)}).catch((l)=>{console.error("loadDiff error:",l)})}var c=new Map;function C(e,t,o){let n=t.probePath;if(n===null||c.get(e)?.path===n)return;c.set(e,{exists:null,path:n}),o.fileExists(n).then((i)=>{let a=pn(e)?.derived;if(a?.kind!=="companion"||a.preset!=="locale"||c.get(e)?.path!==n)return;c.set(e,{exists:i,path:n}),d(e,o)}).catch((i)=>{console.error("fileExists error:",i)})}var f=new Map;function M(e,t){if(f.has(e))return;f.set(e,requestAnimationFrame(()=>{f.delete(e);try{d(e,t)}catch(o){console.error("applyDerivation error:",o)}}))}function aD(e,t){ne(()=>{let o=pn(e),n=o?.derived;if(!n)return;o.activeTabId;let i=vt(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")h.layoutSelection,i?.doc.document?.$layout;M(e,t)})}function tw(e,t,o,n=null){let i=vt(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 Nc(i)==="source"?"a source pane that is not already showing Code":null;if(e==="diff")return p(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 il(i.doc.document.$layout)===null?"a page with a layout — this one declares none":null;if(e==="locale"){let r=Es();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 tb(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)=>uE(e.id)===null)??null}function uE(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 lD(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:ui(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:()=>tb(Gr().id)===null,requires:D,undo:"none",run:(t,o)=>{let n=Vn("pane.derive",o,"preset",O_),i=Qn("pane.derive",o,"media")??null,a=Qn("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)qm(g),yh(r,g);d(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;Yc(t.activeTabId),dE(t.id)}}]}
2
- export{O_,Ou,M_,dE,aD,tw,tb,uE,lD};
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};
3
3
 
4
- //# debugId=55B7584E5B6E46B664756E2164756E21
5
- //# sourceMappingURL=studio-wxhy1yh7.js.map
4
+ //# debugId=F1C86F560EDDDAE864756E2164756E21
5
+ //# sourceMappingURL=studio-43y04qck.js.map
@@ -1,5 +1,5 @@
1
- import{n,v}from"./studio-zkq3r91p.js";var t="jx.collab.v1";function G_(o){if(!v(o))return{offer:[],refused:null};let{collab:s,detail:l,protocols:e}=o;if(s===!1){let r=n(l)?l.trim():"";return{offer:[],refused:r||"This server has collaboration disabled."}}if(!Array.isArray(e)||e.length===0)return{offer:[],refused:null};if(e.includes(t))return{offer:[t],refused:null};let i=e.filter((r)=>n(r)).join(", ")||"none";return{offer:[],refused:`This server speaks collab envelope ${i}; this editor speaks ${t}.`}}
1
+ import{n,v}from"./studio-8z66jk4z.js";var t="jx.collab.v1";function G_(o){if(!v(o))return{offer:[],refused:null};let{collab:s,detail:l,protocols:e}=o;if(s===!1){let r=n(l)?l.trim():"";return{offer:[],refused:r||"This server has collaboration disabled."}}if(!Array.isArray(e)||e.length===0)return{offer:[],refused:null};if(e.includes(t))return{offer:[t],refused:null};let i=e.filter((r)=>n(r)).join(", ")||"none";return{offer:[],refused:`This server speaks collab envelope ${i}; this editor speaks ${t}.`}}
2
2
  export{G_};
3
3
 
4
4
  //# debugId=C27986DCFFD950FF64756E2164756E21
5
- //# sourceMappingURL=studio-06j4en5h.js.map
5
+ //# sourceMappingURL=studio-4g8yb6jn.js.map
@@ -1,5 +1,5 @@
1
- import{as}from"./studio-s0fg2wav.js";var r="site-",f=new Set(["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),o=[[183,183],[192,214],[216,246],[248,893],[895,8191],[8204,8205],[8255,8256],[8304,8591],[11264,12271],[12289,55295],[63744,64975],[65008,65533],[65536,983039]];function n(e){return`${String.fromCodePoint(92)}u{${e.toString(16)}}`}var a=[String.raw`\-.0-9_a-z`,...o.map(([e,t])=>`${n(e)}-${n(t)}`)].join(""),s=new RegExp(`^[${a}]$`,"u");function lw(e){if(e==="")return"Enter a tag name.";if(!/^[a-z]/.test(e))return"A tag name starts with a lower-case letter.";for(let t of e.slice(1))if(!s.test(t))return/[A-Z]/.test(t)?"A tag name is lower case.":`“${t}” cannot appear in a tag name.`;if(!e.includes("-"))return"A tag name needs a hyphen, such as my-card.";if(f.has(e))return`<${e}> is reserved by HTML.`;return""}function lb(e){let t=as(e).replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(t==="")return"";return/^[a-z]/.test(t)&&t.includes("-")?t:`${r}${t}`}
2
- export{lw,lb};
1
+ import{as}from"./studio-kg5ya5r2.js";var r="site-",f=new Set(["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),o=[[183,183],[192,214],[216,246],[248,893],[895,8191],[8204,8205],[8255,8256],[8304,8591],[11264,12271],[12289,55295],[63744,64975],[65008,65533],[65536,983039]];function n(e){return`${String.fromCodePoint(92)}u{${e.toString(16)}}`}var a=[String.raw`\-.0-9_a-z`,...o.map(([e,t])=>`${n(e)}-${n(t)}`)].join(""),s=new RegExp(`^[${a}]$`,"u");function lw(e){if(e==="")return"Enter a tag name.";if(!/^[a-z]/.test(e))return"A tag name starts with a lower-case letter.";for(let t of e.slice(1))if(!s.test(t))return/[A-Z]/.test(t)?"A tag name is lower case.":`“${t}” cannot appear in a tag name.`;if(!e.includes("-"))return"A tag name needs a hyphen, such as my-card.";if(f.has(e))return`<${e}> is reserved by HTML.`;return""}function db(e){let t=as(e).replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(t==="")return"";return/^[a-z]/.test(t)&&t.includes("-")?t:`${r}${t}`}
2
+ export{lw,db};
3
3
 
4
- //# debugId=9EB4936A7D52521C64756E2164756E21
5
- //# sourceMappingURL=studio-jw0q5j6k.js.map
4
+ //# debugId=A84CD13C07BE640164756E2164756E21
5
+ //# sourceMappingURL=studio-4jhw38b2.js.map
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-03mqh8ax.js";import{Ht,Na,ul}from"./studio-3w35qvay.js";import{ae}from"./studio-cpkamjdn.js";import{T,R,En,rt,Zs}from"./studio-jttyqrmh.js";import{g}from"./studio-4kzbrr5t.js";import{u}from"./studio-vzgmyt0v.js";import{hw,AD,hb,yi}from"./studio-3zge48z4.js";import{xh,Tr,S}from"./studio-45gyxpcq.js";import{n,lf}from"./studio-zkq3r91p.js";var I={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPalette",$description:'The command palette: a `role="combobox"` field over the kit\'s `jx-listbox`, whose rows are `jx-option`s the host projects. `rows` is the ranked set for the current mode and query; `activeId` is the highlight, and it is ONE string — the id the field points `aria-activedescendant` at and the id the listbox is handed as `active`, so a key moves the caret without the rows reconciling and no row re-decides its own flag. The FIELD is not a `jx-combobox`: this one carries a mode chip inside its box, its Enter runs a command rather than committing a value, and its panel is a centred scrim rather than a popover under a control. Every gesture calls back into panels/quick-search.ts, which owns the modes, the ranking, the recents and what a row does.',tagName:"div",attributes:{part:"palette"},style:{display:"contents",'& [part="overlay"]':{position:"fixed",inset:"0",zIndex:"1000",display:"flex",justifyContent:"center",paddingTop:"60px",background:"rgba(0, 0, 0, 0.4)"},'& [part="overlay"][hidden]':{display:"none"},'& [part="panel"]':{width:"560px",maxWidth:"calc(100vw - 32px)",maxHeight:"420px",display:"flex",flexDirection:"column",alignSelf:"flex-start",background:"var(--jx-bg-overlay)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-md)",boxShadow:"var(--jx-shadow-dialog)",color:"var(--jx-fg)",fontFamily:"var(--jx-font-sans)",overflow:"hidden"},'& [part="input-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",paddingLeft:"var(--jx-space-4)",background:"var(--jx-bg-input)",borderBottom:"1px solid var(--jx-border)"},'& [part="chip-slot"], & [part="empty-slot"], & [part="section-slot"], & [part="trailing-slot"]':{display:"contents"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-1)",flexShrink:"0",padding:"2px var(--jx-space-1) 2px var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-accent-solid)",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-sm)"},'& [part="chip-remove"] > [part="control"]':{color:"inherit",opacity:"0.8",":hover":{opacity:"1",background:"transparent"}},'& [part="input"]':{flex:"1",minWidth:"0",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-4) var(--jx-space-1)",font:"inherit",fontSize:"var(--jx-text-lg)",border:"none",outline:"none",background:"none",color:"var(--jx-fg)","::placeholder":{color:"var(--jx-fg-muted)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="results"]':{$description:"The list is the kit's: a `jx-listbox` of `jx-option`, so the highlight is ONE id — `active`, the same string the field points `aria-activedescendant` at — and the listbox's sidecar is the single writer of every row's `selected`. What this surface still decides is density. The kit's row pads itself by `--jx-space-3`; the other half of the 16px optical margin the panel has always had sits here, on the list, so the heading, the rows and the empty sentence line up on one edge instead of each naming it.",flex:"1",paddingInline:"var(--jx-space-3)"},'& [part="option"] [part="label"]':{fontWeight:"500"},'& [part="option"] [part="description"]':{$description:"A `jx-select` row's note is a category at the END of the row, so the kit pushes it there with an auto margin. A palette row's note is a CONTINUATION of its name — the file's directory, the command's category — and the far edge belongs to the chord, which is how this surface teaches the keyboard it replaced. So the auto margin moves to the end slot.",marginInlineStart:"0"},'& [part="option"] [part="end"]':{marginInlineStart:"auto"},'& [part="option"][aria-disabled="true"]':{$description:"An unavailable command is greyed with its `requires` sentence as the subtitle, and that sentence is the reason the row is on screen at all. The kit fades the whole row to 0.45, which would take a muted grey below any readable contrast — so the row keeps its ink and only the name and the glyph dim.",opacity:"1"},'& [part="option"][aria-disabled="true"] [part="label"], & [part="option"][aria-disabled="true"] [part="icon"]':{opacity:"0.45"},'& [part="chord"]':{flexShrink:"0",fontFamily:"inherit",fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-muted)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-sm)",padding:"0 5px"},'& [part="option"][aria-selected="true"] [part="chord"]':{color:"inherit",borderColor:"currentColor"},'& [part="badge"]':{fontSize:"var(--jx-text-xs)",padding:"1px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-border)",color:"var(--jx-fg-dim)"},'& [part="hint"]':{padding:"var(--jx-space-2) var(--jx-space-5)",borderTop:"1px solid var(--jx-border)",color:"var(--jx-fg-muted)",fontSize:"var(--jx-text-xs)"},'& [part="hint"] kbd':{fontFamily:"inherit",color:"var(--jx-fg-dim)"}},children:[{tagName:"div",attributes:{part:"overlay",hidden:"${state.open ? null : ''}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"},value:[]}]},children:[{tagName:"div",attributes:{part:"panel"},onclick:{$prototype:"Function",body:[{stopPropagation:!0}]},children:[{tagName:"div",attributes:{part:"input-row"},children:[{tagName:"span",attributes:{part:"chip-slot",role:"none"},$switch:{$ref:"#/state/hasChip"},cases:{true:{tagName:"span",attributes:{part:"chip"},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${state.chipLabel}"},{tagName:"jx-action-button",$props:{label:"Clear mode",hint:"Clear mode (Backspace)",icon:"x",size:"sm"},attributes:{part:"chip-remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}},{tagName:"input",attributes:{part:"input",type:"text",role:"combobox","aria-controls":"quick-search-listbox","aria-expanded":"${state.expanded ? 'true' : 'false'}","aria-activedescendant":"${state.activeId || null}","aria-autocomplete":"list","aria-label":"${state.placeholder}",placeholder:"${state.placeholder}"},value:{$ref:"#/state/query"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activate"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/close"},value:[]}],Backspace:[{$switch:{$ref:"#/state/canClearMode"},cases:{true:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}]}}]},{tagName:"jx-listbox",attributes:{part:"results",id:"quick-search-listbox"},$props:{label:"Results",active:"${state.activeId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activateRow"},value:[{$ref:"event#/detail"}]}],description:"One handler for every row, because a row's `select` bubbles. The detail is the row's `value`, which is the index it occupies in `rows` — the same number a hover names, and the number the id is built from."},children:[{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/isEmpty"},cases:{true:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyHint}"}}},{tagName:"div",attributes:{part:"section-slot",role:"none"},$switch:{$ref:"#/state/showSection"},cases:{true:{tagName:"div",attributes:{part:"group-heading"},textContent:"${state.sectionLabel}"}}},{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"jx-option",attributes:{part:"option",id:"quick-search-option-${$map.index}","data-kind":"${$map.item.kind}"},$props:{value:"${$map.index}",label:{$ref:"$map/item/name"},description:{$ref:"$map/item/detail"},disabled:{$ref:"$map/item/disabled"}},onmouseenter:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/hover"},value:[{$ref:"$map/index"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",attributes:{slot:"end",part:"trailing-slot"},$switch:{$ref:"$map/item/trailing"},cases:{chord:{tagName:"kbd",attributes:{part:"chord"},textContent:"${$map.item.chord}"},recent:{tagName:"span",attributes:{part:"badge"},textContent:"recent"}}}]}}]},{tagName:"div",attributes:{part:"hint"},children:[{tagName:"kbd",textContent:"↑↓"}," move · ",{tagName:"kbd",textContent:"↵"}," run · ",{tagName:"kbd",textContent:"?"}," modes · ",{tagName:"kbd",textContent:">"}," commands · ",{tagName:"kbd",textContent:"@"}," elements"]}]}]}]};var C=[{mode:"files",prefix:"",chip:"Files",placeholder:"Go to a file…",description:"Open a file by any part of its path — pgblog finds pages/blog/index.md."},{mode:"commands",prefix:">",chip:"Commands",placeholder:"Run a command…",description:"Run anything Studio can do, with its keyboard shortcut printed beside it."},{mode:"nodes",prefix:"@",chip:"Symbols",placeholder:"Go to an element in this document…",description:"Select an element in the open document by its Outline name."},{mode:"projects",prefix:"",chip:"Recent Projects",placeholder:"Open a recent project…",description:"Reopen a project you have had open before."},{mode:"picker",prefix:"?",chip:"Modes",placeholder:"Type ? for modes, > for commands, @ for elements…",description:"List these modes."}],X=new Map(C.map((e)=>[e.mode,e])),O=C.filter((e)=>e.prefix!=="");function _(e){return X.get(e)??C[0]}function L(e,t,o){let a=O.find((s)=>t.startsWith(s.prefix));if(a)return L(a.mode,t.slice(1),o);let i=e;if(i==="picker"&&t.trim()!=="")i="files";if(i==="files"&&!o)i="projects";return{mode:i,query:t}}var Y=new Set(["/","-","_","."," "]);function Z(e,t){if(t==="")return 0;let o=e.toLowerCase(),a=t.toLowerCase(),i=o.lastIndexOf("/")+1,s=0,r=0,v=-2;for(let K of a){let h=o.indexOf(K,r);if(h===-1)return null;if(h===v+1)s+=8;if(h===0||Y.has(o[h-1]??""))s+=6;if(h>=i)s+=4;v=h,r=h+1}return s-v*0.01-o.length*0.001}function w(e,t,o){let a=[];for(let[i,s]of e.entries()){let r=Z(o(s),t);if(r!==null)a.push({index:i,item:s,score:r})}return a.toSorted((i,s)=>s.score-i.score||i.index-s.index).map((i)=>i.item)}function q(e){let t=e.args,o=t?.properties;if(!t||!o)return{kind:"none"};let a=Object.keys(o);if(a.length!==1)return{kind:"unsupported"};let i=a[0],s=o[i];if(s.enum)return{kind:"choice",name:i,choices:s.enum.map((r)=>({label:String(r),value:r}))};if(s.type==="boolean")return{kind:"choice",name:i,choices:[{label:"on",value:!0},{label:"off",value:!1}]};return{kind:"unsupported"}}function N(e){return`quick-search-option-${e}`}var D="jx-studio-recent-commands",ee=6;function H(){try{let e=JSON.parse(localStorage.getItem(D)||"[]");return Array.isArray(e)?e.filter((t)=>n(t)):[]}catch{return[]}}function te(e){let t=[e,...H().filter((o)=>o!==e)].slice(0,ee);try{localStorage.setItem(D,JSON.stringify(t))}catch{}}var z=null,x=!1,b="picker",l="",d=0,y=null,j=!1,c=null;function B(){return Zs("popover","quick-search")}function Sk(e){z=e??null}function zg(e="files"){x=!0,b=e,l="",d=0,c=null,y=null,m(),ye(),M()}function k(){x=!1,c=null,m()}function Q(){return S?S.projectRoot:null}function W(){return S!=null}function J(){return L(b,l,W())}function U(e){let t=e.split("/");return t.pop(),t.length>0?t.join("/"):""}function ne(e){if(e.startsWith("/home/"))return`~/${e.split("/").slice(3).join("/")}`;return e}async function M(){if(!x||y!==null||j||!W())return;j=!0,m();try{await Ht(),y=(await p().searchFiles("",ul())).map((t)=>({kind:"file",path:t.path,name:t.name??t.path.split("/").pop()??"",detail:U(t.path),recent:!1}))}catch{y=[]}j=!1,m()}function oe(e){if(e.trim()==="")return AD(Q()??void 0).map((t)=>({kind:"file",path:t.path,name:t.name,detail:U(t.path),recent:!0}));return w(y??[],e.trim(),(t)=>t.path)}function re(e){let t=hw().map((o)=>({kind:"project",root:o.root,name:o.name,detail:ne(o.root)}));return w(t,e.trim(),(o)=>`${o.name}/${o.root}`)}function ie(e,t){let o=H(),a=[];for(let r of e.visible()){if(q(r).kind==="unsupported")continue;if(!(r.menus??["palette"]).includes("palette"))continue;a.push({kind:"command",id:r.id,name:`${r.category}: ${r.title}`,detail:e.disabledReason(r.id)??"",chord:e.keymap.formatBinding(r.id)??"",enabled:e.isEnabled(r.id),recent:o.includes(r.id)})}let i=w(a,t.trim(),(r)=>r.name);if(t.trim()!=="")return i;let s=o.map((r)=>i.find((v)=>v.id===r)).filter((r)=>r!==void 0);return[...s,...i.filter((r)=>!s.includes(r))]}function se(e){let t=u.value;if(!t)return[];let o=xh(t.doc.document).map((a)=>({kind:"node",path:a.path,name:lf(a.node)?String(a.node).slice(0,60):Tr(a.node),detail:a.nodeType}));return w(o,e.trim(),(a)=>a.name)}function ce(){return C.flatMap((e)=>e.mode==="picker"?[]:[{kind:"mode",mode:e.mode,name:e.chip,detail:e.description,chord:e.prefix}])}function de(e){let t=c,o=t.choices.map((a)=>({kind:"arg",commandId:t.command.id,argName:t.name,value:a.value,name:a.label,detail:`${t.command.title} → ${t.name}`}));return w(o,e.trim(),(a)=>a.name)}function le(){let{mode:e,query:t}=J();if(c)return{rows:de(t),showingRecent:!1};switch(e){case"commands":{let o=ae();return{rows:o?ie(o,t):[],showingRecent:t.trim()===""}}case"nodes":return{rows:se(t),showingRecent:!1};case"projects":return{rows:re(t),showingRecent:t.trim()===""};case"picker":return{rows:ce(),showingRecent:!1};default:return{rows:oe(t),showingRecent:t.trim()===""}}}function pe(e){let t=O.find((o)=>e.startsWith(o.prefix));if(t)b=t.mode,l=e.slice(1);else l=e;if(d=0,e!==l)P().query=e;m(),M()}function me(){b="picker",c=null,d=0,m()}function ue(e){b=e,l="",d=0,m(),M()}function G(e,t){let o=ae();if(!o)return;te(e.id),k(),En(o,e.id,t,"Palette")}function A(e){switch(e.kind){case"project":{k(),z?.openRecentProject(e.root);return}case"file":{k(),hb({name:e.name,path:e.path,root:Q()??""}),yi(e.path);return}case"mode":{ue(e.mode);return}case"node":{k(),rt("selection.set",{path:e.path},"Palette");return}case"arg":{G(c.command,{[e.argName]:e.value});return}default:he(e)}}function he(e){let t=ae(),o=t?.get(e.id);if(!t||!o||!e.enabled)return;let a=q(o);if(a.kind==="choice"){c={choices:a.choices,command:o,name:a.name},l="",d=0,m();return}G(o)}function fe(e){let t=e.split(".").pop()?.toLowerCase();if(t==="json")return"file-code";if(t&&Na(t))return"file-text";return"file"}function ge(e){switch(e.kind){case"project":return"folder-open";case"file":return fe(e.name);case"command":return"play";case"node":return"stack";default:return"caret-right"}}function xe(e,t){if((e.kind==="command"||e.kind==="mode")&&e.chord)return"chord";if(e.kind==="command"&&e.recent)return"recent";return t?"recent":"none"}function be(e){switch(e.kind){case"project":return`project:${e.root}`;case"file":return`file:${e.path}`;case"command":return`command:${e.id}`;case"node":return`node:${e.path.join("/")}`;case"mode":return`mode:${e.mode}`;default:return`arg:${e.value}`}}function ve(e,t){if(j)return"Reading the project's files…";if(t.trim()!=="")return"No results";switch(e){case"projects":return"No recent projects — open one to get started";case"nodes":return"Open a document to jump to its elements";case"commands":return"Type to find any command in Studio";default:return _(e).placeholder}}T("palette",I);var E=null,F=null,f=[];function P(){return E??=g({activate:()=>{let e=f[d];if(e)A(e)},activateRow:(e)=>{let t=f[Number(e)];if(t)A(t)},activeId:"",canClearMode:!1,chipLabel:"",clearMode:me,close:k,emptyHint:"",expanded:!1,hasChip:!1,hover:(e)=>{d=e,P().activeId=N(e)},input:pe,isEmpty:!0,move:(e)=>{if(f.length===0)return;d=Math.max(0,Math.min(d+e,f.length-1)),P().activeId=N(d)},open:!1,placeholder:"",query:"",rows:[],sectionLabel:"",showSection:!1}),E}function ye(){setTimeout(()=>{if(x)B().querySelector('[part="input"]')?.focus()},0)}function m(){let e=P();if(!F)F=R("palette",e,B());if(e.open=x,!x){f=[];return}let{mode:t,query:o}=J(),{rows:a,showingRecent:i}=le(),s=_(t);f=a,e.placeholder=c?`Choose a ${c.name}…`:s.placeholder,e.hasChip=c!==null||t!=="picker",e.chipLabel=c?c.command.title:s.chip,e.query=l,e.canClearMode=l===""&&(c!==null||b!=="picker"),e.rows=a.map((r)=>({chord:(r.kind==="command"||r.kind==="mode")&&r.chord?r.chord:"",detail:r.detail,disabled:r.kind==="command"&&!r.enabled,icon:ge(r),key:be(r),kind:r.kind,name:r.name,trailing:xe(r,i)})),e.expanded=a.length>0,e.activeId=a.length>0?N(d):"",e.isEmpty=a.length===0,e.emptyHint=ve(t,o),e.showSection=i&&a.length>0,e.sectionLabel=c?`${c.command.title} — ${c.name}`:t==="projects"?"Recent projects":t==="commands"?"Recently used":"Recently opened"}
2
- export{Sk,zg};
1
+ import{p}from"./studio-jws1a87n.js";import{Ft,Ma,fl}from"./studio-hz5n7x27.js";import{ae}from"./studio-b2qpt0xy.js";import{L,R,En,nt,Xs}from"./studio-0w2dr0q8.js";import{g}from"./studio-y60sts62.js";import{h}from"./studio-k2sz13zg.js";import{hw,jD,fb,xi}from"./studio-c71806xz.js";import{_h,Tr,S}from"./studio-cg710sk9.js";import{n,df}from"./studio-8z66jk4z.js";var I={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPalette",$description:'The command palette: a `role="combobox"` field over the kit\'s `jx-listbox`, whose rows are `jx-option`s the host projects. `rows` is the ranked set for the current mode and query; `activeId` is the highlight, and it is ONE string — the id the field points `aria-activedescendant` at and the id the listbox is handed as `active`, so a key moves the caret without the rows reconciling and no row re-decides its own flag. The FIELD is not a `jx-combobox`: this one carries a mode chip inside its box, its Enter runs a command rather than committing a value, and its panel is a centred scrim rather than a popover under a control. Every gesture calls back into panels/quick-search.ts, which owns the modes, the ranking, the recents and what a row does.',tagName:"div",attributes:{part:"palette"},style:{display:"contents",'& [part="overlay"]':{position:"fixed",inset:"0",zIndex:"1000",display:"flex",justifyContent:"center",paddingTop:"60px",background:"rgba(0, 0, 0, 0.4)"},'& [part="overlay"][hidden]':{display:"none"},'& [part="panel"]':{width:"560px",maxWidth:"calc(100vw - 32px)",maxHeight:"420px",display:"flex",flexDirection:"column",alignSelf:"flex-start",background:"var(--jx-bg-overlay)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-md)",boxShadow:"var(--jx-shadow-dialog)",color:"var(--jx-fg)",fontFamily:"var(--jx-font-sans)",overflow:"hidden"},'& [part="input-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",paddingLeft:"var(--jx-space-4)",background:"var(--jx-bg-input)",borderBottom:"1px solid var(--jx-border)"},'& [part="chip-slot"], & [part="empty-slot"], & [part="section-slot"], & [part="trailing-slot"]':{display:"contents"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-1)",flexShrink:"0",padding:"2px var(--jx-space-1) 2px var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-accent-solid)",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-sm)"},'& [part="chip-remove"] > [part="control"]':{color:"inherit",opacity:"0.8",":hover":{opacity:"1",background:"transparent"}},'& [part="input"]':{flex:"1",minWidth:"0",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-4) var(--jx-space-1)",font:"inherit",fontSize:"var(--jx-text-lg)",border:"none",outline:"none",background:"none",color:"var(--jx-fg)","::placeholder":{color:"var(--jx-fg-muted)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="results"]':{$description:"The list is the kit's: a `jx-listbox` of `jx-option`, so the highlight is ONE id — `active`, the same string the field points `aria-activedescendant` at — and the listbox's sidecar is the single writer of every row's `selected`. What this surface still decides is density. The kit's row pads itself by `--jx-space-3`; the other half of the 16px optical margin the panel has always had sits here, on the list, so the heading, the rows and the empty sentence line up on one edge instead of each naming it.",flex:"1",paddingInline:"var(--jx-space-3)"},'& [part="option"] [part="label"]':{fontWeight:"500"},'& [part="option"] [part="description"]':{$description:"A `jx-select` row's note is a category at the END of the row, so the kit pushes it there with an auto margin. A palette row's note is a CONTINUATION of its name — the file's directory, the command's category — and the far edge belongs to the chord, which is how this surface teaches the keyboard it replaced. So the auto margin moves to the end slot.",marginInlineStart:"0"},'& [part="option"] [part="end"]':{marginInlineStart:"auto"},'& [part="option"][aria-disabled="true"]':{$description:"An unavailable command is greyed with its `requires` sentence as the subtitle, and that sentence is the reason the row is on screen at all. The kit fades the whole row to 0.45, which would take a muted grey below any readable contrast — so the row keeps its ink and only the name and the glyph dim.",opacity:"1"},'& [part="option"][aria-disabled="true"] [part="label"], & [part="option"][aria-disabled="true"] [part="icon"]':{opacity:"0.45"},'& [part="chord"]':{flexShrink:"0",fontFamily:"inherit",fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-muted)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-sm)",padding:"0 5px"},'& [part="option"][aria-selected="true"] [part="chord"]':{color:"inherit",borderColor:"currentColor"},'& [part="badge"]':{fontSize:"var(--jx-text-xs)",padding:"1px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-border)",color:"var(--jx-fg-dim)"},'& [part="hint"]':{padding:"var(--jx-space-2) var(--jx-space-5)",borderTop:"1px solid var(--jx-border)",color:"var(--jx-fg-muted)",fontSize:"var(--jx-text-xs)"},'& [part="hint"] kbd':{fontFamily:"inherit",color:"var(--jx-fg-dim)"}},children:[{tagName:"div",attributes:{part:"overlay",hidden:"${state.open ? null : ''}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"},value:[]}]},children:[{tagName:"div",attributes:{part:"panel"},onclick:{$prototype:"Function",body:[{stopPropagation:!0}]},children:[{tagName:"div",attributes:{part:"input-row"},children:[{tagName:"span",attributes:{part:"chip-slot",role:"none"},$switch:{$ref:"#/state/hasChip"},cases:{true:{tagName:"span",attributes:{part:"chip"},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${state.chipLabel}"},{tagName:"jx-action-button",$props:{label:"Clear mode",hint:"Clear mode (Backspace)",icon:"x",size:"sm"},attributes:{part:"chip-remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}},{tagName:"input",attributes:{part:"input",type:"text",role:"combobox","aria-controls":"quick-search-listbox","aria-expanded":"${state.expanded ? 'true' : 'false'}","aria-activedescendant":"${state.activeId || null}","aria-autocomplete":"list","aria-label":"${state.placeholder}",placeholder:"${state.placeholder}"},value:{$ref:"#/state/query"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activate"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/close"},value:[]}],Backspace:[{$switch:{$ref:"#/state/canClearMode"},cases:{true:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}]}}]},{tagName:"jx-listbox",attributes:{part:"results",id:"quick-search-listbox"},$props:{label:"Results",active:"${state.activeId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activateRow"},value:[{$ref:"event#/detail"}]}],description:"One handler for every row, because a row's `select` bubbles. The detail is the row's `value`, which is the index it occupies in `rows` — the same number a hover names, and the number the id is built from."},children:[{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/isEmpty"},cases:{true:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyHint}"}}},{tagName:"div",attributes:{part:"section-slot",role:"none"},$switch:{$ref:"#/state/showSection"},cases:{true:{tagName:"div",attributes:{part:"group-heading"},textContent:"${state.sectionLabel}"}}},{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"jx-option",attributes:{part:"option",id:"quick-search-option-${$map.index}","data-kind":"${$map.item.kind}"},$props:{value:"${$map.index}",label:{$ref:"$map/item/name"},description:{$ref:"$map/item/detail"},disabled:{$ref:"$map/item/disabled"}},onmouseenter:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/hover"},value:[{$ref:"$map/index"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",attributes:{slot:"end",part:"trailing-slot"},$switch:{$ref:"$map/item/trailing"},cases:{chord:{tagName:"kbd",attributes:{part:"chord"},textContent:"${$map.item.chord}"},recent:{tagName:"span",attributes:{part:"badge"},textContent:"recent"}}}]}}]},{tagName:"div",attributes:{part:"hint"},children:[{tagName:"kbd",textContent:"↑↓"}," move · ",{tagName:"kbd",textContent:"↵"}," run · ",{tagName:"kbd",textContent:"?"}," modes · ",{tagName:"kbd",textContent:">"}," commands · ",{tagName:"kbd",textContent:"@"}," elements"]}]}]}]};var C=[{mode:"files",prefix:"",chip:"Files",placeholder:"Go to a file…",description:"Open a file by any part of its path — pgblog finds pages/blog/index.md."},{mode:"commands",prefix:">",chip:"Commands",placeholder:"Run a command…",description:"Run anything Studio can do, with its keyboard shortcut printed beside it."},{mode:"nodes",prefix:"@",chip:"Symbols",placeholder:"Go to an element in this document…",description:"Select an element in the open document by its Outline name."},{mode:"projects",prefix:"",chip:"Recent Projects",placeholder:"Open a recent project…",description:"Reopen a project you have had open before."},{mode:"picker",prefix:"?",chip:"Modes",placeholder:"Type ? for modes, > for commands, @ for elements…",description:"List these modes."}],X=new Map(C.map((e)=>[e.mode,e])),F=C.filter((e)=>e.prefix!=="");function O(e){return X.get(e)??C[0]}function _(e,t,o){let a=F.find((s)=>t.startsWith(s.prefix));if(a)return _(a.mode,t.slice(1),o);let i=e;if(i==="picker"&&t.trim()!=="")i="files";if(i==="files"&&!o)i="projects";return{mode:i,query:t}}var Y=new Set(["/","-","_","."," "]);function Z(e,t){if(t==="")return 0;let o=e.toLowerCase(),a=t.toLowerCase(),i=o.lastIndexOf("/")+1,s=0,r=0,v=-2;for(let K of a){let u=o.indexOf(K,r);if(u===-1)return null;if(u===v+1)s+=8;if(u===0||Y.has(o[u-1]??""))s+=6;if(u>=i)s+=4;v=u,r=u+1}return s-v*0.01-o.length*0.001}function w(e,t,o){let a=[];for(let[i,s]of e.entries()){let r=Z(o(s),t);if(r!==null)a.push({index:i,item:s,score:r})}return a.toSorted((i,s)=>s.score-i.score||i.index-s.index).map((i)=>i.item)}function q(e){let t=e.args,o=t?.properties;if(!t||!o)return{kind:"none"};let a=Object.keys(o);if(a.length!==1)return{kind:"unsupported"};let i=a[0],s=o[i];if(s.enum)return{kind:"choice",name:i,choices:s.enum.map((r)=>({label:String(r),value:r}))};if(s.type==="boolean")return{kind:"choice",name:i,choices:[{label:"on",value:!0},{label:"off",value:!1}]};return{kind:"unsupported"}}function N(e){return`quick-search-option-${e}`}var D="jx-studio-recent-commands",ee=6;function H(){try{let e=JSON.parse(localStorage.getItem(D)||"[]");return Array.isArray(e)?e.filter((t)=>n(t)):[]}catch{return[]}}function te(e){let t=[e,...H().filter((o)=>o!==e)].slice(0,ee);try{localStorage.setItem(D,JSON.stringify(t))}catch{}}var z=null,x=!1,b="picker",l="",d=0,y=null,j=!1,c=null;function B(){return Xs("popover","quick-search")}function Sk(e){z=e??null}function Vg(e="files"){x=!0,b=e,l="",d=0,c=null,y=null,m(),ye(),M()}function k(){x=!1,c=null,m()}function Q(){return S?S.projectRoot:null}function W(){return S!=null}function J(){return _(b,l,W())}function U(e){let t=e.split("/");return t.pop(),t.length>0?t.join("/"):""}function ne(e){if(e.startsWith("/home/"))return`~/${e.split("/").slice(3).join("/")}`;return e}async function M(){if(!x||y!==null||j||!W())return;j=!0,m();try{await Ft(),y=(await p().searchFiles("",fl())).map((t)=>({kind:"file",path:t.path,name:t.name??t.path.split("/").pop()??"",detail:U(t.path),recent:!1}))}catch{y=[]}j=!1,m()}function oe(e){if(e.trim()==="")return jD(Q()??void 0).map((t)=>({kind:"file",path:t.path,name:t.name,detail:U(t.path),recent:!0}));return w(y??[],e.trim(),(t)=>t.path)}function re(e){let t=hw().map((o)=>({kind:"project",root:o.root,name:o.name,detail:ne(o.root)}));return w(t,e.trim(),(o)=>`${o.name}/${o.root}`)}function ie(e,t){let o=H(),a=[];for(let r of e.visible()){if(q(r).kind==="unsupported")continue;if(!(r.menus??["palette"]).includes("palette"))continue;a.push({kind:"command",id:r.id,name:`${r.category}: ${r.title}`,detail:e.disabledReason(r.id)??"",chord:e.keymap.formatBinding(r.id)??"",enabled:e.isEnabled(r.id),recent:o.includes(r.id)})}let i=w(a,t.trim(),(r)=>r.name);if(t.trim()!=="")return i;let s=o.map((r)=>i.find((v)=>v.id===r)).filter((r)=>r!==void 0);return[...s,...i.filter((r)=>!s.includes(r))]}function se(e){let t=h.value;if(!t)return[];let o=_h(t.doc.document).map((a)=>({kind:"node",path:a.path,name:df(a.node)?String(a.node).slice(0,60):Tr(a.node),detail:a.nodeType}));return w(o,e.trim(),(a)=>a.name)}function ce(){return C.flatMap((e)=>e.mode==="picker"?[]:[{kind:"mode",mode:e.mode,name:e.chip,detail:e.description,chord:e.prefix}])}function de(e){let t=c,o=t.choices.map((a)=>({kind:"arg",commandId:t.command.id,argName:t.name,value:a.value,name:a.label,detail:`${t.command.title} → ${t.name}`}));return w(o,e.trim(),(a)=>a.name)}function le(){let{mode:e,query:t}=J();if(c)return{rows:de(t),showingRecent:!1};switch(e){case"commands":{let o=ae();return{rows:o?ie(o,t):[],showingRecent:t.trim()===""}}case"nodes":return{rows:se(t),showingRecent:!1};case"projects":return{rows:re(t),showingRecent:t.trim()===""};case"picker":return{rows:ce(),showingRecent:!1};default:return{rows:oe(t),showingRecent:t.trim()===""}}}function pe(e){let t=F.find((o)=>e.startsWith(o.prefix));if(t)b=t.mode,l=e.slice(1);else l=e;if(d=0,e!==l)P().query=e;m(),M()}function me(){b="picker",c=null,d=0,m()}function ue(e){b=e,l="",d=0,m(),M()}function G(e,t){let o=ae();if(!o)return;te(e.id),k(),En(o,e.id,t,"Palette")}function A(e){switch(e.kind){case"project":{k(),z?.openRecentProject(e.root);return}case"file":{k(),fb({name:e.name,path:e.path,root:Q()??""}),xi(e.path);return}case"mode":{ue(e.mode);return}case"node":{k(),nt("selection.set",{path:e.path},"Palette");return}case"arg":{G(c.command,{[e.argName]:e.value});return}default:he(e)}}function he(e){let t=ae(),o=t?.get(e.id);if(!t||!o||!e.enabled)return;let a=q(o);if(a.kind==="choice"){c={choices:a.choices,command:o,name:a.name},l="",d=0,m();return}G(o)}function fe(e){let t=e.split(".").pop()?.toLowerCase();if(t==="json")return"file-code";if(t&&Ma(t))return"file-text";return"file"}function ge(e){switch(e.kind){case"project":return"folder-open";case"file":return fe(e.name);case"command":return"play";case"node":return"stack";default:return"caret-right"}}function xe(e,t){if((e.kind==="command"||e.kind==="mode")&&e.chord)return"chord";if(e.kind==="command"&&e.recent)return"recent";return t?"recent":"none"}function be(e){switch(e.kind){case"project":return`project:${e.root}`;case"file":return`file:${e.path}`;case"command":return`command:${e.id}`;case"node":return`node:${e.path.join("/")}`;case"mode":return`mode:${e.mode}`;default:return`arg:${e.value}`}}function ve(e,t){if(j)return"Reading the project's files…";if(t.trim()!=="")return"No results";switch(e){case"projects":return"No recent projects — open one to get started";case"nodes":return"Open a document to jump to its elements";case"commands":return"Type to find any command in Studio";default:return O(e).placeholder}}L("palette",I);var E=null,T=null,f=[];function P(){return E??=g({activate:()=>{let e=f[d];if(e)A(e)},activateRow:(e)=>{let t=f[Number(e)];if(t)A(t)},activeId:"",canClearMode:!1,chipLabel:"",clearMode:me,close:k,emptyHint:"",expanded:!1,hasChip:!1,hover:(e)=>{d=e,P().activeId=N(e)},input:pe,isEmpty:!0,move:(e)=>{if(f.length===0)return;d=Math.max(0,Math.min(d+e,f.length-1)),P().activeId=N(d)},open:!1,placeholder:"",query:"",rows:[],sectionLabel:"",showSection:!1}),E}function ye(){setTimeout(()=>{if(x)B().querySelector('[part="input"]')?.focus()},0)}function m(){let e=P();if(!T)T=R("palette",e,B());if(e.open=x,!x){f=[];return}let{mode:t,query:o}=J(),{rows:a,showingRecent:i}=le(),s=O(t);f=a,e.placeholder=c?`Choose a ${c.name}…`:s.placeholder,e.hasChip=c!==null||t!=="picker",e.chipLabel=c?c.command.title:s.chip,e.query=l,e.canClearMode=l===""&&(c!==null||b!=="picker"),e.rows=a.map((r)=>({chord:(r.kind==="command"||r.kind==="mode")&&r.chord?r.chord:"",detail:r.detail,disabled:r.kind==="command"&&!r.enabled,icon:ge(r),key:be(r),kind:r.kind,name:r.name,trailing:xe(r,i)})),e.expanded=a.length>0,e.activeId=a.length>0?N(d):"",e.isEmpty=a.length===0,e.emptyHint=ve(t,o),e.showSection=i&&a.length>0,e.sectionLabel=c?`${c.command.title} — ${c.name}`:t==="projects"?"Recent projects":t==="commands"?"Recently used":"Recently opened"}
2
+ export{Sk,Vg};
3
3
 
4
- //# debugId=1AB9EA86F1519E9464756E2164756E21
5
- //# sourceMappingURL=studio-3v5cagy9.js.map
4
+ //# debugId=37FD90620A84DC6464756E2164756E21
5
+ //# sourceMappingURL=studio-4ncmwqw5.js.map
@@ -0,0 +1,7 @@
1
+ import{Q}from"./studio-nqxqf8p2.js";import{g,C}from"./studio-y60sts62.js";import{Kt,zt}from"./studio-b2qpt0xy.js";import{Ve,wt,L,R,sn,dt}from"./studio-0w2dr0q8.js";var G={$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…"}]}]};L("github-auth",G);function _(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ve,wt("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 Kt(o),o});return{close(){let i=n?.root;if(i instanceof HTMLElement)zt(i);n?.dispose(),n=null,t.remove(),l()},host:t,ready:r}}var A="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,S=!1;function H(e){f=e}function LT(){return f!==null||S||localStorage.getItem("jx_github_token")!==null}function $T(){return p()?"desktop":"browser"}function y(){return f??localStorage.getItem("jx_github_token")}function IT(){f=null,S=!1,localStorage.removeItem("jx_github_token"),p()?.signOut().catch(()=>{})}var E="github.auth",O="Source Control",j="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 N(e){C.error("Could not reach GitHub to sign in.",{action:j,detail:`${z}
2
+
3
+ ${Q(e)}`,key:E,source:O})}function w(e,t){C.warn(e,{action:j,detail:t,key:E,source:O})}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 N(t),null}if(!e.ok)return w("GitHub refused to start the sign-in.",`GitHub answered ${e.status}${e.statusText?` ${e.statusText}`:""}.`),null;return await e.json()}async function hS(){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 w("GitHub sign-in was not completed.",Q(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,T=!1,I=(c)=>{if(T)return;if(T=!0,i=!0,o)clearTimeout(o),o=null;r(c)},k=!1,x=()=>{if(k)return;k=!0,D.close()},d=(c)=>{I(c),x()},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(A,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}w("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){N(c),d(null);return}o=setTimeout(h,n*1000)}},D=_({layer:dt("dialog"),onCancel:()=>{x()},onClosed:()=>{d(null)},userCode:u,verificationUri:b});o=setTimeout(h,n*1000)})}
4
+ export{LT,$T,IT,hS};
5
+
6
+ //# debugId=5250A3B017A221F564756E2164756E21
7
+ //# sourceMappingURL=studio-5atwjgkj.js.map
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-03mqh8ax.js";import{Si}from"./studio-ry81j4q1.js";import{us}from"./studio-k3bcy02e.js";import{nn}from"./studio-x3mjr5cc.js";import{Wc,mA,jb}from"./studio-34jrz12k.js";import{Z}from"./studio-zkq3r91p.js";var u=new Map,h=new Map,d=new Map,g=new Set;function m(e){return nn(e)===".svg"}function c(e){let t=e===null?null:/^\s*(\d+(?:\.\d+)?)\s*(?:px)?\s*$/.exec(e),n=t?Number(t[1]):Number.NaN;return n>0?n:null}function M(e){let t=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;if(t.localName!=="svg")return null;let n=c(t.getAttribute("width")),i=c(t.getAttribute("height")),r=(t.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number),o=r[2]??Number.NaN,l=r[3]??Number.NaN,a=r.length===4&&o>0&&l>0,s=null;if(n!==null&&i!==null)s={height:i,width:n};else if(a&&n!==null)s={height:n*l/o,width:n};else if(a&&i!==null)s={height:i,width:i*o/l};else if(a)s={height:l,width:o};return s&&{height:Math.round(s.height),width:Math.round(s.width)}}async function b(e){g.add(e);try{let t=M(await p().readFile(e));if(t&&t.width>0&&t.height>0)d.set(e,t)}catch{}}function Rd(e){let t=Si(e);return u.has(t)&&(!m(t)||g.has(t))}function f(e,t){let n=mA(e),i=d.get(e);return{bytes:Z(t?.size)?t.size:null,ext:nn(n),height:i?.height??null,kind:Wc({name:n}),modified:t?.modified??null,name:n,path:e,width:i?.width??null}}function Dd(e){return u.get(Si(e))??null}function oN(e){for(let t of e){if(t.type!=="file")continue;let n=Si(t.path);if(!u.has(n))u.set(n,f(n,t))}}async function qu(e){let t=Si(e),n=u.get(t);if(n&&Rd(t))return n;let i=h.get(t);if(i)return i;let r=(async()=>{if(m(t)&&!g.has(t))await b(t);if(n){let a=d.get(t);return{...n,height:a?.height??null,width:a?.width??null}}let l;try{l=(await us(()=>p().listDirectory(jb(t)))).find((s)=>Si(s.path)===t)}catch{l=void 0}return f(t,l)})();h.set(t,r);let o=await r;return h.delete(t),u.set(t,o),o}function _p(e,t,n){if(!(t>0&&n>0))return!1;let i=Si(e);if(m(i))return!1;let r=d.get(i);if(r&&r.width===t&&r.height===n)return!1;d.set(i,{height:n,width:t});let o=u.get(i);if(o)u.set(i,{...o,height:n,width:t});return!0}function rN(){u.clear(),d.clear(),g.clear()}function WT(e){if(e<1024)return`${e} B`;if(e<1048576)return`${Math.round(e/1024)} KB`;return`${(e/1048576).toFixed(1)} MB`}function Aw(e){if(!e)return"";let t=[];if(e.width!==null&&e.height!==null)t.push(`${e.width} × ${e.height}`);if(e.bytes!==null)t.push(WT(e.bytes));return t.join(" · ")}
2
- export{Rd,Dd,oN,qu,_p,rN,WT,Aw};
1
+ import{p}from"./studio-jws1a87n.js";import{Si}from"./studio-ea74s8c1.js";import{us}from"./studio-t98vq4r6.js";import{tn}from"./studio-8wnvtr4z.js";import{Uc,xA,Bb}from"./studio-f746039f.js";import{Z}from"./studio-8z66jk4z.js";var u=new Map,h=new Map,d=new Map,g=new Set;function m(e){return tn(e)===".svg"}function c(e){let t=e===null?null:/^\s*(\d+(?:\.\d+)?)\s*(?:px)?\s*$/.exec(e),n=t?Number(t[1]):Number.NaN;return n>0?n:null}function M(e){let t=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;if(t.localName!=="svg")return null;let n=c(t.getAttribute("width")),i=c(t.getAttribute("height")),r=(t.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number),o=r[2]??Number.NaN,l=r[3]??Number.NaN,a=r.length===4&&o>0&&l>0,s=null;if(n!==null&&i!==null)s={height:i,width:n};else if(a&&n!==null)s={height:n*l/o,width:n};else if(a&&i!==null)s={height:i,width:i*o/l};else if(a)s={height:l,width:o};return s&&{height:Math.round(s.height),width:Math.round(s.width)}}async function b(e){g.add(e);try{let t=M(await p().readFile(e));if(t&&t.width>0&&t.height>0)d.set(e,t)}catch{}}function Nd(e){let t=Si(e);return u.has(t)&&(!m(t)||g.has(t))}function f(e,t){let n=xA(e),i=d.get(e);return{bytes:Z(t?.size)?t.size:null,ext:tn(n),height:i?.height??null,kind:Uc({name:n}),modified:t?.modified??null,name:n,path:e,width:i?.width??null}}function Ad(e){return u.get(Si(e))??null}function cN(e){for(let t of e){if(t.type!=="file")continue;let n=Si(t.path);if(!u.has(n))u.set(n,f(n,t))}}async function Uu(e){let t=Si(e),n=u.get(t);if(n&&Nd(t))return n;let i=h.get(t);if(i)return i;let r=(async()=>{if(m(t)&&!g.has(t))await b(t);if(n){let a=d.get(t);return{...n,height:a?.height??null,width:a?.width??null}}let l;try{l=(await us(()=>p().listDirectory(Bb(t)))).find((s)=>Si(s.path)===t)}catch{l=void 0}return f(t,l)})();h.set(t,r);let o=await r;return h.delete(t),u.set(t,o),o}function Sp(e,t,n){if(!(t>0&&n>0))return!1;let i=Si(e);if(m(i))return!1;let r=d.get(i);if(r&&r.width===t&&r.height===n)return!1;d.set(i,{height:n,width:t});let o=u.get(i);if(o)u.set(i,{...o,height:n,width:t});return!0}function dN(){u.clear(),d.clear(),g.clear()}function qT(e){if(e<1024)return`${e} B`;if(e<1048576)return`${Math.round(e/1024)} KB`;return`${(e/1048576).toFixed(1)} MB`}function Aw(e){if(!e)return"";let t=[];if(e.width!==null&&e.height!==null)t.push(`${e.width} × ${e.height}`);if(e.bytes!==null)t.push(qT(e.bytes));return t.join(" · ")}
2
+ export{Nd,Ad,cN,Uu,Sp,dN,qT,Aw};
3
3
 
4
- //# debugId=58C7A99D10AD2EBC64756E2164756E21
5
- //# sourceMappingURL=studio-gr36vnte.js.map
4
+ //# debugId=726BA5BCA81A334B64756E2164756E21
5
+ //# sourceMappingURL=studio-5frqk7c0.js.map