@jxsuite/studio 5.6.0 → 5.7.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 (173) hide show
  1. package/dist/chunks/{2020-zvax9fmb.js → 2020-cs2sb9t1.js} +3 -3
  2. package/dist/chunks/adapter-y5gdq19c.js +4 -0
  3. package/dist/chunks/{cf-account-picker-zfycs4k2.js → cf-account-picker-882a7ecm.js} +3 -3
  4. package/dist/chunks/cf-settings-20dznc3j.js +4 -0
  5. package/dist/chunks/components-q037dya7.js +4 -0
  6. package/dist/chunks/content-source-37x3vsap.js +4 -0
  7. package/dist/chunks/{convert-to-repeater-x19jr6c7.js → convert-to-repeater-grfep2w8.js} +3 -3
  8. package/dist/chunks/editor-j5sq149q.js +4 -0
  9. package/dist/chunks/entry-commands-c5h3nqck.js +4 -0
  10. package/dist/chunks/{extension-sections-y90sa0n4.js → extension-sections-dp8endhx.js} +3 -3
  11. package/dist/chunks/file-ops-937cvqk6.js +4 -0
  12. package/dist/chunks/files-tznwe1p1.js +4 -0
  13. package/dist/chunks/format-host-e2pjvd25.js +4 -0
  14. package/dist/chunks/fs-events-fv64ak3s.js +4 -0
  15. package/dist/chunks/git-panel-gb713ttc.js +4 -0
  16. package/dist/chunks/{grid-view-d9mybhn0.js → grid-view-5amhg604.js} +10 -10
  17. package/dist/chunks/iframe-host-t819mcg5.js +4 -0
  18. package/dist/chunks/{index-vnwy9d44.js → index-9ydfe04y.js} +3 -3
  19. package/dist/chunks/index-m0x5ztax.js +4 -0
  20. package/dist/chunks/{javascript-f0nrbdjb.js → javascript-d9pqgc2p.js} +2 -2
  21. package/dist/chunks/{jsonMode-nfa90dtf.js → jsonMode-800yvbem.js} +4 -4
  22. package/dist/chunks/jx-validate-zc9zp77s.js +4 -0
  23. package/dist/chunks/layers-4bsr82wz.js +4 -0
  24. package/dist/chunks/layers-panel-b6shnaax.js +4 -0
  25. package/dist/chunks/lit-html-cfn61dn7.js +4 -0
  26. package/dist/chunks/media-picker-ej0kdh1j.js +4 -0
  27. package/dist/chunks/menu-rtxf9chb.js +4 -0
  28. package/dist/chunks/{monaco-binding-antn79jf.js → monaco-binding-62dtmgbf.js} +3 -3
  29. package/dist/chunks/monaco-buffer-nn4dtx27.js +4 -0
  30. package/dist/chunks/{monaco-setup-k8s40vwg.js → monaco-setup-tj13ndtm.js} +3 -3
  31. package/dist/chunks/notify-ahs57a2z.js +4 -0
  32. package/dist/chunks/platform-v9xyfkbx.js +4 -0
  33. package/dist/chunks/publish-panel-bq36xcmj.js +4 -0
  34. package/dist/chunks/quick-search-zm00h9dh.js +4 -0
  35. package/dist/chunks/references-99ws0b0m.js +4 -0
  36. package/dist/chunks/right-panel-pq2f71q3.js +4 -0
  37. package/dist/chunks/section-registry-b2yzp9sw.js +4 -0
  38. package/dist/chunks/{studio-y17505ge.js → studio-01kbbqg3.js} +207 -207
  39. package/dist/chunks/{studio-gxna6yta.js → studio-01qza1n3.js} +4 -4
  40. package/dist/chunks/{studio-n2e133d6.js → studio-03wwfvyt.js} +4 -4
  41. package/dist/chunks/{studio-09n3fyy0.js → studio-0bbxhhce.js} +4 -4
  42. package/dist/chunks/{studio-dknr8m7b.js → studio-0k9mvpgj.js} +7 -7
  43. package/dist/chunks/{studio-s85vah66.js → studio-0scebvb9.js} +5 -5
  44. package/dist/chunks/studio-1a99w39s.js +5 -0
  45. package/dist/chunks/{studio-eegyf5vg.js → studio-1wvfxkyy.js} +4 -4
  46. package/dist/chunks/{studio-ft8pfpp0.js → studio-1x8x26k3.js} +4 -4
  47. package/dist/chunks/{studio-28pz4s1k.js → studio-222rqyyc.js} +4 -4
  48. package/dist/chunks/{studio-6exg5z4x.js → studio-4xppwncr.js} +3 -3
  49. package/dist/chunks/{studio-0c3fpdqj.js → studio-54g077x3.js} +5 -5
  50. package/dist/chunks/{studio-z47mm077.js → studio-56z7evx4.js} +6 -6
  51. package/dist/chunks/{studio-zkkdbbvd.js → studio-5e9zsamh.js} +6 -6
  52. package/dist/chunks/{studio-4yztve2t.js → studio-65fhspdd.js} +4 -4
  53. package/dist/chunks/{studio-b29h7g7s.js → studio-693nhyky.js} +4 -4
  54. package/dist/chunks/{studio-654fxcr0.js → studio-7pgy3xaf.js} +4 -4
  55. package/dist/chunks/{studio-k9pwvmz8.js → studio-888knnkc.js} +4 -4
  56. package/dist/chunks/{studio-b5rxwkj2.js → studio-9mqfamps.js} +4 -4
  57. package/dist/chunks/{studio-011em5cf.js → studio-a7xqhc3n.js} +4 -4
  58. package/dist/chunks/{studio-mf41717j.js → studio-aje966s9.js} +4 -4
  59. package/dist/chunks/studio-aqmph6k4.js +5 -0
  60. package/dist/chunks/studio-c6w3tq7t.js +5 -0
  61. package/dist/chunks/{studio-tzs6njnb.js → studio-c6zdm25z.js} +7 -7
  62. package/dist/chunks/{studio-1pxvgx1t.js → studio-c9d3pxf7.js} +4 -4
  63. package/dist/chunks/{studio-pvj970st.js → studio-ceb34dxj.js} +4 -4
  64. package/dist/chunks/studio-cvbkkfqb.js +5 -0
  65. package/dist/chunks/{studio-sadckcpp.js → studio-cxt150pj.js} +5 -5
  66. package/dist/chunks/{studio-891t1tv9.js → studio-dkn3x3hz.js} +4 -4
  67. package/dist/chunks/studio-e6re3rk1.js +5 -0
  68. package/dist/chunks/{studio-9n2j9nqk.js → studio-edbtvcd1.js} +4 -4
  69. package/dist/chunks/{studio-wr0pq67n.js → studio-eh0rac07.js} +4 -4
  70. package/dist/chunks/{studio-mm8x32gg.js → studio-evwgp1ym.js} +4 -4
  71. package/dist/chunks/{studio-9tkaykt5.js → studio-f195h2hq.js} +4 -4
  72. package/dist/chunks/{studio-0nm2skex.js → studio-fqq890ap.js} +3 -3
  73. package/dist/chunks/{studio-02y9cb4h.js → studio-frb0qbf7.js} +5 -5
  74. package/dist/chunks/{studio-je15p5v8.js → studio-gfn1kpxj.js} +5 -5
  75. package/dist/chunks/{studio-ymsjnvp9.js → studio-gh97gngt.js} +4 -4
  76. package/dist/chunks/{studio-zkvyd3ev.js → studio-gp02nqnw.js} +4 -4
  77. package/dist/chunks/{studio-5fc0728f.js → studio-hjbg8d5y.js} +7 -7
  78. package/dist/chunks/{studio-dtmdjmqb.js → studio-j6gnhvaa.js} +4 -4
  79. package/dist/chunks/{studio-d007j0z3.js → studio-mwxgyn9h.js} +6 -6
  80. package/dist/chunks/{studio-36s6qjgq.js → studio-n78gjfy8.js} +4 -4
  81. package/dist/chunks/studio-nbxqcgvf.js +5 -0
  82. package/dist/chunks/{studio-ks0ecgjx.js → studio-nt06yybj.js} +4 -4
  83. package/dist/chunks/{studio-ebt49j3c.js → studio-p7c1agz0.js} +5 -5
  84. package/dist/chunks/{studio-y164brht.js → studio-pwqfmt4p.js} +4 -4
  85. package/dist/chunks/{studio-6zyt56ek.js → studio-r3kaka4d.js} +4 -4
  86. package/dist/chunks/{studio-tj28pxa1.js → studio-semd1s8s.js} +4 -4
  87. package/dist/chunks/studio-skzanb0k.js +5 -0
  88. package/dist/chunks/{studio-z1vdxq0e.js → studio-spf2skgc.js} +4 -4
  89. package/dist/chunks/{studio-7w04zw8h.js → studio-st75kn99.js} +5 -5
  90. package/dist/chunks/{studio-dmymvk2j.js → studio-sxc0zvpt.js} +3 -3
  91. package/dist/chunks/studio-t1eedsyx.js +4 -0
  92. package/dist/chunks/{studio-153mwkyq.js → studio-tp642n5g.js} +4 -4
  93. package/dist/chunks/{studio-r7yeeqc4.js → studio-tw7rre6s.js} +4 -4
  94. package/dist/chunks/{studio-t0v47dpc.js → studio-tzegmy4w.js} +4 -4
  95. package/dist/chunks/studio-vavmwshr.js +5 -0
  96. package/dist/chunks/{studio-805fwp9k.js → studio-wma2c6g8.js} +4 -4
  97. package/dist/chunks/studio-x92tgnee.js +64 -0
  98. package/dist/chunks/studio-xk0z6msk.js +5 -0
  99. package/dist/chunks/{studio-njmg0e73.js → studio-xry7tk3z.js} +5 -5
  100. package/dist/chunks/{studio-sgzss898.js → studio-xta2vxp6.js} +7 -7
  101. package/dist/chunks/{studio-jsr14n1s.js → studio-xy3tv3az.js} +4 -4
  102. package/dist/chunks/{studio-6k1eswp9.js → studio-y7jehjrp.js} +4 -4
  103. package/dist/chunks/{studio-81twpmzj.js → studio-yr04mv2j.js} +4 -4
  104. package/dist/chunks/{studio-gj4j9e7k.js → studio-zd4kayn2.js} +4 -4
  105. package/dist/chunks/{studio-w8w9frjy.js → studio-zpnk016a.js} +12 -12
  106. package/dist/chunks/{tsMode-eq26t9gs.js → tsMode-k9s9fcag.js} +4 -4
  107. package/dist/chunks/workspace-b69mgm0e.js +4 -0
  108. package/dist/chunks/{ws-client-3gxqp06s.js → ws-client-0ja08haa.js} +3 -3
  109. package/dist/manifest.json +62 -62
  110. package/dist/studio.js +95 -95
  111. package/package.json +3 -3
  112. package/src/canvas/stage-scrollbar.ts +7 -7
  113. package/src/files/file-ops.ts +5 -8
  114. package/src/panels/jump-bar.ts +132 -158
  115. package/src/panels/pane-context.ts +8 -8
  116. package/src/panels/pane-grid.ts +18 -26
  117. package/src/panels/style-panel.ts +2 -2
  118. package/src/services/context-manager.ts +41 -70
  119. package/src/services/document-assistant.ts +12 -3
  120. package/src/services/harness/chat-reducer.ts +115 -0
  121. package/src/services/harness/turn-hooks.ts +50 -0
  122. package/src/services/tool-executor.ts +69 -288
  123. package/src/services/tool-outcomes.ts +12 -10
  124. package/src/studio.ts +2 -5
  125. package/src/surfaces/block-action-bar.json +6 -1
  126. package/src/surfaces/jump-bar.json +9 -12
  127. package/src/surfaces/jump-bar.ts +15 -16
  128. package/src/surfaces/pane-context.json +2 -2
  129. package/src/surfaces/pane-grid.json +8 -25
  130. package/src/surfaces/pane-grid.ts +7 -8
  131. package/src/surfaces/statusbar.json +71 -3
  132. package/src/surfaces/statusbar.ts +66 -139
  133. package/src/surfaces/style-panel.json +3 -3
  134. package/src/surfaces/style-panel.ts +11 -1
  135. package/dist/chunks/adapter-6zhjbpmd.js +0 -4
  136. package/dist/chunks/cf-settings-fpa485q3.js +0 -4
  137. package/dist/chunks/components-b0vh4sq8.js +0 -4
  138. package/dist/chunks/content-source-z5t0d0h9.js +0 -4
  139. package/dist/chunks/editor-7e23n4a8.js +0 -4
  140. package/dist/chunks/entry-commands-5cm6aba2.js +0 -4
  141. package/dist/chunks/file-ops-hv7gf757.js +0 -4
  142. package/dist/chunks/files-kb0epdxf.js +0 -4
  143. package/dist/chunks/format-host-eg1wy2bp.js +0 -4
  144. package/dist/chunks/fs-events-ky3vxfmh.js +0 -4
  145. package/dist/chunks/git-panel-yyg3bzp2.js +0 -4
  146. package/dist/chunks/iframe-host-9wdf0hes.js +0 -4
  147. package/dist/chunks/index-2tf0m2ne.js +0 -4
  148. package/dist/chunks/jx-validate-7w11db9v.js +0 -4
  149. package/dist/chunks/layers-7zasrpse.js +0 -4
  150. package/dist/chunks/layers-panel-9nzc4fdq.js +0 -4
  151. package/dist/chunks/lit-html-5qr7nbng.js +0 -4
  152. package/dist/chunks/media-picker-maevn9d4.js +0 -4
  153. package/dist/chunks/menu-wq6q0v3y.js +0 -4
  154. package/dist/chunks/monaco-buffer-9ry2rn5x.js +0 -4
  155. package/dist/chunks/notify-g91gjd6w.js +0 -4
  156. package/dist/chunks/platform-jdwjp2vt.js +0 -4
  157. package/dist/chunks/publish-panel-8yym447p.js +0 -4
  158. package/dist/chunks/quick-search-9bzm9kh3.js +0 -4
  159. package/dist/chunks/references-znssfqvq.js +0 -4
  160. package/dist/chunks/right-panel-czbzktm8.js +0 -4
  161. package/dist/chunks/section-registry-0rtq73qs.js +0 -4
  162. package/dist/chunks/studio-0mm38y62.js +0 -5
  163. package/dist/chunks/studio-27tc8q0h.js +0 -5
  164. package/dist/chunks/studio-7djymzt2.js +0 -5
  165. package/dist/chunks/studio-ant1zbp3.js +0 -5
  166. package/dist/chunks/studio-eb5sty2k.js +0 -5
  167. package/dist/chunks/studio-frv7vjhw.js +0 -5
  168. package/dist/chunks/studio-mb8jhtr4.js +0 -64
  169. package/dist/chunks/studio-nvykrgbj.js +0 -4
  170. package/dist/chunks/studio-nw4q9sdn.js +0 -5
  171. package/dist/chunks/studio-p6avneaq.js +0 -5
  172. package/dist/chunks/studio-vz7b43ng.js +0 -5
  173. package/dist/chunks/workspace-emt8454d.js +0 -4
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-6k1eswp9.js";import{v}from"./studio-0nm2skex.js";import{g}from"./studio-27tc8q0h.js";import{qt,wi,Zt,Ka,$r,Us}from"./studio-ft8pfpp0.js";import{Ms,mc}from"./studio-b5rxwkj2.js";import{ds,wb,xb,Ha,Er}from"./studio-eb5sty2k.js";import{D}from"./studio-153mwkyq.js";import{me}from"./studio-09n3fyy0.js";var fc="draft",bb="Marked a draft. Studio filters drafts out of its own lists; the build does not exclude them yet.";function Tu(e){return e?.[fc]===!0}function N(e){return e?.properties?.[fc]?.type==="boolean"}function Jf(e,t){return N(e)||Tu(t)}var E=v({includeDrafts:!1});function G(){return E.includeDrafts}function BE(e){E.includeDrafts=e}function K(e,t,r){return r?e:e.filter((o)=>!Tu(t(o)))}var b="__path";function vb(e){let r=(D?.projectConfig?.content??{})[e];if(!r?.source)return null;let o=r.source.replace(/^\.\//,"").replace(/\/$/,""),f=r.format==="json"?".json":wi(r.format)?.extensions[0]??$r()?.extensions[0]??".json";return{def:r,dir:o,ext:f,name:e}}function Pw(){let e=D?.projectConfig?.content??{};return Object.entries(e).filter(([,t])=>{let r=t.source?.replace(/^\.\//,"")??"";return r!==""&&!/\.[a-z0-9]+$/i.test(r)}).map(([t,r])=>({dir:r.source.replace(/^\.\//,"").replace(/\/$/,""),name:t}))}async function P(e,t){let r=p(),o=[],f=async(x)=>{let w;try{w=await r.listDirectory(x)}catch{return}for(let C of w)if(C.type==="directory")await f(C.path);else if(t.some((k)=>C.path.endsWith(k)))o.push(C.path)};return await f(e),o.toSorted()}async function I1(e){await qt().catch(()=>{});let t=vb(e);if(!t)return[];return(await P(t.dir,[t.ext])).map((o)=>{let f=o.split("/").pop()??o;return f.slice(0,f.length-t.ext.length)})}async function V(e,t,r){let o=Array.from({length:e.length}),f=0,x=Array.from({length:Math.min(t,e.length)},async()=>{while(f<e.length){let w=f;f+=1,o[w]=await r(e[w])}});return await Promise.all(x),o}function T(e){if(e===null||e===void 0)return null;if(typeof e==="string"||typeof e==="number"||typeof e==="boolean")return e;if(Array.isArray(e)&&e.every((t)=>typeof t!=="object"||t===null))return e.map(String);return JSON.stringify(e)}function I(e){for(let t of g.tabs.values())if(t.documentPath===e)return t;return null}function W(e,t){return e.every((r)=>{let o=r[t];return o===null||o===void 0||typeof o!=="string"?!0:!o.startsWith("{")&&!o.startsWith("[")})}var j=new WeakSet;async function R1(){let e=[];for(let t of g.tabs.values()){let r=Ha(t);if(r&&j.has(r.source))e.push(r.load())}await Promise.all(e)}function A(e){let t=M(e);if(e.drafts)j.add(t);return t}function M(e){let t=new Map,r=null,o=null,f=(l=!1)=>{if(!l&&r)return r;return r=(async()=>{await qt().catch(()=>{});let c=p(),a=await e.list();t.clear(),o=null;let u=await V(a,32,async(n)=>{try{let i=await c.readFile(n),s=await Er(n,i);return{document:s.document,formatName:s.format.name,frontmatter:s.frontmatter??{},rawText:i}}catch{return null}});for(let[n,i]of a.entries()){let s=u[n];if(s)t.set(i,s)}})(),r},x=()=>{if(o)return o;let l={editable:!1,field:b,insertOnly:!0,kind:"string",pk:!0,required:!0,title:"Path",widthHint:220},c=wb(e.schema()),a=new Set([b,...c.map((i)=>i.field)]),u=[...t.values()].map((i)=>{let s={};for(let[d,m]of Object.entries(i.frontmatter))if(!a.has(d)&&!d.startsWith("$"))s[d]=T(m);return s}),n=xb(u);for(let i of n)i.editable=i.kind!=="text"||W(u,i.field);if(e.priorityFields?.length){let i=(s)=>{let d=e.priorityFields.indexOf(s.field);return d===-1?e.priorityFields.length:d};n.sort((s,d)=>i(s)-i(d))}return o=C([l,...c,...n]),o},w=()=>{if(!e.drafts)return!1;let l=e.schema();return Jf(l)||[...t.values()].some((c)=>Jf(l,c.frontmatter))},C=(l)=>{let c=l.findIndex((u)=>u.field===fc);if(c<1||!w())return l;let a=l.filter((u)=>u.field!==fc);return[a[0],l[c],...a.slice(1)]},k=(l,c)=>{let a={[b]:l};for(let u of x()){if(u.field===b)continue;a[u.field]=T(c.frontmatter[u.field])}return{cells:a,fingerprint:c.rawText,key:l}},O=async(l,c,a)=>{let u=p(),n={...c.frontmatter};for(let m of a)if(m.value===null)delete n[m.field];else n[m.field]=m.value;let i=c.document,s={...n,...i,children:i.children??[]},d=await Us(c.formatName,s,{mode:"roundtrip"});Ms(l),await u.writeFile(l,d),t.set(l,{...c,frontmatter:n,rawText:d})};return{backingPaths:()=>new Map([...t.keys()].map((l)=>[l,l])),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return await f(),x()},async commit(l){await f();let c=p(),a={cells:[],deletes:[],inserts:[]},u=new Map;for(let n of l.cells){let i=u.get(n.rowKey)??[];i.push({field:n.field,value:n.value}),u.set(n.rowKey,i)}for(let[n,i]of u){let s=(h,F,R)=>{for(let S of i)a.cells.push({error:F,field:S.field,ok:h,rowKey:n,stale:R})},d=t.get(n);if(!d){s(!1,"Entry no longer loaded — refresh the grid");continue}let m=I(n);if(m?.doc.dirty){s(!1,"Open in a tab with unsaved changes — save or close it first");continue}let y=null;try{y=await c.readFile(n)}catch{y=null}if(y!==d.rawText&&!mc(n)){s(!1,"File changed on disk — refresh to reload",!0);continue}try{if(await O(n,d,i),s(!0),m){let{reloadFileInTab:h}=await (me("kb0epdxf"),import("./files-kb0epdxf.js"));h(n)}}catch(h){s(!1,h instanceof Error?h.message:String(h))}}for(let n of l.inserts){let i=n.cells[b];if(typeof i!=="string"||i.trim()===""){a.inserts.push({error:"Path is required",ok:!1,tempKey:n.tempKey});continue}let s=e.resolveInsertPath(i),d=t.has(s);if(!d)try{await c.readFile(s),d=!0}catch{d=!1}if(d){a.inserts.push({error:`${s} already exists`,ok:!1,tempKey:n.tempKey});continue}let m=e.insertFormatName(s);if(!m){a.inserts.push({error:`No format can serialize ${s}`,ok:!1,tempKey:n.tempKey});continue}try{let y={};for(let[R,S]of Object.entries(n.cells))if(R!==b&&S!==null)y[R]=S;let h=await Us(m,{...y,children:[]},{frontmatter:Object.keys(y).length>0,mode:"roundtrip"});Ms(s),await c.writeFile(s,h);let F=await Er(s,h);t.set(s,{document:F.document,formatName:F.format.name,frontmatter:F.frontmatter??{},rawText:h}),a.inserts.push({newKey:s,ok:!0,tempKey:n.tempKey})}catch(y){a.inserts.push({error:y instanceof Error?y.message:String(y),ok:!1,tempKey:n.tempKey})}}for(let n of l.deletes){if(I(n.rowKey)){a.deletes.push({error:"Open in a tab — close it first",ok:!1,rowKey:n.rowKey});continue}try{Ms(n.rowKey),await c.deleteFile(n.rowKey),t.delete(n.rowKey),a.deletes.push({ok:!0,rowKey:n.rowKey})}catch(i){a.deletes.push({error:i instanceof Error?i.message:String(i),ok:!1,rowKey:n.rowKey})}}return a},id:e.id,label:e.label,async refresh(){await f(!0)},async rows(){await f();let c=(e.drafts?K([...t.entries()],([,a])=>a.frontmatter,G()):[...t.entries()]).map(([a,u])=>k(a,u));return{rows:c,total:c.length}}}}function $1(e){let t=()=>{let r=vb(e);if(!r)throw Error(`No content collection named "${e}" in project.json`);return r};return A({drafts:!0,id:ds({kind:"collection",name:e}),insertFormatName:(r)=>{let o=t();return(o.def.format?wi(o.def.format)?.name:void 0)??Zt(r)?.name??$r()?.name??null},label:e,list:()=>{let r=t();return P(r.dir,[r.ext])},resolveInsertPath:(r)=>{let o=t(),f=r.trim().replace(/^\.\//,"").replace(/^\//,"");if(!f.includes("/"))f=`${o.dir}/${f}`;if(!f.endsWith(o.ext))f=`${f}${o.ext}`;return f},schema:()=>t().def.schema})}function D1(){let e=()=>{let t=Ka("page").filter((r)=>r!==".json");return t.length>0?t:[".md"]};return A({id:ds({kind:"pages"}),insertFormatName:(t)=>Zt(t)?.name??null,label:"Pages",list:()=>P("pages",e()),priorityFields:["title","description"],resolveInsertPath:(t)=>{let r=t.trim().replace(/^\.\//,"").replace(/^\//,"");if(!r.startsWith("pages/"))r=`pages/${r}`;if(!e().some((o)=>r.endsWith(o)))r=`${r}${e()[0]}`;return r},schema:()=>null})}
2
- export{fc,bb,Tu,Jf,BE,vb,Pw,I1,R1,$1,D1};
1
+ import{p}from"./studio-y7jehjrp.js";import{v}from"./studio-fqq890ap.js";import{m}from"./studio-cvbkkfqb.js";import{qt,wi,Zt,Ka,Dr,Us}from"./studio-1x8x26k3.js";import{Ps,mc}from"./studio-9mqfamps.js";import{ds,vb,yb,Ha,Er}from"./studio-skzanb0k.js";import{D}from"./studio-tp642n5g.js";import{me}from"./studio-0bbxhhce.js";var fc="draft",mb="Marked a draft. Studio filters drafts out of its own lists; the build does not exclude them yet.";function Lu(e){return e?.[fc]===!0}function N(e){return e?.properties?.[fc]?.type==="boolean"}function Gf(e,t){return N(e)||Lu(t)}var E=v({includeDrafts:!1});function G(){return E.includeDrafts}function FE(e){E.includeDrafts=e}function K(e,t,r){return r?e:e.filter((o)=>!Lu(t(o)))}var b="__path";function gb(e){let r=(D?.projectConfig?.content??{})[e];if(!r?.source)return null;let o=r.source.replace(/^\.\//,"").replace(/\/$/,""),f=r.format==="json"?".json":wi(r.format)?.extensions[0]??Dr()?.extensions[0]??".json";return{def:r,dir:o,ext:f,name:e}}function Fw(){let e=D?.projectConfig?.content??{};return Object.entries(e).filter(([,t])=>{let r=t.source?.replace(/^\.\//,"")??"";return r!==""&&!/\.[a-z0-9]+$/i.test(r)}).map(([t,r])=>({dir:r.source.replace(/^\.\//,"").replace(/\/$/,""),name:t}))}async function P(e,t){let r=p(),o=[],f=async(x)=>{let w;try{w=await r.listDirectory(x)}catch{return}for(let C of w)if(C.type==="directory")await f(C.path);else if(t.some((k)=>C.path.endsWith(k)))o.push(C.path)};return await f(e),o.toSorted()}async function L1(e){await qt().catch(()=>{});let t=gb(e);if(!t)return[];return(await P(t.dir,[t.ext])).map((o)=>{let f=o.split("/").pop()??o;return f.slice(0,f.length-t.ext.length)})}async function V(e,t,r){let o=Array.from({length:e.length}),f=0,x=Array.from({length:Math.min(t,e.length)},async()=>{while(f<e.length){let w=f;f+=1,o[w]=await r(e[w])}});return await Promise.all(x),o}function T(e){if(e===null||e===void 0)return null;if(typeof e==="string"||typeof e==="number"||typeof e==="boolean")return e;if(Array.isArray(e)&&e.every((t)=>typeof t!=="object"||t===null))return e.map(String);return JSON.stringify(e)}function I(e){for(let t of m.tabs.values())if(t.documentPath===e)return t;return null}function W(e,t){return e.every((r)=>{let o=r[t];return o===null||o===void 0||typeof o!=="string"?!0:!o.startsWith("{")&&!o.startsWith("[")})}var j=new WeakSet;async function I1(){let e=[];for(let t of m.tabs.values()){let r=Ha(t);if(r&&j.has(r.source))e.push(r.load())}await Promise.all(e)}function A(e){let t=M(e);if(e.drafts)j.add(t);return t}function M(e){let t=new Map,r=null,o=null,f=(l=!1)=>{if(!l&&r)return r;return r=(async()=>{await qt().catch(()=>{});let c=p(),a=await e.list();t.clear(),o=null;let u=await V(a,32,async(n)=>{try{let i=await c.readFile(n),s=await Er(n,i);return{document:s.document,formatName:s.format.name,frontmatter:s.frontmatter??{},rawText:i}}catch{return null}});for(let[n,i]of a.entries()){let s=u[n];if(s)t.set(i,s)}})(),r},x=()=>{if(o)return o;let l={editable:!1,field:b,insertOnly:!0,kind:"string",pk:!0,required:!0,title:"Path",widthHint:220},c=vb(e.schema()),a=new Set([b,...c.map((i)=>i.field)]),u=[...t.values()].map((i)=>{let s={};for(let[d,y]of Object.entries(i.frontmatter))if(!a.has(d)&&!d.startsWith("$"))s[d]=T(y);return s}),n=yb(u);for(let i of n)i.editable=i.kind!=="text"||W(u,i.field);if(e.priorityFields?.length){let i=(s)=>{let d=e.priorityFields.indexOf(s.field);return d===-1?e.priorityFields.length:d};n.sort((s,d)=>i(s)-i(d))}return o=C([l,...c,...n]),o},w=()=>{if(!e.drafts)return!1;let l=e.schema();return Gf(l)||[...t.values()].some((c)=>Gf(l,c.frontmatter))},C=(l)=>{let c=l.findIndex((u)=>u.field===fc);if(c<1||!w())return l;let a=l.filter((u)=>u.field!==fc);return[a[0],l[c],...a.slice(1)]},k=(l,c)=>{let a={[b]:l};for(let u of x()){if(u.field===b)continue;a[u.field]=T(c.frontmatter[u.field])}return{cells:a,fingerprint:c.rawText,key:l}},O=async(l,c,a)=>{let u=p(),n={...c.frontmatter};for(let y of a)if(y.value===null)delete n[y.field];else n[y.field]=y.value;let i=c.document,s={...n,...i,children:i.children??[]},d=await Us(c.formatName,s,{mode:"roundtrip"});Ps(l),await u.writeFile(l,d),t.set(l,{...c,frontmatter:n,rawText:d})};return{backingPaths:()=>new Map([...t.keys()].map((l)=>[l,l])),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return await f(),x()},async commit(l){await f();let c=p(),a={cells:[],deletes:[],inserts:[]},u=new Map;for(let n of l.cells){let i=u.get(n.rowKey)??[];i.push({field:n.field,value:n.value}),u.set(n.rowKey,i)}for(let[n,i]of u){let s=(g,F,R)=>{for(let S of i)a.cells.push({error:F,field:S.field,ok:g,rowKey:n,stale:R})},d=t.get(n);if(!d){s(!1,"Entry no longer loaded — refresh the grid");continue}let y=I(n);if(y?.doc.dirty){s(!1,"Open in a tab with unsaved changes — save or close it first");continue}let h=null;try{h=await c.readFile(n)}catch{h=null}if(h!==d.rawText&&!mc(n)){s(!1,"File changed on disk — refresh to reload",!0);continue}try{if(await O(n,d,i),s(!0),y){let{reloadFileInTab:g}=await (me("tznwe1p1"),import("./files-tznwe1p1.js"));g(n)}}catch(g){s(!1,g instanceof Error?g.message:String(g))}}for(let n of l.inserts){let i=n.cells[b];if(typeof i!=="string"||i.trim()===""){a.inserts.push({error:"Path is required",ok:!1,tempKey:n.tempKey});continue}let s=e.resolveInsertPath(i),d=t.has(s);if(!d)try{await c.readFile(s),d=!0}catch{d=!1}if(d){a.inserts.push({error:`${s} already exists`,ok:!1,tempKey:n.tempKey});continue}let y=e.insertFormatName(s);if(!y){a.inserts.push({error:`No format can serialize ${s}`,ok:!1,tempKey:n.tempKey});continue}try{let h={};for(let[R,S]of Object.entries(n.cells))if(R!==b&&S!==null)h[R]=S;let g=await Us(y,{...h,children:[]},{frontmatter:Object.keys(h).length>0,mode:"roundtrip"});Ps(s),await c.writeFile(s,g);let F=await Er(s,g);t.set(s,{document:F.document,formatName:F.format.name,frontmatter:F.frontmatter??{},rawText:g}),a.inserts.push({newKey:s,ok:!0,tempKey:n.tempKey})}catch(h){a.inserts.push({error:h instanceof Error?h.message:String(h),ok:!1,tempKey:n.tempKey})}}for(let n of l.deletes){if(I(n.rowKey)){a.deletes.push({error:"Open in a tab — close it first",ok:!1,rowKey:n.rowKey});continue}try{Ps(n.rowKey),await c.deleteFile(n.rowKey),t.delete(n.rowKey),a.deletes.push({ok:!0,rowKey:n.rowKey})}catch(i){a.deletes.push({error:i instanceof Error?i.message:String(i),ok:!1,rowKey:n.rowKey})}}return a},id:e.id,label:e.label,async refresh(){await f(!0)},async rows(){await f();let c=(e.drafts?K([...t.entries()],([,a])=>a.frontmatter,G()):[...t.entries()]).map(([a,u])=>k(a,u));return{rows:c,total:c.length}}}}function R1(e){let t=()=>{let r=gb(e);if(!r)throw Error(`No content collection named "${e}" in project.json`);return r};return A({drafts:!0,id:ds({kind:"collection",name:e}),insertFormatName:(r)=>{let o=t();return(o.def.format?wi(o.def.format)?.name:void 0)??Zt(r)?.name??Dr()?.name??null},label:e,list:()=>{let r=t();return P(r.dir,[r.ext])},resolveInsertPath:(r)=>{let o=t(),f=r.trim().replace(/^\.\//,"").replace(/^\//,"");if(!f.includes("/"))f=`${o.dir}/${f}`;if(!f.endsWith(o.ext))f=`${f}${o.ext}`;return f},schema:()=>t().def.schema})}function $1(){let e=()=>{let t=Ka("page").filter((r)=>r!==".json");return t.length>0?t:[".md"]};return A({id:ds({kind:"pages"}),insertFormatName:(t)=>Zt(t)?.name??null,label:"Pages",list:()=>P("pages",e()),priorityFields:["title","description"],resolveInsertPath:(t)=>{let r=t.trim().replace(/^\.\//,"").replace(/^\//,"");if(!r.startsWith("pages/"))r=`pages/${r}`;if(!e().some((o)=>r.endsWith(o)))r=`${r}${e()[0]}`;return r},schema:()=>null})}
2
+ export{fc,mb,Lu,Gf,FE,gb,Fw,L1,I1,R1,$1};
3
3
 
4
- //# debugId=381326752288D6F764756E2164756E21
5
- //# sourceMappingURL=studio-4yztve2t.js.map
4
+ //# debugId=6E222DFF80378DB664756E2164756E21
5
+ //# sourceMappingURL=studio-65fhspdd.js.map
@@ -1,5 +1,5 @@
1
- function u(t){let n=t.replaceAll("\\","/");return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function a(t){let n=u(t);return n.startsWith("/")?n:`/${n}`}function p(t,n){return[...t].toSorted((e,s)=>s[n].length-e[n].length)}function f(t,n){return t===n||t.startsWith(`${n}/`)}function $I(t,n){let e=u(n);for(let s of p(t,"dir")){let r=u(s.dir);if(!f(e,r)||e===r)continue;let o=e.slice(r.length+1).split("/").map((l)=>encodeURIComponent(l)).join("/");return`${a(s.urlPrefix)}/${o}`}return null}function g(t,n){let e=n.split("#")[0].split("?")[0];if(!e.startsWith("/"))return null;let s;try{s=decodeURIComponent(e)}catch{return null}if(/%2e|%2f/i.test(s))return null;for(let r of p(t,"urlPrefix")){let i=a(r.urlPrefix);if(!s.startsWith(`${i}/`))continue;let l=s.slice(i.length+1).split("/");if(l.some((c)=>c===""||c==="."||c===".."))return null;return`${u(r.dir)}/${l.join("/")}`}return null}var d=String.raw`"'\s<>()\\`;var Op="public";var DI=["mounts","public"];function Av(t){let n=t.search(/[#?]/);return n===-1?{path:t,suffix:""}:{path:t.slice(0,n),suffix:t.slice(n)}}function LS(t){return t===""||t.startsWith("/")||t.startsWith("#")||t.includes("${")||/^[a-z][\w+.-]*:/i.test(t)}function di(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}function AI(t){let n=di(t),e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function IS(t,n){let s=(t===""||t==="."?[]:di(t).split("/")).filter((r)=>r!==""&&r!==".");for(let r of n.replaceAll("\\","/").split("/")){if(r===""||r===".")continue;if(r===".."){if(s.length===0)return null;s.pop();continue}s.push(r)}return s.join("/")}function h(t,n,e){let{path:s}=Av(t);if(!s.startsWith("/"))return[];let r;try{r=decodeURIComponent(s)}catch{return[]}if(/%2e|%2f/i.test(r))return[];let i=r.replace(/^\/+/,"");if(i===""||i.split("/").some((l)=>l==="."||l===".."))return[];let o=[];for(let l of e){if(l==="mounts"){let c=g(n,s);if(c!==null&&!c.startsWith("/")&&!/^[A-Za-z]:/.test(c))o.push(di(c));continue}o.push(l==="root"?i:`${Op}/${i}`)}return[...new Set(o)]}function NI(t,n,e,s){let{path:r}=Av(t);if(r==="")return null;if(LS(t))return r.startsWith("/")?h(r,e,s)[0]??null:null;if(r.endsWith("/"))return null;let i;try{i=decodeURIComponent(r)}catch{return null}let o=IS(n,i);if(o===null||o===""||o===di(n))return null;return o}function Nv(t){return t.split("/").map((n)=>encodeURIComponent(n)).join("/")}function OI(t){let n=[],e=0;while(e<t.length){while(e<t.length&&(/\s/.test(t[e])||t[e]===","))e+=1;if(e>=t.length)break;let s=e;while(e<t.length&&!/\s/.test(t[e]))e+=1;let r=t.slice(s,e);if(r.endsWith(",")){n.push({descriptor:"",url:r.replace(/,+$/,"")});continue}while(e<t.length&&/\s/.test(t[e]))e+=1;let i=e;while(e<t.length&&t[e]!==",")e+=1;let o=t.slice(i,e).trim();if(e+=1,r=r.replace(/,+$/,""),r!=="")n.push({descriptor:o,url:r})}return n}function MI(t){return t.map(({url:n,descriptor:e})=>e?`${n} ${e}`:n).join(", ")}
2
- export{$I,Op,DI,Av,LS,di,AI,IS,NI,Nv,OI,MI};
1
+ function u(t){let n=t.replaceAll("\\","/");return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function a(t){let n=u(t);return n.startsWith("/")?n:`/${n}`}function p(t,n){return[...t].toSorted((e,s)=>s[n].length-e[n].length)}function f(t,n){return t===n||t.startsWith(`${n}/`)}function SI(t,n){let e=u(n);for(let s of p(t,"dir")){let r=u(s.dir);if(!f(e,r)||e===r)continue;let o=e.slice(r.length+1).split("/").map((l)=>encodeURIComponent(l)).join("/");return`${a(s.urlPrefix)}/${o}`}return null}function g(t,n){let e=n.split("#")[0].split("?")[0];if(!e.startsWith("/"))return null;let s;try{s=decodeURIComponent(e)}catch{return null}if(/%2e|%2f/i.test(s))return null;for(let r of p(t,"urlPrefix")){let i=a(r.urlPrefix);if(!s.startsWith(`${i}/`))continue;let l=s.slice(i.length+1).split("/");if(l.some((c)=>c===""||c==="."||c===".."))return null;return`${u(r.dir)}/${l.join("/")}`}return null}var d=String.raw`"'\s<>()\\`;var Np="public";var EI=["mounts","public"];function Nv(t){let n=t.search(/[#?]/);return n===-1?{path:t,suffix:""}:{path:t.slice(0,n),suffix:t.slice(n)}}function Sk(t){return t===""||t.startsWith("/")||t.startsWith("#")||t.includes("${")||/^[a-z][\w+.-]*:/i.test(t)}function di(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}function TI(t){let n=di(t),e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function Ek(t,n){let s=(t===""||t==="."?[]:di(t).split("/")).filter((r)=>r!==""&&r!==".");for(let r of n.replaceAll("\\","/").split("/")){if(r===""||r===".")continue;if(r===".."){if(s.length===0)return null;s.pop();continue}s.push(r)}return s.join("/")}function h(t,n,e){let{path:s}=Nv(t);if(!s.startsWith("/"))return[];let r;try{r=decodeURIComponent(s)}catch{return[]}if(/%2e|%2f/i.test(r))return[];let i=r.replace(/^\/+/,"");if(i===""||i.split("/").some((l)=>l==="."||l===".."))return[];let o=[];for(let l of e){if(l==="mounts"){let c=g(n,s);if(c!==null&&!c.startsWith("/")&&!/^[A-Za-z]:/.test(c))o.push(di(c));continue}o.push(l==="root"?i:`${Np}/${i}`)}return[...new Set(o)]}function LI(t,n,e,s){let{path:r}=Nv(t);if(r==="")return null;if(Sk(t))return r.startsWith("/")?h(r,e,s)[0]??null:null;if(r.endsWith("/"))return null;let i;try{i=decodeURIComponent(r)}catch{return null}let o=Ek(n,i);if(o===null||o===""||o===di(n))return null;return o}function Ov(t){return t.split("/").map((n)=>encodeURIComponent(n)).join("/")}function II(t){let n=[],e=0;while(e<t.length){while(e<t.length&&(/\s/.test(t[e])||t[e]===","))e+=1;if(e>=t.length)break;let s=e;while(e<t.length&&!/\s/.test(t[e]))e+=1;let r=t.slice(s,e);if(r.endsWith(",")){n.push({descriptor:"",url:r.replace(/,+$/,"")});continue}while(e<t.length&&/\s/.test(t[e]))e+=1;let i=e;while(e<t.length&&t[e]!==",")e+=1;let o=t.slice(i,e).trim();if(e+=1,r=r.replace(/,+$/,""),r!=="")n.push({descriptor:o,url:r})}return n}function RI(t){return t.map(({url:n,descriptor:e})=>e?`${n} ${e}`:n).join(", ")}
2
+ export{SI,Np,EI,Nv,Sk,di,TI,Ek,LI,Ov,II,RI};
3
3
 
4
- //# debugId=872AA5FECDAE894964756E2164756E21
5
- //# sourceMappingURL=studio-b29h7g7s.js.map
4
+ //# debugId=523D6F44C843B17C64756E2164756E21
5
+ //# sourceMappingURL=studio-693nhyky.js.map
@@ -1,5 +1,5 @@
1
- import{re,S}from"./studio-0nm2skex.js";var Je={functionEditor:null,blockActionBarEl:null,selDragCleanup:null,dndCleanups:[],elementsCollapsed:new Set,elementsFilter:"",_currentDropTargetRow:null,layerDragSourceHeight:0,_completionRegistered:!1,_layersCollapsed:null};var m=0;function sI(){return m+=1,m}var l=new Map;function Yi(e){let n=l.get(e);if(!n)n=g(e),l.set(e,n);return n}function g(e){return{centerObserver:null,monacoDiffEditor:null,monacoEditor:null,needsCenter:!0,panX:0,panY:0,panels:[],paneId:e,panzoomWrap:null,stage:null,prevCanvasMode:null,prevStylebookCustomizedOnly:null,prevStylebookFilter:null,renderGeneration:0,sourceCollabCleanup:null,stageScrollbar:null,wrap:null}}function Ju(){return[...l.values()]}function jl(e){if(!e)return null;for(let n of l.values())if(n.wrap?.contains(e))return n;return null}function v(e){for(let n of e.panels)n.renderScope?.stop(),n.renderScope=null;e.panels.length=0,e.prevCanvasMode=null}function aI(e,n){let r=Yi(e);return r.wrap=n,v(r),r}function lI(e){if(l.get(e))rS(e);let r=g(e);return l.set(e,r),r}var b=null;function cI(e){b=e}function rS(e){let n=l.get(e);if(!n)return;b?.(n),v(n),w(e)}function w(e){l.delete(e)}var Yu="commit";function Tm(e){let n=new Map,r=new Map,o=new Map,a=!1,u=!1,c=!1;function f(t,i){if(typeof i?.then!=="function")return i;let s=i.finally(()=>{if(o.get(t)===s)o.delete(t)});return o.set(t,s),s}let d={arm(t,i,s){clearTimeout(n.get(t)),r.set(t,s),n.set(t,setTimeout(()=>{n.delete(t),r.delete(t),f(t,s())},i))},cancel(){for(let t of n.values())clearTimeout(t);n.clear(),r.clear()},flush(t){let i=r.get(t);if(!i)return o.get(t);return clearTimeout(n.get(t)),n.delete(t),r.delete(t),f(t,i())},ahead:()=>a,markAhead(){a=!0},typed:()=>u,markTyped(){a=!0,u=!0},markSettled(){a=!1,u=!1},shared:()=>c,markShared(){c=!0}};return e._writes=d,d}var C={logic:{holds:"The handler you were typing",reached:"written into",source:"Logic"},source:{holds:"The source you were typing",reached:"parsed into",source:"Editor"}};function p(e,n,r){if(e._writes?.typed()!==!0)return!0;let a=e._editingTab??null,u=a?.documentPath??"Untitled",{holds:c,reached:f,source:d}=C[n];return S.warn(`${c} was discarded — it was never ${f} "${u}".`,{...r?{detail:y(r.error)}:{},key:`buffer-discarded:${n}:${a?.id??"none"}`,source:d,...a?.documentPath?{path:a.documentPath}:{}}),!1}function y(e){return e instanceof Error?e.stack??e.message:String(e)}function Lm(e,n){let r=e?._writes;if(!e||!r)return!0;let o;try{o=r.flush(Yu)}catch(a){return r.cancel(),p(e,n,{error:a})}if(r.cancel(),typeof o?.then==="function")return o.then(()=>p(e,n,null),(a)=>p(e,n,{error:a})),!0;return p(e,n,null)}function sS(e){e?._writes?.cancel()}function Ec(e){return Boolean(e?.getModel())}function Zu(e,n){if(!Ec(e)||e.hasTextFocus()||e._writes?.ahead()||e._writes?.shared())return!0;return n!==void 0&&e.getValue()!==n}function h(e){let n=re(e);return[...Ju().map((o)=>o.monacoEditor),Je.functionEditor].filter((o)=>o!=null&&o._editingTab!=null&&re(o._editingTab)===n&&Ec(o))}async function kp(e){for(let n of h(e)){if(!Ec(n))continue;try{await n._writes?.flush(Yu)}catch(r){S.error(`Could not save the editor's contents into "${e.documentPath??"Untitled"}".`,{detail:r instanceof Error?r.stack??r.message:String(r),key:`buffer-commit:${e.id}`,source:"Editor",...e.documentPath?{path:e.documentPath}:{}})}}}function Im(e){return h(e).some((n)=>n._writes?.typed()===!0)}
2
- export{Je,sI,Yi,Ju,jl,aI,lI,cI,rS,Yu,Tm,Lm,sS,Ec,Zu,kp,Im};
1
+ import{re,k}from"./studio-fqq890ap.js";var Je={functionEditor:null,blockActionBarEl:null,selDragCleanup:null,dndCleanups:[],elementsCollapsed:new Set,elementsFilter:"",_currentDropTargetRow:null,layerDragSourceHeight:0,_completionRegistered:!1,_layersCollapsed:null};var m=0;function eI(){return m+=1,m}var l=new Map;function Yi(e){let n=l.get(e);if(!n)n=g(e),l.set(e,n);return n}function g(e){return{centerObserver:null,monacoDiffEditor:null,monacoEditor:null,needsCenter:!0,panX:0,panY:0,panels:[],paneId:e,panzoomWrap:null,stage:null,prevCanvasMode:null,prevStylebookCustomizedOnly:null,prevStylebookFilter:null,renderGeneration:0,sourceCollabCleanup:null,stageScrollbar:null,wrap:null}}function Ju(){return[...l.values()]}function jl(e){if(!e)return null;for(let n of l.values())if(n.wrap?.contains(e))return n;return null}function v(e){for(let n of e.panels)n.renderScope?.stop(),n.renderScope=null;e.panels.length=0,e.prevCanvasMode=null}function tI(e,n){let r=Yi(e);return r.wrap=n,v(r),r}function nI(e){if(l.get(e))nk(e);let r=g(e);return l.set(e,r),r}var S=null;function iI(e){S=e}function nk(e){let n=l.get(e);if(!n)return;S?.(n),v(n),h(e)}function h(e){l.delete(e)}var Yu="commit";function km(e){let n=new Map,r=new Map,o=new Map,a=!1,u=!1,c=!1;function f(t,i){if(typeof i?.then!=="function")return i;let s=i.finally(()=>{if(o.get(t)===s)o.delete(t)});return o.set(t,s),s}let d={arm(t,i,s){clearTimeout(n.get(t)),r.set(t,s),n.set(t,setTimeout(()=>{n.delete(t),r.delete(t),f(t,s())},i))},cancel(){for(let t of n.values())clearTimeout(t);n.clear(),r.clear()},flush(t){let i=r.get(t);if(!i)return o.get(t);return clearTimeout(n.get(t)),n.delete(t),r.delete(t),f(t,i())},ahead:()=>a,markAhead(){a=!0},typed:()=>u,markTyped(){a=!0,u=!0},markSettled(){a=!1,u=!1},shared:()=>c,markShared(){c=!0}};return e._writes=d,d}var w={logic:{holds:"The handler you were typing",reached:"written into",source:"Logic"},source:{holds:"The source you were typing",reached:"parsed into",source:"Editor"}};function p(e,n,r){if(e._writes?.typed()!==!0)return!0;let a=e._editingTab??null,u=a?.documentPath??"Untitled",{holds:c,reached:f,source:d}=w[n];return k.warn(`${c} was discarded — it was never ${f} "${u}".`,{...r?{detail:C(r.error)}:{},key:`buffer-discarded:${n}:${a?.id??"none"}`,source:d,...a?.documentPath?{path:a.documentPath}:{}}),!1}function C(e){return e instanceof Error?e.stack??e.message:String(e)}function Sm(e,n){let r=e?._writes;if(!e||!r)return!0;let o;try{o=r.flush(Yu)}catch(a){return r.cancel(),p(e,n,{error:a})}if(r.cancel(),typeof o?.then==="function")return o.then(()=>p(e,n,null),(a)=>p(e,n,{error:a})),!0;return p(e,n,null)}function ik(e){e?._writes?.cancel()}function Ec(e){return Boolean(e?.getModel())}function Zu(e,n){if(!Ec(e)||e.hasTextFocus()||e._writes?.ahead()||e._writes?.shared())return!0;return n!==void 0&&e.getValue()!==n}function b(e){let n=re(e);return[...Ju().map((o)=>o.monacoEditor),Je.functionEditor].filter((o)=>o!=null&&o._editingTab!=null&&re(o._editingTab)===n&&Ec(o))}async function kp(e){for(let n of b(e)){if(!Ec(n))continue;try{await n._writes?.flush(Yu)}catch(r){k.error(`Could not save the editor's contents into "${e.documentPath??"Untitled"}".`,{detail:r instanceof Error?r.stack??r.message:String(r),key:`buffer-commit:${e.id}`,source:"Editor",...e.documentPath?{path:e.documentPath}:{}})}}}function Em(e){return b(e).some((n)=>n._writes?.typed()===!0)}
2
+ export{Je,eI,Yi,Ju,jl,tI,nI,iI,nk,Yu,km,Sm,ik,Ec,Zu,kp,Em};
3
3
 
4
- //# debugId=E7FC4BC9BEA2AFB164756E2164756E21
5
- //# sourceMappingURL=studio-654fxcr0.js.map
4
+ //# debugId=A7D5719267DE823264756E2164756E21
5
+ //# sourceMappingURL=studio-7pgy3xaf.js.map
@@ -1,5 +1,5 @@
1
- import{di}from"./studio-b29h7g7s.js";import{el}from"./studio-0nm2skex.js";var v=new Set([".apng",".avif",".bmp",".gif",".ico",".jpeg",".jpg",".png",".svg",".webp",".eot",".otf",".ttf",".woff",".woff2",".m4v",".mov",".mp4",".ogv",".webm",".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav"]);function l(e){let o=e.lastIndexOf("/"),t=e.lastIndexOf(".");return t>o+1&&v.has(e.slice(t).toLowerCase())}var i=new Map,a=0,p=0,u=new Map,d=new Map,c=null,m=Object.freeze({}),BC=el(0);function g(){c=null,BC.value+=1}function h(){return a}function y(e,o){let t=u.get(e);if(t!==void 0&&t>o)return!0;for(let[r,n]of d)if(n>o&&e.startsWith(r))return!0;return!1}function x(e,o){if(o<p)return;let t=!1;for(let r of e){if(r.type!=="file")continue;let n=di(r.path);if(n===""||y(n,o))continue;let s=typeof r.version==="string"&&r.version!==""?r.version:null,f=i.get(n);if(s===null){if(f===void 0)continue;i.delete(n)}else if(f===s)continue;else i.set(n,s);if(l(n))t=!0}if(t)g()}async function Ir(e){let o=h(),t=await e();return x(t,o),t}function ym(e,o=[]){a+=1;let t=!1;for(let r of e){let n=di(r);if(n==="")continue;if(u.set(n,a),i.delete(n)&&l(n))t=!0}for(let r of o){let n=di(r);if(n==="")continue;let s=`${n}/`;d.set(s,a);for(let f of i.keys())if(f.startsWith(s)){if(i.delete(f),l(f))t=!0}}if(t)g()}function CL(e){return i.get(di(e))}function Rd(){if(c)return c;let e={},o=!1;for(let[t,r]of i)if(l(t))e[t]=r,o=!0;return c=o?Object.freeze(e):m,c}function zC(){let e=Rd()!==m;if(i.clear(),u.clear(),d.clear(),a+=1,p=a,e)g()}function pp(){zC()}
2
- export{BC,Ir,ym,CL,Rd,zC,pp};
1
+ import{di}from"./studio-693nhyky.js";import{el}from"./studio-fqq890ap.js";var v=new Set([".apng",".avif",".bmp",".gif",".ico",".jpeg",".jpg",".png",".svg",".webp",".eot",".otf",".ttf",".woff",".woff2",".m4v",".mov",".mp4",".ogv",".webm",".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav"]);function l(e){let o=e.lastIndexOf("/"),t=e.lastIndexOf(".");return t>o+1&&v.has(e.slice(t).toLowerCase())}var i=new Map,a=0,p=0,u=new Map,d=new Map,c=null,m=Object.freeze({}),jC=el(0);function g(){c=null,jC.value+=1}function h(){return a}function y(e,o){let t=u.get(e);if(t!==void 0&&t>o)return!0;for(let[r,n]of d)if(n>o&&e.startsWith(r))return!0;return!1}function x(e,o){if(o<p)return;let t=!1;for(let r of e){if(r.type!=="file")continue;let n=di(r.path);if(n===""||y(n,o))continue;let s=typeof r.version==="string"&&r.version!==""?r.version:null,f=i.get(n);if(s===null){if(f===void 0)continue;i.delete(n)}else if(f===s)continue;else i.set(n,s);if(l(n))t=!0}if(t)g()}async function Ir(e){let o=h(),t=await e();return x(t,o),t}function gm(e,o=[]){a+=1;let t=!1;for(let r of e){let n=di(r);if(n==="")continue;if(u.set(n,a),i.delete(n)&&l(n))t=!0}for(let r of o){let n=di(r);if(n==="")continue;let s=`${n}/`;d.set(s,a);for(let f of i.keys())if(f.startsWith(s)){if(i.delete(f),l(f))t=!0}}if(t)g()}function mL(e){return i.get(di(e))}function Rd(){if(c)return c;let e={},o=!1;for(let[t,r]of i)if(l(t))e[t]=r,o=!0;return c=o?Object.freeze(e):m,c}function HC(){let e=Rd()!==m;if(i.clear(),u.clear(),d.clear(),a+=1,p=a,e)g()}function pp(){HC()}
2
+ export{jC,Ir,gm,mL,Rd,HC,pp};
3
3
 
4
- //# debugId=0CF6437E921DA7F764756E2164756E21
5
- //# sourceMappingURL=studio-k9pwvmz8.js.map
4
+ //# debugId=C982F455C380AF8564756E2164756E21
5
+ //# sourceMappingURL=studio-888knnkc.js.map
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-6k1eswp9.js";import{ua}from"./studio-81twpmzj.js";import{Ir,ym,zC}from"./studio-k9pwvmz8.js";import{Cm,g}from"./studio-27tc8q0h.js";import{D}from"./studio-153mwkyq.js";var P=/[.*+?^${}()|[\]\\]/;function R(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+=R(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+=R(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 f=s===o.length-1;if(W(e,i,f?n:!0))return!0}return!1}var d=new Map,y=new Map;function Ru(){d.clear(),y.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=d.get(e);if(t!==void 0)return Promise.resolve(t);let n=y.get(e);if(n)return n;let r=w(e).then((o)=>(d.set(e,o),y.delete(e),o));return y.set(e,r),r}async function v(){let e=[...d.keys()];y.clear();let t=await Promise.all(e.map((n)=>w(n)));d.clear();for(let[n,r]of e.entries())d.set(r,t[n]??null)}async function ZE(e){await Promise.all(x(e).map((t)=>_(t)))}function A(e){let t=[];for(let n of x(e)){let r=d.get(n);if(r)t.push(r)}return t}function XE(e,t,n){return N(A(e),t,n)}function C(e){return e.some((t)=>b(t).split("/").pop()===".gitignore")}var U=1500,S={commit:0,open:1,reconnect:2},G=250,V=8,E=new Map,I=(e)=>e.replaceAll("\\","/");function Ms(...e){ym(e,e);let t=Date.now()+U;for(let n of e)if(n)E.set(I(n),t)}function mc(e){let t=I(e),n=E.get(t);if(n===void 0)return!1;if(Date.now()>n)return E.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((f)=>f.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 f=[];for(let c of t)if(c===o.path||c.startsWith(`${o.path}/`))f.push(c);for(let c of f)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)ym(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 f=e.get(s);if(!f)return;let c=[...f],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","manage"]);function Q(e){return e.some((t)=>J.has(t))||e.length>0&&e.every((t)=>t==="git-diff")}function X(){let e=new Set;for(let t of g.tabs.values()){let n=t.documentPath;if(n&&!t.doc.dirty&&!Cm(n)&&!Q(t.capabilities.modes))e.add(n)}return[...e]}function P1(e){let t=p();if(!t.subscribeFileEvents)return()=>{};let n=[],r=null,o=null,i=null,s=()=>{r=null;let l=D,u=n.filter((h)=>!mc(h.path));if(n=[],!l||u.length===0)return;let m=B(l.dirs,l.expanded,u);if(e.onContentChange){for(let h of u)if(h.type==="change")e.onContentChange(h.path)}if(m.size>0)e.renderLeftPanel()},a=async()=>{i=null;let l=o;o=null;let u=D;if(!u||!l)return;let m=H(u.dirs,(h)=>Ir(()=>t.listDirectory(h)));if(l==="reconnect")ua(),e.invalidateDerivedCaches?.(),await Promise.all([m,v()]);else await m;if(D!==u)return;if(l==="reconnect")e.onResyncContent?.(X());e.renderLeftPanel()},f=(l)=>{if(l!=="commit")zC();if(!o||S[l]>S[o])o=l;if(i)clearTimeout(i);i=setTimeout(()=>{a()},G)},c=t.subscribeFileEvents((l)=>{if(ua(),e.invalidateDerivedCaches?.(),j(l),C(l.map((u)=>u.path)))v().then(()=>e.renderLeftPanel());if(n.push(...l),r)clearTimeout(r);r=setTimeout(s,50)},{onResync:f});return()=>{if(i)clearTimeout(i),i=null;c()}}
2
- export{Ru,ZE,XE,Ms,mc,P1};
1
+ import{p}from"./studio-y7jehjrp.js";import{ua}from"./studio-yr04mv2j.js";import{Ir,gm,HC}from"./studio-888knnkc.js";import{wm,m}from"./studio-cvbkkfqb.js";import{D}from"./studio-tp642n5g.js";var P=/[.*+?^${}()|[\]\\]/;function R(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+=R(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+=R(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 f=s===o.length-1;if(W(e,i,f?n:!0))return!0}return!1}var g=new Map,h=new Map;function $u(){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 v(){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 WE(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 VE(e,t,n){return N(A(e),t,n)}function C(e){return e.some((t)=>b(t).split("/").pop()===".gitignore")}var U=1500,S={commit:0,open:1,reconnect:2},G=250,V=8,E=new Map,I=(e)=>e.replaceAll("\\","/");function Ps(...e){gm(e,e);let t=Date.now()+U;for(let n of e)if(n)E.set(I(n),t)}function mc(e){let t=I(e),n=E.get(t);if(n===void 0)return!1;if(Date.now()>n)return E.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((f)=>f.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 f=[];for(let c of t)if(c===o.path||c.startsWith(`${o.path}/`))f.push(c);for(let c of f)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)gm(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 f=e.get(s);if(!f)return;let c=[...f],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","manage"]);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&&!wm(n)&&!Q(t.capabilities.modes))e.add(n)}return[...e]}function O1(e){let t=p();if(!t.subscribeFileEvents)return()=>{};let n=[],r=null,o=null,i=null,s=()=>{r=null;let l=D,u=n.filter((d)=>!mc(d.path));if(n=[],!l||u.length===0)return;let y=B(l.dirs,l.expanded,u);if(e.onContentChange){for(let d of u)if(d.type==="change")e.onContentChange(d.path)}if(y.size>0)e.renderLeftPanel()},a=async()=>{i=null;let l=o;o=null;let u=D;if(!u||!l)return;let y=H(u.dirs,(d)=>Ir(()=>t.listDirectory(d)));if(l==="reconnect")ua(),e.invalidateDerivedCaches?.(),await Promise.all([y,v()]);else await y;if(D!==u)return;if(l==="reconnect")e.onResyncContent?.(X());e.renderLeftPanel()},f=(l)=>{if(l!=="commit")HC();if(!o||S[l]>S[o])o=l;if(i)clearTimeout(i);i=setTimeout(()=>{a()},G)},c=t.subscribeFileEvents((l)=>{if(ua(),e.invalidateDerivedCaches?.(),j(l),C(l.map((u)=>u.path)))v().then(()=>e.renderLeftPanel());if(n.push(...l),r)clearTimeout(r);r=setTimeout(s,50)},{onResync:f});return()=>{if(i)clearTimeout(i),i=null;c()}}
2
+ export{$u,WE,VE,Ps,mc,O1};
3
3
 
4
- //# debugId=F1582A290C6B656C64756E2164756E21
5
- //# sourceMappingURL=studio-b5rxwkj2.js.map
4
+ //# debugId=18E416EAF76F387B64756E2164756E21
5
+ //# sourceMappingURL=studio-9mqfamps.js.map
@@ -1,5 +1,5 @@
1
- import{p,We}from"./studio-6k1eswp9.js";import{$I,DI,Av,LS,AI,IS,NI,Nv}from"./studio-b29h7g7s.js";import{Rd}from"./studio-k9pwvmz8.js";import{Do,u}from"./studio-27tc8q0h.js";import{D}from"./studio-153mwkyq.js";function gm(){let t=We()?p().canvasUrl:void 0;if(t)return new URL(t,location.href).origin;return location.origin}function hp(t){let n=gm(),e=We()?p().documentBaseUrl:void 0;if(e){let s=e.endsWith("/")?e:`${e}/`;return new URL(s,`${n}/`).href}let r=t||"";return`${n}/${r?`${r}/`:""}`}function Sx(t){if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http")||t.startsWith("views://"))return t;let n=gm();if((n.startsWith("http:")||n.startsWith("https:"))&&n!==location.origin)return`${n}/${t.replace(/^\.?\//,"")}`;return t}var a=/^[\w.~-]+$/,g="content",d="{locale}";function jC(t,n){if(typeof n!=="string"||n==="")return t;let e=t.indexOf("#"),r=e===-1?"":t.slice(e),s=e===-1?t:t.slice(0,e),o=s.indexOf("?"),i=o===-1?s:s.slice(0,o),c=(o===-1?[]:s.slice(o+1).split("&")).filter((f)=>f!==""&&!A(f));return c.push(`v=${encodeURIComponent(n)}`),`${i}?${c.join("&")}${r}`}function A(t){let n=t.indexOf("="),e=n===-1?t:t.slice(0,n);if(e==="v")return!0;if(!e.includes("%"))return!1;try{return decodeURIComponent(e)==="v"}catch{return!1}}function x(t,n){if(!t||!Object.hasOwn(t,n))return;let e=t[n];return typeof e==="string"?e:void 0}function iv(t,n,e=[]){if(!t||!n)return null;let r=t.replaceAll("\\","/").replace(/^\.\//,""),s=null,o=(i,l)=>{if(r.startsWith(`${i}/`)&&(!s||i.length>s.dir.length))s={dir:i,urlPrefix:l}};for(let[i,l]of Object.entries(n)){if(!l?.source||!a.test(i))continue;let c=R(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(d)){let f=y(r,c,i,e);if(f)o(f.dir,f.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;o(c,`/${g}/${i}`)}return s}function y(t,n,e,r){let s=n.indexOf(d),o=n.slice(0,s),i=n.slice(s+d.length);if(!t.startsWith(o))return null;let l=t.slice(o.length).split("/")[0]??"";if(l===""||!a.test(l))return null;let c=r.find((h)=>h.toLowerCase()===l.toLowerCase());if(c===void 0||!a.test(c))return null;return{dir:`${o}${l}${i}`.replace(/\/+$/,""),urlPrefix:`/${g}/${e}/${c}`}}function R(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function ov(t,n){if(!n||t==="")return null;if(n.space==="repo"){if(!n.fileBaseUrl)return null;let r=NI(t,n.documentDir,n.mounts,n.lanes);if(r===null)return null;let{suffix:s}=Av(t);return jC(`${n.fileBaseUrl}${Nv(r)}${s}`,x(n.versions,r))}let[e]=n.mounts;return e?m(t,n.documentDir,e):null}function m(t,n,e){if(LS(t))return null;let{path:r,suffix:s}=Av(t),o;try{o=decodeURIComponent(r)}catch{return null}let i=IS(n,o);if(i===null)return null;let l=$I([e],i);if(!l)return null;return`${l}${s}`}function HC(){return Do(D?.projectConfig??{}).i18n?.locales??[]}function bm(t,n){let e=n?.space??"site",r=iv(t,D?.projectConfig?.content,HC());if(e==="site"&&!r)return null;return{documentDir:AI(t??""),...n?.fileBaseUrl===void 0?{}:{fileBaseUrl:n.fileBaseUrl},lanes:DI,mounts:r?[r]:[],space:e}}function Cc(t){if(!t)return t;let n=bm(u.value?.documentPath,vm()),e=n&&{...n,versions:Rd()};return Sx(ov(t,e)??t)}function vm(){return{fileBaseUrl:hp(D?.projectRoot),...We()?{space:p().assetSpace}:{}}}
2
- export{jC,iv,ov,gm,hp,Sx,HC,bm,Cc,vm};
1
+ import{p,We}from"./studio-y7jehjrp.js";import{SI,EI,Nv,Sk,TI,Ek,LI,Ov}from"./studio-693nhyky.js";import{Rd}from"./studio-888knnkc.js";import{$o,u}from"./studio-cvbkkfqb.js";import{D}from"./studio-tp642n5g.js";function pm(){let t=We()?p().canvasUrl:void 0;if(t)return new URL(t,location.href).origin;return location.origin}function hp(t){let n=pm(),e=We()?p().documentBaseUrl:void 0;if(e){let s=e.endsWith("/")?e:`${e}/`;return new URL(s,`${n}/`).href}let r=t||"";return`${n}/${r?`${r}/`:""}`}function kx(t){if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http")||t.startsWith("views://"))return t;let n=pm();if((n.startsWith("http:")||n.startsWith("https:"))&&n!==location.origin)return`${n}/${t.replace(/^\.?\//,"")}`;return t}var a=/^[\w.~-]+$/,g="content",d="{locale}";function PC(t,n){if(typeof n!=="string"||n==="")return t;let e=t.indexOf("#"),r=e===-1?"":t.slice(e),s=e===-1?t:t.slice(0,e),o=s.indexOf("?"),i=o===-1?s:s.slice(0,o),c=(o===-1?[]:s.slice(o+1).split("&")).filter((f)=>f!==""&&!A(f));return c.push(`v=${encodeURIComponent(n)}`),`${i}?${c.join("&")}${r}`}function A(t){let n=t.indexOf("="),e=n===-1?t:t.slice(0,n);if(e==="v")return!0;if(!e.includes("%"))return!1;try{return decodeURIComponent(e)==="v"}catch{return!1}}function x(t,n){if(!t||!Object.hasOwn(t,n))return;let e=t[n];return typeof e==="string"?e:void 0}function tv(t,n,e=[]){if(!t||!n)return null;let r=t.replaceAll("\\","/").replace(/^\.\//,""),s=null,o=(i,l)=>{if(r.startsWith(`${i}/`)&&(!s||i.length>s.dir.length))s={dir:i,urlPrefix:l}};for(let[i,l]of Object.entries(n)){if(!l?.source||!a.test(i))continue;let c=R(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(d)){let f=y(r,c,i,e);if(f)o(f.dir,f.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;o(c,`/${g}/${i}`)}return s}function y(t,n,e,r){let s=n.indexOf(d),o=n.slice(0,s),i=n.slice(s+d.length);if(!t.startsWith(o))return null;let l=t.slice(o.length).split("/")[0]??"";if(l===""||!a.test(l))return null;let c=r.find((h)=>h.toLowerCase()===l.toLowerCase());if(c===void 0||!a.test(c))return null;return{dir:`${o}${l}${i}`.replace(/\/+$/,""),urlPrefix:`/${g}/${e}/${c}`}}function R(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function nv(t,n){if(!n||t==="")return null;if(n.space==="repo"){if(!n.fileBaseUrl)return null;let r=LI(t,n.documentDir,n.mounts,n.lanes);if(r===null)return null;let{suffix:s}=Nv(t);return PC(`${n.fileBaseUrl}${Ov(r)}${s}`,x(n.versions,r))}let[e]=n.mounts;return e?m(t,n.documentDir,e):null}function m(t,n,e){if(Sk(t))return null;let{path:r,suffix:s}=Nv(t),o;try{o=decodeURIComponent(r)}catch{return null}let i=Ek(n,o);if(i===null)return null;let l=SI([e],i);if(!l)return null;return`${l}${s}`}function FC(){return $o(D?.projectConfig??{}).i18n?.locales??[]}function fm(t,n){let e=n?.space??"site",r=tv(t,D?.projectConfig?.content,FC());if(e==="site"&&!r)return null;return{documentDir:TI(t??""),...n?.fileBaseUrl===void 0?{}:{fileBaseUrl:n.fileBaseUrl},lanes:EI,mounts:r?[r]:[],space:e}}function Cc(t){if(!t)return t;let n=fm(u.value?.documentPath,mm()),e=n&&{...n,versions:Rd()};return kx(nv(t,e)??t)}function mm(){return{fileBaseUrl:hp(D?.projectRoot),...We()?{space:p().assetSpace}:{}}}
2
+ export{PC,tv,nv,pm,hp,kx,FC,fm,Cc,mm};
3
3
 
4
- //# debugId=85A7805083290D9E64756E2164756E21
5
- //# sourceMappingURL=studio-011em5cf.js.map
4
+ //# debugId=3B2A8E3149E8288464756E2164756E21
5
+ //# sourceMappingURL=studio-a7xqhc3n.js.map
@@ -1,5 +1,5 @@
1
- function Yy(o){if(o===null||typeof o!=="object")return{offer:[],refused:null};let e=o;if(e.collab===!1){let t=typeof e.detail==="string"?e.detail.trim():"";return{offer:[],refused:t||"This server has collaboration disabled."}}let{protocols:r}=e;if(!Array.isArray(r)||r.length===0)return{offer:[],refused:null};if(r.includes("jx.collab.v1"))return{offer:["jx.collab.v1"],refused:null};let n=r.filter((t)=>typeof t==="string").join(", ")||"none";return{offer:[],refused:`This server speaks collab envelope ${n}; this editor speaks jx.collab.v1.`}}
2
- export{Yy};
1
+ function Zy(o){if(o===null||typeof o!=="object")return{offer:[],refused:null};let e=o;if(e.collab===!1){let t=typeof e.detail==="string"?e.detail.trim():"";return{offer:[],refused:t||"This server has collaboration disabled."}}let{protocols:r}=e;if(!Array.isArray(r)||r.length===0)return{offer:[],refused:null};if(r.includes("jx.collab.v1"))return{offer:["jx.collab.v1"],refused:null};let n=r.filter((t)=>typeof t==="string").join(", ")||"none";return{offer:[],refused:`This server speaks collab envelope ${n}; this editor speaks jx.collab.v1.`}}
2
+ export{Zy};
3
3
 
4
- //# debugId=18695B73664343DB64756E2164756E21
5
- //# sourceMappingURL=studio-mf41717j.js.map
4
+ //# debugId=9E2F4DC69B554C8964756E2164756E21
5
+ //# sourceMappingURL=studio-aje966s9.js.map
@@ -0,0 +1,5 @@
1
+ var e=new Set;function mE(r){return e.add(r),()=>e.delete(r)}function gE(){let r=[];for(let t of e)try{let o=t();if(o)r.push(o)}catch{}return r}
2
+ export{mE,gE};
3
+
4
+ //# debugId=A7899C52ECFB612864756E2164756E21
5
+ //# sourceMappingURL=studio-aqmph6k4.js.map
@@ -0,0 +1,5 @@
1
+ import{te}from"./studio-ery42sqr.js";import{p,We}from"./studio-y7jehjrp.js";import{k}from"./studio-fqq890ap.js";import{u}from"./studio-cvbkkfqb.js";import{Np,di,Ov}from"./studio-693nhyky.js";import{Ir,gm,mL}from"./studio-888knnkc.js";import{PC,tv,kx,FC,mm}from"./studio-a7xqhc3n.js";import{D}from"./studio-tp642n5g.js";var Al=new Set([".jpg",".jpeg",".png",".gif",".svg",".webp",".avif",".ico"]),Ld=new Set([...Al,".mp4",".webm",".mp3",".wav",".ogg",".pdf",".woff",".woff2",".ttf",".otf"]);function m(e){let t=["B","KB","MB","GB"],n=e,r=0;while(n>=1024&&r<t.length-1)n/=1024,r+=1;return`${r===0?n:Number(n.toFixed(1))} ${t[r]}`}var h=["image/*","video/*","audio/*",".pdf",".svg",".woff",".woff2",".ttf",".otf"].join(",");function _c(){return(We()?p().assetCapabilities?.accept:void 0)??h}function Gi(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function ev(e){return Al.has(e.startsWith(".")?e.toLowerCase():`.${e.toLowerCase()}`)}function hm(e){return Ld.has(Gi(e))}var x=new Set([".mp4",".webm",".mov",".m4v"]),w=new Set([".mp3",".wav",".ogg",".m4a",".flac"]);function up(e){let t=e.type??"";if(t.startsWith("image/"))return"image";if(t.startsWith("video/"))return"video";if(t.startsWith("audio/"))return"audio";let n=Gi(e.name);if(Al.has(n))return"image";if(x.has(n))return"video";if(w.has(n))return"audio";return"file"}var S=/^content\/([^/]+)\//;function v(e){let t=e?S.exec(e.replaceAll("\\","/")):null;return t?`content/${t[1]}/images`:"public"}function A(e){let t=e.replaceAll("\\","/");if(t.startsWith("public/"))return t.slice(6);let n=/^content\/[^/]+\/(.+)$/.exec(t);if(n)return`./${n[1]}`;return`./${t}`}function b(e,t){if(!t.has(e))return e;let n=Gi(e),r=n?e.slice(0,-n.length):e;for(let i=1;;i++){let s=`${r}-${i}${n}`;if(!t.has(s))return s}}function y(e,t){let n=e.replaceAll("\\","/").replace(/\/+$/,"");return n==="."||n===""?t:`${n}/${t}`}var g=null;function hL(e){g=e}async function Va(e,t={}){let n=[...e];if(n.length===0)return[];let r=p(),i=t.dir??v(u.value?.documentPath??null),s;try{let o=await Ir(()=>r.listDirectory(i));s=new Set(o.map((c)=>c.name))}catch{s=new Set}let f=We()?p().assetCapabilities?.maxUploadBytes:void 0,a=[];for(let o of n){if(f!==void 0&&o.size>f){k.error(`${o.name} is too large.`,{detail:`This backend accepts at most ${m(f)}; that file is ${m(o.size)}.`,source:"Media"});continue}let c=b(o.name,s);s.add(c);let d=y(i,c);try{let{path:l}=await r.uploadFile(d,o);gm([l]),a.push({kind:up(o),name:c,path:l,ref:A(l)})}catch(l){k.error(`Could not upload ${o.name}.`,{detail:te(l),path:d,source:"Media"})}}if(a.length>0)k.success(a.length===1?`Uploaded ${a[0].name} to ${i}/`:`Uploaded ${a.length} files to ${i}/`),await g?.(i);return a}function pL(e){let t=di(e),n=t.lastIndexOf("/");return n===-1?t:t.slice(n+1)}function fL(e){let t=di(e),n=t.lastIndexOf("/");return n===-1?".":t.slice(0,n)}function E(){return D?.projectConfig?.content??null}function C(e){return tv(e,E(),FC())}function I(e,t){return`${di(t.urlPrefix)}/${e.slice(t.dir.length+1)}`}function Id(e){let t=di(e);if(t.startsWith(`${Np}/`))return`/${t.slice(Np.length+1)}`;let n=C(t);return n?`/${I(t,n)}`:`/${t}`}function Bu(e){let t=di(e);if(t==="")return e;let{space:n,fileBaseUrl:r}=mm();if(n==="repo")return PC(`${r}${Ov(t)}`,mL(t));return kx(Id(t))}
2
+ export{Al,Ld,_c,Gi,ev,hm,up,hL,Va,pL,fL,Id,Bu};
3
+
4
+ //# debugId=2310F1E15B711CFB64756E2164756E21
5
+ //# sourceMappingURL=studio-c6w3tq7t.js.map