@jxsuite/studio 10.0.0 → 10.1.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 (162) hide show
  1. package/dist/chunks/{2020-j56903f1.js → 2020-mkb0qa6p.js} +2 -2
  2. package/dist/chunks/adapter-xcpsmecx.js +4 -0
  3. package/dist/chunks/{add-new-flow-snx1s4b0.js → add-new-flow-ptmhmzr9.js} +3 -3
  4. package/dist/chunks/{cf-account-picker-xyqw0jex.js → cf-account-picker-z1sgwpwd.js} +3 -3
  5. package/dist/chunks/cf-settings-xqvhxxe9.js +4 -0
  6. package/dist/chunks/components-whsc81a7.js +4 -0
  7. package/dist/chunks/content-source-jwtxg78w.js +4 -0
  8. package/dist/chunks/{convert-to-repeater-fhdwyg14.js → convert-to-repeater-f92ey3kp.js} +3 -3
  9. package/dist/chunks/editor-zdqdpq1x.js +4 -0
  10. package/dist/chunks/entry-commands-w8p2fbpt.js +4 -0
  11. package/dist/chunks/{extension-sections-8ez2rrk8.js → extension-sections-y2p1te2r.js} +3 -3
  12. package/dist/chunks/file-ops-13ab4swj.js +4 -0
  13. package/dist/chunks/files-zbc8p6v1.js +4 -0
  14. package/dist/chunks/{format-host-zfjz4rzm.js → format-host-zjsbktbx.js} +3 -3
  15. package/dist/chunks/fs-events-t6x0hch6.js +4 -0
  16. package/dist/chunks/grid-open-fyzdwpkh.js +4 -0
  17. package/dist/chunks/{grid-view-ka55z38f.js → grid-view-r22jsqht.js} +5 -5
  18. package/dist/chunks/{iframe-host-na2mywz4.js → iframe-host-kbyqc7pt.js} +3 -3
  19. package/dist/chunks/index-6nvj89vb.js +4 -0
  20. package/dist/chunks/{index-qb98xhse.js → index-pxwwf00y.js} +2 -2
  21. package/dist/chunks/{javascript-ces13wny.js → javascript-pzqryby6.js} +2 -2
  22. package/dist/chunks/{jsonMode-6md16d4v.js → jsonMode-tcnyxyap.js} +5 -5
  23. package/dist/chunks/jx-validate-5sp8a4rm.js +4 -0
  24. package/dist/chunks/layers-panel-qrxj9vr2.js +4 -0
  25. package/dist/chunks/layers-tpzayggx.js +4 -0
  26. package/dist/chunks/lit-html-x6nrxsx3.js +4 -0
  27. package/dist/chunks/media-library-ywppnjrz.js +4 -0
  28. package/dist/chunks/media-picker-etxgc8qq.js +4 -0
  29. package/dist/chunks/{monaco-binding-p8j80s4w.js → monaco-binding-bqpge64f.js} +2 -2
  30. package/dist/chunks/monaco-buffer-qrnqhk0b.js +4 -0
  31. package/dist/chunks/{monaco-setup-wasktzfg.js → monaco-setup-1mkab762.js} +3 -3
  32. package/dist/chunks/notify-kcv38wwe.js +4 -0
  33. package/dist/chunks/parse-df2kkmhc.js +4 -0
  34. package/dist/chunks/{platform-c16mqvmp.js → platform-dtsysmyd.js} +2 -2
  35. package/dist/chunks/publish-panel-evb1rcxt.js +4 -0
  36. package/dist/chunks/{publish-quick-vr695j26.js → publish-quick-m9vkhahq.js} +3 -3
  37. package/dist/chunks/publish-workspace-ktk9h536.js +4 -0
  38. package/dist/chunks/quick-search-2f47fxcw.js +4 -0
  39. package/dist/chunks/references-5w6ajjv7.js +4 -0
  40. package/dist/chunks/right-panel-kz0a6byf.js +4 -0
  41. package/dist/chunks/source-control-1phx90zk.js +4 -0
  42. package/dist/chunks/{studio-h5tpz5ke.js → studio-07k0geap.js} +4 -4
  43. package/dist/chunks/{studio-7xag4na8.js → studio-0g2sm01j.js} +4 -4
  44. package/dist/chunks/{studio-de1s2x9v.js → studio-0hr000ba.js} +4 -4
  45. package/dist/chunks/{studio-35vrtpdq.js → studio-1wyp7dt5.js} +4 -4
  46. package/dist/chunks/{studio-34jrz12k.js → studio-20ap8dds.js} +4 -4
  47. package/dist/chunks/{studio-d83m0wyq.js → studio-291gqh98.js} +3 -3
  48. package/dist/chunks/{studio-xdpz9rpe.js → studio-37twdaf7.js} +29 -29
  49. package/dist/chunks/{studio-ry81j4q1.js → studio-4nkm4404.js} +4 -4
  50. package/dist/chunks/{studio-3v5cagy9.js → studio-4smcnv33.js} +3 -3
  51. package/dist/chunks/{studio-k3a8rp3d.js → studio-4zqfw5ha.js} +2 -2
  52. package/dist/chunks/{studio-d038kqbs.js → studio-56egy6vf.js} +4 -4
  53. package/dist/chunks/{studio-x3mjr5cc.js → studio-5dmgmyw4.js} +4 -4
  54. package/dist/chunks/{studio-x97ay0v4.js → studio-5e7p1vgd.js} +3 -3
  55. package/dist/chunks/{studio-ndskgqef.js → studio-5m0w815d.js} +3 -3
  56. package/dist/chunks/{studio-pqqq6v85.js → studio-695k95bw.js} +4 -4
  57. package/dist/chunks/{studio-gwrhcrss.js → studio-6vwvshw8.js} +2 -2
  58. package/dist/chunks/{studio-pgm83a2f.js → studio-76t560kn.js} +4 -4
  59. package/dist/chunks/{studio-396srjbk.js → studio-7823f0g8.js} +3 -3
  60. package/dist/chunks/{studio-r17asgs0.js → studio-7vb997ff.js} +4 -4
  61. package/dist/chunks/{studio-et2q4s8n.js → studio-8486jn4r.js} +3 -3
  62. package/dist/chunks/{studio-3w35qvay.js → studio-848rk4p1.js} +4 -4
  63. package/dist/chunks/{studio-5tzgq6fx.js → studio-8jb31dcf.js} +4 -4
  64. package/dist/chunks/{studio-y26hx9re.js → studio-8qejv8yf.js} +4 -4
  65. package/dist/chunks/{studio-h7weqf2q.js → studio-8x8616xd.js} +4 -4
  66. package/dist/chunks/{studio-hcsba201.js → studio-9cp96v90.js} +2 -2
  67. package/dist/chunks/{studio-dx73md4n.js → studio-9rcbvksg.js} +6 -6
  68. package/dist/chunks/{studio-m48v13s3.js → studio-a3s6frde.js} +3 -3
  69. package/dist/chunks/{studio-4kzbrr5t.js → studio-ahf3cspq.js} +3 -3
  70. package/dist/chunks/{studio-zgx7svjd.js → studio-bkmv1h3e.js} +5 -5
  71. package/dist/chunks/{studio-3c8pp7pb.js → studio-brdp85q7.js} +4 -4
  72. package/dist/chunks/{studio-yg3djpnm.js → studio-cgb97rwv.js} +4 -4
  73. package/dist/chunks/{studio-tj2s0tks.js → studio-ch8gt8vt.js} +3 -3
  74. package/dist/chunks/{studio-p1n2xjda.js → studio-cqf1k4qk.js} +4 -4
  75. package/dist/chunks/{studio-jttyqrmh.js → studio-cvz0e00f.js} +4 -4
  76. package/dist/chunks/{studio-5wzdy1jc.js → studio-dbgv4fv9.js} +14 -14
  77. package/dist/chunks/{studio-h310mbqm.js → studio-dy2xtt7a.js} +4 -4
  78. package/dist/chunks/{studio-xkxetm65.js → studio-eesyjg7h.js} +5 -5
  79. package/dist/chunks/studio-et6t8g4m.js +4 -0
  80. package/dist/chunks/{studio-cpkamjdn.js → studio-f2j9et3h.js} +8 -8
  81. package/dist/chunks/{studio-epenqmvk.js → studio-fep7hr66.js} +4 -4
  82. package/dist/chunks/{studio-2ks6ka4g.js → studio-fyf7j57j.js} +3 -3
  83. package/dist/chunks/{studio-rzg8hnkf.js → studio-g5prntab.js} +4 -4
  84. package/dist/chunks/{studio-c1pxszat.js → studio-ga77mf07.js} +4 -4
  85. package/dist/chunks/{studio-9cxmp61c.js → studio-ggm7zf70.js} +3 -3
  86. package/dist/chunks/studio-h7gy12h2.js +5 -0
  87. package/dist/chunks/{studio-9dz76yqc.js → studio-hsr3k06v.js} +5 -5
  88. package/dist/chunks/{studio-vzgmyt0v.js → studio-j933k8nr.js} +4 -4
  89. package/dist/chunks/studio-jgbvqcgh.js +5 -0
  90. package/dist/chunks/{studio-wxhy1yh7.js → studio-jh6t5qz4.js} +3 -3
  91. package/dist/chunks/{studio-88bmt9rh.js → studio-k4xc5g6h.js} +4 -4
  92. package/dist/chunks/{studio-wxdcd42g.js → studio-mwnmzx7g.js} +6 -6
  93. package/dist/chunks/{studio-1e8dw2w2.js → studio-nf0pqpbj.js} +4 -4
  94. package/dist/chunks/{studio-2j86y34y.js → studio-p0nf2e1f.js} +5 -5
  95. package/dist/chunks/{studio-k3bcy02e.js → studio-pd9dsqpq.js} +4 -4
  96. package/dist/chunks/{studio-agyvzfm4.js → studio-pmzg17fj.js} +4 -4
  97. package/dist/chunks/{studio-zg16eeq1.js → studio-pzfa2vmb.js} +4 -4
  98. package/dist/chunks/{studio-hy4ye0dx.js → studio-qyb5bebs.js} +7 -7
  99. package/dist/chunks/{studio-0ydxv2mr.js → studio-rf8d6p9f.js} +6 -6
  100. package/dist/chunks/{studio-45gyxpcq.js → studio-rt498t2v.js} +4 -4
  101. package/dist/chunks/studio-sd07xva5.js +6 -0
  102. package/dist/chunks/{studio-06j4en5h.js → studio-skynbac3.js} +2 -2
  103. package/dist/chunks/{studio-vswcpzk7.js → studio-t3j8htp7.js} +5 -5
  104. package/dist/chunks/{studio-3zge48z4.js → studio-thj81e98.js} +6 -6
  105. package/dist/chunks/{studio-ekgtrndg.js → studio-tpy3rdxn.js} +4 -4
  106. package/dist/chunks/{studio-ewarnzm4.js → studio-va0e63sk.js} +4 -4
  107. package/dist/chunks/{studio-gr36vnte.js → studio-vcz63n42.js} +4 -4
  108. package/dist/chunks/studio-vffwe9k7.js +5 -0
  109. package/dist/chunks/{studio-7dzyz9n8.js → studio-vjhej0w5.js} +103 -103
  110. package/dist/chunks/{studio-hwejq03c.js → studio-vxjap704.js} +4 -4
  111. package/dist/chunks/{studio-03mqh8ax.js → studio-w67vfgy5.js} +2 -2
  112. package/dist/chunks/{studio-ajw4k8hp.js → studio-x2metr13.js} +3 -3
  113. package/dist/chunks/{studio-771k2n12.js → studio-xebavr9s.js} +4 -4
  114. package/dist/chunks/{studio-x08a3m0a.js → studio-yg5n49za.js} +4 -4
  115. package/dist/chunks/{studio-xh683qzy.js → studio-yhz5b313.js} +4 -4
  116. package/dist/chunks/{studio-fy7jzj9j.js → studio-zacvfm31.js} +4 -4
  117. package/dist/chunks/{studio-zkq3r91p.js → studio-zsjpsw08.js} +4 -4
  118. package/dist/chunks/{studio-2hsqbq7b.js → studio-zxm98z2m.js} +6 -6
  119. package/dist/chunks/{tsMode-h6tkz0ea.js → tsMode-6vwhy6ty.js} +5 -5
  120. package/dist/chunks/workspace-d65bz1qk.js +4 -0
  121. package/dist/chunks/workspace-home-vbg9b3jh.js +4 -0
  122. package/dist/chunks/{ws-client-e951my95.js → ws-client-zcxkfgmf.js} +3 -3
  123. package/dist/manifest.json +71 -71
  124. package/dist/studio.js +73 -70
  125. package/package.json +4 -4
  126. package/src/platform-errors.ts +17 -1
  127. package/src/platforms/cloud.ts +14 -0
  128. package/src/publish/publish-changes.ts +136 -4
  129. package/src/types.ts +14 -0
  130. package/dist/chunks/adapter-wc5zvg9a.js +0 -4
  131. package/dist/chunks/cf-settings-hp1pjm0n.js +0 -4
  132. package/dist/chunks/components-nkwphrx3.js +0 -4
  133. package/dist/chunks/content-source-6a253wmk.js +0 -4
  134. package/dist/chunks/editor-wqrc68ca.js +0 -4
  135. package/dist/chunks/entry-commands-nef0wrmp.js +0 -4
  136. package/dist/chunks/file-ops-y3w71k1n.js +0 -4
  137. package/dist/chunks/files-de90apn9.js +0 -4
  138. package/dist/chunks/fs-events-77c0mr0x.js +0 -4
  139. package/dist/chunks/grid-open-4n4fjfpf.js +0 -4
  140. package/dist/chunks/index-ewmgdb7c.js +0 -4
  141. package/dist/chunks/jx-validate-b309c020.js +0 -4
  142. package/dist/chunks/layers-8rn8y6qv.js +0 -4
  143. package/dist/chunks/layers-panel-eyah7h9z.js +0 -4
  144. package/dist/chunks/lit-html-wyqw04y2.js +0 -4
  145. package/dist/chunks/media-library-gs3np47y.js +0 -4
  146. package/dist/chunks/media-picker-tt7dk4tb.js +0 -4
  147. package/dist/chunks/monaco-buffer-wsf6cmnq.js +0 -4
  148. package/dist/chunks/notify-qwst108r.js +0 -4
  149. package/dist/chunks/parse-n8dfxnqf.js +0 -4
  150. package/dist/chunks/publish-panel-d34bhvwj.js +0 -4
  151. package/dist/chunks/publish-workspace-2yr60mt4.js +0 -4
  152. package/dist/chunks/quick-search-e6xsdv0d.js +0 -4
  153. package/dist/chunks/references-gsj6trdv.js +0 -4
  154. package/dist/chunks/right-panel-33jv1knc.js +0 -4
  155. package/dist/chunks/source-control-bj9bejjv.js +0 -4
  156. package/dist/chunks/studio-38g0jdz7.js +0 -5
  157. package/dist/chunks/studio-dbxv7w4s.js +0 -5
  158. package/dist/chunks/studio-psh8mwnw.js +0 -4
  159. package/dist/chunks/studio-v9ywz2se.js +0 -6
  160. package/dist/chunks/studio-yx8hzqja.js +0 -5
  161. package/dist/chunks/workspace-home-zkkrxq3r.js +0 -4
  162. package/dist/chunks/workspace-tdqqjqaa.js +0 -4
@@ -1,7 +1,7 @@
1
- import{mt}from"./studio-ajw4k8hp.js";import{te}from"./studio-psh8mwnw.js";import{ae}from"./studio-cpkamjdn.js";import{T,R,En,rt,xi}from"./studio-jttyqrmh.js";import{g,ar,C}from"./studio-4kzbrr5t.js";import{rf,p,_e}from"./studio-03mqh8ax.js";import{Ht,Lh,ec,Xd,Na,of,fn,ul}from"./studio-3w35qvay.js";import{Sr}from"./studio-de1s2x9v.js";import{us,Om}from"./studio-k3bcy02e.js";import{Vt,ln,go,Pm,cv,Wd,Un,hi,m,Zl,Xl,Ql,_i,U$,jt,mv,Hx}from"./studio-vzgmyt0v.js";import{Bp,XA,QA,Ta}from"./studio-h310mbqm.js";import{pt,Uo,xr}from"./studio-771k2n12.js";import{ks,eA,GL,oA,ax,lx}from"./studio-5wzdy1jc.js";import{el}from"./studio-hy4ye0dx.js";import{Xn}from"./studio-9cxmp61c.js";import{xa}from"./studio-1e8dw2w2.js";import{Rp}from"./studio-x3mjr5cc.js";import{zr,qs,Gs,Wr}from"./studio-ewarnzm4.js";import{yw,mm,gm,yb}from"./studio-hwejq03c.js";import{zc,Sa}from"./studio-34jrz12k.js";import{ZE,oS}from"./studio-2ks6ka4g.js";import{QD,jr,_b,Sb}from"./studio-c1pxszat.js";import{Nw,ym}from"./studio-ndskgqef.js";import{Wt}from"./studio-x97ay0v4.js";import{mw,gw,bw}from"./studio-k3a8rp3d.js";import{Ic}from"./studio-d038kqbs.js";import{tS,KE,JE,fb}from"./studio-s0fg2wav.js";import{zs}from"./studio-h5tpz5ke.js";import{S,Xc,wn}from"./studio-45gyxpcq.js";import{n,_}from"./studio-zkq3r91p.js";import{le}from"./studio-7xag4na8.js";async function ub(){if(yw(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let o=el({status:"Installing dependencies…",title:"Installing dependencies"});try{let r=await e.installDependencies();if(r.ok)return o.done(),!0;o.fail(r.log??"Install failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}return!1}var Le=["page","component"],Me={components:"component",pages:"page"};function L(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ae(e){let t=L(e).toLowerCase();for(let[o,r]of Object.entries(Me))if(t.startsWith(`${o}/`))return r;return null}function Y(e){return Le.some((t)=>e.includes(t))}function He(e){let t=S?.projectConfig?.layout;if(!n(t))return!1;return L(t).toLowerCase()===L(e).toLowerCase()}function K_(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let o of ul(e)){let r=Na(o,"parse");if(r&&Na(o,"serialize"))t.push({ext:o,label:`${r.name} (${o})`})}return t}function ie(){return new Set([".json",...Xd().flatMap((e)=>e.extensions)])}function J_(e){if(e===null||e===void 0||e==="")return[];let t=Ae(e);if(t===null||He(e)||Un(e))return[];let o=fn(e);if(!(o?Boolean(o.capabilities.parse)&&Y(o.documentKinds):L(e).toLowerCase().endsWith(".json")))return[];let a=[];if(o)a.push({ext:".json",label:"JSON (.json)"});for(let i of ul()){let s=Na(i,"serialize");if(!s||s.name===o?.name||!Y(s.documentKinds)||!s.documentKinds.includes(t))continue;a.push({ext:i,label:`${s.name} (${i})`})}return a}function RD(){let e=new Set([".json"]);for(let t of Xd()){if(!t.capabilities.serialize||!Y(t.documentKinds))continue;for(let o of t.extensions)e.add(o)}return[...e].toSorted()}var Q="jx-studio-recent-projects",ce="jx-studio-recent-files",se=8,We=10,E=[];function M(){if(!_e())return null;let e=p();return ze(e)?e:null}function ze(e){return Boolean(e.getRecentProjects&&e.saveRecentProjects)}function Ve(){try{let e=localStorage.getItem(Q);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function X(){return M()?E:Ve()}function de(e){E=e;let t=M();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(Q,JSON.stringify(e))}catch{}}async function DD(){let e=M();if(!e)return;try{E=await e.getRecentProjects()}catch{E=[]}}function hw(){return X().toSorted((e,t)=>t.timestamp-e.timestamp)}function pw(e,t){let o=X().filter((r)=>r.root!==t);if(o.unshift({name:e,root:t,timestamp:ar()}),o.length>se)o.length=se;de(o)}function Y_(e){de(X().filter((t)=>t.root!==e))}function ND(){E=[];let e=M();if(e)e.saveRecentProjects([]);else localStorage.removeItem(Q)}function pe(){try{let e=localStorage.getItem(ce);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function AD(e){let t=pe().toSorted((o,r)=>r.timestamp-o.timestamp);return e==null?t:t.filter((o)=>o.root===e)}function hb(e){let t=pe().filter((a)=>!(a.root===e.root&&a.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:ar()});let o=new Map,r=[];for(let a of t.toSorted((i,s)=>s.timestamp-i.timestamp)){let i=(o.get(a.root)??0)+1;if(o.set(a.root,i),i<=We)r.push(a)}localStorage.setItem(ce,JSON.stringify(r))}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},address:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Add ?project= and a project folder's absolute path to this page's address to open it."}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};T("files-panel",ue);function fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function A(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function qe(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function Be(e){let t=e?.$map,o=_(t)&&"item"in t?t.item:void 0;if(!_(o)||!("path"in o)||!n(o.path)||!("type"in o)||!n(o.type))return null;return{path:o.path,type:o.type}}function me(e,t,o){let r=g({...A(),...o});fe(r,t);let a=null,i=!1,s=R("files-panel",r,e,{onNodeCreated:(l,c,u,d)=>{if(i||!(l instanceof HTMLElement))return;let b=qe(u);if(b==="tree"){o.treeHost(l);return}if(b!=="row")return;let v=Be(d);if(v)o.rowHost(l,v.path,v.type)}}).then((l)=>{if(i){l.dispose();return}a=l});return{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>{fe(r,l)}}}async function Bs(e){if(!S)return;try{let t=p(),[o]=await Promise.all([us(()=>t.listDirectory(e)),XA(e)]);S.dirs.set(e,o)}catch{S.dirs.set(e,[])}}var he=new Set(["pages","layouts","components","content","data","public","styles"]);async function pm(){if(!S)return;await Bs(".");let e=[];for(let t of S.dirs.get(".")??[])if(t.type==="directory"&&he.has(t.name))e.push(t.name),S.expanded.add(t.path||t.name),await Bs(t.path||t.name);S.projectDirs=e}async function OE(e){let t=new Set(S?.projectDirs);if(!e.some((r)=>{let a=r.replaceAll("\\","/").replace(/^\.\//,"").split("/")[0]??"";return r.includes("/")&&he.has(a)&&!t.has(a)}))return!1;return await pm(),!0}function ME(){return Uo(pt.showIgnoredFiles)==="true"}function T2(e){xr(pt.showIgnoredFiles,e?"true":"")}async function PE(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:o,info:r}=t;if(Lh(),Ht(),ec(e),Bp(),Om(),Xc({dirs:new Map,expanded:new Set,isSiteProject:r.isSiteProject,name:r.isSiteProject?r.projectConfig?.name||o.name:o.name,projectConfig:(r.isSiteProject?r.projectConfig:null)||null,projectDirs:r.directories||[],projectRoot:".",root:o.root,searchQuery:"",selectedPath:null}),r.isSiteProject)Ql(o.root||".",r.projectConfig||null);if(r.isSiteProject){if(pw(wn().name,o.root),await gm(),await ub())Lh(),await Ht(),ec(e);await pm(),await xa(),await pb(),mm(o.root)}}catch{}}async function FE({renderLeftPanel:e,resetProjectCaches:t}){try{let o=p(),r=await o.openProject?.();if(!r)return!1;let{config:a,handle:i}=r;if(U$({document:{children:[],tagName:"div"},id:"initial"}),QD(),Lh(),Ht(),ec(o),Bp(),Om(),Xc({...S,dirs:new Map,expanded:new Set,isSiteProject:!0,name:a.name||i.name,projectConfig:a,projectRoot:i.root,searchQuery:"",selectedPath:null}),Ql(i.root,a),await gm(),await ub())Lh(),await Ht(),ec(o);return await pm(),await xa(),yb(),lx(),t?.(),pw(wn().name,wn().projectRoot),e(),await pb(),mm(wn().projectRoot),!0}catch(o){return C.error("Could not open the project.",{detail:te(o),source:"Open Project"}),!1}}async function jE(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),C.success("Initialized a git repository for this project."),!0}catch(o){return C.warn("Could not initialize a git repository — the project itself was written.",{detail:te(o),source:"Source Control"}),!1}}async function Z_(){await Ht();let e=[...ul("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let o=new Set(t.filter((r)=>r.type==="file").map((r)=>r.name));for(let r of e)if(o.has(`index${r}`))return`pages/index${r}`;return null}async function L2(){let e=await Z_();if(e)await yi(e)}async function pb(){let e=oA(m.projectRoot),t=GL(m.projectRoot),o=await Ue(e);return ge?.(t),o}var ge=null;function HE(e){ge=e}async function Ue(e){if(ax(m.projectRoot),e){if(await eA(e,{ensureSecondPane:()=>{Xl(hi)},openFile:(o,r)=>yi(o,{focus:!1,paneId:r})})>0)return!0}return await L2(),!1}function Ge(e,t,o){if(t==="directory")return o?"folder-open":"folder";let r=e.split(".").pop()?.toLowerCase();switch(r){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return r!==void 0&&Rp(r)?"image":"file"}}var $2=24,f=[],k=null,F=new Map,z=null,we=null;function ne(){for(let e of F.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return $2}function Ke(){for(let[e,t]of F)if(!t.isConnected)F.delete(e),$e(t)}function ve(e){let t=F.get(e);return t?.isConnected===!0?t:null}function U(e){return f.find((t)=>!t.loading&&t.path===e)}function ye(e,t,o,r){let a=wn().dirs.get(e);if(!a){Bs(e).then(()=>h()),o.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let i=[...a].toSorted((u,d)=>{if(u.type==="directory"&&d.type!=="directory")return-1;if(u.type!=="directory"&&d.type==="directory")return 1;return u.name.localeCompare(d.name)}),s=ME()?i:i.filter((u)=>!QA(e,u.path,u.type==="directory")),l=wn().searchQuery.toLowerCase(),c=l?s.filter((u)=>u.type==="directory"||u.name.toLowerCase().includes(l)):s;for(let[u,d]of c.entries()){let v=d.type==="directory"&&wn().expanded.has(d.path);if(o.push({depth:t,expanded:v,key:d.path,loading:!1,name:d.name,path:d.path,locale:go(d.path,r)??void 0,posInSet:u+1,setSize:c.length,type:d.type}),v)ye(d.path,t+1,o,r)}}function be(e){return e===void 0?-1:f.findIndex((t)=>!t.loading&&t.path===e)}function H(e,t){for(let o=e+t;o>=0&&o<f.length;o+=t)if(!f[o].loading)return o;return-1}function Ye(e){let t=f[e];if(!t)return-1;for(let o=e-1;o>=0;o--){let r=f[o];if(!r.loading&&r.depth<t.depth)return o}return-1}function Qe(){if(k?.isConnected!==!0||j!=="")return;queueMicrotask(h)}function ee(){let e=k;if(e===null)return;z=bw(z,e,{count:()=>f.length,onChange:Qe,rowHeight:ne})}function Xe(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:Ge(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":Vt(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function Ze(){if(Ke(),!S){f=[];let l={...A(),view:"none"};return y=l,l}if(!S.isSiteProject&&S.projectRoot==="."){f=[];let l=rf(p())?"welcome":"address",c={...A(),view:l};return y=c,c}let e=wn();f=[];let{i18n:t}=ln(e.projectConfig??{});ye(".",0,f,t);let o=mw(k,{count:f.length,rowHeight:ne()}),r=f.slice(o.start,o.end),a=(e.selectedPath!==null&&U(e.selectedPath)?e.selectedPath:"")||r.find((l)=>!l.loading)?.path||"",i=ME(),s={currentPath:a,dragPath:j,dropPath:I,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:i?"eye":"eye-slash",ignoredLabel:i?"Hide ignored files":"Show ignored files",ignoredSelected:i,padBottom:o.padBottom,padTop:o.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:G,rows:r.map((l)=>Xe(l)),selectedPath:e.selectedPath??"",view:"tree"};return y=s,s}function oe(){if(!w||!y)return;y={...y,dragPath:j,dropPath:I,rootDrop:G},w.handle.update(y)}function h(){we?.()}async function et(){let e=wn();e.dirs.clear(),Bp(),await Bs(".");for(let t of e.expanded)await Bs(t);h()}function tt(e){let t=U(e);if(!t)return;if(t.type==="directory"){Fe(e).then(()=>h());return}yi(e)}function ot(e,t){let o=wn();if(U(e)?.type!=="directory"||o.expanded.has(e)===t)return;if(!t){o.expanded.delete(e),h();return}Fe(e).then(()=>h())}function xe(e){if(!S||wn().selectedPath===e)return;wn().selectedPath=e,h()}function nt(e,t){let o=be(e),r;switch(t){case"Home":{r=H(-1,1);break}case"End":{r=H(f.length,-1);break}case"ArrowUp":{r=H(o,-1);break}case"ArrowLeft":{r=Ye(o);break}case"ArrowDown":case"ArrowRight":{r=H(o,1);break}default:return}Pe(r)}function at(e,t){let o=be(e),r=f.length;for(let a=1;a<=r;a++){let i=(o+a+r)%r,s=f[i];if(s&&!s.loading&&s.name.trim().toLowerCase().startsWith(t)){Pe(i);return}}}function Pe(e){let t=f[e];if(!t)return;if(xe(t.path),ve(t.path))return;gw(k,e,ne()),h()}async function Fe(e){let t=wn();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await Bs(e)}var D=new Map,V=null,j="",J="",I="",q=!1,G="";function I2(e){return[...e.dataTransfer?.types??[]].includes("Files")}function je(e,t,o){let r=(s)=>{if(!I2(s))return;if(s.preventDefault(),s.stopPropagation(),s.dataTransfer)s.dataTransfer.dropEffect="copy";o(!0)},a=()=>o(!1),i=(s)=>{o(!1);let l=s.dataTransfer?.files;if(!l?.length)return;s.preventDefault(),s.stopPropagation(),OD(l,t,h)};return e.addEventListener("dragover",r),e.addEventListener("dragleave",a),e.addEventListener("drop",i),()=>{e.removeEventListener("dragover",r),e.removeEventListener("dragleave",a),e.removeEventListener("drop",i)}}function BE(e,t){let o=e.replaceAll("\\","/"),r=t.replaceAll("\\","/");if(!o||o===r)return!1;if(o.startsWith(`${r}/`)||r.startsWith(`${o}/`))return!1;return B(o)!==r}function Z(e,t,o){let r=e.data.path;return o==="directory"&&n(r)&&BE(r,t)}function P(e,t){let o=t?e:"";if(J===e&&I===o)return;J=e,I=o,Se()}function W(e){if(q===e)return;q=e,Se()}function Se(){G=q&&J===""?"true":"",oe()}async function OD(e,t,o){if((await Sa([...e],{dir:t})).length===0)return;if(t!==".")wn().expanded.add(t);o()}function R2(e,t){let o=document.createElement("input");o.type="file",o.multiple=!0,o.accept=zc(),o.addEventListener("change",()=>{if(o.files?.length)OD(o.files,e,t)}),o.click()}function it(e,t,o){$e(e),F.set(t,e);let r=[Wr({element:e,getInitialData(){return{entryType:o,path:t,type:"file-tree"}},onDragStart(){j=t,oe()},onDrop(){j="",P("",!1),oe()}}),je(e,o==="directory"?t:B(t),(a)=>{P(a?t:"",a)}),qs({canDrop({source:a}){return a.data.type==="file-tree"},element:e,getData({source:a}){return Z(a,t,o)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:a}){P(t,Z(a,t,o))},onDragEnter({source:a}){P(t,Z(a,t,o))},onDragLeave(){P("",!1)},onDrop(){P("",!1)}})];D.set(e,zr(...r))}function $e(e){let t=D.get(e);if(t)t(),D.delete(e)}function st(e){if(V?.element===e)return;Re(),k=e;let t=qs({canDrop({source:r}){let a=r.data.path;return r.data.type==="file-tree"&&n(a)&&BE(a,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){W(!0)},onDragLeave(){W(!1)},onDrop(){W(!1)}}),o=Gs({onDrop({source:r,location:a}){let[i]=a.current.dropTargets;if(!i)return;if(r.data.type!=="file-tree")return;if(i.data.type!=="file-tree-target")return;let s=r.data.path,l=i.data.targetDir;if(!n(s)||!n(l)||!BE(s,l))return;let c=s.split("/").pop(),u=l==="."?c:`${l}/${c}`;lt(s,u,h)}});V={cleanup:zr(t,o,je(e,".",W)),element:e},ee()}function Re(){V?.cleanup(),V=null;for(let e of D.values())e();D.clear(),z?.window.destroy(),z=null,k=null,j="",J="",I="",q=!1,G=""}async function lt(e,t,o){let r=p();Ta(e,t);try{let a=await r.renameFile(e,t);Sr();for(let[l]of m.tabs.entries())if(l===e)Hx(e,t,t);else if(l.startsWith(`${e}/`)){let c=t+l.slice(e.length);Hx(l,c,c)}let i=B(e),s=B(t);if(await Bs(i),s!==i)await Bs(s);if(s!==".")wn().expanded.add(s);Te(a,t),o(),MD(`Moved to ${t}`,a,t)}catch(a){C.error(`Could not move ${e}.`,{detail:te(a),path:e,source:"Files"})}}function B(e){let t=e.replaceAll("\\","/"),o=t.lastIndexOf("/");return o===-1?".":t.slice(0,o)}var N=null;function ke(){N?.close(),N=null}function ct(e){let t={};if(e.type==="directory"){let o=Wd(e.path);if(o?.isSourceRoot===!0&&!o.fileBacked)t.name=o.name;return t}if(t.file=e.path,Ic(e.path))t.path=e.path;if(J_(e.path).length>0)t.source=e.path;return t}function x(e,t,o,r={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:o,title:t,...r}}function dt(e){let t=ae();if(!t)return[];let o=ct(e),r=[];for(let a of t.forPlacement("context/file")){let i=a.args;if(!(i?.required??[]).every((c)=>(c in o)))continue;let s={};for(let c of Object.keys(i?.properties??{}))if(c in o)s[c]=o[c];let l=t.disabledReason(a.id);r.push(l===void 0?x(a.id,a.title,()=>{En(t,a.id,s,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:a.id,requires:l,title:a.title})}return r}function ut(e){let t=e.type==="directory",o=[];if(t){if(o.push(x("files.newFile","New File…",()=>{Ee(e.path,h)}),x("files.upload","Upload Files…",()=>{R2(e.path,h)})),e.path==="pages"||e.path.endsWith("/pages"))o.push(x("files.pagesGrid","Edit Pages in Grid",()=>{oS()}))}else o.push(x("files.open","Open",()=>{yi(e.path)}));return o.push(...dt(e),x("files.rename","Rename…",()=>{bt(e,h)},{dividerAbove:!0}),x("files.delete","Delete",()=>{xt(e,h)},{destructive:!0})),o}function ft(e,t,o){let r=U(e);if(!r)return;ke();let a=ve(e);N=Wt({label:"File actions",onClosed:(i)=>{if(N===i)N=null},opener:a,origin:{x:t,y:o},region:"files",rows:ut({name:r.name,path:r.path,type:r.type})})}var ht=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2);function gt(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Na(e.ext)?.name??e.ext} (${e.ext})`}]:K_(e.docKind)).map((o)=>({label:o.label,value:o.ext})),{dividerBefore:!0,label:"Other…",value:tS}]}function wt(e,t,o){let r=e.kind==="choose"?e.defaultExt:e.ext;if(r!==void 0&&t.some((i)=>i.value===r))return r;let a=KE(o);if(a!==""&&t.some((i)=>i.value===a))return a;return t[0]?.value??tS}async function D2(e){let{dir:t,format:o,source:r="Files"}=e;await Ht();let a=await fw(t),i=o!==void 0&&o.kind!=="fixed"?o:null,s=i===null?null:gt(i),l=i===null||s===null?"":wt(i,s,e.suggestedName??""),c={choice:o,dir:t,known:ie(),rows:s,taken:a},u=(K,Oe)=>fb(K,Oe,c),d=l,b={confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,select:s===null?"stem":"all",validate:u,value:e.suggestedName??"untitled.json"};if(s!==null)b.choice={initial:l,label:"Format",onChange:(K)=>{d=K},options:()=>s};if(e.suggestedName!==void 0)b.placeholder=e.suggestedName;let v=await xi(e.title??"New File",b);if(!v)return null;let O=JE(v,d,o),Ne=t==="."?O:`${t}/${O}`,re=fn(O),De=e.content,Ie=o!==void 0&&d!==tS,Ce=De??re?.studio?.newFileTemplate??(re?"":O.toLowerCase().endsWith(".json")?Ie?ht:`{}
2
- `:"");return X_(Ne,Ce,{dir:t,source:r})}async function fw(e){try{let t=await p().listDirectory(e);return new Set(t.map((o)=>o.name.toLowerCase()))}catch{return new Set}}async function X_(e,t,o={}){let r=o.dir??(e.includes("/")?e.slice(0,e.lastIndexOf("/")):".");Ta(e);try{if(await p().writeFile(e,t),await Bs(r),o.quiet!==!0)C.success(`Created ${e}`);return e}catch(a){return C.error(`Could not create ${e}.`,{detail:te(a),path:e,source:o.source??"Files"}),null}}async function Ee(e,t){await Ht();let o=Wd(e);if(o?.unresolvedFormat!=null)C.error(`New files in ${e}/ cannot be constrained to the collection's format.`,{detail:`The "${o.name}" content type declares format "${o.unresolvedFormat}", which no installed extension provides. Install the extension that supplies it, or correct `+"the name in Project Settings › Content Types.",path:e,source:"Files"});let r=o?.ext!=null&&o.unresolvedFormat===null,a=r&&o.isSourceRoot&&o.def.schema!==void 0,i;if(a){let{createEntry:s}=await (le("nef0wrmp"),import("./entry-commands-nef0wrmp.js"));i=await s(o.name,{dir:e})}else i=await D2({dir:e,format:r&&o.ext!==null?{because:`${o.name} entries are ${o.ext} files, so a document of another format here would not be one.`,ext:o.ext,kind:"locked"}:{defaultExt:".json",kind:"choose"},suggestedName:"untitled"});if(i!==null)t()}async function vt(e,t){let o=await Sb(t),r={confirmLabel:"Rename",select:"stem",validate:(a)=>a.trim()?"":"Enter a file name.",value:e};if(o!==void 0)r.message=o;return xi("Rename",r)}function yt(e,t){let o=t.references,r=t.tag?`; tag → <${t.tag.to}> (${t.tag.refsUpdated})`:"";if(o&&o.refsUpdated>0)return`Renamed to ${e}; updated ${o.refsUpdated} reference(s) in ${o.filesChanged} file(s)${r}`;if(r)return`Renamed to ${e}${r}`;return`Renamed to ${e}`}function MD(e,t,o){let r=t.errors??[];if(r.length===0){C.success(e);return}let a=r.length===1?"1 file":`${r.length} files`;C.warn(`${e} — references in ${a} could not be updated`,{detail:r.map((i)=>`${i.path}: ${i.error}`).join(`
3
- `),path:o,source:"Files"})}function Te(e,t){for(let o of e.references?.files??[])if(o.path!==t&&m.tabs.has(o.path))fm(o.path)}function zE(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}async function N2(e,t,o){Sr();let r=zE(e),a=zE(t);if(await Bs(r),a!==r)await Bs(a);if(wn().selectedPath===e)wn().selectedPath=t;Te(o,t)}async function bt(e,t){let o=await vt(e.name,e.path);if(!o||o===e.name)return;let r=zE(e.path),a=r==="."?o:`${r}/${o}`;Ta(e.path,a);try{let s=await p().renameFile(e.path,a);if(m.tabs.has(e.path))Hx(e.path,a,a);await N2(e.path,a,s),t(),MD(yt(o,s),s,a)}catch(i){C.error(`Could not rename ${e.name}.`,{detail:te(i),path:e.path,source:"Files"})}}async function xt(e,t){if(!await _b(e))return;try{let r=p();Ta(e.path),await r.deleteFile(e.path),Sr();let a=e.path.replaceAll("\\","/"),i=a.includes("/")?a.slice(0,a.lastIndexOf("/")):".";if(await Bs(i),wn().selectedPath===e.path)wn().selectedPath=null;t(),C.success(`Deleted ${e.name}`)}catch(r){C.error(`Could not delete ${e.name}.`,{detail:te(r),path:e.path,source:"Files"})}}function Pt(e,t){let o=t.paneId,r=Zl(e);if(o!==void 0&&r){if(r.activeTabId===e&&t.focus===!1)return;mv(e,o)}jt(e,{focus:t.focus!==!1})}async function yi(e,t={}){let o=t.focus!==!1;for(let[a,i]of m.tabs.entries())if(i.documentPath===e){if(t.canvasMode!==void 0)i.session.ui.canvasMode=t.canvasMode;if(Pt(a,t),o)wn().selectedPath=e;return}if(Nw(e)){if(ym(e,t),o)wn().selectedPath=e;hb({name:e.split("/").pop()||e,path:e,root:wn().projectRoot});return}if(e.toLowerCase().endsWith(".csv")){try{if(await ZE(e,t),o)wn().selectedPath=e;hb({name:e.split("/").pop()||e,path:e,root:wn().projectRoot})}catch(a){C.error(`Could not open ${e}.`,{detail:te(a),path:e,source:"Open File"})}return}let r=p();try{let a=await r.readFile(e);if(!a){if(await Ht(),!fn(e)&&!e.toLowerCase().endsWith(".json"))throw of(e);return}await Ht();let i,s,l=null,c=fn(e);if(c){let d=await jr(e,a);({document:i}=d),{frontmatter:s}=d}else if(e.endsWith(".json"))({document:i,layout:l}=ks(a));else throw of(e);if(_i({id:e,documentPath:e,document:i,...s!=null&&{frontmatter:s},layout:l,source:c?a:null,sourceFormat:c?.name??null,...t.paneId!==void 0&&{paneId:t.paneId},...t.preview===!0&&{preview:!0},...t.focus===!1&&{focus:!1},...t.canvasMode!==void 0&&{canvasMode:t.canvasMode}}),o)wn().selectedPath=e;hb({name:e.split("/").pop()||e,path:e,root:wn().projectRoot})}catch(a){C.error(`Could not open ${e}.`,{detail:te(a),path:e,source:"Open File"})}}async function Q_(e,t){await yi(t,{focus:!1,paneId:e,preview:!0})}function WE(e){if(cv(e))return;for(let[,t]of m.tabs.entries())if(t.documentPath===e&&!t.doc.dirty){fm(e);return}}function VE(e){for(let t of e)fm(t,{onlyIfChanged:!0})}async function fm(e,t={}){for(let[,o]of m.tabs.entries())if(o.documentPath===e){let r=p(),a=o.doc.dirty,i=()=>!a&&o.doc.dirty||cv(e);try{let s=await r.readFile(e);if(!s)return;if(await Ht(),i())return;if(fn(e)){let{document:l,frontmatter:c}=await jr(e,s);if(i())return;if(t.onlyIfChanged&&zs(l,o.doc.document)&&zs(c,o.doc.content.frontmatter))return;o.doc.document=l,o.doc.content.frontmatter=c,o.doc.source=s}else if(e.endsWith(".json")){let l=ks(s);o.doc.layout=l.layout;let c=l.document;if(o.doc.bareRepeaters=Pm(c),t.onlyIfChanged&&zs(c,o.doc.document))return;o.doc.document=c}o.doc.dirty=!1}catch(s){C.error(`Could not reload ${e} after it changed on disk.`,{detail:te(s),key:`reload:${e}`,path:e,source:"Files"})}return}}function UE(){Xn({id:"files",title:"Files",level:"project",dock:"navigator",icon:"folder",rail:"developer",render:()=>mt,afterRender:(e,t)=>{A2(t,e.rerender)}})}var Ft={activate:tt,contextMenu:ft,expand:ot,move:nt,newFile:()=>{Ee(".",h)},openProject:()=>{rt("project.open",void 0,"Files")},refresh:()=>{et()},rowHost:it,search:(e)=>{wn().searchQuery=e,h()},select:xe,toggleIgnored:()=>{T2(!ME()),h()},treeHost:st,typeahead:at},w=null,y=null;function A2(e,t){let o=e.querySelector(".panel-content")??e;if(we=t,w&&(w.host!==o||!w.handle.connected()))O2();let r=Ze();if(w)w.handle.update(r);else{let a=me(o,r,Ft);w={handle:a,host:o},a.ready.then(ee)}queueMicrotask(ee)}function O2(){ke(),w?.handle.dispose(),w=null,y=null,Re(),F.clear(),f=[]}
4
- export{ub,K_,J_,RD,DD,hw,pw,Y_,ND,AD,hb,Bs,pm,OE,ME,T2,PE,FE,jE,Z_,L2,pb,HE,$2,I2,BE,OD,R2,D2,fw,X_,MD,zE,N2,yi,Q_,WE,VE,fm,UE,A2,O2};
1
+ import{mt}from"./studio-x2metr13.js";import{ee}from"./studio-et6t8g4m.js";import{ae}from"./studio-f2j9et3h.js";import{T,R,En,rt,Qn}from"./studio-cvz0e00f.js";import{g,ar,C}from"./studio-ahf3cspq.js";import{rf,p,_e}from"./studio-w67vfgy5.js";import{Ht,Lh,ec,Qd,Na,of,fn,ul}from"./studio-848rk4p1.js";import{Sr}from"./studio-0hr000ba.js";import{us,Om}from"./studio-pd9dsqpq.js";import{Vt,ln,go,Pm,cv,Vd,Un,pi,m,Zl,Xl,Ql,_i,U$,jt,mv,Hx}from"./studio-j933k8nr.js";import{Bp,QA,eO,Ta}from"./studio-dy2xtt7a.js";import{pt,Uo,xr}from"./studio-xebavr9s.js";import{Es,eA,GL,oA,ax,lx}from"./studio-dbgv4fv9.js";import{el}from"./studio-qyb5bebs.js";import{Xn}from"./studio-ggm7zf70.js";import{xa}from"./studio-nf0pqpbj.js";import{Rp}from"./studio-5dmgmyw4.js";import{zr,Gs,Ks,Wr}from"./studio-va0e63sk.js";import{yw,mm,gm,yb}from"./studio-vxjap704.js";import{Wc,Sa}from"./studio-20ap8dds.js";import{ZE,oS}from"./studio-fyf7j57j.js";import{QD,jr,_b,Sb}from"./studio-ga77mf07.js";import{Nw,ym}from"./studio-5m0w815d.js";import{Wt}from"./studio-5e7p1vgd.js";import{mw,gw,bw}from"./studio-4zqfw5ha.js";import{Rc}from"./studio-56egy6vf.js";import{tS,KE,JE,fb}from"./studio-s0fg2wav.js";import{Ws}from"./studio-07k0geap.js";import{S,Qc,wn}from"./studio-rt498t2v.js";import{n,_}from"./studio-zsjpsw08.js";import{le}from"./studio-0g2sm01j.js";async function ub(){if(yw(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let o=el({status:"Installing dependencies…",title:"Installing dependencies"});try{let r=await e.installDependencies();if(r.ok)return o.done(),!0;o.fail(r.log??"Install failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}return!1}var Le=["page","component"],Me={components:"component",pages:"page"};function L(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ae(e){let t=L(e).toLowerCase();for(let[o,r]of Object.entries(Me))if(t.startsWith(`${o}/`))return r;return null}function Y(e){return Le.some((t)=>e.includes(t))}function He(e){let t=S?.projectConfig?.layout;if(!n(t))return!1;return L(t).toLowerCase()===L(e).toLowerCase()}function K_(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let o of ul(e)){let r=Na(o,"parse");if(r&&Na(o,"serialize"))t.push({ext:o,label:`${r.name} (${o})`})}return t}function ie(){return new Set([".json",...Qd().flatMap((e)=>e.extensions)])}function J_(e){if(e===null||e===void 0||e==="")return[];let t=Ae(e);if(t===null||He(e)||Un(e))return[];let o=fn(e);if(!(o?Boolean(o.capabilities.parse)&&Y(o.documentKinds):L(e).toLowerCase().endsWith(".json")))return[];let a=[];if(o)a.push({ext:".json",label:"JSON (.json)"});for(let i of ul()){let s=Na(i,"serialize");if(!s||s.name===o?.name||!Y(s.documentKinds)||!s.documentKinds.includes(t))continue;a.push({ext:i,label:`${s.name} (${i})`})}return a}function RD(){let e=new Set([".json"]);for(let t of Qd()){if(!t.capabilities.serialize||!Y(t.documentKinds))continue;for(let o of t.extensions)e.add(o)}return[...e].toSorted()}var Q="jx-studio-recent-projects",ce="jx-studio-recent-files",se=8,We=10,E=[];function M(){if(!_e())return null;let e=p();return ze(e)?e:null}function ze(e){return Boolean(e.getRecentProjects&&e.saveRecentProjects)}function Ve(){try{let e=localStorage.getItem(Q);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function X(){return M()?E:Ve()}function de(e){E=e;let t=M();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(Q,JSON.stringify(e))}catch{}}async function DD(){let e=M();if(!e)return;try{E=await e.getRecentProjects()}catch{E=[]}}function hw(){return X().toSorted((e,t)=>t.timestamp-e.timestamp)}function pw(e,t){let o=X().filter((r)=>r.root!==t);if(o.unshift({name:e,root:t,timestamp:ar()}),o.length>se)o.length=se;de(o)}function Y_(e){de(X().filter((t)=>t.root!==e))}function ND(){E=[];let e=M();if(e)e.saveRecentProjects([]);else localStorage.removeItem(Q)}function pe(){try{let e=localStorage.getItem(ce);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function AD(e){let t=pe().toSorted((o,r)=>r.timestamp-o.timestamp);return e==null?t:t.filter((o)=>o.root===e)}function hb(e){let t=pe().filter((a)=>!(a.root===e.root&&a.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:ar()});let o=new Map,r=[];for(let a of t.toSorted((i,s)=>s.timestamp-i.timestamp)){let i=(o.get(a.root)??0)+1;if(o.set(a.root,i),i<=We)r.push(a)}localStorage.setItem(ce,JSON.stringify(r))}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},address:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Add ?project= and a project folder's absolute path to this page's address to open it."}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};T("files-panel",ue);function fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function A(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function qe(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function Be(e){let t=e?.$map,o=_(t)&&"item"in t?t.item:void 0;if(!_(o)||!("path"in o)||!n(o.path)||!("type"in o)||!n(o.type))return null;return{path:o.path,type:o.type}}function me(e,t,o){let r=g({...A(),...o});fe(r,t);let a=null,i=!1,s=R("files-panel",r,e,{onNodeCreated:(l,c,u,d)=>{if(i||!(l instanceof HTMLElement))return;let b=qe(u);if(b==="tree"){o.treeHost(l);return}if(b!=="row")return;let v=Be(d);if(v)o.rowHost(l,v.path,v.type)}}).then((l)=>{if(i){l.dispose();return}a=l});return{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>{fe(r,l)}}}async function zs(e){if(!S)return;try{let t=p(),[o]=await Promise.all([us(()=>t.listDirectory(e)),QA(e)]);S.dirs.set(e,o)}catch{S.dirs.set(e,[])}}var he=new Set(["pages","layouts","components","content","data","public","styles"]);async function pm(){if(!S)return;await zs(".");let e=[];for(let t of S.dirs.get(".")??[])if(t.type==="directory"&&he.has(t.name))e.push(t.name),S.expanded.add(t.path||t.name),await zs(t.path||t.name);S.projectDirs=e}async function OE(e){let t=new Set(S?.projectDirs);if(!e.some((r)=>{let a=r.replaceAll("\\","/").replace(/^\.\//,"").split("/")[0]??"";return r.includes("/")&&he.has(a)&&!t.has(a)}))return!1;return await pm(),!0}function ME(){return Uo(pt.showIgnoredFiles)==="true"}function L2(e){xr(pt.showIgnoredFiles,e?"true":"")}async function PE(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:o,info:r}=t;if(Lh(),Ht(),ec(e),Bp(),Om(),Qc({dirs:new Map,expanded:new Set,isSiteProject:r.isSiteProject,name:r.isSiteProject?r.projectConfig?.name||o.name:o.name,projectConfig:(r.isSiteProject?r.projectConfig:null)||null,projectDirs:r.directories||[],projectRoot:".",root:o.root,searchQuery:"",selectedPath:null}),r.isSiteProject)Ql(o.root||".",r.projectConfig||null);if(r.isSiteProject){if(pw(wn().name,o.root),await gm(),await ub())Lh(),await Ht(),ec(e);await pm(),await xa(),await pb(),mm(o.root)}}catch{}}async function FE({renderLeftPanel:e,resetProjectCaches:t}){try{let o=p(),r=await o.openProject?.();if(!r)return!1;let{config:a,handle:i}=r;if(U$({document:{children:[],tagName:"div"},id:"initial"}),QD(),Lh(),Ht(),ec(o),Bp(),Om(),Qc({...S,dirs:new Map,expanded:new Set,isSiteProject:!0,name:a.name||i.name,projectConfig:a,projectRoot:i.root,searchQuery:"",selectedPath:null}),Ql(i.root,a),await gm(),await ub())Lh(),await Ht(),ec(o);return await pm(),await xa(),yb(),lx(),t?.(),pw(wn().name,wn().projectRoot),e(),await pb(),mm(wn().projectRoot),!0}catch(o){return C.error("Could not open the project.",{detail:ee(o),source:"Open Project"}),!1}}async function jE(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),C.success("Initialized a git repository for this project."),!0}catch(o){return C.warn("Could not initialize a git repository — the project itself was written.",{detail:ee(o),source:"Source Control"}),!1}}async function Z_(){await Ht();let e=[...ul("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let o=new Set(t.filter((r)=>r.type==="file").map((r)=>r.name));for(let r of e)if(o.has(`index${r}`))return`pages/index${r}`;return null}async function $2(){let e=await Z_();if(e)await wi(e)}async function pb(){let e=oA(m.projectRoot),t=GL(m.projectRoot),o=await Ue(e);return ge?.(t),o}var ge=null;function HE(e){ge=e}async function Ue(e){if(ax(m.projectRoot),e){if(await eA(e,{ensureSecondPane:()=>{Xl(pi)},openFile:(o,r)=>wi(o,{focus:!1,paneId:r})})>0)return!0}return await $2(),!1}function Ge(e,t,o){if(t==="directory")return o?"folder-open":"folder";let r=e.split(".").pop()?.toLowerCase();switch(r){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return r!==void 0&&Rp(r)?"image":"file"}}var I2=24,f=[],k=null,F=new Map,z=null,we=null;function ne(){for(let e of F.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return I2}function Ke(){for(let[e,t]of F)if(!t.isConnected)F.delete(e),$e(t)}function ve(e){let t=F.get(e);return t?.isConnected===!0?t:null}function U(e){return f.find((t)=>!t.loading&&t.path===e)}function ye(e,t,o,r){let a=wn().dirs.get(e);if(!a){zs(e).then(()=>h()),o.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let i=[...a].toSorted((u,d)=>{if(u.type==="directory"&&d.type!=="directory")return-1;if(u.type!=="directory"&&d.type==="directory")return 1;return u.name.localeCompare(d.name)}),s=ME()?i:i.filter((u)=>!eO(e,u.path,u.type==="directory")),l=wn().searchQuery.toLowerCase(),c=l?s.filter((u)=>u.type==="directory"||u.name.toLowerCase().includes(l)):s;for(let[u,d]of c.entries()){let v=d.type==="directory"&&wn().expanded.has(d.path);if(o.push({depth:t,expanded:v,key:d.path,loading:!1,name:d.name,path:d.path,locale:go(d.path,r)??void 0,posInSet:u+1,setSize:c.length,type:d.type}),v)ye(d.path,t+1,o,r)}}function be(e){return e===void 0?-1:f.findIndex((t)=>!t.loading&&t.path===e)}function H(e,t){for(let o=e+t;o>=0&&o<f.length;o+=t)if(!f[o].loading)return o;return-1}function Ye(e){let t=f[e];if(!t)return-1;for(let o=e-1;o>=0;o--){let r=f[o];if(!r.loading&&r.depth<t.depth)return o}return-1}function Qe(){if(k?.isConnected!==!0||j!=="")return;queueMicrotask(h)}function te(){let e=k;if(e===null)return;z=bw(z,e,{count:()=>f.length,onChange:Qe,rowHeight:ne})}function Xe(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:Ge(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":Vt(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function Ze(){if(Ke(),!S){f=[];let l={...A(),view:"none"};return y=l,l}if(!S.isSiteProject&&S.projectRoot==="."){f=[];let l=rf(p())?"welcome":"address",c={...A(),view:l};return y=c,c}let e=wn();f=[];let{i18n:t}=ln(e.projectConfig??{});ye(".",0,f,t);let o=mw(k,{count:f.length,rowHeight:ne()}),r=f.slice(o.start,o.end),a=(e.selectedPath!==null&&U(e.selectedPath)?e.selectedPath:"")||r.find((l)=>!l.loading)?.path||"",i=ME(),s={currentPath:a,dragPath:j,dropPath:I,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:i?"eye":"eye-slash",ignoredLabel:i?"Hide ignored files":"Show ignored files",ignoredSelected:i,padBottom:o.padBottom,padTop:o.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:G,rows:r.map((l)=>Xe(l)),selectedPath:e.selectedPath??"",view:"tree"};return y=s,s}function oe(){if(!w||!y)return;y={...y,dragPath:j,dropPath:I,rootDrop:G},w.handle.update(y)}function h(){we?.()}async function et(){let e=wn();e.dirs.clear(),Bp(),await zs(".");for(let t of e.expanded)await zs(t);h()}function tt(e){let t=U(e);if(!t)return;if(t.type==="directory"){Fe(e).then(()=>h());return}wi(e)}function ot(e,t){let o=wn();if(U(e)?.type!=="directory"||o.expanded.has(e)===t)return;if(!t){o.expanded.delete(e),h();return}Fe(e).then(()=>h())}function xe(e){if(!S||wn().selectedPath===e)return;wn().selectedPath=e,h()}function nt(e,t){let o=be(e),r;switch(t){case"Home":{r=H(-1,1);break}case"End":{r=H(f.length,-1);break}case"ArrowUp":{r=H(o,-1);break}case"ArrowLeft":{r=Ye(o);break}case"ArrowDown":case"ArrowRight":{r=H(o,1);break}default:return}Pe(r)}function at(e,t){let o=be(e),r=f.length;for(let a=1;a<=r;a++){let i=(o+a+r)%r,s=f[i];if(s&&!s.loading&&s.name.trim().toLowerCase().startsWith(t)){Pe(i);return}}}function Pe(e){let t=f[e];if(!t)return;if(xe(t.path),ve(t.path))return;gw(k,e,ne()),h()}async function Fe(e){let t=wn();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await zs(e)}var D=new Map,V=null,j="",J="",I="",q=!1,G="";function R2(e){return[...e.dataTransfer?.types??[]].includes("Files")}function je(e,t,o){let r=(s)=>{if(!R2(s))return;if(s.preventDefault(),s.stopPropagation(),s.dataTransfer)s.dataTransfer.dropEffect="copy";o(!0)},a=()=>o(!1),i=(s)=>{o(!1);let l=s.dataTransfer?.files;if(!l?.length)return;s.preventDefault(),s.stopPropagation(),OD(l,t,h)};return e.addEventListener("dragover",r),e.addEventListener("dragleave",a),e.addEventListener("drop",i),()=>{e.removeEventListener("dragover",r),e.removeEventListener("dragleave",a),e.removeEventListener("drop",i)}}function BE(e,t){let o=e.replaceAll("\\","/"),r=t.replaceAll("\\","/");if(!o||o===r)return!1;if(o.startsWith(`${r}/`)||r.startsWith(`${o}/`))return!1;return B(o)!==r}function Z(e,t,o){let r=e.data.path;return o==="directory"&&n(r)&&BE(r,t)}function P(e,t){let o=t?e:"";if(J===e&&I===o)return;J=e,I=o,Se()}function W(e){if(q===e)return;q=e,Se()}function Se(){G=q&&J===""?"true":"",oe()}async function OD(e,t,o){if((await Sa([...e],{dir:t})).length===0)return;if(t!==".")wn().expanded.add(t);o()}function D2(e,t){let o=document.createElement("input");o.type="file",o.multiple=!0,o.accept=Wc(),o.addEventListener("change",()=>{if(o.files?.length)OD(o.files,e,t)}),o.click()}function it(e,t,o){$e(e),F.set(t,e);let r=[Wr({element:e,getInitialData(){return{entryType:o,path:t,type:"file-tree"}},onDragStart(){j=t,oe()},onDrop(){j="",P("",!1),oe()}}),je(e,o==="directory"?t:B(t),(a)=>{P(a?t:"",a)}),Gs({canDrop({source:a}){return a.data.type==="file-tree"},element:e,getData({source:a}){return Z(a,t,o)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:a}){P(t,Z(a,t,o))},onDragEnter({source:a}){P(t,Z(a,t,o))},onDragLeave(){P("",!1)},onDrop(){P("",!1)}})];D.set(e,zr(...r))}function $e(e){let t=D.get(e);if(t)t(),D.delete(e)}function st(e){if(V?.element===e)return;Re(),k=e;let t=Gs({canDrop({source:r}){let a=r.data.path;return r.data.type==="file-tree"&&n(a)&&BE(a,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){W(!0)},onDragLeave(){W(!1)},onDrop(){W(!1)}}),o=Ks({onDrop({source:r,location:a}){let[i]=a.current.dropTargets;if(!i)return;if(r.data.type!=="file-tree")return;if(i.data.type!=="file-tree-target")return;let s=r.data.path,l=i.data.targetDir;if(!n(s)||!n(l)||!BE(s,l))return;let c=s.split("/").pop(),u=l==="."?c:`${l}/${c}`;lt(s,u,h)}});V={cleanup:zr(t,o,je(e,".",W)),element:e},te()}function Re(){V?.cleanup(),V=null;for(let e of D.values())e();D.clear(),z?.window.destroy(),z=null,k=null,j="",J="",I="",q=!1,G=""}async function lt(e,t,o){let r=p();Ta(e,t);try{let a=await r.renameFile(e,t);Sr();for(let[l]of m.tabs.entries())if(l===e)Hx(e,t,t);else if(l.startsWith(`${e}/`)){let c=t+l.slice(e.length);Hx(l,c,c)}let i=B(e),s=B(t);if(await zs(i),s!==i)await zs(s);if(s!==".")wn().expanded.add(s);Te(a,t),o(),MD(`Moved to ${t}`,a,t)}catch(a){C.error(`Could not move ${e}.`,{detail:ee(a),path:e,source:"Files"})}}function B(e){let t=e.replaceAll("\\","/"),o=t.lastIndexOf("/");return o===-1?".":t.slice(0,o)}var N=null;function ke(){N?.close(),N=null}function ct(e){let t={};if(e.type==="directory"){let o=Vd(e.path);if(o?.isSourceRoot===!0&&!o.fileBacked)t.name=o.name;return t}if(t.file=e.path,Rc(e.path))t.path=e.path;if(J_(e.path).length>0)t.source=e.path;return t}function x(e,t,o,r={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:o,title:t,...r}}function dt(e){let t=ae();if(!t)return[];let o=ct(e),r=[];for(let a of t.forPlacement("context/file")){let i=a.args;if(!(i?.required??[]).every((c)=>(c in o)))continue;let s={};for(let c of Object.keys(i?.properties??{}))if(c in o)s[c]=o[c];let l=t.disabledReason(a.id);r.push(l===void 0?x(a.id,a.title,()=>{En(t,a.id,s,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:a.id,requires:l,title:a.title})}return r}function ut(e){let t=e.type==="directory",o=[];if(t){if(o.push(x("files.newFile","New File…",()=>{Ee(e.path,h)}),x("files.upload","Upload Files…",()=>{D2(e.path,h)})),e.path==="pages"||e.path.endsWith("/pages"))o.push(x("files.pagesGrid","Edit Pages in Grid",()=>{oS()}))}else o.push(x("files.open","Open",()=>{wi(e.path)}));return o.push(...dt(e),x("files.rename","Rename…",()=>{bt(e,h)},{dividerAbove:!0}),x("files.delete","Delete",()=>{xt(e,h)},{destructive:!0})),o}function ft(e,t,o){let r=U(e);if(!r)return;ke();let a=ve(e);N=Wt({label:"File actions",onClosed:(i)=>{if(N===i)N=null},opener:a,origin:{x:t,y:o},region:"files",rows:ut({name:r.name,path:r.path,type:r.type})})}var ht=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2);function gt(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Na(e.ext)?.name??e.ext} (${e.ext})`}]:K_(e.docKind)).map((o)=>({label:o.label,value:o.ext})),{dividerBefore:!0,label:"Other…",value:tS}]}function wt(e,t,o){let r=e.kind==="choose"?e.defaultExt:e.ext;if(r!==void 0&&t.some((i)=>i.value===r))return r;let a=KE(o);if(a!==""&&t.some((i)=>i.value===a))return a;return t[0]?.value??tS}async function N2(e){let{dir:t,format:o,source:r="Files"}=e;await Ht();let a=await fw(t),i=o!==void 0&&o.kind!=="fixed"?o:null,s=i===null?null:gt(i),l=i===null||s===null?"":wt(i,s,e.suggestedName??""),c={choice:o,dir:t,known:ie(),rows:s,taken:a},u=(K,Oe)=>fb(K,Oe,c),d=l,b={confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,select:s===null?"stem":"all",validate:u,value:e.suggestedName??"untitled.json"};if(s!==null)b.choice={initial:l,label:"Format",onChange:(K)=>{d=K},options:()=>s};if(e.suggestedName!==void 0)b.placeholder=e.suggestedName;let v=await Qn(e.title??"New File",b);if(!v)return null;let O=JE(v,d,o),Ne=t==="."?O:`${t}/${O}`,re=fn(O),De=e.content,Ie=o!==void 0&&d!==tS,Ce=De??re?.studio?.newFileTemplate??(re?"":O.toLowerCase().endsWith(".json")?Ie?ht:`{}
2
+ `:"");return X_(Ne,Ce,{dir:t,source:r})}async function fw(e){try{let t=await p().listDirectory(e);return new Set(t.map((o)=>o.name.toLowerCase()))}catch{return new Set}}async function X_(e,t,o={}){let r=o.dir??(e.includes("/")?e.slice(0,e.lastIndexOf("/")):".");Ta(e);try{if(await p().writeFile(e,t),await zs(r),o.quiet!==!0)C.success(`Created ${e}`);return e}catch(a){return C.error(`Could not create ${e}.`,{detail:ee(a),path:e,source:o.source??"Files"}),null}}async function Ee(e,t){await Ht();let o=Vd(e);if(o?.unresolvedFormat!=null)C.error(`New files in ${e}/ cannot be constrained to the collection's format.`,{detail:`The "${o.name}" content type declares format "${o.unresolvedFormat}", which no installed extension provides. Install the extension that supplies it, or correct `+"the name in Project Settings › Content Types.",path:e,source:"Files"});let r=o?.ext!=null&&o.unresolvedFormat===null,a=r&&o.isSourceRoot&&o.def.schema!==void 0,i;if(a){let{createEntry:s}=await (le("w8p2fbpt"),import("./entry-commands-w8p2fbpt.js"));i=await s(o.name,{dir:e})}else i=await N2({dir:e,format:r&&o.ext!==null?{because:`${o.name} entries are ${o.ext} files, so a document of another format here would not be one.`,ext:o.ext,kind:"locked"}:{defaultExt:".json",kind:"choose"},suggestedName:"untitled"});if(i!==null)t()}async function vt(e,t){let o=await Sb(t),r={confirmLabel:"Rename",select:"stem",validate:(a)=>a.trim()?"":"Enter a file name.",value:e};if(o!==void 0)r.message=o;return Qn("Rename",r)}function yt(e,t){let o=t.references,r=t.tag?`; tag → <${t.tag.to}> (${t.tag.refsUpdated})`:"";if(o&&o.refsUpdated>0)return`Renamed to ${e}; updated ${o.refsUpdated} reference(s) in ${o.filesChanged} file(s)${r}`;if(r)return`Renamed to ${e}${r}`;return`Renamed to ${e}`}function MD(e,t,o){let r=t.errors??[];if(r.length===0){C.success(e);return}let a=r.length===1?"1 file":`${r.length} files`;C.warn(`${e} — references in ${a} could not be updated`,{detail:r.map((i)=>`${i.path}: ${i.error}`).join(`
3
+ `),path:o,source:"Files"})}function Te(e,t){for(let o of e.references?.files??[])if(o.path!==t&&m.tabs.has(o.path))fm(o.path)}function zE(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}async function A2(e,t,o){Sr();let r=zE(e),a=zE(t);if(await zs(r),a!==r)await zs(a);if(wn().selectedPath===e)wn().selectedPath=t;Te(o,t)}async function bt(e,t){let o=await vt(e.name,e.path);if(!o||o===e.name)return;let r=zE(e.path),a=r==="."?o:`${r}/${o}`;Ta(e.path,a);try{let s=await p().renameFile(e.path,a);if(m.tabs.has(e.path))Hx(e.path,a,a);await A2(e.path,a,s),t(),MD(yt(o,s),s,a)}catch(i){C.error(`Could not rename ${e.name}.`,{detail:ee(i),path:e.path,source:"Files"})}}async function xt(e,t){if(!await _b(e))return;try{let r=p();Ta(e.path),await r.deleteFile(e.path),Sr();let a=e.path.replaceAll("\\","/"),i=a.includes("/")?a.slice(0,a.lastIndexOf("/")):".";if(await zs(i),wn().selectedPath===e.path)wn().selectedPath=null;t(),C.success(`Deleted ${e.name}`)}catch(r){C.error(`Could not delete ${e.name}.`,{detail:ee(r),path:e.path,source:"Files"})}}function Pt(e,t){let o=t.paneId,r=Zl(e);if(o!==void 0&&r){if(r.activeTabId===e&&t.focus===!1)return;mv(e,o)}jt(e,{focus:t.focus!==!1})}async function wi(e,t={}){let o=t.focus!==!1;for(let[a,i]of m.tabs.entries())if(i.documentPath===e){if(t.canvasMode!==void 0)i.session.ui.canvasMode=t.canvasMode;if(Pt(a,t),o)wn().selectedPath=e;return}if(Nw(e)){if(ym(e,t),o)wn().selectedPath=e;hb({name:e.split("/").pop()||e,path:e,root:wn().projectRoot});return}if(e.toLowerCase().endsWith(".csv")){try{if(await ZE(e,t),o)wn().selectedPath=e;hb({name:e.split("/").pop()||e,path:e,root:wn().projectRoot})}catch(a){C.error(`Could not open ${e}.`,{detail:ee(a),path:e,source:"Open File"})}return}let r=p();try{let a=await r.readFile(e);if(!a){if(await Ht(),!fn(e)&&!e.toLowerCase().endsWith(".json"))throw of(e);return}await Ht();let i,s,l=null,c=fn(e);if(c){let d=await jr(e,a);({document:i}=d),{frontmatter:s}=d}else if(e.endsWith(".json"))({document:i,layout:l}=Es(a));else throw of(e);if(_i({id:e,documentPath:e,document:i,...s!=null&&{frontmatter:s},layout:l,source:c?a:null,sourceFormat:c?.name??null,...t.paneId!==void 0&&{paneId:t.paneId},...t.preview===!0&&{preview:!0},...t.focus===!1&&{focus:!1},...t.canvasMode!==void 0&&{canvasMode:t.canvasMode}}),o)wn().selectedPath=e;hb({name:e.split("/").pop()||e,path:e,root:wn().projectRoot})}catch(a){C.error(`Could not open ${e}.`,{detail:ee(a),path:e,source:"Open File"})}}async function Q_(e,t){await wi(t,{focus:!1,paneId:e,preview:!0})}function WE(e){if(cv(e))return;for(let[,t]of m.tabs.entries())if(t.documentPath===e&&!t.doc.dirty){fm(e);return}}function VE(e){for(let t of e)fm(t,{onlyIfChanged:!0})}async function fm(e,t={}){for(let[,o]of m.tabs.entries())if(o.documentPath===e){let r=p(),a=o.doc.dirty,i=()=>!a&&o.doc.dirty||cv(e);try{let s=await r.readFile(e);if(!s)return;if(await Ht(),i())return;if(fn(e)){let{document:l,frontmatter:c}=await jr(e,s);if(i())return;if(t.onlyIfChanged&&Ws(l,o.doc.document)&&Ws(c,o.doc.content.frontmatter))return;o.doc.document=l,o.doc.content.frontmatter=c,o.doc.source=s}else if(e.endsWith(".json")){let l=Es(s);o.doc.layout=l.layout;let c=l.document;if(o.doc.bareRepeaters=Pm(c),t.onlyIfChanged&&Ws(c,o.doc.document))return;o.doc.document=c}o.doc.dirty=!1}catch(s){C.error(`Could not reload ${e} after it changed on disk.`,{detail:ee(s),key:`reload:${e}`,path:e,source:"Files"})}return}}function UE(){Xn({id:"files",title:"Files",level:"project",dock:"navigator",icon:"folder",rail:"developer",render:()=>mt,afterRender:(e,t)=>{O2(t,e.rerender)}})}var Ft={activate:tt,contextMenu:ft,expand:ot,move:nt,newFile:()=>{Ee(".",h)},openProject:()=>{rt("project.open",void 0,"Files")},refresh:()=>{et()},rowHost:it,search:(e)=>{wn().searchQuery=e,h()},select:xe,toggleIgnored:()=>{L2(!ME()),h()},treeHost:st,typeahead:at},w=null,y=null;function O2(e,t){let o=e.querySelector(".panel-content")??e;if(we=t,w&&(w.host!==o||!w.handle.connected()))M2();let r=Ze();if(w)w.handle.update(r);else{let a=me(o,r,Ft);w={handle:a,host:o},a.ready.then(te)}queueMicrotask(te)}function M2(){ke(),w?.handle.dispose(),w=null,y=null,Re(),F.clear(),f=[]}
4
+ export{ub,K_,J_,RD,DD,hw,pw,Y_,ND,AD,hb,zs,pm,OE,ME,L2,PE,FE,jE,Z_,$2,pb,HE,I2,R2,BE,OD,D2,N2,fw,X_,MD,zE,A2,wi,Q_,WE,VE,fm,UE,O2,M2};
5
5
 
6
- //# debugId=AD0D8CA2FFE1F76564756E2164756E21
7
- //# sourceMappingURL=studio-3zge48z4.js.map
6
+ //# debugId=8676482278A725F464756E2164756E21
7
+ //# sourceMappingURL=studio-thj81e98.js.map
@@ -1,5 +1,5 @@
1
- import{n,Z,_}from"./studio-zkq3r91p.js";function y(t){return JSON.parse(JSON.stringify(t))}function Se(t){return t===void 0||t===null?t:y(t)}function oe(t,e){let r=t;for(let o of e){if(r==null)return;r=r[o]}return r}function Lv(t){if(Array.isArray(t))throw TypeError("Cannot insert into a children array; parentPath must point at a node");if(!t.children)t.children=[];if(!Array.isArray(t.children))throw TypeError("Cannot insert into mapped-array children; edit the map template instead");return t.children}function $v(t,e){let{op:r}=e;switch(e.op){case"set-key":{let o=oe(t,e.path);if(!o)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);if(e.value===void 0)delete o[e.key];else o[e.key]=Se(e.value);return}case"insert-child":{l(t,e.parentPath).splice(e.index,0,Se(e.node));return}case"remove-child":{l(t,e.parentPath).splice(e.index,1);return}case"set-child":{l(t,e.parentPath).splice(e.index,1,Se(e.node));return}case"move-child":{P(e);let o=l(t,e.fromParentPath),a=l(t,e.toParentPath),[i]=o.splice(e.fromIndex,1);a.splice(e.toIndex,0,i);return}default:break}throw Error(`unknown-doc-op:${r}`)}function l(t,e){let r=oe(t,e);if(r==null)throw TypeError(`doc-op-node-not-found:${e.join("/")}`);return Lv(r)}function FC(t,e,r,o,a){let i=t.length,c=i<e.length&&t.every((s,u)=>s===e[u]),d=e[i+1];if(!c||e[i]!=="children"||!Z(d))return e;if(a?d<r:d<=r)return e;let h=[...e];return h[i+1]=d+o,h}function P(t){let e=[...t.fromParentPath,"children",t.fromIndex],r=t.toParentPath;if(r.length>=e.length&&e.every((o,a)=>o===r[a]))throw Error(`doc-op-move-into-self:${r.join("/")}`)}function sf(t,e){return t<0?Math.max(e+t,0):Math.min(t,e)}function jC(t,e){let{op:r}=e;switch(b(e),e.op){case"set-key":{let o=oe(t,e.path);if(o===void 0)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);if(!_(o)||Array.isArray(o))throw TypeError(`doc-op-not-a-node:${e.path.join("/")}`);let a=Se(o[e.key]);return a===void 0?{key:e.key,op:"set-key",path:e.path}:{key:e.key,op:"set-key",path:e.path,value:a}}case"insert-child":{let{length:o}=f(t,e.parentPath);return{index:sf(e.index,o),op:"remove-child",parentPath:e.parentPath}}case"remove-child":{let o=x(t,e.parentPath,e.index);return{index:e.index,node:o,op:"insert-child",parentPath:e.parentPath}}case"set-child":{let o=x(t,e.parentPath,e.index);return{index:e.index,node:o,op:"set-child",parentPath:e.parentPath}}case"move-child":{P(e);let o=J(t,e.fromParentPath);m(o,e.fromParentPath,e.fromIndex);let a=f(t,e.toParentPath),i=sf(e.toIndex,a.length-(a===o?1:0));return{fromIndex:i,fromParentPath:FC(e.fromParentPath,e.toParentPath,e.fromIndex,-1,!1),op:"move-child",toIndex:e.fromIndex,toParentPath:FC(e.toParentPath,e.fromParentPath,i,1,!0)}}default:break}throw Error(`unknown-doc-op:${r}`)}function b(t){let e=[];if(t.op==="move-child")e.push([t.fromParentPath,t.fromIndex],[t.toParentPath,t.toIndex]);else if(t.op==="insert-child"||t.op==="remove-child"||t.op==="set-child")e.push([t.parentPath,t.index]);for(let[r,o]of e)if(!Number.isInteger(o))throw TypeError(`doc-op-index:${[...r,"children",String(o)].join("/")}`)}function J(t,e){let r=oe(t,e);return r&&Array.isArray(r.children)?r.children:null}function m(t,e,r){if(!t||r<0||r>=t.length)throw Error(`doc-op-node-not-found:${[...e,"children",r].join("/")}`)}function x(t,e,r){let o=J(t,e);return m(o,e,r),Se(o[r])}function f(t,e){let r=oe(t,e);if(!_(r)||Array.isArray(r))throw Error(`doc-op-node-not-found:${e.join("/")}`);if(r.children===void 0)return[];if(!Array.isArray(r.children))throw TypeError(`doc-op-mapped-children:${e.join("/")}`);return r.children}function ta(t,e){if(t.length>e.length)return!1;return t.every((r,o)=>r===e[o])}function g(t,e){let r=Math.min(t.length,e.length);for(let o=0;o<r;o++){let a=t[o],i=e[o];if(a===i)continue;if(Z(a)&&Z(i))return a-i;return String(a)<String(i)?-1:1}return t.length-e.length}function w(t){let e=[];for(let r of t)if(!t.some((o)=>!v(o,r)&&ta(o,r)))e.push([...r]);return e}function v(t,e){return t.length===e.length&&ta(t,e)}function af(t){let e=t?.at(-1);return t&&t.at(-2)==="children"&&Z(e)?{index:e,parentPath:t.slice(0,-2)}:null}function Qd(t){return af(t)!==null}function Ym(t){return w(t).filter((e)=>Qd(e)).toSorted((e,r)=>g(r,e))}function qx(t){if(Z(t)&&Number.isInteger(t))return t;return n(t)&&/^(?:0|[1-9]\d*)$/.test(t)?Number(t):null}function Gx(t,e,r,o){let a=af(e),i=a&&oe(t,a.parentPath),c=oe(t,r);if(!a||!i||!Array.isArray(i.children)||!c)return null;if(i.children[a.index]===void 0)return null;let d=i===c,h=d&&a.index<o?o-1:o,s=Array.isArray(c.children)?c.children.length:0,u={fromIndex:a.index,fromParentPath:a.parentPath,op:"move-child",toIndex:sf(h,s-(d?1:0)),toParentPath:r},p=jC(t,u);return{forward:u,inverse:p}}
2
- export{Se,oe,Lv,$v,FC,sf,jC,ta,af,Qd,Ym,qx,Gx};
1
+ import{n,Z,_}from"./studio-zsjpsw08.js";function y(t){return JSON.parse(JSON.stringify(t))}function Se(t){return t===void 0||t===null?t:y(t)}function oe(t,e){let r=t;for(let o of e){if(r==null)return;r=r[o]}return r}function Lv(t){if(Array.isArray(t))throw TypeError("Cannot insert into a children array; parentPath must point at a node");if(!t.children)t.children=[];if(!Array.isArray(t.children))throw TypeError("Cannot insert into mapped-array children; edit the map template instead");return t.children}function $v(t,e){let{op:r}=e;switch(e.op){case"set-key":{let o=oe(t,e.path);if(!o)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);if(e.value===void 0)delete o[e.key];else o[e.key]=Se(e.value);return}case"insert-child":{l(t,e.parentPath).splice(e.index,0,Se(e.node));return}case"remove-child":{l(t,e.parentPath).splice(e.index,1);return}case"set-child":{l(t,e.parentPath).splice(e.index,1,Se(e.node));return}case"move-child":{P(e);let o=l(t,e.fromParentPath),a=l(t,e.toParentPath),[i]=o.splice(e.fromIndex,1);a.splice(e.toIndex,0,i);return}default:break}throw Error(`unknown-doc-op:${r}`)}function l(t,e){let r=oe(t,e);if(r==null)throw TypeError(`doc-op-node-not-found:${e.join("/")}`);return Lv(r)}function FC(t,e,r,o,a){let i=t.length,c=i<e.length&&t.every((s,u)=>s===e[u]),d=e[i+1];if(!c||e[i]!=="children"||!Z(d))return e;if(a?d<r:d<=r)return e;let h=[...e];return h[i+1]=d+o,h}function P(t){let e=[...t.fromParentPath,"children",t.fromIndex],r=t.toParentPath;if(r.length>=e.length&&e.every((o,a)=>o===r[a]))throw Error(`doc-op-move-into-self:${r.join("/")}`)}function sf(t,e){return t<0?Math.max(e+t,0):Math.min(t,e)}function jC(t,e){let{op:r}=e;switch(b(e),e.op){case"set-key":{let o=oe(t,e.path);if(o===void 0)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);if(!_(o)||Array.isArray(o))throw TypeError(`doc-op-not-a-node:${e.path.join("/")}`);let a=Se(o[e.key]);return a===void 0?{key:e.key,op:"set-key",path:e.path}:{key:e.key,op:"set-key",path:e.path,value:a}}case"insert-child":{let{length:o}=f(t,e.parentPath);return{index:sf(e.index,o),op:"remove-child",parentPath:e.parentPath}}case"remove-child":{let o=x(t,e.parentPath,e.index);return{index:e.index,node:o,op:"insert-child",parentPath:e.parentPath}}case"set-child":{let o=x(t,e.parentPath,e.index);return{index:e.index,node:o,op:"set-child",parentPath:e.parentPath}}case"move-child":{P(e);let o=J(t,e.fromParentPath);m(o,e.fromParentPath,e.fromIndex);let a=f(t,e.toParentPath),i=sf(e.toIndex,a.length-(a===o?1:0));return{fromIndex:i,fromParentPath:FC(e.fromParentPath,e.toParentPath,e.fromIndex,-1,!1),op:"move-child",toIndex:e.fromIndex,toParentPath:FC(e.toParentPath,e.fromParentPath,i,1,!0)}}default:break}throw Error(`unknown-doc-op:${r}`)}function b(t){let e=[];if(t.op==="move-child")e.push([t.fromParentPath,t.fromIndex],[t.toParentPath,t.toIndex]);else if(t.op==="insert-child"||t.op==="remove-child"||t.op==="set-child")e.push([t.parentPath,t.index]);for(let[r,o]of e)if(!Number.isInteger(o))throw TypeError(`doc-op-index:${[...r,"children",String(o)].join("/")}`)}function J(t,e){let r=oe(t,e);return r&&Array.isArray(r.children)?r.children:null}function m(t,e,r){if(!t||r<0||r>=t.length)throw Error(`doc-op-node-not-found:${[...e,"children",r].join("/")}`)}function x(t,e,r){let o=J(t,e);return m(o,e,r),Se(o[r])}function f(t,e){let r=oe(t,e);if(!_(r)||Array.isArray(r))throw Error(`doc-op-node-not-found:${e.join("/")}`);if(r.children===void 0)return[];if(!Array.isArray(r.children))throw TypeError(`doc-op-mapped-children:${e.join("/")}`);return r.children}function na(t,e){if(t.length>e.length)return!1;return t.every((r,o)=>r===e[o])}function g(t,e){let r=Math.min(t.length,e.length);for(let o=0;o<r;o++){let a=t[o],i=e[o];if(a===i)continue;if(Z(a)&&Z(i))return a-i;return String(a)<String(i)?-1:1}return t.length-e.length}function w(t){let e=[];for(let r of t)if(!t.some((o)=>!v(o,r)&&na(o,r)))e.push([...r]);return e}function v(t,e){return t.length===e.length&&na(t,e)}function af(t){let e=t?.at(-1);return t&&t.at(-2)==="children"&&Z(e)?{index:e,parentPath:t.slice(0,-2)}:null}function eu(t){return af(t)!==null}function Ym(t){return w(t).filter((e)=>eu(e)).toSorted((e,r)=>g(r,e))}function qx(t){if(Z(t)&&Number.isInteger(t))return t;return n(t)&&/^(?:0|[1-9]\d*)$/.test(t)?Number(t):null}function Gx(t,e,r,o){let a=af(e),i=a&&oe(t,a.parentPath),c=oe(t,r);if(!a||!i||!Array.isArray(i.children)||!c)return null;if(i.children[a.index]===void 0)return null;let d=i===c,h=d&&a.index<o?o-1:o,s=Array.isArray(c.children)?c.children.length:0,u={fromIndex:a.index,fromParentPath:a.parentPath,op:"move-child",toIndex:sf(h,s-(d?1:0)),toParentPath:r},p=jC(t,u);return{forward:u,inverse:p}}
2
+ export{Se,oe,Lv,$v,FC,sf,jC,na,af,eu,Ym,qx,Gx};
3
3
 
4
- //# debugId=5049D5BEC82B22A464756E2164756E21
5
- //# sourceMappingURL=studio-ekgtrndg.js.map
4
+ //# debugId=64B70C5F7BA98A9B64756E2164756E21
5
+ //# sourceMappingURL=studio-tpy3rdxn.js.map
@@ -1,8 +1,8 @@
1
- import{ip,pe}from"./studio-7xag4na8.js";var ne=pe(function(be){Object.defineProperty(be,"__esModule",{value:!0});be.bind=void 0;function at(e,r){var{type:t,listener:n,options:o}=r;return e.addEventListener(t,n,o),function i(){e.removeEventListener(t,n,o)}}be.bind=at});var Te=pe(function(k){var N=k&&k.__assign||function(){return N=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o))e[o]=r[o]}return e},N.apply(this,arguments)};Object.defineProperty(k,"__esModule",{value:!0});k.bindAll=void 0;var it=ne();function xe(e){if(typeof e>"u")return;if(typeof e==="boolean")return{capture:e};return e}function ut(e,r){if(r==null)return e;var t=N(N({},e),{options:N(N({},xe(r)),xe(e.options))});return t}function lt(e,r,t){var n=r.map(function(o){var i=ut(o,t);return(0,it.bind)(e,i)});return function o(){n.forEach(function(i){return i()})}}k.bindAll=lt});var R=pe(function(V){Object.defineProperty(V,"__esModule",{value:!0});V.bindAll=V.bind=void 0;var ct=ne();Object.defineProperty(V,"bind",{enumerable:!0,get:function(){return ct.bind}});var st=Te();Object.defineProperty(V,"bindAll",{enumerable:!0,get:function(){return st.bindAll}})});function me(e){if(Array.isArray(e))return e}function ge(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n,o,i,u,l=[],a=!0,c=!1;try{if(i=(t=t.call(e)).next,r===0){if(Object(t)!==t)return;a=!1}else for(;!(a=(n=i.call(t)).done)&&(l.push(n.value),l.length!==r);a=!0);}catch(d){c=!0,o=d}finally{try{if(!a&&t.return!=null&&(u=t.return(),Object(u)!==u))return}finally{if(c)throw o}}return l}}function L(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function X(e,r){if(e){if(typeof e=="string")return L(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?L(e,r):void 0}}function ye(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{ip,pe}from"./studio-0g2sm01j.js";var ne=pe(function(be){Object.defineProperty(be,"__esModule",{value:!0});be.bind=void 0;function at(e,r){var{type:t,listener:n,options:o}=r;return e.addEventListener(t,n,o),function i(){e.removeEventListener(t,n,o)}}be.bind=at});var Te=pe(function(k){var N=k&&k.__assign||function(){return N=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o))e[o]=r[o]}return e},N.apply(this,arguments)};Object.defineProperty(k,"__esModule",{value:!0});k.bindAll=void 0;var it=ne();function xe(e){if(typeof e>"u")return;if(typeof e==="boolean")return{capture:e};return e}function ut(e,r){if(r==null)return e;var t=N(N({},e),{options:N(N({},xe(r)),xe(e.options))});return t}function lt(e,r,t){var n=r.map(function(o){var i=ut(o,t);return(0,it.bind)(e,i)});return function o(){n.forEach(function(i){return i()})}}k.bindAll=lt});var R=pe(function(V){Object.defineProperty(V,"__esModule",{value:!0});V.bindAll=V.bind=void 0;var ct=ne();Object.defineProperty(V,"bind",{enumerable:!0,get:function(){return ct.bind}});var st=Te();Object.defineProperty(V,"bindAll",{enumerable:!0,get:function(){return st.bindAll}})});function me(e){if(Array.isArray(e))return e}function ge(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n,o,i,u,l=[],a=!0,c=!1;try{if(i=(t=t.call(e)).next,r===0){if(Object(t)!==t)return;a=!1}else for(;!(a=(n=i.call(t)).done)&&(l.push(n.value),l.length!==r);a=!0);}catch(d){c=!0,o=d}finally{try{if(!a&&t.return!=null&&(u=t.return(),Object(u)!==u))return}finally{if(c)throw o}}return l}}function L(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function X(e,r){if(e){if(typeof e=="string")return L(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?L(e,r):void 0}}function ye(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B(e,r){return me(e)||ge(e,r)||X(e,r)||ye()}var ot=ip(R());var q="data-pdnd-honey-pot";function z(e){return e instanceof Element&&e.hasAttribute(q)}function G(e){var r=document.elementsFromPoint(e.x,e.y),t=B(r,2),n=t[0],o=t[1];if(!n)return null;if(z(n))return o!==null&&o!==void 0?o:null;return n}function H(e){return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},H(e)}function we(e,r){if(H(e)!="object"||!e)return e;var t;if(typeof Symbol<"u"&&(t=e[Symbol.toPrimitive])!==void 0){var n=t.call(e,r||"default");if(H(n)!="object")return n;throw TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function De(e){var r=we(e,"string");return H(r)=="symbol"?r:r+""}function ol(e,r,t){return(r=De(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var Y=ip(R());var Ae=2147483647;var Oe={inset:"unset",border:"none",padding:0,margin:0,overflow:"visible",color:"inherit",background:"transparent",width:"auto",height:"auto"};function A(e){var r=null;return function t(){if(!r){for(var n=arguments.length,o=Array(n),i=0;i<n;i++)o[i]=arguments[i];var u=e.apply(this,o);r={result:u}}return r.result}}var Z=A(function e(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype.showPopover==="function"});function Ee(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function Se(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Ee(Object(t),!0).forEach(function(n){ol(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ee(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}var U=2,Pe=U/2;function ft(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function dt(e){return{x:e.x-Pe,y:e.y-Pe}}function vt(e){return{x:Math.max(e.x,0),y:Math.max(e.y,0)}}function mt(e){return{x:Math.min(e.x,window.innerWidth-U),y:Math.min(e.y,window.innerHeight-U)}}function je(e){var r=e.client,t=mt(vt(dt(ft(r))));return DOMRect.fromRect({x:t.x,y:t.y,width:U,height:U})}function Ie(e){var r=e.clientRect;return{left:"".concat(r.left,"px"),top:"".concat(r.top,"px"),width:"".concat(r.width,"px"),height:"".concat(r.height,"px")}}function gt(e){var{client:r,clientRect:t}=e;return r.x>=t.x&&r.x<=t.x+t.width&&r.y>=t.y&&r.y<=t.y+t.height}function yt(e){var r=e.initial,t=document.createElement("div");if(t.setAttribute(q,"true"),Z())t.setAttribute("popover","manual");var n=je({client:r});if(Object.assign(t.style,Se(Se({position:"fixed"},Z()?Oe:{zIndex:Ae}),{},{backgroundColor:"transparent",padding:0,margin:0,boxSizing:"border-box",pointerEvents:"auto"},Ie({clientRect:n}))),document.body.appendChild(t),Z())t.showPopover();var o=Y.bind(window,{type:"pointermove",listener:function i(u){var l={x:u.clientX,y:u.clientY};n=je({client:l}),Object.assign(t.style,Ie({clientRect:n}))},options:{capture:!0}});return function i(u){var l=u.current;if(o(),gt({client:l,clientRect:n})){t.remove();return}function a(){c(),t.remove()}var c=Y.bindAll(window,[{type:"pointerdown",listener:a},{type:"pointermove",listener:a},{type:"focusin",listener:a},{type:"focusout",listener:a},{type:"dragstart",listener:a},{type:"dragenter",listener:a},{type:"dragover",listener:a}],{capture:!0})}}function Fe(){var e=null;function r(){return e=null,Y.bind(window,{type:"pointermove",listener:function n(o){e={x:o.clientX,y:o.clientY}},options:{capture:!0}})}function t(){var n=null;return function o(i){var{eventName:u,payload:l}=i;if(u==="onDragStart"){var a=l.location.initial.input,c=e!==null&&e!==void 0?e:{x:a.clientX,y:a.clientY};n=yt({initial:c})}if(u==="onDrop"){var d,f=l.location.current.input;(d=n)===null||d===void 0||d({current:{x:f.clientX,y:f.clientY}}),n=null,e=null}}}return{bindEvents:r,getOnPostDispatch:t}}function He(e){if(Array.isArray(e))return L(e)}function Ce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Me(){throw TypeError(`Invalid attempt to spread non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function J(e){return He(e)||Ce(e)||X(e)||Me()}var Xe=ip(R());var Ne=A(function e(){return navigator.userAgent.includes("Firefox")});var W=A(function e(){var r=navigator,t=r.userAgent;return t.includes("AppleWebKit")&&!t.includes("Chrome")});function bt(e){return"nodeName"in e}function ke(e){return bt(e)&&e.ownerDocument!==document}var We=ip(R());var Q={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};(function e(){if(typeof window>"u")return;if(!W())return;function r(){return{enterCount:0,isOverWindow:!1}}var t=r();function n(){t=r()}We.bindAll(window,[{type:"dragstart",listener:function o(){t.enterCount=0,t.isOverWindow=!0}},{type:"drop",listener:n},{type:"dragend",listener:n},{type:"dragenter",listener:function o(i){if(!t.isOverWindow&&t.enterCount===0)i[Q.isEnteringWindow]=!0;t.isOverWindow=!0,t.enterCount++}},{type:"dragleave",listener:function o(i){if(t.enterCount--,t.isOverWindow&&t.enterCount===0)i[Q.isLeavingWindow]=!0,t.isOverWindow=!1}}],{capture:!0})})();function Ke(e){var r=e.dragLeave;if(!W())return!1;return r.hasOwnProperty(Q.isLeavingWindow)}function Le(e){var r=e.dragLeave,{type:t,relatedTarget:n}=r;if(t!=="dragleave")return!1;if(W())return Ke({dragLeave:r});if(n==null)return!0;if(Ne())return ke(n);return n instanceof HTMLIFrameElement}function Re(e){var r=e.onDragEnd;return[{type:"pointermove",listener:function(){var t=0;return function n(){if(t<20){t++;return}r()}}()},{type:"pointerdown",listener:r}]}function C(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var ht=function e(r){var t=[],n=null,o=function i(){for(var u=arguments.length,l=Array(u),a=0;a<u;a++)l[a]=arguments[a];if(t=l,n)return;n=requestAnimationFrame(function(){n=null,r.apply(void 0,t)})};return o.cancel=function(){if(!n)return;cancelAnimationFrame(n),n=null},o},Ue=ht;var oe=Ue(function(e){return e()}),_=function(){var e=null;function r(n){var o=requestAnimationFrame(function(){e=null,n()});e={frameId:o,fn:n}}function t(){if(e)cancelAnimationFrame(e.frameId),e.fn(),e=null}return{schedule:r,flush:t}}();function Ye(e){var{source:r,initial:t,dispatchEvent:n}=e,o={dropTargets:[]};function i(l){n(l),o={dropTargets:l.payload.location.current.dropTargets}}var u={start:function l(a){var c=a.nativeSetDragImage,d={current:t,previous:o,initial:t};i({eventName:"onGenerateDragPreview",payload:{source:r,location:d,nativeSetDragImage:c}}),_.schedule(function(){i({eventName:"onDragStart",payload:{source:r,location:d}})})},dragUpdate:function l(a){var c=a.current;_.flush(),oe.cancel(),i({eventName:"onDropTargetChange",payload:{source:r,location:{initial:t,previous:o,current:c}}})},drag:function l(a){var c=a.current;oe(function(){_.flush();var d={initial:t,previous:o,current:c};i({eventName:"onDrag",payload:{source:r,location:d}})})},drop:function l(a){var{current:c,updatedSourcePayload:d}=a;_.flush(),oe.cancel(),i({eventName:"onDrop",payload:{source:d!==null&&d!==void 0?d:r,location:{current:c,previous:o,initial:t}}})}};return u}var ie={isActive:!1};function Be(){return!ie.isActive}function xt(e){if(e.dataTransfer)return e.dataTransfer.setDragImage.bind(e.dataTransfer);return null}function Tt(e){var{current:r,next:t}=e;if(r.length!==t.length)return!0;for(var n=0;n<r.length;n++)if(r[n].element!==t[n].element)return!0;return!1}function wt(e){var{event:r,dragType:t,getDropTargetsOver:n,dispatchEvent:o}=e;if(!Be())return;var i=Dt({event:r,dragType:t,getDropTargetsOver:n});ie.isActive=!0;var u={current:i};ae({event:r,current:i.dropTargets});var l=Ye({source:t.payload,dispatchEvent:o,initial:i});function a(s){var p=Tt({current:u.current.dropTargets,next:s.dropTargets});if(u.current=s,p)l.dragUpdate({current:u.current})}function c(s){var p=C(s),m=z(s.target)?G({x:p.clientX,y:p.clientY}):s.target,g=n({target:m,input:p,source:t.payload,current:u.current.dropTargets});if(g.length)s.preventDefault(),ae({event:s,current:g});a({dropTargets:g,input:p})}function d(){if(u.current.dropTargets.length)a({dropTargets:[],input:u.current.input});l.drop({current:u.current,updatedSourcePayload:null}),f()}function f(){ie.isActive=!1,w()}var w=Xe.bindAll(window,[{type:"dragover",listener:function s(p){c(p),l.drag({current:u.current})}},{type:"dragenter",listener:c},{type:"dragleave",listener:function s(p){if(!Le({dragLeave:p}))return;if(a({input:u.current.input,dropTargets:[]}),t.startedFrom==="external")d()}},{type:"drop",listener:function s(p){if(u.current={dropTargets:u.current.dropTargets,input:C(p)},!u.current.dropTargets.length){d();return}p.preventDefault(),ae({event:p,current:u.current.dropTargets}),l.drop({current:u.current,updatedSourcePayload:t.type==="external"?t.getDropPayload(p):null}),f()}},{type:"dragend",listener:function s(p){u.current={dropTargets:u.current.dropTargets,input:C(p)},d()}}].concat(J(Re({onDragEnd:d}))),{capture:!0});l.start({nativeSetDragImage:xt(r)})}function ae(e){var r,{event:t,current:n}=e,o=(r=n[0])===null||r===void 0?void 0:r.dropEffect;if(o!=null&&t.dataTransfer)t.dataTransfer.dropEffect=o}function Dt(e){var{event:r,dragType:t,getDropTargetsOver:n}=e,o=C(r);if(t.startedFrom==="external")return{input:o,dropTargets:[]};var i=n({input:o,source:t.payload,target:r.target,current:[]});return{input:o,dropTargets:i}}var ue={canStart:Be,start:wt};var le=new Map;function At(e){var{typeKey:r,mount:t}=e,n=le.get(r);if(n)return n.usageCount++,n;var o={typeKey:r,unmount:t(),usageCount:1};return le.set(r,o),o}function Ve(e){var r=At(e);return function t(){if(r.usageCount--,r.usageCount>0)return;r.unmount(),le.delete(e.typeKey)}}function zr(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return function n(){r.forEach(function(o){return o()})}}function ee(e,r){var{attribute:t,value:n}=r;return e.setAttribute(t,n),function(){return e.removeAttribute(t)}}function qe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function F(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?qe(Object(t),!0).forEach(function(n){ol(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):qe(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function ce(e,r){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=Ot(e))||r&&e&&typeof e.length=="number"){t&&(e=t);var n=0,o=function a(){};return{s:o,n:function a(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function a(c){throw c},f:o}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
4
4
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,u=!0,l=!1;return{s:function a(){t=t.call(e)},n:function a(){var c=t.next();return u=c.done,c},e:function a(c){l=!0,i=c},f:function a(){try{u||t.return==null||t.return()}finally{if(l)throw i}}}}function Ot(e,r){if(e){if(typeof e=="string")return ze(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ze(e,r):void 0}}function ze(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function se(e){return e.slice(0).reverse()}function Ge(e){var{typeKey:r,defaultDropEffect:t}=e,n=new WeakMap,o="data-drop-target-for-".concat(r),i="[".concat(o,"]");function u(s){return n.set(s.element,s),function(){return n.delete(s.element)}}function l(s){if(!1)var p;var m=zr(ee(s.element,{attribute:o,value:"true"}),u(s));return A(m)}function a(s){var p,m,g,D,{source:y,target:h,input:b,result:T}=s,v=T===void 0?[]:T;if(h==null)return v;if(!(h instanceof Element)){if(h instanceof Node)return a({source:y,target:h.parentElement,input:b,result:v});return v}var P=h.closest(i);if(P==null)return v;var x=n.get(P);if(x==null)return v;var E={input:b,source:y,element:x.element};if(x.canDrop&&!x.canDrop(E))return a({source:y,target:x.element.parentElement,input:b,result:v});var S=(p=(m=x.getData)===null||m===void 0?void 0:m.call(x,E))!==null&&p!==void 0?p:{},j=(g=(D=x.getDropEffect)===null||D===void 0?void 0:D.call(x,E))!==null&&g!==void 0?g:t,O={data:S,element:x.element,dropEffect:j,isActiveDueToStickiness:!1};return a({source:y,target:x.element.parentElement,input:b,result:[].concat(J(v),[O])})}function c(s){var{eventName:p,payload:m}=s,g=ce(m.location.current.dropTargets),D;try{for(g.s();!(D=g.n()).done;){var y,h=D.value,b=n.get(h.element),T=F(F({},m),{},{self:h});b===null||b===void 0||(y=b[p])===null||y===void 0||y.call(b,T)}}catch(v){g.e(v)}finally{g.f()}}var d={onGenerateDragPreview:c,onDrag:c,onDragStart:c,onDrop:c,onDropTargetChange:function s(p){var m=p.payload,g=new Set(m.location.current.dropTargets.map(function(K){return K.element})),D=new Set,y=ce(m.location.previous.dropTargets),h;try{for(y.s();!(h=y.n()).done;){var b,T=h.value;D.add(T.element);var v=n.get(T.element),P=g.has(T.element),x=F(F({},m),{},{self:T});if(v===null||v===void 0||(b=v.onDropTargetChange)===null||b===void 0||b.call(v,x),!P){var E;v===null||v===void 0||(E=v.onDragLeave)===null||E===void 0||E.call(v,x)}}}catch(K){y.e(K)}finally{y.f()}var S=ce(m.location.current.dropTargets),j;try{for(S.s();!(j=S.n()).done;){var O,M,re=j.value;if(D.has(re.element))continue;var ve=F(F({},m),{},{self:re}),I=n.get(re.element);I===null||I===void 0||(O=I.onDropTargetChange)===null||O===void 0||O.call(I,ve),I===null||I===void 0||(M=I.onDragEnter)===null||M===void 0||M.call(I,ve)}}catch(K){S.e(K)}finally{S.f()}}};function f(s){d[s.eventName](s)}function w(s){var{source:p,target:m,input:g,current:D}=s,y=a({source:p,target:m,input:g});if(y.length>=D.length)return y;var h=se(D),b=se(y),T=[];for(var v=0;v<h.length;v++){var P,x=h[v],E=b[v];if(E!=null){T.push(E);continue}var S=T[v-1],j=h[v-1];if((S===null||S===void 0?void 0:S.element)!==(j===null||j===void 0?void 0:j.element))break;var O=n.get(x.element);if(!O)break;var M={input:g,source:p,element:O.element};if(O.canDrop&&!O.canDrop(M))break;if(!((P=O.getIsSticky)!==null&&P!==void 0&&P.call(O,M)))break;T.push(F(F({},x),{},{isActiveDueToStickiness:!0}))}return se(T)}return{dropTargetForConsumers:l,getIsOver:w,dispatchEvent:f}}function Et(e,r){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=St(e))||r&&e&&typeof e.length=="number"){t&&(e=t);var n=0,o=function a(){};return{s:o,n:function a(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function a(c){throw c},f:o}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
5
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,u=!0,l=!1;return{s:function a(){t=t.call(e)},n:function a(){var c=t.next();return u=c.done,c},e:function a(c){l=!0,i=c},f:function a(){try{u||t.return==null||t.return()}finally{if(l)throw i}}}}function St(e,r){if(e){if(typeof e=="string")return Ze(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ze(e,r):void 0}}function Ze(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function $e(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function Pt(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?$e(Object(t),!0).forEach(function(n){ol(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$e(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function Je(){var e=new Set,r=null;function t(i){if(!r)return;if(!i.canMonitor||i.canMonitor(r.canMonitorArgs))r.active.add(i)}function n(i){var u=Pt({},i);e.add(u),t(u);function l(){if(e.delete(u),r)r.active.delete(u)}return A(l)}function o(i){var{eventName:u,payload:l}=i;if(u==="onGenerateDragPreview"){r={canMonitorArgs:{initial:l.location.initial,source:l.source},active:new Set};var a=Et(e),c;try{for(a.s();!(c=a.n()).done;){var d=c.value;t(d)}}catch(g){a.e(g)}finally{a.f()}}if(!r)return;var f=Array.from(r.active);for(var w=0,s=f;w<s.length;w++){var p=s[w];if(r.active.has(p)){var m;(m=p[u])===null||m===void 0||m.call(p,l)}}if(u==="onDrop")r.active.clear(),r=null}return{dispatchEvent:o,monitorForConsumers:n}}function Qe(e){var{typeKey:r,mount:t,dispatchEventToSource:n,onPostDispatch:o,defaultDropEffect:i}=e,u=Je(),l=Ge({typeKey:r,defaultDropEffect:i});function a(f){n===null||n===void 0||n(f),l.dispatchEvent(f),u.dispatchEvent(f),o===null||o===void 0||o(f)}function c(f){var{event:w,dragType:s}=f;ue.start({event:w,dragType:s,getDropTargetsOver:l.getIsOver,dispatchEvent:a})}function d(){function f(){var w={canStart:ue.canStart,start:c};return t(w)}return Ve({typeKey:r,mount:f})}return{registerUsage:d,dropTarget:l.dropTargetForConsumers,monitor:u.monitorForConsumers}}var _e=A(function e(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),et="pdnd:android-fallback";var fe="text/plain";var tt="text/uri-list";var rt="application/vnd.pdnd";var te=new WeakMap;function jt(e){return te.set(e.element,e),function r(){te.delete(e.element)}}var nt=Fe(),de=Qe({typeKey:"element",defaultDropEffect:"move",mount:function e(r){return zr(nt.bindEvents(),ot.bind(document,{type:"dragstart",listener:function t(n){var o,i,u,l,a,c;if(!r.canStart(n))return;if(n.defaultPrevented)return;if(!n.dataTransfer)return;var d=n.target;if(!(d instanceof HTMLElement))return;var f=te.get(d);if(!f)return;var w=C(n),s={element:f.element,dragHandle:(o=f.dragHandle)!==null&&o!==void 0?o:null,input:w};if(f.canDrag&&!f.canDrag(s)){n.preventDefault();return}if(f.dragHandle){var p=G({x:w.clientX,y:w.clientY});if(!f.dragHandle.contains(p)){n.preventDefault();return}}var m=(i=(u=f.getInitialDataForExternal)===null||u===void 0?void 0:u.call(f,s))!==null&&i!==void 0?i:null;if(m)for(var g=0,D=Object.entries(m);g<D.length;g++){var y=B(D[g],2),h=y[0],b=y[1];n.dataTransfer.setData(h,b!==null&&b!==void 0?b:"")}if(_e()&&!n.dataTransfer.types.includes(fe)&&!n.dataTransfer.types.includes(tt))n.dataTransfer.setData(fe,et);n.dataTransfer.setData(rt,"");var T={element:f.element,dragHandle:(l=f.dragHandle)!==null&&l!==void 0?l:null,data:(a=(c=f.getInitialData)===null||c===void 0?void 0:c.call(f,s))!==null&&a!==void 0?a:{}},v={type:"element",payload:T,startedFrom:"internal"};r.start({event:n,dragType:v})}}))},dispatchEventToSource:function e(r){var t,n,{eventName:o,payload:i}=r;(t=te.get(i.source.element))===null||t===void 0||(n=t[o])===null||n===void 0||n.call(t,i)},onPostDispatch:nt.getOnPostDispatch()}),{dropTarget:qs,monitor:Gs}=de;function Wr(e){if(!1)var r;var t=zr(de.registerUsage(),jt(e),ee(e.element,{attribute:"draggable",value:"true"}));return A(t)}export{ol,zr,qs,Gs,Wr};
5
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,u=!0,l=!1;return{s:function a(){t=t.call(e)},n:function a(){var c=t.next();return u=c.done,c},e:function a(c){l=!0,i=c},f:function a(){try{u||t.return==null||t.return()}finally{if(l)throw i}}}}function St(e,r){if(e){if(typeof e=="string")return Ze(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ze(e,r):void 0}}function Ze(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function $e(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function Pt(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?$e(Object(t),!0).forEach(function(n){ol(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$e(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function Je(){var e=new Set,r=null;function t(i){if(!r)return;if(!i.canMonitor||i.canMonitor(r.canMonitorArgs))r.active.add(i)}function n(i){var u=Pt({},i);e.add(u),t(u);function l(){if(e.delete(u),r)r.active.delete(u)}return A(l)}function o(i){var{eventName:u,payload:l}=i;if(u==="onGenerateDragPreview"){r={canMonitorArgs:{initial:l.location.initial,source:l.source},active:new Set};var a=Et(e),c;try{for(a.s();!(c=a.n()).done;){var d=c.value;t(d)}}catch(g){a.e(g)}finally{a.f()}}if(!r)return;var f=Array.from(r.active);for(var w=0,s=f;w<s.length;w++){var p=s[w];if(r.active.has(p)){var m;(m=p[u])===null||m===void 0||m.call(p,l)}}if(u==="onDrop")r.active.clear(),r=null}return{dispatchEvent:o,monitorForConsumers:n}}function Qe(e){var{typeKey:r,mount:t,dispatchEventToSource:n,onPostDispatch:o,defaultDropEffect:i}=e,u=Je(),l=Ge({typeKey:r,defaultDropEffect:i});function a(f){n===null||n===void 0||n(f),l.dispatchEvent(f),u.dispatchEvent(f),o===null||o===void 0||o(f)}function c(f){var{event:w,dragType:s}=f;ue.start({event:w,dragType:s,getDropTargetsOver:l.getIsOver,dispatchEvent:a})}function d(){function f(){var w={canStart:ue.canStart,start:c};return t(w)}return Ve({typeKey:r,mount:f})}return{registerUsage:d,dropTarget:l.dropTargetForConsumers,monitor:u.monitorForConsumers}}var _e=A(function e(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),et="pdnd:android-fallback";var fe="text/plain";var tt="text/uri-list";var rt="application/vnd.pdnd";var te=new WeakMap;function jt(e){return te.set(e.element,e),function r(){te.delete(e.element)}}var nt=Fe(),de=Qe({typeKey:"element",defaultDropEffect:"move",mount:function e(r){return zr(nt.bindEvents(),ot.bind(document,{type:"dragstart",listener:function t(n){var o,i,u,l,a,c;if(!r.canStart(n))return;if(n.defaultPrevented)return;if(!n.dataTransfer)return;var d=n.target;if(!(d instanceof HTMLElement))return;var f=te.get(d);if(!f)return;var w=C(n),s={element:f.element,dragHandle:(o=f.dragHandle)!==null&&o!==void 0?o:null,input:w};if(f.canDrag&&!f.canDrag(s)){n.preventDefault();return}if(f.dragHandle){var p=G({x:w.clientX,y:w.clientY});if(!f.dragHandle.contains(p)){n.preventDefault();return}}var m=(i=(u=f.getInitialDataForExternal)===null||u===void 0?void 0:u.call(f,s))!==null&&i!==void 0?i:null;if(m)for(var g=0,D=Object.entries(m);g<D.length;g++){var y=B(D[g],2),h=y[0],b=y[1];n.dataTransfer.setData(h,b!==null&&b!==void 0?b:"")}if(_e()&&!n.dataTransfer.types.includes(fe)&&!n.dataTransfer.types.includes(tt))n.dataTransfer.setData(fe,et);n.dataTransfer.setData(rt,"");var T={element:f.element,dragHandle:(l=f.dragHandle)!==null&&l!==void 0?l:null,data:(a=(c=f.getInitialData)===null||c===void 0?void 0:c.call(f,s))!==null&&a!==void 0?a:{}},v={type:"element",payload:T,startedFrom:"internal"};r.start({event:n,dragType:v})}}))},dispatchEventToSource:function e(r){var t,n,{eventName:o,payload:i}=r;(t=te.get(i.source.element))===null||t===void 0||(n=t[o])===null||n===void 0||n.call(t,i)},onPostDispatch:nt.getOnPostDispatch()}),{dropTarget:Gs,monitor:Ks}=de;function Wr(e){if(!1)var r;var t=zr(de.registerUsage(),jt(e),ee(e.element,{attribute:"draggable",value:"true"}));return A(t)}export{ol,zr,Gs,Ks,Wr};
6
6
 
7
- //# debugId=31631FFB85617B5464756E2164756E21
8
- //# sourceMappingURL=studio-ewarnzm4.js.map
7
+ //# debugId=8970FD6068B07C0064756E2164756E21
8
+ //# sourceMappingURL=studio-va0e63sk.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-w67vfgy5.js";import{Si}from"./studio-4nkm4404.js";import{us}from"./studio-pd9dsqpq.js";import{nn}from"./studio-5dmgmyw4.js";import{Vc,mA,jb}from"./studio-20ap8dds.js";import{Z}from"./studio-zsjpsw08.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 Dd(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:Vc({name:n}),modified:t?.modified??null,name:n,path:e,width:i?.width??null}}function Nd(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&&Dd(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{Dd,Nd,oN,qu,_p,rN,WT,Aw};
3
3
 
4
- //# debugId=58C7A99D10AD2EBC64756E2164756E21
5
- //# sourceMappingURL=studio-gr36vnte.js.map
4
+ //# debugId=29B3B3660CB5A14B64756E2164756E21
5
+ //# sourceMappingURL=studio-vcz63n42.js.map
@@ -0,0 +1,5 @@
1
+ import{p,_e}from"./studio-w67vfgy5.js";import{ae}from"./studio-f2j9et3h.js";import{vA}from"./studio-8x8616xd.js";import{C}from"./studio-ahf3cspq.js";import{Qn}from"./studio-cvz0e00f.js";import{ee}from"./studio-et6t8g4m.js";import{mO,Vn,Ce,hi}from"./studio-j933k8nr.js";import{Em,u}from"./studio-dbgv4fv9.js";import{zl,Cb,Ri,Ad,SS}from"./studio-zxm98z2m.js";import{Us}from"./studio-qyb5bebs.js";import{ks,Vs,sT}from"./studio-vxjap704.js";import{as}from"./studio-s0fg2wav.js";import{S}from"./studio-rt498t2v.js";import{le}from"./studio-0g2sm01j.js";var k={attempts:6,delayMs:5000};function A(e,t){return`https://dash.cloudflare.com/${e}/pages/view/${t}`}async function B(e){if(e>0)await new Promise((t)=>{setTimeout(t,e)})}async function y(e={}){let t=Ri(),r=new AbortController,i=Us({cancel:()=>{r.abort()},source:"Publish",status:"Starting…",steps:["Push to the remote","Ask Cloudflare for the deployment"],title:"Deploy"});i.step("Push to the remote");try{await p().gitPush({setUpstream:!0}),i.log("Pushed the current branch.")}catch(s){return i.log(ee(s)),i.fail("Could not push to the remote.",{action:"git.push"}),!1}if(!t)return i.done("Pushed. No provider is connected, so nothing was asked to build it."),!0;i.step("Ask Cloudflare for the deployment");let n=e.attempts??k.attempts,l=e.delayMs??k.delayMs;for(let s=0;s<n;s+=1){if(r.signal.aborted)return!1;let a;try{a=await Cb(t)}catch(o){return i.log(ee(o)),i.fail("Cloudflare did not answer.",{action:"publish.deploy"}),!1}if(a)return Ad(a),i.log(`${a.stage}: ${a.status} — ${a.url}`),i.done(`${a.stage}: ${a.status}`),!0;await B(l)}if(r.signal.aborted)return!1;return Ad(null),i.done("Pushed. Cloudflare has not reported a deployment yet."),!0}function q(){return[{category:"Publish",id:"publish.setUp",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"an open project on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>e.capability.publish,run:async()=>{let{openPublishPanel:e}=await (le("evb1rcxt"),import("./publish-panel-evb1rcxt.js"));e()},title:"Set Up Publishing"},{category:"Publish",id:"publish.deploy",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a repository with a remote and a connected deploy provider, on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>e.project.isRepo&&Ri()!==void 0&&e.capability.publish,run:async()=>{await y()},title:"Deploy"},{category:"Publish",id:"publish.openDashboard",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a connected deploy provider, on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>Ri()!==void 0&&e.capability.publish,run:()=>{let e=Ri();if(e)window.open(A(e.accountId,e.projectName),"_blank","noopener")},title:"Open Deployment Dashboard"},{category:"Publish",id:"publish.quick",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a project tracked by git",when:(e)=>e.project.open,enablement:(e)=>e.project.isRepo,run:async()=>{let{openQuickPublish:e}=await (le("m9vkhahq"),import("./publish-quick-m9vkhahq.js"));e()},title:"Quick Publish"},{args:Ce({tab:hi(Em,"Which view of the Publish workspace to show: review (the changes and where they go), deploys (the live site and its deployments), branches, or hosting (where the project is saved and hosted). Defaults to the view the workspace was left on.")},[]),category:"Publish",id:"publish.open",level:"project",menus:["never"],group:"8_publish",requires:"an open project",enablement:(e)=>e.project.open,run:async(e,t)=>{let r=t.tab===void 0?null:Vn("publish.open",t,"tab",Em),i=ae();if(!i)throw Error(`command "publish.open" needs the window's command registry`);if(await i.run("view.setWorkspace",{workspace:"publish"}),r!==null){let{showPublishTab:n}=await (le("ktk9h536"),import("./publish-workspace-ktk9h536.js"));n(r)}},title:"Show Publish"}]}function iR(e){e.registerAll(q())}function d(){let e=u.git.status?.remotes;return Array.isArray(e)&&e.length>0?e[0]??"":""}function h(){return u.git.branches?.current||u.git.status?.branch||""}function P(){return Ri()!==void 0&&zl()&&d()!==""}function R(){let e=Ri();return e?.productionUrl??e?.projectName??""}function b(e){return`studio/${as(e).replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"").slice(0,48).replace(/-$/,"")||"changes"}`}function x(){return _e()&&p().gitCommitBranch!==void 0}function v(){let e=f();return Vs()&&x()&&e!==""&&h()===e}function f(){return u.git.branches?.defaultBranch??""}function Hg(){if(!sT())return"This host cannot open a pull request yet. Publish live, or create a branch under Branches and push it.";if(Vs()){let e=f(),t=h();if(v())return"";if(!e||!t||t===e)return`Every commit to ${e||"the default branch"} on this host is live. Create a branch under Branches and send it for review from there.`;return""}if(d()==="")return"A pull request needs a remote. Create the GitHub repository under Hosting first.";return""}function T(){let e=h()||"the current branch";if(P())return`Commits to ${e} and deploys to ${R()}.`;if(Vs())return`Commits to ${e} on GitHub.`;let t=d();return t?`Commits to ${e} and pushes it to ${t}.`:`Commits to ${e}. This repository has no remote, so nothing leaves this machine.`}function M(){let e=h()||"the current branch",t=u.git.commitMessage.trim(),r=t?b(t):"a new studio/ branch";if(v())return`Saves to ${r} on GitHub and opens a pull request into ${e}.`;if(Vs())return`Commits to ${e} and opens a pull request from it into ${f()||"the default branch"}.`;return`Saves to ${r}, pushes it and opens a pull request into ${e}.`}function Ty(e){let t=Hg();return[{checked:e==="live"?"true":"false",disabled:!1,label:"Publish live",note:T(),reason:"",value:"live"},{checked:e==="review"?"true":"false",disabled:t!=="",label:"Send for review",note:M(),reason:t,value:"review"}]}function qf(e){return e==="review"&&Hg()!==""?"live":e}function oR(e){if(e==="review")return"Send for review";if(P())return"Publish live";return Vs()||d()!==""?"Commit and push":"Commit"}function D(e){let t=u.git.status?.files??[];return e?t:t.filter((r)=>Boolean(r.staged))}function Gf(e,t=!1){let{status:r}=u.git;if(!S||!r?.isRepo)return"Track this project with git first.";if(u.git.loading)return"Source control is busy.";if(r.files.length===0)return"There is nothing to publish.";if(D(t).length===0)return"Include at least one change.";if(!u.git.commitMessage.trim())return"Write a summary of the change first.";return e==="review"?Hg():""}function j(){return(u.git.status?.files??[]).map((e)=>`${e.status}:${e.path}`).join("|")}function s_(){return _e()&&p().buildSite!==void 0}async function rR(){if(!s_()||u.publish.build.state==="running")return;let e=p().buildSite;if(!e)return;u.publish.build.state="running",u.publish.build.text="Building the site…",u.publish.build.for=j();try{let t=await e();if(t.errors.length>0)u.publish.build.state="failed",u.publish.build.text=`Built with ${t.errors.length} error(s): ${t.errors[0]}`;else u.publish.build.state="passed",u.publish.build.text=t.mode==="live"?`${t.routes} page(s) render. This host previews the working tree; it does not build.`:`Site builds: ${t.routes} page(s).`}catch(t){u.publish.build.state="failed",u.publish.build.text=`The site could not be built: ${ee(t)}`}}function Bg(){let e=[],t=SS();if(e.push(t?{command:t.command,key:"deploy",state:t.state==="unknown"?"unknown":"todo",text:`${t.label}: ${t.detail}`}:{command:"",key:"deploy",state:"done",text:"Everything this project needs to ship is in place."}),s_()){let r=u.publish.build.for===j()||u.publish.build.state==="running";e.push(r&&u.publish.build.state!=="idle"?{command:"",key:"build",state:u.publish.build.state==="passed"?"done":u.publish.build.state==="failed"?"failed":"running",text:u.publish.build.text}:{command:"",key:"build",state:"unknown",text:"The site has not been built with these changes."})}return e}function sR(e){let t=e.filter((r)=>r.state!=="done");if(t.length===0)return"Checks passed: ready to publish.";return t.map((r)=>r.text).join(" · ")}function aR(){return u.publish.review.number>0?{number:u.publish.review.number,url:u.publish.review.url}:null}function w(e){if(!u.git.commitMessage)u.git.commitMessage=e}async function Ly(e,t={}){let r=t.includeAll??!1,i=Gf(e,r);if(i)return u.git.error=i,!1;let n=u.git.commitMessage.trim(),l=p();u.git.commitMessage="",u.git.loading=!0,u.git.error=null,await mO();let s=!1,a=!0;try{if(r){let o=D(!0).filter((c)=>!c.staged).map((c)=>c.path);if(o.length>0)await l.gitStage(o)}if(e==="review")await L(l,n,()=>{s=!0});else if(await l.gitCommit(n),s=!0,P())u.git.loading=!1,a=await y();else if(!Vs()&&d()!=="")await l.gitPush();return await ks(),a}catch(o){let c=s?null:vA(o);if(c&&x()){if(u.git.loading=!1,await G(n,c))return!0;return u.git.error??=ee(o),!1}if(u.git.error=ee(o),u.git.loading=!1,!s)w(n);return!1}}function _(e){let t=e.slice(0,3).join(", ");return e.length>3?`${t} and ${e.length-3} more`:t}async function G(e,t){let r=p(),i=r.gitCommitBranch;if(!i)return!1;let n=h()||"this branch",l=t.length===1?"1 file":`${t.length} files`,s=await Qn("Publish to a New Branch",{confirmLabel:"Publish to branch",message:`${n} changed on GitHub after these edits began, and ${l} changed on both sides (${_(t)}). Publish your changes to a branch of their own instead, and a pull request will bring them into ${n}.`,value:b(e),validate:(o)=>o.trim()?"":"Enter a branch name."});if(!s)return w(e),!1;u.git.loading=!0,u.git.error=null;let a=!1;try{let o=await i({branch:s,message:e});a=!0;let c=r.createPullRequest,g=h(),m=c&&g?await c({base:g,head:o.branch,title:e}):null;if(m)u.publish.review.number=m.number,u.publish.review.url=m.url;C.success(m?`Published to ${o.branch}. Pull request #${m.number} brings it into ${g}.`:`Published to ${o.branch}.`,{detail:m?.url??"",key:"publish.branch",source:"Publish"});try{await r.gitPull()}catch{}return await ks(),!0}catch(o){if(u.git.error=ee(o),u.git.loading=!1,!a)w(e);return!1}}async function H(e,t,r){if(v()&&e.gitCommitBranch){let l=h(),{branch:s}=await e.gitCommitBranch({branch:b(t),message:t});return r(),{base:l,head:s,title:t}}if(Vs()){await e.gitCommit(t),r();let l=f();return l?{base:l,title:t}:{title:t}}let i=h(),n=b(t);return await e.gitCreateBranch(n),await e.gitCommit(t),r(),await e.gitPush({setUpstream:!0}),i?{base:i,head:n,title:t}:{head:n,title:t}}async function L(e,t,r){let i=e.createPullRequest;if(!i)throw Error(Hg());let n=await i(await H(e,t,r));u.publish.review.number=n.number,u.publish.review.url=n.url,C.success(`Pull request #${n.number} opened for review.`,{detail:n.url,key:"publish.review",source:"Publish"})}
2
+ export{iR,Hg,Ty,qf,oR,Gf,s_,rR,Bg,sR,aR,Ly};
3
+
4
+ //# debugId=E4F824BF6EA8F6DD64756E2164756E21
5
+ //# sourceMappingURL=studio-vffwe9k7.js.map