@jxsuite/studio 5.5.0 → 5.6.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 (221) hide show
  1. package/LICENSE +1 -1
  2. package/dist/chunks/{2020-g8mwpbkq.js → 2020-zvax9fmb.js} +3 -3
  3. package/dist/chunks/adapter-6zhjbpmd.js +4 -0
  4. package/dist/chunks/cf-account-picker-zfycs4k2.js +4 -0
  5. package/dist/chunks/cf-settings-fpa485q3.js +4 -0
  6. package/dist/chunks/components-b0vh4sq8.js +4 -0
  7. package/dist/chunks/content-source-z5t0d0h9.js +4 -0
  8. package/dist/chunks/convert-to-repeater-x19jr6c7.js +4 -0
  9. package/dist/chunks/editor-7e23n4a8.js +4 -0
  10. package/dist/chunks/entry-commands-5cm6aba2.js +4 -0
  11. package/dist/chunks/extension-sections-y90sa0n4.js +4 -0
  12. package/dist/chunks/file-ops-hv7gf757.js +4 -0
  13. package/dist/chunks/files-kb0epdxf.js +4 -0
  14. package/dist/chunks/format-host-eg1wy2bp.js +4 -0
  15. package/dist/chunks/fs-events-ky3vxfmh.js +4 -0
  16. package/dist/chunks/git-panel-yyg3bzp2.js +4 -0
  17. package/dist/chunks/grid-view-5mqv1cbd.css +1 -0
  18. package/dist/chunks/grid-view-d9mybhn0.js +51 -0
  19. package/dist/chunks/iframe-host-9wdf0hes.js +4 -0
  20. package/dist/chunks/index-2tf0m2ne.js +4 -0
  21. package/dist/chunks/{index-arg188jq.js → index-vnwy9d44.js} +3 -3
  22. package/dist/chunks/{javascript-zcdmye2k.js → javascript-f0nrbdjb.js} +2 -2
  23. package/dist/chunks/{jsonMode-6x5e1nbf.js → jsonMode-nfa90dtf.js} +5 -5
  24. package/dist/chunks/jx-validate-7w11db9v.js +4 -0
  25. package/dist/chunks/layers-7zasrpse.js +4 -0
  26. package/dist/chunks/layers-panel-9nzc4fdq.js +4 -0
  27. package/dist/chunks/lit-html-5qr7nbng.js +4 -0
  28. package/dist/chunks/media-picker-maevn9d4.js +4 -0
  29. package/dist/chunks/menu-wq6q0v3y.js +4 -0
  30. package/dist/chunks/{monaco-binding-4az2kh5p.js → monaco-binding-antn79jf.js} +3 -3
  31. package/dist/chunks/monaco-buffer-9ry2rn5x.js +4 -0
  32. package/dist/chunks/{monaco-setup-d7mwkcx3.js → monaco-setup-k8s40vwg.js} +3 -3
  33. package/dist/chunks/notify-g91gjd6w.js +4 -0
  34. package/dist/chunks/platform-jdwjp2vt.js +4 -0
  35. package/dist/chunks/publish-panel-8yym447p.js +4 -0
  36. package/dist/chunks/quick-search-9bzm9kh3.js +4 -0
  37. package/dist/chunks/references-znssfqvq.js +4 -0
  38. package/dist/chunks/right-panel-czbzktm8.js +4 -0
  39. package/dist/chunks/section-registry-0rtq73qs.js +4 -0
  40. package/dist/chunks/studio-011em5cf.js +5 -0
  41. package/dist/chunks/studio-02y9cb4h.js +6 -0
  42. package/dist/chunks/{studio-7gqyhjns.js → studio-09n3fyy0.js} +4 -4
  43. package/dist/chunks/{studio-xcng8nx7.js → studio-0c3fpdqj.js} +5 -5
  44. package/dist/chunks/studio-0mm38y62.js +5 -0
  45. package/dist/chunks/studio-0nm2skex.js +4 -0
  46. package/dist/chunks/{studio-73czgk6a.js → studio-153mwkyq.js} +4 -4
  47. package/dist/chunks/{studio-f8jyp45j.js → studio-1pxvgx1t.js} +4 -4
  48. package/dist/chunks/studio-27tc8q0h.js +5 -0
  49. package/dist/chunks/studio-28pz4s1k.js +5 -0
  50. package/dist/chunks/{studio-x5esgzct.js → studio-36s6qjgq.js} +4 -4
  51. package/dist/chunks/studio-4yztve2t.js +5 -0
  52. package/dist/chunks/{studio-x9sagq2d.js → studio-5fc0728f.js} +7 -7
  53. package/dist/chunks/{studio-7jazdy6y.js → studio-654fxcr0.js} +4 -4
  54. package/dist/chunks/studio-6exg5z4x.js +4 -0
  55. package/dist/chunks/studio-6k1eswp9.js +5 -0
  56. package/dist/chunks/{studio-5wfrgee9.js → studio-6zyt56ek.js} +4 -4
  57. package/dist/chunks/studio-7djymzt2.js +5 -0
  58. package/dist/chunks/{studio-b4epb26c.js → studio-7w04zw8h.js} +7 -7
  59. package/dist/chunks/studio-805fwp9k.js +5 -0
  60. package/dist/chunks/{studio-k1eaqyzm.js → studio-81twpmzj.js} +4 -4
  61. package/dist/chunks/studio-891t1tv9.js +5 -0
  62. package/dist/chunks/{studio-5n1km79v.js → studio-9n2j9nqk.js} +4 -4
  63. package/dist/chunks/{studio-he2fhrgp.js → studio-9tkaykt5.js} +4 -4
  64. package/dist/chunks/studio-ant1zbp3.js +5 -0
  65. package/dist/chunks/studio-b29h7g7s.js +5 -0
  66. package/dist/chunks/studio-b5rxwkj2.js +5 -0
  67. package/dist/chunks/studio-d007j0z3.js +7 -0
  68. package/dist/chunks/studio-dknr8m7b.js +14 -0
  69. package/dist/chunks/{studio-eq27rrr0.js → studio-dmymvk2j.js} +3 -3
  70. package/dist/chunks/studio-dtmdjmqb.js +5 -0
  71. package/dist/chunks/studio-eb5sty2k.js +5 -0
  72. package/dist/chunks/{studio-hc9q4j24.js → studio-ebt49j3c.js} +5 -5
  73. package/dist/chunks/studio-eegyf5vg.js +5 -0
  74. package/dist/chunks/studio-frv7vjhw.js +5 -0
  75. package/dist/chunks/studio-ft8pfpp0.js +5 -0
  76. package/dist/chunks/{studio-mhhc9btt.js → studio-gj4j9e7k.js} +4 -4
  77. package/dist/chunks/{studio-hf4qdjc8.js → studio-gxna6yta.js} +4 -4
  78. package/dist/chunks/studio-je15p5v8.js +6 -0
  79. package/dist/chunks/{studio-21enxdr8.js → studio-jsr14n1s.js} +4 -4
  80. package/dist/chunks/studio-k9pwvmz8.js +5 -0
  81. package/dist/chunks/{studio-p1eggxcf.js → studio-ks0ecgjx.js} +3 -3
  82. package/dist/chunks/studio-mb8jhtr4.js +64 -0
  83. package/dist/chunks/studio-mf41717j.js +5 -0
  84. package/dist/chunks/{studio-625ezz59.js → studio-mm8x32gg.js} +4 -4
  85. package/dist/chunks/{studio-pkkw32j0.js → studio-n2e133d6.js} +4 -4
  86. package/dist/chunks/{studio-c4pnt1c6.js → studio-njmg0e73.js} +5 -5
  87. package/dist/chunks/studio-nvykrgbj.js +4 -0
  88. package/dist/chunks/studio-nw4q9sdn.js +5 -0
  89. package/dist/chunks/studio-p6avneaq.js +5 -0
  90. package/dist/chunks/studio-pvj970st.js +5 -0
  91. package/dist/chunks/studio-r7yeeqc4.js +5 -0
  92. package/dist/chunks/studio-s85vah66.js +6 -0
  93. package/dist/chunks/studio-sadckcpp.js +7 -0
  94. package/dist/chunks/studio-sgzss898.js +9 -0
  95. package/dist/chunks/{studio-7by9a93k.js → studio-t0v47dpc.js} +4 -4
  96. package/dist/chunks/{studio-jnb285we.js → studio-tj28pxa1.js} +4 -4
  97. package/dist/chunks/{studio-6j2jn55a.js → studio-tzs6njnb.js} +8 -8
  98. package/dist/chunks/studio-vz7b43ng.js +5 -0
  99. package/dist/chunks/studio-w8w9frjy.js +16 -0
  100. package/dist/chunks/{studio-xc8ebsts.js → studio-wr0pq67n.js} +4 -4
  101. package/dist/chunks/{studio-8r4y2x0z.js → studio-y164brht.js} +4 -4
  102. package/dist/chunks/studio-y17505ge.js +928 -0
  103. package/dist/chunks/studio-ymsjnvp9.js +5 -0
  104. package/dist/chunks/studio-z1vdxq0e.js +5 -0
  105. package/dist/chunks/studio-z47mm077.js +10 -0
  106. package/dist/chunks/studio-zkkdbbvd.js +9 -0
  107. package/dist/chunks/{studio-awqghqxv.js → studio-zkvyd3ev.js} +4 -4
  108. package/dist/chunks/{tsMode-rtwt7w1a.js → tsMode-eq26t9gs.js} +5 -5
  109. package/dist/chunks/workspace-emt8454d.js +4 -0
  110. package/dist/chunks/ws-client-3gxqp06s.js +4 -0
  111. package/dist/iframe-entry.js +14 -14
  112. package/dist/manifest.json +62 -59
  113. package/dist/studio.css +1 -1
  114. package/dist/studio.js +115 -117
  115. package/package.json +5 -5
  116. package/src/account/action-flow.ts +294 -0
  117. package/src/account/action-required.ts +68 -0
  118. package/src/account-status.ts +29 -1
  119. package/src/browse/library-model.ts +3 -1
  120. package/src/browse/library-preview.ts +6 -2
  121. package/src/canvas/asset-refs.ts +3 -1
  122. package/src/canvas/asset-resolve.ts +79 -1
  123. package/src/canvas/iframe-entry.ts +38 -1
  124. package/src/canvas/iframe-host.ts +85 -0
  125. package/src/canvas/iframe-protocol.ts +13 -0
  126. package/src/files/asset-versions.ts +294 -0
  127. package/src/files/files.ts +61 -9
  128. package/src/files/fs-events.ts +279 -28
  129. package/src/files/media-meta.ts +2 -1
  130. package/src/files/media-paths.ts +5 -2
  131. package/src/files/media-upload.ts +5 -1
  132. package/src/new-project/add-repo-modal.ts +12 -1
  133. package/src/new-project/new-project-modal.ts +12 -1
  134. package/src/panels/git-panel.ts +25 -2
  135. package/src/platform-errors.ts +61 -1
  136. package/src/platforms/cloud.ts +389 -50
  137. package/src/platforms/devserver.ts +17 -1
  138. package/src/publish/pages-service.ts +17 -7
  139. package/src/services/ai-models.ts +30 -6
  140. package/src/services/ai-system-prompt.ts +81 -51
  141. package/src/settings/preferences-accounts.ts +42 -3
  142. package/src/settings/preferences-dialog.ts +8 -1
  143. package/src/studio.ts +18 -1
  144. package/src/surfaces/dialog.ts +5 -0
  145. package/src/surfaces/welcome.json +86 -1
  146. package/src/surfaces/welcome.ts +61 -2
  147. package/src/types.ts +84 -2
  148. package/src/ui/ai-managed-connect.ts +41 -4
  149. package/src/ui/media-picker.ts +2 -1
  150. package/dist/chunks/adapter-bsbs78x9.js +0 -4
  151. package/dist/chunks/cf-account-picker-gnm7xeqb.js +0 -4
  152. package/dist/chunks/cf-settings-9y6jyscp.js +0 -4
  153. package/dist/chunks/components-s51h3b7c.js +0 -4
  154. package/dist/chunks/content-source-ty3be0qg.js +0 -4
  155. package/dist/chunks/convert-to-repeater-c3e7q61z.js +0 -4
  156. package/dist/chunks/editor-t002b41m.js +0 -4
  157. package/dist/chunks/entry-commands-sb72e9gy.js +0 -4
  158. package/dist/chunks/extension-sections-ktn2ntnj.js +0 -4
  159. package/dist/chunks/file-ops-78zeytkm.js +0 -4
  160. package/dist/chunks/files-gatzrz8v.js +0 -4
  161. package/dist/chunks/format-host-r59b1651.js +0 -4
  162. package/dist/chunks/fs-events-f8h91ndt.js +0 -4
  163. package/dist/chunks/git-panel-y12zf7nj.js +0 -4
  164. package/dist/chunks/grid-view-rfd8b2pg.js +0 -51
  165. package/dist/chunks/grid-view-tafenfm2.css +0 -1
  166. package/dist/chunks/iframe-host-vsrsj20g.js +0 -4
  167. package/dist/chunks/index-5aghyrfh.js +0 -4
  168. package/dist/chunks/jx-validate-653krkrf.js +0 -4
  169. package/dist/chunks/layers-32p8gtae.js +0 -4
  170. package/dist/chunks/layers-panel-rs58m105.js +0 -4
  171. package/dist/chunks/lit-html-54bmkwz3.js +0 -4
  172. package/dist/chunks/media-picker-5bb04wct.js +0 -4
  173. package/dist/chunks/menu-cbha7w2e.js +0 -4
  174. package/dist/chunks/monaco-buffer-9vbbyfr1.js +0 -4
  175. package/dist/chunks/notify-dc1nz5ar.js +0 -4
  176. package/dist/chunks/platform-2m49s1zf.js +0 -4
  177. package/dist/chunks/publish-panel-nx3ycmma.js +0 -4
  178. package/dist/chunks/quick-search-yzrzh9x3.js +0 -4
  179. package/dist/chunks/references-vx7mbj9f.js +0 -4
  180. package/dist/chunks/right-panel-7jzpbxja.js +0 -4
  181. package/dist/chunks/section-registry-gjryse41.js +0 -4
  182. package/dist/chunks/studio-3znfhcxg.js +0 -5
  183. package/dist/chunks/studio-58qam27v.js +0 -4
  184. package/dist/chunks/studio-6j59fwaw.js +0 -5
  185. package/dist/chunks/studio-7z69g1gx.js +0 -5
  186. package/dist/chunks/studio-93j3v6zx.js +0 -5
  187. package/dist/chunks/studio-9gf6v8zy.js +0 -5
  188. package/dist/chunks/studio-9rhmettf.js +0 -4
  189. package/dist/chunks/studio-ac5aq677.js +0 -10
  190. package/dist/chunks/studio-as65vbns.js +0 -5
  191. package/dist/chunks/studio-bkv0sga4.js +0 -6
  192. package/dist/chunks/studio-bttmqef4.js +0 -5
  193. package/dist/chunks/studio-c3y9d41k.js +0 -5
  194. package/dist/chunks/studio-ccegp7gz.js +0 -9
  195. package/dist/chunks/studio-chxabn98.js +0 -6
  196. package/dist/chunks/studio-cktcdsxz.js +0 -16
  197. package/dist/chunks/studio-cnspfke5.js +0 -5
  198. package/dist/chunks/studio-de3p1ktm.js +0 -5
  199. package/dist/chunks/studio-fsbcn530.js +0 -928
  200. package/dist/chunks/studio-gftga7a3.js +0 -64
  201. package/dist/chunks/studio-hf1rpcq0.js +0 -4
  202. package/dist/chunks/studio-hz02hq70.js +0 -5
  203. package/dist/chunks/studio-jsv3s3s1.js +0 -5
  204. package/dist/chunks/studio-ks7cksh0.js +0 -5
  205. package/dist/chunks/studio-nptx0dbs.js +0 -5
  206. package/dist/chunks/studio-pg0z7k98.js +0 -5
  207. package/dist/chunks/studio-pve0b2f2.js +0 -5
  208. package/dist/chunks/studio-q7zmjv3b.js +0 -6
  209. package/dist/chunks/studio-rpmvw7kj.js +0 -5
  210. package/dist/chunks/studio-rwhss52s.js +0 -5
  211. package/dist/chunks/studio-sbg3g3h0.js +0 -5
  212. package/dist/chunks/studio-sq1bn60g.js +0 -14
  213. package/dist/chunks/studio-vwz7rma2.js +0 -5
  214. package/dist/chunks/studio-wa55e8gf.js +0 -5
  215. package/dist/chunks/studio-x0mzdha2.js +0 -5
  216. package/dist/chunks/studio-xrgpakvc.js +0 -9
  217. package/dist/chunks/studio-xt3djk1w.js +0 -7
  218. package/dist/chunks/studio-yh3nggx1.js +0 -7
  219. package/dist/chunks/studio-zmecp6hq.js +0 -5
  220. package/dist/chunks/workspace-g6dvaete.js +0 -4
  221. package/dist/chunks/ws-client-shf41j5p.js +0 -4
@@ -1,6 +0,0 @@
1
- import{f}from"./studio-jsv3s3s1.js";import{at}from"./studio-8r4y2x0z.js";import{st,_l,Cl,_o,ur,mc,Lb,$u,O1}from"./studio-vwz7rma2.js";import{ge,ee,v,re,Nd,S}from"./studio-9rhmettf.js";import{Ke,Vu,gm,bm,DC,xc,Uu}from"./studio-7jazdy6y.js";import{un,Mu,Te,sp,q,Ue,Jo,Os,rv,fr,hL,ju,ot,Yo,vi,li,ux,ke,Do,oo,av,je,$l,cv,wL,ca,kd,xL,g,u,Ms,Bn,gx,pp,zu,wc,Al}from"./studio-ks7cksh0.js";import{bp,_m,Id,Cm}from"./studio-de3p1ktm.js";import{xp,GC,KC,Tm,Bs,Rm,$d,ne}from"./studio-sq1bn60g.js";import{Di,Go,cs,El,y,tp,xd}from"./studio-cktcdsxz.js";import{tt}from"./studio-eq27rrr0.js";import{Gn}from"./studio-c4pnt1c6.js";import{rt,HL,mv,T,R,On,ps}from"./studio-zmecp6hq.js";import{wo,sd,wE,cc,vu,yu,ad,ld,dc,cd,xu}from"./studio-21enxdr8.js";import{mr}from"./studio-b4epb26c.js";import{$t}from"./studio-p1eggxcf.js";import{od,Qy}from"./studio-rpmvw7kj.js";import{fc,As,_1,Jf,Yf}from"./studio-k1eaqyzm.js";import{fb,pc,mb,y1,AE}from"./studio-chxabn98.js";import{ym,_c,K,ht,D,Ai,Wr}from"./studio-73czgk6a.js";import{Ae}from"./studio-625ezz59.js";import{He}from"./studio-cnspfke5.js";import{nt,Ot,ua,_v,Ep,Dd,We}from"./studio-as65vbns.js";import{me}from"./studio-7gqyhjns.js";var Vy=["code","layout","component","diff","breakpoint","locale"],kr={breakpoint:"design",code:"source",component:"design"},Sr={design:"Design",source:"Code"},Er="Could not read this file's comparison against HEAD.";var mu={breakpoint:"Same page at",code:"Code",component:"Component definition",diff:"Diff vs HEAD",layout:"Layout",locale:"Same page in"};function Cr(e){let t=Bn(e)?.derived;if(!t)return null;let n=st(t.sourcePaneId);if(!n)return{diffPath:null,kind:t.kind,media:null,mode:null,path:null,probePath:null,reason:"The pane this one follows has no document open.",select:null,status:"unavailable"};if(t.kind==="lens")return Nr(e,t,n);return Tr(e,t,n)}function Nr(e,t,n){let a={diffPath:null,kind:"lens",media:t.media,mode:t.mode,path:null,probePath:null,select:null};if(t.preset==="diff"){let r=n.documentPath;if(!Bt(r))return{...a,reason:"Nothing to compare — this file matches HEAD.",status:"unavailable"};if(t.diff?.filePath===r&&(t.diffRev===void 0||t.diffRev===y.git.rev))return{...a,reason:"",status:"ready"};if(ce.get(e)?.failed&&ce.get(e)?.path===r)return{...a,reason:Er,status:"unavailable"};return{...a,diffPath:r,reason:"",status:"loading"}}if(t.preset==="code"&&_l(n)==="source")return{...a,reason:"The pane this one follows is showing Code — one document has one editor.",status:"unavailable"};if(t.preset==="breakpoint"&&!Uy(n).includes(t.media))return{...a,reason:`This document does not declare a "${t.media??"base"}" breakpoint.`,status:"unavailable"};return{...a,reason:"",status:"ready"}}function Bt(e){return y.git.status?.files.find((t)=>t.path===e&&(t.status==="M"||t.status==="A"||t.status==="U"))??null}function Tr(e,t,n){let a={diffPath:null,kind:"companion",media:null,mode:null};if(t.preset==="layout"){let o=y.layoutSelection,i=o?.layoutFile??El(n.doc.document.$layout);return i===null?{...a,path:null,probePath:null,reason:"This page has no layout.",select:null,status:"unavailable"}:{...a,path:i,probePath:null,reason:"",select:o?o.layoutPath:null,status:"ready"}}if(t.preset==="locale"){let o=cs(),i=n.documentPath===null||t.locale===null?null:Mu(n.documentPath,t.locale,o);if(i===null)return{...a,path:null,probePath:null,reason:"This document has no path in that locale.",select:null,status:"unavailable"};let s=be.get(e);if(s?.path!==i||s.exists===null)return{...a,path:null,probePath:i,reason:"",select:null,status:"loading"};if(!s.exists)return{...a,path:null,probePath:null,reason:`No ${un(t.locale)} copy of this document yet — `+"the Languages panel can create one.",select:null,status:"unavailable"};return{...a,path:i,probePath:null,reason:"",select:null,status:"ready"}}let r=Rr(n);if(r===null)return t.resolved===null?{...a,path:null,probePath:null,reason:"Select an element inside a component to see its definition.",select:null,status:"unavailable"}:{...a,path:null,probePath:null,reason:"",select:null,status:"ready"};return{...a,path:r,probePath:null,reason:"",select:null,status:"ready"}}function Uy(e){let{sizeBreakpoints:t}=ur(Di(e.doc.document.$media));return[null,...t.map((n)=>n.name)]}function Rr(e){let[t]=e?.session.selection??[];if(!e||!t)return null;let n=e.doc.document,a=[...t];while(a){let r=K(n,a),o=r?at.find((i)=>i.tagName===r.tagName):null;if(o?.path)return o.path;a=ht(a)}return null}function Pr(e,t){if(t.sourcePaneId===e||!Bn(t.sourcePaneId))throw RangeError(`pane "${e}" cannot derive from "${t.sourcePaneId}" — a derivation names `+"another pane that is in the grid");Pn(e,t)}function Pn(e,t){let n=Bn(e);if(n)ce.delete(e),be.delete(e),n.derived=t}function k_(e){Pn(e,null)}function Ze(e,t){let n=Bn(e),a=n?.derived,r=Cr(e);if(!n||!a||!r)return;if(_o.derivedResolves+=1,a.status=r.status,a.reason=r.reason,a.kind==="lens"){let i=Bn(a.sourcePaneId);if(n.tabOrder.length>0||n.activeTabId!==null){let s=[...n.tabOrder];for(let l of s)if(pp(l),i)zu(i,l);n.activeTabId=null}if(a.preset==="diff"&&r.status!=="ready")a.diff=null;Ar(e,r,t);return}if(Dr(e,r,t),a.resolved!==null&&st(e)===null)a.resolved=null;if(r.path===null||r.path===a.resolved){Tn(e,r);return}a.resolved=r.path,_o.derivedRetargets+=1;let o=t.openFileInPane(e,r.path);if(r.select===null)return;Promise.resolve(o).then(()=>{Tn(e,r)})}function Tn(e,t){let n=t.select,a=st(e);if(!n||!a||t.path!==null&&a.documentPath!==t.path)return;let[r]=a.session.selection;if(r?.length===n.length&&r.every((o,i)=>o===n[i]))return;a.session.selection=[[...n]]}var ce=new Map;function Ar(e,t,n){let a=t.diffPath,r=Bt(a),{rev:o}=y.git,i=ce.get(e);if(a===null||!r||i?.path===a&&i.rev===o)return;ce.set(e,{failed:!1,path:a,rev:o}),n.loadDiff(a,r.status).then((s)=>{let l=Bn(e)?.derived;if(l?.kind!=="lens"||l.preset!=="diff"||ce.get(e)?.path!==a)return;if(s)l.diff=s,l.diffRev=o;else ce.set(e,{failed:!0,path:a,rev:o});Ze(e,n)}).catch((s)=>{console.error("loadDiff error:",s)})}var be=new Map;function Dr(e,t,n){let a=t.probePath;if(a===null||be.get(e)?.path===a)return;be.set(e,{exists:null,path:a}),n.fileExists(a).then((r)=>{let o=Bn(e)?.derived;if(o?.kind!=="companion"||o.preset!=="locale"||be.get(e)?.path!==a)return;be.set(e,{exists:r,path:a}),Ze(e,n)}).catch((r)=>{console.error("fileExists error:",r)})}var Wt=new Map;function jr(e,t){if(Wt.has(e))return;Wt.set(e,requestAnimationFrame(()=>{Wt.delete(e);try{Ze(e,t)}catch(n){console.error("applyDerivation error:",n)}}))}function $k(e,t){ee(()=>{let n=Bn(e),a=n?.derived;if(!a)return;n.activeTabId;let r=st(a.sourcePaneId);if(a.kind==="lens"&&a.preset==="code")r?.session.ui.canvasMode;if(a.kind==="companion"&&a.preset==="component")r?.session.selection;if(a.kind==="companion"&&a.preset==="layout")y.layoutSelection,r?.doc.document?.$layout;jr(e,t)})}function Hg(e,t,n,a=null){let r=st(t);if(!r)return"an open document";let o=kr[e];if(o&&!r.capabilities.modes.includes(o))return`a document with a ${Sr[o]} view — this one declares none`;if(e==="code")return _l(r)==="source"?"a source pane that is not already showing Code":null;if(e==="diff")return Bt(r.documentPath)===null?"a file with changes against HEAD":null;if(e==="breakpoint")return Uy(r).includes(n)?null:"a breakpoint this document declares — see Project Settings › Contexts";if(e==="layout")return El(r.doc.document.$layout)===null?"a page with a layout — this one declares none":null;if(e==="locale"){let i=cs();if(i===null||i.locales.length<2)return"a project that declares more than one locale — see Project Settings › Locales";if(r.documentPath===null)return"a document that has been saved";return a!==null&&i.locales.includes(a)?null:"a locale this project declares"}return null}function Bg(e){let t=Bn(e);return t&&t.activeTabId!==null&&t.derived===null?null:An}var An="an open document in a pane that is not itself derived";function Lr(e,t,n,a=null){if(e==="locale")return{kind:"companion",locale:a,preset:e,reason:"",resolved:null,sourcePaneId:t,status:"loading"};if(e==="layout"||e==="component")return{kind:"companion",preset:e,reason:"",resolved:null,sourcePaneId:t,status:"loading"};return{diff:null,kind:"lens",media:e==="breakpoint"?n:null,mode:e==="code"?"source":e==="diff"?"git-diff":"design",preset:e,reason:"",sourcePaneId:t,status:"loading",zoom:1}}function Rn(){return g.panes.find((e)=>E_(e.id)===null)??null}function E_(e){let t=Bn(e);return t?.derived?.kind==="companion"&&t.activeTabId?null:Dn}var Dn="a derived pane showing a document of its own — Code, Diff and breakpoint views project "+"the document already open beside them";function Dk(e){return[{args:ke({locale:je('BCP 47 tag for preset "locale". Ignored by every other preset.'),media:je('Breakpoint name for preset "breakpoint" — omit or leave empty for the base size. '+"Ignored by every other preset."),preset:Do(Vy,"Which projection of this pane's document to show beside it.")},["preset"]),id:"pane.derive",title:"Show Beside This…",category:"View",level:"document",menus:["context/pane"],group:"5_pane",when:(t)=>t.document.open,enablement:()=>Bg(Ms().id)===null,requires:An,undo:"none",run:(t,n)=>{let a=li("pane.derive",n,"preset",Vy),r=Yo("pane.derive",n,"media")??null,o=Yo("pane.derive",n,"locale")??null,i=Ms(),s=Hg(a,i.id,r,o);if(s)throw RangeError(`command "pane.derive" argument "preset": "${a}" requires ${s}`);let l=gx(i.id);Pr(l.id,Lr(a,i.id,r,o));let d=[...l.tabOrder];for(let p of d)pp(p),zu(i,p);Ze(l.id,e)}},{id:"pane.pin",title:"Keep This Document",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:()=>Rn()!==null,requires:Dn,undo:"none",run:()=>{let t=Rn();if(!t?.activeTabId)return;Al(t.activeTabId),k_(t.id)}}]}var jn={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelData",$description:'Navigator › Data: the value tree under one state entry — what the canvas resolved that entry to, a line per key. The rows arrive FLAT. JSON nests to any depth and a document\'s one repeater is `$prototype: "Array"` over a list, so `panels/data-explorer.ts` walks the value once, applies the item, key and depth caps, and hands over rows that already carry their own indent; recursion is a property of the walk rather than of the markup. Two kinds of line come out of it: a key and the value beside it, and a truncation marker, which is a real button because the reader opened this panel BECAUSE item 40 was the surprising one. The adapter decides what a value reads as and what a marker raises; nothing here knows about the canvas.',tagName:"div",attributes:{part:"tree"},style:{$description:"The whole of the tree's look, and two things about it are the conversion. THE SYNTAX COLOURS MOVED: `--data-key` was declared on `<sp-theme>` in `styles/spectrum.css`, where Spectrum's own ramp was in scope, and this document is mounted in the Navigator — outside that element every `var(--data-key)` would have silently taken its hex fallback and stopped following the theme, so the key colour is `var(--accent)`, which is the studio token `--spectrum-blue-700` was chosen to match. Its three neighbours (`--data-string`, `--data-number`, `--data-boolean`) were NOT re-pointed, because no rule ever read them: they were declared for a palette nobody wrote, and inventing one here would have been a visual change nobody asked for. So when `styles/spectrum.css` was deleted the three were not re-homed either — this paragraph is the whole of what remains of them. `data-tone` still carries the type on every value, so the day that palette is designed it has somewhere to land. AND THE INDENT IS A VARIABLE: a row's depth used to be an inline `style=\"padding-left:…\"`, which is one rule per row once the padding is a declaration; `--row-indent` is written inline under its own name and read by one shared rule, so a hundred-row tree interns one.",display:"block",'& [part="row"], & [part="more"]':{$description:"Every line, whichever kind. One line high and clipped rather than wrapped: a tree that reflows a long string across three lines stops being a column of keys you can scan.",display:"block",boxSizing:"border-box",width:"100%",paddingTop:"1px",paddingBottom:"1px",paddingRight:"8px",paddingLeft:"var(--row-indent, 8px)",fontSize:"var(--jx-text-sm)",fontFamily:"var(--font-mono, monospace)",lineHeight:"1.5",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},'& [part="key"]':{$description:"The key or index this line is under. Empty for the single line a primitive value renders as, which is why it is always drawn: a span with nothing in it takes no width, and switching it in and out would cost a wrapper element per row to save nothing.",color:"var(--accent)"},'& [part="value"]':{color:"var(--fg)"},'& [part="value"][data-tone="null"], & [part="value"][data-tone="object"]':{$description:"Not a value you are reading: an absence, or a summary standing in for the lines underneath it. Both are dimmed and italic so the eye passes over them on the way to what is real.",color:"var(--fg-dim)",fontStyle:"italic"},'& [part="more"]':{$description:"A truncation marker is a CONTROL, not a caption — it shows more of what the panel already has in hand. Dressed as the text it replaced so the tree does not sprout buttons, and stripped of the chrome a `<button>` brings with it, but focusable and hoverable so that it reads as pressable.",textAlign:"left",background:"none",border:"none",color:"var(--fg-dim)",fontStyle:"italic",cursor:"pointer"},'& [part="more"]:hover, & [part="more"]:focus-visible':{color:"var(--accent)",textDecoration:"underline"}},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"line-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{row:{tagName:"div",attributes:{part:"row"},style:{"--row-indent":{$ref:"$map/item/indent"}},children:[{tagName:"span",attributes:{part:"key"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"value","data-tone":"${$map.item.tone}"},textContent:"${$map.item.text}"}]},more:{tagName:"button",attributes:{part:"more",type:"button",title:"${$map.item.title}"},style:{"--row-indent":{$ref:"$map/item/indent"}},textContent:"${$map.item.text}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showMore"},value:[{$ref:"$map/item/path"},{$ref:"$map/item/limit"}]}]}}}}}]};T("panel-data",jn);var et=new Map;function Ln(e,t,n){let a=et.get(e);if(a&&!a.disposed&&(a.handle===null||a.handle.root.isConnected)){a.scope.rows=t;return}Fn(e,a),e.textContent="";let r=v({rows:t,showMore:n.showMore}),o={disposed:!1,handle:null,scope:r};et.set(e,o),R("panel-data",r,e).then((i)=>{if(o.disposed){i.dispose();return}o.handle=i})}function Pe(){for(let[e,t]of et)if(!e.isConnected)Fn(e,t)}function Fn(e,t){if(!t)return;t.disposed=!0,t.handle?.dispose(),t.handle=null,et.delete(e)}function zt(){let e=u.value?.session.ui;if(!e)return null;return e.dataRows??={}}var Kt=50;function _n(){let e=u.value?.session.ui;if(!e)return null;return e.dataLimits??={}}function Mn(e,t,n){return n+(_n()?.[`${e}\x00${t}`]??0)}function Or(e,t){let n=_n();if(!n)return;let a=`${e}\x00${t}`;n[a]=(n[a]??0)+Kt}function Vn(e,t,n,a,r=`Show ${Kt} more`){return{indent:n,key:`${e}\x00${t}`,kind:"more",label:"",limit:t,path:e,text:a,title:r,tone:"marker"}}function In(e,t){if(typeof e==="string"&&e.length>t)return`"${e.slice(0,t)}…"`;return JSON.stringify(e)??""}function Jn(e){return e===null?"null":typeof e}function Mr(e){return Array.isArray(e)?`Array(${e.length})`:`{${Object.keys(e).length}}`}function sc(e){if(e&&typeof e==="object"&&e.__v_isRef)return e.value;return e}function Lf(e){let t=sc(e);if(t===null)return"null";if(t===void 0)return"pending";if(Array.isArray(t))return`Array(${t.length})`;if(typeof t==="object")return`{${Object.keys(t).length}}`;return typeof t}function Hn(e,t,n=5,a=""){let r=`${(t+1)*12}px`,o=(c,b,w,k)=>({indent:r,key:k,kind:"row",label:c,limit:"",path:"",text:b,title:"",tone:w});if(t>Mn(a,"depth",n))return[Vn(a,"depth",r,"…",`Show ${Kt} more levels`)];if(e===null||e===void 0)return[o("",String(e),"null",a)];if(typeof e!=="object")return[o("",In(e,200),Jn(e),a)];let i=Array.isArray(e),s=i?e.map((c,b)=>[`${b}`,`[${b}] `,c]):Object.keys(e).map((c)=>[c,`${c}: `,e[c]]),l=i?"items":"keys",d=Mn(a,l,i?20:30),p=[];for(let[c,b,w]of s.slice(0,d)){let k=`${a}/${c}`;if(w===null||w===void 0||typeof w!=="object"){p.push(o(b,In(w,80),Jn(w),k));continue}p.push(o(b,Mr(w),"object",k),...Hn(w,t+1,n,k))}if(s.length>d)p.push(Vn(a,l,r,`… ${s.length-d} more`));return p}function it(e,t,n,a,r=5){Ln(e,Hn(t,0,r,n),{showMore:(o,i)=>{if(i==="items"||i==="keys"||i==="depth")Or(o,i);a()}})}function ie(e,t){let n=zt();if(!n)return;if(t)n[e]=!0;else delete n[e]}function Ut(e){return zt()?.[e]===!0}function Wn(){return Object.keys(zt()??{})}function Vr(){return Object.keys(u.value?.doc.document?.state??{})}function Ir(e){return[{args:{additionalProperties:!1,properties:{expanded:{default:!0,description:"True to expand the row's value tree, false to collapse it.",type:"boolean"},name:je("The state entry's name, as the document defines it.")},required:["name"],type:"object"},category:"Document",id:"data.expandRow",level:"document",menus:["palette"],group:"5_data",requires:"an open document that defines data",when:(t)=>t.document.open,run:(t,n)=>{let a=ot("data.expandRow",n,"name"),r=Vr();if(!r.includes(a))throw RangeError(`command "data.expandRow" argument "name": "${a}" is not defined by this `+`document — it defines: ${r.length>0?r.join(", "):"nothing"}`);let{expanded:o}=n;ie(a,o===void 0||vi("data.expandRow",n,"expanded")),e.renderLeftPanel()},title:"Expand Data Row"}]}function Ak(e,t){e.registerAll(Ir(t))}function Nk(){Gn({id:"data",title:"Data",level:"document",dock:"navigator",icon:"database",requiresDocument:"Open a page to give it data — values it can read, compute or fetch.",render:()=>tt,afterRender:(e,t)=>{e.deps.mountSignalsPanel(t,e.doc,{refreshData:e.deps.refreshData,renderLeftPanel:e.rerender})}})}var lt=[{description:"Arithmetic mean of an array of numbers; 0 for an empty array.",expression:{operator:"?:",target:{$ref:"$args/values/length"},value:{operator:"/",target:{operator:"reduce",target:{$ref:"$args/values"},initial:0,value:{operator:"+",target:{$ref:"$reduce/acc"},value:{$ref:"$map/item"}}},value:{$ref:"$args/values/length"}},initial:0},name:"average",parameters:[{name:"values",type:{text:"number[]"}}]},{description:"Uppercase the first character of a string, leaving the rest unchanged (the CSS text-transform: capitalize shape for a single word).",expression:{operator:"+",target:{operator:"toUpperCase",target:{operator:"charAt",target:{$ref:"$args/text"},value:0}},value:{operator:"slice",target:{$ref:"$args/text"},value:1}},name:"capitalize",parameters:[{name:"text",type:{text:"string"}}]},{description:"Bound a number to the [min, max] range (the TC39 Math.clamp shape): returns min when below, max when above, the value itself otherwise.",expression:{operator:"call",target:{$ref:"window#/Math/min"},value:[{operator:"call",target:{$ref:"window#/Math/max"},value:[{$ref:"$args/value"},{$ref:"$args/min"}]},{$ref:"$args/max"}]},name:"clamp",parameters:[{name:"value",type:{text:"number"}},{name:"min",type:{text:"number"}},{name:"max",type:{text:"number"}}]},{description:"A copy of an array with the falsy elements removed (Array.prototype.filter on truthiness).",expression:{operator:"filter",target:{$ref:"$args/values"},value:{operator:"!",target:{operator:"!",target:{$ref:"$map/item"}}}},name:"compact",parameters:[{name:"values",type:{text:"unknown[]"}}]},{description:"The length of an array or string, or 0 when the value is missing.",expression:{operator:"??",target:{$ref:"$args/values/length"},value:0},name:"count",parameters:[{name:"values",type:{text:"unknown[] | string"}}]},{description:"The first element of an array (index 0), or null when empty.",expression:{operator:"??",target:{$ref:"$args/values/0"},value:null},name:"first",parameters:[{name:"values",type:{text:"unknown[]"}}]},{description:'The uppercase first letters of each whitespace-separated word, joined (e.g. "ada lovelace" → "AL").',expression:{operator:"join",target:{operator:"map",target:{operator:"split",target:{$ref:"$args/name"},value:" "},value:{operator:"toUpperCase",target:{operator:"charAt",target:{$ref:"$map/item"},value:0}}},value:""},name:"initials",parameters:[{name:"name",type:{text:"string"}}]},{description:"True when an array or string has no elements (length 0 — a missing value counts as empty).",expression:{operator:"===",target:{operator:"??",target:{$ref:"$args/value/length"},value:0},value:0},name:"isEmpty",parameters:[{name:"value",type:{text:"unknown[] | string"}}]},{description:"The last element of an array (Array.prototype.at(-1)), or undefined when empty.",expression:{operator:"at",target:{$ref:"$args/values"},value:-1},name:"last",parameters:[{name:"values",type:{text:"unknown[]"}}]},{description:"The largest number in an array (Math.max folded over the values); undefined for an empty array.",expression:{operator:"reduce",target:{$ref:"$args/values"},initial:{$ref:"$args/values/0"},value:{operator:"call",target:{$ref:"window#/Math/max"},value:[{$ref:"$reduce/acc"},{$ref:"$map/item"}]}},name:"max",parameters:[{name:"values",type:{text:"number[]"}}]},{description:"The smallest number in an array (Math.min folded over the values); undefined for an empty array.",expression:{operator:"reduce",target:{$ref:"$args/values"},initial:{$ref:"$args/values/0"},value:{operator:"call",target:{$ref:"window#/Math/min"},value:[{$ref:"$reduce/acc"},{$ref:"$map/item"}]}},name:"min",parameters:[{name:"values",type:{text:"number[]"}}]},{description:"part / whole as a percentage (0 when the whole is 0 or missing).",expression:{operator:"?:",target:{$ref:"$args/whole"},value:{operator:"*",target:{operator:"/",target:{$ref:"$args/part"},value:{$ref:"$args/whole"}},value:100},initial:0},name:"percent",parameters:[{name:"part",type:{text:"number"}},{name:"whole",type:{text:"number"}}]},{description:"Round a number to the given decimal places (Math.round against a Math.pow(10, digits) scale).",expression:{operator:"/",target:{operator:"call",target:{$ref:"window#/Math/round"},value:[{operator:"*",target:{$ref:"$args/value"},value:{operator:"call",target:{$ref:"window#/Math/pow"},value:[10,{$ref:"$args/digits"}]}}]},value:{operator:"call",target:{$ref:"window#/Math/pow"},value:[10,{$ref:"$args/digits"}]}},name:"roundTo",parameters:[{name:"value",type:{text:"number"}},{name:"digits",type:{text:"number"},default:0}]},{description:"Add every number in an array (Array.prototype.reduce with +, seeded at 0).",expression:{operator:"reduce",target:{$ref:"$args/values"},initial:0,value:{operator:"+",target:{$ref:"$reduce/acc"},value:{$ref:"$map/item"}}},name:"sum",parameters:[{name:"values",type:{text:"number[]"}}]},{description:"Shorten a string to at most the given length, appending a horizontal ellipsis when cut.",expression:{operator:"?:",target:{operator:">",target:{$ref:"$args/text/length"},value:{$ref:"$args/length"}},value:{operator:"+",target:{operator:"slice",target:{$ref:"$args/text"},value:[0,{$ref:"$args/length"}]},value:"…"},initial:{$ref:"$args/text"}},name:"truncate",parameters:[{name:"text",type:{text:"string"}},{name:"length",type:{text:"number"}}]}];function ct(e,t,n){if(e.ensure&&!n?.stateEntries?.[e.ensure.name])n?.onInsertDef?.(e.ensure.name,e.ensure.def);t(e.insert())}var dt={description:"Writable pointer the operation applies to",name:"target"},Jr={description:"Left operand",name:"target"},_r={description:"Right operand",name:"value"};function De(e,t){return{description:`${t} assignment operator (ECMA \`${e}\`): stores the result at the target pointer.`,group:"Assignment",insert:()=>({operator:e,target:{$ref:""},value:null}),parameters:[dt,{description:"Value assigned to the target",name:"value"}]}}function H(e,t,n){return{description:n,group:e,insert:()=>({operator:t,target:null,value:null}),parameters:[Jr,_r]}}function pt(e,t,n){return{description:t,group:"Array methods",insert:()=>n?{operator:e,target:{$ref:""},value:null}:{operator:e,target:{$ref:""}},parameters:n?[dt,{description:"Element to add",name:"value"}]:[dt]}}function qt(e,t,n){let a={operator:e,target:{$ref:""},value:{operator:"!",target:null}};return{description:t,group:"Aggregate",insert:()=>n?{...a,initial:0}:{...a},parameters:[{description:"Array pointer to iterate",name:"target"},{description:"Per-item expression ($map/item, $map/index)",name:"value"},...n?[{description:"Initial accumulator ($reduce/acc)",name:"initial"}]:[]]}}var zn={"!":{description:"Logical NOT operator (ECMA `!`): coerces the operand to boolean and negates it.",group:"Unary",insert:()=>({operator:"!",target:null}),parameters:[{description:"Operand to negate",name:"target"}]},"!==":H("Comparison","!==","Strict inequality operator (ECMA `!==`): true when the operands differ without coercion."),"%":H("Arithmetic","%","Remainder operator (ECMA `%`): remainder of dividing the left operand by the right."),"&&":H("Logical","&&","Logical AND operator (ECMA `&&`): yields the right operand when the left is truthy."),"*":H("Arithmetic","*","Multiplication operator (ECMA `*`): numeric product of the operands."),"*=":De("*=","Multiplication"),"+":H("Arithmetic","+","Addition operator (ECMA `+`): numeric addition, or string concatenation."),"+=":De("+=","Addition"),"-":H("Arithmetic","-","Subtraction operator (ECMA `-`); with no value operand it is unary negation."),"-=":De("-=","Subtraction"),"/":H("Arithmetic","/","Division operator (ECMA `/`): quotient of the operands."),"/=":De("/=","Division"),"<":H("Comparison","<","Less-than operator (ECMA `<`): relational comparison of the operands."),"<=":H("Comparison","<=","Less-than-or-equal operator (ECMA `<=`): relational comparison of the operands."),"=":De("=","Simple"),"===":H("Comparison","===","Strict equality operator (ECMA `===`): true when the operands are equal without coercion."),">":H("Comparison",">","Greater-than operator (ECMA `>`): relational comparison of the operands."),">=":H("Comparison",">=","Greater-than-or-equal operator (ECMA `>=`): relational comparison of the operands."),"??":H("Logical","??","Nullish coalescing operator (ECMA `??`): yields the right operand when the left is null or undefined."),"?:":{description:"Conditional operator (ECMA `?:`): evaluates the test in target, yielding value when truthy, initial otherwise.",group:"Conditional",insert:()=>({initial:null,operator:"?:",target:null,value:null}),parameters:[{description:"Test condition",name:"target"},{description:"Result when the test is truthy",name:"value"},{description:"Result when the test is falsy",name:"initial"}]},"||":H("Logical","||","Logical OR operator (ECMA `||`): yields the right operand when the left is falsy."),call:{description:"Function.prototype.call (ECMA): invokes a named formula (#/state/…) or blessed pure global (window#/…) with positional arguments.",group:"Function",insert:()=>({operator:"call",target:{$ref:""},value:[]}),parameters:[{description:"Callee pointer: #/state/<formula> or window#/<global>",name:"target"},{description:"Positional argument list",name:"value"}]},filter:qt("filter","Array.prototype.filter (ECMA): keeps elements whose per-item expression is truthy.",!1),map:qt("map","Array.prototype.map (ECMA): transforms each element via the per-item expression.",!1),pop:pt("pop","Array.prototype.pop (ECMA): removes and returns the last element of the target array.",!1),push:pt("push","Array.prototype.push (ECMA): appends the value to the target array.",!0),reduce:qt("reduce","Array.prototype.reduce (ECMA): folds the array into an accumulator via the per-item expression.",!0),shift:pt("shift","Array.prototype.shift (ECMA): removes and returns the first element of the target array.",!1),splice:{description:"Array.prototype.splice (ECMA): removes and/or inserts elements at an index of the target array.",group:"Array methods",insert:()=>({operator:"splice",target:{$ref:""},value:[null]}),parameters:[dt,{description:"Arguments: start, deleteCount, items…",name:"value"}]},switch:{description:"Switch selection (ECMA `switch` semantics): matches the target's string form against case keys, falling back to default.",group:"Conditional",insert:()=>({cases:{},default:null,operator:"switch",target:null}),parameters:[{description:"Discriminant value",name:"target"},{description:"Matched value → result operand map",name:"cases"},{description:"Result when no case matches",name:"default"}]},unshift:pt("unshift","Array.prototype.unshift (ECMA): prepends the value to the target array.",!0)};function Hr(){let e=[];for(let t of GC){let n=Object.hasOwn(zn,t)?zn[t]:void 0;if(n)e.push({description:n.description,group:n.group,insert:n.insert,kind:"operator",label:t,name:t,parameters:n.parameters});else if(xp.has(t))e.push(Kr(t))}return e}var Br={at:"Array/String",charAt:"String",concat:"Array/String",endsWith:"String",flat:"Array",includes:"Array/String",indexOf:"Array/String",join:"Array",lastIndexOf:"Array/String",normalize:"String",padEnd:"String",padStart:"String",repeat:"String",replaceAll:"String",slice:"Array/String",split:"String",startsWith:"String",toFixed:"Number",toLocaleLowerCase:"String",toLocaleString:"Number",toLocaleUpperCase:"String",toLowerCase:"String",toPrecision:"Number",toReversed:"Array",toSorted:"Array",toSpliced:"Array",toUpperCase:"String",trim:"String",trimEnd:"String",trimStart:"String",with:"Array"},zr=new Set(["flat","normalize","toLocaleLowerCase","toLocaleString","toLocaleUpperCase","toLowerCase","toReversed","toSorted","toUpperCase","trim","trimEnd","trimStart"]);function Kr(e){let t=Br[e]??"Standard library";return{description:`${t}.prototype.${e} (ECMA) — pure: never mutates the receiver. Receiver in target; argument (or argument list) in value.`,group:`${t} methods`,insert:()=>zr.has(e)?{operator:e,target:{$ref:""}}:{operator:e,target:{$ref:""},value:null},kind:"operator",label:e,name:e,parameters:[]}}var Ur={"Intl/formatDate":"Intl.formatDate(value, locale?, options?) — blessed helper wrapping new Intl.DateTimeFormat(locale, options).format(new Date(value)).","Intl/formatNumber":"Intl.formatNumber(value, locale?, options?) — blessed helper wrapping new Intl.NumberFormat(locale, options).format(value).","Intl/formatRelativeTime":"Intl.formatRelativeTime(value, unit, locale?, options?) — blessed helper wrapping new Intl.RelativeTimeFormat(locale, options).format(value, unit)."};function ut(){let e=[];for(let t of KC){let n=t.indexOf("/"),a=n===-1?"globalThis":t.slice(0,n),r=t.replaceAll("/",".");e.push({description:Ur[t]??`${r} — blessed pure global from the ECMAScript standard library, invoked via the call operator (window#/${t}).`,group:a,insert:()=>({operator:"call",target:{$ref:`window#/${t}`},value:[]}),kind:"global",label:r,name:t,parameters:[]})}return e}function Kn(e){if(typeof e==="string")return e?{name:e}:null;if(!nt(e)||typeof e.name!=="string"||!e.name)return null;let t={name:e.name},{type:n}=e;if(typeof n==="string")t.type=n;else if(nt(n)){if(typeof n.text==="string")t.type=n.text;else if(typeof n.type==="string")t.type=n.type}if(typeof e.description==="string")t.description=e.description;if("default"in e&&e.default!==void 0)t.default=e.default;return t}function mt(e){let t=[];for(let[n,a]of Object.entries(e??{})){if(!_v(a))continue;let r=a.parameters.map((i)=>Kn(i)).filter((i)=>i!==null),o=typeof a.description==="string"&&a.description?a.description:typeof a.$title==="string"&&a.$title?a.$title:`Named formula "${n}" from document state.`;t.push({description:o,group:"Formulas",insert:()=>({operator:"call",target:{$ref:`#/state/${n}`},value:r.map((i)=>i.default??null)}),kind:"formula",label:n,name:n,parameters:r})}return t}function qr(e){let t=[];for(let n of lt){if(e?.[n.name])continue;let a=n.parameters.map((r)=>Kn(r)).filter((r)=>r!==null);t.push({description:n.description,ensure:{def:{$description:n.description,$expression:n.expression,parameters:n.parameters},name:n.name},group:"Formulas library",insert:()=>({operator:"call",target:{$ref:`#/state/${n.name}`},value:a.map((r)=>r.default??null)}),kind:"formula",label:n.name,name:n.name,parameters:a})}return t}function ft(e){return[...mt(e),...qr(e),...Hr(),...ut()]}function Un(e,t){if(e.startsWith("window#/")){let n=e.slice(8);return ut().find((a)=>a.name===n)}if(e.startsWith("#/state/")){let n=e.slice(8);return mt(t).find((a)=>a.name===n)}return}function qn(e,t){let n=e?.doc.document,a=(r)=>nt(r)&&typeof r.body==="string"?r.body:"";if(t?.type==="def")return a(n?.state?.[t.defName]);else if(t?.type==="event"){let r=K(n,t.path);return r?a(r[t.eventKey]):""}return""}var Gr='[part="code-host"]';function Yt(e){let t=u.value,n=t?.session.ui.editingFunction,a=n&&t?e.querySelector(Gr):null;if(!a||!t||!n){Gt();return}let r=Ke.functionEditor,o=Boolean(r&&a.contains(r.getDomNode()));if(r&&o&&r._editingTab===t&&r._editingTarget===JSON.stringify(n)){let l=qn(t,n);if(!Uu(r)&&r.getValue()!==l)r._ignoreNextChange=!0,r.setValue(l),r._writes?.markSettled();return}Gt(),a.textContent="";let i=qn(t,n),s=AE(n,t.doc.document);Xr(a,t,n,i,s)}function Gt(){let e=Ke.functionEditor;if(e)bm(e,"logic"),e.dispose(),Ke.functionEditor=null}function Yn(e,t,n){return(a)=>{if(!wc(e))return!1;let r=!1;if(t.type==="def")r=q(e,(o)=>fr(o,t.defName,{body:a}));else if(t.type==="event"){let o=K(e.doc.document,t.path);if(!o)return!1;let i=o[t.eventKey]||{};r=q(e,(s)=>Ue(s,t.path,t.eventKey,{...i,$prototype:"Function",body:a}))}if(r)n?.markSettled();return r}}async function qy(){let e=u.value,t=e?.session.ui.editingFunction;if(!e||!t)return;let n=Ke.functionEditor;if(n){let a=n.getValue(),r=await fb("minify",{code:a});if(DC(n),!(n._commitBody??Yn(e,t))(r?.code??a)){S.warn("The handler could not be saved — source editing holds this document. Your code is still in the editor.",{key:"logic.close-refused",source:"Logic",...e.documentPath?{path:e.documentPath}:{}});return}if(Ke.functionEditor!==null&&Ke.functionEditor!==n)return;Gt()}Wr(u.value,"editingFunction",null)}function Yr(e,t,n){return _m(e,Ke.functionEditor,()=>{let a=u.value;return a===t&&JSON.stringify(a.session.ui.editingFunction??null)===JSON.stringify(n)})}async function Xr(e,t,n,a,r){let o=await bp();if(!Yr(e,t,n))return;Qr();let i=o.editor.create(e,{automaticLayout:!0,fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace",fontSize:12,language:"javascript",lineNumbers:"on",minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2,theme:tp(),value:a,wordWrap:"on"});i._editingTarget=JSON.stringify(n),i._editingTab=t;let s=gm(i);i._commitBody=Yn(t,n,s),Ke.functionEditor=i;let l=0;fb("format",{args:r,code:a}).then((d)=>{if(d?.code!=null&&Ke.functionEditor===i&&wc(t)&&!Uu(i,a))i._ignoreNextChange=!0,i.setValue(d.code),s.markAhead()}),fb("lint",{args:r,code:a}).then((d)=>{if(d?.diagnostics&&Ke.functionEditor===i&&wc(t)&&xc(i))y1(i,d.diagnostics)}),i.onDidChangeModelContent(()=>{if(i._ignoreNextChange){i._ignoreNextChange=!1;return}s.markTyped(),s.arm(Vu,500,()=>{i._commitBody?.(i.getValue()),Ai("leftPanel")}),s.arm("lint",750,()=>{l+=1;let d=l,p=i.getValue();fb("lint",{args:r,code:p}).then((c)=>{if(d!==l||Ke.functionEditor!==i||!wc(t)||!xc(i))return;if(c?.diagnostics)y1(i,c.diagnostics)})})})}async function Qr(){if(Ke._completionRegistered)return;Ke._completionRegistered=!0;let e=await bp();e.languages.registerCompletionItemProvider("javascript",{provideCompletionItems(t,n){if(!u.value)return{suggestions:[]};let a=u.value.doc.document?.state||{},r=t.getWordUntilPosition(n),o={endColumn:r.endColumn,endLineNumber:n.lineNumber,startColumn:r.startColumn,startLineNumber:n.lineNumber},i=new Map(mt(a).map((l)=>[l.name,l.description])),s=Object.entries(a).map(([l,d])=>{let p=e.languages.CompletionItemKind.Variable;if(d?.$prototype==="Function"||d?.$handler||i.has(l))p=e.languages.CompletionItemKind.Function;else if(d?.$prototype)p=e.languages.CompletionItemKind.Property;let c={insertText:`state.${l}`,kind:p,label:`state.${l}`,range:o},b=i.get(l);if(b)c.documentation=b;return c});for(let l of ut())s.push({documentation:l.description,insertText:`window.${l.label}`,kind:e.languages.CompletionItemKind.Function,label:l.label,range:o});return{suggestions:s}},triggerCharacters:["."]})}function Le(e){return nt(e)&&typeof e.operator==="string"}function Zr(e){if(e.startsWith("#/state/"))return e.slice(8);if(e.startsWith("window#/"))return e.slice(8).replaceAll("/",".");return e||"?"}function Xt(e){if(Ot(e))return Zr(e.$ref);if(Le(e))return`(${gt(e)})`;if(typeof e==="string")return JSON.stringify(e);return String(e)}function Xn(e,t){return[...e,...Array.from({length:t},()=>"target")]}function Qn(e,t){let n=[],a=e;for(;;){n.push(a);let s=a.target;if(Le(s))a=s;else break}let r=n.at(-1),o="target"in r||r.target!==void 0?{path:Xn(t,n.length),value:r.target}:null,i=n.map((s,l)=>({node:s,path:Xn(t,l)}));return{head:o,links:i.toReversed()}}function gt(e){if(!Le(e))return Xt(e);let{head:t,links:n}=Qn(e,[]),a=[];if(t)a.push(Xt(t.value));for(let r of n)a.push(String(r.node.operator));return a.join(" › ")}function Qt(e,t,n,a=!1){let r=t.join("/"),o=n?.values.get(r);return{badge:o??"",group:a,hasBadge:o!==void 0,key:r,label:e,path:t}}function eo(e,t){let n=[],a=(s,l)=>{if(Le(s))n.push(Qt(`(${gt(s)})`,l,t,!0))},{value:r,initial:o,cases:i}=e.node;if(Array.isArray(r))for(let[s,l]of r.entries())a(l,[...e.path,"value",s]);else a(r,[...e.path,"value"]);if(a(o,[...e.path,"initial"]),nt(i))for(let[s,l]of Object.entries(i))a(l,[...e.path,"cases",s]);return a(e.node.default,[...e.path,"default"]),n}function yt(e,t={}){if(!Le(e))return[];let n=t.preview??null,{head:a,links:r}=Qn(e,t.path??[]),o=[];if(a)o.push(Qt(Xt(a.value),a.path,n));for(let i of r)o.push(Qt(String(i.node.operator),i.path,n),...eo(i,n));return o}var Zn={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFormulaPalette",$description:"The formula palette (spec.md §19.9): a search field over the formula catalog, its results grouped by the catalog's own group order, and one pick that hands an entry back to whoever opened it. The same shape as `palette.json` — a scrim, a framed panel, a borderless field, a listbox — because it is the same gesture over a different corpus, and the two used to share a stylesheet by sharing its class names. `groups` is the filtered catalog already grouped; `activeId` is the highlight, and it is ONE string — the id the field points `aria-activedescendant` at and the id the listbox is handed as `active` — kept apart from the rows so a key moves it without the list reconciling, which is why every row carries the FLAT index it would otherwise have to be asked for. Panel position is the caller's: centred under the top edge by default, and pinned under an anchor control when one was named, which is the only thing about this surface a document cannot decide for itself — it arrives as `anchorLeft`/`anchorTop`, two numbers the `style` object below binds, because a style declaration may read state like any other value (spec.md §9.1).",tagName:"div",attributes:{part:"palette"},style:{$description:"The `.quick-search-*` rules the palette used to borrow from `styles/overlays.css`, brought here and re-valued. Every colour in the originals was a `--spectrum-*` name with a hex fallback, and a mounted document is outside `<sp-theme>` — so each of those resolved to its fallback and the palette had stopped following the chrome theme at all. The names now read from the kit's own layer, which is where a surface's colours come from.",display:"contents","--formula-palette-left":"${state.anchorLeft}px","--formula-palette-top":"${state.anchorTop}px",'& [part="overlay"]':{position:"fixed",inset:"0",zIndex:"1000",display:"flex",justifyContent:"center",paddingTop:"60px",background:"rgba(0, 0, 0, 0.4)"},'& [part="overlay"][hidden]':{display:"none"},'& [part="panel"]':{width:"560px",maxWidth:"calc(100vw - 32px)",maxHeight:"420px",display:"flex",flexDirection:"column",alignSelf:"flex-start",background:"var(--jx-bg-overlay)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-md)",boxShadow:"var(--jx-shadow-dialog)",color:"var(--jx-fg)",fontFamily:"var(--jx-font-sans)",overflow:"hidden"},'& [part="panel"][data-anchored]':{$description:"Opened from a control rather than from a chord: the panel hangs under that control instead of sitting under the top edge. The two custom properties are the only measured numbers in the surface — a rect belongs to the moment it was taken, so the adapter measures it once per open and this document binds the result. They used to travel as a `style` ATTRIBUTE the adapter assembled into one string, on the belief that a document cannot bind a style declaration to state; it can, and always could. They are declared at the top of this object rather than here because a reactive custom property in a rule targeting the element ITSELF is written inline under the author's own name (spec.md §9.1), and the panel then reads them by inheritance — the root is `display: contents`, so nothing sits between the two.",position:"fixed",left:"var(--formula-palette-left)",top:"var(--formula-palette-top)",margin:"0"},'& [part="input"]':{$description:"Borderless inside its own framed panel: the frame is the affordance and a second one around the field would only draw a box inside a box. The keyboard ring is given back explicitly, because the reader who arrives here by Tab has nothing else to go on.",flex:"0 0 auto",minWidth:"0",padding:"var(--jx-space-4) var(--jx-space-5)",font:"inherit",fontSize:"var(--jx-text-lg)",border:"none",borderBottom:"1px solid var(--jx-border)",outline:"none",background:"var(--jx-bg-input)",color:"var(--jx-fg)","::placeholder":{color:"var(--jx-fg-muted)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="results"]':{$description:"The list is the kit's `jx-listbox`, its groups the `role=\"group\"` wrappers that element's own definition names as the shape it draws headings for, and its rows `jx-option`s. The kit's row pads itself by `--jx-space-3`; the other half of the panel's 16px optical margin sits here, on the list, so the heading, the rows and the empty sentence all line up on one edge.",flex:"1",paddingInline:"var(--jx-space-3)"},'& [part="empty-slot"]':{display:"contents"},'& [part="option"] [part="label"]':{$description:"Monospaced because these are identifiers the reader will type: `??`, `?:`, `Math.max`. It is a rule rather than the kit's per-row `face`, because the whole catalogue draws this way — `face` is data a row carries, and every row carrying the same string would be this decision written once per entry.",fontFamily:"var(--jx-font-mono)",fontWeight:"500"},'& [part="option"] [part="description"]':{$description:"A `jx-select` row's note is a category at the END of the row, so the kit pushes it there with an auto margin. Here the note is what the identifier MEANS and reads as a definition beside it, while the far edge belongs to the kind badge. So the auto margin moves to the end slot.",marginInlineStart:"0"},'& [part="option"] [part="end"]':{marginInlineStart:"auto"},'& [part="badge"]':{flexShrink:"0",fontSize:"var(--jx-text-xs)",padding:"1px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-border)",color:"var(--jx-fg-dim)"},'& [part="option"][aria-selected="true"] [part="badge"]':{$description:"The highlight is keyed on `aria-selected`, which the listbox's sidecar is the single writer of — so the state a reader hears and the state a reader sees are one attribute rather than two that could disagree.",background:"transparent",border:"1px solid currentColor",color:"inherit"}},children:[{tagName:"div",attributes:{part:"overlay",hidden:"${state.open ? null : ''}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"},value:[]}]},children:[{tagName:"div",attributes:{part:"panel","data-anchored":"${state.anchored ? '' : null}"},onclick:{$prototype:"Function",body:[{stopPropagation:!0}]},children:[{tagName:"input",attributes:{part:"input",type:"text",role:"combobox","aria-controls":"formula-palette-listbox","aria-expanded":"${state.expanded ? 'true' : 'false'}","aria-activedescendant":"${state.activeId || null}","aria-autocomplete":"list","aria-label":"Search formulas, operators and globals",placeholder:"Search formulas, operators, globals…"},value:{$ref:"#/state/query"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activate"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/close"},value:[]}]}}]}},{tagName:"jx-listbox",attributes:{part:"results",id:"formula-palette-listbox"},$props:{label:"Formulas",active:"${state.activeId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activateRow"},value:[{$ref:"event#/detail"}]}],description:"One handler for every row, because a row's `select` bubbles. The detail is the row's `value`, which is the FLAT index it occupies across all the groups — the number the nested map cannot count for itself, and the number the id is built from."},children:[{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/isEmpty"},cases:{true:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyHint}"}}},{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"group",role:"group","aria-label":"${$map.item.label}"},children:[{tagName:"div",attributes:{part:"group-heading","aria-hidden":"true"},textContent:"${$map.item.label}"},{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{tagName:"jx-option",attributes:{part:"option",id:"formula-palette-option-${$map.item.index}",title:"${$map.item.description}","data-kind":"${$map.item.kind}"},$props:{value:"${$map.item.index}",label:{$ref:"$map/item/label"},description:{$ref:"$map/item/description"}},onmouseenter:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/hover"},value:[{$ref:"$map/item/index"}]}]},children:[{tagName:"span",attributes:{slot:"end",part:"badge"},textContent:"${$map.item.kind}"}]}}]}}]}]}]}]};T("formula-palette",Zn);var no="formula-palette",ao=568,Fe=!1,vt=null,Oe="",$e=0,ve=[],ea=null,bt=null,Zt=null;function aa(e){return`formula-palette-option-${e}`}function ro(){let e=vt?.entries??[],t=Oe.trim().toLowerCase();if(!t)return e;return e.filter((n)=>n.label.toLowerCase().includes(t)||n.name.toLowerCase().includes(t)||n.group.toLowerCase().includes(t)||n.description.toLowerCase().includes(t))}function io(e){let t=new Map;for(let[n,a]of e.entries()){let r={description:a.description,index:n,key:`${a.kind}:${a.name}`,kind:a.kind,label:a.label},o=t.get(a.group);if(o)o.rows.push(r);else t.set(a.group,{key:a.group,label:a.group,rows:[r]})}return[...t.values()]}function so(e){if(!e)return null;let t=He(e);if(t.top===0&&t.left===0&&t.width===0)return null;return{left:Math.max(8,Math.min(t.left,(globalThis.innerWidth||1200)-ao)),top:t.bottom+4}}function xt(){return ea??=v({activate:()=>{let e=ve[$e];if(e)na(e)},activateRow:(e)=>{let t=ve[Number(e)];if(t)na(t)},activeId:"",anchored:!1,anchorLeft:0,anchorTop:0,close:ra,emptyHint:"",expanded:!1,groups:[],hover:(e)=>{ta(e)},input:(e)=>{Oe=e,$e=0,en()},isEmpty:!0,move:(e)=>{if(ve.length===0)return;ta(Math.max(0,Math.min($e+e,ve.length-1)))},open:!1,query:""}),ea}function ta(e){$e=e,xt().activeId=aa(e)}function lo(){let e=ps("popover",no);if(Zt===e)return;let t=bt;if(Zt=e,bt=R("formula-palette",xt(),e),t)t.then((n)=>{n.dispose()})}function en(){let e=xt();if(e.open=Fe,!Fe){ve=[];return}let t=ro();ve=t,e.query=Oe,e.groups=io(t),e.isEmpty=t.length===0,e.emptyHint=Oe.trim()===""?"No entries available":"No results",e.expanded=t.length>0,e.activeId=t.length>0?aa($e):""}function po(){let e=bt;if(!e)return;e.then(()=>{setTimeout(()=>{if(Fe)Zt?.querySelector('[part="input"]')?.focus()},0)})}function na(e){let t=vt;ra(),t?.onPick(e)}function wt(e){Fe=!0,vt=e,Oe="",$e=0;let t=xt(),n=so(e.anchor??null);t.anchorLeft=n?.left??0,t.anchorTop=n?.top??0,t.anchored=n!==null,lo(),en(),po()}function ra(){if(Fe=!1,vt=null,bt)en()}var oa={$schema:"https://jxsuite.com/schema/v1",$id:"StudioExpressionEditor",$description:"The expression editor (spec.md §19.9): a `$expression` node edited as STRUCTURE — an operator, the operands that operator needs, and the live value of each. The rows arrive FLAT. An expression nests to any depth (an operand may be another expression, an aggregate's per-item body is one, and either may hold more of both) while a document's one repeater is `$prototype: \"Array\"` over a list, so `ui/expression-editor.ts` walks the tree once and hands over rows that already carry their own indent — recursion is a property of the walk, exactly as it is for the statement tree and the Data panel's value tree. Six kinds of row come out of that walk: the CHIP strip that summarises the whole pipeline, the preview's ERROR line, the OPERATOR row, an OPERAND row (the workhorse, which carries the value ladder and every literal control), a section LABEL, and an ACTION that grows the node. Five surfaces draw this — the Inspector's Content and Logic tabs, the Navigator's State panel, the statement editor and the Logic dock — and none of them is named here: each host has already said where it is, so this document stamps no region of its own.",tagName:"div",attributes:{part:"expression"},style:{$description:"What `.expression-editor`, `.expr-*`, `.switch-case-*`, `.array-object-*` and `.formula-chip*` said across `styles/inspector.css` and this module's own inline `style=` strings, keyed on `part` and re-pointed at the studio token layer. Three things changed on the way in. THE NESTING IS A VARIABLE: `.expression-editor--nested` was a bordered box per level, so an operand four deep was four boxes; `--expr-indent` is written per row and read by one shared rule, so a tree of any depth interns one declaration. `min-width: 0` IS ON EVERY LINK OF THE CHAIN, which is the defect that sent this editor to a stylesheet in the first place — a flex item's automatic minimum is its min-content width, so at Inspector width (280px) Operator, Target and Value were clipped by the right edge of the window. And every `--spectrum-*` reference is gone rather than renamed: those names resolve only inside `<sp-theme>`, and a document mounted in the Inspector's tab body, in a settings pane or in the Bottom dock is outside it, so each would silently have taken its hard-coded fallback and stopped following the theme.",display:"flex",flexDirection:"column",gap:"2px",minWidth:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-sm)",color:"var(--fg)",'& [part="chips"]':{$description:"The pipeline reads left to right and wraps rather than scrolling sideways: a chip you have to find by scrolling is one you do not know is there. Drawn from the same model the Logic dock draws (`ui/formula-chips.ts`), in this surface's own element set.",display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center",minWidth:"0",padding:"2px 0 6px"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",gap:"4px",maxWidth:"180px",minWidth:"0",padding:"1px 7px",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-lg)",background:"var(--bg-input)",color:"var(--fg)",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--jx-text-xs)",lineHeight:"18px",cursor:"pointer"},'& [part="chip"]:hover':{borderColor:"var(--accent)"},'& [part="chip"]:focus-visible':{outline:"2px solid var(--accent)",outlineOffset:"1px"},'& [part="chip"][data-group="true"]':{$description:"A parenthesised non-target operand — a `value`, an `initial`, one case of a `switch`. It is a branch off the chain rather than a link of it, and the dashed rule is what says so; `.formula-chip--group` carried no rule at all, so the distinction the model draws was invisible.",borderStyle:"dashed"},'& [part="chip-label"]':{maxWidth:"110px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& [part="row"]':{$description:"studio-ui-guidelines.md §4.1's standard form row, stacked, with its own indent. `display: flex` rather than `block` because an operand row carries a leading cell (an argument's name, a case's key) beside the field.",boxSizing:"border-box",display:"flex",alignItems:"flex-start",flexWrap:"wrap",gap:"4px",minWidth:"0",padding:"2px 0",marginInlineStart:"var(--expr-indent, 0)"},'& [part="row"][data-nested="true"]':{$description:"A nested expression reads as being INSIDE the operand above it. The rule on the leading edge is the connector, which is what `.expression-editor--nested` drew with a whole box per level.",borderInlineStart:"2px solid var(--border)",paddingInlineStart:"var(--jx-space-2)"},'& [part="field"]':{flex:"1 1 auto",minWidth:"0"},'& [part="widget"]':{$description:"The control line: what the row is edited with, and the live value beside it. It wraps, so a value-source picker and a literal editor stack rather than overflowing a 280px Inspector.",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",minWidth:"0"},'& [part="source"], & [part="literal-type"]':{flex:"0 1 auto",minWidth:"0"},'& [part="ref"], & [part="literal-text"], & [part="literal-number"], & [part="operator"]':{flex:"1 1 auto",minWidth:"0"},'& [part="literal"]':{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",flex:"1 1 auto",minWidth:"0"},'& [part="literal-null"]':{color:"var(--fg-dim)",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--jx-text-xs)"},'& [part="badge"]':{$description:"The live value (spec.md §19.9). A resolved formula is arbitrary text — an object, a URL, a paragraph — so it ellipsizes inside the line it annotates and never sets that line's width.",flex:"0 1 auto",minWidth:"0",maxWidth:"120px",overflow:"hidden",padding:"0 5px",borderRadius:"var(--jx-radius-sm)",background:"var(--bg)",color:"var(--success)",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--jx-text-xs)",lineHeight:"16px",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& [part="preview-error"]':{$description:"§16.1's inline tier: not a toast and not a problem record, because it is a property of the value currently in the editor and lives exactly as long as that value does.",margin:"0",padding:"2px 0",minWidth:"0",color:"var(--danger)",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--jx-text-xs)",lineHeight:"1.5"},'& [part="section"]':{flex:"1 1 auto",minWidth:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="lead"]':{$description:"An argument's positional name, or the `default` case's word. A fixed column so the operands under it line up at any width — which the inline `style=` string could never guarantee, because it could not carry `min-width: 0` for what sat beside it.",flex:"0 0 auto",width:"56px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",paddingBlockStart:"6px",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="case-key"]':{flex:"0 1 90px",minWidth:"0"},'& [part="empty"]':{$description:'The one empty-state pattern (`panels/empty-state.ts`), compact, drawn here because a document cannot render a lit helper. A picker whose only entry is a disabled "No state defined" is a dead end; this says what a binding IS instead.',display:"flex",flexDirection:"column",gap:"2px",flex:"1 1 auto",minWidth:"0",color:"var(--fg-dim)"},'& [part="empty-message"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5",fontSize:"var(--jx-text-sm)"},'& [part="empty-detail"]':{margin:"0",maxWidth:"34ch",fontSize:"var(--jx-text-xs)",opacity:"0.8"},'& [part="action"]':{flex:"0 0 auto"}},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:{chips:{tagName:"div",attributes:{part:"chips",role:"group","aria-label":"Formula pipeline"},children:[{$prototype:"Array",items:{$ref:"$map/item/chips"},key:{$ref:"$map/item/key"},map:{$description:"A chip's key is the joined node path, which is self-contained on purpose: this `$map` shadows the row's own `$map.item`, so nothing inside it can reach back to the row.",tagName:"button",attributes:{part:"chip",type:"button","data-path":"${$map.item.key}","data-group":"${$map.item.group}",title:"${$map.item.label}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickChip"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"chip-badge-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasBadge"},cases:{true:{tagName:"span",attributes:{part:"badge",title:"${$map.item.badge}"},textContent:"${$map.item.badge}"}}}]}}]},error:{tagName:"p",attributes:{part:"preview-error",role:"alert"},textContent:"${$map.item.label}"},operator:{tagName:"div",attributes:{part:"row","data-prop":"${$map.item.prop}","data-nested":"${$map.item.nested}"},style:{"--expr-indent":{$ref:"$map/item/indent"}},children:[{tagName:"jx-field",attributes:{part:"field"},$props:{label:{$ref:"$map/item/label"},span:!0},children:[{tagName:"div",attributes:{part:"widget"},children:[{tagName:"jx-select",attributes:{part:"operator"},$props:{size:"sm",label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},groups:{$ref:"$map/item/groups"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOperator"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"span",attributes:{part:"catalog-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/catalog"},cases:{true:{tagName:"jx-action-button",attributes:{part:"catalog"},$props:{size:"sm",quiet:!0,icon:"brackets-curly",haspopup:"dialog",label:{$ref:"$map/item/title"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[{$ref:"$map/item/key"},{$ref:"event#/currentTarget"}]}]}}}},{tagName:"span",attributes:{part:"badge-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasBadge"},cases:{true:{tagName:"span",attributes:{part:"badge",title:"${$map.item.badge}"},textContent:"${$map.item.badge}"}}}]}]}]},operand:{tagName:"div",attributes:{part:"row","data-prop":"${$map.item.prop}","data-nested":"${$map.item.nested}","data-source":"${$map.item.source}"},style:{"--expr-indent":{$ref:"$map/item/indent"}},children:[{$description:"The leading cell: an argument's positional name, one `switch` case's matched value (which is EDITABLE, because a case's key IS the value it matches), or the `default` case's word. `none` draws nothing at all, which is every ordinary Target / Value / Initial row.",tagName:"div",attributes:{part:"lead-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/lead"},cases:{arg:{tagName:"span",attributes:{part:"lead"},textContent:"${$map.item.leadLabel}"},default:{tagName:"span",attributes:{part:"lead"},textContent:"${$map.item.leadLabel}"},case:{$description:"Committed on change rather than on input: renaming a case rebuilds the branch under it, and doing that per keystroke would take the caret out of the field being typed into.",tagName:"jx-textfield",attributes:{part:"case-key"},$props:{size:"sm",label:"Case value",placeholder:"value",value:{$ref:"$map/item/leadValue"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameCase"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-field",attributes:{part:"field"},$props:{label:{$ref:"$map/item/label"},span:!0},children:[{tagName:"div",attributes:{part:"widget"},children:[{$description:"The value ladder (§6.6), in the one vocabulary `ui/value-source.ts` owns. It is absent where the position admits a single shape — an assignment target, a `call`'s callee — because a picker with one entry is a control that asks a question with one answer.",tagName:"span",attributes:{part:"source-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/chooser"},cases:{true:{tagName:"jx-select",attributes:{part:"source"},$props:{size:"sm",label:"Value source",value:{$ref:"$map/item/source"},options:{$ref:"$map/item/sourceOptions"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSource"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{$description:"The rung itself. `expression` draws NOTHING: the rows beneath this one, one indent deeper, are the nested expression — which is what makes recursion a property of the walk rather than of this document.",tagName:"div",attributes:{part:"rung-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/source"},cases:{literal:{tagName:"div",attributes:{part:"literal"},children:[{tagName:"jx-select",attributes:{part:"literal-type"},$props:{size:"sm",label:"Literal type",value:{$ref:"$map/item/literalType"},options:{$ref:"$map/item/typeOptions"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setLiteralType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"literal-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/literal"},cases:{text:{tagName:"jx-textfield",attributes:{part:"literal-text"},$props:{size:"sm",label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setText"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},number:{tagName:"jx-number-field",attributes:{part:"literal-number"},$props:{size:"sm",label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNumber"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},bool:{tagName:"jx-checkbox",attributes:{part:"literal-bool"},$props:{size:"sm",label:"true",checked:{$ref:"$map/item/checked"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBool"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]}},null:{tagName:"span",attributes:{part:"literal-null"},textContent:"null"}}}]},ref:{$description:"A ref the list does not hold keeps its own row: the kit's select synthesises a stand-in for a value no option carries, so the `__custom__` sentinel this editor used to draw — a row that had to be ignored inside its own change handler — is gone.",tagName:"jx-select",attributes:{part:"ref"},$props:{size:"sm",label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},options:{$ref:"$map/item/refOptions"},groups:{$ref:"$map/item/refGroups"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRef"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"${$map.item.emptyMessage}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${$map.item.emptyDetail}"}]}}},{tagName:"span",attributes:{part:"badge-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasBadge"},cases:{true:{tagName:"span",attributes:{part:"badge",title:"${$map.item.badge}"},textContent:"${$map.item.badge}"}}}]}]},{tagName:"div",attributes:{part:"remove-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/removable"},cases:{true:{tagName:"jx-action-button",attributes:{part:"remove"},$props:{size:"sm",quiet:!0,icon:"trash",label:{$ref:"$map/item/title"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/key"}]}]}}}}]},label:{tagName:"div",attributes:{part:"row","data-prop":"${$map.item.prop}","data-nested":"${$map.item.nested}"},style:{"--expr-indent":{$ref:"$map/item/indent"}},children:[{tagName:"span",attributes:{part:"section"},textContent:"${$map.item.label}"}]},action:{tagName:"div",attributes:{part:"row","data-nested":"${$map.item.nested}"},style:{"--expr-indent":{$ref:"$map/item/indent"}},children:[{tagName:"jx-action-button",attributes:{part:"action","data-action":"${$map.item.key}"},$props:{size:"sm",quiet:!0,icon:"plus",label:{$ref:"$map/item/label"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/act"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}]}}}}]};T("expression-editor",oa);var kt=new Map;function ia(e,t,n){let a=kt.get(e);if(a&&!a.disposed&&(a.handle===null||a.handle.root.isConnected)){a.scope.rows=t;return}la(e,a),e.textContent="";let r=v({...n,rows:t}),o={disposed:!1,handle:null,scope:r};kt.set(e,o),R("expression-editor",r,e).then((i)=>{if(o.disposed){i.dispose();return}o.handle=i})}function sa(){for(let[e,t]of kt)if(!e.isConnected)la(e,t)}function la(e,t){if(!t)return;t.disposed=!0,t.handle?.dispose(),t.handle=null,kt.delete(e)}var fa=new Set(["!","-"]),uo=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),tn=new Set(["=","+=","-=","*=","/="]);function ga(e){let t=e?.operator;return typeof t==="string"&&tn.has(t)}var ha=new Set(["pop","shift"]),ya=new Set(["push","unshift"]),mo=new Set(["flat","normalize","toLocaleLowerCase","toLocaleString","toLocaleUpperCase","toLowerCase","toReversed","toSorted","toUpperCase","trim","trimEnd","trimStart"]),fo=[{label:"Assignment",ops:["=","+=","-=","*=","/="]},{label:"Unary",ops:["!","-"]},{label:"Arithmetic",ops:["+","-","*","/","%"]},{label:"Comparison",ops:["===","!==","<","<=",">",">="]},{label:"Logical",ops:["&&","||","??"]},{label:"Conditional",ops:["?:","switch"]},{label:"Array methods",ops:["push","pop","shift","unshift","splice"]},{label:"Pure methods (String)",ops:["toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize"]},{label:"Pure methods (Array)",ops:["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with"]},{label:"Pure methods (Number)",ops:["toFixed","toPrecision","toLocaleString"]},{label:"Aggregate",ops:["reduce","map","filter"]},{label:"Function",ops:["call"]}],ba=fo.map((e)=>({id:e.label,label:e.label,rows:e.ops.map((t)=>({label:t,value:t}))}));function go(e){let t=new Set(e);return ba.map((n)=>({...n,rows:n.rows.filter((a)=>t.has(a.value))})).filter((n)=>n.rows.length>0)}var pa=[{label:wo.literal,value:"literal"},{label:wo.ref,value:"ref"},{label:wo.expression,value:"expression"}],ho=[{label:"str",value:"string"},{label:"num",value:"number"},{label:"bool",value:"boolean"},{label:"null",value:"null"}],yo={boolean:"bool",null:"null",number:"number",string:"text"},bo=["event#/detail","event#/target/value"],da="A binding points at a value this page holds.",ma="Add one in the State panel and it shows up here.",z={callArgs:!1,needsInitial:!1,needsValue:!1,spliceArray:!1,switchCases:!1,targetMustBeRef:!1,valueIsNode:!1};function va(e){if(fa.has(e))return{...z};if(e==="?:")return{...z,needsInitial:!0,needsValue:!0};if(e==="switch")return{...z,switchCases:!0};if(e==="call")return{...z,callArgs:!0,targetMustBeRef:!0};if(xp.has(e))return{...z,needsValue:!mo.has(e)};if(uo.has(e))return{...z,needsValue:!0};if(tn.has(e))return{...z,needsValue:!0,targetMustBeRef:!0};if(ha.has(e))return{...z,targetMustBeRef:!0};if(ya.has(e))return{...z,needsValue:!0,targetMustBeRef:!0};if(e==="splice")return{...z,needsValue:!0,spliceArray:!0,targetMustBeRef:!0};if(e==="reduce")return{...z,needsInitial:!0,needsValue:!0,targetMustBeRef:!0,valueIsNode:!0};if(e==="map"||e==="filter")return{...z,needsValue:!0,targetMustBeRef:!0,valueIsNode:!0};return{...z}}function $a(e){if(e&&typeof e==="object"){if("$ref"in e)return"ref";if("operator"in e)return"expression"}return"literal"}function vo(e,t){let n=Ot(e)?e.$ref:"",a=n?Un(n,t):void 0;return a?.kind==="formula"?a.parameters.map((r)=>r.name):[]}function $o(e){if(e==="ref")return{$ref:""};if(e==="expression")return{operator:"!",target:null};return null}function xo(e){if(e===null||e===void 0)return"null";if(typeof e==="boolean")return"boolean";if(typeof e==="number")return"number";return"string"}function ko(e){if(e==="number")return 0;if(e==="boolean")return!1;if(e==="null")return null;return""}function xa(e){if(!nt(e)||typeof e.operator!=="string")return"$expression";let t=e,n=t.operator,{target:a}=t,r=Ot(a)?a.$ref.replace("#/state/",""):nt(a)&&typeof a.operator==="string"?`(${a.operator}…)`:String(a??"?");if(tn.has(n)||ya.has(n))return`${n} ${r}`;if(ha.has(n))return`${n}(${r})`;if(n==="splice")return`splice(${r})`;if(n==="call")return`${r.replace("window#/","").replaceAll("/",".")}(…)`;if(n==="reduce"||n==="map"||n==="filter"||xp.has(n))return`${n}(${r})`;if(n==="?:")return`${r} ? … : …`;if(n==="switch")return`switch(${r})`;if(fa.has(n))return`${n}${r}`;return`${r} ${n} …`}function Q(e){return{badge:"",catalog:!1,checked:!1,chips:[],chooser:!1,emptyDetail:"",emptyMessage:"",groups:[],hasBadge:!1,indent:"0",label:"",lead:"none",leadLabel:"",leadValue:"",literal:"",literalType:"",nested:"false",prop:"",refGroups:[],refOptions:[],removable:!1,source:"literal",sourceOptions:[],title:"",typeOptions:[],value:"",...e}}function xe(e){return`${e*4}px`}function wa(e,t){let n=e.preview?.values.get(t);return{badge:n??"",hasBadge:n!==void 0}}function ue(e,t,n,a){let{allowEventRef:r,stateDefs:o}=e.opts,i=(o||[]).map((b)=>`#/state/${b}`),s=t?.$ref??"",l={setRef:(b)=>n({$ref:b})};if(a.renameCase)l.renameCase=a.renameCase;if(a.remove)l.remove=a.remove;let d={...wa(e,a.badgeKey),indent:xe(a.depth),label:a.label,lead:a.lead??"none",leadLabel:a.leadLabel??"",leadValue:a.leadValue??"",nested:a.depth>0?"true":"false",prop:a.prop,refGroups:r?[{id:"event",label:"Event",rows:bo.map((b)=>({label:b,value:b}))}]:[],refOptions:i.map((b)=>({label:b.replace("#/state/",""),value:b})),removable:Boolean(a.removable),title:a.title??"",value:s},p=i.length===0&&!r&&!s;if(a.mustBeRef){e.plans.set(a.key,l),e.rows.push(Q({...d,emptyDetail:p?ma:"",emptyMessage:p?da:"",key:a.key,kind:"operand",source:p?"empty":"ref"}));return}let c=$a(t);if(l.setSource=(b)=>n($o(b)),c==="literal"){let b=xo(t),w=Number(t??0);l.setLiteralType=(k)=>n(ko(k)),l.setText=(k)=>n(k),l.setNumber=(k)=>n(Number(k)),l.setBool=(k)=>n(k),e.plans.set(a.key,l),e.rows.push(Q({...d,checked:Boolean(t),chooser:!0,key:a.key,kind:"operand",literal:yo[b],literalType:b,source:"literal",sourceOptions:pa,typeOptions:ho,value:b==="number"?String(w):String(t??"")}));return}if(e.plans.set(a.key,l),e.rows.push(Q({...d,chooser:!0,emptyDetail:c==="ref"&&p?ma:"",emptyMessage:c==="ref"&&p?da:"",key:a.key,kind:"operand",source:c==="ref"&&p?"empty":c,sourceOptions:pa})),c==="expression")nn(e,t,n,a.depth+1,a.path)}function So(e,t,n,a,r,o){let i=Array.isArray(t)?t:[];for(let[l,d]of i.entries()){let p=[...r,"value",l],c=o.labels[l]??o.fallbackLabel;ue(e,d,(b)=>{let w=[...i];w[l]=b,n(w)},{badgeKey:"",depth:a,key:p.join("/"),label:c,leadLabel:c,lead:"arg",mustBeRef:!1,path:p,prop:"value",remove:()=>{let b=i.filter((w,k)=>k!==l);n(b.length>0?b:[null])},removable:!0,title:`Remove ${c}`})}let s=`${r.join("/")}::add-arg`;e.plans.set(s,{act:()=>n([...i,null])}),e.rows.push(Q({indent:xe(a),key:s,kind:"action",label:"+ Add arg",nested:a>0?"true":"false"}))}function Eo(e,t,n,a,r){let o=nt(t.cases)?t.cases:{},i=Object.entries(o),s=(p)=>n({...t,cases:p});for(let[p,c]of i){let b=[...r,"cases",p];ue(e,c,(w)=>s({...o,[p]:w}),{badgeKey:b.join("/"),depth:a,key:b.join("/"),label:`Case ${p}`,lead:"case",leadValue:p,mustBeRef:!1,path:b,prop:"cases",remove:()=>{let w={...o};delete w[p],s(w)},removable:!0,renameCase:(w)=>{if(w===p)return;let k={};for(let[x,h]of i)k[x===p?w:x]=h;s(k)},title:`Remove case ${p}`})}let l=[...r,"default"];ue(e,t.default,(p)=>n({...t,default:p}),{badgeKey:l.join("/"),depth:a,key:l.join("/"),label:"Default",lead:"default",leadLabel:"default",mustBeRef:!1,path:l,prop:"default"});let d=`${r.join("/")}::add-case`;e.plans.set(d,{act:()=>{let p=i.length+1,c=`case ${p}`;while(Object.hasOwn(o,c))p+=1,c=`case ${p}`;s({...o,[c]:null})}}),e.rows.push(Q({indent:xe(a),key:d,kind:"action",label:"+ Add case",nested:a>0?"true":"false"}))}function Co(e,t){let n=va(t),a={operator:t,target:e.target};if(n.targetMustBeRef&&$a(e.target)!=="ref")a.target={$ref:""};if(n.needsValue)if(n.valueIsNode){let r=e.value;a.value=r?.operator?e.value:{operator:"!",target:null}}else if(n.spliceArray)a.value=Array.isArray(e.value)?e.value:[null];else a.value=e.value??null;if(n.needsInitial)a.initial=e.initial??(t==="?:"?null:0);if(n.switchCases){if(a.cases=nt(e.cases)?e.cases:{},"default"in e)a.default=e.default}if(n.callArgs)a.value=Array.isArray(e.value)?e.value:[];return a}function nn(e,t,n,a,r){let o=t&&typeof t==="object"?t:{operator:"=",target:null},i=o.operator||"=",s=va(i),l=r.join("/"),d=(...x)=>[...r,...x].join("/"),{opts:p,preview:c}=e;if(a===0){let x=yt(o,{path:r,preview:c});if(x.length>0){for(let h of x)e.chipPaths.set(h.key,h.path);e.rows.push(Q({chips:x.map((h)=>({badge:h.badge,group:h.group?"true":"false",hasBadge:h.hasBadge,key:h.key,label:h.label})),key:"::chips",kind:"chips"}))}if(c?.error)e.rows.push(Q({key:"::error",kind:"error",label:c.error}))}let b=a===0&&c&&!c.mutating?wa(e,l):{badge:"",hasBadge:!1},w=a===0?p.operators:void 0,k=`${l}::operator`;if(e.plans.set(k,{...w?{}:{browse:(x)=>wt({anchor:x,entries:ft(p.stateEntries),onPick:(h)=>ct(h,n,{onInsertDef:p.onInsertDef,stateEntries:p.stateEntries})})},setOperator:(x)=>n(Co(o,x))}),e.rows.push(Q({...b,catalog:w===void 0,groups:w?go(w):ba,indent:xe(a),key:k,kind:"operator",label:"Operator",nested:a>0?"true":"false",prop:"operator",title:"Browse catalog",value:i})),ue(e,o.target,(x)=>n({...o,target:x}),{badgeKey:d("target"),depth:a,key:`${l}::target`,label:i==="?:"?"If":i==="switch"?"On":i==="call"?"Callee":"Target",mustBeRef:s.targetMustBeRef,path:[...r,"target"],prop:"target"}),s.needsValue&&!s.valueIsNode&&!s.spliceArray)ue(e,o.value,(x)=>n({...o,value:x}),{badgeKey:d("value"),depth:a,key:`${l}::value`,label:i==="?:"?"Then":"Value",mustBeRef:!1,path:[...r,"value"],prop:"value"});if(s.needsValue&&s.valueIsNode)e.rows.push(Q({indent:xe(a),key:`${l}::per-item`,kind:"label",label:"Per-item",nested:a>0?"true":"false",prop:"value"})),nn(e,o.value?.operator?o.value:{operator:"!",target:null},(x)=>n({...o,value:x}),a+1,[...r,"value"]);if(s.spliceArray||s.callArgs)e.rows.push(Q({indent:xe(a),key:`${l}::args`,kind:"label",label:"Args",nested:a>0?"true":"false",prop:"value"})),So(e,o.value,(x)=>n({...o,value:x}),a,r,s.callArgs?{fallbackLabel:"arg",labels:vo(o.target,p.stateEntries)}:{fallbackLabel:"item",labels:["start","del","item"]});if(s.switchCases)Eo(e,o,n,a,r);if(s.needsInitial)ue(e,o.initial,(x)=>n({...o,initial:x}),{badgeKey:d("initial"),depth:a,key:`${l}::initial`,label:i==="?:"?"Else":"Initial",mustBeRef:!1,path:[...r,"initial"],prop:"initial"})}function ka(e){return{chipPaths:new Map,opts:e,plans:new Map,preview:e.preview??null,rows:[]}}function No(e,t,n){let a=ka(n);return nn(a,e,t,n.depth??0,n.path??[]),{chipPaths:a.chipPaths,plans:a.plans,rows:a.rows}}function To(e,t,n){let a=ka(n),r=n.path??[];return ue(a,e,t,{badgeKey:r.join("/"),depth:n.depth??0,key:`${r.join("/")}::operand`,label:n.label??"Value",mustBeRef:!1,path:r,prop:n.prop??"operand"}),{chipPaths:a.chipPaths,plans:a.plans,rows:a.rows}}var Me=new Map;function Ro(e){let t=(n)=>Me.get(e)?.projection.plans.get(n);return{act:(n)=>t(n)?.act?.(),browse:(n,a)=>t(n)?.browse?.(a),pickChip:(n)=>{let a=Me.get(e),r=a?.projection.chipPaths.get(n);if(r)a?.opts.onChipSelect?.(r)},remove:(n)=>t(n)?.remove?.(),renameCase:(n,a)=>t(n)?.renameCase?.(a),setBool:(n,a)=>t(n)?.setBool?.(a),setLiteralType:(n,a)=>t(n)?.setLiteralType?.(a),setNumber:(n,a)=>t(n)?.setNumber?.(a),setOperator:(n,a)=>t(n)?.setOperator?.(a),setRef:(n,a)=>t(n)?.setRef?.(a),setSource:(n,a)=>t(n)?.setSource?.(a),setText:(n,a)=>t(n)?.setText?.(a)}}function Sa(e,t,n){for(let a of Me.keys())if(!a.isConnected)Me.delete(a);sa(),Me.set(e,{opts:n,projection:t}),ia(e,t.rows,Ro(e))}function wl(e,t,n,a){Sa(e,No(t,n,a),a)}function St(e,t,n,a){Sa(e,To(t,n,a),a)}function Ea(e){if(e===void 0)return"undefined";let t;try{t=typeof e==="string"?JSON.stringify(e):JSON.stringify(e)??"undefined"}catch{t=String(e)}if(t.length>48)t=`${t.slice(0,47)}…`;return t}function Ca(e,t){if(!t||!e||typeof e!=="object"||!("operator"in e))return null;let n;try{n=structuredClone(re(t))}catch{return null}let a=new Map,r=e,o=null;try{Bs(r,n,null,void 0,{report:(i,s)=>a.set(i.join("/"),Ea(s))})}catch(i){o=i instanceof Error?i.message:String(i)}return{error:o,mutating:Tm(r.operator),values:a}}var Po=100,an=new Map;function Ao(e,t){return JSON.stringify([e,t])}function jo(e){return Boolean(e&&typeof e==="object"&&"operator"in e)}function Na(e,t,n){return{error:n,mutating:Tm(e.operator),values:new Map(t)}}async function Lo(e,t,n){let r=(await O1(e.id,[{id:"0",node:t}],n))?.find((o)=>o.id==="0");return r?Na(t,r.values,r.error??null):null}function If(e,t,n,a=null,r){if(!e||!jo(n))return null;let o=Ao(n,a);Fo(e,t,n,a,o,r);let i=e.session.canvas.livePreviews?.[t];if(i&&i.key===o)return Na(n,i.values,i.error);return Ca(n,e.session.canvas.scope)}function Fo(e,t,n,a,r,o){let i=`${e.id}\x00${t}`,s=an.get(i);if(s)clearTimeout(s);an.set(i,setTimeout(()=>{an.delete(i),(async()=>{let l=await Lo(e,n,a);if(!l)return;let d={error:l.error,key:r,values:[...l.values.entries()]},p=e.session.canvas.livePreviews?.[t],c=!p||p.key!==r||p.error!==d.error||JSON.stringify(p.values)!==JSON.stringify(d.values);if((e.session.canvas.livePreviews??={})[t]=d,c)o?.()})()},Po))}var Ta={$schema:"https://jxsuite.com/schema/v1",$id:"StudioLogicWorkspace",$description:'Logic — the Bottom dock tab where a formula and a function body are edited BESIDE the page they compute. One tab, two surfaces, one header: `panels/formula-workspace.ts` decides which of them is open (a `$expression` or a Monaco body), what it is called and what its verbs are, and this draws both. The chip pipeline is a projection of `ui/formula-chips.ts`\'s model — the expression tree read left to right — and a chip click reports its key back; nothing here unrolls a tree, reads a document or evaluates anything. Three ISLANDS, each an empty host this document draws and the flow fills (studio-ui-guidelines.md §9.4): `[part="code-host"]` takes Monaco, `[part="editor-host"]` takes the expression editor, which is a lit surface of its own and another conversion\'s to move, and one `[part="tree-host"]` per data-rail entry takes the value tree, which is a mounted document of its own (`surfaces/panel-data.json`). The rail\'s trees had been empty since that tree became a document, because the lit takeover rendered a host nothing ever filled; announcing them is what fills them.',tagName:"div",attributes:{part:"workspace"},style:{$description:"What the seventeen `fw-*` rules of `styles/panels.css` said, keyed on `part`. THE CONSTRAINT IS THE HEIGHT, and it is why every rule here looks tight: a dock is not a stage, so the whole surface has to fit ~240px with the page still rendering above it — the header, the chip pipeline and the result are one line each, and only the editor and the data rail scroll. Four token families moved on the way. `--spectrum-font-size-50` and `--spectrum-font-size-75` resolve only inside `<sp-theme>`, and this document is mounted in the Bottom dock's body where that element is not an ancestor, so both would silently have taken their px fallback: they are the kit's own scale here (`--jx-text-sm`, `--jx-text-md`), which is the step each of them was. A CHIP's greys were `--spectrum-gray-100/300/800`, the same problem, and they are the studio layer's `--bg-input`, `--border` and `--fg` — the three roles they were chosen for. A live BADGE was `--spectrum-gray-200` on `--spectrum-seafoam-900`; a resolved value is the reading that says the formula works, so it is `--success` on `--bg`. And a chip's 10px radius is `--jx-radius-lg`, which is that value exactly. Two rules were DELETED rather than moved: `.fw-browse-catalog` and `.fw-close` styled nothing — they existed so a lit template could hold a handle on its own button — and `jx-action-button` is the button.",display:"flex",flexDirection:"column",minHeight:"0",height:"100%",background:"var(--bg-panel)",color:"var(--fg)",fontFamily:"var(--jx-font-sans)",'& [part="frame"]':{display:"flex",flexDirection:"column",flex:"1",minHeight:"0"},'& [part="formula"]':{$description:"The formula surface's own column inside the frame: chips, the two-column body, and the result line. It is a second flex column rather than the header's sibling because the header is shared with the code surface and this is not.",display:"flex",flexDirection:"column",flex:"1",minHeight:"0"},'& [part="frame"][data-surface="code"]':{$description:"The code surface has no chip strip, no rail and no result line, so Monaco takes the height the formula surface spends on all three.",overflow:"hidden"},'& [part="header"]':{display:"flex",flexShrink:"0",gap:"8px",alignItems:"center",padding:"6px 10px",borderBottom:"1px solid var(--border)"},'& [part="title"]':{overflow:"hidden",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--jx-text-md)",color:"var(--fg)",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& [part="kind"]':{flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="gap"]':{$description:"The header is a row of two groups — what is open, and what you can do to it — and this is the space between them. A margin on the verbs would have to be spelled on whichever verb happens to come first, which changes when one of them is conditional.",flex:"1",minWidth:"0"},'& [part="chips"]':{$description:"The pipeline reads left to right and wraps rather than scrolling sideways: a chip you have to find by scrolling is one you do not know is there. It never shrinks, because it is the surface's table of contents.",display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center",flexShrink:"0",padding:"4px 10px",borderBottom:"1px solid var(--border)"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",gap:"4px",maxWidth:"180px",padding:"1px 7px",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-lg)",background:"var(--bg-input)",color:"var(--fg)",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--jx-text-sm)",lineHeight:"18px",cursor:"pointer"},'& [part="chip"]:hover':{$description:"The takeover's chips had no hover state at all, which made a row of pressable things look like a row of labels. Nothing else on this surface changes colour on hover, so the border is enough to say it.",borderColor:"var(--accent)"},'& [part="chip-label"]':{maxWidth:"110px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& [part="badge"]':{$description:"The live value (spec.md §19.9). A resolved formula is arbitrary text — an object, a URL, a paragraph — so it ellipsizes inside the chip it annotates and never sets the chip's width.",flex:"0 1 auto",minWidth:"0",maxWidth:"120px",overflow:"hidden",padding:"0 5px",borderRadius:"var(--jx-radius-sm)",background:"var(--bg)",color:"var(--success)",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--jx-text-xs)",lineHeight:"16px",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& [part="body"]':{$description:"The two columns, and the only thing in the tab that scrolls vertically.",display:"flex",flex:"1",minHeight:"0"},'& [part="editor"]':{flex:"1",minWidth:"0",overflow:"auto",padding:"8px 10px"},'& [part="selected"]':{display:"flex",gap:"4px",paddingBottom:"6px",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="selected-node"]':{minWidth:"0",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontFamily:"var(--font-mono, monospace)"},'& [part="editor-host"]':{$description:"The expression editor's island. It gets `min-width: 0` and nothing else: the editor inside it is a flex chain that must be allowed to shrink, and this is the rung of it this document owns.",minWidth:"0"},'& [part="rail"]':{$description:"Narrower than the takeover's 280px slab: at dock height it is a reference column beside the editor, and the live values it used to be the only source of are on the canvas now.",flex:"0 0 200px",overflow:"auto",padding:"8px 10px",borderLeft:"1px solid var(--border)"},'& [part="rail-title"]':{paddingBottom:"6px",fontSize:"var(--jx-text-sm)",letterSpacing:"0.5px",color:"var(--fg-dim)",textTransform:"uppercase"},'& [part="entry"]':{marginBottom:"8px"},'& [part="entry-head"]':{display:"flex",gap:"6px",alignItems:"baseline"},'& [part="entry-name"]':{fontFamily:"var(--font-mono, monospace)",fontSize:"var(--jx-text-md)",color:"var(--fg)"},'& [part="entry-type"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="tree-host"]':{$description:"What `.data-tree` said. One entry's value tree is a mounted document of its own, and a deep one is capped rather than allowed to push the entries under it off the rail.",padding:"2px 0",maxHeight:"300px",overflowY:"auto"},'& [part="code-host"]':{$description:"Monaco's host. It must have a real height of its own — the editor measures its container, and a flex item with an `auto` minimum would report the editor's own content height back at itself.",flex:"1",minHeight:"0"},'& [part="result"]':{flexShrink:"0",display:"flex",gap:"6px",overflow:"hidden",padding:"6px 10px",borderTop:"1px solid var(--border)",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--jx-text-md)",color:"var(--success)",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& [part="result-text"]':{minWidth:"0",overflow:"hidden",textOverflow:"ellipsis"},'& [part="result"][data-tone="error"]':{color:"var(--danger)"},'& [part="result"][data-tone="pending"]':{$description:'Not a value: a sentence saying why there is none. It leaves the monospace face the two real answers wear, so "nothing has evaluated this yet" cannot be misread as a result.',fontFamily:"var(--jx-font-sans)",color:"var(--fg-dim)"},'& [part="result-note"]':{flexShrink:"0",color:"var(--fg-dim)"},'& [part="empty"]':{$description:"The one empty-state pattern (`panels/empty-state.ts`), drawn here because a document cannot render a lit helper. `.empty-state` keeps its stylesheet while every panel still lit renders through that helper, so this is a copy rather than a move.",display:"flex",flex:"1",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-6)",textAlign:"center",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="empty-message"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"}},children:[{tagName:"div",attributes:{part:"state-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/state"},cases:{empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"${state.emptyMessage}"}]},ready:{tagName:"div",attributes:{part:"frame","data-surface":"${state.surface}"},children:[{tagName:"div",attributes:{part:"header"},children:[{tagName:"span",attributes:{part:"title",title:"${state.titleHint}"},textContent:"${state.glyph} ${state.name}"},{tagName:"span",attributes:{part:"kind"},textContent:"${state.kind}"},{tagName:"span",attributes:{part:"gap","aria-hidden":"true"}},{tagName:"span",attributes:{part:"catalog-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasCatalog"},cases:{true:{tagName:"jx-action-button",attributes:{part:"catalog"},$props:{size:"sm",quiet:!0,icon:"brackets-curly",haspopup:"menu",label:"Browse catalog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browseCatalog"},value:[{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"Catalog"}]}}},{tagName:"jx-action-button",attributes:{part:"close"},$props:{size:"sm",quiet:!0,icon:"x",label:"Close"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"}}]},children:[{tagName:"span",textContent:"Close"}]}]},{tagName:"div",attributes:{part:"surface-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/surface"},cases:{code:{tagName:"div",attributes:{part:"code-host"}},missing:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"${state.missingMessage}"}]},formula:{tagName:"div",attributes:{part:"formula"},children:[{tagName:"div",attributes:{part:"chips",role:"group","aria-label":"Formula pipeline"},children:[{$prototype:"Array",items:{$ref:"#/state/chips"},key:{$ref:"$map/item/key"},map:{tagName:"button",attributes:{part:"chip",type:"button","data-path":"${$map.item.key}",title:"${$map.item.label}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/selectChip"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"badge-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasBadge"},cases:{true:{tagName:"span",attributes:{part:"badge",title:"${$map.item.badge}"},textContent:"${$map.item.badge}"}}}]}}]},{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"editor"},children:[{tagName:"div",attributes:{part:"selected"},children:[{tagName:"span",attributes:{part:"selected-label"},textContent:"Selected:"},{tagName:"span",attributes:{part:"selected-node"},textContent:"${state.selectedSummary}"}]},{tagName:"div",attributes:{part:"editor-host"}}]},{tagName:"div",attributes:{part:"rail"},children:[{tagName:"div",attributes:{part:"rail-title"},textContent:"Data"},{tagName:"div",attributes:{part:"rail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasScope"},cases:{false:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"${state.scopeEmptyMessage}"}]},true:{tagName:"div",attributes:{part:"rail-list"},children:[{$prototype:"Array",items:{$ref:"#/state/scopeEntries"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"entry","data-entry":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"entry-head"},children:[{tagName:"span",attributes:{part:"entry-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"entry-type"},textContent:"${$map.item.type}"}]},{tagName:"div",attributes:{part:"tree-host"}}]}}]}}}]}]},{tagName:"div",attributes:{part:"result","data-tone":"${state.resultTone}",role:"status"},children:[{tagName:"span",attributes:{part:"result-text"},textContent:"${state.resultText}"},{tagName:"span",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasResultNote"},cases:{true:{tagName:"span",attributes:{part:"result-note"},textContent:"${state.resultNote}"}}}]}]}}}]}}}]};T("logic-workspace",Ta);function rn(){return{chips:[],emptyMessage:"",glyph:"",hasCatalog:!1,hasResultNote:!1,hasScope:!1,kind:"",missingMessage:"",name:"",resultNote:"",resultText:"",resultTone:"pending",scopeEmptyMessage:"",scopeEntries:[],selectedSummary:"",state:"empty",surface:"formula",titleHint:""}}function Ra(e,t){for(let[n,a]of Object.entries(t))e[n]=a}function Mo(e){let t=typeof e==="string"?void 0:e.attributes?.part;return typeof t==="string"?t:""}function Vo(e){let t=e?.$map?.item,n=t!==null&&typeof t==="object"?t.key:"";return typeof n==="string"?n:""}function Pa(e,t,n,a){let r=v({...rn(),...n});Ra(r,t);let o=null,i=!1,s=R("logic-workspace",r,e,{onNodeCreated:(l,d,p,c)=>{if(!(l instanceof HTMLElement))return;let b=Mo(p);if(b==="code-host")a.codeSlot(l);else if(b==="editor-host")a.editorSlot(l);else if(b==="tree-host")a.treeSlot(Vo(c),l)}}).then((l)=>{if(i){l.dispose();return}o=l});return{connected:()=>{let l=o?.root;return l instanceof HTMLElement?l.isConnected:!i},dispose(){i=!0,o?.dispose(),o=null},ready:s,update(l){Ra(r,l)}}}var Io="Open a formula or a function to edit it here, beside the page it computes.",Ho="No expression found at this document position.",Wo="The values this formula can read appear here once the canvas has rendered.",Bo="Preview unavailable — the canvas has not posted a data snapshot yet";function zg(e=u.value){let t=e?.session.ui;if(!t)return null;if(t.editingFunction)return{editing:t.editingFunction,surface:"function"};if(t.editingFormula)return{editing:t.editingFormula,surface:"formula"};return null}function T_(){xd("logic")}function gu(e){Wr(u.value,"editingFunction",e.surface==="function"?e.editing:null),Wr(u.value,"editingFormula",e.surface==="formula"?e.editing:null),T_()}function zo(e){return nt(e)&&typeof e.operator==="string"}function Ko(e,t){let{document:n}=e.doc;if(t.type==="def"&&t.defName){let a=n?.state?.[t.defName];return ua(a)?a.$expression:null}if(t.type==="event"&&t.path&&t.eventKey){let a=K(n,t.path),r=a?Ep(a,t.eventKey):void 0;return ua(r)?r.$expression:null}return null}function Uo(e,t){let n=e,a=e,r=[];for(let[o,i]of t.entries()){if(!n||typeof n!=="object")break;if(n=n[i],zo(n))a=n,r=t.slice(0,o+1)}return{node:a,path:r}}function on(e,t,n){if(t.length===0)return n;let[a,...r]=t;if(Array.isArray(e)){let i=[...e];return i[Number(a)]=on(i[Number(a)],r,n),i}let o=nt(e)?e:{};return{...o,[a]:on(o[a],r,n)}}function qo(e,t,n){if(t.type==="def"&&t.defName){let{defName:a}=t;q(e,(r)=>fr(r,a,{$expression:n}))}else if(t.type==="event"&&t.path&&t.eventKey){let{eventKey:a,path:r}=t;q(e,(o)=>Ue(o,r,a,{$expression:n}))}}function Xo(){Wr(u.value,"editingFormula",null)}var Fa=Nd({key:"",path:[],tab:null});function Oa(e){return JSON.stringify(e)}var X=null;function Ma(e){let t=X;if(!t)return;qo(t.tab,t.editing,on(t.root,t.selectedPath,e))}function ja(e,t,n,a){return{glyph:e,kind:n,name:t,titleHint:a}}function Qo(e){if(e?.error)return{hasResultNote:!1,resultNote:"",resultText:e.error,resultTone:"error"};if(e)return{hasResultNote:e.mutating,resultNote:e.mutating?"(mutates target)":"",resultText:`= ${e.values.get("")??"undefined"}`,resultTone:"value"};return{hasResultNote:!1,resultNote:"",resultText:Bo,resultTone:"pending"}}function Zo(e){let t=[],n=new Map;for(let[a,r]of Object.entries(e??{}))t.push({key:a,name:a,type:Lf(r)}),n.set(a,sc(r));return{entries:t,values:n}}function sn(){let e=rn(),t=u.value,n=zg(t);if(!t||!n)return X=null,{...e,emptyMessage:Io,state:"empty"};if(n.surface==="function"){X=null;let{editing:m}=n,C=m.defName??m.eventKey??"?";return{...e,...ja("ƒ",C,m.type==="def"?"function body":"event handler",m.type==="def"?`state/${C}`:C),state:"ready",surface:"code"}}let{editing:a}=n,r=(a.type==="def"?a.defName:a.eventKey)??"?",o=ja("fx",r,a.type==="def"?"state expression":"event expression",a.type==="def"?`state/${r}`:r),i=Ko(t,a);if(!i)return X=null,{...e,...o,missingMessage:Ho,state:"ready",surface:"missing"};let s=t.doc.document?.state??{},l=If(t,`formula:${JSON.stringify(a)}`,i,a.type==="event"?a.path??null:null,Ja),d=Fa.value,p=Oa(a),{node:c,path:b}=Uo(i,d.tab===t&&d.key===p?d.path:[]),w=yt(i,{preview:l}),k=w.map((m)=>({badge:m.badge,hasBadge:m.hasBadge,key:m.key,label:m.label})),x=new Map(w.map((m)=>[m.key,m.path])),h=Zo(t.session.canvas.scope);return X={allowEventRef:a.type==="event",chipPaths:x,editing:a,preview:l,root:i,scopeValues:h.values,selected:c,selectedPath:b,stateEntries:s,tab:t},{...e,...o,...Qo(l),chips:k,hasCatalog:!0,hasScope:h.entries.length>0,scopeEmptyMessage:Wo,scopeEntries:h.entries,selectedSummary:b.length===0?"root":gt(c),state:"ready",surface:"formula"}}var Et=null,Ve=new Map;function ln(){let e=Et;if(!e)return;let t=X;if(!t){e.textContent="";return}wl(e,t.selected,Ma,{allowEventRef:t.allowEventRef,depth:1,onInsertDef:_a,path:t.selectedPath,preview:t.preview,stateDefs:Object.keys(t.stateEntries),stateEntries:t.stateEntries})}function Va(e,t){let n=X?.scopeValues.get(e);it(t,n,e,Ja,4)}function Ia(){let e=X;for(let[t,n]of Ve){if(!e?.scopeValues.has(t)){Ve.delete(t);continue}Va(t,n)}Pe()}var U=null;function Ja(){if(!U)return;U.handle.update(sn()),ln(),Ia()}var ei={browseCatalog(e){let t=X;if(!t)return;wt({anchor:e,entries:ft(t.stateEntries),onPick:(n)=>ct(n,Ma,{onInsertDef:_a,stateEntries:t.stateEntries})})},close(){if(zg()?.surface==="function"){qy();return}Xo()},selectChip(e){let t=X,n=t?.chipPaths.get(e);if(!t||!n)return;Fa.value={key:Oa(t.editing),path:n,tab:t.tab}}};function _a(e,t){q(u.value,(n)=>Os(n,e,t))}var ti={codeSlot(e){queueMicrotask(()=>{if(U)Yt(U.host)})},editorSlot(e){Et=e,ln()},treeSlot(e,t){Ve.set(e,t),Va(e,t)}};function La(){if(!U)return;U.scope.stop(),U.handle.dispose(),U=null,Et=null,Ve.clear(),X=null,Pe()}function ni(e){Et=null,Ve.clear();let t=Pa(e,sn(),ei,ti),n=ge();U={handle:t,host:e,scope:n},n.run(()=>{ee(()=>{t.update(sn()),ln(),Ia()})})}function ai(e){if(e.getAttribute(rt)===mv("logic")){if(U&&(U.host!==e||!U.handle.connected()))La();if(!U)ni(e)}else La();Yt(e)}function Ok(){Gn({id:"logic",title:"Logic",level:"document",dock:"bottom",icon:"lightning",rail:!1,when:()=>zg()!==null,render:()=>tt,afterRender:(e,t)=>{ai(t)}})}function ri(){return[{args:ke({defName:je("The state entry whose body to open in the code editor.")}),category:"Document",id:"formula.editDef",level:"document",menus:["palette"],group:"5_data",requires:"an open document that defines state",when:(e)=>e.document.open,run:(e,t)=>{let n=ot("formula.editDef",t,"defName"),a=u.value;if(!a)throw RangeError('command "formula.editDef" needs an open document');let r=a.doc.document?.state??{};if(!(n in r)){let o=Object.keys(r);throw RangeError(`command "formula.editDef" argument "defName": "${n}" is not a state entry `+"this document defines — it defines: "+`${o.length>0?o.join(", "):"nothing"}`)}gu({editing:{defName:n,type:"def"},surface:"function"})},title:"Edit Function"},{args:ke({eventKey:je('The event binding, e.g. "onclick".'),path:av("The document path of the element that carries the binding.")}),category:"Document",id:"formula.editEvent",level:"document",menus:["palette"],group:"5_data",requires:"an open document",when:(e)=>e.document.open,run:(e,t)=>{let n=ot("formula.editEvent",t,"eventKey"),a=ux("formula.editEvent",t,"path"),r=u.value;if(!r)throw RangeError('command "formula.editEvent" needs an open document');if(!K(r.doc.document,a))throw RangeError(`command "formula.editEvent" argument "path": [${a.join(", ")}] addresses no node in ${r.documentPath??"the open document"}`);gu({editing:{eventKey:n,path:a,type:"event"},surface:"function"})},title:"Edit Event Handler"}]}function Mk(e){e.registerAll(ri())}var oi={bound:"Bound",default:"Not set",inherited:"Inherited",mixed:"Mixed",set:"Set here"};function Gy(e){if(e.state==="inherited")return e.donor?`from ${e.donor}`:"inherited";if(e.state==="bound")return e.donor??"bound";if(e.state==="mixed")return e.donor?`mixed (${e.donor})`:"mixed";return""}function Uh(e,t){if(t.title)return t.title;let n=oi[t.state];if(t.state==="inherited")return`${n} from ${t.donor??"the cascade"} — click to go there`;if(t.state==="bound")return t.donor?`${n} to ${t.donor} — click to open it`:n;if(t.state==="set")return`${n} — click to clear ${e}`;if(t.state==="mixed"){let a=t.donor?`${t.donor} selected elements`:"the selected elements";return`${n} — ${a} have different values for ${e}; typing sets them all`}return`${n} — ${e} falls back to the browser default`}function Ky(e){let t={bound:0,inherited:0,mixed:0,set:0};for(let n of e)if(n!=="default")t[n]+=1;return t}function Pk(e){let t=[];if(e.set>0)t.push(`${e.set} set here`);if(e.inherited>0)t.push(`${e.inherited} inherited`);if(e.bound>0)t.push(`${e.bound} bound`);if(e.mixed>0)t.push(`${e.mixed} mixed`);return t.length>0?t.join(" · "):"nothing set"}var Z=new Map;function W(e,t){let n=Z.get(e);return n?n.value:t}function pn(e){return Z.has(e)}function Ct(e,t){let n=Z.get(e);if(n)n.value=t;else Z.set(e,{value:t})}function Nt(e){let t=Z.get(e);if(t?.timer)clearTimeout(t.timer);Z.delete(e)}function dn(e,t,n){let a=Z.get(e);if(!a)return;if(a.timer)clearTimeout(a.timer);a.timer=setTimeout(()=>{let r=Z.get(e);if(!r)return;delete r.timer,n(r.value)},t)}function Ha(e,t){let n=Z.get(e);if(!n)return;if(n.timer)clearTimeout(n.timer);let{value:a}=n;Z.delete(e),t(a)}var ii=/^([a-z][a-z\d+.-]*:)?\/\//i;function Wa(e=""){let t=e,n=t.toLowerCase();if(n.startsWith("mailto:"))return{kind:"mailto",value:t.slice(7)};if(n.startsWith("tel:"))return{kind:"tel",value:t.slice(4)};if(t.startsWith("#"))return{kind:"anchor",value:t.slice(1)};if(ii.test(t))return{kind:"external",value:t};if(t.startsWith("/"))return{kind:"internal",value:t};return{kind:"external",value:t}}function Ba(e,t){let n=(t??"").trim();if(!n)return"";switch(e){case"mailto":return`mailto:${n}`;case"tel":return`tel:${n}`;case"anchor":return n.startsWith("#")?n:`#${n}`;default:return n}}function qh(e){return`Click anything on the canvas to ${e}.`}function Rf(){return`That element is no longer on the page. ${qh("pick another one")}`}function xl(e="Open a page…"){return{label:e,run:()=>{(me("yzrzh9x3"),import("./quick-search-yzrzh9x3.js")).then((t)=>{t.openQuickSearch()})}}}var si=/^var\(\s*(--[\w-]+)\s*\)$/;function bu(e){if(typeof e!=="string")return null;return si.exec(e)?.[1]??null}function Wg(e){return`var(${e})`}function nd(e,t){if(t===null||t===void 0)return;let n=t,a=new Set;for(let r=0;r<10;r+=1){let o=bu(n);if(!o)return n;if(a.has(o))return;a.add(o);let i=e?.[o];if(typeof i!=="string"&&typeof i!=="number")return;n=i}return}function pi(e){return cv(e.replace(/^--color-?/,""))||e}function Jy(){let e=Go(u.value?.doc.document?.style),t=[];for(let[n,a]of Object.entries(e))if(n.startsWith("--color")&&(typeof a==="string"||typeof a==="number"))t.push({color:String(a),label:pi(n),value:`var(${n})`});return t}function Yy(e){if(bu(e)===null)return"";let t=Go(u.value?.doc.document?.style),n=nd(t,e);return n===void 0?"":String(n)}var Ie={$id:"html-meta",title:"HTML Attribute Metadata",description:"Section assignment, order, and input inference metadata for the properties sidebar.",$sections:[{key:"identity",label:"Identity"},{key:"link",label:"Link"},{key:"media",label:"Media"},{key:"form",label:"Form"},{key:"interactive",label:"Interactive"},{key:"table",label:"Table"},{key:"accessibility",label:"Accessibility"}],$defs:{id:{$section:"identity",$order:10,type:"string",$label:"ID"},class:{$section:"identity",$order:20,type:"string",$label:"Class"},title:{$section:"identity",$order:30,type:"string"},hidden:{$section:"identity",$order:40,type:"boolean"},lang:{$section:"identity",$order:50,type:"string"},dir:{$section:"identity",$order:60,type:"string",enum:["ltr","rtl","auto"]},slot:{$section:"identity",$order:70,type:"string"},"slot-name":{$attr:"name",$section:"identity",$order:75,type:"string",$label:"Slot Name",$elements:["slot"]},part:{$section:"identity",$order:80,type:"string"},href:{$section:"link",$order:10,type:"string",$elements:["a","area","link"]},target:{$section:"link",$order:20,type:"string",$elements:["a","area","form"],enum:["_self","_blank","_parent","_top"]},rel:{$section:"link",$order:30,type:"string",$elements:["a","area","link"]},download:{$section:"link",$order:40,type:"string",$elements:["a","area"]},src:{$section:"media",$order:10,$input:"media",type:"string",$elements:["img","script","iframe","video","audio","source","embed","input"]},alt:{$section:"media",$order:20,type:"string",$elements:["img","input","area"]},width:{$section:"media",$order:30,type:"string",$elements:["img","video","iframe","canvas","embed","object"]},height:{$section:"media",$order:40,type:"string",$elements:["img","video","iframe","canvas","embed","object"]},loading:{$section:"media",$order:50,type:"string",$elements:["img","iframe"],enum:["lazy","eager"]},srcset:{$section:"media",$order:60,type:"string",$elements:["img","source"]},sizes:{$section:"media",$order:70,type:"string",$elements:["img","source"]},poster:{$section:"media",$order:80,type:"string",$elements:["video"]},controls:{$section:"media",$order:90,type:"boolean",$elements:["video","audio"]},autoplay:{$section:"media",$order:100,type:"boolean",$elements:["video","audio"]},loop:{$section:"media",$order:110,type:"boolean",$elements:["video","audio"]},muted:{$section:"media",$order:120,type:"boolean",$elements:["video","audio"]},type:{$section:"form",$order:5,type:"string",$elements:["input","button"],enum:["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color","range","file","checkbox","radio","hidden","submit","reset","button"]},name:{$section:"form",$order:10,type:"string",$elements:["input","button","select","textarea","fieldset","output","form"]},value:{$section:"form",$order:20,type:"string",$elements:["input","button","option","li","meter","progress"]},placeholder:{$section:"form",$order:30,type:"string",$elements:["input","textarea"]},disabled:{$section:"form",$order:40,type:"boolean",$elements:["input","button","select","textarea","fieldset"]},required:{$section:"form",$order:50,type:"boolean",$elements:["input","select","textarea"]},readonly:{$section:"form",$order:60,type:"boolean",$elements:["input","textarea"]},checked:{$section:"form",$order:70,type:"boolean",$elements:["input"]},multiple:{$section:"form",$order:80,type:"boolean",$elements:["input","select"]},min:{$section:"form",$order:90,type:"string",$elements:["input","meter"]},max:{$section:"form",$order:100,type:"string",$elements:["input","meter"]},step:{$section:"form",$order:110,type:"string",$elements:["input"]},pattern:{$section:"form",$order:120,type:"string",$elements:["input"]},maxlength:{$section:"form",$order:130,type:"string",$elements:["input","textarea"]},minlength:{$section:"form",$order:140,type:"string",$elements:["input","textarea"]},autocomplete:{$section:"form",$order:150,type:"string",$elements:["input","select","textarea","form"],enum:["on","off"]},action:{$section:"form",$order:160,type:"string",$elements:["form"]},method:{$section:"form",$order:170,type:"string",$elements:["form"],enum:["get","post","dialog"]},for:{$section:"form",$order:180,type:"string",$elements:["label","output"]},open:{$section:"form",$order:190,type:"boolean",$elements:["details","dialog"]},colspan:{$section:"table",$order:10,type:"string",$elements:["td","th"]},rowspan:{$section:"table",$order:20,type:"string",$elements:["td","th"]},scope:{$section:"table",$order:30,type:"string",$elements:["th"],enum:["row","col","rowgroup","colgroup"]},role:{$section:"accessibility",$order:10,type:"string"},"aria-label":{$section:"accessibility",$order:20,type:"string"},"aria-hidden":{$section:"accessibility",$order:30,type:"string",enum:["true","false"]},"aria-describedby":{$section:"accessibility",$order:40,type:"string"},"aria-labelledby":{$section:"accessibility",$order:50,type:"string"},"aria-live":{$section:"accessibility",$order:60,type:"string",enum:["off","polite","assertive"]},tabindex:{$section:"accessibility",$order:70,type:"string"},popover:{$section:"identity",$order:50,type:"string",$label:"Popover",enum:["auto","manual","hint"]},popovertarget:{$section:"interactive",$order:10,type:"string",$label:"Opens popover",$elements:["button","input"],$input:"popover-target"},popovertargetaction:{$section:"interactive",$order:20,type:"string",$label:"Action",$elements:["button","input"],enum:["toggle","show","hide"]}}};var za={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPropertiesPanel",$description:"The Inspector's Content tab — what this element IS and what it says: its tag, id, class and text, its component settings, where it is used, its HTML attributes by section, and the attributes its schema does not know about. It is the densest surface in the application and it is drawn out of ONE row vocabulary: a section's body is a single list, and each entry names the shape it takes — a field, a key/value pair, a note, an action or a file. They differ in what they COMMIT rather than in what they look like, and what they commit is `panels/properties-panel.ts`'s decision, reached by the row's `key`. Nothing here knows what an attribute is, which cascade a value came from, or that a `$ref` is a binding: every field of every row is already a string, a flag or a list.",tagName:"div",attributes:{part:"content"},style:{$description:"What this block replaces is thirty-odd rules spread over `styles/inspector.css` and `styles/panels.css` — `.style-sidebar`, `.style-row`, `.style-row-label`, `.set-dot`, `.provenance-chip`, `.kv-row`, `.kv-add`, `.usage-row`, `.layout-origin*` and the teaching empty state — and they are TRANSCRIBED rather than shared, because a document emits no class and a class it does not emit cannot style it. The Style and Logic tabs still draw `.style-row`, so the stylesheet keeps those rules until they convert too. Two things changed on the way in. Every `--spectrum-font-size-*` is re-pointed at the kit's scale: this document is mounted in the Inspector's tab body, outside `<sp-theme>`, where each of those would have silently taken its hard-coded pixel fallback and stopped following the theme. And the provenance chip's four states are an ATTRIBUTE rather than four class names, because the state is a fact about the row's value and a document says such things with data.",display:"flex",flexDirection:"column",minHeight:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="empty"]':{$description:"The one empty-state pattern (`panels/empty-state.ts`), drawn here because a document cannot render a lit helper. Same three parts in the same order — the sentence saying what the region is for, the sentence saying where its content comes from, and the button that fills it.",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-2)",padding:"var(--jx-space-5)",textAlign:"center",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="empty-message"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-detail"]':{margin:"0",maxWidth:"34ch",fontSize:"var(--jx-text-sm)",opacity:"0.8"},'& [part="empty-actions"]':{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:"var(--jx-space-2)"},'& [part="section-body"]':{display:"flex",flexDirection:"column",padding:"0 var(--jx-space-2) var(--jx-space-2)",minWidth:"0"},'& [part="section-body"] > [part="row"], & [part="layout-class-slot"] > [part="row"]':{$description:'studio-ui-guidelines.md §4.1\'s standard form row, stacked: the label sits above a control that takes the whole width. `min-width: 0` is what keeps it honest in a narrow dock — a field refuses to shrink below its own min-content without it. Scoped to the tab\'s OWN rows rather than to every `part="row"` beneath it, which a colour row made load-bearing: the kit is light DOM and one cascade, so a bare descendant selector also matches `jx-color-field`\'s internal row — and at equal specificity with the kit\'s own `& > [part="row"]` the winner is whichever sheet was interned later, which is not a thing a stylesheet may depend on. `[part="chip"]` moved under `[part="chip-slot"]` for the same reason and a sharper one: its `background: transparent` and its border would otherwise have erased a swatch\'s colour and drawn a box round it. The `layout-class-slot` half of the pair is there because that slot is `display: contents`, so its row is a grandchild in the DOM even though it is a child in the box tree.',display:"flex",flexDirection:"column",alignItems:"stretch",gap:"2px",padding:"2px 0",minWidth:"0"},'& [part="row-label"]':{display:"flex",alignItems:"center",gap:"4px",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="row-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="widget"]':{width:"100%",minWidth:"0"},'& [part="color"]':{display:"flex",width:"100%",minWidth:"0"},'& [part="color"] > [part="color-field"]':{flex:"1",minWidth:"0"},'& [part="color-field"] > [part="row"]':{$description:"The field is `inline-flex` around a row sized to its own contents, which is wrong where the control IS the width of the dock. Two declarations, not a restatement of the kit's layout.",flex:"1",minWidth:"0"},'& [part="color-field"] [part="text"]':{flex:"1",inlineSize:"auto",minInlineSize:"0"},'& [part="chip-slot"] > [part="chip"]':{$description:"§6.7's provenance chip. `set` is the 6px accent dot it has always been — a circle is not a button, whatever element draws it — and the three states that carry a donor are bordered chips naming it. The fourth state, `default`, draws nothing at all: a ghost dot on every unset row says less than silence.",flexShrink:"0",display:"inline-flex",alignItems:"center",maxWidth:"14ch",overflow:"hidden",padding:"0 5px",border:"1px solid currentcolor",borderRadius:"var(--radius)",background:"transparent",font:"inherit",fontSize:"var(--jx-text-xs)",lineHeight:"14px",whiteSpace:"nowrap",textOverflow:"ellipsis",cursor:"default"},'& [part="chip-slot"] > button[part="chip"]':{cursor:"pointer"},'& [part="chip-slot"] > button[part="chip"]:hover':{background:"var(--hover-bg)"},'& [part="chip-slot"] > button[part="chip"]:focus-visible':{background:"var(--hover-bg)",outline:"2px solid var(--accent)",outlineOffset:"1px"},'& [part="chip-slot"] > [part="chip"][data-state="inherited"]':{color:"var(--warning)"},'& [part="chip-slot"] > [part="chip"][data-state="bound"]':{color:"var(--handler)"},'& [part="chip-slot"] > [part="chip"][data-state="mixed"]':{color:"var(--text-secondary)"},'& [part="chip-slot"] > [part="chip"][data-state="set"]':{width:"6px",height:"6px",padding:"0",border:"none",borderRadius:"50%",background:"var(--accent)"},'& [part="chip-slot"] > [part="chip"][data-state="set"]:hover':{background:"var(--danger)"},'& [part="source"][data-source="fixed"]':{color:"var(--fg-dim)"},'& [part="source"][data-source="bound"]':{color:"var(--accent)"},'& [part="section-dot"]':{display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",background:"var(--accent)",flexShrink:"0"},'& [part="kv-row"]':{display:"flex",alignItems:"center",gap:"4px",marginBottom:"3px",minWidth:"0"},'& [part="kv-key"]':{width:"90px",flexShrink:"0"},'& [part="kv-val"]':{flex:"1",minWidth:"0"},'& [part="note"]':{margin:"0",padding:"2px 0",fontSize:"var(--jx-text-sm)",lineHeight:"1.5",color:"var(--fg-dim)"},'& [part="action"]':{$description:"The `.kv-add` affordance, which was a `<span>` with a click handler on it — not reachable by keyboard, and announced as nothing. It is a real button stripped of the chrome a button brings with it, so it still reads as a link at the foot of a section.",alignSelf:"flex-start",padding:"2px 8px",border:"none",background:"none",font:"inherit",fontSize:"var(--jx-text-xs)",color:"var(--accent)",textAlign:"left",cursor:"pointer"},'& [part="action"]:hover':{textDecoration:"underline"},'& [part="action"]:focus-visible':{outline:"2px solid var(--accent)",outlineOffset:"-1px"},'& [part="file"]':{display:"flex",alignItems:"center",gap:"6px",width:"100%",padding:"3px 4px",border:"none",borderRadius:"var(--radius)",background:"none",color:"inherit",font:"inherit",fontSize:"var(--jx-text-sm)",textAlign:"left",cursor:"pointer"},'& [part="file"]:hover':{background:"var(--hover-bg)"},'& [part="file"]:focus-visible':{background:"var(--hover-bg)",outline:"2px solid var(--accent)",outlineOffset:"-1px"},'& [part="file-path"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="file-count"]':{flexShrink:"0",color:"var(--fg-dim)",fontVariantNumeric:"tabular-nums"},'& [part="link-field"]':{display:"flex",gap:"4px",minWidth:"0"},'& [part="link-kind"]':{flex:"1",minWidth:"0"},'& [part="link-value"]':{flex:"1",minWidth:"0"},'& [part="control-host"]':{$description:"`display: contents` for the reason every embedded host in this package uses it: the row lays its own children out, and a wrapper box would become the flex item in the control's place.",display:"contents"},'& [part="layout-origin"]':{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},'& [part="layout-badge"]':{padding:"2px 6px",borderRadius:"var(--radius)",background:"var(--map)",color:"var(--accent-fg)",fontSize:"var(--jx-text-xs)",textTransform:"uppercase",letterSpacing:"0.5px"},'& [part="layout-tag"]':{fontFamily:"var(--font-mono, monospace)",fontSize:"var(--jx-text-sm)"},'& [part="layout-class"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",wordBreak:"break-all"},'& [part="layout-note"]':{margin:"0",padding:"4px 0",fontSize:"var(--jx-text-xs)",fontStyle:"italic",color:"var(--fg-dim)"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/view"},cases:{empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"${state.emptyMessage}"},{tagName:"div",attributes:{part:"empty-detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasEmptyDetail"},cases:{true:{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"}}},{tagName:"div",attributes:{part:"empty-actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasEmptyActions"},cases:{true:{tagName:"div",attributes:{part:"empty-actions"},children:[{$prototype:"Array",items:{$ref:"#/state/emptyActions"},key:{$ref:"$map/item/id"},map:{tagName:"jx-button",attributes:{part:"empty-action"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runEmptyAction"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}}}]},layout:{tagName:"jx-accordion",attributes:{part:"sections"},children:[{tagName:"jx-accordion-item",attributes:{part:"section","data-section":"__layout"},$props:{label:"Layout Element",open:!0},children:[{tagName:"div",attributes:{part:"section-body"},children:[{tagName:"div",attributes:{part:"layout-origin"},children:[{tagName:"span",attributes:{part:"layout-badge"},textContent:"Layout"},{tagName:"code",attributes:{part:"layout-tag"},textContent:"<${state.layoutTag}>"}]},{tagName:"div",attributes:{part:"layout-class-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/layoutHasClass"},cases:{true:{tagName:"div",attributes:{part:"row","data-prop":"className"},children:[{tagName:"div",attributes:{part:"row-label"},children:[{tagName:"span",attributes:{part:"row-name"},textContent:"Class"}]},{tagName:"span",attributes:{part:"layout-class"},textContent:"${state.layoutClass}"}]}}},{tagName:"p",attributes:{part:"layout-note"},textContent:"${state.layoutNote}"},{tagName:"div",attributes:{part:"layout-open-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/layoutCanOpen"},cases:{true:{$description:"Drawn only where it can run. A layout click focuses the pane it landed in — including a lens, which draws layout chrome because it draws the same document — and from a derived pane `pane.derive` can only refuse. A chip that does nothing when you press it is worse than no chip: the sentence above it already says where the element comes from.",tagName:"button",attributes:{part:"action",type:"button","data-prop":"openLayout"},textContent:"Open Layout →",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openLayout"}}]}}}}]}]}]},content:{tagName:"jx-accordion",attributes:{part:"sections"},$props:{multiple:!0},children:[{$prototype:"Array",items:{$ref:"#/state/sections"},key:{$ref:"$map/item/key"},map:{tagName:"jx-accordion-item",attributes:{part:"section","data-section":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},open:{$ref:"$map/item/open"}},ontoggle:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSection"},value:[{$ref:"$map/item/key"},{$ref:"event#/detail"}]}]},children:[{$description:"§6.7's collapsed-header tally. It is an indicator and not a control: the heading's own click already toggles the section, so a second meaning for the same click would be worse than the silence. It says how many values in the section are set, which is what a closed section otherwise cannot say.",tagName:"span",attributes:{slot:"heading",role:"none"},$switch:{$ref:"$map/item/hasDot"},cases:{true:{tagName:"span",attributes:{part:"section-dot","aria-hidden":"true",title:"${$map.item.dotTitle}"}}}},{tagName:"div",attributes:{part:"section-body"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/shape"},cases:{field:{tagName:"div",attributes:{part:"row","data-prop":"${$map.item.prop}"},children:[{tagName:"div",attributes:{part:"row-label"},children:[{tagName:"div",attributes:{part:"chip-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/chip"},cases:{dot:{tagName:"button",attributes:{part:"chip",type:"button","data-state":"${$map.item.chipState}",title:"${$map.item.chipTitle}","aria-label":"${$map.item.chipTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chipAction"},value:[{$ref:"$map/item/key"}]}]}},press:{tagName:"button",attributes:{part:"chip",type:"button","data-state":"${$map.item.chipState}",title:"${$map.item.chipTitle}"},textContent:"${$map.item.chipText}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chipAction"},value:[{$ref:"$map/item/key"}]}]}},text:{tagName:"span",attributes:{part:"chip","data-state":"${$map.item.chipState}",title:"${$map.item.chipTitle}"},textContent:"${$map.item.chipText}"}}},{tagName:"span",attributes:{part:"row-name",title:"${$map.item.prop}","aria-hidden":"true"},textContent:"${$map.item.label}"},{tagName:"div",attributes:{part:"source-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasSource"},cases:{true:{$description:"§6.6's Value Source chip: the rung this value is produced at, in plain language, opening a picker of every rung the POSITION permits. The rungs are derived from the schema at that position and the picker is the kit menu every other list in the shell opens, so neither is decided here.",tagName:"jx-action-button",attributes:{part:"source","data-source":"${$map.item.source}"},$props:{size:"sm",quiet:!0,label:"${$map.item.sourceName}",hint:"${$map.item.sourceName}",disabled:{$ref:"$map/item/sourceLocked"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickSource"},value:[{$ref:"$map/item/key"},{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"${$map.item.sourceLabel}"}]}}}]},{tagName:"div",attributes:{part:"widget-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{text:{tagName:"jx-textfield",attributes:{part:"widget"},$props:{size:"sm",label:"${$map.item.label}",placeholder:{$ref:"$map/item/placeholder"},value:{$ref:"$map/item/value"},mono:{$ref:"$map/item/mono"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},textarea:{tagName:"jx-textfield",attributes:{part:"widget"},$props:{size:"sm",label:"${$map.item.label}",placeholder:{$ref:"$map/item/placeholder"},value:{$ref:"$map/item/value"},mono:{$ref:"$map/item/mono"},multiline:!0,rows:3},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},checkbox:{tagName:"jx-checkbox",attributes:{part:"widget"},$props:{size:"sm",label:"${$map.item.label}",checked:{$ref:"$map/item/checked"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commitChecked"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]}},number:{tagName:"jx-number-field",attributes:{part:"widget"},$props:{size:"sm",label:"${$map.item.label}",placeholder:{$ref:"$map/item/placeholder"},value:{$ref:"$map/item/value"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},select:{tagName:"jx-select",attributes:{part:"widget"},$props:{size:"sm",label:"${$map.item.label}",options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},link:{$description:"The Link target: a kind and a value, over one `href`. It is two controls because the attribute is two decisions — an internal route, an external URL, an anchor, an address or a number — and `utils/link-target.ts` is what joins them back into one string. The value half is a picker of the site's own routes when the kind is internal and a field otherwise, so the answer the author most often wants is the one they can pick.",tagName:"div",attributes:{part:"link-field"},children:[{tagName:"jx-select",attributes:{part:"link-kind"},$props:{size:"sm",label:"Link type",options:{$ref:"$map/item/kindOptions"},value:{$ref:"$map/item/linkKind"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commitKind"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"link-value-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/linkValueKind"},cases:{route:{tagName:"jx-select",attributes:{part:"link-value"},$props:{size:"sm",label:"${$map.item.label}",options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},text:{tagName:"jx-textfield",attributes:{part:"link-value"},$props:{size:"sm",label:"${$map.item.label}",placeholder:{$ref:"$map/item/placeholder"},value:{$ref:"$map/item/value"},mono:{$ref:"$map/item/mono"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}}]},color:{$description:'A prop whose schema says `format: "color"`. It was the second of the three lit leaves this tab drew into `[part="control-host"]`; `ui.md` §5.6 landed and it is `jx-color-field` here, beside every other control. The listener is on the WRAPPER and not on the field, and that is the field\'s own contract rather than a preference. `jx-color-field` stops its five inner controls\' native events at its root and re-says the platform\'s two names FROM the host, so an ancestor hears exactly one `input` and one `change` per gesture with `e.target` being the field — while a listener on the field itself hears BOTH, including the raw `change` of a text box holding a half-typed word the field has just refused. Bound there, `not a colour` would have been committed as a colour.',tagName:"div",attributes:{part:"color",role:"none"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},children:[{tagName:"jx-color-field",attributes:{part:"color-field"},$props:{size:"sm",label:"${$map.item.label}",value:{$ref:"$map/item/value"},resolved:{$ref:"$map/item/resolved"},alpha:!0},children:[{tagName:"span",attributes:{part:"palette-slot",slot:"tokens",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasTokens"},cases:{true:{$description:"The palette's `change` is caught HERE, on the group, because it never gets out: the field routes it as its `palette` channel, stops it, and then declines it — a swatch that stands for `var(--color-accent)` is not a string the field can parse as a colour, which is exactly why the reference survives the click. A row that let the field answer instead would have committed the literal behind the token and quietly opted one declaration out of the palette for ever.",tagName:"jx-swatch-group",attributes:{part:"palette"},$props:{label:"Colour tokens",value:{$ref:"$map/item/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},children:[{$prototype:"Array",items:{$ref:"$map/item/tokens"},key:{$ref:"$map/item/value"},map:{tagName:"jx-swatch",attributes:{part:"token","data-token":"${$map.item.value}"},$props:{size:"sm",color:{$ref:"$map/item/color"},value:{$ref:"$map/item/value"},label:{$ref:"$map/item/label"}}}}]}}}]}]},control:{$description:"The one thing still drawn in lit. The media picker, the colour selector and the expression editor are each their own surface with readers outside this tab, so the document draws an empty host and `panels/properties-panel.ts` renders into it — the seam `ui/schema-form.ts` established for a registered control. The host is announced through `onNodeCreated` as it is created, never found by selector.",tagName:"div",attributes:{part:"control-host"}}}}]},kv:{$description:"An editable key/value pair — a custom attribute, which is a name and a value and a way to be rid of it. Both cells commit through the same debounce as every other text control, so renaming a key and retyping its value in one gesture is one write.",tagName:"div",attributes:{part:"kv-row","data-prop":"${$map.item.prop}"},children:[{tagName:"jx-textfield",attributes:{part:"kv-key"},$props:{size:"sm",label:"${$map.item.prop} name",value:{$ref:"$map/item/name"},mono:!0},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editName"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editName"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",attributes:{part:"kv-val"},$props:{size:"sm",label:"${$map.item.label}",value:{$ref:"$map/item/value"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editValue"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editValue"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",attributes:{part:"kv-remove"},$props:{size:"sm",quiet:!0,icon:"x",label:"${$map.item.removeLabel}",hint:"${$map.item.removeLabel}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeRow"},value:[{$ref:"$map/item/key"}]}]}}]},note:{tagName:"p",attributes:{part:"note","data-prop":"${$map.item.prop}"},textContent:"${$map.item.text}"},action:{tagName:"button",attributes:{part:"action",type:"button","data-prop":"${$map.item.prop}"},textContent:"${$map.item.text}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[{$ref:"$map/item/key"}]}]}},file:{tagName:"button",attributes:{part:"file",type:"button","data-prop":"${$map.item.prop}",title:"${$map.item.title}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"file-path"},textContent:"${$map.item.text}"},{tagName:"span",attributes:{part:"file-count"},textContent:"${$map.item.detail}"}]}}}}]}]}}]}}}]};T("properties-panel",za);function we(){return{emptyActions:[],emptyDetail:"",emptyMessage:"",hasEmptyActions:!1,hasEmptyDetail:!1,layoutCanOpen:!1,layoutClass:"",layoutHasClass:!1,layoutNote:"",layoutTag:"element",sections:[],view:"empty"}}function Ka(e,t){e.view=t.view,e.emptyMessage=t.emptyMessage,e.emptyDetail=t.emptyDetail,e.hasEmptyDetail=t.hasEmptyDetail,e.emptyActions=t.emptyActions,e.hasEmptyActions=t.hasEmptyActions,e.layoutTag=t.layoutTag,e.layoutClass=t.layoutClass,e.layoutHasClass=t.layoutHasClass,e.layoutNote=t.layoutNote,e.layoutCanOpen=t.layoutCanOpen,e.sections=t.sections}function ui(e,t){if(e!=="control-host")return"";let a=t?.$map?.item?.key;return typeof a==="string"?a:""}function mi(e){let t=typeof e==="string"?void 0:e.attributes?.part;return typeof t==="string"?t:""}function Ua(e,t,n,a){let r=v({...we(),...n});Ka(r,t);let o=null,i=!1;return R("properties-panel",r,e,{onNodeCreated:(s,l,d,p)=>{if(!(s instanceof HTMLElement))return;let c=ui(mi(d),p);if(c!=="")a(c,s)}}).then((s)=>{if(i){s.dispose();return}o=s}),{dispose(){i=!0,o?.dispose(),o=null},update(s){if(!i)Ka(r,s)}}}var qa="jx:other",At={label:"—",value:""};function L_(e){return e.includes("map")?[{label:"$map/item",value:"$map/item"},{label:"$map/index",value:"$map/index"}]:null}function Gh(e){return Object.entries(e.state||{}).filter(([,t])=>!t?.$handler&&t?.$prototype!=="Function").map(([t])=>t)}function I_(e){if(!e||typeof e!=="object"||Array.isArray(e))return"";let t=e.default;if(t===void 0)return"";return typeof t==="object"?JSON.stringify(t):String(t)}function fi(e){if(Ot(e)){let t=e.$ref;return t.startsWith("#/state/")?t.slice(8):t||"nothing yet"}return typeof e==="string"?"a template":"a formula"}function gi(e){if(Ot(e)){let t=e.$ref;return t.startsWith("#/state/")?t.slice(8).split("/")[0]??null:null}if(typeof e!=="string")return null;return/\$\{\s*(?:state\.)?([A-Za-z_$][\w$]*)/.exec(e)?.[1]??null}function hi(e){let t=ne();t?.run("view.setActivity",{tab:"data"}),t?.run("data.expandRow",{name:e})}function Qa(e,t){let n=gi(e),a=u.value?.doc.document,r=n&&a?Gh(a).includes(n):!1;return{donor:fi(e),state:"bound",title:t,...r&&n?{onClick:()=>hi(n)}:{}}}function yi(e){let t=at.find((a)=>a.tagName===We(e.tagName)),n=u.value?.documentPath;return t?.path!==void 0&&n!==void 0&&t.path===n}function bi(e,t,n,a){if(n&&sd(t)!=="literal")return Qa(t,`Bound — ${e.name}`);if(n)return{onClick:a.onClear,state:"set",title:`Clear ${e.name}`};if(e.default!==void 0&&!a.isDefinition)return{donor:"the component default",state:"inherited",title:`Not set here — the component's default (${String(e.default)}) applies`,...a.openDefinition?{onClick:a.openDefinition}:{}};return{state:"default"}}function $i(e,t,n,a,r=0){if(r>0)return{donor:String(r),onClick:a,state:"mixed"};if(n&&(Ot(t)||typeof t==="string"&&t.includes("${")))return Qa(t,`Bound — ${e}`);return n?{onClick:a,state:"set",title:`Clear ${e}`}:{state:"default"}}function xi(e,t,n){if(t.length<2)return 0;let a=t.map((r)=>n(K(e,r)));return sp(a).mixed?t.length:0}function Ga(e){return Ot(e)||typeof e==="string"&&e.includes("${")}var Dt=null,fn=!1;function wi(e){let n=e.replace(/\.[^./]+$/,"").split("/").map((o)=>o.startsWith("[")?`:${o.slice(1,-1)}`:o),a=n.at(-1)==="index";if(a)n.pop();let r=n.join("/");if(!r)return"/";return a||r.includes(":")?`/${r}${a?"/":""}`:`/${r}/`}async function ki(){fn=!0;let e=[],t=new Set([".json",".md",".html"]);try{let n=f(),a=async(r,o)=>{let i;try{i=await n.listDirectory(r)}catch{return}for(let s of i){let l=o?`${o}/${s.name}`:s.name;if(s.type==="directory")await a(s.path??`${r}/${s.name}`,l);else if(t.has(s.name.slice(s.name.lastIndexOf("."))))e.push(wi(l))}};await a("pages",""),Dt=[...new Set(e)].toSorted((r,o)=>r.localeCompare(o))}finally{fn=!1}Kh()}function Fk(){Dt=null,Kh()}var Si=["__element","__observed","__usages","__custom","__cssprops","__cssparts"],Ya="__props",gn="__usages";function Ei(){let e=Object.keys(u.value?.session.ui.inspectorSections??{});return[...new Set([...Si,...e])]}function Da(e,t){let n=u.value?.session.ui.inspectorSections?.[e];return n===void 0?t:n}function Vg(e,t){let n=u.value;if(!n)return;n.session.ui.inspectorSections={...n.session.ui.inspectorSections,[e]:t}}function Y(e,t,n){return{checked:!1,chip:"",chipState:"",chipText:"",chipTitle:"",detail:"",hasSource:!1,hasTokens:!1,key:e,kind:"text",kindOptions:[],label:n,linkKind:"",linkValueKind:"text",mono:!1,name:"",options:[],placeholder:"",prop:t,removeLabel:"",resolved:"",shape:"field",source:"fixed",sourceLabel:"",sourceLocked:!1,sourceName:"",text:"",title:"",tokens:[],value:""}}var Za=()=>{},_e=null,Tt=null,I=new Map,Be=new Map,hn=new Set;function se(e){return hn.add(e),e}var ze=null,er=v({tick:0}),cn=!1;function Kh(){er.tick+=1}function R_(e,t){Tt?.stop(),Tt=null,_e?.dispose(),_e=null,I.clear();for(let n of Be.values())Qy(n);Be.clear();for(let n of hn)Nt(n);if(hn.clear(),ze?.close(),ze=null,!e)return;Za=t?.navigateToComponent??(()=>{}),_e=Ua(e,we(),Ti,(n,a)=>{Be.set(n,a),tr(n,a)}),Tt=ge(),Tt.run(()=>{ee(()=>{let n=u.value;if(y.layoutSelection,g.activePaneId,er.tick,n)n.doc.document,n.documentPath,n.session.selection.map((a)=>a.join("/")).join("|"),n.session.ui.inspectorSections;Ci()})})}function Ci(){if(cn||!_e)return;cn=!0,queueMicrotask(()=>{cn=!1,_e?.update(Fi()),Ni()})}function tr(e,t){I.get(e)?.control?.(t)}function Ni(){for(let[e,t]of Be)if(I.has(e))tr(e,t);else Be.delete(e),Qy(t)}var Ti={chipAction:(e)=>{I.get(e)?.chipAction?.()},commit:(e,t)=>{let n=I.get(e);if(!n?.commit)return;if(n.draft){Ct(n.draft,t),Ha(n.draft,n.commit);return}n.commit(t)},commitChecked:(e,t)=>{I.get(e)?.commitChecked?.(t)},commitKind:(e,t)=>{I.get(e)?.commitKind?.(t)},edit:(e,t)=>{let n=I.get(e);if(!n?.commit||!n.draft||n.debounceMs<=0)return;Ct(n.draft,t),dn(n.draft,n.debounceMs,n.commit)},editName:(e,t)=>{Xa(e,"nameKey",t)},editValue:(e,t)=>{Xa(e,"valueKey",t)},openFile:(e)=>{let t=I.get(e)?.openPath;if(t)ji(t)},openLayout:()=>{ne()?.run("pane.derive",{preset:"layout"})},pickSource:(e,t)=>{Pi(e,t)},removeRow:(e)=>{I.get(e)?.action?.()},runAction:(e)=>{I.get(e)?.action?.()},runEmptyAction:(e)=>{if(e==="open-page")xl().run();else if(e==="open-logic")Li()},setSection:(e,t)=>{Vg(e,t)}};function Xa(e,t,n){let a=I.get(e);if(!a?.kv)return;let r=a.kv[t];Ct(r,n),dn(r,a.debounceMs,()=>{Ri(e)})}function Ri(e){let t=I.get(e);if(!t?.kv)return;let{nameKey:n,valueKey:a,write:r}=t.kv;if(!pn(n)&&!pn(a))return;let o=W(n,t.kv.name),i=W(a,t.kv.value);Nt(n),Nt(a),r(o,i)}function Pi(e,t){let n=I.get(e)?.ladder;if(!n)return;let{fieldKey:a,mode:r,offered:o}=n;ze?.close(),ze=$t({label:"Value source",onClosed:()=>{ze=null},opener:t,region:"value-source",rows:o.map((i)=>({checked:i===r?"true":"false",destructive:!1,disabled:!1,dividerAbove:!1,id:i,title:wo[i]})),run:(i)=>{let s=i;if(s===r)return;if(r==="ref"&&n.literalDefault!==void 0&&!yu(a,"literal"))vu(a,"literal",n.literalDefault);n.onChange(dc(a,r,s,Ae(n.value),n.seedFor?.(s)??ld(s,{extraSignals:n.extraSignals,literalDefault:n.literalDefault,stateDefs:n.stateDefs})))}})}function ji(e){(me("gatzrz8v"),import("./files-gatzrz8v.js")).then((t)=>t.openFileInTab(e))}function Li(){(me("7jzpbxja"),import("./right-panel-7jzpbxja.js")).then((e)=>e.setInspectorTab("events"))}function G(e,t){return I.set(e.key,t),e}function ae(e,t,n,a){if(!a||a.state==="default")return;e.chipState=a.state,e.chipText=Gy(a),e.chipTitle=Uh(n,a),e.chip=a.state==="set"?"dot":a.onClick?"press":"text",t.chipAction=a.onClick}function jt(e,t,n){let a=cc(n.caps),r=ad(n.fieldKey,n.value),o=[...n.stateDefs.map((d)=>({label:d,value:`#/state/${d}`})),...n.extraSignals??[]],i=a.filter((d)=>d!=="ref"||o.length>0),s=wo[r],l=!i.some((d)=>d!==r);if(e.hasSource=!0,e.sourceLabel=s,e.sourceLocked=l,e.sourceName=l?`Value source: ${s} (no other source available here)`:`Value source: ${s} — click to change`,e.source=r==="literal"?"fixed":"bound",t.ladder={extraSignals:[...n.extraSignals??[]],fieldKey:n.fieldKey,literalDefault:n.literalDefault,mode:r,offered:i,onChange:n.onChange,seedFor:n.seedFor,sources:o,stateDefs:n.stateDefs,value:Ae(n.value)},r==="ref"){e.kind="select",e.value=Ot(n.value)?n.value.$ref:"",e.options=[{label:"— select signal —",value:""},...o.map((d)=>({label:d.label,value:d.value}))],t.commit=(d)=>n.onChange(d?{$ref:d}:void 0),t.debounceMs=0,t.draft=void 0,t.control=void 0;return}if(r==="template"){let d=se(`${n.fieldKey}:template`);e.kind="text",e.mono=!0,e.placeholder="${state.…}",e.value=W(d,typeof n.value==="string"?n.value:""),t.commit=(p)=>n.onChange(p),t.debounceMs=_c,t.draft=d,t.control=void 0;return}if(r==="expression"){let d=n.value?.$expression;e.kind="control",t.commit=void 0,t.draft=void 0,t.control=(p)=>wl(p,d,(c)=>n.onChange({$expression:c}),{allowEventRef:!1,...n.operators?{operators:n.operators}:{},preview:null,stateDefs:n.stateDefs,stateEntries:null})}}function mn(e){let t=Y(e.key,e.prop,e.label);return t.kind="text",t.value=W(e.draft,e.value),t.placeholder=e.placeholder??"",{plan:{commit:e.commit,debounceMs:_c,draft:se(e.draft)},row:t}}function Rt(e,t,n){return{...we(),emptyActions:n,emptyDetail:t,emptyMessage:e,hasEmptyActions:n.length>0,hasEmptyDetail:t!=="",view:"empty"}}function Fi(){I.clear();let e=u.value;if(!e)return Rt("Open a page to inspect and style what you click.","",[{id:"open-page",label:xl().label}]);if(y.layoutSelection)return Oi(y.layoutSelection);let t=Te(e.session.selection);if(!t)return Rt(qh("edit its content"),"",[]);let n=t,a=K(e.doc.document,n);if(!a)return Rt(Rf(),"",[]);if(a.$prototype==="Array")return Rt("A repeating list has no content of its own.","Its items, filter, sort and template are wiring, so they live in Logic.",[{id:"open-logic",label:"Open Logic"}]);return{...we(),sections:Mi(a,n),view:"content"}}function Oi(e){let t=e.layoutFile||"layout";return{...we(),layoutCanOpen:Bg(g.activePaneId)===null,layoutClass:e.className,layoutHasClass:Boolean(e.className),layoutNote:`This element comes from ${t}, which wraps every page that uses it. Open the layout to edit it.`,layoutTag:e.tagName||"element",view:"layout"}}function Mi(e,t){let n=u.value,a=n.doc.document,r=n.session.selection.length>0?n.session.selection:[t],o=We(e.tagName)||"div",i=We(e.tagName).includes("-"),s=e.attributes||{},l=L_(t),d=Gh(a),p={};for(let[h,m]of Object.entries(Ie.$defs))if(!m.$elements||m.$elements.includes(We(o)))p[m.$attr??h]=m;let c={};for(let h of Ie.$sections)c[h.key]=[];for(let[h,m]of Object.entries(p))c[m.$section]?.push({entry:m,name:h});for(let h of Ie.$sections)c[h.key].sort((m,C)=>m.entry.$order-C.entry.$order);let b=new Set(Object.keys(p));if(i){let h=at.find((m)=>m.tagName===e.tagName);for(let m of h?.props??[])b.add(m.name)}let w=Object.entries(s).filter(([h])=>!b.has(h)),k=new Set;for(let h of Object.keys(s)){let m=p[h];if(m)k.add(m.$section)}if(w.length>0)k.add("__custom");let x=[Je("__element","Element",Da("__element",!1),[],0)];if(x[0].rows=Vi(e,t,o,l,d),i){let h=yi(e);x.push(Je(Ya,h?"Component Defaults":"Component Settings",Da(Ya,!0),Ii(e,t,l,h),0));let m=Wi(We(o),at.find((C)=>C.tagName===We(o))?.path??null);if(m)x.push(m)}for(let h of Ie.$sections){let m=c[h.key];if(m.length===0)continue;let C=m.filter((A)=>s[A.name]!==void 0).length,N={bindableSignals:d,doc:a,mapSignals:l,node:e,path:t,tagName:o,targets:r},E=m.map((A)=>Ji(A.name,A.entry,s[A.name],N)),j=Da(h.key,k.has(h.key));x.push(Je(h.key,h.label,j,E,C))}if(w.length>0||Object.keys(s).length>0){let h=Hi(t,w),m=Da("__custom",k.has("__custom"));x.push(Je("__custom","Custom",m,h,w.length))}return x}function Je(e,t,n,a,r){return{dotTitle:`${r} value${r===1?"":"s"} set in this section`,hasDot:r>0,key:e,label:t,open:n,rows:a}}function Pt(e,t){return`prop:${e.join("/")}:${t}`}function Vi(e,t,n,a,r){let o=Dd(e.tagName)?e.tagName.$expression:null,i=(k,x)=>({onClick:()=>q(u.value,(h)=>Ue(h,t,k)),state:"set",title:`Clear ${x}`}),s=(k)=>(x)=>{q(u.value,(h)=>Ue(h,t,k,x||void 0))},l=[],d=mn({commit:s("tagName"),draft:Pt(t,"tagName"),key:"prop|tagName",label:"Tag",prop:"tagName",value:n});jt(d.row,d.plan,{caps:"elementTag",fieldKey:`${t.join(".")}:tagName`,operators:wE,onChange:(k)=>{q(u.value,(x)=>Ue(x,t,"tagName",k??void 0))},seedFor:(k)=>k==="expression"?{$expression:{initial:n,operator:"?:",target:null,value:n}}:void 0,stateDefs:r,value:e.tagName}),l.push(G(d.row,d.plan));let p=mn({commit:s("$id"),draft:Pt(t,"$id"),key:"prop|$id",label:"ID",prop:"$id",value:String(e.$id||"")});if(e.$id)ae(p.row,p.plan,"$id",i("$id","ID"));l.push(G(p.row,p.plan));let c=mn({commit:s("className"),draft:Pt(t,"className"),key:"prop|className",label:"Class",prop:"className",value:String(e.className||"")});if(e.className)ae(c.row,c.plan,"className",i("className","class"));if(l.push(G(c.row,c.plan)),!Array.isArray(e.children)||e.children.length===0){let k=se(Pt(t,"textContent")),x=Y("prop|textContent","textContent","Text Content");x.kind="textarea",x.value=W(k,typeof e.textContent==="string"?e.textContent:"");let h={commit:s("textContent"),debounceMs:_c,draft:k};if(jt(x,h,{caps:"textProperty",extraSignals:a,fieldKey:`prop|${t.join("/")}|textContent`,onChange:(m)=>q(u.value,(C)=>Ue(C,t,"textContent",m)),stateDefs:r,value:e.textContent}),e.textContent!==void 0)ae(x,h,"textContent",i("textContent","text"));l.push(G(x,h))}let b=Y("prop|hidden","hidden","Hidden");b.kind="checkbox",b.checked=Boolean(e.hidden);let w={commitChecked:(k)=>q(u.value,(x)=>Ue(x,t,"hidden",k||void 0)),debounceMs:0};if(e.hidden)ae(b,w,"hidden",i("hidden","hidden"));return l.push(G(b,w)),l}function Ii(e,t,n,a){let r=u.value,o=at.find((x)=>x.tagName===We(e.tagName));if(!o||!o.props)return[qe("props|unknown","This component is not in the project's library, so it has no settings to show.")];let i=o.source==="npm",s=r.doc.document.state??{},l=a?Object.fromEntries(o.props.map((x)=>[x.name,s[x.name]?.default])):i?e.attributes||{}:e.$props||{},d=a?(x,h)=>q(u.value,(m)=>fr(m,x,{default:h})):i?(x,h)=>q(u.value,(m)=>Jo(m,t,x,h===""?void 0:h)):(x,h)=>q(u.value,(m)=>ju(m,t,x,h)),p=r.doc.document.state||{},c=Gh(r.doc.document),b=o.path,w=b&&!a?()=>Za(b):void 0,k=[];for(let x of o.props){let h=l[x.name],m=Ot(h)?h.$ref:null,C=h!==void 0&&h!==null,N=xL(x.type),E=(O)=>d(x.name,O),j=sd(h)==="literal"?String(h??""):"",A=`cprop|${x.name}`,L=se(`cprop:${t.join("/")}:${x.name}`),P=Y(A,x.name,$l(x.name)),F={debounceMs:_c};if(ca(x.format))P.kind="control",F.control=(O)=>od(O,x.name,j,(M)=>E(M));else if(x.format==="color")P.kind="color",P.tokens=Jy(),P.hasTokens=P.tokens.length>0,P.value=W(L,j),P.resolved=Yy(P.value),F.commit=(O)=>E(O),F.draft=L;else if(x.format==="date")P.kind="text",P.placeholder="YYYY-MM-DD",P.value=W(L,j),F.commit=(O)=>E(O),F.draft=L;else if(N.kind==="boolean")P.kind="checkbox",P.checked=Boolean(j),F.commitChecked=(O)=>E(O||void 0);else if(N.kind==="number")P.kind="number",P.value=W(L,j),F.commit=(O)=>E(O),F.draft=L;else if(N.kind==="combobox")P.kind="select",P.value=j,P.options=[At,...N.options.map((O)=>({label:$l(O),value:O}))],F.commit=(O)=>E(O||void 0),F.debounceMs=0;else P.kind="text",P.value=W(L,j),F.commit=(O)=>E(O),F.draft=L;jt(P,F,{caps:"componentProp",extraSignals:n,fieldKey:`cprop|${t.join("/")}|${x.name}`,literalDefault:m?I_(p[m.startsWith("#/state/")?m.slice(8):m])||void 0:void 0,onChange:E,stateDefs:c,value:h}),ae(P,F,x.name,bi(x,h,C,{isDefinition:a,onClear:()=>d(x.name),...w?{openDefinition:w}:{}})),k.push(G(P,F))}if(o.props.length===0)k.push(qe("props|empty",a?"This component declares no settings yet. Add a state entry with a default to give whoever places it something to fill in.":"This component has no settings to fill in yet."));if(w)k.push(yn("props|edit-definition","editDefinition","→ Edit definition",w));return k}function Ji(e,t,n,a){let{doc:r,node:o,path:i,tagName:s,targets:l}=a,d=n!==void 0&&n!=="",p=`attr|${e}`,c=wL(t,e),b=(E)=>q(u.value,(j)=>{for(let A of l)Jo(j,A,e,E)}),w=()=>q(u.value,(E)=>{for(let j of l)Jo(E,j,e)}),k=()=>$i(e,n,d,w,xi(r,l,(E)=>(E?.attributes??{})[e]??null));if((s==="a"||s==="area")&&!Ga(n)){if(e==="href")return _i(p,c,o,i);if(e==="target"){let E=Y(p,e,c);E.kind="select",E.value=typeof o.attributes?.target==="string"?o.attributes.target:"",E.options=[At,...(Array.isArray(t.enum)?t.enum:[]).map((A)=>({label:A,value:A}))];let j={commit:(A)=>b(A||void 0),debounceMs:0};return ae(E,j,e,k()),G(E,j)}}if(t.$input==="popover-target"&&!Ga(n)){let E=Y(p,e,c);E.kind="select",E.value=typeof n==="string"?n:"",E.options=[At,...Rm(u.value?.doc.document??{},{popoverTags:$d}).map((A)=>({label:A,value:A})),{label:"Type an id…",value:qa}];let j={commit:(A)=>{if(A===qa){On("Popover id",{confirmLabel:"Use",message:"The id of a popover in another file.",placeholder:"site-mobile-menu"}).then((L)=>b(L?.trim()||void 0));return}b(A||void 0)},debounceMs:0};return ae(E,j,e,k()),G(E,j)}let h=Y(p,e,c),m=se(`attr:${i.join("/")}:${e}`),C={debounceMs:ym},N=kd(t);if(t.type==="boolean")h.kind="checkbox",h.checked=Boolean(n),C.commitChecked=(E)=>b(E?"":void 0);else if(N==="media"){h.kind="control";let E=Ot(n)?"":String(n||"");C.control=(j)=>od(j,e,E,(A)=>b(A||void 0))}else if(N==="select")h.kind="select",h.value=Ot(n)?"":String(n||""),h.options=[At,...(Array.isArray(t.enum)?t.enum:[]).map((E)=>({label:E,value:E}))],C.commit=(E)=>b(E||void 0),C.debounceMs=0;else h.kind="text",h.value=W(m,Ot(n)?"":String(n||"")),C.commit=(E)=>b(E||void 0),C.draft=m;return jt(h,C,{caps:"attribute",extraSignals:a.mapSignals,fieldKey:`attr|${i.join("/")}|${e}`,onChange:b,stateDefs:a.bindableSignals,value:n}),ae(h,C,e,k()),G(h,C)}function _i(e,t,n,a){let r=typeof n.attributes?.href==="string"?n.attributes.href:"",{kind:o,value:i}=Wa(r),s=(p,c)=>{let b=Ba(p,c);q(u.value,(w)=>Jo(w,a,"href",b||void 0))},l=Y(e,"href",t);l.kind="link",l.linkKind=o,l.kindOptions=[{label:"Internal Page",value:"internal"},{label:"External URL",value:"external"},{label:"Anchor",value:"anchor"},{label:"Email",value:"mailto"},{label:"Phone",value:"tel"}];let d={commit:(p)=>s(o,p),commitKind:(p)=>s(p,i),debounceMs:ym};if(o==="internal"){if(Dt===null&&!fn)ki();l.linkValueKind="route",l.value=i,l.options=(Dt??[]).map((p)=>({label:p,value:p})),d.debounceMs=0}else{let p=se(`link:${a.join("/")}:href`);l.linkValueKind="text",l.value=W(p,i),l.placeholder=o==="mailto"?"name@example.com":o==="tel"?"+15551234567":o==="anchor"?"section-id":"https://example.com",d.draft=p}return ae(l,d,"href",r===""?{state:"default"}:{onClick:()=>q(u.value,(p)=>Jo(p,a,"href")),state:"set",title:"Clear href"}),G(l,d)}function Hi(e,t){let n=t.map(([a,r])=>{let o=`kv|${a}`,i=se(`kvname:${e.join("/")}:${a}`),s=se(`kvval:${e.join("/")}:${a}`),l=Y(o,a,`${a} value`);l.shape="kv",l.name=W(i,a),l.value=W(s,String(r)),l.removeLabel=`Remove ${a}`;let d={action:()=>q(u.value,(p)=>Jo(p,e,a)),debounceMs:ym,kv:{name:a,nameKey:i,value:String(r),valueKey:s,write:(p,c)=>{if(p!==a)q(u.value,(b)=>{Jo(b,e,a),Jo(b,e,p,c)});else q(u.value,(b)=>Jo(b,e,a,c))}}};return G(l,d)});return n.push(yn("kv|add","addAttribute","+ Add attribute",()=>q(u.value,(a)=>Jo(a,e,"data-","")))),n}function Wi(e,t){let n={tagName:e,...t?{path:t}:{}},a=fc(n);if(a?.status==="unsupported")return null;if(a===null)As(n).then(()=>Kh());let r=[],o="Usage";if(a===null||a.status==="pending")r.push(qe("usage|pending","Counting references…"));else if(a.status==="failed")o="Usage · unknown",r.push(qe("usage|failed",`References could not be counted: ${a.message}. This is not the same as “unused”.`),yn("usage|retry","retryUsages","Retry",()=>{_1(n).then(()=>Kh())}));else{let i=Yf(a.result);if(o=Jf(a.result),i.length===0)r.push(qe("usage|none",`Nothing else in this project places <${e}> yet.`));else for(let s of i){let l=Y(`usage|${s.path}`,s.path,s.path);l.shape="file",l.text=s.path,l.detail=String(s.count),l.title=s.refs.map((d)=>`${d.refType} ${d.ref} ×${d.count}`).join(", "),r.push(G(l,{debounceMs:0,openPath:s.path}))}}return Je(gn,o,Da(gn,!1),r,0)}function qe(e,t){let n=Y(e,e,"");return n.shape="note",n.text=t,I.set(e,{debounceMs:0}),n}function yn(e,t,n,a){let r=Y(e,t,n);return r.shape="action",r.text=n,G(r,{action:a,debounceMs:0})}function $_(){return[{args:ke({open:oo("True to expand the section, false to collapse it."),section:je("The section key — one of the fixed rows (__element, __observed, __usages, "+"__custom, __cssprops, __cssparts) or an attribute schema's own $section.")}),category:"View",id:"inspector.setSection",level:"document",menus:["palette"],group:"4_docks",requires:"an open document",when:(e)=>e.document.open,run:(e,t)=>{let n=vi("inspector.setSection",t,"open"),a=ot("inspector.setSection",t,"section"),r=Ei();if(!r.includes(a))throw RangeError(`command "inspector.setSection" argument "section": "${a}" is not a section `+`this document declares — declared: ${r.join(", ")}`);Vg(a,n)},title:"Show Inspector Section"},{category:"Selection",id:"selection.findUsages",level:"selection",menus:["context/element","palette"],group:"4_identity",undo:"none",when:(e)=>e.capability.findReferences&&e.selection.isComponentInstance,requires:"a component instance, on a backend that can search the project",run:()=>{let e=Bi();if(!e)return;let t=at.find((n)=>n.tagName===e)?.path??null;Vg(gn,!0),As({tagName:e,...t?{path:t}:{}}).then(()=>Kh())},title:"Find Usages"}]}function Bi(){let e=u.value,t=Te(e?.session.selection);if(!e||!t)return null;let n=K(e.doc.document,t),a=typeof n?.tagName==="string"?n.tagName:"";return a.includes("-")?a:null}function jk(e){e.registerAll($_())}var nr={$schema:"https://jxsuite.com/schema/v1",$id:"StudioStatements",$description:"The statement editor (spec.md §20): a Function entry's `body: JxStatement[]` edited as STRUCTURE rather than as text. The rows arrive FLAT. A statement tree nests to any depth — an `if` holds two lanes, a `$switch` holds one per case plus a default, and either may hold another of both — while a document's one repeater is `$prototype: \"Array\"` over a list, so `panels/statement-editor.ts` walks the tree once and hands over rows that already carry their own indent; recursion is a property of the walk, exactly as it is for the Data panel's value tree. Four kinds of row come out of that walk: a statement CARD (its header, and the fields that statement is made of), a LANE header naming a branch, the ADD control that ends every lane, and an ACTION that grows the statement itself (`+ Add else`, `+ Add case`). Two hosts draw this — the Navigator's State panel and the Inspector's Logic tab — and neither is named here: the region is stamped on the host, because a shared control cannot know where it is. An operand is an ISLAND: the document renders `[part=\"control-host\"]` and nothing inside it, and the flow fills it with the expression editor (studio-ui-guidelines.md §9.4).",tagName:"div",attributes:{part:"statements"},style:{$description:"The whole of the editor's look, and the conversion moved three things rather than transcribing them. THE INDENT IS A VARIABLE: a lane's depth used to be a nested `<div class=\"statement-lane\">` per level, so a card six deep was six boxes; `--stmt-indent` is written inline per row and read by one shared rule, so a tree of any depth interns one declaration. THE DRAG FEEDBACK IS DATA, NOT CLASSES: `dragging`, `drop-above` and `drop-below` were class toggles with no rule anywhere in the package — they are `data-dragging` and `data-drop` now, and they finally draw. AND `min-width: 0` IS ON EVERY LINK OF THE CHAIN, which is the defect that sent this surface to a stylesheet in the first place: an inline `style=` attribute could not carry it, so at Inspector width an If/Else card pushed its operand controls past the right edge of the window.",display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",minWidth:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-sm)",color:"var(--fg)",'& [part="card"]':{$description:"One statement. A box rather than a bare row because a statement CONTAINS things — its operands, and the lanes under it — and the border is what says where it stops.",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",minWidth:"0",marginInlineStart:"var(--stmt-indent, 0)",padding:"var(--jx-space-2)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-bg-input)"},'& [part="card"][data-dragging]':{opacity:"0.4"},'& [part="card"][data-drop="above"]':{borderBlockStartColor:"var(--jx-accent)"},'& [part="card"][data-drop="below"]':{borderBlockEndColor:"var(--jx-accent)"},'& [part="card-head"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="drag"]':{$description:"A plain span, not a button: the drag adapter needs an element native drag events pass straight through, and a control would swallow the pointer press that starts the drag. Keyboard reorder is the lane's own concern (WCAG 2.2 SC 2.5.7) and is not carried by this handle.",flex:"0 0 auto",display:"inline-flex",color:"var(--fg-dim)",cursor:"grab"},'& [part="kind"]':{flex:"1 1 auto",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--fg-dim)"},'& [part="card-body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",minWidth:"0"},'& [part="field"]':{minWidth:"0"},'& [part="control-host"]':{$description:"Where the expression editor lands. Sized by the row rather than by what is dropped into it, so a formula that grows a row of chips does not widen the Inspector.",display:"block",minWidth:"0"},'& [part="flags"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-3)",minWidth:"0"},'& [part="lane"]':{$description:"A branch's name. The rule on the leading edge is the connector: it is what makes the cards under a `Then` read as being inside it rather than after it.",display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0",marginInlineStart:"var(--stmt-indent, 0)",paddingInlineStart:"var(--jx-space-2)",borderInlineStart:"2px solid var(--jx-border)",color:"var(--fg-dim)"},'& [part="lane-label"]':{flex:"1 1 auto",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="lane-key"]':{flex:"1 1 auto",minWidth:"0"},'& [part="add"], & [part="action"]':{display:"flex",minWidth:"0",marginInlineStart:"var(--stmt-indent, 0)"}},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:{card:{$description:"`data-stmt-row`, `data-stmt-lane` and `data-stmt-index` are the drag adapter's addressing, unchanged from the lit version: a card may only be dropped into the lane it came from, and the lane id is what says so.",tagName:"div",attributes:{part:"card","data-stmt-row":"","data-stmt-kind":"${$map.item.stmt}","data-stmt-lane":"${$map.item.lane}","data-stmt-index":"${$map.item.index}"},style:{"--stmt-indent":{$ref:"$map/item/indent"}},children:[{tagName:"div",attributes:{part:"card-head"},children:[{tagName:"span",attributes:{part:"drag",title:"Drag to reorder","aria-hidden":"true"},children:[{tagName:"jx-icon",$props:{name:"dots-three-vertical"}}]},{tagName:"span",attributes:{part:"kind"},textContent:"${$map.item.label}"},{tagName:"jx-action-button",attributes:{part:"delete"},$props:{size:"sm",quiet:!0,icon:"trash",label:"${$map.item.title}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/key"}]}]}}]},{tagName:"div",attributes:{part:"card-body"},children:[{$prototype:"Array",items:{$ref:"$map/item/fields"},key:{$ref:"$map/item/key"},map:{$description:"One operand of the statement. Every field is `span` — the Inspector is 280px and the standard row is vertically stacked (studio-ui-guidelines.md §4.1) — and every field carries `data-prop`, which is what `inspector/field:<prop>` addresses. The key is `<row>::<prop>`, self-contained because this `$map` shadows the row's own `$map.item`.",tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}"},$props:{label:{$ref:"$map/item/label"},span:!0},children:[{tagName:"div",attributes:{part:"widget-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{control:{tagName:"div",attributes:{part:"control-host","data-field":"${$map.item.key}"}},text:{tagName:"jx-textfield",attributes:{part:"text"},$props:{size:"sm",label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setField"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},select:{tagName:"jx-select",attributes:{part:"select"},$props:{size:"sm",label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},options:{$ref:"$map/item/options"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setField"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},flags:{tagName:"div",attributes:{part:"flags"},children:[{$prototype:"Array",items:{$ref:"$map/item/flags"},key:{$ref:"$map/item/key"},map:{tagName:"jx-checkbox",attributes:{part:"flag","data-flag":"${$map.item.key}"},$props:{size:"sm",label:{$ref:"$map/item/label"},checked:{$ref:"$map/item/checked"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFlag"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]}}}]}}}]}}]}]},lane:{tagName:"div",attributes:{part:"lane","data-lane":"${$map.item.lane}"},style:{"--stmt-indent":{$ref:"$map/item/indent"}},children:[{tagName:"div",attributes:{part:"lane-name-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/editable"},cases:{false:{tagName:"span",attributes:{part:"lane-label"},textContent:"${$map.item.label}"},true:{$description:"A `$switch` case's value is its own name, so the lane header of a case IS a text field. It commits on change rather than on input: renaming a case rebuilds the branch under it, and doing that per keystroke would take the caret out of the field being typed into.",tagName:"jx-textfield",attributes:{part:"lane-key"},$props:{size:"sm",label:"Case value",placeholder:"value",value:{$ref:"$map/item/label"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/rename"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"div",attributes:{part:"lane-actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/removable"},cases:{true:{tagName:"jx-action-button",attributes:{part:"lane-remove"},$props:{size:"sm",quiet:!0,icon:"trash",label:"${$map.item.title}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/key"}]}]}}}}]},add:{$description:"The end of every lane. It opens the kit's menu rather than being a picker of its own: a select that has to snap back to its placeholder after each pick is a control fighting the runtime's skip-an-equal-write, and studio-ui-guidelines.md §12.5 asks for one list of actions rather than a second.",tagName:"div",attributes:{part:"add","data-lane":"${$map.item.lane}"},style:{"--stmt-indent":{$ref:"$map/item/indent"}},children:[{tagName:"jx-action-button",attributes:{part:"add-statement"},$props:{size:"sm",quiet:!0,icon:"plus",haspopup:"menu",label:"${$map.item.title}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[{$ref:"$map/item/key"},{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}]},action:{tagName:"div",attributes:{part:"action"},style:{"--stmt-indent":{$ref:"$map/item/indent"}},children:[{tagName:"jx-action-button",attributes:{part:"grow","data-action":"${$map.item.key}"},$props:{size:"sm",quiet:!0,icon:"plus",label:"${$map.item.label}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/act"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}]}}}}]};T("statements",nr);var Lt=new Map;function ar(e,t,n,a,r){let o=Lt.get(e);if(o&&!o.disposed&&(o.handle===null||o.handle.root.isConnected)){o.scope.rows=t;return}or(e,o),e.textContent="",e.setAttribute(rt,n);let i=v({...a,rows:t}),s={disposed:!1,handle:null,scope:i};Lt.set(e,s),R("statements",i,e,{onNodeCreated:(l,d,p,c)=>{if(!(l instanceof HTMLElement)||Ki(p)!=="control-host")return;r.controlSlot(Ui(c),l)},region:n}).then((l)=>{if(s.disposed){l.dispose();return}s.handle=l})}function Ki(e){let t=typeof e==="string"?void 0:e.attributes?.part;return typeof t==="string"?t:""}function Ui(e){let t=e?.$map?.item,n=t!==null&&typeof t==="object"?t.key:"";return typeof n==="string"?n:""}function rr(){for(let[e,t]of Lt)if(!e.isConnected)or(e,t)}function or(e,t){if(!t)return;t.disposed=!0,t.handle?.dispose(),t.handle=null,Lt.delete(e)}function Mt(e){if(nt(e)){if("operator"in e)return"expression";if("if"in e)return"if";if("$switch"in e)return"switch";if("dispatchEvent"in e)return"dispatch"}return"expression"}var qi=new Set(["=","+=","-=","*=","/="]);function Gi(e){switch(Mt(e)){case"if":return"If / Else";case"switch":return"Switch";case"dispatch":return"Dispatch event";default:{let t=nt(e)?String(e.operator??""):"";if(qi.has(t))return"Set state";if(t==="call")return"Call";return"Expression"}}}var Yi={call:()=>({operator:"call",target:{$ref:""},value:[]}),dispatch:()=>({dispatchEvent:""}),if:()=>({if:{operator:"===",target:{$ref:""},value:null},then:[]}),set:()=>({operator:"=",target:{$ref:""},value:null}),switch:()=>({$switch:{$ref:""},cases:{}})},Xi=[{label:"Set state",value:"set"},{label:"Call function",value:"call"},{label:"If / Else",value:"if"},{label:"Switch",value:"switch"},{label:"Dispatch event",value:"dispatch"}];function $n(e,t){if(t.length===0)return e;let[n,a]=t,r=typeof n==="number"?e[n]:null;if(!nt(r)||typeof a!=="string")return null;if(a==="cases"){let o=t.at(2),{cases:i}=r;if(typeof o!=="string"||!nt(i)||!Array.isArray(i[o]))return null;return $n(i[o],t.slice(3))}if(!Array.isArray(r[a]))return null;return $n(r[a],t.slice(2))}function Ge(e,t,n){if(t.length===0)return n;let a=t[0],r=t[1],o=e[a],i;if(r==="cases"){let s=t[2],l={...o.cases};l[s]=Ge(l[s]??[],t.slice(3),n),i={...o,cases:l}}else i={...o,[r]:Ge(o[r]??[],t.slice(2),n)};return e.map((s,l)=>l===a?i:s)}function bn(e){return{allowEventRef:e.allowEventRef,depth:0,stateDefs:e.stateDefs,stateEntries:e.stateEntries??null}}function Ft(e){return e===0?"0":`calc(var(--jx-space-3) * ${e})`}function Se(e){return{flags:[],key:"",kind:"control",label:"",options:[],placeholder:"",prop:"",value:"",...e}}function Qi(e,t,n){let a=[],r=new Map,o=new Map,i=new Map,s=new Map,l=new Map,d=(n.emits??[]).map((m)=>m.name).filter((m)=>typeof m==="string"&&m.length>0),p=(m)=>JSON.stringify(m);function c(m,C){return{commit:(N)=>t(Ge(e,m,N)),list:C,path:m}}function b(m,C){let N=`add:${p(m.path)}`;i.set(N,m),a.push({editable:!1,fields:[],index:0,indent:Ft(C),key:N,kind:"add",label:"Add statement",lane:p(m.path),removable:!1,stmt:"",title:"Add statement"})}function w(m,C,N,E={}){let j=`lane:${p(m.path)}`;o.set(j,m),a.push({editable:E.editable??!1,fields:[],index:0,indent:Ft(C),key:j,kind:"lane",label:N,lane:p(m.path),removable:Boolean(m.remove),stmt:"",title:E.title??`Remove ${N}`})}function k(m,C,N,E){s.set(m,E),a.push({editable:!1,fields:[],index:0,indent:Ft(C),key:m,kind:"action",label:N,lane:"",removable:!1,stmt:"",title:N})}function x(m,C){let{commit:N,stmt:E}=C,j=Mt(E),A=(L)=>`${m}::${L}`;if(j==="if"){let L=E;return l.set(A("if"),{paint:(P)=>St(P,L.if,(F)=>N({...L,if:F}),{...bn(n),label:"If",prop:"if"})}),[Se({key:A("if"),kind:"control",label:"If",prop:"if"})]}if(j==="switch"){let L=E;return l.set(A("$switch"),{paint:(P)=>St(P,L.$switch,(F)=>N({...L,$switch:F}),{...bn(n),label:"Switch on",prop:"$switch"})}),[Se({key:A("$switch"),kind:"control",label:"Switch on",prop:"$switch"})]}if(j==="dispatch"){let L=E;return l.set(A("dispatchEvent"),{set:(P)=>N({...L,dispatchEvent:P})}),l.set(A("detail"),{paint:(P)=>St(P,L.detail??null,(F)=>N({...L,detail:F}),{...bn(n),label:"Detail",prop:"detail"})}),l.set(A("eventInit"),{flag:(P,F)=>{let{[P]:O,...M}=L;N(F?{...M,[P]:!0}:M)}}),[Se({key:A("dispatchEvent"),kind:d.length>0?"select":"text",label:"Event",options:d.map((P)=>({label:P,value:P})),placeholder:"event-name",prop:"dispatchEvent",value:L.dispatchEvent??""}),Se({key:A("detail"),kind:"control",label:"Detail",prop:"detail"}),Se({flags:[{checked:Boolean(L.bubbles),key:`${A("eventInit")}::bubbles`,label:"Bubbles"},{checked:Boolean(L.composed),key:`${A("eventInit")}::composed`,label:"Composed"}],key:A("eventInit"),kind:"flags",label:"Options",prop:"eventInit"})]}return l.set(A("expression"),{paint:(L)=>wl(L,E,(P)=>N(P),{allowEventRef:n.allowEventRef,stateDefs:n.stateDefs,stateEntries:n.stateEntries??null})}),[Se({key:A("expression"),kind:"control",prop:"expression"})]}function h(m,C,N,E=(j)=>t(Ge(e,C,j))){for(let[j,A]of m.entries()){let L=`${p(C)}#${j}`,P=(M)=>E(m.map((te,oe)=>oe===j?M:te)),F={commit:P,commitLane:E,index:j,list:m,stmt:A};r.set(L,F),a.push({editable:!1,fields:x(L,F),index:j,indent:Ft(N),key:L,kind:"card",label:Gi(A),lane:p(C),removable:!1,stmt:Mt(A),title:"Delete statement"});let O=Mt(A);if(O==="if"){let M=A,te=[...C,j,"then"],oe=c(te,M.then??[]);if(w(oe,N+1,"Then"),h(M.then??[],te,N+1,oe.commit),Array.isArray(M.else)){let ye=[...C,j,"else"],Ne={...c(ye,M.else),remove:()=>{let{else:Ht,...Xe}=M;P(Xe)}};w(Ne,N+1,"Else",{title:"Remove branch"}),h(M.else,ye,N+1,Ne.commit)}else k(`act:${L}:else`,N+1,"Add else",()=>P({...M,else:[]}))}else if(O==="switch"){let M=A,te=nt(M.cases)?M.cases:{},oe=Object.entries(te),ye=(_)=>P({...M,cases:_});for(let[_,de]of oe){let Qe=[...C,j,"cases",_],Sn=Array.isArray(de)?de:[],En={...c(Qe,Sn),remove:()=>{let Re={...te};delete Re[_],ye(Re)},rename:(Re)=>{if(Re===_)return;let Cn={};for(let[Nn,wr]of oe)Cn[Nn===_?Re:Nn]=wr;ye(Cn)}};w(En,N+1,_,{editable:!0,title:"Remove branch"}),h(Sn,Qe,N+1,En.commit)}let Ne=[...C,j,"default"],Ht=Array.isArray(M.default)?M.default:[],Xe={...c(Ne,Ht),commit:(_)=>{if(_.length===0){let{default:de,...Qe}=M;P(Qe);return}P({...M,default:_})}};w(Xe,N+1,"Default"),h(Ht,Ne,N+1,Xe.commit),k(`act:${L}:case`,N+1,"Add case",()=>{let _=oe.length+1,de=`case ${_}`;while(Object.hasOwn(te,de))_+=1,de=`case ${_}`;ye({...te,[de]:[]})})}}b(c(C,m),N)}return h(e,[],0),{actions:s,adds:i,cards:r,fields:l,lanes:o,rows:a}}var ir=new WeakMap;function Zi(e,t,n){requestAnimationFrame(async()=>{let{draggable:a,dropTargetForElements:r}=await (me("bsbs78x9"),import("./adapter-bsbs78x9.js"));ir.get(e)?.();let o=[];for(let i of e.querySelectorAll("[data-stmt-row]")){let s=i.dataset.stmtLane??"[]",l=Math.trunc(Number(i.dataset.stmtIndex))||0,d=i.querySelector('[part="drag"]');o.push(mr(a({element:i,...d?{dragHandle:d}:{},getInitialData(){return{index:l,lane:s,type:"statement"}},onGenerateDragPreview({nativeSetDragImage:p}){mc({nativeSetDragImage:p})},onDragStart(){i.dataset.dragging=""},onDrop(){delete i.dataset.dragging}}),r({element:i,canDrop({source:p}){return p.data.type==="statement"&&p.data.lane===s},getData({input:p,element:c}){return Lb({index:l},{block:["make-child"],currentLevel:0,element:c,indentPerLevel:16,input:p,mode:"standard"})},onDrag({self:p}){let c=$u(p.data);vn(i,c?.type)},onDragLeave(){vn(i)},onDrop({self:p,source:c}){vn(i);let b=$u(p.data);if(!b||b.type!=="reorder-above"&&b.type!=="reorder-below")return;let w=c.data.index,k=JSON.parse(s),x=$n(t,k);if(!x||w===l)return;let h=b.type==="reorder-above"?l:l+1;if(w<h)h-=1;if(h===w)return;let m=x.filter((C,N)=>N!==w);m.splice(h,0,x[w]),n(Ge(t,k,m))}})))}ir.set(e,()=>{for(let i of o)i()})})}function vn(e,t){if(t==="reorder-above")e.dataset.drop="above";else if(t==="reorder-below")e.dataset.drop="below";else delete e.dataset.drop}var sr=new WeakMap;function Zy(e,t,n,a){rr();let r=Array.isArray(t)?t:[],o=Qi(r,n,a),i=sr.get(e);if(!i)i=new Map,sr.set(e,i);let s=i,l=(d,p)=>{o.fields.get(d)?.paint?.(p)};ar(e,o.rows,a.region,{act:(d)=>o.actions.get(d)?.(),add:(d,p)=>{let c=o.adds.get(d);if(!c)return;$t({label:"Add statement",opener:p,region:"statement-add",rows:Xi.map((b)=>({destructive:!1,disabled:!1,dividerAbove:!1,id:b.value,title:b.label})),run:(b)=>{let w=Yi[b];if(w)c.commit([...c.list,w()])}})},remove:(d)=>{let p=o.lanes.get(d);if(p){p.remove?.();return}let c=o.cards.get(d);c?.commitLane(c.list.filter((b,w)=>w!==c.index))},rename:(d,p)=>o.lanes.get(d)?.rename?.(p),setField:(d,p)=>o.fields.get(d)?.set?.(p),setFlag:(d,p)=>{let c=d.lastIndexOf("::");o.fields.get(d.slice(0,c))?.flag?.(d.slice(c+2),p)}},{controlSlot:(d,p)=>{s.set(d,p),l(d,p)}});for(let[d,p]of s){if(!o.fields.has(d)){s.delete(d);continue}l(d,p)}Zi(e,r,n)}var lr={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelSignals",$description:"Navigator › Data: every state entry this document defines, grouped by what KIND of thing it is, and — under the one you opened — the fields that define it beside the value it resolved to. `panels/signals-panel.ts` keeps every decision: what category an entry falls in, what its badge and its one-line summary say, which of nine controls each field of a `$prototype` gets, what a commit is worth, what a rename collides with, and which four surfaces are islands rather than fields. This document draws the answer. Two things follow from that split and are worth stating. THE FIELD LIST IS A PROJECTION, not a shape per category: a `Request` and an `IndexedDB` entry differ only in the rows the flow hands over, so adding a prototype is a case in TypeScript and no markup at all. And EVERY CONTROL HANDS BACK THE NAMES THAT PLACE IT — the entry, the field, and for a table cell its row and column — because the maps nest four deep and inside the innermost one `$map/item` is the cell: a control genuinely cannot see the entry it belongs to, and a name it can hand straight back is the whole answer.",tagName:"div",attributes:{part:"signals","data-refreshing":"${state.refreshing ? '' : null}"},style:{$description:'The `.signal-*`, `.signals-*` and `.data-*` rules of `styles/inspector.css`, carried here and keyed on `part`. A signal row is `part="entry"` rather than `part="row"` because the value tree mounted INSIDE an open one is `surfaces/panel-data.json`, whose lines are `part="row"`; two documents sharing a container may not share a part name. Three token repairs travel with them, all of the shape `surfaces/git-panel.json` describes: `--spectrum-font-size-50` and the bare `10px` literals resolved only inside `<sp-theme>` and a document is mounted outside it, so every rule that read one would silently have taken its px fallback — they are `--jx-text-sm` (11px) and `--jx-text-xs` (10px) here, at the same values — and `--spectrum-corner-radius-75` is `--jx-radius-xs`, also at its own value. ONE rule is repaired rather than moved: `.signal-badge.handler` never matched anything, because `defCategory` has returned `"function"` since the handler category was renamed, so a function entry\'s badge was the only one of five drawn untinted. The tint is keyed on the category the projection actually emits now, and `--handler` is the token it was always written against. And one is DELETED, because the kit already draws it: `.signal-del`\'s hand-rolled visibility hiding is `[part="delete"]`\'s reveal on `:hover` and on `:focus-within` — the old rule was `:hover` alone, so tabbing to Delete moved the keyboard onto an invisible control.',display:"flex",flexDirection:"column",minHeight:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-sm)",color:"var(--fg)",'& [part="toolbar"]':{display:"flex",justifyContent:"flex-end",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)"},'& [part="categories"]':{border:"none"},'& [part="category"]':{$description:"The accordion header reads at the panel's own size rather than the kit's default, which is what `--spectrum-accordion-item-header-font-size` was set for.","--jx-text-md":"var(--jx-text-sm)"},'& [part="entry"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderLeft:"2px solid transparent",userSelect:"none"},'& [part="entry"]:hover':{background:"var(--hover-bg)"},'& [part="entry"][data-expanded]':{background:"var(--accent-10)",borderLeftColor:"var(--accent)"},'& [part="disclosure"]':{$description:"A button dressed as the row it fills: no chrome of its own, the row's own cursor, and the three spans laid out exactly as the old div laid them out.",display:"flex",flex:"1",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0",padding:"0",margin:"0",background:"none",border:"none",color:"inherit",font:"inherit",textAlign:"left",cursor:"pointer"},'& [part="badge"]':{flexShrink:"0",minWidth:"18px",padding:"0 var(--jx-space-2)",borderRadius:"var(--jx-radius-xs)",fontSize:"var(--jx-text-xs)",fontWeight:"600",textAlign:"center"},'& [part="badge"][data-category="state"]':{background:"color-mix(in srgb, var(--signal) 25%, transparent)",color:"var(--signal)"},'& [part="badge"][data-category="computed"]':{background:"color-mix(in srgb, var(--success) 25%, transparent)",color:"var(--success)"},'& [part="badge"][data-category="data"]':{background:"color-mix(in srgb, var(--tag) 25%, transparent)",color:"var(--tag)"},'& [part="badge"][data-category="function"]':{background:"color-mix(in srgb, var(--handler) 25%, transparent)",color:"var(--handler)"},'& [part="name"]':{$description:"The NAME is what you came for, so it is the last thing to be elided. It used to sit at `flex: 1` beside a hint pinned at `flex-shrink: 0`, so a long-prototype row rendered as `re… ContentCollect…` — the summary intact and the identity gone.",flex:"1 1 auto",minWidth:"8em",overflow:"hidden",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& [part="summary"]':{flex:"0 1 auto",minWidth:"0",maxWidth:"64px",overflow:"hidden",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& [part="summary"][data-tone="pending"]':{$description:"PENDING IS A RESTING STATE, not progress. While you are editing, an automatic `Request` is deliberately not fetched — so a value that has not arrived is dim and STILL, and the pulse below is kept for the one moment something is actually in flight. An animation that never stops is a spinner for a thing that is not loading, and it is why `probe.idle()` could not call this panel quiet.",opacity:"0.55"},'&[data-refreshing] [part="summary"][data-tone="pending"]':{opacity:"1",animation:"jx-signals-pulse 1.5s ease-in-out infinite"},'& [part="delete"]':{flexShrink:"0",visibility:"hidden",color:"var(--danger)"},'& [part="entry"]:hover [part="delete"], & [part="entry"]:focus-within [part="delete"]':{visibility:"visible"},'& [part="editor"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",padding:"var(--jx-space-2) var(--jx-space-3) var(--jx-space-3) 26px",borderBottom:"1px solid var(--border)"},'& [part="field"]':{$description:"The editor's rows are narrower than the Inspector's: 65px of label at 10px, which is what `.signal-editor .field-row sp-field-label` set and what keeps a 240px Navigator readable.","--jx-field-label-w":"65px","--jx-text-md":"var(--jx-text-xs)"},'& [part="field-error"]':{margin:"var(--jx-space-1) 0 0",fontSize:"var(--jx-text-xs)",color:"var(--danger)"},'& [part="note"]':{fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="code"], & [part="slot"]':{width:"100%"},'& [part="hint"]':{display:"block",padding:"var(--jx-space-1) 0",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="bar"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",marginTop:"var(--jx-space-2)"},'& [part="bar-label"]':{flex:"1",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="bar-segments"]':{$description:"The Body switch is the kit's segmented control, which draws its own row, frame and selected segment; all the bar asks of it is not to shrink.",flex:"none"},'& [part="bar-buttons"]':{display:"flex",flex:"none",alignItems:"center"},'& [part="chips"]':{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-1)",padding:"1px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",background:"var(--hover-bg)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-xs)"},'& [part="chip-add"]':{flex:"0 0 60px"},'& [part="cells"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)"},'& [part="cell-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="cell-text"]':{$description:"A column's share of the row travels as a custom property under its own name, so a three-column row interns one rule instead of three inline `flex:` attributes.",flex:"var(--cell-grow, 1)",minWidth:"0"},'& [part="field-footer"]':{alignSelf:"flex-start",marginTop:"var(--jx-space-1)","--jx-text-md":"var(--jx-text-xs)"},'& [part="live"]':{marginTop:"var(--jx-space-3)",paddingTop:"var(--jx-space-2)",borderTop:"1px solid var(--border)"},'& [part="live-label"]':{display:"block",marginBottom:"var(--jx-space-1)",fontSize:"var(--jx-text-xs)",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)"},'& [part="tree-host"]':{padding:"var(--jx-space-1) 0",maxHeight:"300px",overflowY:"auto"},'& [part="empty"]':{display:"flex",flex:"1",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-5)",textAlign:"center",color:"var(--fg-dim)"},'& [part="empty-message"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-actions"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)"},'& [part="add"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)"},'& [part="add-picker"]':{flex:"1",minWidth:"0"},"@keyframes jx-signals-pulse":{"0%, 100%":{opacity:"1"},"50%":{opacity:"0.4"}},"@(prefers-reduced-motion: reduce)":{'&[data-refreshing] [part="summary"][data-tone="pending"]':{animation:"none"}},"@(forced-colors: active)":{$description:"Every badge tint collapses into the page in forced colours, so the badge keeps a border of its own and the expanded row is marked by its rule rather than by a wash.",'& [part="badge"]':{border:"1px solid CanvasText"},'& [part="entry"][data-expanded]':{borderLeftColor:"Highlight"}}},children:[{tagName:"span",attributes:{part:"toolbar-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/refreshState"},cases:{idle:{tagName:"div",attributes:{part:"toolbar"},children:[{tagName:"jx-action-button",attributes:{part:"refresh","data-action":"refresh"},$props:{size:"sm",quiet:!0,icon:"arrows-clockwise",label:"Refresh",hint:"Re-run automatic fetches and read the canvas again"},textContent:"Refresh",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]}}]},busy:{tagName:"div",attributes:{part:"toolbar"},children:[{tagName:"jx-action-button",attributes:{part:"refresh","data-action":"refresh"},$props:{size:"sm",quiet:!0,icon:"arrows-clockwise",label:"Refreshing…",loading:!0,disabled:!0},textContent:"Refreshing…"}]}},$description:"Absent entirely until there is something to refresh: the verb re-runs automatic `Request` entries, and a project with no state entries has none. `loading` is the kit's own spinner swap, so the panel does not carry a second one."},{tagName:"jx-accordion",attributes:{part:"categories"},$props:{multiple:!0},children:[{$prototype:"Array",items:{$ref:"#/state/categories"},key:{$ref:"$map/item/key"},map:{tagName:"jx-accordion-item",attributes:{part:"category","data-category":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},open:{$ref:"$map/item/open"}},ontoggle:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleCategory"},value:[{$ref:"$map/item/key"},{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"entry-group",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"entry","data-signal":"${$map.item.key}","data-category":"${$map.item.category}","data-expanded":"${$map.item.expanded ? '' : null}"},children:[{$description:'The disclosure is the BUTTON and the row is the box around it, rather than the row being a `role="button"` with a second button inside it: a delete nested in a control is a control the keyboard reaches by leaving the one it is in. The badge, the name and the summary are what the button is made of, so its accessible name is the entry and what the entry became.',tagName:"button",attributes:{part:"disclosure",type:"button","aria-expanded":"${$map.item.expanded ? 'true' : 'false'}"},children:[{tagName:"span",attributes:{part:"badge","data-category":"${$map.item.category}",title:"${$map.item.categoryLabel}"},textContent:"${$map.item.badge}"},{tagName:"span",attributes:{part:"name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"summary","data-tone":"${$map.item.summaryTone}",title:"${$map.item.summaryTitle}"},textContent:"${$map.item.summary}"}],onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleRow"},value:[{$ref:"$map/item/key"}]}]}},{tagName:"jx-action-button",attributes:{part:"delete","data-signal":"${$map.item.key}"},$props:{size:"sm",quiet:!0,icon:"trash",label:{$ref:"$map/item/deleteLabel"},hint:{$ref:"$map/item/deleteLabel"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dropSignal"},value:[{$ref:"$map/item/key"}]}]}}]},{tagName:"span",attributes:{part:"editor-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/expanded"},cases:{true:{tagName:"div",attributes:{part:"editor","data-signal":"${$map.item.key}"},children:[{$prototype:"Array",items:{$ref:"$map/item/fields"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"field-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{code:{$description:"A function body written as source, which is a control that owns its row: the `bar` above it already says `Body` and holds the mode switch, so a labelled field here would print the word twice. Committed as it is typed, exactly as the textarea it replaces was.",tagName:"jx-textfield",attributes:{part:"code","data-field":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},size:"sm",mono:!0,multiline:!0,grows:!0,rows:{$ref:"$map/item/rows"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/inputField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commitField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},hint:{$description:"A sentence about the whole entry rather than about one field of it — the class an imported prototype resolves to, what a plugin schema says it is for, or that the schema has not arrived yet. No label, because there is no value beside it to name.",tagName:"span",attributes:{part:"hint","data-field":"${$map.item.key}"},textContent:"${$map.item.value}"},text:{tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}","data-field":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},invalid:{$ref:"$map/item/hasError"},span:{$ref:"$map/item/span"}},children:[{tagName:"jx-textfield",attributes:{part:"text"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},size:"sm",mono:{$ref:"$map/item/mono"},invalid:{$ref:"$map/item/hasError"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/inputField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commitField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"span",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasError"},cases:{true:{$description:"§7.1's inline tier: why the value is refused, said AT the control that refuses it and for as long as the value stays bad. The rename collision this exists for used to be a silent no-op — the field kept the typed name, the document kept the old one, and only the canvas could tell you which had won.",tagName:"p",attributes:{part:"field-error",role:"alert"},textContent:"${$map.item.error}"}}}],$description:"Label plus one line. `jx-field` owns the label, the invalid shade and the association between the two, which is the whole of what `ui/field-row.ts`'s `.style-row` carried."},multiline:{tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}","data-field":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},invalid:{$ref:"$map/item/hasError"},span:{$ref:"$map/item/span"}},children:[{tagName:"jx-textfield",attributes:{part:"multiline"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},size:"sm",mono:{$ref:"$map/item/mono"},invalid:{$ref:"$map/item/hasError"},multiline:!0,grows:!0,rows:{$ref:"$map/item/rows"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/inputField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commitField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"span",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasError"},cases:{true:{$description:"§7.1's inline tier: why the value is refused, said AT the control that refuses it and for as long as the value stays bad. The rename collision this exists for used to be a silent no-op — the field kept the typed name, the document kept the old one, and only the canvas could tell you which had won.",tagName:"p",attributes:{part:"field-error",role:"alert"},textContent:"${$map.item.error}"}}}]},select:{tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}","data-field":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},invalid:{$ref:"$map/item/hasError"},span:{$ref:"$map/item/span"}},children:[{tagName:"jx-select",attributes:{part:"select"},$props:{label:{$ref:"$map/item/label"},options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commitField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"span",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasError"},cases:{true:{$description:"§7.1's inline tier: why the value is refused, said AT the control that refuses it and for as long as the value stays bad. The rename collision this exists for used to be a silent no-op — the field kept the typed name, the document kept the old one, and only the canvas could tell you which had won.",tagName:"p",attributes:{part:"field-error",role:"alert"},textContent:"${$map.item.error}"}}}]},checkbox:{tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}","data-field":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},invalid:{$ref:"$map/item/hasError"},span:{$ref:"$map/item/span"}},children:[{tagName:"jx-checkbox",attributes:{part:"checkbox"},$props:{label:{$ref:"$map/item/label"},checked:{$ref:"$map/item/checked"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/checkField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]}},{tagName:"span",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasError"},cases:{true:{$description:"§7.1's inline tier: why the value is refused, said AT the control that refuses it and for as long as the value stays bad. The rename collision this exists for used to be a silent no-op — the field kept the typed name, the document kept the old one, and only the canvas could tell you which had won.",tagName:"p",attributes:{part:"field-error",role:"alert"},textContent:"${$map.item.error}"}}}]},note:{tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}","data-field":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},invalid:{$ref:"$map/item/hasError"},span:{$ref:"$map/item/span"}},children:[{tagName:"span",attributes:{part:"note"},textContent:"${$map.item.value}"},{tagName:"span",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasError"},cases:{true:{$description:"§7.1's inline tier: why the value is refused, said AT the control that refuses it and for as long as the value stays bad. The rename collision this exists for used to be a silent no-op — the field kept the typed name, the document kept the old one, and only the canvas could tell you which had won.",tagName:"p",attributes:{part:"field-error",role:"alert"},textContent:"${$map.item.error}"}}}],$description:"A fact about the entry rather than a control on it — the dependency list a computed entry derived, the class name an imported prototype resolves to, the sentence a plugin schema describes itself with."},"slot-field":{tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}","data-field":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},invalid:{$ref:"$map/item/hasError"},span:{$ref:"$map/item/span"}},children:[{tagName:"div",attributes:{part:"slot-host","data-slot":"${$map.item.slot}","data-signal":"${$map.item.signal}",role:"none"}},{tagName:"span",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasError"},cases:{true:{$description:"§7.1's inline tier: why the value is refused, said AT the control that refuses it and for as long as the value stays bad. The rename collision this exists for used to be a silent no-op — the field kept the typed name, the document kept the old one, and only the canvas could tell you which had won.",tagName:"p",attributes:{part:"field-error",role:"alert"},textContent:"${$map.item.error}"}}}],$description:"A labelled row whose control belongs to another surface — the media picker. The document renders the host and nothing in it (studio-ui-guidelines.md §9.4)."},slot:{$description:"A full-width island: the expression editor, the statement-card editor, or the shared schema form. Each is a surface of its own that three other places embed, so this document renders an empty host and `panels/signals-panel.ts` fills it.",tagName:"div",attributes:{part:"slot-host","data-slot":"${$map.item.slot}","data-signal":"${$map.item.signal}","data-field":"${$map.item.key}",role:"none"}},bar:{$description:"A heading with the controls that act on the whole of what is under it: the Body mode switch, and the button that opens the same value in the Bottom dock. The segments are a projection — the flow says which one is on — so nothing here knows that an array body is `Statements`.",tagName:"div",attributes:{part:"bar","data-field":"${$map.item.key}"},children:[{tagName:"span",attributes:{part:"bar-label"},textContent:"${$map.item.label}"},{$description:"The mode switch is the kit's radiogroup, as the Logic panel's Handler body is. It was a `span` with `role=group` over buttons that carried `selected` alone: the one Spectrum `compact` group the conversion never reached, so it drew as two loose words and announced neither which mode was on nor that the two exclude each other. `checked` makes each segment a radio, so the caret roves and `aria-checked` is the element's own.",tagName:"jx-action-group",attributes:{part:"bar-segments"},$props:{selects:"single",compact:!0,label:{$ref:"$map/item/label"}},children:[{$prototype:"Array",items:{$ref:"$map/item/segments"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"segment","data-segment":"${$map.item.key}"},$props:{size:"sm",label:{$ref:"$map/item/label"},checked:{$ref:"$map/item/checked"}},children:[{tagName:"span",textContent:"${$map.item.label}"}],onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pressField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/field"},{$ref:"$map/item/key"}]}]}}}]},{tagName:"span",attributes:{part:"bar-buttons",role:"none"},children:[{$prototype:"Array",items:{$ref:"$map/item/buttons"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"bar-button","data-action":"${$map.item.key}"},$props:{size:"sm",quiet:!0,icon:{$ref:"$map/item/icon"},label:{$ref:"$map/item/label"},hint:{$ref:"$map/item/label"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pressField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/field"},{$ref:"$map/item/key"}]}]}}}]}]},chips:{tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}","data-field":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},invalid:{$ref:"$map/item/hasError"},span:{$ref:"$map/item/span"}},children:[{$description:"The basic parameter editor: one chip per name, and a field that mints another. Enter commits, because the chip IS the commit — there is nothing else in the row to leave.",tagName:"div",attributes:{part:"chips",role:"none"},children:[{$prototype:"Array",items:{$ref:"$map/item/chips"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"chip","data-chip":"${$map.item.key}"},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${$map.item.label}"},{tagName:"jx-action-button",attributes:{part:"chip-remove","data-chip":"${$map.item.key}"},$props:{size:"sm",quiet:!0,icon:"x",label:{$ref:"$map/item/removeLabel"},hint:{$ref:"$map/item/removeLabel"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dropChip"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/field"},{$ref:"$map/item/key"}]}]}}]}},{tagName:"jx-textfield",attributes:{part:"chip-add"},$props:{label:{$ref:"$map/item/addLabel"},placeholder:"+",size:"sm"},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/addChip"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}]}}]},{tagName:"span",attributes:{part:"footer-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFooter"},cases:{true:{$description:"The basic/advanced switch, drawn as the quiet text link it has always been rather than as a second control: it changes how much of ONE value is on screen, not what the value is.",tagName:"jx-action-button",attributes:{part:"field-footer"},$props:{quiet:!0,size:"sm",label:{$ref:"$map/item/footer"}},textContent:"${$map.item.footer}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pressField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},"footer"]}]}}}},{tagName:"span",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasError"},cases:{true:{$description:"§7.1's inline tier: why the value is refused, said AT the control that refuses it and for as long as the value stays bad. The rename collision this exists for used to be a silent no-op — the field kept the typed name, the document kept the old one, and only the canvas could tell you which had won.",tagName:"p",attributes:{part:"field-error",role:"alert"},textContent:"${$map.item.error}"}}}]},rows:{tagName:"jx-field",attributes:{part:"field","data-prop":"${$map.item.prop}","data-field":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},invalid:{$ref:"$map/item/hasError"},span:{$ref:"$map/item/span"}},children:[{$description:"The advanced parameter editor and the emits editor, which are one shape: a row per entry, a cell per declared column, a remove beside each and one add below. Every cell hands back the four names that place it, because inside the cell map `$map/item` is the cell and it cannot see the row it is in.",tagName:"div",attributes:{part:"cells",role:"none"},children:[{$prototype:"Array",items:{$ref:"$map/item/cellRows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"cell-row","data-row":"${$map.item.key}"},children:[{$prototype:"Array",items:{$ref:"$map/item/cells"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"cell",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{text:{tagName:"jx-textfield",attributes:{part:"cell-text"},style:{"--cell-grow":{$ref:"$map/item/grow"}},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editCell"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},checkbox:{tagName:"jx-checkbox",attributes:{part:"cell-checkbox"},$props:{label:{$ref:"$map/item/label"},checked:{$ref:"$map/item/checked"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/checkCell"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/field"},{$ref:"$map/item/row"},{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]}}}}},{tagName:"jx-action-button",attributes:{part:"cell-remove","data-row":"${$map.item.key}"},$props:{size:"sm",quiet:!0,icon:"x",label:{$ref:"$map/item/removeLabel"},hint:{$ref:"$map/item/removeLabel"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dropRow"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/field"},{$ref:"$map/item/key"}]}]}}]}},{tagName:"jx-action-button",attributes:{part:"row-add"},$props:{size:"sm",quiet:!0,icon:"plus",label:{$ref:"$map/item/addLabel"}},textContent:"${$map.item.addLabel}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addRow"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"}]}]}}]},{tagName:"span",attributes:{part:"footer-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFooter"},cases:{true:{$description:"The basic/advanced switch, drawn as the quiet text link it has always been rather than as a second control: it changes how much of ONE value is on screen, not what the value is.",tagName:"jx-action-button",attributes:{part:"field-footer"},$props:{quiet:!0,size:"sm",label:{$ref:"$map/item/footer"}},textContent:"${$map.item.footer}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pressField"},value:[{$ref:"$map/item/signal"},{$ref:"$map/item/key"},"footer"]}]}}}},{tagName:"span",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasError"},cases:{true:{$description:"§7.1's inline tier: why the value is refused, said AT the control that refuses it and for as long as the value stays bad. The rename collision this exists for used to be a silent no-op — the field kept the typed name, the document kept the old one, and only the canvas could tell you which had won.",tagName:"p",attributes:{part:"field-error",role:"alert"},textContent:"${$map.item.error}"}}}]}}}},{$description:"What this entry BECAME, under the fields that define it. The border above it is the seam between the two halves that used to be two panels (plan §11.2).",tagName:"div",attributes:{part:"live"},children:[{tagName:"span",attributes:{part:"live-label"},textContent:"${$map.item.liveLabel}"},{tagName:"div",attributes:{part:"tree-host","data-slot":"tree","data-signal":"${$map.item.key}",role:"none"}}]}]}}}]}}]}}]},{tagName:"span",attributes:{part:"empty-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/listState"},cases:{empty:{$description:"Drawn here rather than borrowed from `panels/empty-state.ts`, which is a lit template a document cannot call. What is kept is the pattern's rules (§11): one sentence saying what the region is for, then the action that fills it.",tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"${state.emptyMessage}"},{tagName:"div",attributes:{part:"empty-actions"},children:[{tagName:"jx-action-button",attributes:{part:"empty-action"},$props:{size:"sm",label:"Add a value"},textContent:"Add a value",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addSignal"},value:["state"]}]}}]}]}}},{$description:'One picker, and its rows are GROUPED rather than divided: `jx-select` draws both halves of a group\'s delimiter, so "Data sources" and "Project imports" are named instead of being three unlabelled rules the reader has to infer. Picking a row is the whole gesture — the flow mints a free name, seeds the template and opens the entry — so the control never rests on what was picked, and `addSignal` announces the pick and then the empty string so the binding has a change to write back.',tagName:"div",attributes:{part:"add"},children:[{tagName:"jx-select",attributes:{part:"add-picker"},$props:{label:"Add a state entry",size:"sm",options:{$ref:"#/state/addOptions"},groups:{$ref:"#/state/addGroups"},value:{$ref:"#/state/addValue"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addSignal"},value:[{$ref:"event#/target/value"}]}]}}]}]};T("panel-signals",lr);function ts(e){let n=e?.attributes?.part;return typeof n==="string"?n:""}function ns(e){let n=e?.$map?.item;return n!==null&&typeof n==="object"?n:null}function xn(e,t){let n=e?.[t];return typeof n==="string"?n:""}function as(){return{addGroups:[],addOptions:[],addValue:"",categories:[],emptyMessage:"",listState:"empty",refreshState:"none",refreshing:!1}}function pr(e,t){e.refreshState=t.refreshState,e.refreshing=t.refreshing,e.listState=t.listState,e.emptyMessage=t.emptyMessage,e.categories=t.categories,e.addOptions=t.addOptions,e.addGroups=t.addGroups,e.addValue=t.addValue}function dr(e,t,n,a){let r=v({...as(),...n,addSignal:(p)=>{r.addValue=p,n.addSignal(p),r.addValue=""}});pr(r,t);let o=new Map,i=!1,s=()=>{if(i)return;i=!0,queueMicrotask(()=>{i=!1;for(let[p,c]of o)if(c.host.isConnected)a(c.host,c.signal,c.slot);else o.delete(p)})},l=null,d=!1;return R("panel-signals",r,e,{onNodeCreated:(p,c,b,w)=>{if(!(p instanceof HTMLElement))return;let k=ts(b);if(k!=="slot-host"&&k!=="tree-host")return;let x=ns(w),h=k==="tree-host",m=h?xn(x,"key"):xn(x,"signal"),C=h?"tree":xn(x,"slot");if(!m||!C)return;o.set(`${m}/${C}`,{host:p,signal:m,slot:C}),s()}}).then((p)=>{if(d){p.dispose();return}l=p,s()}),{attached:()=>!d&&(l===null||l.root.parentNode===e),dispose(){d=!0,l?.dispose(),l=null,o.clear()},update(p){pr(r,p),s()}}}var fe=null,Vt=new Set,rs={computed:{$compute:"",$deps:[]},cookie:{$prototype:"Cookie",default:"",name:""},expression:{$expression:{operator:"=",target:null}},external:{$prototype:"",$src:""},formData:{$prototype:"FormData",fields:{}},function:{$prototype:"Function",body:"",parameters:[]},indexedDB:{$prototype:"IndexedDB",database:"",store:"",version:1},localStorage:{$prototype:"LocalStorage",default:null,key:""},map:{$prototype:"Map",default:{}},request:{$prototype:"Request",method:"GET",timing:"client",url:""},sessionStorage:{$prototype:"SessionStorage",default:null,key:""},set:{$prototype:"Set",default:[]},state:{default:"",type:"string"}},os=new Set(["$prototype","$src","$export","timing","default","description","body","parameters","name","attribute","reflects","deprecated","emits"]),is=500;function hr(){let e=[];for(let t of Cm())for(let n of t.classes??[])if(n.state)e.push({name:n.name,...n.stateDefaults===void 0?{}:{stateDefaults:n.stateDefaults}});return e}function ss(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)?e:{}}function Aa(e){if(!e)return"state";let t=e;if(t.$expression)return"expression";if(t.$handler||t.$prototype==="Function")return"function";if(t.$compute)return"computed";if(t.$prototype)return"data";return"state"}function D_(e){if(!e)return"S";let t=e;if(t.$expression)return"E";if(t.$handler||t.$prototype==="Function")return"F";if(t.$compute)return"C";if(t.$prototype)return t.$prototype.charAt(0);return"S"}function ls(e,t){if(!t)return"";if(t.$expression)return xa(t.$expression);if(t.$prototype==="Function"){if(Array.isArray(t.body))return`${t.body.length} statement${t.body.length===1?"":"s"}`;if(t.body)return t.body.length>20?`${t.body.slice(0,20)}...`:t.body;if(t.$src)return t.$src;return"function"}if(t.$handler)return"handler (legacy)";if(t.$compute)return`=${t.$compute.length>20?`${t.$compute.slice(0,20)}...`:t.$compute}`;if(t.$prototype==="Request")return`${t.method||"GET"} ${(t.url||"").slice(0,20)}`;if(t.$prototype==="LocalStorage"||t.$prototype==="SessionStorage")return t.key||"";if(t.$prototype==="IndexedDB")return t.database||"";if(t.$prototype==="Cookie")return t.name||"";if(t.$prototype)return t.$prototype;if(t.attribute)return`[${t.attribute}] ${t.type||""}`;return t.type||""}function Xy(e){return We(e.document.tagName).includes("-")}function A_(e,t=[]){let n=e?.attributes?.part;if(typeof n==="string"&&n)t.push({name:n,tag:We(e?.tagName)||"div"});if(Array.isArray(e?.children)){for(let a of e.children)if(typeof a!=="string")A_(a,t)}return t}function ds(e){return typeof e==="string"?{name:e}:e}function yr(e){if(typeof e==="object"&&e!==null&&!Array.isArray(e)){let{text:t}=e;if(typeof t==="string")return t}return""}function br(e,t=!1){if(e===void 0||e===null)return"";if(typeof e==="object")return t?JSON.stringify(e,null,2):JSON.stringify(e);return String(e)}var Ce=new Map,he=new Map,Ye=new Map,It=new Set,wn=null,kn=null;function _t(e,t){return`${e}
2
- ${t}`}function V(e,t){let n={addLabel:"",buttons:[],cellRows:[],checked:!1,chips:[],error:"",footer:"",hasError:!1,hasFooter:!1,label:"",mono:!1,options:[],placeholder:"",prop:e.prop??e.label??e.key,rows:"",segments:[],slot:"",span:!1,value:"",...e};return Ce.set(_t(e.signal,e.key),{...t??{live:"none",value:""},value:n.value}),n}function J(e,t,n,a,r,o={}){return V({key:t,kind:"text",label:n,signal:e,value:a,...o},{live:"none",value:a,write:r})}function Jt(e,t,n,a,r,o){return V({key:t,kind:"select",label:n,options:a.map((i)=>({label:i,value:i})),signal:e,value:r},{live:"none",value:r,write:o})}function us(e,t){let n=fe?.name===t?fe.message:"";return V({error:n,hasError:n!=="",key:"name",kind:"text",label:"Name",prop:"Name",signal:t,value:t},{live:"none",value:t,write:(a)=>{let r=a.trim();if(r===t){fe=null;return}if(!r)fe={message:"A name is required.",name:t};else if(e.document.state?.[r])fe={message:`"${r}" is already defined by this document.`,name:t};else fe=null,ie(t,!1),ie(r,!0),q(u.value,(o)=>hL(o,t,r));B()}})}function ms(e,t,n){let a=(i)=>{q(u.value,(s)=>fr(s,t,i))},r=br(n.default),o=[Jt(t,"type","Type",["string","integer","number","boolean","array","object"],n.type||"string",(i)=>a({type:i}))];if(n.type==="string"||!n.type)o.push(Jt(t,"format","Format",["","image","date","color"],n.format||"",(i)=>a({format:i||void 0})));if(ca(n.format))o.push(V({key:"default",kind:"slot-field",label:"Default",prop:"Default",signal:t,slot:"media"})),he.set(`${t}/media`,(i)=>{od(i,"default",r,(s)=>a({default:s||void 0}))});else o.push(J(t,"default","Default",r,(i)=>{let s=i;if(n.type==="integer")s=Math.trunc(Number(i))||0;else if(n.type==="number")s=Number(i)||0;else if(n.type==="boolean")s=i==="true";else if(n.type==="array"||n.type==="object")try{s=JSON.parse(i)}catch{s=i}a({default:s})}));if(o.push(J(t,"description","Description",n.description||"",(i)=>a({description:i||void 0}))),Xy(e))o.push(J(t,"attribute","Attribute",n.attribute||"",(i)=>a({attribute:i||void 0})),V({checked:Boolean(n.reflects),key:"reflects",kind:"checkbox",label:"Reflects",prop:"reflects",signal:t},{check:(i)=>a({reflects:i||void 0}),live:"none",value:""}),J(t,"deprecated","Deprecated",typeof n.deprecated==="string"?n.deprecated:"",(i)=>a({deprecated:i||void 0})));return o}function fs(e,t){let n=t.$compute||"",a=[V({key:"expression",kind:"multiline",label:"Expression",prop:"expression",rows:"2",signal:e,value:n},{live:"debounce",value:n,write:(r)=>{let o=r.match(/\$[a-zA-Z_]\w*/g)||[],i=[...new Set(o)].map((s)=>`#/state/${s}`);q(u.value,(s)=>fr(s,e,{$compute:r,$deps:i}))}})];if(t.$deps&&t.$deps.length>0)a.push(V({key:"dependencies",kind:"note",label:"Dependencies",prop:"dependencies",signal:e,value:t.$deps.map((r)=>r.replace("#/state/","")).join(", ")}));return a}function gs(e,t,n){let a=(o)=>{q(u.value,(i)=>fr(i,t,o))},r=n.$prototype;if(r==="Request")return[J(t,"url","URL",n.url||"",(o)=>a({url:o})),Jt(t,"method","Method",["GET","POST","PUT","DELETE","PATCH"],n.method||"GET",(o)=>a({method:o})),Jt(t,"timing","Timing",["client","server"],n.timing||"client",(o)=>a({timing:o}))];if(r==="LocalStorage"||r==="SessionStorage"){let o=br(n.default,!0);return[J(t,"key","Key",n.key||"",(i)=>a({key:i})),V({key:"default",kind:"multiline",label:"Default",prop:"Default",rows:"3",signal:t,value:o},{live:"debounce",value:o,write:(i)=>{try{a({default:JSON.parse(i)})}catch{a({default:i})}}})]}if(r==="IndexedDB")return[J(t,"database","Database",n.database||"",(o)=>a({database:o})),J(t,"store","Store",n.store||"",(o)=>a({store:o})),J(t,"version","Version",String(n.version||1),(o)=>a({version:Math.trunc(Number(o))||1}))];if(r==="Cookie")return[J(t,"cookie","Cookie",n.name||"",(o)=>a({name:o})),J(t,"default","Default",String(n.default||""),(o)=>a({default:o}))];if(r==="Set"||r==="Map"||r==="FormData"){let o=r==="FormData",i=o?"fields":"default",s=o?"Fields":"Default",l=n.default!==void 0&&n.default!==null?JSON.stringify(n.default,null,2):o?JSON.stringify(n.fields||{},null,2):"";return[V({key:i,kind:"multiline",label:s,prop:s,rows:"3",signal:t,value:l},{live:"debounce",value:l,write:(d)=>{try{a({[i]:JSON.parse(d)})}catch{}}})]}return hs(e,t,n)}function hs(e,t,n){let a=(d)=>{q(u.value,(p)=>fr(p,t,d))},r=n.$prototype?D?.projectConfig?.imports?.[n.$prototype]:null,o=[];if(r)o.push(V({key:"prototype",kind:"hint",signal:t,value:n.$prototype||""}));else o.push(J(t,"src","Source",n.$src||"",(d)=>{a({$src:d||void 0}),pc.delete(`${d}::${n.$prototype}`)}),J(t,"kind","Kind",n.$prototype||"",(d)=>{a({$prototype:d||void 0}),pc.delete(`${n.$src}::${d}`)}));if(n.$export)o.push(J(t,"export","Export",n.$export||"",(d)=>a({$export:d||void 0})));let i=n.$src||r;if(!i||!n.$prototype)return o;let s=`${i}::${n.$prototype}`;if(!pc.has(s)){if(o.push(V({key:"schema-loading",kind:"hint",signal:t,value:"Loading schema…"})),!It.has(s))It.add(s),mb(n,{...e.documentPath!=null&&{documentPath:e.documentPath}}).then((d)=>{if(d)B()}).finally(()=>It.delete(s));return o}let l=pc.get(s);if(!l)return o;if(l.description)o.push(V({key:"schema-note",kind:"hint",signal:t,value:l.description}));return o.push(V({key:"schema",kind:"slot",signal:t,slot:"schema"})),he.set(`${t}/schema`,(d)=>{ks(d,l,n,t,e)}),o}function vr(e,t,n){if(t==="name")return{...e,name:n};if(t==="type"){let{type:o,...i}=e;return n?{...i,type:{text:n}}:i}let{description:a,...r}=e;return n?{...r,description:n}:r}function Ee(e,t,n,a){return{checked:!1,grow:a,key:e,kind:"text",label:t,placeholder:t,value:n}}function $r(e,t,n,a,r){return{cells:r.map((o)=>({...o,field:t,row:n,signal:e})),field:t,key:n,removeLabel:`Remove ${a}`,signal:e}}function ys(e,t){let n=(t.parameters||[]).map((i)=>ds(i)),a=Vt.has(e),r=(i)=>{q(u.value,(s)=>fr(s,e,{parameters:i.length>0?i:void 0}))},o={addChip:(i)=>{let s=i.trim();if(s)r([...n,{name:s}])},addRow:()=>{q(u.value,(i)=>fr(i,e,{parameters:[...n,{name:""}]}))},cell:(i,s,l)=>{let d=[...n],p=d[Number(i)];if(!p)return;d[Number(i)]=vr(p,s,l),r(d)},cellCheck:(i,s,l)=>{let d=[...n],p=d[Number(i)];if(!p)return;let{optional:c,...b}=p;d[Number(i)]=l?{...b,optional:!0}:b,r(d)},dropChip:(i)=>r(n.filter((s,l)=>l!==Number(i))),dropRow:(i)=>r(n.filter((s,l)=>l!==Number(i))),live:"none",press:(i)=>{if(i!=="footer")return;if(a)Vt.delete(e);else Vt.add(e);B()},value:""};if(!a){let i=n.map((s,l)=>({field:"parameters",key:String(l),label:s.name||"?",removeLabel:`Remove ${s.name||"parameter"}`,signal:e}));return V({addLabel:"Add a parameter",chips:i,footer:"▸ Advanced",hasFooter:!0,key:"parameters",kind:"chips",label:"Parameters",prop:"parameters",signal:e},o)}return V({addLabel:"Add parameter",cellRows:n.map((i,s)=>$r(e,"parameters",String(s),i.name||"parameter",[Ee("name","name",i.name||"","1"),Ee("type","type",yr(i.type),"1"),Ee("description","desc",i.description||"","2"),{checked:Boolean(i.optional),grow:"0",key:"optional",kind:"checkbox",label:"Optional",placeholder:"",value:""}])),footer:"▾ Basic",hasFooter:!0,key:"parameters",kind:"rows",label:"Parameters",prop:"parameters",signal:e,span:!0},o)}function bs(e,t){let n=t.emits||[],a=(r)=>{q(u.value,(o)=>fr(o,e,{emits:r.length>0?r:void 0}))};return V({addLabel:"Add event",cellRows:n.map((r,o)=>$r(e,"emits",String(o),r.name||"event",[Ee("name","event name",r.name||"","1"),Ee("type","type",yr(r.type),"1"),Ee("description","description",r.description||"","2")])),key:"emits",kind:"rows",label:"Emits",prop:"emits",signal:e,span:!0},{addRow:()=>{q(u.value,(r)=>fr(r,e,{emits:[...n,{name:""}]}))},cell:(r,o,i)=>{let s=[...n],l=s[Number(r)];if(!l)return;s[Number(r)]=vr(l,o,i),a(s)},dropRow:(r)=>a(n.filter((o,i)=>i!==Number(r))),live:"none",value:""})}function vs(e,t,n){let a=(s)=>{q(u.value,(l)=>fr(l,t,s))},r=[J(t,"description","Description",n.description||"",(s)=>a({description:s||void 0})),ys(t,n)];if(Xy(e))r.push(bs(t,n));if(n.$src)return r.push(J(t,"src","Source",n.$src||"",(s)=>a({$src:s||void 0})),J(t,"export","Export",n.$export||"",(s)=>a({$export:s||void 0}))),r;let o=Array.isArray(n.body);if(r.push(V({buttons:o?[]:[{field:"body",icon:"code",key:"editor",label:"Open in code editor",signal:t}],key:"body",kind:"bar",label:"Body",prop:"Body",segments:[{checked:o?"true":"false",field:"body",key:"statements",label:"Statements",signal:t},{checked:o?"false":"true",field:"body",key:"code",label:"Code",signal:t}],signal:t},{live:"none",press:(s)=>{if(s==="statements"&&!o)a({body:[]}),B();else if(s==="code"&&o)a({body:""}),B();else if(s==="editor")gu({editing:{defName:t,type:"def"},surface:"function"})},value:""})),o)return r.push(V({key:"statements",kind:"slot",signal:t,slot:"statements"})),he.set(`${t}/statements`,(s)=>{Zy(s,n.body,(l)=>{a({body:l}),B()},{allowEventRef:!0,emits:n.emits??[],region:HL,stateDefs:Object.keys(e.document.state||{}),stateEntries:e.document.state||{}})}),r;let i=typeof n.body==="string"?n.body:"";return r.push(V({key:"code",kind:"code",label:"Body",prop:"Body",rows:"3",signal:t,value:i},{live:"commit",value:i,write:(s)=>a({body:s})})),r}function $s(e,t,n){let a=n.$expression||{operator:"=",target:null},r=[V({buttons:[{field:"expression",icon:"align-bottom",key:"formula",label:"Open in formula workspace",signal:t}],key:"expression",kind:"bar",label:"Expression",prop:"Expression",signal:t},{live:"none",press:()=>gu({editing:{defName:t,type:"def"},surface:"formula"}),value:""}),V({key:"editor",kind:"slot",signal:t,slot:"expression"})];return he.set(`${t}/expression`,(o)=>{wl(o,a,(i)=>q(u.value,(s)=>fr(s,t,{$expression:i})),{allowEventRef:!1,preview:If(u.value,`def:${t}`,a,null,()=>Ai("leftPanel")),onInsertDef:(i,s)=>q(u.value,(l)=>Os(l,i,s)),stateDefs:Object.keys(e.document.state||{}),stateEntries:e.document.state||{}})}),r}function xs(e,t,n){let a=us(e,t);switch(Aa(n)){case"state":return[a,...ms(e,t,n)];case"computed":return[a,...fs(t,n)];case"data":return[a,...gs(e,t,n)];case"function":return[a,...vs(e,t,n)];case"expression":return[a,...$s(e,t,n)];default:return[a]}}function ws(e,t){if(e==="#/$context/content")return D?.projectConfig?.content??{};if(e==="$contentTypes"||e==="#/$context/contentTypes")return D?.projectConfig?.contentTypes??{};return xu(e,{projectConfig:D?.projectConfig??{},...t!==void 0&&{scope:t}})}function ks(e,t,n,a,r){if(!t.properties){e.replaceChildren();return}let o=Object.fromEntries(Object.entries(t.properties).filter(([s])=>!os.has(s))),i=cd(`signal:${a}`,{...t,properties:o},n,{context:{fieldKeyPrefix:a,params:Cl(r.documentPath),resolvePointer:ws,signals:Gh(r.document).filter((s)=>s!==a)},onChange:(s)=>q(u.value,(l)=>fr(l,a,s)),rerender:B});if(i.parentNode!==e)e.replaceChildren(i)}function Ss(e,t,n,a){let r=Aa(t)==="function"||t.$expression!=null&&ga(t.$expression);if(!a||r){let o=ls(e,t);return{summary:o,summaryTitle:o,summaryTone:"hint"}}return{summary:Lf(n),summaryTitle:"What this resolved to on the canvas",summaryTone:sc(n)===null?"pending":"value"}}var cr=[{key:"state",label:"State"},{key:"computed",label:"Computed"},{key:"data",label:"Data"},{key:"expression",label:"Expressions"},{key:"function",label:"Functions"}],Es=[{id:"values",label:"Values",rows:[{label:"Value",value:"state"},{label:"Computed",value:"computed"}]},{id:"sources",label:"Data sources",rows:[{label:"Fetch from a URL",value:"request"},{label:"LocalStorage",value:"localStorage"},{label:"SessionStorage",value:"sessionStorage"},{label:"IndexedDB",value:"indexedDB"},{label:"Cookie",value:"cookie"},{label:"Set",value:"set"},{label:"Map",value:"map"},{label:"FormData",value:"formData"},{label:"From a module…",value:"external"}]},{id:"logic",label:"Logic",rows:[{label:"Expression",value:"expression"},{label:"Function",value:"function"}]}];function Cs(e,t){Ce.clear(),he.clear();let n=e.document.state||{},a=Object.entries(n),r=e.canvas?.scope??null,o=r??{},i=e.canvas?.refreshing===!0;Id();let s=new Map(cr.map(({key:w})=>[w,[]]));for(let[w,k]of a)s.get(Aa(k))?.push([w,ss(k)]);e._collapsedSignalCats||=new Set;let l=e._collapsedSignalCats,d=[];for(let{key:w,label:k}of cr){let x=s.get(w)??[];if(x.length===0)continue;let h=x.map(([m,C])=>{let N=Ut(m),E=o[m];if(N)he.set(`${m}/tree`,(j)=>{it(j,sc(E),m,B)});return{badge:D_(C),category:Aa(C),categoryLabel:k,deleteLabel:`Delete ${m}`,expanded:N,fields:N?xs(e,m,C):[],key:m,liveLabel:"Resolved to",name:m,...Ss(m,C,E,r!==null)}});d.push({key:w,label:`${k} (${x.length})`,open:!l.has(w),rows:h})}let p=[...Es],c=D?.projectConfig?.imports;if(c)p.splice(2,0,{id:"imports",label:"Project imports",rows:Object.keys(c).map((w)=>({label:w,value:`import:${w}`}))});let b=hr();if(b.length>0)p.splice(c?3:2,0,{id:"extensions",label:"Extensions",rows:b.map((w)=>({label:w.name,value:`ext:${w.name}`}))});return{addGroups:p,addOptions:[{label:"+ Add…",value:""}],addValue:"",categories:d,emptyMessage:"Data lives here — values this page can read, compute or fetch, "+"ready to bind to any element.",listState:a.length===0?"empty":"listed",refreshState:t.refreshData&&a.length>0?i?"busy":"idle":"none",refreshing:i}}function xr(e,t){let n=t,a=1;while(e.document.state&&e.document.state[n])n=t+a,a+=1;return n}function Ns(e,t){let n=rs[e];if(!n)return;let a=xr(t,e==="function"?"newFunction":"$newSignal");q(u.value,(r)=>Os(r,a,structuredClone(n))),ie(a,!0),B()}function gr(e,t){return xr(e,`$${t.charAt(0).toLowerCase()}${t.slice(1)}`)}function Ts(e){let t=wn;if(!t||!e)return;if(e.startsWith("ext:")){let n=e.slice(4),a=hr().find((o)=>o.name===n),r=gr(t,n);q(u.value,(o)=>Os(o,r,{$prototype:n,...a?.stateDefaults})),ie(r,!0),B();return}if(e.startsWith("import:")){let n=e.slice(7),a=gr(t,n);q(u.value,(r)=>Os(r,a,{$prototype:n})),ie(a,!0),B();return}Ns(e,t)}function B(){kn?.renderLeftPanel()}function le(e,t){return Ce.get(_t(e,t))}function Rs(e,t,n){let a=_t(e,t);clearTimeout(Ye.get(a)),Ye.delete(a);let r=Ce.get(a);if(!r?.write||n===r.value)return;r.write(n)}var Ps={addChip:(e,t,n)=>le(e,t)?.addChip?.(n),addRow:(e,t)=>le(e,t)?.addRow?.(),addSignal:(e)=>Ts(e),checkCell:(e,t,n,a,r)=>le(e,t)?.cellCheck?.(n,a,r),checkField:(e,t,n)=>le(e,t)?.check?.(n),commitField:(e,t,n)=>Rs(e,t,n),dropChip:(e,t,n)=>le(e,t)?.dropChip?.(n),dropRow:(e,t,n)=>le(e,t)?.dropRow?.(n),dropSignal:(e)=>q(u.value,(t)=>rv(t,e)),editCell:(e,t,n,a,r)=>le(e,t)?.cell?.(n,a,r),inputField:(e,t,n)=>{let a=_t(e,t),r=Ce.get(a);if(!r?.write||r.live==="none")return;if(r.live==="commit"){r.write(n);return}clearTimeout(Ye.get(a)),Ye.set(a,setTimeout(()=>{Ye.delete(a),Ce.get(a)?.write?.(n)},is))},pressField:(e,t,n)=>le(e,t)?.press?.(n),refresh:()=>{kn?.refreshData?.(),B()},toggleCategory:(e,t)=>{let n=wn?._collapsedSignalCats;if(!n)return;if(t)n.delete(e);else n.add(e);B()},toggleRow:(e)=>{ie(e,!Ut(e)),B()}};function Ds(e,t,n){let a=he.get(`${t}/${n}`);if(a){a(e);return}e.replaceChildren()}var pe=null;function Hk(e,t,n){let a=e.querySelector(".panel-content")??e;if(wn=t,kn=n,Pe(),pe&&(pe.host!==a||!pe.handle.attached()))pe.handle.dispose(),pe=null,Vt.clear(),It.clear(),fe=null;let r=Cs(t,n);if(pe){pe.handle.update(r);return}pe={handle:dr(a,r,Ps,Ds),host:a}}function js(){return Object.keys(u.value?.doc.document?.state??{})}function Ls(){function e(t,n){let r=(u.value?.doc.document?.state??{})[n];if(!r){let o=js();throw RangeError(`command "${t}" argument "name": "${n}" is not a state entry this document `+`defines — it defines: ${o.length>0?o.join(", "):"nothing"}`)}return r}return[{args:{additionalProperties:!1,properties:{defName:je("The state entry whose $expression to edit. Defaults to the selected one.")},required:[],type:"object"},category:"Document",id:"formula.openWorkspace",level:"document",menus:["palette"],group:"5_data",requires:"a selected state entry that holds a formula",when:(t)=>t.document.open,run:(t,n)=>{let a=Yo("formula.openWorkspace",n,"defName"),r=Wn(),o=a??(r.length===1?r[0]:null);if(o===null)throw RangeError(r.length>1?`command "formula.openWorkspace" needs a target: ${r.length} Data rows are open (${r.join(", ")}), so pass "defName"`:`command "formula.openWorkspace" needs a target: pass "defName", or open a state entry's row first with data.expandRow`);if(!e("formula.openWorkspace",o).$expression)throw RangeError(`command "formula.openWorkspace" argument "defName": "${o}" holds no `+"$expression — the workspace edits formulas, and this entry is not one");gu({editing:{defName:o,type:"def"},surface:"formula"})},title:"Open Formula Workspace"}]}function Bk(e){e.registerAll(Ls())}
3
- export{Vy,mu,Uy,k_,$k,Hg,Bg,E_,Dk,wl,sc,Lf,Ak,Nk,If,qy,zg,T_,gu,Ok,Mk,Gy,Uh,Ky,Pk,qh,Rf,xl,bu,Wg,nd,Jy,Yy,Zy,L_,Gh,I_,Fk,Da,Vg,Kh,R_,$_,jk,Aa,D_,Xy,A_,Hk,Bk};
4
-
5
- //# debugId=363A90EA5D6AE0EF64756E2164756E21
6
- //# sourceMappingURL=studio-bkv0sga4.js.map